Notifications
Settings Notifications User Panel
This commit is contained in:
@@ -574,13 +574,17 @@ module.exports = {
|
||||
'type',
|
||||
'userId',
|
||||
'sender',
|
||||
'typedir',
|
||||
'typeid',
|
||||
'dest',
|
||||
'descr',
|
||||
'link',
|
||||
'openUrl',
|
||||
'datenotif',
|
||||
'read',
|
||||
'deleted',
|
||||
'idapp',
|
||||
'tablerec',
|
||||
'idrec',
|
||||
'status'];
|
||||
},
|
||||
|
||||
@@ -723,7 +727,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
// Pass object into sendNotification
|
||||
return webpush.sendNotification(subscription, JSON.stringify(payload),
|
||||
return webpush.sendNotification(subscription._doc, JSON.stringify(payload),
|
||||
pushOptions).
|
||||
catch(err => {
|
||||
if (err.statusCode === 410) {
|
||||
@@ -734,7 +738,7 @@ module.exports = {
|
||||
}
|
||||
}).
|
||||
then(ris => {
|
||||
// console.log('ris', ris)
|
||||
console.log('sendNotification', ris)
|
||||
}).
|
||||
catch(err => {
|
||||
console.error(err);
|
||||
@@ -1141,8 +1145,7 @@ module.exports = {
|
||||
|
||||
getNomeAppByIdApp: function(idapp) {
|
||||
|
||||
const myapp =
|
||||
this.getApps().find(item => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find(item => item.idapp === idapp);
|
||||
if (myapp)
|
||||
return ((process.env.NODE_ENV === 'test') ? 'Test: ' : '') + myapp.name;
|
||||
else
|
||||
@@ -1161,7 +1164,7 @@ module.exports = {
|
||||
|
||||
getHostByIdApp: function(idapp) {
|
||||
|
||||
const myapp = this.getApps().find(item => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find(item => item.idapp === idapp);
|
||||
if (myapp) {
|
||||
let siteport = (myapp.portapp && myapp.portapp !== '0') ? (':' +
|
||||
myapp.portapp) : '';
|
||||
@@ -1185,7 +1188,7 @@ module.exports = {
|
||||
|
||||
getConfSiteOptionEnabledByIdApp: function(idapp, option) {
|
||||
|
||||
const myapp = this.getApps().find(item => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find(item => item.idapp === idapp);
|
||||
if (myapp) {
|
||||
|
||||
if (myapp.hasOwnProperty('confsite')) {
|
||||
@@ -1200,7 +1203,7 @@ module.exports = {
|
||||
|
||||
getConfParamSiteByIdApp: function(idapp, field) {
|
||||
|
||||
const myapp = this.getApps().find(item => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find(item => item.idapp === idapp);
|
||||
if (myapp) {
|
||||
|
||||
if (myapp.hasOwnProperty('confsite')) {
|
||||
@@ -1214,7 +1217,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
isAbilitaNave: function(idapp) {
|
||||
const myapp = this.getApps().find(item => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find(item => item.idapp === idapp);
|
||||
return myapp.abilitanave;
|
||||
},
|
||||
|
||||
@@ -1222,7 +1225,7 @@ module.exports = {
|
||||
|
||||
let mypath = '';
|
||||
const myapp =
|
||||
this.getApps().find(item => item.idapp === idapp);
|
||||
this.MYAPPS.find(item => item.idapp === idapp);
|
||||
if (myapp) {
|
||||
if (process.env.NODE_ENV === 'test')
|
||||
mypath = (myapp) ? myapp.dir_test : '';
|
||||
@@ -1240,7 +1243,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getAdminEmailByIdApp: function(idapp) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
if (myapp)
|
||||
return myapp.adminemail;
|
||||
else
|
||||
@@ -1248,7 +1251,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getreplyToEmailByIdApp: function(idapp) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
if (myapp)
|
||||
return myapp.replyTo;
|
||||
else
|
||||
@@ -1256,7 +1259,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getpathregByIdApp: function(idapp, lang) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
if (myapp) {
|
||||
const addstr = myapp.pathreg_add ? myapp.pathreg_add : '';
|
||||
|
||||
@@ -1276,7 +1279,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getManagerEmailByIdApp: function(idapp) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
if (myapp)
|
||||
return !!myapp.manageremail ? myapp.manageremail : '';
|
||||
else
|
||||
@@ -1284,17 +1287,17 @@ module.exports = {
|
||||
},
|
||||
|
||||
getEmailByIdApp: function(idapp) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
return (myapp) ? myapp.email_from : '';
|
||||
},
|
||||
|
||||
getPwdByIdApp: function(idapp) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
return (myapp) ? this.decryptdata(myapp.email_pwd) : '';
|
||||
},
|
||||
|
||||
getTelegramBotNameByIdApp: function(idapp) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
if (process.env.NODE_ENV === 'test')
|
||||
return (myapp) ? myapp.telegram_bot_name_test : '';
|
||||
else
|
||||
@@ -1303,7 +1306,7 @@ module.exports = {
|
||||
|
||||
getTelegramSupportChat: function(idapp) {
|
||||
try {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
return (myapp && myapp.telegram_support_chat)
|
||||
? myapp.telegram_support_chat
|
||||
: '';
|
||||
@@ -1313,8 +1316,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getTelegramKeyByIdApp: function(idapp) {
|
||||
const myarr = this.getApps();
|
||||
const myapp = myarr.find((item) => item.idapp === idapp);
|
||||
const myapp = this.MYAPPS.find((item) => item.idapp === idapp);
|
||||
if (process.env.NODE_ENV === 'test')
|
||||
return (myapp) ? myapp.telegram_key_test : '';
|
||||
else
|
||||
@@ -2750,12 +2752,16 @@ module.exports = {
|
||||
},
|
||||
|
||||
async loadApps() {
|
||||
this.MYAPPS = await Site.findAll(0);
|
||||
// console.log('this.MYAPPS', this.MYAPPS);
|
||||
try {
|
||||
this.MYAPPS = await Site.findAll(0);
|
||||
console.log('this.MYAPPS', this.MYAPPS);
|
||||
}catch (e) {
|
||||
console.error('loadApps', e);
|
||||
}
|
||||
},
|
||||
getApps() {
|
||||
async getApps() {
|
||||
if (this.MYAPPS.length <= 0)
|
||||
this.loadApps();
|
||||
await this.loadApps();
|
||||
|
||||
return this.MYAPPS;
|
||||
},
|
||||
@@ -2936,6 +2942,8 @@ module.exports = {
|
||||
},
|
||||
|
||||
updateQueryStringParameter(uri, key, value) {
|
||||
if (uri === '')
|
||||
return '';
|
||||
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
||||
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
|
||||
if (uri.match(re)) {
|
||||
|
||||
Reference in New Issue
Block a user