From cbdb28c5d52f85118737f4a132a1223959dda00f Mon Sep 17 00:00:00 2001 From: PhilReact Date: Mon, 24 Feb 2025 19:05:40 +0200 Subject: [PATCH] fixes --- src/ExtStates/NotAuthenticated.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ExtStates/NotAuthenticated.tsx b/src/ExtStates/NotAuthenticated.tsx index a1aaf19..f693a38 100644 --- a/src/ExtStates/NotAuthenticated.tsx +++ b/src/ExtStates/NotAuthenticated.tsx @@ -74,7 +74,7 @@ export const NotAuthenticated = ({ // }); const [importedApiKey, setImportedApiKey] = React.useState(null); //add and edit states - const [url, setUrl] = React.useState("http://"); + const [url, setUrl] = React.useState("https://"); const [customApikey, setCustomApiKey] = React.useState(""); const [customNodeToSaveIndex, setCustomNodeToSaveIndex] = React.useState(null); @@ -348,15 +348,14 @@ export const NotAuthenticated = ({ const addCustomNode = () => { setMode("add-node"); }; - - const saveCustomNodes = (myNodes) => { + const saveCustomNodes = (myNodes, isFullListOfNodes) => { let nodes = [...(myNodes || [])]; - if (customNodeToSaveIndex !== null) { + if (!isFullListOfNodes && customNodeToSaveIndex !== null) { nodes.splice(customNodeToSaveIndex, 1, { url: removeTrailingSlash(url), apikey: customApikey, }); - } else if (url) { + } else if (!isFullListOfNodes && url) { nodes.push({ url: removeTrailingSlash(url), apikey: customApikey, @@ -372,7 +371,7 @@ export const NotAuthenticated = ({ .then((response) => { if (response) { setMode("list"); - setUrl("http://"); + setUrl("https://"); setCustomApiKey(""); if(window?.electronAPI?.setAllowedDomains){ window.electronAPI.setAllowedDomains(nodes?.map((node) => node.url)) @@ -776,7 +775,7 @@ export const NotAuthenticated = ({ ...(customNodes || []), ].filter((item) => item?.url !== node?.url); - saveCustomNodes(nodesToSave); + saveCustomNodes(nodesToSave, true); }} variant="contained" >