alert on core error
This commit is contained in:
@@ -176,6 +176,15 @@ func (a *APIHandler) loadData(c *gin.Context) (interface{}, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
onlines, err := a.StatsService.GetOnlines()
|
onlines, err := a.StatsService.GetOnlines()
|
||||||
|
|
||||||
|
sysInfo := a.ServerService.GetSingboxInfo()
|
||||||
|
if sysInfo["running"] == false {
|
||||||
|
logs := a.ServerService.GetLogs("sing-box", "1", "debug")
|
||||||
|
if len(logs) > 0 {
|
||||||
|
data["lastLog"] = logs[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { FindDiff } from '@/plugins/utils'
|
import { FindDiff } from '@/plugins/utils'
|
||||||
import HttpUtils from '@/plugins/httputil'
|
import HttpUtils from '@/plugins/httputil'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
import Message from './message'
|
||||||
|
|
||||||
const Data = defineStore('Data', {
|
const Data = defineStore('Data', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@@ -20,17 +21,10 @@ const Data = defineStore('Data', {
|
|||||||
this.lastLoad = Math.floor((new Date()).getTime()/1000)
|
this.lastLoad = Math.floor((new Date()).getTime()/1000)
|
||||||
|
|
||||||
// Set new data
|
// Set new data
|
||||||
const data = JSON.parse(JSON.stringify(msg.obj))
|
if (msg.obj.lastLog) {
|
||||||
if (data.subURI) this.subURI = data.subURI
|
const sb = Message()
|
||||||
if (data.config) this.config = data.config
|
sb.showMessage('Core error: \n' + msg.obj.lastLog,'error', 5000)
|
||||||
if (data.clients) this.clients = data.clients
|
}
|
||||||
if (data.tls) this.tlsConfigs = data.tls
|
|
||||||
this.onlines = data.onlines
|
|
||||||
|
|
||||||
// To avoid ref copy
|
|
||||||
if (data.config) this.oldData.config = { ...msg.obj }.config
|
|
||||||
if (data.clients) this.oldData.clients = { ...msg.obj }.clients
|
|
||||||
if (data.tls) this.oldData.tlsConfigs = { ...msg.obj }.tls
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async pushData() {
|
async pushData() {
|
||||||
|
|||||||
Reference in New Issue
Block a user