diff --git a/lib/template/template-settings.js b/lib/template/template-settings.js index f4fd896..e01d886 100644 --- a/lib/template/template-settings.js +++ b/lib/template/template-settings.js @@ -42,7 +42,6 @@ let got let agentApplied const auth = { - type: 'credentials', // the type of the auth tokenHeader: 'x-access-token', // the header where node-red expects to find the token tokens: async function (token) { const [prefix, deviceId] = (token + '').split('_') @@ -94,12 +93,6 @@ const auth = { } catch (err) { console.log('error getting new token', err) } - }, - users: async function (username) { - return null - }, - authenticate: async function (username, password) { - return null } } @@ -169,6 +162,15 @@ const runtimeSettings = { [themeName]: { ...themeSettings }, editorTheme: { ...editorTheme } } +runtimeSettings.editorTheme.login = { + message: 'Access the editor through the FlowFuse platform' +} +if (themeSettings.projectURL) { + runtimeSettings.editorTheme.login.button = { + url: themeSettings.projectURL, + label: 'Open FlowFuse Dashboard' + } +} if (settings.flowforge.auditLogger?.bin && settings.flowforge.auditLogger?.url) { try { diff --git a/test/unit/lib/template-settings_spec.js b/test/unit/lib/template-settings_spec.js index 3a5d4cd..2eeedf6 100644 --- a/test/unit/lib/template-settings_spec.js +++ b/test/unit/lib/template-settings_spec.js @@ -55,10 +55,7 @@ describe('template-settings', () => { const settings = require(settingsFile) should.exist(settings) settings.should.have.a.property('adminAuth').and.be.an.Object() - settings.adminAuth.should.have.a.property('type', 'credentials') - settings.adminAuth.should.have.a.property('users').and.be.a.Function() - settings.adminAuth.should.have.a.property('authenticate').and.be.a.Function() - settings.adminAuth.should.have.a.property('tokens').and.be.a.Function() + settings.adminAuth.should.not.have.a.property('type') settings.should.have.a.property('contextStorage').and.be.an.Object() settings.contextStorage.should.have.a.property('default', 'memory') @@ -76,6 +73,9 @@ describe('template-settings', () => { settings.editorTheme.codeEditor.should.have.a.property('lib', 'monaco') settings.editorTheme.tours.should.be.false() settings.editorTheme.should.have.a.property('palette').and.be.an.Object() + settings.editorTheme.should.have.a.property('login').and.be.an.Object() + settings.editorTheme.login.should.have.a.property('message').and.be.an.String() + settings.editorTheme.login.should.have.a.property('button').and.be.an.Object() settings.should.have.a.property('externalModules').and.be.an.Object() settings.externalModules.should.have.a.property('autoInstall', true)