1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-02-03 12:49:09 +00:00

Merge branch 'master' into geospatial-plugin

This commit is contained in:
jeremy@jermolene.com 2022-12-30 17:24:52 +00:00
commit e3773ded23
18 changed files with 88 additions and 71 deletions

View File

@ -1881,7 +1881,7 @@ A default set of files for TiddlyWiki to ignore during load.
This matches what NPM ignores, and adds "*.meta" to ignore tiddler
metadata files.
*/
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
$tw.boot.excludeRegExp = /^\.DS_Store$|^.*\.meta$|^\..*\.swp$|^\._.*$|^\.git$|^\.github$|^\.vscode$|^\.hg$|^\.lock-wscript$|^\.svn$|^\.wafpickle-.*$|^CVS$|^npm-debug\.log$/;
/*
Load all the tiddlers recursively from a directory, including honouring `tiddlywiki.files` files for drawing in external files. Returns an array of {filepath:,type:,tiddlers: [{..fields...}],hasMetaFile:}. Note that no file information is returned for externally loaded tiddlers, just the `tiddlers` property.
@ -2408,6 +2408,7 @@ $tw.boot.initStartup = function(options) {
$tw.utils.registerFileType("video/webm","base64",".webm");
$tw.utils.registerFileType("video/mp4","base64",".mp4");
$tw.utils.registerFileType("audio/mp3","base64",".mp3");
$tw.utils.registerFileType("audio/mpeg","base64");
$tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});
$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
$tw.utils.registerFileType("application/enex+xml","utf8",".enex");

View File

@ -176,7 +176,11 @@ function getDataItem(data,indexes) {
var item = data;
for(var i=0; i<indexes.length; i++) {
if(item !== undefined) {
item = item[indexes[i]];
if(item !== null && ["number","string","boolean"].indexOf(typeof item) === -1) {
item = item[indexes[i]];
} else {
item = undefined;
}
}
}
return item;

View File

@ -21,6 +21,7 @@ exports.handler = function(request,response,state) {
username: state.authenticatedUsername || state.server.get("anon-username") || "",
anonymous: !state.authenticatedUsername,
read_only: !state.server.isAuthorized("writers",state.authenticatedUsername),
logout_is_available: false,
space: {
recipe: "default"
},

View File

@ -687,7 +687,7 @@ exports.escapeRegExp = function(s) {
// Checks whether a link target is external, i.e. not a tiddler title
exports.isLinkExternal = function(to) {
var externalRegExp = /^(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s<>{}\[\]`|"\\^]+(?:\/|\b)/i;
var externalRegExp = /^(?:file|http|https|mailto|ftp|irc|news|obsidian|data|skype):[^\s<>{}\[\]`|"\\^]+(?:\/|\b)/i;
return externalRegExp.test(to);
};

View File

@ -8,19 +8,19 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","index.html","text/plain"],
"--render","$:/core/save/all","index.html","text/plain"],
"empty": [
"--rendertiddler","$:/core/save/all","empty.html","text/plain",
"--rendertiddler","$:/core/save/all","empty.hta","text/plain"],
"--render","$:/core/save/all","empty.html","text/plain",
"--render","$:/core/save/all","empty.hta","text/plain"],
"externalimages": [
"--savetiddlers","[is[image]]","images",
"--setfield","[is[image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
"--setfield","[is[image]]","text","","text/plain",
"--rendertiddler","$:/core/save/all","externalimages.html","text/plain"],
"--render","$:/core/save/all","externalimages.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"]
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
}
}

View File

@ -11,11 +11,11 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","highlightdemo.html","text/plain"],
"--render","$:/core/save/all","highlightdemo.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"]
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
}
}

View File

@ -11,11 +11,11 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","katexdemo.html","text/plain"],
"--render","$:/core/save/all","katexdemo.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"]
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
}
}

View File

@ -6,6 +6,7 @@ title: Release 5.2.6
type: text/vnd.tiddlywiki
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.2.5...master]]//
! Major Improvements
New [ext[Twitter Archivist|./editions/twitter-archivist]] plugin to import the tweets and associated media from a Twitter Archive as individual tiddlers.

View File

@ -13,13 +13,13 @@
"listen": [
"--listen","root-tiddler=$:/core/save/all-external-js","use-browser-cache=yes"],
"index": [
"--rendertiddler","$:/core/save/offline-external-js","index.html","text/plain",
"--render","$:/core/save/offline-external-js","index.html","text/plain",
"--render","$:/core/templates/tiddlywiki5.js","[[tiddlywikicore-]addsuffix<version>addsuffix[.js]]","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"],
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"],
"tiddlywikicore": [
"--render","$:/core/templates/tiddlywiki5.js","[[tiddlywikicore-]addsuffix<version>addsuffix[.js]]","text/plain"]
}

View File

@ -11,11 +11,11 @@
],
"build": {
"index": [
"--rendertiddler","$:/plugins/tiddlywiki/tiddlyweb/save/offline","index.html","text/plain"],
"--render","$:/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"]
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
}
}

View File

@ -41,7 +41,9 @@ describe("json filter tests", function() {
expect(wiki.filterTiddlers("[{Second}jsonget[]]")).toEqual(["une","deux","trois","quatre","cinq"]);
expect(wiki.filterTiddlers("[{First}jsonget[]]")).toEqual(["one","","1.618","four","five","six","true","false","null"]);
expect(wiki.filterTiddlers("[{First}jsonget[a]]")).toEqual(["one"]);
expect(wiki.filterTiddlers("[{First}jsonget[a],[fixed]]")).toEqual([]);
expect(wiki.filterTiddlers("[{First}jsonget[b]]")).toEqual([""]);
expect(wiki.filterTiddlers("[{First}jsonget[c]]")).toEqual(["1.618"]);
expect(wiki.filterTiddlers("[{First}jsonget[missing-property]]")).toEqual([]);
expect(wiki.filterTiddlers("[{First}jsonget[d]]")).toEqual(["four","five","six","true","false","null"]);
expect(wiki.filterTiddlers("[{First}jsonget[d],[e]]")).toEqual(["four"]);

View File

@ -15,14 +15,14 @@
"--savetiddlers","[tag[external-image]]","images",
"--setfield","[tag[external-image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
"--setfield","[tag[external-image]]","text","","text/plain",
"--rendertiddler","$:/core/save/all","index.html","text/plain"],
"--render","$:/core/save/all","index.html","text/plain"],
"favicon": [
"--savetiddler","$:/favicon.ico","favicon.ico"],
"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"]
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
},
"config": {
"retain-original-tiddler-path": true

View File

@ -10,6 +10,6 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","index.html","text/plain"]
"--render","$:/core/save/all","index.html","text/plain"]
}
}

View File

@ -25,6 +25,7 @@ The JSON data returned comprises the following properties:
* ''username'' - the username of the currently authenticated user. If undefined, the [[WebServer Parameter: anon-username]] is returned instead
* ''anonymous'' - true if the current user is anonymous
* ''read_only'' - true if the current user is restricted to read only access to the server
* ''logout_is_available'' - true if the server supports logging out (optional, defaults to true)
* ''space'' - always contains the object `{recipe: "default"}`
* ''tiddlywiki_version'' - the current TiddlyWiki version

View File

@ -25,35 +25,35 @@
"build": {
"index": [
"--savetiddlers","[tag[external-image]]","images",
"--rendertiddlers","[tag[external-text]]","$:/core/templates/tid-tiddler","text","text/plain",".tid",
"--render","[tag[external-text]]","[encodeuricomponent[]addprefix[text/]addsuffix[.tid]]","text/plain","$:/core/templates/tid-tiddler",
"--setfield","[tag[external-image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
"--setfield","[tag[external-text]]","_canonical_uri","$:/core/templates/canonical-uri-external-text","text/plain",
"--setfield","[tag[external-image]] [tag[external-text]]","text","","text/plain",
"--rendertiddler","$:/core/save/all","index.html","text/plain"],
"--render","$:/core/save/all","index.html","text/plain"],
"empty": [
"--rendertiddler","$:/editions/tw5.com/download-empty","empty.html","text/plain",
"--rendertiddler","$:/editions/tw5.com/download-empty","empty.hta","text/plain"],
"--render","$:/editions/tw5.com/download-empty","empty.html","text/plain",
"--render","$:/editions/tw5.com/download-empty","empty.hta","text/plain"],
"encrypted": [
"--password", "password",
"--rendertiddler", "$:/core/save/all", "encrypted.html", "text/plain",
"--render", "$:/core/save/all", "encrypted.html", "text/plain",
"--clearpassword"],
"favicon": [
"--savetiddler","$:/favicon.ico","favicon.ico",
"--savetiddler","$:/green_favicon.ico","static/favicon.ico"],
"readmes": [
"--rendertiddler","ReadMe","readme.md","text/html",
"--rendertiddler","ReadMeBinFolder","bin/readme.md","text/html",
"--rendertiddler","ContributingTemplate","contributing.md","text/html",
"--rendertiddler","$:/core/copyright.txt","license","text/plain"],
"--render","ReadMe","readme.md","text/html",
"--render","ReadMeBinFolder","bin/readme.md","text/html",
"--render","ContributingTemplate","contributing.md","text/html",
"--render","$:/core/copyright.txt","license","text/plain"],
"tw2": [
"--rendertiddler","TiddlyWiki2ReadMe","tw2/readme.md","text/html"],
"--render","TiddlyWiki2ReadMe","tw2/readme.md","text/html"],
"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"],
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"],
"external-js": [
"--rendertiddler","$:/core/save/offline-external-js","index.html","text/plain",
"--render","$:/core/save/offline-external-js","index.html","text/plain",
"--render","$:/core/templates/tiddlywiki5.js","[[tiddlywikicore-]addsuffix<version>addsuffix[.js]]","text/plain"]
},
"config": {

View File

@ -11,6 +11,6 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","index.html","text/plain"]
"--render","$:/core/save/all","index.html","text/plain"]
}
}

View File

@ -23,6 +23,7 @@ function TiddlyWebAdaptor(options) {
this.logger = new $tw.utils.Logger("TiddlyWebAdaptor");
this.isLoggedIn = false;
this.isReadOnly = false;
this.logoutIsAvailable = true;
}
TiddlyWebAdaptor.prototype.name = "tiddlyweb";
@ -91,6 +92,7 @@ TiddlyWebAdaptor.prototype.getStatus = function(callback) {
self.isLoggedIn = json.username !== "GUEST";
self.isReadOnly = !!json["read_only"];
self.isAnonymous = !!json.anonymous;
self.logoutIsAvailable = "logout_is_available" in json ? !!json["logout_is_available"] : true;
}
// Invoke the callback if present
if(callback) {
@ -127,23 +129,28 @@ TiddlyWebAdaptor.prototype.login = function(username,password,callback) {
/*
*/
TiddlyWebAdaptor.prototype.logout = function(callback) {
var options = {
url: this.host + "logout",
type: "POST",
data: {
csrf_token: this.getCsrfToken(),
tiddlyweb_redirect: "/status" // workaround to marginalize automatic subsequent GET
},
callback: function(err,data) {
callback(err);
},
headers: {
"accept": "application/json",
"X-Requested-With": "TiddlyWiki"
}
};
this.logger.log("Logging out:",options);
$tw.utils.httpRequest(options);
if(this.logoutIsAvailable) {
var options = {
url: this.host + "logout",
type: "POST",
data: {
csrf_token: this.getCsrfToken(),
tiddlyweb_redirect: "/status" // workaround to marginalize automatic subsequent GET
},
callback: function(err,data,xhr) {
callback(err);
},
headers: {
"accept": "application/json",
"X-Requested-With": "TiddlyWiki"
}
};
this.logger.log("Logging out:",options);
$tw.utils.httpRequest(options);
} else {
alert("This server does not support logging out. If you are using basic authentication the only way to logout is close all browser windows");
callback(null);
}
};
/*

View File

@ -127,7 +127,7 @@ var insertMacroCall = function(w,output,macroName,paramString) {
var isLinkExternal = function(to) {
var externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data|skype):[^\s'"]+(?:\/|\b)/i;
var externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|obsidian|data|skype):[^\s'"]+(?:\/|\b)/i;
return externalRegExp.test(to);
};
var rules = [