4 Commits

Author SHA1 Message Date
573fba708e fix can't create entry 2025-08-17 17:45:50 +02:00
a7c85ea3c6 fix name 2025-08-17 01:12:31 +02:00
ea6948dbe2 Actualiser README.md 2025-08-17 00:50:56 +02:00
da2ad068b4 update version number 2025-08-17 00:43:58 +02:00
9 changed files with 29 additions and 14 deletions

View File

@@ -21,6 +21,8 @@ e.g.:
test:$2y$10$uULsuyROe3LVdTzFoBH7HO0zhvyKp6CX2FDNl7quXMFYqzitU0kc.
```
To generate bcrypt password, I recommand [hash_utils](https://git.thelilfrog.com/thelilfrog/hash_utils), which is offline and secure
The default path to this directory is `/var/lib/cloudsave`, this can be changed with the `-document-root` argument
### Client
@@ -45,7 +47,7 @@ Run this command to start the scan, if needed, the tool will create a new archiv
```bash
cloudsave scan
```
#### Send everythings on the server
#### Send everything on the server
This will pull and push data to the server.

View File

@@ -1,7 +1,7 @@
#!/bin/bash
MAKE_PACKAGE=false
VERSION=0.0.3
VERSION=0.0.4
usage() {
echo "Usage: $0 [OPTIONS]"

View File

@@ -11,24 +11,24 @@ import (
)
type (
ListCmd struct {
ApplyCmd struct {
Service *data.Service
}
)
func (*ListCmd) Name() string { return "apply" }
func (*ListCmd) Synopsis() string { return "apply a backup" }
func (*ListCmd) Usage() string {
func (*ApplyCmd) Name() string { return "apply" }
func (*ApplyCmd) Synopsis() string { return "apply a backup" }
func (*ApplyCmd) Usage() string {
return `Usage: cloudsave apply <GAME_ID> [BACKUP_ID]
Apply a backup
`
}
func (p *ListCmd) SetFlags(f *flag.FlagSet) {
func (p *ApplyCmd) SetFlags(f *flag.FlagSet) {
}
func (p *ListCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
func (p *ApplyCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
if f.NArg() < 1 {
fmt.Fprintln(os.Stderr, "error: missing game ID and/or backup uuid")
return subcommands.ExitUsageError

View File

@@ -71,7 +71,9 @@ func (p *ListCmd) local(includeBackup bool) error {
for _, g := range games {
fmt.Println("ID:", g.ID)
fmt.Println("Name:", g.Name)
fmt.Println("Last Version:", g.Date, "( Version Number", g.Version, ")")
fmt.Println("Last Version:", g.Date)
fmt.Println("Version:", g.Version)
fmt.Println("MD5:", g.MD5)
if includeBackup {
bk, err := p.Service.AllBackups(g.ID)
if err != nil {
@@ -108,7 +110,9 @@ func (p *ListCmd) server(url, username, password string, includeBackup bool) err
for _, g := range games {
fmt.Println("ID:", g.ID)
fmt.Println("Name:", g.Name)
fmt.Println("Last Version:", g.Date, "( Version Number", g.Version, ")")
fmt.Println("Last Version:", g.Date)
fmt.Println("Version:", g.Version)
fmt.Println("MD5:", g.MD5)
if includeBackup {
bk, err := cli.ListArchives(g.ID)
if err != nil {

View File

@@ -78,7 +78,7 @@ func (p *RemoteCmd) print() error {
for _, g := range games {
r, err := remote.One(g.ID)
if err != nil {
return fmt.Errorf("failed to load datastore: %w", err)
continue
}
cli := client.New(r.URL, "", "")

View File

@@ -51,7 +51,7 @@ func main() {
subcommands.Register(&remove.RemoveCmd{Service: s}, "management")
subcommands.Register(&show.ShowCmd{Service: s}, "management")
subcommands.Register(&apply.ListCmd{Service: s}, "restore")
subcommands.Register(&apply.ApplyCmd{Service: s}, "restore")
subcommands.Register(&remote.RemoteCmd{Service: s}, "remote")
subcommands.Register(&sync.SyncCmd{Service: s}, "remote")

View File

@@ -1,5 +1,5 @@
package constants
const Version = "0.0.5"
const Version = "0.0.4a"
const ApiVersion = 1

View File

@@ -36,7 +36,7 @@ func (s *Service) Add(name, path, remote string) (string, error) {
ID: gameID.Key(),
Name: name,
Path: path,
Version: 1,
Version: 0,
Date: time.Now(),
}
@@ -268,6 +268,8 @@ func (l Service) PullBackup(gameID, backupID string, cli *client.Client) error {
return fmt.Errorf("failed to pull backup: %w", err)
}
return nil
}

View File

@@ -213,6 +213,13 @@ func (l *LazyRepository) Metadata(id GameIdentifier) (Metadata, error) {
return Metadata{}, fmt.Errorf("corrupted datastore: failed to parse metadata: %w", err)
}
if _, err := os.Stat(filepath.Join(path, "data.tar.gz")); err != nil {
if errors.Is(err, os.ErrNotExist) {
return m, nil
}
return Metadata{}, fmt.Errorf("failed to open archive: %w", err)
}
m.MD5, err = hash.FileMD5(filepath.Join(path, "data.tar.gz"))
if err != nil {
return Metadata{}, fmt.Errorf("failed to calculate md5: %w", err)