summaryrefslogtreecommitdiff
path: root/lib/web/note/util.js (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add better logging messagesErik Michelson2021-03-291-2/+2
| | | | Signed-off-by: Erik Michelson <opensource@erik.michelson.eu>
* Check for existing notes on POST and dont override themErik Michelson2021-03-291-1/+14
| | | | | | Previously one could override notes in FreeURL-mode by sending multiple POST requests to the /new/<alias> endpoint. This commit adds a check for an already existing note with the requested alias and returns a HTTP 409 Conflict error in case that happens. Signed-off-by: Erik Michelson <opensource@erik.michelson.eu>
* Add HTTP 404 error on non-existent note downloadsErik Michelson2021-02-171-2/+5
| | | | | | | | When FreeURL mode is enabled and you called the /download route, the note was created and the user redirected to the blank note. This is caused because the findNote method automatically creates a note when no existing one is found. This commit adds a new parameter to the findNote method which allows to disable this behaviour. In that case a HTTP 404 error will be returned. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
* Add config option which requires authentication in FreeURL modeNicolas Dietrich2021-01-221-1/+1
| | | | | | | | | This mitigates unintended note creation by bots or humans through a simple GET call. See discussion in #754. Signed-off-by: Nicolas Dietrich <nidi@mailbox.org>
* Minor refactoring of freeURL condition checkNicolas Dietrich2021-01-221-4/+6
| | | | Signed-off-by: Nicolas Dietrich <nidi@mailbox.org>
* Save note title to database when creating a noteDavid Mehren2020-11-111-1/+2
| | | | | | | | Currently, when creating a note with content via the API, a title is only saved to the database after visiting the note with the browser. This commit makes sure that a title is saved at creation time. Closes #306 Signed-off-by: David Mehren <git@herrmehren.de>
* Fixed meta parsing of lang-attribute for using it in the published-viewErik Michelson2020-07-041-1/+1
| | | | Signed-off-by: Erik Michelson <github@erik.michelson.eu>
* Added dynamic lang-attr to pretty.ejsErik Michelson2020-07-031-0/+1
| | | | | | CodiMD currently only uses the 'lang' attribute in YAML-metadata of a note for setting certain js-elements of the markdown-renderer. This commit adds the chosen lang into the published version of a note. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
* findNoteOrCreate: Create new note with empty string instead of `null`Sandro2020-04-281-1/+1
| | | | | | Backport of #345 to 1.x Signed-off-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
* Backport Fix for relative theme pathSheogorath2020-03-211-1/+1
| | | | | | This commit backport 856fc01fb9b30489b254f2ef9d29de80aa189118 Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
* Move showPublishNote and publishNoteActions to note controllerDavid Mehren2019-10-271-0/+42
| | | | Signed-off-by: David Mehren <dmehren1@gmail.com>
* Move note actions to their own file.David Mehren2019-10-271-0/+67
Because of circular import problems, this commit also moves the error messages from response.js to errors.js Signed-off-by: David Mehren <dmehren1@gmail.com>