edit-text icon indicating copy to clipboard operation
edit-text copied to clipboard

Going to http://sandbox.edit.io/?new=1 should open up a new page

Open tcr opened this issue 6 years ago • 1 comments

Right now, going to sandbox.edit.io (or a locally running edit-text instance) will open up the document that corresponds to the requester's IP address, e.g. /welcome-127-0-0-1. This code lives in edit-server.rs:

https://github.com/tcr/edit-text/blob/8bcb38a7f0ac1002b04c9b1b74495927ede2b2ae/edit-server/src/bin/edit-server.rs#L251-L301

We want to add another check just before this which looks to see if the parameter "new" exists, and if so, sets the id to a random value (using random_id_alpha). It should also set the document contents to default_doc(), so once it's generated there will be a basic document template for the user to edit.

Some expectations about how this works:

  • ?new=1 would redirect to a random document id with the header "Welcome" and some accompanying text.
  • If both new and from were supplied (e.g. ?new=1&from=markdown_content), we can assume that the "from" code will run last and take precedence.
  • The behavior for http://sandbox.edit.io/?new=1 should be identical to going to the URL http://sandbox.edit.io/?from=https:, which (due to a quirk of the code right now) does the same thing.

tcr avatar Dec 20 '18 01:12 tcr

Starting on it. 💻

briankabiro avatar Jan 08 '19 15:01 briankabiro