Skip to content

Node.js based forum software built for the modern web

feat: #14186, tinycon config options in ACP

Julian Lama46cc7889ab4
diff --git a/install/data/defaults.json b/install/data/defaults.json
index a6b25a2732..9217f8ac07 100644
--- a/install/data/defaults.json
+++ b/install/data/defaults.json
@@ -200,6 +200,8 @@
"maxReconnectionAttempts": 5,
"reconnectionDelay": 1500,
"disableCustomUserSkins": 0,
+ "tinyconColor": "#ffffff",
+ "tinyconBackground": "#ff0000",
"activitypubEnabled": 1,
"activitypubAllowLoopback": 0,
"activitypubProbe": 1,
diff --git a/public/language/en-GB/admin/settings/notifications.json b/public/language/en-GB/admin/settings/notifications.json
index a2f82b82fb..ea422da765 100644
--- a/public/language/en-GB/admin/settings/notifications.json
+++ b/public/language/en-GB/admin/settings/notifications.json
@@ -4,6 +4,10 @@
"welcome-notification-link": "Welcome Notification Link",
"welcome-notification-uid": "Welcome Notification User (UID)",
"post-queue-notification-uid": "Post Queue User (UID)",
+ "notification-uid-help": "If set, the notification sent comes from that user. Otherwise, it will be a system notification.",
"notification-delay": "Delay for sending notification emails (seconds)",
- "notification-delay-help": "If the user has read the notification within this time, the email will not be sent.<br/>Default: 60 seconds."
+ "notification-delay-help": "If the user has read the notification within this time, the email will not be sent.<br/>Default: 60 seconds.",
+ "tinycon.settings": "Tinycon",
+ "tinycon.notification-color": "Notification Colour",
+ "tinycon.notification-background": "Notification Background"
}
\ No newline at end of file
diff --git a/public/src/admin/settings.js b/public/src/admin/settings.js
index 46c0fa4380..ca6a8cac84 100644
--- a/public/src/admin/settings.js
+++ b/public/src/admin/settings.js
@@ -73,7 +73,7 @@ define('admin/settings', [
app.flags = app.flags || {};
app.flags._unsaved = true;
});
- const defaultInputs = ['text', 'hidden', 'password', 'textarea', 'number'];
+ const defaultInputs = ['text', 'hidden', 'password', 'textarea', 'number', 'color'];
for (x = 0; x < numFields; x += 1) {
field = fields.eq(x);
key = field.attr('data-field');
@@ -199,6 +199,7 @@ define('admin/settings', [
case 'hidden':
case 'textarea':
case 'number':
+ case 'color':
value = field.val();
break;
diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js
index 60d48fff3c..7d5da2ac3b 100644
--- a/public/src/modules/notifications.js
+++ b/public/src/modules/notifications.js
@@ -137,6 +137,7 @@ define('notifications', [
return false;
}
+ let tinyconSetup = false;
Notifications.updateNotifCount = function (count) {
const notifIcon = components.get('notifications/icon');
count = Math.max(0, count);
@@ -154,6 +155,13 @@ define('notifications', [
hooks.fire('action:notification.updateCount', payload);
if (payload.updateFavicon) {
+ if (!tinyconSetup) {
+ Tinycon.setOptions({
+ color: config.tinycon.color,
+ background: config.tinycon.background,
+ });
+ tinyconSetup = true;
+ }
Tinycon.setBubble(countText);
}
diff --git a/src/controllers/api.js b/src/controllers/api.js
index d01e3844c9..ae9078e7d2 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -105,6 +105,10 @@ apiController.loadConfig = async function (req) {
probe: meta.config.activitypubEnabled && meta.config.activitypubProbe,
worldDefaultCid: meta.config.activitypubWorldDefaultCid,
},
+ tinycon: {
+ color: meta.config.tinyconColor,
+ background: meta.config.tinyconBackground,
+ },
};
let settings = config;
diff --git a/src/views/admin/settings/notifications.tpl b/src/views/admin/settings/notifications.tpl
index f912f13259..8bb80c39d3 100644
--- a/src/views/admin/settings/notifications.tpl
+++ b/src/views/admin/settings/notifications.tpl
@@ -27,9 +27,20 @@
<p class="form-text">[[admin/settings/notifications:notification-delay-help]]</p>
</div>
</div>
+
+ <div id="tinycon-settings" class="mb-4">
+ <h5 class="fw-bold tracking-tight settings-header">[[admin/settings/notifications:tinycon.settings]]</h5>
+ <div class="mb-3">
+ <label class="form-label">[[admin/settings/notifications:tinycon.notification-color]]</label>
+ <input type="color" class="form-control form-control-color" data-field="tinyconColor" />
+ </div>
+ <div class="mb-3">
+ <label class="form-label">[[admin/settings/notifications:tinycon.notification-background]]</label>
+ <input type="color" class="form-control form-control-color" data-field="tinyconBackground" />
+ </div>
+ </div>
</div>
<!-- IMPORT admin/partials/settings/toc.tpl -->
</div>
</div>
-