Skip to content

Commit

Permalink
Merge pull request #175 from flowforge/nr-3.1-got-fix
Browse files Browse the repository at this point in the history
Proper fix for #173
  • Loading branch information
Pezmc authored Sep 22, 2023
2 parents 06ab161 + 589b703 commit 632412c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/editor/tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class EditorTunnel {
}).catch(_err => {
// debug(`proxy [${request.method}] ${fullUrl} : error ${_err.toString()}`)
// ↓ useful for debugging but noisy due to .map files
// console.log(err)
// console.log(_err)
// console.log(JSON.stringify(request))
this.socket?.send(JSON.stringify({
id: request.id,
Expand Down
5 changes: 3 additions & 2 deletions lib/template/template-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const settings = require('./settings.json')
const editorTheme = settings.editorTheme || {}
const themeName = editorTheme.theme || 'forge-light'
const themeSettings = settings[themeName] || {}
const { default: got } = import('got')
const { existsSync, readFileSync } = require('fs')

settings.editorTheme.header = settings.editorTheme.header || {}
Expand All @@ -25,9 +24,10 @@ const auth = {
return authCache[token].result
}
}
const { default: got } = await import('got')
try {
const result = await got.get(`${settings.flowforge.forgeURL}/api/v1/devices/${deviceId}/editor/token`, {
timeout: 2000,
timeout: { request: 2000 },
headers: {
'x-access-token': token,
'user-agent': 'FlowForge Device Agent Node-RED admin auth'
Expand All @@ -43,6 +43,7 @@ const auth = {
return { username, permissions }
}
} catch (err) {
console.log('error getting new token', err)
}
},
users: async function (username) {
Expand Down

0 comments on commit 632412c

Please sign in to comment.