const minisrv_service_file = true;
const docName = request_headers.query.docName;
const page = session_data.pagestore.loadPage(docName);
const site = session_data.pagestore.getPublishDomain();
if (request_headers.query.publishStage === "1") {
headers = `200 OK
Content-Type: text/html`
data = `
Ready to publish
`
} else if (request_headers.query.publishStage === "2") {
let inlist;
if (typeof request_headers.query.includeInPublicList !== 'undefined') {
inlist = true;
} else {
inlist = false;
}
const result = session_data.pagestore.publishPage(docName, inlist);
if (result === true) {
headers = `300 OK
wtv-expire-all: wtv-author:/documents
Location: wtv-author:/congrats?docName=${docName}`
} else {
headers = `400 ${result}`
}
} else if (request_headers.query.unpublish === "1") {
const result = session_data.pagestore.unpublishPage(docName);
if (result === true) {
headers = `300 OK
wtv-expire-all: wtv-author:/documents
wtv-expire-all: wtv-author:/doc-info
Location: wtv-author:/doc-info?docName=${docName}`
} else {
headers = `400 ${result}`
}
} else {
headers = `300 OK
wtv-expire-all: wtv-author:/block-preview
wtv-expire-all: wtv-author:/preview
wtv-expire-all: wtv-author:/show-blocks
Location: wtv-author:/edit-title?docName=${docName}&publishing=true`
}