mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-17 07:14:50 +00:00
34 lines
734 B
JavaScript
34 lines
734 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("anon-username") || "",
|
||
|
anonymous: !state.authenticatedUsername,
|
||
|
read_only: !state.server.isAuthorized("writers",state.authenticatedUsername),
|
||
|
space: {
|
||
|
recipe: "default"
|
||
|
},
|
||
|
tiddlywiki_version: $tw.version
|
||
|
});
|
||
|
response.end(text,"utf8");
|
||
|
};
|
||
|
|
||
|
}());
|