Rename localStorage item knowns to sshwifty-knowns

This commit is contained in:
NI
2019-12-08 17:02:12 +08:00
parent d3c569f68d
commit aeb339ce49

View File

@@ -3,8 +3,21 @@ import { History } from "./commands/history.js";
export function build(ctx) { export function build(ctx) {
let rec = []; let rec = [];
// This renames "knowns" to "sshwifty-knowns"
// TODO: Remove this after some few years
try { 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) { if (!rec) {
rec = []; rec = [];
@@ -17,7 +30,7 @@ export function build(ctx) {
rec, rec,
(h, d) => { (h, d) => {
try { try {
localStorage.setItem("knowns", JSON.stringify(d)); localStorage.setItem("sshwifty-knowns", JSON.stringify(d));
ctx.connector.knowns = h.all(); ctx.connector.knowns = h.all();
} catch (e) { } catch (e) {
alert("Unable to save remote history due to error: " + e); alert("Unable to save remote history due to error: " + e);