1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-30 15:13:00 +00:00
Files
TiddlyWiki5/core/modules/server/routes/get-status.js
Jermolene bdb68fea6d Do the right thing when we have a username but no password
With a username parameter but no password parameter we'll attribute edits to that username, but not require authentication.
2018-06-26 15:40:29 +01:00

32 lines
606 B
JavaScript

/*\
title: $:/core/modules/server/routes/get-status.js
type: application/javascript
module-type: route
GET /status
\*/
(function() {
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.method = "GET";
exports.path = /^\/status$/;
exports.handler = function(request,response,state) {
response.writeHead(200, {"Content-Type": "application/json"});
var text = JSON.stringify({
username: state.authenticatedUsername || state.server.get("username") || "",
space: {
recipe: "default"
},
tiddlywiki_version: $tw.version
});
response.end(text,"utf8");
};
}());