1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 01:57:19 +00:00

Minor tweaks to boot kernel for AWS

Part of the upcoming AWS integration work is a custom build of
TiddlyWiki that can run as an Amazon Lambda function. These tweaks
enable the new build to control the loading of SJCL, the package info,
and any preloaded tiddlers.
This commit is contained in:
Jermolene 2015-12-19 18:52:25 +00:00
parent 64b916bb43
commit ad1793c8f5
2 changed files with 14 additions and 7 deletions

View File

@ -590,7 +590,7 @@ Crypto helper object for encrypted content. It maintains the password text in a
the password, and to encrypt/decrypt a block of text
*/
$tw.utils.Crypto = function() {
var sjcl = $tw.node ? require("./sjcl.js") : window.sjcl,
var sjcl = $tw.node ? (global.sjcl || require("./sjcl.js")) : window.sjcl,
currentPassword = null,
callSjcl = function(method,inputText,password) {
password = password || currentPassword;
@ -1399,10 +1399,6 @@ $tw.loadTiddlersBrowser = function() {
for(var t=0; t<containerIds.length; t++) {
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById(containerIds[t])));
}
// Load any preloaded tiddlers
if($tw.preloadTiddlers) {
$tw.wiki.addTiddlers($tw.preloadTiddlers);
}
};
} else {
@ -1808,7 +1804,7 @@ $tw.boot.startup = function(options) {
$tw.boot.wikiPath = process.cwd();
}
// Read package info
$tw.packageInfo = require("../package.json");
$tw.packageInfo = $tw.packageInfo || require("../package.json");
// Check node version number
if(!$tw.utils.checkVersions(process.version.substr(1),$tw.packageInfo.engines.node.substr(2))) {
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engines.node);
@ -1866,6 +1862,10 @@ $tw.boot.startup = function(options) {
} else {
$tw.loadTiddlersNode();
}
// Load any preloaded tiddlers
if($tw.preloadTiddlers) {
$tw.wiki.addTiddlers($tw.preloadTiddlers);
}
// Unpack plugin tiddlers
$tw.wiki.readPluginInfo();
$tw.wiki.registerPluginTiddlers("plugin",$tw.safeMode ? ["$:/core"] : undefined);

View File

@ -99,7 +99,14 @@ $tw.preloadTiddler = function(fields) {
$tw.preloadTiddlers.push(fields);
};
return $tw
/*
Convenience function for pushing an array of tiddlers onto the preloading array
*/
$tw.preloadTiddlerArray = function(fieldsArray) {
$tw.preloadTiddlers.push.apply($tw.preloadTiddlers,fieldsArray);
};
return $tw;
});