Skip to content

Commit

Permalink
v2.5.1: Fix re-enable startup not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibowl committed May 29, 2020
1 parent 1009e53 commit 5a40210
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kccacheproxy",
"productName": "KCCacheProxy",
"version": "2.5.0",
"version": "2.5.1",
"description": "KanColle caching proxy",
"main": "src/electron/index.js",
"scripts": {
Expand Down
12 changes: 9 additions & 3 deletions src/proxy/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,17 @@ async function setConfig(newConfig, save = false, al = undefined) {
Logger.error(error)
}

if (al !== undefined)
if (al.isEnabled() && !newConfig.autoStartup)
if (al !== undefined) {
const enabled = await al.isEnabled()

if (enabled && !newConfig.autoStartup) {
await al.disable()
else if (!al.isEnabled() && newConfig.autoStartup)
Logger.log("Disabled startup")
} else if (!enabled && newConfig.autoStartup) {
await al.enable()
Logger.log("Enabled startup")
}
}

if (config.cacheLocation == undefined || config.cacheLocation == "default")
cacheLocation = join(userdata, "cache")
Expand Down

0 comments on commit 5a40210

Please sign in to comment.