Skip to content

Commit de59479

Browse files
author
sheepzh
committed
Count local files by default
1 parent e8ce2f7 commit de59479

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/app/components/Option/components/StatisticsOption.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const _default = defineComponent({
3232
return () => <>
3333
<OptionItem
3434
label={msg => msg.option.statistics.countLocalFiles}
35-
defaultValue={t(msg => msg.option.no)}
35+
defaultValue={t(msg => msg.option.yes)}
3636
hideDivider
3737
v-slots={{
3838
info: () => <OptionTooltip>{t(msg => msg.option.statistics.localFilesInfo)}</OptionTooltip>,

src/background/timer/server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import statService from "@service/stat-service"
66
import { extractHostname, HostInfo } from "@util/pattern"
77
import badgeTextManager from "../badge-text-manager"
88
import MessageDispatcher from "../message-dispatcher"
9+
import optionService from "@service/option-service"
10+
11+
let option = null
12+
optionService.getAllOption().then(opt => option = opt)
13+
optionService.addOptionChangeListener(opt => option = opt)
914

1015
async function handleTime(hostInfo: HostInfo, url: string, dateRange: [number, number]): Promise<number> {
1116
const host = hostInfo.host
@@ -34,6 +39,7 @@ async function handleEvent(event: timer.stat.Event, sender: ChromeMessageSender)
3439
if (!tab?.active) return
3540
}
3641
const hostInfo = extractHostname(url)
42+
if (hostInfo.protocol === "file" && !option.countLocalFiles) return
3743
await handleTime(hostInfo, url, [start, end])
3844
if (tabId) {
3945
const winTabs = await listTabs({ active: true, windowId })

src/util/constant/option.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function defaultAppearance(): timer.option.AppearanceOption {
4040
export function defaultStatistics(): timer.option.StatisticsOption {
4141
return {
4242
collectSiteName: true,
43-
countLocalFiles: false,
43+
countLocalFiles: true,
4444
}
4545
}
4646

0 commit comments

Comments
 (0)