From 7944f424674479581e5c8f19d0b8850d0e36f710 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 12 Sep 2025 15:21:34 +0100 Subject: [PATCH] [v5.4.0] Offload server components from browser builds of TiddlyWiki (#9183) * Move Node.js specific files out of the core plugin * Package server files as new $:/core-server plugin * Missed commander.js * Fix crash in browser * Extend server-only mechanism to be usable by other plugins * in * Revert "Extend server-only mechanism to be usable by other plugins" This reverts commit 3faf50307356f374f632fd54b4d48195c6decf2a. * Revert "in" This reverts commit b80213128f3b12410012e7a353b1c4de02bd1eda. * Reapply "Extend server-only mechanism to be usable by other plugins" This reverts commit c6c83bc18b3aaa4582d7d4e459dd8e7b4ae1898d. * Fix test failure * Move filesystem utilities into core-server * Move old-style release notes out of the way * Move the 5.4.0 release note into the right place * Revert "Move the 5.4.0 release note into the right place" This reverts commit 3f5c2bfba3f869a0b9c55fec422a594c669fa059. * Revert "Move old-style release notes out of the way" This reverts commit ee16e48a43f570db2c7fb2e29ea8fa893023a7b2. --- boot/boot.js | 4 +++- {core/modules => core-server}/commander.js | 0 {core/modules => core-server}/commands/build.js | 0 .../modules => core-server}/commands/clearpassword.js | 0 {core/modules => core-server}/commands/commands.js | 0 .../commands/deletetiddlers.js | 0 {core/modules => core-server}/commands/editions.js | 0 {core/modules => core-server}/commands/fetch.js | 0 {core/modules => core-server}/commands/help.js | 0 {core/modules => core-server}/commands/import.js | 0 {core/modules => core-server}/commands/init.js | 0 {core/modules => core-server}/commands/listen.js | 0 {core/modules => core-server}/commands/load.js | 0 {core/modules => core-server}/commands/makelibrary.js | 0 {core/modules => core-server}/commands/output.js | 0 {core/modules => core-server}/commands/password.js | 0 {core/modules => core-server}/commands/render.js | 0 .../modules => core-server}/commands/rendertiddler.js | 0 .../commands/rendertiddlers.js | 0 {core/modules => core-server}/commands/save.js | 0 .../commands/savelibrarytiddlers.js | 0 {core/modules => core-server}/commands/savetiddler.js | 0 .../modules => core-server}/commands/savetiddlers.js | 0 .../commands/savewikifolder.js | 1 + {core/modules => core-server}/commands/server.js | 0 {core/modules => core-server}/commands/setfield.js | 0 .../modules => core-server}/commands/unpackplugin.js | 0 {core/modules => core-server}/commands/verbose.js | 0 {core/modules => core-server}/commands/version.js | 0 {core/modules/utils => core-server}/filesystem.js | 0 core-server/plugin.info | 11 +++++++++++ core-server/readme.tid | 6 ++++++ .../server/authenticators/basic.js | 0 .../server/authenticators/header.js | 0 .../server/routes/delete-tiddler.js | 0 .../server/routes/get-favicon.js | 0 .../modules => core-server}/server/routes/get-file.js | 0 .../server/routes/get-index.js | 0 .../server/routes/get-login-basic.js | 0 .../server/routes/get-status.js | 0 .../server/routes/get-tiddler-html.js | 0 .../server/routes/get-tiddler.js | 0 .../server/routes/get-tiddlers-json.js | 0 .../server/routes/put-tiddler.js | 0 {core/modules => core-server}/server/server.js | 0 core/modules/startup/load-modules.js | 4 +++- core/templates/external-js/save-all-external-js.tid | 2 +- .../external-js/save-offline-external-js.tid | 2 +- core/templates/save-all.tid | 2 +- core/templates/save-empty.tid | 2 +- core/templates/save-lazy-all.tid | 2 +- core/templates/save-lazy-images.tid | 2 +- .../system/$__editions_de-AT-DE_download-empty.tid | 2 +- editions/es-ES/tiddlers/system/download-empty.tid | 2 +- editions/fr-FR/tiddlers/system/download-empty.tid | 2 +- editions/ja-JP/tiddlers/system/download-empty.tid | 2 +- editions/ko-KR/tiddlers/system/download-empty.tid | 2 +- .../prerelease/tiddlers/system/download-empty.tid | 2 +- editions/test/tiddlers/tests/test-filters.js | 2 +- editions/tw5.com/tiddlers/plugins/Plugin_Fields.tid | 3 ++- editions/tw5.com/tiddlers/system/download-empty.tid | 2 +- .../webserver/WebServer API_ Get All Tiddlers.tid | 2 +- .../tiddlers/system/download-empty-zh-Hans.tid | 2 +- .../tiddlers/system/download-empty-zh-Hant.tid | 2 +- .../tiddlywiki/tiddlyweb/config-tiddlers-filter.tid | 2 +- plugins/tiddlywiki/tiddlyweb/save-offline.tid | 2 +- plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js | 2 +- plugins/tiddlywiki/upgrade/save-tiddler-filter.tid | 2 +- 68 files changed, 47 insertions(+), 24 deletions(-) rename {core/modules => core-server}/commander.js (100%) rename {core/modules => core-server}/commands/build.js (100%) rename {core/modules => core-server}/commands/clearpassword.js (100%) rename {core/modules => core-server}/commands/commands.js (100%) rename {core/modules => core-server}/commands/deletetiddlers.js (100%) rename {core/modules => core-server}/commands/editions.js (100%) rename {core/modules => core-server}/commands/fetch.js (100%) rename {core/modules => core-server}/commands/help.js (100%) rename {core/modules => core-server}/commands/import.js (100%) rename {core/modules => core-server}/commands/init.js (100%) rename {core/modules => core-server}/commands/listen.js (100%) rename {core/modules => core-server}/commands/load.js (100%) rename {core/modules => core-server}/commands/makelibrary.js (100%) rename {core/modules => core-server}/commands/output.js (100%) rename {core/modules => core-server}/commands/password.js (100%) rename {core/modules => core-server}/commands/render.js (100%) rename {core/modules => core-server}/commands/rendertiddler.js (100%) rename {core/modules => core-server}/commands/rendertiddlers.js (100%) rename {core/modules => core-server}/commands/save.js (100%) rename {core/modules => core-server}/commands/savelibrarytiddlers.js (100%) rename {core/modules => core-server}/commands/savetiddler.js (100%) rename {core/modules => core-server}/commands/savetiddlers.js (100%) rename {core/modules => core-server}/commands/savewikifolder.js (99%) rename {core/modules => core-server}/commands/server.js (100%) rename {core/modules => core-server}/commands/setfield.js (100%) rename {core/modules => core-server}/commands/unpackplugin.js (100%) rename {core/modules => core-server}/commands/verbose.js (100%) rename {core/modules => core-server}/commands/version.js (100%) rename {core/modules/utils => core-server}/filesystem.js (100%) create mode 100644 core-server/plugin.info create mode 100644 core-server/readme.tid rename {core/modules => core-server}/server/authenticators/basic.js (100%) rename {core/modules => core-server}/server/authenticators/header.js (100%) rename {core/modules => core-server}/server/routes/delete-tiddler.js (100%) rename {core/modules => core-server}/server/routes/get-favicon.js (100%) rename {core/modules => core-server}/server/routes/get-file.js (100%) rename {core/modules => core-server}/server/routes/get-index.js (100%) rename {core/modules => core-server}/server/routes/get-login-basic.js (100%) rename {core/modules => core-server}/server/routes/get-status.js (100%) rename {core/modules => core-server}/server/routes/get-tiddler-html.js (100%) rename {core/modules => core-server}/server/routes/get-tiddler.js (100%) rename {core/modules => core-server}/server/routes/get-tiddlers-json.js (100%) rename {core/modules => core-server}/server/routes/put-tiddler.js (100%) rename {core/modules => core-server}/server/server.js (100%) diff --git a/boot/boot.js b/boot/boot.js index 20a639731c..9b88b98b14 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1433,7 +1433,7 @@ $tw.Wiki = function(options) { checkTiddler = function(tiddler,title) { if(tiddler && tiddler.fields.type === "application/json" && tiddler.fields["plugin-type"] && (!pluginType || tiddler.fields["plugin-type"] === pluginType)) { var disablingTiddler = self.getTiddler("$:/config/Plugins/Disabled/" + title); - if(title === "$:/core" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") { + if(title === "$:/core" || title === "$:/core-server" || !disablingTiddler || (disablingTiddler.fields.text || "").trim() !== "yes") { self.unregisterPluginTiddlers(null,[title]); // Unregister the plugin if it's already registered pluginTiddlers.push(tiddler); registeredTitles.push(tiddler.fields.title); @@ -2350,6 +2350,7 @@ $tw.loadTiddlersNode = function() { }); // Load the core tiddlers $tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath)); + $tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.coreServerPath)); // Load any extra plugins $tw.utils.each($tw.boot.extraPlugins,function(name) { if(name.charAt(0) === "+") { // Relative path to plugin @@ -2423,6 +2424,7 @@ $tw.boot.initStartup = function(options) { // System paths and filenames $tw.boot.bootPath = options.bootPath || path.dirname(module.filename); $tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core"); + $tw.boot.coreServerPath = path.resolve($tw.boot.bootPath,"../core-server"); // If there's no arguments then default to `--help` if($tw.boot.argv.length === 0) { $tw.boot.argv = ["--help"]; diff --git a/core/modules/commander.js b/core-server/commander.js similarity index 100% rename from core/modules/commander.js rename to core-server/commander.js diff --git a/core/modules/commands/build.js b/core-server/commands/build.js similarity index 100% rename from core/modules/commands/build.js rename to core-server/commands/build.js diff --git a/core/modules/commands/clearpassword.js b/core-server/commands/clearpassword.js similarity index 100% rename from core/modules/commands/clearpassword.js rename to core-server/commands/clearpassword.js diff --git a/core/modules/commands/commands.js b/core-server/commands/commands.js similarity index 100% rename from core/modules/commands/commands.js rename to core-server/commands/commands.js diff --git a/core/modules/commands/deletetiddlers.js b/core-server/commands/deletetiddlers.js similarity index 100% rename from core/modules/commands/deletetiddlers.js rename to core-server/commands/deletetiddlers.js diff --git a/core/modules/commands/editions.js b/core-server/commands/editions.js similarity index 100% rename from core/modules/commands/editions.js rename to core-server/commands/editions.js diff --git a/core/modules/commands/fetch.js b/core-server/commands/fetch.js similarity index 100% rename from core/modules/commands/fetch.js rename to core-server/commands/fetch.js diff --git a/core/modules/commands/help.js b/core-server/commands/help.js similarity index 100% rename from core/modules/commands/help.js rename to core-server/commands/help.js diff --git a/core/modules/commands/import.js b/core-server/commands/import.js similarity index 100% rename from core/modules/commands/import.js rename to core-server/commands/import.js diff --git a/core/modules/commands/init.js b/core-server/commands/init.js similarity index 100% rename from core/modules/commands/init.js rename to core-server/commands/init.js diff --git a/core/modules/commands/listen.js b/core-server/commands/listen.js similarity index 100% rename from core/modules/commands/listen.js rename to core-server/commands/listen.js diff --git a/core/modules/commands/load.js b/core-server/commands/load.js similarity index 100% rename from core/modules/commands/load.js rename to core-server/commands/load.js diff --git a/core/modules/commands/makelibrary.js b/core-server/commands/makelibrary.js similarity index 100% rename from core/modules/commands/makelibrary.js rename to core-server/commands/makelibrary.js diff --git a/core/modules/commands/output.js b/core-server/commands/output.js similarity index 100% rename from core/modules/commands/output.js rename to core-server/commands/output.js diff --git a/core/modules/commands/password.js b/core-server/commands/password.js similarity index 100% rename from core/modules/commands/password.js rename to core-server/commands/password.js diff --git a/core/modules/commands/render.js b/core-server/commands/render.js similarity index 100% rename from core/modules/commands/render.js rename to core-server/commands/render.js diff --git a/core/modules/commands/rendertiddler.js b/core-server/commands/rendertiddler.js similarity index 100% rename from core/modules/commands/rendertiddler.js rename to core-server/commands/rendertiddler.js diff --git a/core/modules/commands/rendertiddlers.js b/core-server/commands/rendertiddlers.js similarity index 100% rename from core/modules/commands/rendertiddlers.js rename to core-server/commands/rendertiddlers.js diff --git a/core/modules/commands/save.js b/core-server/commands/save.js similarity index 100% rename from core/modules/commands/save.js rename to core-server/commands/save.js diff --git a/core/modules/commands/savelibrarytiddlers.js b/core-server/commands/savelibrarytiddlers.js similarity index 100% rename from core/modules/commands/savelibrarytiddlers.js rename to core-server/commands/savelibrarytiddlers.js diff --git a/core/modules/commands/savetiddler.js b/core-server/commands/savetiddler.js similarity index 100% rename from core/modules/commands/savetiddler.js rename to core-server/commands/savetiddler.js diff --git a/core/modules/commands/savetiddlers.js b/core-server/commands/savetiddlers.js similarity index 100% rename from core/modules/commands/savetiddlers.js rename to core-server/commands/savetiddlers.js diff --git a/core/modules/commands/savewikifolder.js b/core-server/commands/savewikifolder.js similarity index 99% rename from core/modules/commands/savewikifolder.js rename to core-server/commands/savewikifolder.js index 751e0e54ea..b17246e866 100644 --- a/core/modules/commands/savewikifolder.js +++ b/core-server/commands/savewikifolder.js @@ -76,6 +76,7 @@ WikiFolderMaker.prototype.tiddlersToIgnore = [ "$:/boot/boot.js", "$:/boot/bootprefix.js", "$:/core", + "$:/core-server", "$:/library/sjcl.js", "$:/temp/info-plugin" ]; diff --git a/core/modules/commands/server.js b/core-server/commands/server.js similarity index 100% rename from core/modules/commands/server.js rename to core-server/commands/server.js diff --git a/core/modules/commands/setfield.js b/core-server/commands/setfield.js similarity index 100% rename from core/modules/commands/setfield.js rename to core-server/commands/setfield.js diff --git a/core/modules/commands/unpackplugin.js b/core-server/commands/unpackplugin.js similarity index 100% rename from core/modules/commands/unpackplugin.js rename to core-server/commands/unpackplugin.js diff --git a/core/modules/commands/verbose.js b/core-server/commands/verbose.js similarity index 100% rename from core/modules/commands/verbose.js rename to core-server/commands/verbose.js diff --git a/core/modules/commands/version.js b/core-server/commands/version.js similarity index 100% rename from core/modules/commands/version.js rename to core-server/commands/version.js diff --git a/core/modules/utils/filesystem.js b/core-server/filesystem.js similarity index 100% rename from core/modules/utils/filesystem.js rename to core-server/filesystem.js diff --git a/core-server/plugin.info b/core-server/plugin.info new file mode 100644 index 0000000000..21560a1ad4 --- /dev/null +++ b/core-server/plugin.info @@ -0,0 +1,11 @@ +{ + "title": "$:/core-server", + "name": "Core Server Components", + "description": "TiddlyWiki5 core server components", + "author": "JeremyRuston", + "core-version": ">=5.0.0", + "platform": "server", + "plugin-priority": "0", + "list": "readme", + "stability": "STABILITY_2_STABLE" +} diff --git a/core-server/readme.tid b/core-server/readme.tid new file mode 100644 index 0000000000..3960fe76a7 --- /dev/null +++ b/core-server/readme.tid @@ -0,0 +1,6 @@ +title: $:/core-server/readme + +This plugin contains TiddlyWiki's core components that are only needed on the server, comprising: + +* Commands +* HTTP server code diff --git a/core/modules/server/authenticators/basic.js b/core-server/server/authenticators/basic.js similarity index 100% rename from core/modules/server/authenticators/basic.js rename to core-server/server/authenticators/basic.js diff --git a/core/modules/server/authenticators/header.js b/core-server/server/authenticators/header.js similarity index 100% rename from core/modules/server/authenticators/header.js rename to core-server/server/authenticators/header.js diff --git a/core/modules/server/routes/delete-tiddler.js b/core-server/server/routes/delete-tiddler.js similarity index 100% rename from core/modules/server/routes/delete-tiddler.js rename to core-server/server/routes/delete-tiddler.js diff --git a/core/modules/server/routes/get-favicon.js b/core-server/server/routes/get-favicon.js similarity index 100% rename from core/modules/server/routes/get-favicon.js rename to core-server/server/routes/get-favicon.js diff --git a/core/modules/server/routes/get-file.js b/core-server/server/routes/get-file.js similarity index 100% rename from core/modules/server/routes/get-file.js rename to core-server/server/routes/get-file.js diff --git a/core/modules/server/routes/get-index.js b/core-server/server/routes/get-index.js similarity index 100% rename from core/modules/server/routes/get-index.js rename to core-server/server/routes/get-index.js diff --git a/core/modules/server/routes/get-login-basic.js b/core-server/server/routes/get-login-basic.js similarity index 100% rename from core/modules/server/routes/get-login-basic.js rename to core-server/server/routes/get-login-basic.js diff --git a/core/modules/server/routes/get-status.js b/core-server/server/routes/get-status.js similarity index 100% rename from core/modules/server/routes/get-status.js rename to core-server/server/routes/get-status.js diff --git a/core/modules/server/routes/get-tiddler-html.js b/core-server/server/routes/get-tiddler-html.js similarity index 100% rename from core/modules/server/routes/get-tiddler-html.js rename to core-server/server/routes/get-tiddler-html.js diff --git a/core/modules/server/routes/get-tiddler.js b/core-server/server/routes/get-tiddler.js similarity index 100% rename from core/modules/server/routes/get-tiddler.js rename to core-server/server/routes/get-tiddler.js diff --git a/core/modules/server/routes/get-tiddlers-json.js b/core-server/server/routes/get-tiddlers-json.js similarity index 100% rename from core/modules/server/routes/get-tiddlers-json.js rename to core-server/server/routes/get-tiddlers-json.js diff --git a/core/modules/server/routes/put-tiddler.js b/core-server/server/routes/put-tiddler.js similarity index 100% rename from core/modules/server/routes/put-tiddler.js rename to core-server/server/routes/put-tiddler.js diff --git a/core/modules/server/server.js b/core-server/server/server.js similarity index 100% rename from core/modules/server/server.js rename to core-server/server/server.js diff --git a/core/modules/startup/load-modules.js b/core/modules/startup/load-modules.js index cf0a8232dd..c94335fb7e 100644 --- a/core/modules/startup/load-modules.js +++ b/core/modules/startup/load-modules.js @@ -31,5 +31,7 @@ exports.startup = function() { $tw.modules.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerModules); $tw.macros = $tw.modules.getModulesByTypeAsHashmap("macro"); $tw.wiki.initParsers(); - $tw.Commander.initCommands(); + if($tw.node) { + $tw.Commander.initCommands(); + } }; diff --git a/core/templates/external-js/save-all-external-js.tid b/core/templates/external-js/save-all-external-js.tid index 1f49088781..36bdd9f68a 100644 --- a/core/templates/external-js/save-all-external-js.tid +++ b/core/templates/external-js/save-all-external-js.tid @@ -3,7 +3,7 @@ title: $:/core/save/all-external-js \whitespace trim \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] $(publishFilter)$ \end diff --git a/core/templates/external-js/save-offline-external-js.tid b/core/templates/external-js/save-offline-external-js.tid index 70cb8bbc0d..bae0d16fdb 100644 --- a/core/templates/external-js/save-offline-external-js.tid +++ b/core/templates/external-js/save-offline-external-js.tid @@ -3,7 +3,7 @@ title: $:/core/save/offline-external-js \whitespace trim \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] $(publishFilter)$ \end \define defaultCoreURL() tiddlywikicore-$(version)$.js <$let coreURL={{{ [[coreURL]is[variable]thenelse] }}}> diff --git a/core/templates/save-all.tid b/core/templates/save-all.tid index a316d1954c..72fb9548dd 100644 --- a/core/templates/save-all.tid +++ b/core/templates/save-all.tid @@ -2,6 +2,6 @@ title: $:/core/save/all \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] $(publishFilter)$ \end {{$:/core/templates/tiddlywiki5.html}} diff --git a/core/templates/save-empty.tid b/core/templates/save-empty.tid index 0b1c33b595..372d1c4a1f 100644 --- a/core/templates/save-empty.tid +++ b/core/templates/save-empty.tid @@ -1,6 +1,6 @@ title: $:/core/save/empty \define saveTiddlerFilter() -[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end {{$:/core/templates/tiddlywiki5.html}} diff --git a/core/templates/save-lazy-all.tid b/core/templates/save-lazy-all.tid index da4353fba6..1162b1155d 100644 --- a/core/templates/save-lazy-all.tid +++ b/core/templates/save-lazy-all.tid @@ -1,7 +1,7 @@ title: $:/core/save/lazy-all \define saveTiddlerFilter() -[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]] +[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] [is[tiddler]type[application/javascript]] +[sort[title]] \end \define skinnySaveTiddlerFilter() [!is[system]] -[type[application/javascript]] diff --git a/core/templates/save-lazy-images.tid b/core/templates/save-lazy-images.tid index b23b348f0a..369c1e7e06 100644 --- a/core/templates/save-lazy-images.tid +++ b/core/templates/save-lazy-images.tid @@ -1,7 +1,7 @@ title: $:/core/save/lazy-images \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]] +[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] -[!is[system]is[image]] +[sort[title]] \end \define skinnySaveTiddlerFilter() [!is[system]is[image]] diff --git a/editions/de-AT/tiddlers/system/$__editions_de-AT-DE_download-empty.tid b/editions/de-AT/tiddlers/system/$__editions_de-AT-DE_download-empty.tid index d14f6c4c99..0bc96ec9a1 100755 --- a/editions/de-AT/tiddlers/system/$__editions_de-AT-DE_download-empty.tid +++ b/editions/de-AT/tiddlers/system/$__editions_de-AT-DE_download-empty.tid @@ -4,7 +4,7 @@ title: $:/editions/de-AT-DE/download-empty type: text/vnd.tiddlywiki \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/de-DE]] [[$:/languages/de-AT]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/de-DE]] [[$:/languages/de-AT]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/es-ES/tiddlers/system/download-empty.tid b/editions/es-ES/tiddlers/system/download-empty.tid index 64928eb2f4..8113ba50ad 100755 --- a/editions/es-ES/tiddlers/system/download-empty.tid +++ b/editions/es-ES/tiddlers/system/download-empty.tid @@ -2,7 +2,7 @@ title: $:/editions/es-ES/download-empty type: text/vnd.tiddlywiki \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/es-ES]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/es-ES]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/fr-FR/tiddlers/system/download-empty.tid b/editions/fr-FR/tiddlers/system/download-empty.tid index d07088b63c..f90e602059 100755 --- a/editions/fr-FR/tiddlers/system/download-empty.tid +++ b/editions/fr-FR/tiddlers/system/download-empty.tid @@ -2,7 +2,7 @@ title: $:/editions/fr-FR/download-empty type: text/vnd.tiddlywiki \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/fr-FR]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/fr-FR]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/ja-JP/tiddlers/system/download-empty.tid b/editions/ja-JP/tiddlers/system/download-empty.tid index 79b98e462f..a61a20258f 100644 --- a/editions/ja-JP/tiddlers/system/download-empty.tid +++ b/editions/ja-JP/tiddlers/system/download-empty.tid @@ -2,7 +2,7 @@ title: $:/editions/ja-JP/download-empty type: text/vnd.tiddlywiki \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/ja-JP]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/ja-JP]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/ko-KR/tiddlers/system/download-empty.tid b/editions/ko-KR/tiddlers/system/download-empty.tid index 75f80307ff..940d087284 100644 --- a/editions/ko-KR/tiddlers/system/download-empty.tid +++ b/editions/ko-KR/tiddlers/system/download-empty.tid @@ -2,7 +2,7 @@ title: $:/editions/ko-KR/download-empty type: text/vnd.tiddlywiki \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/ko-KR]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] [[$:/languages/ko-KR]] [[$:/language]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/prerelease/tiddlers/system/download-empty.tid b/editions/prerelease/tiddlers/system/download-empty.tid index 2c0eaa259a..0d91b9da6b 100644 --- a/editions/prerelease/tiddlers/system/download-empty.tid +++ b/editions/prerelease/tiddlers/system/download-empty.tid @@ -2,7 +2,7 @@ title: $:/editions/tw5.com/download-empty code-body: yes \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [[$:/config/OfficialPluginLibrary]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] [[$:/config/OfficialPluginLibrary]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/test/tiddlers/tests/test-filters.js b/editions/test/tiddlers/tests/test-filters.js index 4ba8a849ed..dee9128bf6 100644 --- a/editions/test/tiddlers/tests/test-filters.js +++ b/editions/test/tiddlers/tests/test-filters.js @@ -1137,7 +1137,7 @@ Tests the filtering mechanism. // No such tiddlers. Nothing to return. expect(wiki.filterTiddlers("[[nonexistent]moduleproperty[name]]").length).toBe(0); // Non string properties should get toStringed. - expect(wiki.filterTiddlers("[[$:/core/modules/commands/init.js]moduleproperty[info]]").join(" ")).toBe('{"name":"init","synchronous":true}'); + expect(wiki.filterTiddlers("[[$:/core/modules/startup.js]moduleproperty[synchronous]]").join(" ")).toBe('true'); }); it("should minimize unnecessary variable lookup", function() { diff --git a/editions/tw5.com/tiddlers/plugins/Plugin_Fields.tid b/editions/tw5.com/tiddlers/plugins/Plugin_Fields.tid index 5c2bb6fdfb..b7631602ce 100644 --- a/editions/tw5.com/tiddlers/plugins/Plugin_Fields.tid +++ b/editions/tw5.com/tiddlers/plugins/Plugin_Fields.tid @@ -19,4 +19,5 @@ Plugins are stored as tiddlers with the following fields: |text |JSON encoding of the list of tiddlers comprising the plugin | |title |Title of plugin | |type |Must be ''application/json'' | -|version |//(optional)// Version string (should conform to [ext[SemanticVersioning|http://semver.org/]] convention) | \ No newline at end of file +|version |//(optional)// Version string (should conform to [ext[SemanticVersioning|http://semver.org/]] convention) | +|platform |<<.from-version 5.4.0>> //(optional)// Set this field to ''node'' to restrict the plugin to only be loaded on the server (this is accomplished by suppressing such plugins from the various save templates) | diff --git a/editions/tw5.com/tiddlers/system/download-empty.tid b/editions/tw5.com/tiddlers/system/download-empty.tid index f49b9b7940..f8c2393904 100644 --- a/editions/tw5.com/tiddlers/system/download-empty.tid +++ b/editions/tw5.com/tiddlers/system/download-empty.tid @@ -2,7 +2,7 @@ title: $:/editions/tw5.com/download-empty code-body: yes \procedure saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \procedure savingEmpty() yes diff --git a/editions/tw5.com/tiddlers/webserver/WebServer API_ Get All Tiddlers.tid b/editions/tw5.com/tiddlers/webserver/WebServer API_ Get All Tiddlers.tid index 9c38f61573..4abcc3ec69 100644 --- a/editions/tw5.com/tiddlers/webserver/WebServer API_ Get All Tiddlers.tid +++ b/editions/tw5.com/tiddlers/webserver/WebServer API_ Get All Tiddlers.tid @@ -22,7 +22,7 @@ In order to avoid denial of service attacks with malformed filters in the defaul To enable a particular filter, create a tiddler with the title "$:/config/Server/ExternalFilters/" concatenated with the filter text, and the text field set to "yes". For example, the TiddlyWeb plugin includes the following shadow tiddler to enable the filter that it requires: ``` -title: $:/config/Server/ExternalFilters/[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/library/sjcl.js]] -[[$:/core]] +title: $:/config/Server/ExternalFilters/[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] -[[$:/library/sjcl.js]] -[[$:/core]] text: yes ``` diff --git a/editions/zh-Hans/tiddlers/system/download-empty-zh-Hans.tid b/editions/zh-Hans/tiddlers/system/download-empty-zh-Hans.tid index 861a1d410c..0fdcbe0410 100644 --- a/editions/zh-Hans/tiddlers/system/download-empty-zh-Hans.tid +++ b/editions/zh-Hans/tiddlers/system/download-empty-zh-Hans.tid @@ -1,7 +1,7 @@ title: $:/editions/zh-Hans/download-empty \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/language]] [[$:/languages/zh-Hans]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/language]] [[$:/languages/zh-Hans]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/editions/zh-Hant/tiddlers/system/download-empty-zh-Hant.tid b/editions/zh-Hant/tiddlers/system/download-empty-zh-Hant.tid index c061d95380..d76fcbf627 100644 --- a/editions/zh-Hant/tiddlers/system/download-empty-zh-Hant.tid +++ b/editions/zh-Hant/tiddlers/system/download-empty-zh-Hant.tid @@ -1,7 +1,7 @@ title: $:/editions/zh-Hant/download-empty \define saveTiddlerFilter() -[[$:/core]] [[$:/isEncrypted]] [[$:/language]] [[$:/languages/zh-Hant]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[[$:/core]] [[$:/isEncrypted]] [[$:/language]] [[$:/languages/zh-Hant]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end \define savingEmpty() yes diff --git a/plugins/tiddlywiki/tiddlyweb/config-tiddlers-filter.tid b/plugins/tiddlywiki/tiddlyweb/config-tiddlers-filter.tid index 4e5c951dbb..e71bb119a3 100644 --- a/plugins/tiddlywiki/tiddlyweb/config-tiddlers-filter.tid +++ b/plugins/tiddlywiki/tiddlyweb/config-tiddlers-filter.tid @@ -1,2 +1,2 @@ -title: $:/config/Server/ExternalFilters/[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/library/sjcl.js]] -[[$:/core]] +title: $:/config/Server/ExternalFilters/[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] -[[$:/library/sjcl.js]] -[[$:/core]] text: yes diff --git a/plugins/tiddlywiki/tiddlyweb/save-offline.tid b/plugins/tiddlywiki/tiddlyweb/save-offline.tid index 591a1e438a..06984d6527 100644 --- a/plugins/tiddlywiki/tiddlyweb/save-offline.tid +++ b/plugins/tiddlywiki/tiddlyweb/save-offline.tid @@ -2,6 +2,6 @@ title: $:/plugins/tiddlywiki/tiddlyweb/save/offline \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[[$:/boot/boot.css]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[prefix[$:/temp/]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[[$:/boot/boot.css]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[prefix[$:/temp/]] +[sort[title]] $(publishFilter)$ \end {{$:/core/templates/tiddlywiki5.html}} diff --git a/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js b/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js index b33d3b5e6c..38e034df7d 100644 --- a/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js +++ b/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js @@ -175,7 +175,7 @@ TiddlyWebAdaptor.prototype.getSkinnyTiddlers = function(callback) { $tw.utils.httpRequest({ url: this.host + "recipes/" + this.recipe + "/tiddlers.json", data: { - filter: "[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/library/sjcl.js]] -[[$:/core]]" + filter: "[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] -[[$:/library/sjcl.js]] -[[$:/core]]" }, callback: function(err,data) { // Check for errors diff --git a/plugins/tiddlywiki/upgrade/save-tiddler-filter.tid b/plugins/tiddlywiki/upgrade/save-tiddler-filter.tid index 988cdae540..4f94addf43 100644 --- a/plugins/tiddlywiki/upgrade/save-tiddler-filter.tid +++ b/plugins/tiddlywiki/upgrade/save-tiddler-filter.tid @@ -1,6 +1,6 @@ title: $:/plugins/tiddlywiki/upgrade/save-tiddler-filter \define saveTiddlerFilter() -[is[tiddler]] -[[$:/UpgradeLibrary]] -[[$:/plugins/tiddlywiki/upgrade]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[is[tiddler]] -[[$:/UpgradeLibrary]] -[[$:/plugins/tiddlywiki/upgrade]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[has[plugin-type]field:platform[server]] +[sort[title]] \end {{$:/core/templates/tiddlywiki5.html}}