increased json limits + new paths

master
cheetah 2 years ago
parent f5ddd0a0a6
commit eb1609744a

@ -97,7 +97,7 @@
}, },
methods: { methods: {
loadPresets() { loadPresets() {
this.$http.get('/api/deliveryPresets') this.$http.get(window.location.pathname + 'api/deliveryPresets')
.then(response => { .then(response => {
this.presetSearchItems = response.body.map(x => { return { this.presetSearchItems = response.body.map(x => { return {
text: x.name, text: x.name,
@ -107,7 +107,7 @@
}) })
}, },
loadConfig() { loadConfig() {
this.$http.get('/config').then(response => { this.$http.get(window.location.pathname + 'config').then(response => {
const newConfig = response.body const newConfig = response.body
newConfig.deliveryModes = newConfig.deliveryModes.map((x) => { newConfig.deliveryModes = newConfig.deliveryModes.map((x) => {
x._id = btoa(JSON.stringify(x)) x._id = btoa(JSON.stringify(x))
@ -123,9 +123,9 @@
delete x._id delete x._id
return x return x
}) })
this.$http.post('/config', storeConfig).then(response => { this.$http.post(window.location.pathname + 'config', storeConfig).then(response => {
}) })
.then(this.$http.post('/restart')) .then(this.$http.post(window.location.pathname + 'restart'))
.then(() => { .then(() => {
document.body.style = 'display:none' document.body.style = 'display:none'
setTimeout(() => window.location.reload(), 1e3) setTimeout(() => window.location.reload(), 1e3)

@ -191,7 +191,7 @@ Last LoRaWAN Packet:
this.refreshMessages() this.refreshMessages()
setInterval(this.refreshMessages, 1e3) setInterval(this.refreshMessages, 1e3)
this.$http.get('/api/modes') this.$http.get(window.location.pathname + 'api/modes')
.then(response => { .then(response => {
console.log(response.body) console.log(response.body)
this.presetSearchItems = response.body.map(x => { return { this.presetSearchItems = response.body.map(x => { return {
@ -204,7 +204,7 @@ Last LoRaWAN Packet:
}, },
methods: { methods: {
refreshDevices() { refreshDevices() {
this.$http.get('/api/devices').then(response => { this.$http.get(window.location.pathname + 'api/devices').then(response => {
this.deviceListData = Object.keys(response.body).map(key => { this.deviceListData = Object.keys(response.body).map(key => {
const item = response.body[ key ] const item = response.body[ key ]
const keyData = key.split(':') const keyData = key.split(':')
@ -221,7 +221,7 @@ Last LoRaWAN Packet:
}, },
refreshMessages() { refreshMessages() {
if (this.messagesCheckList.length == 0) return if (this.messagesCheckList.length == 0) return
this.$http.get('/api/message/status', { params: { this.$http.get(window.location.pathname + 'api/message/status', { params: {
ids: this.messagesCheckList ids: this.messagesCheckList
} }).then(response => { } }).then(response => {
this.recentMessageListData = response.body.map(msg => { this.recentMessageListData = response.body.map(msg => {
@ -236,6 +236,7 @@ Last LoRaWAN Packet:
case 3: msg.state = '💬 Responded'; break; case 3: msg.state = '💬 Responded'; break;
} }
} }
if (msg._routerData.failed === true) msg.state = '❌ Failed'
msg.date = new Date(msg.date).toLocaleString() msg.date = new Date(msg.date).toLocaleString()
return msg return msg
}) })
@ -245,7 +246,7 @@ Last LoRaWAN Packet:
}, },
testMsg_send() { testMsg_send() {
console.log(this.newMSGData.preset) console.log(this.newMSGData.preset)
this.$http.post('/api/message/preset/', this.$http.post(window.location.pathname + 'api/message/preset/',
Object.assign({ preset: this.newMSGData.preset }, { payload: this.newMSGData.payload }) Object.assign({ preset: this.newMSGData.preset }, { payload: this.newMSGData.payload })
).then(x=>{ ).then(x=>{
console.log('response', x) console.log('response', x)

@ -116,7 +116,7 @@ app.get('/api/message/status', async (req, res) => {
let msgStatus = ( let msgStatus = (
await axios.get(new URL(config.pager.url).origin + '/api/message/status/' + msgID) await axios.get(new URL(config.pager.url).origin + '/api/message/status/' + msgID)
).data ).data
delete msgStatus.routingParams.connectors
if (!!msgStatus._routerData && !!msgStatus._routerData.metadata) { if (!!msgStatus._routerData && !!msgStatus._routerData.metadata) {
msgStatus._routerData.metadata = msgStatus._routerData.metadata.map(x => { msgStatus._routerData.metadata = msgStatus._routerData.metadata.map(x => {
if (x.ack == 'operational') { if (x.ack == 'operational') {
@ -146,7 +146,7 @@ app.post('/api/message/preset', async (req, res) => {
allowedIDs.push(msgId) allowedIDs.push(msgId)
return res.json(msgId) return res.json(msgId)
}) })
app.listen(3091, '0.0.0.0' || config.host || '127.0.0.1') app.listen(3081, '0.0.0.0' || config.host || '127.0.0.1')
const appConfig = express() const appConfig = express()
appConfig.use(express.json()) appConfig.use(express.json())
@ -173,5 +173,5 @@ appConfig.post('/restart', (req, res) => {
process.exit(1) process.exit(1)
}) })
appConfig.listen(3090, '0.0.0.0' || config.host || '127.0.0.1') appConfig.listen(3080, '0.0.0.0' || config.host || '127.0.0.1')

Loading…
Cancel
Save