Rename localStorage item knowns to sshwifty-knowns
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user