diff --git a/core/templates/external-js/save-all-external-js.tid b/core/templates/external-js/save-all-external-js.tid new file mode 100644 index 000000000..31476e663 --- /dev/null +++ b/core/templates/external-js/save-all-external-js.tid @@ -0,0 +1,6 @@ +title: $:/core/save/all-external-js + +\define saveTiddlerFilter() +[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +\end +{{$:/core/templates/tiddlywiki5-external-js.html}} diff --git a/core/templates/external-js/tiddlywiki.js.tid b/core/templates/external-js/tiddlywiki.js.tid new file mode 100644 index 000000000..a8170663f --- /dev/null +++ b/core/templates/external-js/tiddlywiki.js.tid @@ -0,0 +1,15 @@ +title: $:/core/templates/tiddlywiki5.js + +\rules only filteredtranscludeinline transcludeinline codeinline + +/* +{{ $:/core/copyright.txt ||$:/core/templates/plain-text-tiddler}} +`*/ +` +{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/plain-text-tiddler}}} + +{{ $:/boot/bootprefix.js ||$:/core/templates/plain-text-tiddler}} + +{{$:/core/templates/tiddlywiki5.js/tiddlers}} + +{{ $:/boot/boot.js ||$:/core/templates/plain-text-tiddler}} diff --git a/core/templates/external-js/tiddlywiki.js.tiddlers.tid b/core/templates/external-js/tiddlywiki.js.tiddlers.tid new file mode 100644 index 000000000..52b2c293f --- /dev/null +++ b/core/templates/external-js/tiddlywiki.js.tiddlers.tid @@ -0,0 +1,9 @@ +title: $:/core/templates/tiddlywiki5.js/tiddlers + +` +$tw.preloadTiddlerArray(`<$text text=<>/>`); +$tw.preloadTiddlerArray([{ + title: "$:/config/SaveWikiButton/Template", + text: "$:/core/save/all-external-js" +}]); +` diff --git a/core/templates/external-js/tiddlywiki5-external-js.html.tid b/core/templates/external-js/tiddlywiki5-external-js.html.tid new file mode 100644 index 000000000..611da06b0 --- /dev/null +++ b/core/templates/external-js/tiddlywiki5-external-js.html.tid @@ -0,0 +1,41 @@ +title: $:/core/templates/tiddlywiki5-external-js.html + +\rules only filteredtranscludeinline transcludeinline + +{{$:/core/templates/MOTW.html}} + + + + + + + + + + + + + +{{$:/core/wiki/title}} + + + +{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}} +{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}} + + + +
+{{$:/boot/boot.css||$:/core/templates/css-tiddler}} +
+ + + +{{$:/core/templates/store.area.template.html}} + + + diff --git a/editions/tw5.com/tiddlers/Using the external JavaScript template.tid b/editions/tw5.com/tiddlers/Using the external JavaScript template.tid new file mode 100644 index 000000000..c6c2373cb --- /dev/null +++ b/editions/tw5.com/tiddlers/Using the external JavaScript template.tid @@ -0,0 +1,19 @@ +created: 20180905075846391 +modified: 20180905080955513 +tags: [[WebServer Guides]] +title: Using the external JavaScript template +type: text/vnd.tiddlywiki + +Setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js` switches to a special template that externalises TiddlyWiki's core JavaScript into a separate file. For example: + +``` +tiddlywiki editions/tw5.com-server/ --listen host=0.0.0.0 "root-tiddler=$:/core/save/all-external-js" +``` + +!! Background + +TiddlyWiki in the single file configuration ordinarily packs everything into a single file: your data, and the JavaScript, CSS and HTML comprising TiddlyWiki itself. This lack of dependencies is usually very convenient: it means that it is impossible for the parts of a TiddlyWiki to become separated, and enormously improves the changes of it still functioning in the future. + +However, there is some inefficiency in this arrangement because the core code is repeatedly loaded and saved every time the content of the wiki is saved. This inefficiency is partially ameliorated when working in the client server configuration because once the wiki is loaded by the browser the synchronisation process only transmits individual tiddlers back and forth to the server. + +The remaining inefficiency when working in the client server configuration is that the single page wiki that is initially loaded will contain a copy of the entire core code of TiddlyWiki, making it impossible for the browser to cache it. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/webserver/WebServer Authorization.tid b/editions/tw5.com/tiddlers/webserver/WebServer Authorization.tid index 8bd2e0566..49ba60a6c 100644 --- a/editions/tw5.com/tiddlers/webserver/WebServer Authorization.tid +++ b/editions/tw5.com/tiddlers/webserver/WebServer Authorization.tid @@ -1,5 +1,5 @@ created: 20180630194006239 -modified: 20180701174944267 +modified: 20180904174030250 tags: WebServer title: WebServer Authorization type: text/vnd.tiddlywiki @@ -13,6 +13,17 @@ The available special tokens are: * ''(anon)'' - indicates all anonymous users * ''(authenticated)'' - indicates all authenticated users +!! Read-only Mode + +Read-only mode is engaged when the current user is not authorized to write to the current wiki. + +User interface features concerned with creating or editing content are disabled in read-only mode: + +* ''clone'', ''delete'', ''new-here'' and ''new-journal-here'' tiddler toolbar buttons +* ''import'', ''manager'', ''new-tiddler'' ''new-image'' and ''new-journal'' page control buttons + +The tiddler $:/status/IsReadOnly is set to `yes` when read-only mode is engaged. + !! Examples These example use the [[credentials|WebServer Parameter: credentials]] parameter to specify the location of a file containing usernames and passwords. diff --git a/editions/tw5.com/tiddlywiki.info b/editions/tw5.com/tiddlywiki.info index a845845d3..aa3cd5707 100644 --- a/editions/tw5.com/tiddlywiki.info +++ b/editions/tw5.com/tiddlywiki.info @@ -48,7 +48,10 @@ "--rendertiddler","$:/core/templates/static.template.html","static.html","text/plain", "--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain", "--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain", - "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"] + "--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"], + "external-js": [ + "--rendertiddler","$:/core/save/all-external-js","index.html","text/plain", + "--rendertiddler","$:/core/templates/tiddlywiki5.js","tiddlywiki.js","text/plain"] }, "config": { "retain-original-tiddler-path": true