Skip to content

Commit

Permalink
Rename localStorage item knowns to sshwifty-knowns
Browse files Browse the repository at this point in the history
  • Loading branch information
NI committed Dec 8, 2019
1 parent d3c569f commit aeb339c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ui/home_historyctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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);
Expand Down

0 comments on commit aeb339c

Please sign in to comment.