From 01ea9f600825f3aa70b7fe2201b8e1c3db552cb3 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Wed, 26 Nov 2025 12:43:37 +0100 Subject: [PATCH] first attempt to get unified item creation menu --- documentation/API.md | 36 ---------------------------- frontend/app.js | 56 ++++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 62 deletions(-) diff --git a/documentation/API.md b/documentation/API.md index 3590808..fd3c567 100644 --- a/documentation/API.md +++ b/documentation/API.md @@ -429,41 +429,5 @@ All endpoints return JSON responses: ``` --- ---- - -## 🔒 Security & Rate Limiting - -### Authentication -When authentication is enabled (via `AUTHENTICATION_ENABLED` environment variable or `config.yaml`), all API endpoints require a valid session cookie obtained through the `/login` endpoint. - -### Rate Limiting -When `DEMO_MODE` is enabled, the following rate limits are enforced: - -**Read Operations:** -- `GET /api/notes` - 120/minute -- `GET /api/templates` - 120/minute -- `GET /api/templates/{template_name}` - 120/minute -- `GET /api/tags` - 120/minute -- `GET /api/tags/{tag}` - 120/minute - -**Write Operations:** -- `POST /api/notes` - 60/minute -- `DELETE /api/notes/*` - 60/minute -- `POST /api/folders` - 60/minute -- `DELETE /api/folders/*` - 60/minute -- `POST /api/images/upload` - 30/minute -- `DELETE /api/images/*` - 60/minute -- `POST /api/templates/create-note` - 60/minute -- `POST /api/plugins/*/toggle` - 60/minute - -### Path Security -All file operations validate that paths are within the configured `notes_dir` to prevent directory traversal attacks. This includes: -- Note operations -- Folder operations -- Image operations -- Template operations - ---- - 💡 **Tip:** Use the `/api` endpoint to get a live, self-documented list of all available endpoints! diff --git a/frontend/app.js b/frontend/app.js index 49364ef..9d7fc7e 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -99,6 +99,7 @@ function noteApp() { // Dropdown state showNewDropdown: false, + dropdownTargetFolder: '', // Folder context for "New" dropdown (empty = root) // Template state showTemplateModal: false, @@ -620,15 +621,16 @@ function noteApp() { } try { - // Determine the note path based on current context + // Determine the note path based on dropdown context let notePath = this.newTemplateNoteName.trim(); if (!notePath.endsWith('.md')) { notePath += '.md'; } - // If we're in a folder on the homepage, create in that folder - if (this.selectedHomepageFolder) { - notePath = `${this.selectedHomepageFolder}/${notePath}`; + // If we have a target folder context, create in that folder + if (this.dropdownTargetFolder || this.selectedHomepageFolder) { + const targetFolder = this.dropdownTargetFolder || this.selectedHomepageFolder; + notePath = `${targetFolder}/${notePath}`; } // Create note from template @@ -980,17 +982,11 @@ function noteApp() {
- + title="Add item here" + >+