mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-05 23:10:28 +00:00
Server extension framework
May not actually be needed
This commit is contained in:
parent
615dc0c4a3
commit
8941bd1747
@ -43,6 +43,14 @@ function Server(options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Register server extensions
|
||||
this.extensions = [];
|
||||
$tw.modules.forEachModuleOfType("server-extension",function(title,exports) {
|
||||
var extension = new exports.Extension(self);
|
||||
self.extensions.push(extension);
|
||||
});
|
||||
// Initialise server extensions
|
||||
this.invokeExtensionHook("server-start-initialisation");
|
||||
// Setup the default required plugins
|
||||
this.requiredPlugins = this.get("required-plugins").split(',');
|
||||
// Initialise CSRF
|
||||
@ -96,8 +104,16 @@ function Server(options) {
|
||||
this.servername = $tw.utils.transliterateToSafeASCII(this.get("server-name") || this.wiki.getTiddlerText("$:/SiteTitle") || "TiddlyWiki5");
|
||||
this.boot.origin = this.get("origin")? this.get("origin"): this.protocol+"://"+this.get("host")+":"+this.get("port");
|
||||
this.boot.pathPrefix = this.get("path-prefix") || "";
|
||||
// Complete initialisation of server extensions
|
||||
this.invokeExtensionHook("server-completed-initialisation");
|
||||
}
|
||||
|
||||
Server.prototype.invokeExtensionHook = function(hookName) {
|
||||
$tw.utils.each(this.extensions,function(extension) {
|
||||
extension.hook(hookName);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
Send a response to the client. This method checks if the response must be sent
|
||||
or if the client alrady has the data cached. If that's the case only a 304
|
||||
|
@ -0,0 +1,25 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/multiwikiserver/server-extension.js
|
||||
type: application/javascript
|
||||
module-type: server-extension
|
||||
|
||||
Multi wiki server extension for the core server object
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
function Extension(server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
Extension.prototype.hook = function(name) {
|
||||
|
||||
};
|
||||
|
||||
exports.Extension = Extension;
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user