From 8fdaaa72135aca08b1528006b1b7d129919381b1 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Fri, 9 Dec 2022 22:54:38 +0000 Subject: [PATCH 1/2] Minimal functional built-in plugin library --- core/modules/library.js | 100 ++++++++++++++ .../modules/server/routes/get-library-html.js | 24 ++++ .../modules/server/routes/get-library-item.js | 31 +++++ core/modules/server/routes/get-library.js | 24 ++++ core/modules/startup/startup.js | 2 + .../server/library.template.html.tid | 127 ++++++++++++++++++ .../tiddlywiki/tiddlyweb/BuiltInLibrary.tid | 6 + 7 files changed, 314 insertions(+) create mode 100644 core/modules/library.js create mode 100644 core/modules/server/routes/get-library-html.js create mode 100644 core/modules/server/routes/get-library-item.js create mode 100644 core/modules/server/routes/get-library.js create mode 100644 core/templates/server/library.template.html.tid create mode 100644 plugins/tiddlywiki/tiddlyweb/BuiltInLibrary.tid diff --git a/core/modules/library.js b/core/modules/library.js new file mode 100644 index 000000000..c238e7ef1 --- /dev/null +++ b/core/modules/library.js @@ -0,0 +1,100 @@ +/*\ +title: $:/core/modules/library.js +type: application/javascript +module-type: global + +Library handling utilities + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +function Library(options) { +} + +/* +*/ +Library.prototype.getLibraryItems = function() { + if(!this.items) { + this.loadLibraryItems(); + } +}; + +/* +*/ +Library.prototype.loadLibraryItems = function() { + var self = this, + fs = require("fs"), + path = require("path"); + // Collect the library items from disk + this.items = {}; + var collectPlugins = function(folder) { + var pluginFolders = $tw.utils.getSubdirectories(folder) || []; + for(var p=0; p + + + + + + + +Plugin Library + + + + +

HelloThere

+ +

This is the TiddlyWiki plugin library. It is not intended to be opened directly in the browser.

+ +

See https://tiddlywiki.com/ for details of how to install plugins.

+ + + \ No newline at end of file diff --git a/plugins/tiddlywiki/tiddlyweb/BuiltInLibrary.tid b/plugins/tiddlywiki/tiddlyweb/BuiltInLibrary.tid new file mode 100644 index 000000000..f5e212563 --- /dev/null +++ b/plugins/tiddlywiki/tiddlyweb/BuiltInLibrary.tid @@ -0,0 +1,6 @@ +title: $:/plugins/tiddlywiki/tiddlyweb/BuiltinLibrary +tags: $:/tags/PluginLibrary +url: /library +caption: TiddlyWiki Built-in Plugin Library + +This is the TiddlyWiki Built-in Plugin Library From e9e60063dfa990d51587c1d2ffe0b7940bb81231 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sat, 10 Dec 2022 14:11:58 +0000 Subject: [PATCH 2/2] Fix comment --- core/modules/server/routes/get-library-html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/server/routes/get-library-html.js b/core/modules/server/routes/get-library-html.js index 87f0aa80e..dfe106abc 100644 --- a/core/modules/server/routes/get-library-html.js +++ b/core/modules/server/routes/get-library-html.js @@ -3,7 +3,7 @@ title: $:/core/modules/server/routes/get-library-html.js type: application/javascript module-type: route -GET /library/ +GET /library/{:title} \*/ (function() {