Skip to content

Commit 0ee26b5

Browse files
author
sheepzh
committed
Fix initial option after installed
1 parent 756bfad commit 0ee26b5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/database/option-database.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* https://opensource.org/licenses/MIT
66
*/
77

8+
import { defaultOption } from "@util/constant/option"
89
import BaseDatabase from "./common/base-database"
910
import { REMAIN_WORD_PREFIX } from "./common/constant"
1011

@@ -28,7 +29,7 @@ class OptionDatabase extends BaseDatabase {
2829
async getOption(): Promise<Partial<timer.option.AllOption>> {
2930
const data = await this.storage.get(DB_KEY)
3031
const option = data[DB_KEY]
31-
if (!option) return {}
32+
if (!option) return defaultOption()
3233
return option as Partial<timer.option.AllOption>
3334
}
3435

src/util/constant/option.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,12 @@ export function defaultStatistics(): timer.option.StatisticsOption {
4040
collectSiteName: true,
4141
countLocalFiles: false
4242
}
43+
}
44+
45+
export function defaultOption(): timer.option.AllOption {
46+
return {
47+
...defaultPopup(),
48+
...defaultAppearance(),
49+
...defaultStatistics(),
50+
}
4351
}

0 commit comments

Comments
 (0)