From eb1609744af6ecccfa951c180c488bc89d5bfa48 Mon Sep 17 00:00:00 2001 From: cheetah Date: Sun, 18 Dec 2022 16:21:01 +0100 Subject: [PATCH] increased json limits + new paths --- html_config/index.html | 8 ++++---- html_public/index.html | 9 +++++---- index.js | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/html_config/index.html b/html_config/index.html index 4acb663..acf535d 100644 --- a/html_config/index.html +++ b/html_config/index.html @@ -97,7 +97,7 @@ }, methods: { loadPresets() { - this.$http.get('/api/deliveryPresets') + this.$http.get(window.location.pathname + 'api/deliveryPresets') .then(response => { this.presetSearchItems = response.body.map(x => { return { text: x.name, @@ -107,7 +107,7 @@ }) }, loadConfig() { - this.$http.get('/config').then(response => { + this.$http.get(window.location.pathname + 'config').then(response => { const newConfig = response.body newConfig.deliveryModes = newConfig.deliveryModes.map((x) => { x._id = btoa(JSON.stringify(x)) @@ -123,9 +123,9 @@ delete x._id 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(() => { document.body.style = 'display:none' setTimeout(() => window.location.reload(), 1e3) diff --git a/html_public/index.html b/html_public/index.html index 25f24ea..b829527 100644 --- a/html_public/index.html +++ b/html_public/index.html @@ -191,7 +191,7 @@ Last LoRaWAN Packet: this.refreshMessages() setInterval(this.refreshMessages, 1e3) - this.$http.get('/api/modes') + this.$http.get(window.location.pathname + 'api/modes') .then(response => { console.log(response.body) this.presetSearchItems = response.body.map(x => { return { @@ -204,7 +204,7 @@ Last LoRaWAN Packet: }, methods: { 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 => { const item = response.body[ key ] const keyData = key.split(':') @@ -221,7 +221,7 @@ Last LoRaWAN Packet: }, refreshMessages() { 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 } }).then(response => { this.recentMessageListData = response.body.map(msg => { @@ -236,6 +236,7 @@ Last LoRaWAN Packet: case 3: msg.state = '💬 Responded'; break; } } + if (msg._routerData.failed === true) msg.state = '❌ Failed' msg.date = new Date(msg.date).toLocaleString() return msg }) @@ -245,7 +246,7 @@ Last LoRaWAN Packet: }, testMsg_send() { 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 }) ).then(x=>{ console.log('response', x) diff --git a/index.js b/index.js index 2490b81..3535b8f 100644 --- a/index.js +++ b/index.js @@ -116,7 +116,7 @@ app.get('/api/message/status', async (req, res) => { let msgStatus = ( await axios.get(new URL(config.pager.url).origin + '/api/message/status/' + msgID) ).data - + delete msgStatus.routingParams.connectors if (!!msgStatus._routerData && !!msgStatus._routerData.metadata) { msgStatus._routerData.metadata = msgStatus._routerData.metadata.map(x => { if (x.ack == 'operational') { @@ -146,7 +146,7 @@ app.post('/api/message/preset', async (req, res) => { allowedIDs.push(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() appConfig.use(express.json()) @@ -173,5 +173,5 @@ appConfig.post('/restart', (req, res) => { 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')