1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-19 00:04:51 +00:00
TiddlyWiki5/core/modules/server/routes/get-status.js

34 lines
775 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) {
var text = JSON.stringify({
username: state.authenticatedUsername || state.server.get("anon-username") || "",
anonymous: !state.authenticatedUsername,
read_only: !state.server.isAuthorized("writers",state.authenticatedUsername),
sse_enabled: state.server.get("sse-enabled") === "yes",
space: {
recipe: "default"
},
tiddlywiki_version: $tw.version
});
state.sendResponse(200,{"Content-Type": "application/json"},text,"utf8");
};
}());