mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Allow username to be set for the built-in server
This commit is contained in:
parent
9345078926
commit
a427702628
@ -157,7 +157,7 @@ var Command = function(params,commander,callback) {
|
||||
handler: function(request,response,state) {
|
||||
response.writeHead(200, {"Content-Type": "application/json"});
|
||||
var text = JSON.stringify({
|
||||
username: "ANONYMOUS",
|
||||
username: state.server.get("username"),
|
||||
space: {
|
||||
recipe: "default"
|
||||
},
|
||||
@ -221,11 +221,13 @@ Command.prototype.execute = function() {
|
||||
var port = this.params[0] || "8080",
|
||||
rootTiddler = this.params[1] || "$:/core/templates/tiddlywiki5.template.html",
|
||||
renderType = this.params[2] || "text/plain",
|
||||
serveType = this.params[3] || "text/html";
|
||||
serveType = this.params[3] || "text/html",
|
||||
username = this.params[4] || "ANONYMOUS";
|
||||
this.server.set({
|
||||
rootTiddler: rootTiddler,
|
||||
renderType: renderType,
|
||||
serveType: serveType
|
||||
serveType: serveType,
|
||||
username: username
|
||||
});
|
||||
this.server.listen(port);
|
||||
if(this.commander.verbose) {
|
||||
|
@ -6,22 +6,19 @@ The server built in to TiddlyWiki5 is very simple. Although compatible with Tidd
|
||||
At the root, it serves a rendering of a specified tiddler. Away from the root, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for `GET`, `PUT` and `DELETE`.
|
||||
|
||||
```
|
||||
--server <port> <roottiddler> <rendertype> <servetype>
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html
|
||||
--server <port> <roottiddler> <rendertype> <servetype> <username>
|
||||
```
|
||||
|
||||
The parameters are:
|
||||
|
||||
```
|
||||
--server <port> <roottiddler> <rendertype> <servetype>
|
||||
```
|
||||
|
||||
* ''port'' - port number to serve from (defaults to "8080")
|
||||
* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/tiddlywiki5.template.html")
|
||||
* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
|
||||
* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html")
|
||||
* ''username'' - the default username for signing edits
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html MyUserName
|
||||
```
|
||||
|
4
serve.sh
4
serve.sh
@ -2,8 +2,10 @@
|
||||
|
||||
# serve TiddlyWiki5 over HTTP
|
||||
|
||||
# Optional parameter is the username for signing edits
|
||||
|
||||
node ./tiddlywiki.js \
|
||||
editions/clientserver \
|
||||
--verbose \
|
||||
--server 8080 $:/core/templates/tiddlywiki5.template.html text/plain text/html \
|
||||
--server 8080 $:/core/templates/tiddlywiki5.template.html text/plain text/html $1\
|
||||
|| exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user