Skip to content

Conversation

@lucasew
Copy link

@lucasew lucasew commented Sep 30, 2023

This is a opt-in feature that, to be enabled, one must pass a flag (-use-set-tokens) or a environment variable (USE_SET_TOKENS) to enable.

Basically it allows the owner of a note to create edit tokens. The flow is the following:

  • User creates a note.
  • User creates a token for a note.
  • Server gives a full URL.
  • User can now set the content of that note by passing the content as body to the full URL of the previous step.
  • If funnel is enabled then the user can even use the tokens through the Internet using any machine that speaks HTTP and can connect to the Internet.

In practice:

  • go run -v ./cmd/tclipd -data-location /tmp/test-paste -hostname test-paste -tsnet-verbose -use-funnel -use-set-tokens
  • Create a note from the Web UI then a token on the note page
  • It will give you a full link like https://test-paste.stargazer-shark.ts.net/api/token/set/0d4f1364-548f-4fdd-ba08-d5e1c3503044
  • Change the content of the note using HTTP requests
    • Ex: curl https://test-paste.stargazer-shark.ts.net/api/token/set/0d4f1364-548f-4fdd-ba08-d5e1c3503044 -d blah

I also abstracted away some details like the function to assert that the request is in the form format to a function to reuse in other routes (before that this logic was only used once).

BTW I hope I got the CSS right lol.

@Erisa Erisa added the enhancement New feature or request label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants