diff --git a/server/model/status_page.js b/server/model/status_page.js
index e2155c4c..6f763f58 100644
--- a/server/model/status_page.js
+++ b/server/model/status_page.js
@@ -22,7 +22,7 @@ class StatusPage extends BeanModel {
slug: this.slug,
title: this.title,
description: this.description,
- icon: this.icon,
+ icon: this.getIcon(),
theme: this.theme,
published: !!this.published,
showTags: !!this.show_tags,
@@ -34,7 +34,7 @@ class StatusPage extends BeanModel {
slug: this.slug,
title: this.title,
description: this.description,
- icon: this.icon,
+ icon: this.getIcon(),
theme: this.theme,
published: !!this.published,
showTags: !!this.show_tags,
@@ -47,6 +47,14 @@ class StatusPage extends BeanModel {
]);
}
+ getIcon() {
+ if (!this.icon) {
+ return "/icon.svg";
+ } else {
+ return this.icon;
+ }
+ }
+
}
module.exports = StatusPage;
diff --git a/server/socket-handlers/status-page-socket-handler.js b/server/socket-handlers/status-page-socket-handler.js
index 060ccf8d..c1d66797 100644
--- a/server/socket-handlers/status-page-socket-handler.js
+++ b/server/socket-handlers/status-page-socket-handler.js
@@ -90,9 +90,17 @@ module.exports.statusPageSocketHandler = (socket) => {
try {
checkLogin(socket);
-
apicache.clear();
+ // Save Config
+ let statusPage = await R.findOne("status_page", " slug = ? ", [
+ slug
+ ]);
+
+ if (!statusPage) {
+ throw new Error("No slug?");
+ }
+
const header = "data:image/png;base64,";
// Check logo format
@@ -103,23 +111,16 @@ module.exports.statusPageSocketHandler = (socket) => {
throw new Error("Only allowed PNG logo.");
}
+ const filename = `logo${statusPage.id}.png`;
+
// Convert to file
- await ImageDataURI.outputFile(imgDataUrl, Database.uploadDir + "logo.png");
- config.logo = "/upload/logo.png?t=" + Date.now();
+ await ImageDataURI.outputFile(imgDataUrl, Database.uploadDir + filename);
+ config.logo = `/upload/${filename}?t=` + Date.now();
} else {
config.icon = imgDataUrl;
}
- // Save Config
- let statusPage = await R.findOne("status_page", " slug = ? ", [
- slug
- ]);
-
- if (!statusPage) {
- throw new Error("No slug?");
- }
-
statusPage.slug = config.slug;
statusPage.title = config.title;
statusPage.description = config.description;
diff --git a/src/pages/ManageStatusPage.vue b/src/pages/ManageStatusPage.vue
index dad92e8b..2e5d1154 100644
--- a/src/pages/ManageStatusPage.vue
+++ b/src/pages/ManageStatusPage.vue
@@ -9,33 +9,14 @@