1
0
Fork 0
forked from jriou/coller

feat: Pass encryption key in URL fragment

- Remove encryptionKey from URL
- Use POST method to pass both password and encryption key
- Parse URL fragment to extract the encryption key from the web (using
  javascript) and from the CLI

Fixes #36.

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-10-01 12:40:46 +02:00
commit ee7b5f0c6e
Signed by: jriou
GPG key ID: 9A099EDA51316854
8 changed files with 103 additions and 316 deletions

View file

@ -249,22 +249,20 @@ func handleMain() int {
noteURL := *url + "/" + fmt.Sprintf("%d", jsonBody.ID)
if *copier {
location = "copier"
if *encryptionKey != "" {
location += " -encryption-key " + *encryptionKey
}
if *password != "" {
location += " -password '" + *password + "'"
}
location += " " + noteURL
if *encryptionKey != "" {
location += "#" + *encryptionKey
}
} else {
location = noteURL
if *encryptionKey != "" {
location += "/" + *encryptionKey
}
if *html {
location += ".html"
} else {
location += "/raw"
}
if *encryptionKey != "" {
location += "#" + *encryptionKey
}
}

View file

@ -96,6 +96,11 @@ func handleMain() int {
}
u.Path = "api/note" + u.Path
if u.Fragment != "" {
*encryptionKey = u.Fragment
u.Fragment = ""
}
rawURL = u.String()
logger.Debug("creating http request")