From e9fb63affc53fabe158408d3a269af959034797b Mon Sep 17 00:00:00 2001 From: Galen Huntington Date: Tue, 21 Jan 2025 06:43:36 -0800 Subject: [PATCH 01/41] Sign CLA. (#8899) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index 6f16cad99ec..e6c177766b3 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -605,3 +605,5 @@ Thomas E Tuoti, @well-noted, 2024/12/16 @opn, 2025/01/04 J. Ryan Stinnett, @jryans, 2025/01/04 + +Galen Huntington, @galenhuntington, 2025/01/19 From 9aed6a52488e4081e4e092aa4c5de940538d9d1e Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 23 Jan 2025 18:05:56 +0000 Subject: [PATCH 02/41] Update CI due to deprecation of actions/upload-artifact@v3 See https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/ --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75c3bb8d329..ed16d707d28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-test.sh" - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: name: playwright-report @@ -30,8 +30,8 @@ jobs: TW5_BUILD_MAIN_EDITION: "./editions/prerelease" TW5_BUILD_OUTPUT: "./output/prerelease" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-pre-build.sh" @@ -62,8 +62,8 @@ jobs: TW5_BUILD_OUTPUT: "./output" TW5_BUILD_ARCHIVE: "./output" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-pre-build.sh" From b04af8bf7ae04dc371d9c29d4c69bea2b23a9557 Mon Sep 17 00:00:00 2001 From: Galen Huntington Date: Thu, 23 Jan 2025 10:18:02 -0800 Subject: [PATCH 03/41] Bug fix: TTF extension was wrong. update font types, add OTF type. (#8898) * Bug fix: TTF extension was wrong. * Update font MIME types throughout; add font/otf. --- boot/boot.js | 7 ++++--- plugins/tiddlywiki/katex/files/tiddlywiki.files | 4 ++-- themes/tiddlywiki/starlight/arvo.woff.meta | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index ab403aa5ae8..7570dade576 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -2467,9 +2467,10 @@ $tw.boot.initStartup = function(options) { $tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]}); $tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]}); $tw.utils.registerFileType("application/wasm","base64",".wasm"); - $tw.utils.registerFileType("application/font-woff","base64",".woff"); - $tw.utils.registerFileType("application/x-font-ttf","base64",".woff"); - $tw.utils.registerFileType("application/font-woff2","base64",".woff2"); + $tw.utils.registerFileType("font/woff","base64",".woff"); + $tw.utils.registerFileType("font/woff2","base64",".woff2"); + $tw.utils.registerFileType("font/ttf","base64",".ttf"); + $tw.utils.registerFileType("font/otf","base64",".otf"); $tw.utils.registerFileType("audio/ogg","base64",".ogg"); $tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]); $tw.utils.registerFileType("video/ogg","base64",[".ogm",".ogv",".ogg"]); diff --git a/plugins/tiddlywiki/katex/files/tiddlywiki.files b/plugins/tiddlywiki/katex/files/tiddlywiki.files index 6dd868a1031..506a0f4482f 100644 --- a/plugins/tiddlywiki/katex/files/tiddlywiki.files +++ b/plugins/tiddlywiki/katex/files/tiddlywiki.files @@ -6,7 +6,7 @@ "isTiddlerFile": false, "fields": { "title": {"source": "filename", "prefix": "$:/plugins/tiddlywiki/katex/fonts/"}, - "type": "application/font-woff" + "type": "font/woff" } } ], @@ -37,4 +37,4 @@ "suffix": "})(require);\n" } ] -} \ No newline at end of file +} diff --git a/themes/tiddlywiki/starlight/arvo.woff.meta b/themes/tiddlywiki/starlight/arvo.woff.meta index 19b089408b5..97732f909ec 100644 --- a/themes/tiddlywiki/starlight/arvo.woff.meta +++ b/themes/tiddlywiki/starlight/arvo.woff.meta @@ -1,2 +1,2 @@ title: $:/themes/tiddlywiki/starlight/arvo.woff -type: application/font-woff +type: font/woff From 903d0fb8e12c5ef361dc816da3fa9d464de91e6a Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 23 Jan 2025 21:47:22 +0000 Subject: [PATCH 04/41] Update CI due to deprecation of actions/upload-artifact@v3 See https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/ --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75c3bb8d329..ed16d707d28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-test.sh" - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: name: playwright-report @@ -30,8 +30,8 @@ jobs: TW5_BUILD_MAIN_EDITION: "./editions/prerelease" TW5_BUILD_OUTPUT: "./output/prerelease" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-pre-build.sh" @@ -62,8 +62,8 @@ jobs: TW5_BUILD_OUTPUT: "./output" TW5_BUILD_ARCHIVE: "./output" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "${{ env.NODE_VERSION }}" - run: "./bin/ci-pre-build.sh" From 0219af604bd3450d68a1ca96250c28db24b117bb Mon Sep 17 00:00:00 2001 From: Rhys-T <108157737+Rhys-T@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:48:45 -0500 Subject: [PATCH 05/41] Sign the CLA (#8904) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index e6c177766b3..f827a3f2be3 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -607,3 +607,5 @@ Thomas E Tuoti, @well-noted, 2024/12/16 J. Ryan Stinnett, @jryans, 2025/01/04 Galen Huntington, @galenhuntington, 2025/01/19 + +@Rhys-T, 2025/01/23 From 94b325f41f778238fbbd550873723571801f43a4 Mon Sep 17 00:00:00 2001 From: Rhys-T <108157737+Rhys-T@users.noreply.github.com> Date: Sat, 25 Jan 2025 05:59:51 -0500 Subject: [PATCH 06/41] Fix: Don't set dirty flag when shadow tiddler changes (#8903) Adds `shadow` and `normal` flags to each entry in `changedTiddlers`, indicating whether the corresponding version of the tiddler has changed. Makes the saver handler ignore any changes that aren't flagged `normal`. Fixes #8902. --- core/modules/saver-handler.js | 6 ++++-- core/modules/startup/plugins.js | 2 +- core/modules/wiki.js | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index 23056bcc2c0..612613140eb 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -46,8 +46,10 @@ function SaverHandler(options) { // Filter the changes so that we only count changes to tiddlers that we care about var filteredChanges = self.filterFn.call(self.wiki,function(iterator) { $tw.utils.each(changes,function(change,title) { - var tiddler = self.wiki.getTiddler(title); - iterator(tiddler,title); + if(change.normal) { + var tiddler = self.wiki.getTiddler(title); + iterator(tiddler,title); + } }); }); // Adjust the number of changes diff --git a/core/modules/startup/plugins.js b/core/modules/startup/plugins.js index fc8ba95894d..af354c38e8d 100644 --- a/core/modules/startup/plugins.js +++ b/core/modules/startup/plugins.js @@ -75,7 +75,7 @@ exports.startup = function() { $tw.wiki.unpackPluginTiddlers(); // Queue change events for the changed shadow tiddlers $tw.utils.each(Object.keys(changedShadowTiddlers),function(title) { - $tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title]); + $tw.wiki.enqueueTiddlerEvent(title,changedShadowTiddlers[title], true); }); } } diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 620f4eccfa1..928a2e8470e 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -141,12 +141,15 @@ This method should be called after the changes it describes have been made to th title: Title of tiddler isDeleted: defaults to false (meaning the tiddler has been created or modified), true if the tiddler has been deleted + isShadow: defaults to false (meaning the change applies to the normal tiddler), + true if the tiddler being changed is a shadow tiddler */ -exports.enqueueTiddlerEvent = function(title,isDeleted) { +exports.enqueueTiddlerEvent = function(title,isDeleted,isShadow) { // Record the touch in the list of changed tiddlers this.changedTiddlers = this.changedTiddlers || Object.create(null); this.changedTiddlers[title] = this.changedTiddlers[title] || Object.create(null); this.changedTiddlers[title][isDeleted ? "deleted" : "modified"] = true; + this.changedTiddlers[title][isShadow ? "shadow" : "normal"] = true; // Increment the change count this.changeCount = this.changeCount || Object.create(null); if($tw.utils.hop(this.changeCount,title)) { From f02c9ebba3a95117baa8e55220ab79e18d84edef Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Sun, 26 Jan 2025 13:25:01 +0100 Subject: [PATCH 07/41] feat: support for avif images (#8911) --- boot/boot.js | 1 + core/modules/parsers/imageparser.js | 1 + 2 files changed, 2 insertions(+) diff --git a/boot/boot.js b/boot/boot.js index 7570dade576..2efa58b1d18 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -2463,6 +2463,7 @@ $tw.boot.initStartup = function(options) { $tw.utils.registerFileType("image/webp","base64",".webp",{flags:["image"]}); $tw.utils.registerFileType("image/heic","base64",".heic",{flags:["image"]}); $tw.utils.registerFileType("image/heif","base64",".heif",{flags:["image"]}); + $tw.utils.registerFileType("image/avif","base64",".avif",{flags:["image"]}); $tw.utils.registerFileType("image/svg+xml","utf8",".svg",{flags:["image"]}); $tw.utils.registerFileType("image/vnd.microsoft.icon","base64",".ico",{flags:["image"]}); $tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]}); diff --git a/core/modules/parsers/imageparser.js b/core/modules/parsers/imageparser.js index a964a4ba8fb..d594803b290 100644 --- a/core/modules/parsers/imageparser.js +++ b/core/modules/parsers/imageparser.js @@ -40,6 +40,7 @@ exports["image/gif"] = ImageParser; exports["image/webp"] = ImageParser; exports["image/heic"] = ImageParser; exports["image/heif"] = ImageParser; +exports["image/avif"] = ImageParser; exports["image/x-icon"] = ImageParser; exports["image/vnd.microsoft.icon"] = ImageParser; From 42c22acba629030e3a016cd4a758a3cb17ac453a Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Mon, 27 Jan 2025 12:00:07 +0100 Subject: [PATCH 08/41] Cleans up cruft from edit widget (#8897) * chore: cleanup cruft from edit widget * chore: cleanup cruft from edit widget * chore: cleanup cruft from edit widget --- core/modules/widgets/edit.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/core/modules/widgets/edit.js b/core/modules/widgets/edit.js index eb7758e9086..e4433e1da06 100644 --- a/core/modules/widgets/edit.js +++ b/core/modules/widgets/edit.js @@ -43,15 +43,6 @@ EditWidget.prototype.execute = function() { // Get our parameters this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); this.editField = this.getAttribute("field","text"); - this.editIndex = this.getAttribute("index"); - this.editClass = this.getAttribute("class"); - this.editPlaceholder = this.getAttribute("placeholder"); - this.editTabIndex = this.getAttribute("tabindex"); - this.editFocus = this.getAttribute("focus",""); - this.editCancelPopups = this.getAttribute("cancelPopups",""); - this.editInputActions = this.getAttribute("inputActions"); - this.editRefreshTitle = this.getAttribute("refreshTitle"); - this.editAutoComplete = this.getAttribute("autocomplete"); // Choose the appropriate edit widget this.editorType = this.getEditorType(); // Make the child widgets @@ -89,8 +80,8 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ EditWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - // Refresh if an attribute has changed, or the type associated with the target tiddler has changed - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (this.getEditorType() !== this.editorType)) { + // Refresh if the editor type has changed + if(changedAttributes.tiddler || changedAttributes.field || (this.getEditorType() !== this.editorType)) { this.refreshSelf(); return true; } else { From b1843837ea2eecd26a8691d42517f447611bb31c Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Mon, 27 Jan 2025 12:00:26 +0100 Subject: [PATCH 09/41] Fixes unnecessary refresh in Genesis widget (#8895) * fix: handle attributes correctly in genesis widget * fix: handle attributes correctly in genesis widget --- core/modules/widgets/genesis.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/modules/widgets/genesis.js b/core/modules/widgets/genesis.js index 299be1e487b..a527553ad29 100644 --- a/core/modules/widgets/genesis.js +++ b/core/modules/widgets/genesis.js @@ -23,15 +23,21 @@ Inherit from the base widget class */ GenesisWidget.prototype = new Widget(); +GenesisWidget.prototype.computeAttributes = function(options) { + options = options || Object.create(null); + options.filterFn = function(name) { + // Only compute our own attributes which start with a single dollar + return name.charAt(0) === "$" && name.charAt(1) !== "$"; + } + return Widget.prototype.computeAttributes.call(this,options); +}; + /* Render this widget into the DOM */ GenesisWidget.prototype.render = function(parent,nextSibling) { this.parentDomNode = parent; - this.computeAttributes({filterFn: function(name) { - // Only compute our own attributes which start with a single dollar - return name.charAt(0) === "$" && name.charAt(1) !== "$"; - }}); + this.computeAttributes(); this.execute(); this.renderChildren(parent,nextSibling); }; From 67e8670c73a944c4c9dab8bb101704878c6ff4cc Mon Sep 17 00:00:00 2001 From: Leilei332 Date: Tue, 28 Jan 2025 00:45:26 +0800 Subject: [PATCH 10/41] Extend copy to clipborad function to support customized mime types (#8912) * Extend copy to clipborad function to support customized mime types * Remove function default parameter syntax * Add plainText option * Use plainText name * Set "text/plain" data only when it exists * Docs update * Docs update --- core/modules/startup/rootwidget.js | 5 +++-- core/modules/utils/dom/dom.js | 15 +++++++++++---- core/wiki/macros/copy-to-clipboard.tid | 18 ++++++++++-------- .../macros/copy-to-clipboard Macro.tid | 6 +++++- .../copy-to-clipboard Macro (Examples).tid | 10 ++++++++-- .../WidgetMessage_ tm-copy-to-clipboard.tid | 4 +++- 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/core/modules/startup/rootwidget.js b/core/modules/startup/rootwidget.js index d96d569c366..8496b48dfda 100644 --- a/core/modules/startup/rootwidget.js +++ b/core/modules/startup/rootwidget.js @@ -77,8 +77,9 @@ exports.startup = function() { $tw.rootWidget.addEventListener("tm-copy-to-clipboard",function(event) { $tw.utils.copyToClipboard(event.param,{ successNotification: event.paramObject && event.paramObject.successNotification, - failureNotification: event.paramObject && event.paramObject.failureNotification - }); + failureNotification: event.paramObject && event.paramObject.failureNotification, + plainText: event.paramObject && event.paramObject.plainText + },event.paramObject.type); }); // Install the tm-focus-selector message $tw.rootWidget.addEventListener("tm-focus-selector",function(event) { diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 0b71e128c31..5f33bbeea99 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -268,9 +268,10 @@ exports.copyStyles = function(srcDomNode,dstDomNode) { /* Copy plain text to the clipboard on browsers that support it */ -exports.copyToClipboard = function(text,options) { - options = options || {}; - text = text || ""; +exports.copyToClipboard = function(text,options,type) { + var text = text || ""; + var options = options || {}; + var type = type || "text/plain"; var textArea = document.createElement("textarea"); textArea.style.position = "fixed"; textArea.style.top = 0; @@ -283,10 +284,16 @@ exports.copyToClipboard = function(text,options) { textArea.style.outline = "none"; textArea.style.boxShadow = "none"; textArea.style.background = "transparent"; - textArea.value = text; document.body.appendChild(textArea); textArea.select(); textArea.setSelectionRange(0,text.length); + textArea.addEventListener("copy",function(event) { + event.preventDefault(); + if (options.plainText) { + event.clipboardData.setData("text/plain",options.plainText); + } + event.clipboardData.setData(type,text); + }); var succeeded = false; try { succeeded = document.execCommand("copy"); diff --git a/core/wiki/macros/copy-to-clipboard.tid b/core/wiki/macros/copy-to-clipboard.tid index d05d014e2ca..f299cf955d0 100644 --- a/core/wiki/macros/copy-to-clipboard.tid +++ b/core/wiki/macros/copy-to-clipboard.tid @@ -3,9 +3,11 @@ tags: $:/tags/Macro \whitespace trim -\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style) -<$button message="tm-copy-to-clipboard" - param=<> +\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style,type:"text/plain",plain) +\procedure copy-to-clipboard-actions() +<$action-sendmessage $message="tm-copy-to-clipboard" $param=<> type=<> plainText=<>/> +\end copy-to-clipboard-actions +<$button actions=<> class=<> style=< - diff --git a/editions/translators/tiddlers/Extracting Translations.tid b/editions/translators/tiddlers/Extracting Translations.tid index 3fe559e10d1..c29d7a40eba 100644 --- a/editions/translators/tiddlers/Extracting Translations.tid +++ b/editions/translators/tiddlers/Extracting Translations.tid @@ -12,7 +12,6 @@ Use this procedure if the language being submitted is not already present in the # Create the new language folder `languages/xx-XX` # Copy the language files into the language folder # Create a `plugin.info` file for the translation -# Create an appropriate flag image in `icon.tid` # Add the new language to tw5.com # Submit a pull request diff --git a/editions/tw5.com/tiddlers/images/external/tiddlywiki.files b/editions/tw5.com/tiddlers/images/external/tiddlywiki.files deleted file mode 100644 index 340199e41af..00000000000 --- a/editions/tw5.com/tiddlers/images/external/tiddlywiki.files +++ /dev/null @@ -1,202 +0,0 @@ -{ - "tiddlers": [ - { - "file": "../../../../../languages/ca-ES/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: ca-ES", - "language": "ca-ES", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/cs-CZ/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: cs-CZ", - "language": "cs-CZ", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/da-DK/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: da-DK", - "language": "da-DK", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/de-AT/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: de-AT", - "language": "de-AT", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/de-DE/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: de-DE", - "language": "de-DE", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/el-GR/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: el-GR", - "language": "el-GR", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/en-US/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: en-US", - "language": "en-US", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/es-ES/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: es-ES", - "language": "es-ES", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/fr-FR/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: fr-FR", - "language": "fr-FR", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/hi-IN/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: hi-IN", - "language": "hi-IN", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/ia-IA/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: ia-IA", - "language": "ia-IA", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/it-IT/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: it-IT", - "language": "it-IT", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/ja-JP/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: ja-JP", - "language": "ja-JP", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/ko-KR/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: ko-KR", - "language": "ko-KR", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/nl-NL/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: nl-NL", - "language": "nl-NL", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/pa-IN/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: pa-IN", - "language": "pa-IN", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/pt-PT/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: pt-PT", - "language": "pt-PT", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/ru-RU/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: ru-RU", - "language": "ru-RU", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/sk-SK/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: sk-SK", - "language": "sk-SK", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/sv-SE/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: sv-SE", - "language": "sv-SE", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/zh-Hans/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: zh-Hans", - "language": "zh-Hans", - "tags": "Language Icon" - } - }, - { - "file": "../../../../../languages/zh-Hant/icon.tid", - "isTiddlerFile": true, - "fields": { - "title": "Language Icon: zh-Hant", - "language": "zh-Hant", - "tags": "Language Icon" - } - } - ] -} diff --git a/editions/tw5.com/tiddlers/languages/LanguageGallery.tid b/editions/tw5.com/tiddlers/languages/LanguageGallery.tid deleted file mode 100644 index cdb97209566..00000000000 --- a/editions/tw5.com/tiddlers/languages/LanguageGallery.tid +++ /dev/null @@ -1,25 +0,0 @@ -created: 20151231083708980 -modified: 20211117212723856 -tags: Languages -title: LanguageGallery Example -type: text/vnd.tiddlywiki - -Here is an example of using the ListWidget and the TranscludeWidget to show a grid of all of Language Icons which are tiddlers [[tagged|Tagging]] <>and <> - - - diff --git a/languages/ar-PS/icon.tid b/languages/ar-PS/icon.tid deleted file mode 100644 index fecb187cdee..00000000000 --- a/languages/ar-PS/icon.tid +++ /dev/null @@ -1,7 +0,0 @@ -created: 20200618172251289 -modified: 20200618172321223 -tags: -title: $:/languages/ar-PS/icon -type: image/svg+xml - - diff --git a/languages/ca-ES/icon.tid b/languages/ca-ES/icon.tid deleted file mode 100644 index 264124da324..00000000000 --- a/languages/ca-ES/icon.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/languages/ca-ES/icon -type: image/svg+xml - - - - - - \ No newline at end of file diff --git a/languages/cs-CZ/icon.tid b/languages/cs-CZ/icon.tid deleted file mode 100644 index 4246c25dbbc..00000000000 --- a/languages/cs-CZ/icon.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/languages/cs-CZ/icon -type: image/svg+xml - - - - - - - diff --git a/languages/da-DK/icon.tid b/languages/da-DK/icon.tid deleted file mode 100644 index 955f38a94ec..00000000000 --- a/languages/da-DK/icon.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/languages/da-DK/icon -type: image/svg+xml - - - - - - - diff --git a/languages/de-AT/icon.tid b/languages/de-AT/icon.tid deleted file mode 100644 index a0b4315b0e0..00000000000 --- a/languages/de-AT/icon.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/languages/de-AT/icon -type: image/svg+xml - - - - - - \ No newline at end of file diff --git a/languages/de-DE/icon.tid b/languages/de-DE/icon.tid deleted file mode 100644 index 4847c1df009..00000000000 --- a/languages/de-DE/icon.tid +++ /dev/null @@ -1,12 +0,0 @@ -title: $:/languages/de-DE/icon -type: image/svg+xml - - - - - Flag of Germany - - - - diff --git a/languages/el-GR/icon.tid b/languages/el-GR/icon.tid deleted file mode 100644 index 787a5f6ade0..00000000000 --- a/languages/el-GR/icon.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/languages/el-GR/icon -type: image/svg+xml - - - Flag of Greece - - - \ No newline at end of file diff --git a/languages/en-PH/icon.tid b/languages/en-PH/icon.tid deleted file mode 100644 index c664ed2f0e8..00000000000 --- a/languages/en-PH/icon.tid +++ /dev/null @@ -1,21 +0,0 @@ -title: $:/languages/en-PH/icon -type: image/svg+xml - - - Flag of the Philippines - - - - - - - - - - - - - - - - diff --git a/languages/en-US/icon.tid b/languages/en-US/icon.tid deleted file mode 100644 index 78681f521c5..00000000000 --- a/languages/en-US/icon.tid +++ /dev/null @@ -1,29 +0,0 @@ -title: $:/languages/en-US/icon -type: image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/languages/es-ES/icon.tid b/languages/es-ES/icon.tid deleted file mode 100644 index 092788da758..00000000000 --- a/languages/es-ES/icon.tid +++ /dev/null @@ -1,409 +0,0 @@ -title: $:/languages/es-ES/icon -type: image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/languages/fa-IR/icon.tid b/languages/fa-IR/icon.tid deleted file mode 100644 index 70e60562982..00000000000 --- a/languages/fa-IR/icon.tid +++ /dev/null @@ -1,14 +0,0 @@ -title: $:/languages/fa-IR/icon -type: image/svg+xml - - - - - - - - \ No newline at end of file diff --git a/languages/fr-FR/icon.tid b/languages/fr-FR/icon.tid deleted file mode 100644 index a7ec4d9d08a..00000000000 --- a/languages/fr-FR/icon.tid +++ /dev/null @@ -1,5 +0,0 @@ -title: $:/languages/fr-FR/icon -type: image/svg+xml - - - diff --git a/languages/he-IL/icon.tid b/languages/he-IL/icon.tid deleted file mode 100644 index c18b4a1583a..00000000000 --- a/languages/he-IL/icon.tid +++ /dev/null @@ -1,38 +0,0 @@ -title: $:/languages/he-IL/icon -type: image/svg+xml - - - - - Flag of Israel - - - - - - - - - - - - diff --git a/languages/hi-IN/icon.tid b/languages/hi-IN/icon.tid deleted file mode 100644 index 4db8115ff0d..00000000000 --- a/languages/hi-IN/icon.tid +++ /dev/null @@ -1,4 +0,0 @@ -title: $:/languages/hi-IN/icon -type: image/svg+xml - - \ No newline at end of file diff --git a/languages/ia-IA/icon.tid b/languages/ia-IA/icon.tid deleted file mode 100644 index 72eff65ed3b..00000000000 --- a/languages/ia-IA/icon.tid +++ /dev/null @@ -1,13 +0,0 @@ -title: $:/languages/ia-IA/icon -type: image/svg+xml - - - - - Interlingua Logo - Created with Sketch. - - - - - \ No newline at end of file diff --git a/languages/it-IT/icon.tid b/languages/it-IT/icon.tid deleted file mode 100644 index 157744a52c4..00000000000 --- a/languages/it-IT/icon.tid +++ /dev/null @@ -1,32 +0,0 @@ -title: $:/languages/it-IT/icon -type: image/svg+xml - - - - - Bandiera della Repubblica Italiana PMS 20060414 - - - - - \ No newline at end of file diff --git a/languages/ja-JP/icon.tid b/languages/ja-JP/icon.tid deleted file mode 100644 index 56a7d6efbc6..00000000000 --- a/languages/ja-JP/icon.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/languages/ja-JP/icon -type: image/svg+xml - - - - - - - \ No newline at end of file diff --git a/languages/ko-KR/icon.tid b/languages/ko-KR/icon.tid deleted file mode 100644 index 83eda528766..00000000000 --- a/languages/ko-KR/icon.tid +++ /dev/null @@ -1,15 +0,0 @@ -title: $:/languages/ko-KR/icon -type: image/svg+xml - - - -Flag of South Korea - - - - - - - - - \ No newline at end of file diff --git a/languages/mk-MK/icon.tid b/languages/mk-MK/icon.tid deleted file mode 100644 index 20525ace9a2..00000000000 --- a/languages/mk-MK/icon.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/languages/mk-MK/icon -type: image/svg+xml - - - - - - diff --git a/languages/nl-NL/icon.tid b/languages/nl-NL/icon.tid deleted file mode 100644 index 9cb61ccea33..00000000000 --- a/languages/nl-NL/icon.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/languages/nl-NL/icon -type: image/svg+xml - - - - - - - \ No newline at end of file diff --git a/languages/pa-IN/icon.tid b/languages/pa-IN/icon.tid deleted file mode 100644 index 2efc09d0fe5..00000000000 --- a/languages/pa-IN/icon.tid +++ /dev/null @@ -1,4 +0,0 @@ -title: $:/languages/pa-IN/icon -type: image/svg+xml - - \ No newline at end of file diff --git a/languages/pl-PL/icon.tid b/languages/pl-PL/icon.tid deleted file mode 100644 index 0cecbb24a89..00000000000 --- a/languages/pl-PL/icon.tid +++ /dev/null @@ -1,7 +0,0 @@ -title: $:/languages/pl-PL/icon -type: image/svg+xml - - - - - \ No newline at end of file diff --git a/languages/pt-BR/icon.tid b/languages/pt-BR/icon.tid deleted file mode 100644 index 28daecd9ca3..00000000000 --- a/languages/pt-BR/icon.tid +++ /dev/null @@ -1,54 +0,0 @@ -title: $:/languages/pt-BR/icon -type: image/svg+xml - - -image/svg+xml \ No newline at end of file diff --git a/languages/pt-PT/icon.tid b/languages/pt-PT/icon.tid deleted file mode 100644 index 8c15895135f..00000000000 --- a/languages/pt-PT/icon.tid +++ /dev/null @@ -1,70 +0,0 @@ -title: $:/languages/pt-PT/icon -type: image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/languages/ru-RU/icon.tid b/languages/ru-RU/icon.tid deleted file mode 100644 index 3ea67a7b2a6..00000000000 --- a/languages/ru-RU/icon.tid +++ /dev/null @@ -1,10 +0,0 @@ -title: $:/languages/ru-RU/icon -type: image/svg+xml - - - - - - - - \ No newline at end of file diff --git a/languages/sk-SK/icon.tid b/languages/sk-SK/icon.tid deleted file mode 100644 index 626942b82b4..00000000000 --- a/languages/sk-SK/icon.tid +++ /dev/null @@ -1,17 +0,0 @@ -title: $:/languages/sk-SK/icon -type: image/svg+xml - - - -Flag of Slovakia - - - - - - - - - - - \ No newline at end of file diff --git a/languages/sl-SI/icon.tid b/languages/sl-SI/icon.tid deleted file mode 100644 index b3b8d0584f6..00000000000 --- a/languages/sl-SI/icon.tid +++ /dev/null @@ -1,28 +0,0 @@ -title: $:/languages/sl-SI/icon -type: image/svg+xml - - - - - Flag of Slovenia - - - - - - - - - - - - - - - - - - - - - diff --git a/languages/sv-SE/icon.tid b/languages/sv-SE/icon.tid deleted file mode 100755 index e8e16a6aee4..00000000000 --- a/languages/sv-SE/icon.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/languages/sv-SE/icon -type: image/svg+xml - - - - - - \ No newline at end of file diff --git a/languages/zh-CN/icon.tid b/languages/zh-CN/icon.tid deleted file mode 100644 index 29cb7b9f1a0..00000000000 --- a/languages/zh-CN/icon.tid +++ /dev/null @@ -1,18 +0,0 @@ -title: $:/languages/zh-CN/icon -type: image/svg+xml - - - - -Flag of the People's Republic of China - - - - - - - - - - diff --git a/languages/zh-HK/icon.tid b/languages/zh-HK/icon.tid deleted file mode 100644 index 38c8ff0961d..00000000000 --- a/languages/zh-HK/icon.tid +++ /dev/null @@ -1,16 +0,0 @@ -title: $:/languages/zh-HK/icon -type: image/svg+xml - - - - - - - - - - - - - - \ No newline at end of file diff --git a/languages/zh-Hans/icon.tid b/languages/zh-Hans/icon.tid deleted file mode 100644 index ba8400636f0..00000000000 --- a/languages/zh-Hans/icon.tid +++ /dev/null @@ -1,18 +0,0 @@ -title: $:/languages/zh-Hans/icon -type: image/svg+xml - - - - -Flag of the People's Republic of China - - - - - - - - - - diff --git a/languages/zh-Hant/icon.tid b/languages/zh-Hant/icon.tid deleted file mode 100644 index 97c8f6ab4ae..00000000000 --- a/languages/zh-Hant/icon.tid +++ /dev/null @@ -1,14 +0,0 @@ -title: $:/languages/zh-Hant/icon -type: image/svg+xml - - - - - - - - - - - - \ No newline at end of file diff --git a/languages/zh-TW/icon.tid b/languages/zh-TW/icon.tid deleted file mode 100644 index 5db3cae30cd..00000000000 --- a/languages/zh-TW/icon.tid +++ /dev/null @@ -1,14 +0,0 @@ -title: $:/languages/zh-TW/icon -type: image/svg+xml - - - - - - - - - - - - \ No newline at end of file From 0f79f88f5897296de67148ee0bba0416fa8af607 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Mon, 24 Feb 2025 21:49:48 +0100 Subject: [PATCH 36/41] Fix problem toc-selective-expandable (#8959) fix problem toc-selective-expandable --- core/wiki/macros/toc.tid | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index 2bbc4f6fcc5..4238c3a46ef 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -1,7 +1,6 @@ title: $:/core/macros/toc tags: $:/tags/Macro - \define toc-open-icon() $:/core/images/down-arrow \define toc-closed-icon() $:/core/images/right-arrow @@ -121,7 +120,7 @@ tags: $:/tags/Macro <$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item" >
  • >> <$link to={{{ [get[target]else] }}}> - <$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}"> + <$list filter="[all[current]tagging[]$sort$] -[subfilter<__exclude__>] +[limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}"> <$reveal type="nomatch" stateTitle=<> text="open"> <$button setTitle=<> setTo="open" class="tc-btn-invisible tc-popup-keep"> <$transclude tiddler=<> /> @@ -148,7 +147,7 @@ tags: $:/tags/Macro <$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix] }}}> <$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
  • >> - <$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}<>"""> + <$list filter="[all[current]tagging[]$sort$] -[subfilter<__exclude__>] +[limit[1]]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}<>"""> <$reveal type="nomatch" stateTitle=<> text="open"> <$button setTitle=<> setTo="open" class="tc-btn-invisible tc-popup-keep"> <$transclude tiddler=<> /> From 0dda07e3f194f344af7665b6d7fb7fca8970bccb Mon Sep 17 00:00:00 2001 From: Cameron Fischer Date: Thu, 27 Feb 2025 13:02:43 -0500 Subject: [PATCH 37/41] Fix for #5930: missing tiddlers with checkbox indexes (#8964) --- core/modules/widgets/checkbox.js | 2 +- .../tiddlers/tests/test-checkbox-widget.js | 28 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/core/modules/widgets/checkbox.js b/core/modules/widgets/checkbox.js index bf0a7bb796d..9d3a074148a 100644 --- a/core/modules/widgets/checkbox.js +++ b/core/modules/widgets/checkbox.js @@ -157,7 +157,7 @@ CheckboxWidget.prototype.getValue = function() { if(this.checkboxTag) { return false; } - if(this.checkboxField) { + if(this.checkboxField || this.checkboxIndex) { if(this.checkboxDefault === this.checkboxChecked) { return true; } diff --git a/editions/test/tiddlers/tests/test-checkbox-widget.js b/editions/test/tiddlers/tests/test-checkbox-widget.js index f42a269a9a7..936f6933827 100644 --- a/editions/test/tiddlers/tests/test-checkbox-widget.js +++ b/editions/test/tiddlers/tests/test-checkbox-widget.js @@ -78,6 +78,13 @@ Tests the checkbox widget thoroughly. startsOutChecked: false, expectedChange: { "TiddlerOne": { expand: "yes" } } }, + { + testName: "field mode default when missing -> true", + tiddlers: [], + widgetText: "<$checkbox tiddler='TiddlerOne' field='expand' default='yes' checked='yes' unchecked='no' />", + startsOutChecked: true, + expectedChange: { "TiddlerOne": { expand: "no" } } + }, { testName: "field mode indeterminate -> true", tiddlers: [{title: "TiddlerOne", text: "Jolly Old World", expand: "some other value"}], @@ -98,19 +105,28 @@ Tests the checkbox widget thoroughly. var indexModeTests = fieldModeTests.map(data => { var newData = {...data}; var newName = data.testName.replace('field mode', 'index mode'); + var tiddlerOneAlreadyExists = false; var newTiddlers = data.tiddlers.map(tiddler => { + if(tiddler.title === "TiddlerOne") { + tiddlerOneAlreadyExists = true; + } return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\nexpand: ${tiddler.expand}\ntwo: b`} }); var newWidgetText = data.widgetText.replace("field='expand'", "index='expand'"); var newChange = {}; for (var key of Object.keys(data.expectedChange)) { var oldChange = data.expectedChange[key]; - if (oldChange.expand) { - newChange[key] = { text: `one: a\nexpand: ${oldChange.expand}\ntwo: b` } + var text; + if (!tiddlerOneAlreadyExists) { + // If it wasn't there, the created one will be JSON + text = `{\n "expand": "${oldChange.expand}"\n}`; + } else if (oldChange.expand) { + text = `one: a\nexpand: ${oldChange.expand}\ntwo: b`; } else { // In index tiddlers, the "expand" field gets completely removed, not turned into "expand: (undefined)" - newChange[key] = { text: `one: a\ntwo: b` } + text = `one: a\ntwo: b`; } + newChange[key] = { text: text }; } newData.testName = newName; newData.tiddlers = newTiddlers; @@ -514,7 +530,9 @@ Tests the checkbox widget thoroughly. /* * Checkbox widget tests using the test data above */ - for (var data of checkboxTestData) { + // MAKE SURE TO USE $tw.utils.each HERE!!! + // If you use a forloop, the closure of the tests will all use the last value "data" was assigned to, and thus all run the same test. + $tw.utils.each(checkboxTestData, function(data) { it('checkbox widget test: ' + data.testName, function() { // Setup @@ -553,7 +571,7 @@ Tests the checkbox widget thoroughly. } } }) - } + }); }); From dc0cc40d5f2c034226b1ffc3f673893530bfc1f2 Mon Sep 17 00:00:00 2001 From: joshuafontany Date: Thu, 27 Feb 2025 21:18:22 -0800 Subject: [PATCH 38/41] normalize module paths for MSW server plugin, setup globals type defition for $tw, setup jsfonfig.json to map $:/ paths to file system paths --- globals.d.ts | 2 ++ jsconfig.json | 29 +++++++++++++++++++ .../modules/commands/mws-add-permission.js | 2 +- .../modules/commands/mws-add-role.js | 2 +- .../modules/commands/mws-add-user.js | 2 +- .../commands/mws-assign-role-permission.js | 2 +- .../modules/commands/mws-assign-user-role.js | 2 +- .../modules/commands/mws-create-bag.js | 2 +- .../modules/commands/mws-create-recipe.js | 4 +-- .../modules/commands/mws-listen.js | 2 +- .../modules/commands/mws-load-archive.js | 2 +- .../modules/commands/mws-load-plugin-bags.js | 4 +-- .../modules/commands/mws-load-tiddlers.js | 2 +- .../modules/commands/mws-load-wiki-folder.js | 2 +- .../modules/commands/mws-save-archive.js | 2 +- .../modules/commands/mws-save-tiddler-text.js | 2 +- .../modules/commands/mws-test-server.js | 2 +- .../multiwikiserver/modules/mws-server.js | 18 +++++++----- .../routes/handlers/change-user-password.js | 2 +- .../modules/routes/handlers/delete-acl.js | 2 +- .../routes/handlers/delete-bag-tiddler.js | 2 +- .../modules/routes/handlers/delete-role.js | 2 +- .../routes/handlers/delete-user-account.js | 2 +- .../modules/routes/handlers/get-acl.js | 2 +- .../routes/handlers/get-bag-tiddler-blob.js | 2 +- .../routes/handlers/get-bag-tiddler.js | 2 +- .../modules/routes/handlers/get-bag.js | 2 +- .../modules/routes/handlers/get-index.js | 4 +-- .../modules/routes/handlers/get-login.js | 2 +- .../routes/handlers/get-recipe-events.js | 2 +- .../routes/handlers/get-recipe-tiddler.js | 2 +- .../handlers/get-recipe-tiddlers-json.js | 2 +- .../modules/routes/handlers/get-system.js | 2 +- .../modules/routes/handlers/get-users.js | 2 +- .../modules/routes/handlers/get-wiki.js | 2 +- .../modules/routes/handlers/manage-roles.js | 2 +- .../modules/routes/handlers/manage-user.js | 2 +- .../modules/routes/handlers/post-acl.js | 2 +- .../routes/handlers/post-anon-config.js | 2 +- .../modules/routes/handlers/post-anon.js | 2 +- .../routes/handlers/post-bag-tiddlers.js | 4 +-- .../modules/routes/handlers/post-bag.js | 2 +- .../modules/routes/handlers/post-login.js | 2 +- .../modules/routes/handlers/post-logout.js | 2 +- .../modules/routes/handlers/post-recipe.js | 2 +- .../modules/routes/handlers/post-role.js | 2 +- .../modules/routes/handlers/post-user.js | 2 +- .../modules/routes/handlers/put-bag.js | 2 +- .../routes/handlers/put-recipe-tiddler.js | 2 +- .../modules/routes/handlers/put-recipe.js | 2 +- .../modules/routes/handlers/update-role.js | 2 +- .../routes/handlers/update-user-profile.js | 2 +- .../modules/routes/helpers/acl-middleware.js | 2 +- .../modules/routes/helpers/multipart-forms.js | 4 +-- .../multiwikiserver/modules/startup.js | 8 ++--- .../modules/store/attachments.js | 2 +- .../modules/store/sql-engine.js | 8 +++-- .../modules/store/sql-tiddler-database.js | 6 ++-- .../modules/store/sql-tiddler-store.js | 6 ++-- .../store/tests-sql-tiddler-database.js | 4 +-- .../modules/store/tests-sql-tiddler-store.js | 4 +-- .../modules/tests/test-attachment.js | 2 +- .../multiwikiserver/scripts/admin-dropdown.js | 6 +++- 63 files changed, 124 insertions(+), 83 deletions(-) create mode 100644 globals.d.ts create mode 100644 jsconfig.json diff --git a/globals.d.ts b/globals.d.ts new file mode 100644 index 00000000000..be131e2dd07 --- /dev/null +++ b/globals.d.ts @@ -0,0 +1,2 @@ +// globals.d.ts +declare var $tw: any; diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000000..281dbec849d --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "ES2019", + "module": "CommonJS", + "lib": ["dom", "es2019"], + "allowSyntheticDefaultImports": true, + "checkJs": true, + "baseUrl": ".", + "paths": { + "$:/plugins/*": ["plugins/*"], + "$:/core/*": ["core/*"], + "$:/editions/*": ["editions/*"] + } + }, + "include": [ + "globals.d.ts", + "core/**/*.js", + "plugins/**/*.js", + "editions/**/*.js" + ], + "exclude": [ + "node_modules", + ".git", + "dist", + "tmp", + "output" + ] +} + \ No newline at end of file diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-permission.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-permission.js index fe742956612..13f5aebf9fe 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-permission.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-permission.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-add-permission.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-permission.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-role.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-role.js index ec435a97ff3..35ee1b7cb12 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-role.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-role.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-add-role.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-role.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-user.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-user.js index fc0c4e6e197..737f3db733d 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-user.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-user.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-add-user.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-add-user.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-role-permission.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-role-permission.js index 89ed568d932..ae4037ad394 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-role-permission.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-role-permission.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-assign-role-permission.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-role-permission.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-user-role.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-user-role.js index 2657dbdd332..3f39f7741a4 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-user-role.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-user-role.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-assign-user-role.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-assign-user-role.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-bag.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-bag.js index c90088a8729..cb89f65a60e 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-bag.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-bag.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-create-bag.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-bag.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-recipe.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-recipe.js index 6515c817a20..5ce9da89d91 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-recipe.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-recipe.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-create-recipe.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-create-recipe.js type: application/javascript module-type: command @@ -35,7 +35,7 @@ Command.prototype.execute = function() { } var recipeName = this.params[0], bagList = (this.params[1] || "").split(" "), - recipeDescription = this.params[2] || recipeNameName; + recipeDescription = this.params[2] || recipeName; // Create recipe var result = $tw.mws.store.createRecipe(recipeName,bagList,recipeDescription); if(result) { diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-listen.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-listen.js index 0ee10f9be2c..32567a452e8 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-listen.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-listen.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-listen.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-listen.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-archive.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-archive.js index 9e37cb32b08..c6d0649ac6a 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-archive.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-archive.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-archive.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-archive.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-plugin-bags.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-plugin-bags.js index 40bfb37493d..19c680349da 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-plugin-bags.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-plugin-bags.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-plugin-bags.js type: application/javascript module-type: command @@ -40,7 +40,7 @@ function loadPluginBags() { const bagName = makePluginBagName(type,publisher,name); const result = $tw.mws.store.createBag(bagName,pluginFields.description || "(no description)",{allowPrivilegedCharacters: true}); if(result) { - console.log(`Error creating plugin bag ${bagname}: ${JSON.stringify(result)}`); + console.log(`Error creating plugin bag ${bagName}: ${JSON.stringify(result)}`); } $tw.mws.store.saveBagTiddler(pluginFields,bagName); }, diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-tiddlers.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-tiddlers.js index 659e2398cfe..e771bd6d126 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-tiddlers.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-tiddlers.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-tiddlers.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-tiddlers.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-wiki-folder.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-wiki-folder.js index ada8c86becf..ec45e248008 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-wiki-folder.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-wiki-folder.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-wiki-folder.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-load-wiki-folder.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-archive.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-archive.js index d8b67753ca7..18e458b2c8a 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-archive.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-archive.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-save-archive.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-archive.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-tiddler-text.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-tiddler-text.js index 524ec948a82..2faf1b9121e 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-tiddler-text.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-tiddler-text.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-save-tiddler-text.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-save-tiddler-text.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-test-server.js b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-test-server.js index 5d03844aa7e..96bd3ba8927 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-test-server.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-test-server.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/commands/mws-test-server.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/commands/mws-test-server.js type: application/javascript module-type: command diff --git a/plugins/tiddlywiki/multiwikiserver/modules/mws-server.js b/plugins/tiddlywiki/multiwikiserver/modules/mws-server.js index 132159a8fe9..05a3c9dd515 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/mws-server.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/mws-server.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/mws-server.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/mws-server.js type: application/javascript module-type: library @@ -507,24 +507,26 @@ Server.prototype.requestHandler = function(request,response,options) { } else if(route.bodyFormat === "string" || route.bodyFormat === "www-form-urlencoded" || !route.bodyFormat) { // Set the encoding for the incoming request request.setEncoding("utf8"); - var data = ""; + var rawData = ""; request.on("data",function(chunk) { - data += chunk.toString(); + rawData += chunk.toString(); }); request.on("end",function() { if(route.bodyFormat === "www-form-urlencoded") { - data = queryString.parse(data); + // Assign the parsed data directly to state.data. + state.data = queryString.parse(rawData); + } else { + state.data = rawData; } - state.data = data; route.handler(request,response,state); }); } else if(route.bodyFormat === "buffer") { - var data = []; + var bufferData = []; request.on("data",function(chunk) { - data.push(chunk); + bufferData.push(chunk); }); request.on("end",function() { - state.data = Buffer.concat(data); + state.data = Buffer.concat(bufferData); route.handler(request,response,state); }) } else { diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/change-user-password.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/change-user-password.js index 303b8e4e6e6..34e3a970ed2 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/change-user-password.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/change-user-password.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/change-password.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/change-password.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-acl.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-acl.js index a4c4768e4e5..0b598236936 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-acl.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-acl.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/delete-acl.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-acl.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-bag-tiddler.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-bag-tiddler.js index 722ef2d8c09..a65dcf834ec 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-bag-tiddler.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-bag-tiddler.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/delete-bag-tiddler.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-bag-tiddler.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js index 571545b1519..00a37b89fae 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/delete-role.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-role.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-user-account.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-user-account.js index 5fb0f219f28..8df1cf79ee3 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-user-account.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-user-account.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/delete-user-account.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-user-account.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js index 1c6e2f1b7e8..6a5949ca88e 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-acl.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-acl.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler-blob.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler-blob.js index 28d23212c43..13d39b22f85 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler-blob.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler-blob.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-bag-tiddler-blob.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler-blob.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler.js index 52b169652b0..b52a71bb5b9 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-bag-tiddler.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag-tiddler.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag.js index 7d262b83fcf..de6123a47ee 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-bag.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-bag.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js index 1b5dc96fe6f..f0c40ce0bc1 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-index.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js type: application/javascript module-type: mws-route @@ -24,7 +24,7 @@ exports.handler = function(request,response,state) { // If application/json is requested then this is an API request, and gets the response in JSON if(request.headers.accept && request.headers.accept.indexOf("application/json") !== -1) { - state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(recipes),"utf8"); + state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(recipeList),"utf8"); } else { // This is not a JSON API request, we should return the raw tiddler content response.writeHead(200, "OK",{ diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-login.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-login.js index dd0421a66ea..2657e68a95c 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-login.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-login.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-login.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-login.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-events.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-events.js index bfdc40c187d..3f91cfb496a 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-events.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-events.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-recipe-events.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-events.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddler.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddler.js index a50657ce58a..99fdc77189a 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddler.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddler.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-recipe-tiddler.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddler.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddlers-json.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddlers-json.js index e16e3d10a55..09a5b7b7133 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddlers-json.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddlers-json.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-recipe-tiddlers-json.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-recipe-tiddlers-json.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-system.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-system.js index a5346c1a658..fa18203896a 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-system.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-system.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-system.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-system.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-users.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-users.js index 142258aa0d5..5c9dc0aa22c 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-users.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-users.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-users.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-users.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-wiki.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-wiki.js index 1765f5e208f..ad209bcd4bd 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-wiki.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-wiki.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/get-wiki.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-wiki.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-roles.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-roles.js index e6400dbb92c..6070fb8917d 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-roles.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-roles.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/manage-roles.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-roles.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js index cada04b832f..b1154726245 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/manage-user.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-acl.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-acl.js index 63a9f414f1b..8fb4690c052 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-acl.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-acl.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-acl.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-acl.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon-config.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon-config.js index e1e841516c4..7b1a35965bc 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon-config.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon-config.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-anon-config.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon-config.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon.js index 911b6ef971c..da6fb5ef731 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-anon.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-anon.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag-tiddlers.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag-tiddlers.js index 0f520b1ba59..12ed611e910 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag-tiddlers.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag-tiddlers.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-bag-tiddlers.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag-tiddlers.js type: application/javascript module-type: mws-route @@ -27,7 +27,7 @@ exports.entityName = "bag" exports.handler = function(request,response,state) { const path = require("path"), fs = require("fs"), - processIncomingStream = require("$:/plugins/tiddlywiki/multiwikiserver/routes/helpers/multipart-forms.js").processIncomingStream; + processIncomingStream = require("$:/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/multipart-forms.js").processIncomingStream; // Get the parameters var bag_name = $tw.utils.decodeURIComponentSafe(state.params[0]); // Process the incoming data diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js index bd59b06427f..8c2249186fa 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-bag.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-bag.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-login.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-login.js index b2bc0ff4df4..f0c10767ea9 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-login.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-login.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-login.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-login.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-logout.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-logout.js index 36d901b4467..130837b8353 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-logout.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-logout.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-logout.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-logout.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-recipe.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-recipe.js index aa38986a002..11116ca0f0c 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-recipe.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-recipe.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-recipe.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-recipe.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-role.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-role.js index 9692c7d689d..99b1273257d 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-role.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-role.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-role.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-role.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-user.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-user.js index ff3acbfc916..a1202d1bb99 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-user.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-user.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/post-user.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/post-user.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-bag.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-bag.js index d174ee8cea2..12ea3fdb13b 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-bag.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-bag.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/put-bag.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-bag.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe-tiddler.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe-tiddler.js index 25279cdd0d8..eaf2e922f02 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe-tiddler.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe-tiddler.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/put-recipe-tiddler.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe-tiddler.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe.js index 002c5e4dbd9..c2fb98ffbf5 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/put-recipe.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/put-recipe.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-role.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-role.js index 081ba9b7374..d5150162740 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-role.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-role.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/update-role.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-role.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-user-profile.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-user-profile.js index 3cbc0669000..5da97186aa9 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-user-profile.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-user-profile.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/update-profile.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/update-profile.js type: application/javascript module-type: mws-route diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js index 7210ed82c68..bfabb1cd18e 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/modules/routes/helpers/acl-middleware.js type: application/javascript module-type: library diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/multipart-forms.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/multipart-forms.js index 6a46699fabb..563c3770c7f 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/multipart-forms.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/multipart-forms.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/routes/helpers/multipart-forms.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/multipart-forms.js type: application/javascript module-type: library @@ -72,7 +72,7 @@ exports.processIncomingStream = function(options) { } else { const partFile = parts.find(part => part.name === "file-to-upload" && !!part.filename); if(!partFile) { - return state.sendResponse(400, {"Content-Type": "text/plain"},"Missing file to upload"); + return options.state.sendResponse(400, {"Content-Type": "text/plain"},"Missing file to upload"); } const type = partFile.headers["content-type"]; const tiddlerFields = { diff --git a/plugins/tiddlywiki/multiwikiserver/modules/startup.js b/plugins/tiddlywiki/multiwikiserver/modules/startup.js index 42686e889be..c6918cbf990 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/startup.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/startup.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/startup.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/startup.js type: application/javascript module-type: startup @@ -31,11 +31,11 @@ exports.startup = function() { function setupStore() { const path = require("path"); // Create and initialise the attachment store and the tiddler store - const AttachmentStore = require("$:/plugins/tiddlywiki/multiwikiserver/store/attachments.js").AttachmentStore, + const AttachmentStore = require("$:/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js").AttachmentStore, attachmentStore = new AttachmentStore({ storePath: path.resolve($tw.boot.wikiPath,"store/") }), - SqlTiddlerStore = require("$:/plugins/tiddlywiki/multiwikiserver/store/sql-tiddler-store.js").SqlTiddlerStore, + SqlTiddlerStore = require("$:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js").SqlTiddlerStore, store = new SqlTiddlerStore({ databasePath: path.resolve($tw.boot.wikiPath,"store/database.sqlite"), engine: $tw.wiki.getTiddlerText("$:/config/MultiWikiServer/Engine","better"), // better || wasm @@ -49,7 +49,7 @@ function ServerManager(store) { } ServerManager.prototype.createServer = function(options) { - const MWSServer = require("$:/plugins/tiddlywiki/multiwikiserver/mws-server.js").Server, + const MWSServer = require("$:/plugins/tiddlywiki/multiwikiserver/modules/mws-server.js").Server, server = new MWSServer(options); this.servers.push(server); return server; diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js b/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js index 352f96a8386..b66a58a10bf 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/store/attachments.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js type: application/javascript module-type: library diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js index 00d15edf370..044c98a38a3 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/store/sql-engine.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js type: application/javascript module-type: library @@ -16,6 +16,7 @@ Create a database engine. Options include: databasePath - path to the database file (can be ":memory:" or missing to get a temporary database) engine - wasm | better +verbose - flag to turn on console logging, defaults to undefined */ function SqlEngine(options) { options = options || {}; @@ -37,6 +38,9 @@ function SqlEngine(options) { ({ DatabaseSync: Database } = require("node:sqlite")); break; case "wasm": + // "node-sqlite3-wasm" requires manual installation + // see https://mws.tiddlywiki.com/#Database%20Engines + // @ts-ignore ({ Database } = require("node-sqlite3-wasm")); break; case "better": @@ -44,7 +48,7 @@ function SqlEngine(options) { break; } this.db = new Database(databasePath,{ - verbose: undefined && console.log + verbose: options.verbose ? console.log : undefined }); // Turn on WAL mode for better-sqlite3 if(this.engine === "better") { diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js index 14f8641f4ce..a06cb2b218c 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/store/sql-tiddler-database.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js type: application/javascript module-type: library @@ -20,7 +20,7 @@ engine - wasm | better */ function SqlTiddlerDatabase(options) { options = options || {}; - const SqlEngine = require("$:/plugins/tiddlywiki/multiwikiserver/store/sql-engine.js").SqlEngine; + const SqlEngine = require("$:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js").SqlEngine; this.engine = new SqlEngine({ databasePath: options.databasePath, engine: options.engine @@ -1041,7 +1041,7 @@ SqlTiddlerDatabase.prototype.findUserBySessionId = function(sessionId) { const lastAccessed = new Date(sessionResult.last_accessed); const expirationTime = 24 * 60 * 60 * 1000; // 24 hours in milliseconds - if (new Date() - lastAccessed > expirationTime) { + if (new Date().getTime() - lastAccessed.getTime() > expirationTime) { // Session has expired this.deleteSession(sessionId); return null; diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js index bb32eba18d3..eec36d52ccf 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/store/sql-tiddler-store.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js type: application/javascript module-type: library @@ -31,7 +31,7 @@ function SqlTiddlerStore(options) { this.eventOutstanding = {}; // Hashmap by type of boolean true of outstanding events // Create the database this.databasePath = options.databasePath || ":memory:"; - var SqlTiddlerDatabase = require("$:/plugins/tiddlywiki/multiwikiserver/store/sql-tiddler-database.js").SqlTiddlerDatabase; + var SqlTiddlerDatabase = require("$:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js").SqlTiddlerDatabase; this.sqlTiddlerDatabase = new SqlTiddlerDatabase({ databasePath: this.databasePath, engine: options.engine @@ -201,7 +201,7 @@ SqlTiddlerStore.prototype.saveTiddlersFromPath = function(tiddler_files_path,bag // Save the tiddlers for(const tiddlersFromFile of tiddlersFromPath) { for(const tiddler of tiddlersFromFile.tiddlers) { - self.saveBagTiddler(tiddler,bag_name,null); + self.saveBagTiddler(tiddler,bag_name); } } }); diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-database.js b/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-database.js index 563f86bf517..d9229a4dee9 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-database.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-database.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/store/tests-sql-tiddler-database.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-database.js type: application/javascript tags: [[$:/tags/test-spec]] @@ -27,7 +27,7 @@ describe("SQL tiddler database with better-sqlite3", function() { function runSqlDatabaseTests(engine) { // Create and initialise the tiddler store - var SqlTiddlerDatabase = require("$:/plugins/tiddlywiki/multiwikiserver/store/sql-tiddler-database.js").SqlTiddlerDatabase; + var SqlTiddlerDatabase = require("$:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-database.js").SqlTiddlerDatabase; const sqlTiddlerDatabase = new SqlTiddlerDatabase({ engine: engine }); diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-store.js b/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-store.js index c5888b2ce16..677bba072df 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-store.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-store.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/store/tests-sql-tiddler-store.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/store/tests-sql-tiddler-store.js type: application/javascript tags: [[$:/tags/test-spec]] @@ -22,7 +22,7 @@ describe("SQL tiddler store with better-sqlite3", function() { }); function runSqlStoreTests(engine) { - var SqlTiddlerStore = require("$:/plugins/tiddlywiki/multiwikiserver/store/sql-tiddler-store.js").SqlTiddlerStore; + var SqlTiddlerStore = require("$:/plugins/tiddlywiki/multiwikiserver/modules/store/sql-tiddler-store.js").SqlTiddlerStore; var store; diff --git a/plugins/tiddlywiki/multiwikiserver/modules/tests/test-attachment.js b/plugins/tiddlywiki/multiwikiserver/modules/tests/test-attachment.js index 9298c43f8a3..055aa843100 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/tests/test-attachment.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/tests/test-attachment.js @@ -11,7 +11,7 @@ if(typeof window === 'undefined' && typeof process !== 'undefined' && process.ve var fs = require('fs'); var path = require('path'); var assert = require('assert'); - var AttachmentStore = require('$:/plugins/tiddlywiki/multiwikiserver/store/attachments.js').AttachmentStore; + var AttachmentStore = require('$:/plugins/tiddlywiki/multiwikiserver/modules/store/attachments.js').AttachmentStore; const {Buffer} = require('buffer'); function generateFileWithSize(filePath, sizeInBytes) { diff --git a/plugins/tiddlywiki/multiwikiserver/scripts/admin-dropdown.js b/plugins/tiddlywiki/multiwikiserver/scripts/admin-dropdown.js index 58336e65f12..4eb25aba446 100644 --- a/plugins/tiddlywiki/multiwikiserver/scripts/admin-dropdown.js +++ b/plugins/tiddlywiki/multiwikiserver/scripts/admin-dropdown.js @@ -4,11 +4,15 @@ type: application/javascript \*/ +// @ts-check (function () { document.addEventListener("click", function (event) { + /** @type {HTMLElement|null} */ var dropdown = document.querySelector(".mws-admin-dropdown-content"); + /** @type {HTMLElement|null} */ var dropbtn = document.querySelector(".mws-admin-dropbtn"); - if(!event.target.matches(".mws-admin-dropbtn")) { + // Ensure event.target is an Element + if (!(event.target instanceof Element) || !event.target.matches(".mws-admin-dropbtn")) { if(dropdown.style.display === "block") { dropdown.style.display = "none"; } From 4c39b5d6ccf6293b77a21935a5f094711faec1b1 Mon Sep 17 00:00:00 2001 From: joshuafontany Date: Sat, 1 Mar 2025 19:38:07 -0800 Subject: [PATCH 39/41] cleanup linter errors --- .../multiwikiserver/modules/routes/helpers/acl-middleware.js | 2 +- plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js index bfabb1cd18e..7210ed82c68 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js @@ -1,5 +1,5 @@ /*\ -title: $:/plugins/tiddlywiki/multiwikiserver/modules/modules/routes/helpers/acl-middleware.js +title: $:/plugins/tiddlywiki/multiwikiserver/modules/routes/helpers/acl-middleware.js type: application/javascript module-type: library diff --git a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js index 044c98a38a3..60bceba5f39 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/store/sql-engine.js @@ -53,6 +53,7 @@ function SqlEngine(options) { // Turn on WAL mode for better-sqlite3 if(this.engine === "better") { // See https://github.com/WiseLibs/better-sqlite3/blob/master/docs/performance.md + // @ts-ignore this.db.pragma("journal_mode = WAL"); } } From c783d20884712e07e7d83e019379d433da48a938 Mon Sep 17 00:00:00 2001 From: joshuafontany Date: Tue, 4 Mar 2025 00:08:46 -0800 Subject: [PATCH 40/41] allow anon read/write for upload tests --- .../tiddlers/MultiWikiServerAllowAnonymousReads.tid | 4 ++++ .../tiddlers/MultiWikiServerAllowAnonymousWrites.tid | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousReads.tid create mode 100644 editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousWrites.tid diff --git a/editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousReads.tid b/editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousReads.tid new file mode 100644 index 00000000000..97cf771aa29 --- /dev/null +++ b/editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousReads.tid @@ -0,0 +1,4 @@ +title: $:/config/MultiWikiServer/AllowAnonymousReads +text: yes +description: Controls whether anonymous users can read wiki content +type: text/plain diff --git a/editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousWrites.tid b/editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousWrites.tid new file mode 100644 index 00000000000..d2400349179 --- /dev/null +++ b/editions/multiwikiserver/tiddlers/MultiWikiServerAllowAnonymousWrites.tid @@ -0,0 +1,4 @@ +title: $:/config/MultiWikiServer/AllowAnonymousWrites +text: yes +description: Controls whether anonymous users can write to the wiki +type: text/plain From e0a9ea95039a4fa092102616e544dce5ccfb3622 Mon Sep 17 00:00:00 2001 From: joshuafontany Date: Tue, 4 Mar 2025 00:42:14 -0800 Subject: [PATCH 41/41] bugfix multiwikiclientadaptor --- editions/multiwikiserver/tiddlers/$__StoryList_1.tid | 2 -- plugins/tiddlywiki/multiwikiclient/multiwikiclientadaptor.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 editions/multiwikiserver/tiddlers/$__StoryList_1.tid diff --git a/editions/multiwikiserver/tiddlers/$__StoryList_1.tid b/editions/multiwikiserver/tiddlers/$__StoryList_1.tid deleted file mode 100644 index 28aae8c87f6..00000000000 --- a/editions/multiwikiserver/tiddlers/$__StoryList_1.tid +++ /dev/null @@ -1,2 +0,0 @@ -list: GettingStarted -title: $:/StoryList \ No newline at end of file diff --git a/plugins/tiddlywiki/multiwikiclient/multiwikiclientadaptor.js b/plugins/tiddlywiki/multiwikiclient/multiwikiclientadaptor.js index 39d0fe88215..94df0821692 100644 --- a/plugins/tiddlywiki/multiwikiclient/multiwikiclientadaptor.js +++ b/plugins/tiddlywiki/multiwikiclient/multiwikiclientadaptor.js @@ -287,7 +287,7 @@ MultiWikiClientAdaptor.prototype.checkLastRecordedUpdate = function(title,revisi var numRevision = $tw.utils.getInt(revision); console.log(`Checking for updates to ${title} since ${JSON.stringify(revision)} comparing to ${numRevision}`) if(lru.tiddler_id > numRevision) { - options.syncer.enqueueLoadTiddler(title); + syncer.enqueueLoadTiddler(title); } } }