Fix syncing issues with external JS template

Fixes #4808
optimising-macrocalls
jeremy@jermolene.com 2020-08-14 11:06:08 +01:00
rodzic 8cf458d3b3
commit f74c49f393
6 zmienionych plików z 33 dodań i 10 usunięć

Wyświetl plik

@ -2,8 +2,4 @@ title: $:/core/templates/tiddlywiki5.js/tiddlers
`
$tw.preloadTiddlerArray(`<$text text=<<jsontiddlers "[[$:/core]]">>/>`);
$tw.preloadTiddlerArray([{
title: "$:/config/SaveWikiButton/Template",
text: "$:/core/save/all-external-js"
}]);
`

Wyświetl plik

@ -1,3 +1,3 @@
title: $:/config/SyncFilter
[is[tiddler]] -[[$:/HistoryList]] -[[$:/Import]] -[[$:/isEncrypted]] -[prefix[$:/status/]] -[prefix[$:/state/]] -[prefix[$:/temp/]]
[is[tiddler]] -[[$:/core]] -[[$:/HistoryList]] -[[$:/Import]] -[[$:/isEncrypted]] -[prefix[$:/status/]] -[prefix[$:/state/]] -[prefix[$:/temp/]]

Wyświetl plik

@ -0,0 +1,23 @@
{
"description": "Client-server edition with external tiddlywiki.js",
"plugins": [
"tiddlywiki/tiddlyweb",
"tiddlywiki/filesystem",
"tiddlywiki/highlight"
],
"themes": [
"tiddlywiki/vanilla",
"tiddlywiki/snowwhite"
],
"build": {
"listen": [
"--listen","root-tiddler=$:/core/save/all-external-js"],
"index": [
"--rendertiddler","$:/plugins/tiddlywiki/tiddlyweb/save/offline","index.html","text/plain"],
"static": [
"--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"]
}
}

Wyświetl plik

@ -1,18 +1,22 @@
created: 20180905075846391
modified: 20180905080955513
modified: 20200814110131083
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:
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"
```
To ensure that the "save changes" button saves a full, standalone wiki, it is also necessary to set the tiddler $:/config/SaveWikiButton/Template to contain `$:/core/save/all-external-js`.
The provided edition `server-external-js` contains all the configuration necessary to use the external ~JavaScript template.
!! 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 chances of it still functioning in the future.
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 chances 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.

Wyświetl plik

@ -1,2 +1,2 @@
title: $:/config/Server/ExternalFilters/[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]]
title: $:/config/Server/ExternalFilters/[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/library/sjcl.js]] -[[$:/core]]
text: yes

Wyświetl plik

@ -159,7 +159,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/]]"
filter: "[all[tiddlers]] -[[$:/isEncrypted]] -[prefix[$:/temp/]] -[prefix[$:/status/]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/library/sjcl.js]] -[[$:/core]]"
},
callback: function(err,data) {
// Check for errors