fix/optimize wtv-author, wtv-favorite

This commit is contained in:
zefie
2025-08-12 20:44:15 -04:00
parent 011229cc22
commit 6827746799
54 changed files with 543 additions and 610 deletions

View File

@@ -1,13 +1,14 @@
var minisrv_service_file = true;
var create = true;
var pagenums = session_data.pagestore.listPages().length;
const minisrv_service_file = true;
let create = true;
const pagenums = session_data.pagestore.listPages().length;
if (minisrv_config.services["wtv-author"].max_pages) {
if (pagenums + 1 > minisrv_config.services["wtv-author"].max_pages) {
create = false;
}
}
if (create) {
var pagename = session_data.pagestore.createPage(request_headers.query.styleName.replace(' ', '_'));
const pagename = session_data.pagestore.createPage(request_headers.query.styleName.replace(' ', '_'));
headers = `300 OK
Connection: Keep-Alive
@@ -15,7 +16,7 @@ Content-Type: text/html
wtv-expire-all: wtv-author:/documents
Location: wtv-author:/show-blocks?docName=${pagename}`
} else {
var err = wtvshared.doErrorPage(500, "You are not allowed to create more than <b>"+minisrv_config.services["wtv-author"].max_pages+"</b> pages.");
const err = wtvshared.doErrorPage(500, "You are not allowed to create more than <b>"+minisrv_config.services["wtv-author"].max_pages+"</b> pages.");
headers = err[0];
data = err[1];
}