diff --git a/src/main.c b/src/main.c index 1cd7c5c..616c345 100644 --- a/src/main.c +++ b/src/main.c @@ -19,7 +19,7 @@ #define EPILOG "Made by simon987 . Released under GPL-3.0" -static const char *const Version = "2.1.0"; +static const char *const Version = "2.1.1"; static const char *const usage[] = { "sist2 scan [OPTION]... PATH", "sist2 index [OPTION]... INDEX", diff --git a/src/static/js/search.js b/src/static/js/search.js index bcc6915..29f0040 100644 --- a/src/static/js/search.js +++ b/src/static/js/search.js @@ -73,18 +73,23 @@ function Settings() { this._onUpdate = function () { $("#fuzzyToggle").prop("checked", this.options.fuzzy); - } + }; this.load = function () { const raw = window.localStorage.getItem("options"); if (raw === null) { this.options = _defaults; } else { - this.options = JSON.parse(raw); + const j = JSON.parse(raw); + if (!j || Object.keys(_defaults).some(k => !j.hasOwnProperty(k))) { + this.options = _defaults; + } else { + this.options = j; + } } this._onUpdate(); - } + }; this.save = function () { window.localStorage.setItem("options", JSON.stringify(this.options)); diff --git a/src/static/search.html b/src/static/search.html index c4069fe..166fd11 100644 --- a/src/static/search.html +++ b/src/static/search.html @@ -11,7 +11,7 @@