- numerous bug fixes
 - wtv-news goodies, ready for local testing
   - custom patched nntp-server node module with support for POSTing
   - should be able to post locally
   - 4 groups are made by default
   - can override in user_config.json (look at the config.json changes but dont do them there)
   - can sync down from an upstream server with sync_nntp.js
   - sync does not push new posts to upstream yet
This commit is contained in:
zefie
2022-10-11 21:44:18 -04:00
parent 1165b245ce
commit b89e0e932c
181 changed files with 4333 additions and 688 deletions

View File

@@ -0,0 +1,48 @@
var minisrv_service_file = true;
var WTVAdmin = require(classPath + "/WTVAdmin.js");
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
var auth = wtva.isAuthorized();
if (auth === true) {
var password = null;
if (request_headers.Authorization) {
var authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
}
if (wtva.checkPassword(password)) {
var user_config = wtvshared.getUserConfig();
Object.keys(request_headers.query).forEach((k) => {
if (k === "autosubmit") return;
var v = request_headers.query[k];
if (!isNaN(parseInt(v))) v = parseInt(v);
if (v === "on" || v === "true" || v === "false") v = wtvshared.parseBool(v);
if (k.indexOf("-") > 0) {
var s = k.split("-");
if (!user_config.config[s[0]]) user_config.config[s[0]] = {}
user_config.config[s[0]][s[1]] = v;
} else {
user_config.config[k] = v;
}
});
var res = wtvshared.writeToUserConfig(user_config);
if (res) {
console.log(" * Configuration updated from wtv-admin, reloading")
reloadConfig();
headers = "200 OK\nwtv-expire-all: wtv-admin:/operatortweaks\nContent-Type: text/html";
} else {
err = wtvshared.doErrorPage(400, "Error writing userconfig");
headers = err[0];
data = err[1];
}
}
}
if (!headers) {
err = wtvshared.doErrorPage();
headers = err[0];
data = err[1];
}