Skip to content
This repository was archived by the owner on Sep 26, 2020. It is now read-only.

Commit 4889047

Browse files
committed
fix save problem
1 parent e11c91b commit 4889047

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

js/index.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ window.addEventListener('DOMContentLoaded', function () {
5252
}
5353
}
5454
function aboutDialog(){
55-
alert("KaiAuth v1.1.0\nCopyright 2020 zjyl1994\nAll rights reserved");
55+
alert("KaiAuth v1.1.1\nCopyright 2020 zjyl1994.\nAll rights reserved.");
5656
}
5757
function selectItemByIndex() {
5858
[].forEach.call(mainlist.children, function (el) {
@@ -73,6 +73,9 @@ window.addEventListener('DOMContentLoaded', function () {
7373
});
7474
return maxID + 1;
7575
}
76+
function saveList(){
77+
window.localStorage.setItem('authcodes', JSON.stringify(authcodes));
78+
}
7679
function loadSDFile(){
7780
var sdcard = navigator.getDeviceStorage('sdcard');
7881
var request = sdcard.get("kaiauth.json");
@@ -148,7 +151,7 @@ window.addEventListener('DOMContentLoaded', function () {
148151
secret: gaDetail.query.secret
149152
}
150153
authcodes.push(item);
151-
window.localStorage.setItem('authcodes', JSON.stringify(authcodes));
154+
saveList();
152155
init();
153156
selectIndex = authcodes.length - 1;
154157
selectItemByIndex();
@@ -169,6 +172,7 @@ window.addEventListener('DOMContentLoaded', function () {
169172
var result = confirm(translate('delete-confirm'));
170173
if(result == true){
171174
authcodes = authcodes.filter(obj => obj.id != authcodeActiveItem);
175+
saveList();
172176
refreshCodeList();
173177
}
174178
}
@@ -178,6 +182,7 @@ window.addEventListener('DOMContentLoaded', function () {
178182
var newname = prompt(translate('rename-prompt'))
179183
if (newname!=null && newname!=""){
180184
authcodes.find(obj => obj.id == authcodeActiveItem).name = newname;
185+
saveList();
181186
refreshCodeList();
182187
}
183188
}

manifest.webapp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.0",
2+
"version": "1.1.1",
33
"name": "KaiAuth",
44
"description": "Simple Google Authenticator alternative",
55
"theme_color": "#0F4C81",

0 commit comments

Comments
 (0)