mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-12 12:41:30 +03:00
Added filters for notifications
Added notifications for tasks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { uuid } = require('uuidv4');
|
||||
const db_api = require('./db');
|
||||
const config_api = require('./config');
|
||||
|
||||
exports.sendNotification = async (notification) => {
|
||||
// TODO: hook into third party service
|
||||
@@ -7,6 +8,15 @@ exports.sendNotification = async (notification) => {
|
||||
return notification;
|
||||
}
|
||||
|
||||
exports.sendTaskNotification = async (task_obj, confirmed) => {
|
||||
// workaround for tasks which are user_uid agnostic
|
||||
const user_uid = config_api.getConfigItem('ytdl_multi_user_mode') ? 'admin' : null;
|
||||
await db_api.removeAllRecords('notifications', {"data.task_key": task_obj.key});
|
||||
const data = {task_key: task_obj.key, task_title: task_obj.title, confirmed: confirmed};
|
||||
const notification = exports.createNotification('task_finished', ['view_tasks'], data, user_uid);
|
||||
return await exports.sendNotification(notification);
|
||||
}
|
||||
|
||||
exports.sendDownloadNotification = async (file, user_uid) => {
|
||||
const data = {file_uid: file.uid, file_title: file.title};
|
||||
const notification = exports.createNotification('download_complete', ['play'], data, user_uid);
|
||||
|
||||
Reference in New Issue
Block a user