Merge pull request #1645 from symonbaikov/feature/apprise-config-options

feat: add operator config options for Apprise notifications (closes #1576)
This commit is contained in:
Daniel Hiller
2026-09-17 02:00:24 +02:00
committed by GitHub
8 changed files with 98 additions and 2 deletions
@@ -68,6 +68,12 @@ const Errors = {
BOARD_NOT_FOUND: {
boardNotFound: 'Board not found',
},
APPRISE_DISABLED: {
appriseDisabled: 'Apprise notifications are disabled',
},
SCHEMA_NOT_ALLOWED: {
schemaNotAllowed: 'Notification service schema is not allowed',
},
LIMIT_REACHED: {
limitReached: 'Limit reached',
},
@@ -95,6 +101,12 @@ module.exports = {
boardNotFound: {
responseType: 'notFound',
},
appriseDisabled: {
responseType: 'forbidden',
},
schemaNotAllowed: {
responseType: 'unprocessableEntity',
},
limitReached: {
responseType: 'conflict',
},
@@ -125,6 +137,8 @@ module.exports = {
actorUser: currentUser,
request: this.req,
})
.intercept('appriseDisabled', () => Errors.APPRISE_DISABLED)
.intercept('schemaNotAllowed', () => Errors.SCHEMA_NOT_ALLOWED)
.intercept('limitReached', () => Errors.LIMIT_REACHED);
return {
@@ -68,6 +68,12 @@ const Errors = {
USER_NOT_FOUND: {
userNotFound: 'User not found',
},
APPRISE_DISABLED: {
appriseDisabled: 'Apprise notifications are disabled',
},
SCHEMA_NOT_ALLOWED: {
schemaNotAllowed: 'Notification service schema is not allowed',
},
LIMIT_REACHED: {
limitReached: 'Limit reached',
},
@@ -95,6 +101,12 @@ module.exports = {
userNotFound: {
responseType: 'notFound',
},
appriseDisabled: {
responseType: 'forbidden',
},
schemaNotAllowed: {
responseType: 'unprocessableEntity',
},
limitReached: {
responseType: 'conflict',
},
@@ -118,6 +130,8 @@ module.exports = {
actorUser: currentUser,
request: this.req,
})
.intercept('appriseDisabled', () => Errors.APPRISE_DISABLED)
.intercept('schemaNotAllowed', () => Errors.SCHEMA_NOT_ALLOWED)
.intercept('limitReached', () => Errors.LIMIT_REACHED);
return {
@@ -23,11 +23,28 @@ module.exports = {
},
exits: {
appriseDisabled: {},
schemaNotAllowed: {},
limitReached: {},
},
async fn(inputs) {
const { values } = inputs;
const { appriseEnabled, appriseAllowedSchemas, appriseBlockedSchemas } = sails.config.custom;
if (!appriseEnabled) {
throw 'appriseDisabled';
}
const schema = values.url.split(':')[0];
if (appriseAllowedSchemas.length > 0 && !appriseAllowedSchemas.includes(schema)) {
throw 'schemaNotAllowed';
}
if (appriseAllowedSchemas.length === 0 && appriseBlockedSchemas.includes(schema)) {
throw 'schemaNotAllowed';
}
const notificationServicesTotal = await sails.helpers.boards.getNotificationServicesTotal(
values.board.id,
@@ -19,11 +19,28 @@ module.exports = {
},
exits: {
appriseDisabled: {},
schemaNotAllowed: {},
limitReached: {},
},
async fn(inputs) {
const { values } = inputs;
const { appriseEnabled, appriseAllowedSchemas, appriseBlockedSchemas } = sails.config.custom;
if (!appriseEnabled) {
throw 'appriseDisabled';
}
const schema = values.url.split(':')[0];
if (appriseAllowedSchemas.length > 0 && !appriseAllowedSchemas.includes(schema)) {
throw 'schemaNotAllowed';
}
if (appriseAllowedSchemas.length === 0 && appriseBlockedSchemas.includes(schema)) {
throw 'schemaNotAllowed';
}
const notificationServicesTotal = await sails.helpers.users.getNotificationServicesTotal(
values.user.id,
@@ -31,6 +31,17 @@ module.exports = {
},
async fn(inputs) {
const { appriseEnabled, appriseAllowedSchemas, appriseBlockedSchemas } = sails.config.custom;
if (!appriseEnabled) {
return;
}
const schemaConfig = JSON.stringify({
allowedSchemas: appriseAllowedSchemas,
blockedSchemas: appriseBlockedSchemas,
});
try {
await promisifyExecFile(
PYTHON_PATH,
@@ -39,6 +50,7 @@ module.exports = {
JSON.stringify(inputs.services),
inputs.title,
JSON.stringify(inputs.bodyByFormat),
schemaConfig,
],
{
env: {