[Status Page] wip

pull/863/head
Louis Lam 3 years ago
parent 7c7dbf68c1
commit 18ec42b060

@ -5,14 +5,15 @@ CREATE TABLE [status_page](
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
[slug] VARCHAR(255) NOT NULL UNIQUE, [slug] VARCHAR(255) NOT NULL UNIQUE,
[title] VARCHAR(255) NOT NULL, [title] VARCHAR(255) NOT NULL,
[description] TEXT,
[icon] VARCHAR(255) NOT NULL, [icon] VARCHAR(255) NOT NULL,
[theme] VARCHAR(30) NOT NULL, [theme] VARCHAR(30) NOT NULL,
[published] BOOLEAN NOT NULL DEFAULT 1, [published] BOOLEAN NOT NULL DEFAULT 1,
[search_engine_index] BOOLEAN NOT NULL DEFAULT 1, [search_engine_index] BOOLEAN NOT NULL DEFAULT 1,
[show_tags] BOOLEAN NOT NULL DEFAULT 0, [show_tags] BOOLEAN NOT NULL DEFAULT 0,
[password] VARCHAR, [password] VARCHAR,
[date_created] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, [created_date] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
[date_modified] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP [modified_date] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
CREATE UNIQUE INDEX [slug] ON [status_page]([slug]); CREATE UNIQUE INDEX [slug] ON [status_page]([slug]);

@ -233,6 +233,7 @@ class Database {
let statusPage = R.dispense("status_page"); let statusPage = R.dispense("status_page");
statusPage.slug = ""; statusPage.slug = "";
statusPage.title = title; statusPage.title = title;
statusPage.description = await setting("description");
statusPage.icon = await setting("icon"); statusPage.icon = await setting("icon");
statusPage.theme = await setting("statusPageTheme"); statusPage.theme = await setting("statusPageTheme");
statusPage.published = await setting("statusPagePublished"); statusPage.published = await setting("statusPagePublished");

@ -21,6 +21,7 @@ class StatusPage extends BeanModel {
id: this.id, id: this.id,
slug: this.slug, slug: this.slug,
title: this.title, title: this.title,
description: this.description,
icon: this.icon, icon: this.icon,
theme: this.theme, theme: this.theme,
published: !!this.published, published: !!this.published,
@ -32,6 +33,7 @@ class StatusPage extends BeanModel {
return { return {
slug: this.slug, slug: this.slug,
title: this.title, title: this.title,
description: this.description,
icon: this.icon, icon: this.icon,
theme: this.theme, theme: this.theme,
published: !!this.published, published: !!this.published,

@ -220,11 +220,7 @@ async function checkPublished() {
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
async function isPublished() { async function isPublished() {
const value = await setting("statusPagePublished");
if (value === null) {
return true; return true;
}
return value;
} }
function send403(res, msg = "") { function send403(res, msg = "") {

@ -107,12 +107,14 @@ module.exports.statusPageSocketHandler = (socket) => {
statusPage.slug = config.slug; statusPage.slug = config.slug;
statusPage.title = config.title; statusPage.title = config.title;
statusPage.description = config.description;
statusPage.icon = config.logo; statusPage.icon = config.logo;
statusPage.theme = config.theme; statusPage.theme = config.theme;
//statusPage.published = ; //statusPage.published = ;
//statusPage.search_engine_index = ; //statusPage.search_engine_index = ;
statusPage.show_tags = config.showTags; statusPage.show_tags = config.showTags;
//statusPage.password = null; //statusPage.password = null;
statusPage.modified_date = R.isoDateTime();
await R.store(statusPage); await R.store(statusPage);

@ -436,6 +436,14 @@ export default {
this.slug = "default"; this.slug = "default";
} }
axios.get("/api/status-page/" + this.slug).then((res) => {
this.config = res.data;
if (this.config.logo) {
this.imgDataUrl = this.config.logo;
}
});
axios.get("/api/status-page/config/" + this.slug).then((res) => { axios.get("/api/status-page/config/" + this.slug).then((res) => {
this.config = res.data; this.config = res.data;

Loading…
Cancel
Save