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:
parent
1fcde736a8
commit
ee7b5f0c6e
8 changed files with 103 additions and 316 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue