[feat] Watchdog and notifications (#2895)
This commit is contained in:
+22
-20
@@ -41,6 +41,7 @@ window.AdminPageLogic = {
|
||||
formAddAdmin: '',
|
||||
formAddUser: '',
|
||||
formAddExtensionsManifest: '',
|
||||
nostrNotificationIdentifier: '',
|
||||
formAllowedIPs: '',
|
||||
formBlockedIPs: '',
|
||||
nostrAcceptedUrl: '',
|
||||
@@ -238,6 +239,23 @@ window.AdminPageLogic = {
|
||||
m => m !== manifest
|
||||
)
|
||||
},
|
||||
addNostrNotificationIdentifier() {
|
||||
const identifer = this.nostrNotificationIdentifier.trim()
|
||||
const identifiers = this.formData.lnbits_nostr_notifications_identifiers
|
||||
if (identifer && identifer.length && !identifiers.includes(identifer)) {
|
||||
this.formData.lnbits_nostr_notifications_identifiers = [
|
||||
...identifiers,
|
||||
identifer
|
||||
]
|
||||
this.nostrNotificationIdentifier = ''
|
||||
}
|
||||
},
|
||||
removeNostrNotificationIdentifier(identifer) {
|
||||
const identifiers = this.formData.lnbits_nostr_notifications_identifiers
|
||||
this.formData.lnbits_nostr_notifications_identifiers = identifiers.filter(
|
||||
m => m !== identifer
|
||||
)
|
||||
},
|
||||
async toggleServerLog() {
|
||||
this.serverlogEnabled = !this.serverlogEnabled
|
||||
if (this.serverlogEnabled) {
|
||||
@@ -377,23 +395,9 @@ window.AdminPageLogic = {
|
||||
formatDate(date) {
|
||||
return moment(date * 1000).fromNow()
|
||||
},
|
||||
getNotifications() {
|
||||
if (this.settings.lnbits_notifications) {
|
||||
axios
|
||||
.get(this.settings.lnbits_status_manifest)
|
||||
.then(response => {
|
||||
this.statusData = response.data
|
||||
})
|
||||
.catch(error => {
|
||||
this.formData.lnbits_notifications = false
|
||||
error.response.data = {}
|
||||
error.response.data.message = 'Could not fetch status manifest.'
|
||||
LNbits.utils.notifyApiError(error)
|
||||
})
|
||||
}
|
||||
},
|
||||
async getAudit() {
|
||||
await LNbits.api
|
||||
|
||||
getAudit() {
|
||||
LNbits.api
|
||||
.request('GET', '/admin/api/v1/audit', this.g.user.wallets[0].adminkey)
|
||||
.then(response => {
|
||||
this.auditData = response.data
|
||||
@@ -421,7 +425,6 @@ window.AdminPageLogic = {
|
||||
this.isSuperUser = response.data.is_super_user || false
|
||||
this.settings = response.data
|
||||
this.formData = {...this.settings}
|
||||
this.getNotifications()
|
||||
})
|
||||
.catch(LNbits.utils.notifyApiError)
|
||||
},
|
||||
@@ -441,8 +444,7 @@ window.AdminPageLogic = {
|
||||
.then(response => {
|
||||
this.needsRestart =
|
||||
this.settings.lnbits_backend_wallet_class !==
|
||||
this.formData.lnbits_backend_wallet_class ||
|
||||
this.settings.lnbits_killswitch !== this.formData.lnbits_killswitch
|
||||
this.formData.lnbits_backend_wallet_class
|
||||
this.settings = this.formData
|
||||
this.formData = _.clone(this.settings)
|
||||
Quasar.Notify.create({
|
||||
|
||||
Reference in New Issue
Block a user