From ee811ca89b41ea35268548fd0e54ca2ccc8b87eb Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Sun, 2 Apr 2023 00:39:33 +0900 Subject: [PATCH 1/3] Use build status icon of GitHub Actions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1e9766f0..06310a220 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ http://nodered.org -[![Build Status](https://travis-ci.org/node-red/node-red.svg?branch=master)](https://travis-ci.org/node-red/node-red) +[![Build Status](https://github.com/node-red/node-red/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/node-red/node-red/actions?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/node-red/node-red/badge.svg?branch=master)](https://coveralls.io/r/node-red/node-red?branch=master) Low-code programming for event-driven applications. From f917212d6754856c402f253237b1b892bdb0d9d8 Mon Sep 17 00:00:00 2001 From: Mario Wolff Date: Fri, 28 Apr 2023 12:35:19 +0200 Subject: [PATCH 2/3] a simple approach to fix #2657 --- .../@node-red/editor-client/src/js/settings.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/settings.js b/packages/node_modules/@node-red/editor-client/src/js/settings.js index c9a24d636..af7f091c9 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/settings.js +++ b/packages/node_modules/@node-red/editor-client/src/js/settings.js @@ -33,8 +33,8 @@ RED.settings = (function () { if (!hasLocalStorage()) { return; } - if (key === "auth-tokens") { - localStorage.setItem(key, JSON.stringify(value)); + if (key.startsWith("auth-tokens")) { + localStorage.setItem(key+this.authTokensSuffix, JSON.stringify(value)); } else { RED.utils.setMessageProperty(userSettings,key,value); saveUserSettings(); @@ -52,8 +52,8 @@ RED.settings = (function () { if (!hasLocalStorage()) { return undefined; } - if (key === "auth-tokens") { - return JSON.parse(localStorage.getItem(key)); + if (key.startsWith("auth-tokens")) { + return JSON.parse(localStorage.getItem(key+this.authTokensSuffix)); } else { var v; try { v = RED.utils.getMessageProperty(userSettings,key); } catch(err) {} @@ -71,8 +71,8 @@ RED.settings = (function () { if (!hasLocalStorage()) { return; } - if (key === "auth-tokens") { - localStorage.removeItem(key); + if (key.startsWith("auth-tokens")) { + localStorage.removeItem(key+this.authTokensSuffix); } else { delete userSettings[key]; saveUserSettings(); @@ -99,6 +99,8 @@ RED.settings = (function () { var init = function (options, done) { var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search); + var path=window.location.pathname.slice(0,-1); + RED.settings.authTokensSuffix=path.replaceAll('/', '-'); if (accessTokenMatch) { var accessToken = accessTokenMatch[1]; RED.settings.set("auth-tokens",{access_token: accessToken}); From ed2c9d24e8af1e8176d272d44149132ef65f45e4 Mon Sep 17 00:00:00 2001 From: Mario Wolff Date: Fri, 28 Apr 2023 14:53:18 +0200 Subject: [PATCH 3/3] use replace instead of replaceAll to support node14 --- .../node_modules/@node-red/editor-client/src/js/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/settings.js b/packages/node_modules/@node-red/editor-client/src/js/settings.js index af7f091c9..85c930bfb 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/settings.js +++ b/packages/node_modules/@node-red/editor-client/src/js/settings.js @@ -100,7 +100,7 @@ RED.settings = (function () { var init = function (options, done) { var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search); var path=window.location.pathname.slice(0,-1); - RED.settings.authTokensSuffix=path.replaceAll('/', '-'); + RED.settings.authTokensSuffix=path.replace(/\//g, '-'); if (accessTokenMatch) { var accessToken = accessTokenMatch[1]; RED.settings.set("auth-tokens",{access_token: accessToken});