From aeb339ce496bad5f67f2f137639623a524887000 Mon Sep 17 00:00:00 2001 From: NI Date: Sun, 8 Dec 2019 17:02:12 +0800 Subject: [PATCH] Rename localStorage item `knowns` to `sshwifty-knowns` --- ui/home_historyctl.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ui/home_historyctl.js b/ui/home_historyctl.js index c864f4c0..651b83de 100644 --- a/ui/home_historyctl.js +++ b/ui/home_historyctl.js @@ -3,8 +3,21 @@ import { History } from "./commands/history.js"; export function build(ctx) { let rec = []; + // This renames "knowns" to "sshwifty-knowns" + // TODO: Remove this after some few years try { - rec = JSON.parse(localStorage.getItem("knowns")); + let oldStore = localStorage.getItem("knowns"); + + if (oldStore) { + localStorage.setItem("sshwifty-knowns", oldStore); + localStorage.removeItem("knowns"); + } + } catch (e) { + // Do nothing + } + + try { + rec = JSON.parse(localStorage.getItem("sshwifty-knowns")); if (!rec) { rec = []; @@ -17,7 +30,7 @@ export function build(ctx) { rec, (h, d) => { try { - localStorage.setItem("knowns", JSON.stringify(d)); + localStorage.setItem("sshwifty-knowns", JSON.stringify(d)); ctx.connector.knowns = h.all(); } catch (e) { alert("Unable to save remote history due to error: " + e);