|
|
|
|
@ -22,7 +22,7 @@ const NOTIFICATION_TYPE_TO_TITLE = {
|
|
|
|
|
|
|
|
|
|
const NOTIFICATION_TYPE_TO_BODY = {
|
|
|
|
|
task_finished: (notification) => notification['data']['task_title'],
|
|
|
|
|
download_complete: (notification) => {return `${notification['data']['file_title']}\nOriginal URL: ${notification['data']['original_url']}`},
|
|
|
|
|
download_complete: (notification) => {return `${notification['data']['file_title']}\nOriginal URL: ${notification['data']['original_url']}\nPath: ${notification['data']['file_path']}`},
|
|
|
|
|
download_error: (notification) => {return `Error: ${notification['data']['download_error_message']}\nError code: ${notification['data']['download_error_type']}\n\nOriginal URL: ${notification['data']['download_url']}`}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -85,7 +85,7 @@ exports.sendTaskNotification = async (task_obj, confirmed) => {
|
|
|
|
|
|
|
|
|
|
exports.sendDownloadNotification = async (file, user_uid) => {
|
|
|
|
|
if (!notificationEnabled('download_complete')) return;
|
|
|
|
|
const data = {file_uid: file.uid, file_title: file.title, file_thumbnail: file.thumbnailURL, original_url: file.url};
|
|
|
|
|
const data = {file_uid: file.uid, file_title: file.title, file_path: file.path, file_thumbnail: file.thumbnailURL, original_url: file.url};
|
|
|
|
|
const notification = exports.createNotification('download_complete', ['play'], data, user_uid);
|
|
|
|
|
return await exports.sendNotification(notification);
|
|
|
|
|
}
|
|
|
|
|
@ -290,4 +290,4 @@ function sendGenericNotification(data) {
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|