diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-28 20:55:36 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-28 20:55:36 -0700 |
| commit | 25d822ed2251a8dfec8bf5934a067f38d22fae95 (patch) | |
| tree | 448c41de0dccf5143d0db409a26f50cf74ed0105 /roseh.moe.go | |
| parent | cbd368cd7549c544bcf64281f6b4126299665639 (diff) | |
| download | roseh.moe-25d822ed2251a8dfec8bf5934a067f38d22fae95.tar.zst | |
Switch to ccl
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/roseh.moe.go b/roseh.moe.go index 762eb4e..696b64e 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -8,7 +8,6 @@ import ( "embed" "encoding/base64" "encoding/binary" - "encoding/hex" "flag" "fmt" "html/template" @@ -20,7 +19,7 @@ import ( "sync" "time" - "roseh.moe/pkg/asspb" + "roseh.moe/pkg/ccl" "roseh.moe/pkg/roseh.moe/internal/pwhash" "roseh.moe/pkg/wordlist" ) @@ -28,8 +27,8 @@ import ( var ( port = flag.Int("port", 42069, "port to listen on") selfURL = flag.String("self-url", "http://localhost:42069", "base URL of the server") - secretsFile = flag.String("secrets", "secrets.ass", "secrets file") - configFile = flag.String("config", "config.ass", "configuration file (asspb format https://pkg.go.dev/roseh.moe/pkg/asspb)") + secretsFile = flag.String("secrets", "secrets.ccl", "secrets file") + configFile = flag.String("config", "config.ccl", "configuration file (ccl format https://pkg.go.dev/roseh.moe/pkg/ccl)") serverStartTime = time.Now() ) @@ -42,26 +41,20 @@ func loadSecrets() error { return err } var secretsConfig struct { - NotepadPassword string - SecretKey string + NotepadPassword []byte + SecretKey []byte } - if err := asspb.Unmarshal(fileBytes, &secretsConfig); err != nil { + if err := ccl.Unmarshal(fileBytes, &secretsConfig); err != nil { return fmt.Errorf("%s: %s", *secretsFile, err) } - if secretsConfig.NotepadPassword == "" { + if len(secretsConfig.NotepadPassword) == 0 { return fmt.Errorf("%s: missing notepad-password", *secretsFile) } - if secretsConfig.SecretKey == "" { + if len(secretsConfig.SecretKey) == 0 { return fmt.Errorf("%s: missing secret-key", *secretsFile) } - notepadPassword, err = hex.AppendDecode(nil, []byte(secretsConfig.NotepadPassword)) - if err != nil { - return fmt.Errorf("bad notepad password: %s", err) - } - secretKey, err = hex.AppendDecode(nil, []byte(secretsConfig.SecretKey)) - if err != nil { - return fmt.Errorf("bad secret key: %s", err) - } + notepadPassword = secretsConfig.NotepadPassword + secretKey = secretsConfig.SecretKey return nil } @@ -97,7 +90,7 @@ func loadConfig() (*serviceConfiguration, error) { var fileConfig struct { Redirect []struct{ Package, Command, To string } } - if err := asspb.Unmarshal(fileBytes, &fileConfig); err != nil { + if err := ccl.Unmarshal(fileBytes, &fileConfig); err != nil { return nil, err } config := &serviceConfiguration{ |
