From 6d1baa329a173b5ae41b85d10d584f9dce2608cc Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 2 Nov 2021 12:26:22 +0800 Subject: [PATCH 01/25] draft for restructure status page From 72a59ce7a481448e61427de66c9f82e82b3a2c3c Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 27 Dec 2021 18:54:48 +0800 Subject: [PATCH 02/25] add status page table --- db/patch-status-page.sql | 25 +++++++++++++++++++++++++ server/database.js | 1 + 2 files changed, 26 insertions(+) create mode 100644 db/patch-status-page.sql diff --git a/db/patch-status-page.sql b/db/patch-status-page.sql new file mode 100644 index 000000000..18986403c --- /dev/null +++ b/db/patch-status-page.sql @@ -0,0 +1,25 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +CREATE TABLE [status_page]( + [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + [slug] VARCHAR(255) NOT NULL UNIQUE, + [title] VARCHAR(255) NOT NULL, + [icon] VARCHAR(255) NOT NULL, + [theme] VARCHAR(30) NOT NULL, + [published] BOOLEAN NOT NULL DEFAULT 1, + [search_engine_index] BOOLEAN NOT NULL DEFAULT 1, + [public] BOOLEAN NOT NULL DEFAULT 1, + [password] VARCHAR +); + +CREATE UNIQUE INDEX [slug] ON [status_page]([slug]); + + +CREATE TABLE [status_page_cname]( + [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + [status_page_id] INTEGER NOT NULL REFERENCES [status_page]([id]) ON DELETE CASCADE ON UPDATE CASCADE, + [domain] VARCHAR NOT NULL UNIQUE +); + +COMMIT; diff --git a/server/database.js b/server/database.js index afcace705..fcef91719 100644 --- a/server/database.js +++ b/server/database.js @@ -53,6 +53,7 @@ class Database { "patch-2fa-invalidate-used-token.sql": true, "patch-notification_sent_history.sql": true, "patch-monitor-basic-auth.sql": true, + "patch-status-page.sql": true, } /** From 72ce28a5414163a6a578017e9a879ca3042b0dcc Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 8 Mar 2022 14:33:35 +0800 Subject: [PATCH 03/25] Migrate status page table --- db/patch-status-page.sql | 2 +- server/database.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/db/patch-status-page.sql b/db/patch-status-page.sql index 18986403c..07eacc023 100644 --- a/db/patch-status-page.sql +++ b/db/patch-status-page.sql @@ -9,7 +9,7 @@ CREATE TABLE [status_page]( [theme] VARCHAR(30) NOT NULL, [published] BOOLEAN NOT NULL DEFAULT 1, [search_engine_index] BOOLEAN NOT NULL DEFAULT 1, - [public] BOOLEAN NOT NULL DEFAULT 1, + [show_tags] BOOLEAN NOT NULL DEFAULT 0, [password] VARCHAR ); diff --git a/server/database.js b/server/database.js index fcef91719..119289e6a 100644 --- a/server/database.js +++ b/server/database.js @@ -171,6 +171,7 @@ class Database { } await this.patch2(); + await this.migrateNewStatusPage(); } /** @@ -212,6 +213,39 @@ class Database { await setSetting("databasePatchedFiles", databasePatchedFiles); } + /** + * Migrate status page value in setting to "status_page" table + * @returns {Promise} + */ + static async migrateNewStatusPage() { + let title = await setting("title"); + + if (title) { + console.log("Migrating Status Page"); + + let statusPageCheck = await R.findOne("status_page", " slug = '' "); + + if (statusPageCheck !== null) { + console.log("Migrating Status Page - Fail, empty slug record is already existing"); + return; + } + + let statusPage = R.dispense("status_page"); + statusPage.slug = ""; + statusPage.title = title; + statusPage.icon = await setting("icon"); + statusPage.theme = await setting("statusPageTheme"); + statusPage.published = await setting("statusPagePublished"); + statusPage.search_engine_index = await setting("searchEngineIndex"); + statusPage.show_tags = await setting("statusPageTags"); + statusPage.password = null; + await R.store(statusPage); + await R.exec("DELETE FROM setting WHERE type = 'statusPage'"); + console.log("Migrating Status Page - Done"); + } + + } + /** * Used it patch2() only * @param sqlFilename From ae14ad5a840bc7c29a4de3a62b70d5cf786b49b1 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 9 Mar 2022 22:14:07 +0800 Subject: [PATCH 04/25] Add a word "Status Pages" --- src/languages/bg-BG.js | 1 + src/languages/cs-CZ.js | 1 + src/languages/da-DK.js | 1 + src/languages/de-DE.js | 1 + src/languages/en.js | 13 +++--- src/languages/es-ES.js | 1 + src/languages/et-EE.js | 1 + src/languages/fa.js | 1 + src/languages/fr-FR.js | 7 ++-- src/languages/hr-HR.js | 1 + src/languages/hu.js | 1 + src/languages/id-ID.js | 1 + src/languages/it-IT.js | 1 + src/languages/ja.js | 1 + src/languages/ko-KR.js | 1 + src/languages/nb-NO.js | 1 + src/languages/nl-NL.js | 1 + src/languages/pl.js | 1 + src/languages/pt-BR.js | 1 + src/languages/ru-RU.js | 1 + src/languages/sl-SI.js | 3 +- src/languages/sr-latn.js | 1 + src/languages/sr.js | 1 + src/languages/sv-SE.js | 90 ---------------------------------------- src/languages/tr-TR.js | 48 --------------------- src/languages/vi-VN.js | 1 + src/languages/zh-CN.js | 1 + src/languages/zh-HK.js | 1 + src/languages/zh-TW.js | 1 + 29 files changed, 37 insertions(+), 148 deletions(-) diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js index 762cfff79..66ce636f8 100644 --- a/src/languages/bg-BG.js +++ b/src/languages/bg-BG.js @@ -197,6 +197,7 @@ export default { line: "Line Messenger", mattermost: "Mattermost", "Status Page": "Статус страница", + "Status Pages": "Статус страница", "Primary Base URL": "Основен базов URL адрес", "Push URL": "Генериран Push URL адрес", needPushEvery: "Необходимо е да извършвате заявка към този URL адрес на всеки {0} секунди", diff --git a/src/languages/cs-CZ.js b/src/languages/cs-CZ.js index 6d4f349aa..e479b094c 100644 --- a/src/languages/cs-CZ.js +++ b/src/languages/cs-CZ.js @@ -183,6 +183,7 @@ export default { "Edit Status Page": "Upravit stavovou stránku", "Go to Dashboard": "Přejít na nástěnku", "Status Page": "Stavová stránka", + "Status Pages": "Stavová stránka", defaultNotificationName: "Moje {notification} upozornění ({číslo})", here: "sem", Required: "Vyžadováno", diff --git a/src/languages/da-DK.js b/src/languages/da-DK.js index 6c295c772..b629a1ba1 100644 --- a/src/languages/da-DK.js +++ b/src/languages/da-DK.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "Rediger Statusside", "Go to Dashboard": "Gå til Betjeningspanel", "Status Page": "Statusside", + "Status Pages": "Statusside", telegram: "Telegram", webhook: "Webhook", smtp: "Email (SMTP)", diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js index 9e77214a6..5514850b5 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -179,6 +179,7 @@ export default { "Edit Status Page": "Bearbeite Status-Seite", "Go to Dashboard": "Gehe zum Dashboard", "Status Page": "Status-Seite", + "Status Pages": "Status-Seite", telegram: "Telegram", webhook: "Webhook", smtp: "E-Mail (SMTP)", diff --git a/src/languages/en.js b/src/languages/en.js index 40c9c89f3..480e97138 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -183,6 +183,7 @@ export default { "Edit Status Page": "Edit Status Page", "Go to Dashboard": "Go to Dashboard", "Status Page": "Status Page", + "Status Pages": "Status Page", defaultNotificationName: "My {notification} Alert ({number})", here: "here", Required: "Required", @@ -363,10 +364,10 @@ export default { smtpDkimheaderFieldNames: "Header Keys to sign (Optional)", smtpDkimskipFields: "Header Keys not to sign (Optional)", gorush: "Gorush", - alerta: 'Alerta', - alertaApiEndpoint: 'API Endpoint', - alertaEnvironment: 'Environment', - alertaApiKey: 'API Key', - alertaAlertState: 'Alert State', - alertaRecoverState: 'Recover State', + alerta: "Alerta", + alertaApiEndpoint: "API Endpoint", + alertaEnvironment: "Environment", + alertaApiKey: "API Key", + alertaAlertState: "Alert State", + alertaRecoverState: "Recover State", }; diff --git a/src/languages/es-ES.js b/src/languages/es-ES.js index 088172bc3..d8cdcc780 100644 --- a/src/languages/es-ES.js +++ b/src/languages/es-ES.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "Editar página de estado", "Go to Dashboard": "Ir al panel de control", "Status Page": "Página de estado", + "Status Pages": "Página de estado", telegram: "Telegram", webhook: "Webhook", smtp: "Email (SMTP)", diff --git a/src/languages/et-EE.js b/src/languages/et-EE.js index 224d9811f..36212e080 100644 --- a/src/languages/et-EE.js +++ b/src/languages/et-EE.js @@ -17,6 +17,7 @@ export default { pauseMonitorMsg: "Kas soovid peatada seire?", Settings: "Seaded", "Status Page": "Ülevaade", + "Status Pages": "Ülevaade", Dashboard: "Töölaud", "New Update": "Uuem tarkvara versioon on saadaval.", Language: "Keel", diff --git a/src/languages/fa.js b/src/languages/fa.js index 8901c72ae..7f873f992 100644 --- a/src/languages/fa.js +++ b/src/languages/fa.js @@ -178,6 +178,7 @@ export default { "Add a monitor": "اضافه کردن مانیتور", "Edit Status Page": "ویرایش صفحه وضعیت", "Status Page": "صفحه وضعیت", + "Status Pages": "صفحه وضعیت", "Go to Dashboard": "رفتن به پیشخوان", "Uptime Kuma": "آپتایم کوما", records: "مورد", diff --git a/src/languages/fr-FR.js b/src/languages/fr-FR.js index 054e16c11..d8c033ae8 100644 --- a/src/languages/fr-FR.js +++ b/src/languages/fr-FR.js @@ -179,6 +179,7 @@ export default { "Edit Status Page": "Modifier la page de statut", "Go to Dashboard": "Accéder au tableau de bord", "Status Page": "Status Page", + "Status Pages": "Status Page", defaultNotificationName: "Ma notification {notification} numéro ({number})", here: "ici", Required: "Requis", @@ -304,9 +305,9 @@ export default { steamApiKeyDescription: "Pour surveiller un serveur Steam, vous avez besoin d'une clé Steam Web-API. Vous pouvez enregistrer votre clé ici : ", "Current User": "Utilisateur actuel", recent: "Récent", - alertaApiEndpoint: 'API Endpoint', - alertaEnvironment: 'Environement', + alertaApiEndpoint: "API Endpoint", + alertaEnvironment: "Environement", alertaApiKey: "Clé de l'API", alertaAlertState: "État de l'Alerte", - alertaRecoverState: 'État de récupération', + alertaRecoverState: "État de récupération", }; diff --git a/src/languages/hr-HR.js b/src/languages/hr-HR.js index 6c7e4ea56..ac851b675 100644 --- a/src/languages/hr-HR.js +++ b/src/languages/hr-HR.js @@ -183,6 +183,7 @@ export default { "Edit Status Page": "Uredi Statusnu stranicu", "Go to Dashboard": "Na Kontrolnu ploču", "Status Page": "Statusna stranica", + "Status Pages": "Statusna stranica", defaultNotificationName: "Moja {number}. {notification} obavijest", here: "ovdje", Required: "Potrebno", diff --git a/src/languages/hu.js b/src/languages/hu.js index b63bb5066..8b390dc46 100644 --- a/src/languages/hu.js +++ b/src/languages/hu.js @@ -197,6 +197,7 @@ export default { line: "Line Messenger", mattermost: "Mattermost", "Status Page": "Státusz oldal", + "Status Pages": "Státusz oldal", "Primary Base URL": "Elsődleges URL", "Push URL": "Meghívandó URL", needPushEvery: "Ezt az URL-t kell meghívni minden {0} másodpercben.", diff --git a/src/languages/id-ID.js b/src/languages/id-ID.js index 9734e355b..36d830759 100644 --- a/src/languages/id-ID.js +++ b/src/languages/id-ID.js @@ -179,6 +179,7 @@ export default { "Edit Status Page": "Edit Halaman Status", "Go to Dashboard": "Pergi ke Dasbor", "Status Page": "Halaman Status", + "Status Pages": "Halaman Status", defaultNotificationName: "{notification} saya Peringatan ({number})", here: "di sini", Required: "Dibutuhkan", diff --git a/src/languages/it-IT.js b/src/languages/it-IT.js index 7c2638bad..fc3cbe291 100644 --- a/src/languages/it-IT.js +++ b/src/languages/it-IT.js @@ -183,6 +183,7 @@ export default { "Edit Status Page": "Modifica pagina di stato", "Go to Dashboard": "Vai alla dashboard", "Status Page": "Pagina di stato", + "Status Pages": "Pagina di stato", defaultNotificationName: "Notifica {notification} ({number})", here: "qui", Required: "Obbligatorio", diff --git a/src/languages/ja.js b/src/languages/ja.js index 3a244d137..da388f03c 100644 --- a/src/languages/ja.js +++ b/src/languages/ja.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "ステータスページ編集", "Go to Dashboard": "ダッシュボード", "Status Page": "ステータスページ", + "Status Pages": "ステータスページ", telegram: "Telegram", webhook: "Webhook", smtp: "Email (SMTP)", diff --git a/src/languages/ko-KR.js b/src/languages/ko-KR.js index fe943793b..e900f6120 100644 --- a/src/languages/ko-KR.js +++ b/src/languages/ko-KR.js @@ -179,6 +179,7 @@ export default { "Edit Status Page": "상태 페이지 수정", "Go to Dashboard": "대시보드로 가기", "Status Page": "상태 페이지", + "Status Pages": "상태 페이지", defaultNotificationName: "내 {notification} 알림 ({number})", here: "여기", Required: "필수", diff --git a/src/languages/nb-NO.js b/src/languages/nb-NO.js index 10a48011d..a02885bd1 100644 --- a/src/languages/nb-NO.js +++ b/src/languages/nb-NO.js @@ -179,6 +179,7 @@ export default { "Edit Status Page": "Rediger statusside", "Go to Dashboard": "Gå til Dashboard", "Status Page": "Statusside", + "Status Pages": "Statusside", defaultNotificationName: "Min {notification} varsling ({number})", here: "her", Required: "Obligatorisk", diff --git a/src/languages/nl-NL.js b/src/languages/nl-NL.js index a652b795a..d148ba364 100644 --- a/src/languages/nl-NL.js +++ b/src/languages/nl-NL.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "Wijzig status pagina", "Go to Dashboard": "Ga naar Dashboard", "Status Page": "Status Pagina", + "Status Pages": "Status Pagina", telegram: "Telegram", webhook: "Webhook", smtp: "Email (SMTP)", diff --git a/src/languages/pl.js b/src/languages/pl.js index c863e4e39..fb377148e 100644 --- a/src/languages/pl.js +++ b/src/languages/pl.js @@ -179,6 +179,7 @@ export default { "Edit Status Page": "Edytuj stronę statusu", "Go to Dashboard": "Idź do panelu", "Status Page": "Strona statusu", + "Status Pages": "Strona statusu", defaultNotificationName: "Moje powiadomienie {notification} ({number})", here: "tutaj", Required: "Wymagane", diff --git a/src/languages/pt-BR.js b/src/languages/pt-BR.js index f3b1692dd..d83c303a1 100644 --- a/src/languages/pt-BR.js +++ b/src/languages/pt-BR.js @@ -169,6 +169,7 @@ export default { "Avg. Ping": "Ping Médio.", "Avg. Response": "Resposta Média. ", "Status Page": "Página de Status", + "Status Pages": "Página de Status", "Entry Page": "Página de entrada", statusPageNothing: "Nada aqui, por favor, adicione um grupo ou monitor.", "No Services": "Nenhum Serviço", diff --git a/src/languages/ru-RU.js b/src/languages/ru-RU.js index d0add4829..d6b72085a 100644 --- a/src/languages/ru-RU.js +++ b/src/languages/ru-RU.js @@ -181,6 +181,7 @@ export default { "Edit Status Page": "Редактировать", "Go to Dashboard": "Панель управления", "Status Page": "Мониторинг", + "Status Pages": "Página de Status", Discard: "Отмена", "Create Incident": "Создать инцидент", "Switch to Dark Theme": "Тёмная тема", diff --git a/src/languages/sl-SI.js b/src/languages/sl-SI.js index fd34f8d20..4318fd284 100644 --- a/src/languages/sl-SI.js +++ b/src/languages/sl-SI.js @@ -182,7 +182,8 @@ export default { "Add a monitor": "Dodaj monitor", "Edit Status Page": "Uredi statusno stran", "Go to Dashboard": "Pojdi na nadzorno ploščo", - "Status Page": "Status", + "Status Page": "Página de Status", + "Status Pages": "Página de Status", defaultNotificationName: "Moje {notification} Obvestilo ({number})", here: "tukaj", Required: "Obvezno", diff --git a/src/languages/sr-latn.js b/src/languages/sr-latn.js index 39edde484..396d580f6 100644 --- a/src/languages/sr-latn.js +++ b/src/languages/sr-latn.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "Edit Status Page", "Go to Dashboard": "Go to Dashboard", "Status Page": "Status Page", + "Status Pages": "Status Page", telegram: "Telegram", webhook: "Webhook", smtp: "Email (SMTP)", diff --git a/src/languages/sr.js b/src/languages/sr.js index aac79e58d..9f53a5e02 100644 --- a/src/languages/sr.js +++ b/src/languages/sr.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "Edit Status Page", "Go to Dashboard": "Go to Dashboard", "Status Page": "Status Page", + "Status Pages": "Status Page", telegram: "Telegram", webhook: "Webhook", smtp: "Email (SMTP)", diff --git a/src/languages/sv-SE.js b/src/languages/sv-SE.js index e1fdadc9e..0ba43682e 100644 --- a/src/languages/sv-SE.js +++ b/src/languages/sv-SE.js @@ -108,94 +108,4 @@ export default { "Repeat Password": "Upprepa Lösenord", respTime: "Svarstid (ms)", notAvailableShort: "Ej Tillg.", - Create: "Create", - clearEventsMsg: "Are you sure want to delete all events for this monitor?", - clearHeartbeatsMsg: "Are you sure want to delete all heartbeats for this monitor?", - confirmClearStatisticsMsg: "Are you sure want to delete ALL statistics?", - "Clear Data": "Clear Data", - Events: "Events", - Heartbeats: "Heartbeats", - "Auto Get": "Auto Get", - enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", - "Default enabled": "Default enabled", - "Also apply to existing monitors": "Also apply to existing monitors", - Export: "Export", - Import: "Import", - backupDescription: "You can backup all monitors and all notifications into a JSON file.", - backupDescription2: "PS: History and event data is not included.", - backupDescription3: "Sensitive data such as notification tokens is included in the export file, please keep it carefully.", - alertNoFile: "Please select a file to import.", - alertWrongFileType: "Please select a JSON file.", - twoFAVerifyLabel: "Please type in your token to verify that 2FA is working", - tokenValidSettingsMsg: "Token is valid! You can now save the 2FA settings.", - confirmEnableTwoFAMsg: "Are you sure you want to enable 2FA?", - confirmDisableTwoFAMsg: "Are you sure you want to disable 2FA?", - "Apply on all existing monitors": "Apply on all existing monitors", - "Verify Token": "Verify Token", - "Setup 2FA": "Setup 2FA", - "Enable 2FA": "Enable 2FA", - "Disable 2FA": "Disable 2FA", - "2FA Settings": "2FA Settings", - "Two Factor Authentication": "Two Factor Authentication", - Active: "Active", - Inactive: "Inactive", - Token: "Token", - "Show URI": "Show URI", - "Clear all statistics": "Clear all Statistics", - retryCheckEverySecond: "Retry every {0} seconds.", - importHandleDescription: "Choose 'Skip existing' if you want to skip every monitor or notification with the same name. 'Overwrite' will delete every existing monitor and notification.", - confirmImportMsg: "Are you sure to import the backup? Please make sure you've selected the right import option.", - "Heartbeat Retry Interval": "Heartbeat Retry Interval", - "Import Backup": "Import Backup", - "Export Backup": "Export Backup", - "Skip existing": "Skip existing", - Overwrite: "Overwrite", - Options: "Options", - "Keep both": "Keep both", - Tags: "Tags", - "Add New below or Select...": "Add New below or Select...", - "Tag with this name already exist.": "Tag with this name already exist.", - "Tag with this value already exist.": "Tag with this value already exist.", - color: "color", - "value (optional)": "value (optional)", - Gray: "Gray", - Red: "Red", - Orange: "Orange", - Green: "Green", - Blue: "Blue", - Indigo: "Indigo", - Purple: "Purple", - Pink: "Pink", - "Search...": "Search...", - "Avg. Ping": "Avg. Ping", - "Avg. Response": "Avg. Response", - "Entry Page": "Entry Page", - statusPageNothing: "Nothing here, please add a group or a monitor.", - "No Services": "No Services", - "All Systems Operational": "All Systems Operational", - "Partially Degraded Service": "Partially Degraded Service", - "Degraded Service": "Degraded Service", - "Add Group": "Add Group", - "Add a monitor": "Add a monitor", - "Edit Status Page": "Edit Status Page", - "Go to Dashboard": "Go to Dashboard", - "Status Page": "Status Page", - telegram: "Telegram", - webhook: "Webhook", - smtp: "Email (SMTP)", - discord: "Discord", - teams: "Microsoft Teams", - signal: "Signal", - gotify: "Gotify", - slack: "Slack", - "rocket.chat": "Rocket.chat", - pushover: "Pushover", - pushy: "Pushy", - octopush: "Octopush", - promosms: "PromoSMS", - lunasea: "LunaSea", - apprise: "Apprise (Support 50+ Notification services)", - pushbullet: "Pushbullet", - line: "Line Messenger", - mattermost: "Mattermost", }; diff --git a/src/languages/tr-TR.js b/src/languages/tr-TR.js index 64fffd9d2..3e3f9152c 100644 --- a/src/languages/tr-TR.js +++ b/src/languages/tr-TR.js @@ -149,52 +149,4 @@ export default { "Two Factor Authentication": "İki Faktörlü Kimlik Doğrulama (2FA)", Active: "Aktif", Inactive: "İnaktif", - Token: "Token", - "Show URI": "Show URI", - Tags: "Tags", - "Add New below or Select...": "Add New below or Select...", - "Tag with this name already exist.": "Tag with this name already exist.", - "Tag with this value already exist.": "Tag with this value already exist.", - color: "color", - "value (optional)": "value (optional)", - Gray: "Gray", - Red: "Red", - Orange: "Orange", - Green: "Green", - Blue: "Blue", - Indigo: "Indigo", - Purple: "Purple", - Pink: "Pink", - "Search...": "Search...", - "Avg. Ping": "Avg. Ping", - "Avg. Response": "Avg. Response", - "Entry Page": "Entry Page", - statusPageNothing: "Nothing here, please add a group or a monitor.", - "No Services": "No Services", - "All Systems Operational": "All Systems Operational", - "Partially Degraded Service": "Partially Degraded Service", - "Degraded Service": "Degraded Service", - "Add Group": "Add Group", - "Add a monitor": "Add a monitor", - "Edit Status Page": "Edit Status Page", - "Go to Dashboard": "Go to Dashboard", - "Status Page": "Status Page", - telegram: "Telegram", - webhook: "Webhook", - smtp: "Email (SMTP)", - discord: "Discord", - teams: "Microsoft Teams", - signal: "Signal", - gotify: "Gotify", - slack: "Slack", - "rocket.chat": "Rocket.chat", - pushover: "Pushover", - pushy: "Pushy", - octopush: "Octopush", - promosms: "PromoSMS", - lunasea: "LunaSea", - apprise: "Apprise (Support 50+ Notification services)", - pushbullet: "Pushbullet", - line: "Line Messenger", - mattermost: "Mattermost", }; diff --git a/src/languages/vi-VN.js b/src/languages/vi-VN.js index c97c3c6cb..4ef5a54e5 100644 --- a/src/languages/vi-VN.js +++ b/src/languages/vi-VN.js @@ -183,6 +183,7 @@ export default { "Edit Status Page": "Sửa trang trạng thái", "Go to Dashboard": "Đi tới Dashboard", "Status Page": "Trang trạng thái", + "Status Pages": "Trang trạng thái", defaultNotificationName: "My {notification} Alerts ({number})", here: "tại đây", Required: "Bắt buộc", diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js index 9133f5d04..1f2439b05 100644 --- a/src/languages/zh-CN.js +++ b/src/languages/zh-CN.js @@ -185,6 +185,7 @@ export default { "Edit Status Page": "编辑状态页面", "Go to Dashboard": "前往仪表盘", "Status Page": "状态页面", + "Status Pages": "状态页面", defaultNotificationName: "{notification} 通知({number})", here: "这里", Required: "必填", diff --git a/src/languages/zh-HK.js b/src/languages/zh-HK.js index cd574970c..ba0631552 100644 --- a/src/languages/zh-HK.js +++ b/src/languages/zh-HK.js @@ -180,6 +180,7 @@ export default { "Edit Status Page": "編輯 Status Page", "Go to Dashboard": "前往主控台", "Status Page": "Status Page", + "Status Pages": "Status Pages", telegram: "Telegram", webhook: "Webhook", smtp: "電郵 (SMTP)", diff --git a/src/languages/zh-TW.js b/src/languages/zh-TW.js index 6f5bc0990..ec730b0f2 100644 --- a/src/languages/zh-TW.js +++ b/src/languages/zh-TW.js @@ -183,6 +183,7 @@ export default { "Edit Status Page": "編輯狀態頁", "Go to Dashboard": "前往儀表板", "Status Page": "狀態頁", + "Status Pages": "狀態頁", defaultNotificationName: "我的 {notification} 通知 ({number})", here: "此處", Required: "必填", From 50d6e888c28eaef46ec880bd992d00a90e428a18 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 10 Mar 2022 21:34:30 +0800 Subject: [PATCH 05/25] [new status page] wip --- db/patch-status-page.sql | 4 +- server/model/status_page.js | 44 ++++++++++++++ server/routers/api-router.js | 35 +++++------ server/server.js | 3 + src/assets/app.scss | 8 ++- src/icon.js | 4 ++ src/languages/en.js | 2 +- src/layouts/Layout.vue | 6 +- src/mixins/socket.js | 6 ++ src/pages/ManageStatusPage.vue | 104 +++++++++++++++++++++++++++++++++ src/pages/Settings.vue | 2 + src/pages/StatusPage.vue | 33 ++++++----- src/router.js | 9 +++ 13 files changed, 220 insertions(+), 40 deletions(-) create mode 100644 server/model/status_page.js create mode 100644 src/pages/ManageStatusPage.vue diff --git a/db/patch-status-page.sql b/db/patch-status-page.sql index 07eacc023..584eb615c 100644 --- a/db/patch-status-page.sql +++ b/db/patch-status-page.sql @@ -10,7 +10,9 @@ CREATE TABLE [status_page]( [published] BOOLEAN NOT NULL DEFAULT 1, [search_engine_index] BOOLEAN NOT NULL DEFAULT 1, [show_tags] BOOLEAN NOT NULL DEFAULT 0, - [password] VARCHAR + [password] VARCHAR, + [date_created] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + [date_modified] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ); CREATE UNIQUE INDEX [slug] ON [status_page]([slug]); diff --git a/server/model/status_page.js b/server/model/status_page.js new file mode 100644 index 000000000..eab89d4a9 --- /dev/null +++ b/server/model/status_page.js @@ -0,0 +1,44 @@ +const { BeanModel } = require("redbean-node/dist/bean-model"); +const { R } = require("redbean-node"); + +class StatusPage extends BeanModel { + + static async sendStatusPageList(io, socket) { + let result = {}; + + let list = await R.findAll("status_page", " ORDER BY title "); + + for (let item of list) { + result[item.id] = await item.toJSON(); + } + + io.to(socket.userID).emit("statusPageList", result); + return list; + } + + async toJSON() { + return { + id: this.id, + slug: this.slug, + title: this.title, + icon: this.icon, + theme: this.theme, + published: !!this.published, + showTags: !!this.show_tags, + }; + } + + async toPublicJSON() { + return { + slug: this.slug, + title: this.title, + icon: this.icon, + theme: this.theme, + published: !!this.published, + showTags: !!this.show_tags, + }; + } + +} + +module.exports = StatusPage; diff --git a/server/routers/api-router.js b/server/routers/api-router.js index 1920cef71..0b8a46b40 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -83,33 +83,28 @@ router.get("/api/push/:pushToken", async (request, response) => { }); // Status Page Config -router.get("/api/status-page/config", async (_request, response) => { +router.get("/api/status-page/config/:slug", async (request, response) => { allowDevAllOrigin(response); + let slug = request.params.slug; - let config = await getSettings("statusPage"); + let statusPage = await R.findOne("status_page", " slug = ? ", [ + slug + ]); - if (! config.statusPageTheme) { - config.statusPageTheme = "light"; + if (!statusPage) { + response.statusCode = 404; + response.json({ + msg: "Not Found" + }); + return; } - if (! config.statusPagePublished) { - config.statusPagePublished = true; - } - - if (! config.statusPageTags) { - config.statusPageTags = false; - } - - if (! config.title) { - config.title = "Uptime Kuma"; - } - - response.json(config); + response.json(await statusPage.toPublicJSON()); }); // Status Page - Get the current Incident // Can fetch only if published -router.get("/api/status-page/incident", async (_, response) => { +router.get("/api/status-page/incident/:slug", async (_, response) => { allowDevAllOrigin(response); try { @@ -133,7 +128,7 @@ router.get("/api/status-page/incident", async (_, response) => { // Status Page - Monitor List // Can fetch only if published -router.get("/api/status-page/monitor-list", cache("5 minutes"), async (_request, response) => { +router.get("/api/status-page/monitor-list/:slug", cache("5 minutes"), async (_request, response) => { allowDevAllOrigin(response); try { @@ -172,7 +167,7 @@ router.get("/api/status-page/monitor-list", cache("5 minutes"), async (_request, // Status Page Polling Data // Can fetch only if published -router.get("/api/status-page/heartbeat", cache("5 minutes"), async (_request, response) => { +router.get("/api/status-page/heartbeat/:slug", cache("5 minutes"), async (_request, response) => { allowDevAllOrigin(response); try { diff --git a/server/server.js b/server/server.js index 153cac4fd..043d85bb7 100644 --- a/server/server.js +++ b/server/server.js @@ -132,6 +132,7 @@ const { sendNotificationList, sendHeartbeatList, sendImportantHeartbeatList, sen const { statusPageSocketHandler } = require("./socket-handlers/status-page-socket-handler"); const databaseSocketHandler = require("./socket-handlers/database-socket-handler"); const TwoFA = require("./2fa"); +const StatusPage = require("./model/status_page"); app.use(express.json()); @@ -1414,6 +1415,8 @@ async function afterLogin(socket, user) { for (let monitorID in monitorList) { await Monitor.sendStats(io, monitorID, user.id); } + + await StatusPage.sendStatusPageList(io, socket); } async function getMonitorJSONList(userID) { diff --git a/src/assets/app.scss b/src/assets/app.scss index f49ed4f2c..08f647b45 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss @@ -92,6 +92,10 @@ textarea.form-control { } } +.btn-dark { + background-color: #161B22; +} + @media (max-width: 550px) { .table-shadow-box { padding: 10px !important; @@ -162,12 +166,12 @@ textarea.form-control { .form-check-input:checked { border-color: $primary; // Re-apply bootstrap border } - + .form-switch .form-check-input { background-color: #232f3b; } - a, + a:not(.btn), .table, .nav-link { color: $dark-font-color; diff --git a/src/icon.js b/src/icon.js index 88b8a8ecd..865897608 100644 --- a/src/icon.js +++ b/src/icon.js @@ -34,6 +34,8 @@ import { faAward, faLink, faChevronDown, + faPen, + faExternalLinkSquareAlt, } from "@fortawesome/free-solid-svg-icons"; library.add( @@ -67,6 +69,8 @@ library.add( faAward, faLink, faChevronDown, + faPen, + faExternalLinkSquareAlt, ); export { FontAwesomeIcon }; diff --git a/src/languages/en.js b/src/languages/en.js index 480e97138..d66d3188d 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -183,7 +183,7 @@ export default { "Edit Status Page": "Edit Status Page", "Go to Dashboard": "Go to Dashboard", "Status Page": "Status Page", - "Status Pages": "Status Page", + "Status Pages": "Status Pages", defaultNotificationName: "My {notification} Alert ({number})", here: "here", Required: "Required", diff --git a/src/layouts/Layout.vue b/src/layouts/Layout.vue index 1a769a0dc..f1f915a67 100644 --- a/src/layouts/Layout.vue +++ b/src/layouts/Layout.vue @@ -19,9 +19,9 @@