Skip to content

Commit d4889a3

Browse files
authored
chore(desktop): Release v0.6.1 for hotfix
chore(desktop): Release v0.6.1 for hotfix
2 parents 7c56fc0 + 380922e commit d4889a3

File tree

14 files changed

+156
-261
lines changed

14 files changed

+156
-261
lines changed

apps/desktop/changelog/0.6.0.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,3 @@
11
# What's New in v0.6.0
22

3-
## Shiny New Things
4-
5-
- Import and export your Actions (394d00f)
6-
- Add a bio, website, and social links to your profile (507a525)
7-
- Upload a profile picture
8-
- Use video duration as an Action condition
9-
10-
## Improvements
11-
12-
- A snazzy new look for your personal profile
13-
- Redesigned the Actions page (1ace5ea)
14-
- Redesigned the RSSHub page (f9aca60)
15-
- Added length limits to certain profile fields
16-
- Simplified default commands in the entry tool (85122fb)
17-
- Enhanced UI labels and descriptions for clarity (2ed9f70)
18-
- Gradually rolling out an experimental unified local database for mobile and desktop (#3897 #3902)
19-
- Polished image-preview styling (cf72753)
20-
- Refined toast notifications (73f8011)
21-
22-
## No Longer Broken
23-
24-
- More reliable automatic recovery after database-migration failures (c2e0c3d)
25-
- Fixed unread counts not clearing in the macOS Docker build (70255af)
26-
- Fixed old entries showing during initial load (24ae065)
27-
- Fixed handling of links starting with `.` (de8eac8)
28-
- Fixed text-to-speech not working (82952b0)
29-
- Fixed star/unstar status not syncing across devices (fbd0b3)
30-
31-
## Thanks
32-
33-
Special thanks to volunteer contributors @kovsu @huanfe1 @cscnk52 @Olexandr88 @0-o0 @kingsword09 @ericyzhu for their valuable contributions
3+
This version has been withdrawn.

apps/desktop/changelog/0.6.1.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# What's New in v0.6.1
2+
3+
## Shiny New Things
4+
5+
- Import and export your Actions (394d00f)
6+
- Add a bio, website, and social links to your profile (507a525)
7+
- Upload a profile picture
8+
- Use video duration as an Action condition
9+
10+
## Improvements
11+
12+
- A snazzy new look for your personal profile
13+
- Redesigned the Actions page (1ace5ea)
14+
- Redesigned the RSSHub page (f9aca60)
15+
- Added length limits to certain profile fields
16+
- Simplified default commands in the entry tool (85122fb)
17+
- Enhanced UI labels and descriptions for clarity (2ed9f70)
18+
- Gradually rolling out an experimental unified local database for mobile and desktop (#3897 #3902)
19+
- Polished image-preview styling (cf72753)
20+
- Refined toast notifications (73f8011)
21+
22+
## No Longer Broken
23+
24+
- More reliable automatic recovery after database-migration failures (c2e0c3d)
25+
- Fixed unread counts not clearing in the macOS Docker build (70255af)
26+
- Fixed old entries showing during initial load (24ae065)
27+
- Fixed handling of links starting with `.` (de8eac8)
28+
- Fixed text-to-speech not working (82952b0)
29+
- Fixed star/unstar status not syncing across devices (fbd0b3)
30+
31+
## Thanks
32+
33+
Special thanks to volunteer contributors @kovsu @huanfe1 @cscnk52 @Olexandr88 @0-o0 @kingsword09 @ericyzhu for their valuable contributions

apps/desktop/configs/vite.electron-render.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { dirname, resolve } from "node:path"
1+
import { dirname } from "node:path"
2+
import { resolve } from "node:path/posix"
23
import { fileURLToPath } from "node:url"
34

45
import { tsImport } from "tsx/esm/api"

apps/desktop/forge.config.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const ymlMapsMap = {
3535
win32: "latest.yml",
3636
}
3737

38-
const keepModules = new Set(["font-list", "vscode-languagedetection", "fast-folder-size"])
38+
const keepModules = new Set(["font-list", "vscode-languagedetection"])
3939
const keepLanguages = new Set(["en", "en_GB", "en-US", "en_US"])
4040

4141
// remove folders & files not to be included in the app

apps/desktop/layer/main/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"electron-store": "10.1.0",
3737
"electron-updater": "6.6.2",
3838
"es-toolkit": "1.39.3",
39-
"fast-folder-size": "2.4.0",
4039
"font-list": "1.5.1",
4140
"i18next": "25.2.1",
4241
"js-yaml": "4.1.0",

apps/desktop/layer/main/src/ipc/services/app.ts

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
import fsp from "node:fs/promises"
12
import path from "node:path"
23
import { fileURLToPath } from "node:url"
34

45
import { callWindowExpose } from "@follow/shared/bridge"
56
import { DEV } from "@follow/shared/constants"
6-
import { app, BrowserWindow, clipboard, dialog } from "electron"
7+
import { app, BrowserWindow, clipboard, dialog, shell } from "electron"
78

9+
import { getCacheSize } from "~/lib/cleaner"
810
import { i18n } from "~/lib/i18n"
11+
import { store, StoreKey } from "~/lib/store"
912
import { registerAppTray } from "~/lib/tray"
10-
import { logger } from "~/logger"
13+
import { logger, revealLogFile } from "~/logger"
1114
import { AppManager } from "~/manager/app"
1215
import { WindowManager } from "~/manager/window"
1316
import { cleanupOldRender, loadDynamicRenderEntry } from "~/updater/hot-updater"
@@ -179,4 +182,73 @@ export class AppService extends IpcService {
179182

180183
return path.join(app.getAppPath(), input)
181184
}
185+
186+
@IpcMethod()
187+
openCacheFolder(_context: IpcContext): void {
188+
const dir = path.join(app.getPath("userData"), "cache")
189+
shell.openPath(dir)
190+
}
191+
192+
@IpcMethod()
193+
getCacheLimit(_context: IpcContext): number {
194+
return store.get(StoreKey.CacheSizeLimit) || 0
195+
}
196+
197+
@IpcMethod()
198+
async clearCache(_context: IpcContext): Promise<void> {
199+
const cachePath = path.join(app.getPath("userData"), "cache", "Cache_Data")
200+
if (process.platform === "win32") {
201+
// Request elevation on Windows
202+
203+
try {
204+
// Create a bat file to delete cache with elevated privileges
205+
const batPath = path.join(app.getPath("temp"), "clear_cache.bat")
206+
await fsp.writeFile(batPath, `@echo off\nrd /s /q "${cachePath}"\ndel "%~f0"`, "utf-8")
207+
208+
// Execute the bat file with admin privileges
209+
await shell.openPath(batPath)
210+
return
211+
} catch (err) {
212+
logger.error("Failed to clear cache with elevation", { error: err })
213+
}
214+
}
215+
await fsp.rm(cachePath, { recursive: true, force: true }).catch(() => {
216+
logger.error("Failed to clear cache")
217+
})
218+
}
219+
220+
// getCacheLimit: t.procedure.action(async () => {
221+
// return store.get(StoreKey.CacheSizeLimit)
222+
// }),
223+
224+
// clearCache: t.procedure.action(async () => {
225+
226+
// }),
227+
228+
// limitCacheSize: t.procedure.input<number>().action(async ({ input }) => {
229+
// logger.info("set limitCacheSize", input)
230+
// if (input === 0) {
231+
// store.delete(StoreKey.CacheSizeLimit)
232+
// } else {
233+
// store.set(StoreKey.CacheSizeLimit, input)
234+
// }
235+
// }),
236+
@IpcMethod()
237+
limitCacheSize(_context: IpcContext, input: number): void {
238+
if (input === 0) {
239+
store.delete(StoreKey.CacheSizeLimit)
240+
} else {
241+
store.set(StoreKey.CacheSizeLimit, input)
242+
}
243+
}
244+
245+
@IpcMethod()
246+
revealLogFile(_context: IpcContext) {
247+
return revealLogFile()
248+
}
249+
250+
@IpcMethod()
251+
getCacheSize(_context: IpcContext) {
252+
return getCacheSize()
253+
}
182254
}

apps/desktop/layer/main/src/lib/cleaner.ts

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { statSync } from "node:fs"
22
import fsp from "node:fs/promises"
3-
import { createRequire } from "node:module"
43
import path from "node:path"
5-
import { promisify } from "node:util"
64

75
import { callWindowExpose } from "@follow/shared/bridge"
86
import { app, dialog } from "electron"
@@ -14,13 +12,37 @@ import { WindowManager } from "~/manager/window"
1412
import { t } from "./i18n"
1513
import { store, StoreKey } from "./store"
1614

17-
const esModuleInterop = (module: any) => {
18-
return module.default || module
15+
const getFolderSize = async (dir: string): Promise<number> => {
16+
try {
17+
const files = await fsp.readdir(dir, { withFileTypes: true })
18+
const sizes = await Promise.all(
19+
files.map(async (file) => {
20+
const filePath = path.join(dir, file.name)
21+
22+
if (file.isSymbolicLink()) {
23+
return 0
24+
}
25+
26+
if (file.isDirectory()) {
27+
return await getFolderSize(filePath)
28+
}
29+
30+
if (file.isFile()) {
31+
try {
32+
const { size } = await fsp.stat(filePath)
33+
return size
34+
} catch {
35+
return 0
36+
}
37+
}
38+
return 0
39+
}),
40+
)
41+
return sizes.reduce((acc, size) => acc + size, 0)
42+
} catch {
43+
return 0
44+
}
1945
}
20-
const require = createRequire(import.meta.url)
21-
const fastFolderSize = esModuleInterop(
22-
require("fast-folder-size"),
23-
) as typeof import("fast-folder-size").default
2446

2547
export const clearAllDataAndConfirm = async () => {
2648
const win = WindowManager.getMainWindow()
@@ -71,12 +93,12 @@ export const clearAllData = async () => {
7193
caller.toast.error(`Error resetting app data: ${error.message}`)
7294
}
7395
}
74-
const fastFolderSizeAsync = promisify(fastFolderSize)
96+
7597
export const getCacheSize = async () => {
7698
const cachePath = path.join(app.getPath("userData"), "cache")
7799

78100
// Size is in bytes
79-
const sizeInBytes = await fastFolderSizeAsync(cachePath).catch((error) => {
101+
const sizeInBytes = await getFolderSize(cachePath).catch((error) => {
80102
logger.error(error)
81103
})
82104
return sizeInBytes || 0
@@ -155,7 +177,7 @@ export const clearCacheCronJob = () => {
155177
export const checkAndCleanCodeCache = async () => {
156178
const cachePath = path.join(app.getPath("userData"), "Code Cache")
157179

158-
const size = await fastFolderSizeAsync(cachePath).catch((error) => {
180+
const size = await getFolderSize(cachePath).catch((error) => {
159181
logger.error(error)
160182
})
161183

apps/desktop/layer/main/src/manager/window.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class WindowManagerStatic {
298298
webviewTag: true,
299299
webSecurity: !DEV,
300300
nodeIntegration: true,
301-
contextIsolation: true,
301+
contextIsolation: false,
302302
},
303303
...this.getPlatformSpecificWindowConfig(),
304304
}

apps/desktop/layer/renderer/src/initialize/analytics.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import type { AuthSession } from "@follow/shared/hono"
2-
import { setFirebaseTracker, setOpenPanelTracker, tracker } from "@follow/tracker"
2+
import { setFirebaseTracker, tracker } from "@follow/tracker"
33

44
import { QUERY_PERSIST_KEY } from "~/constants/app"
55

66
import { ga4 } from "./ga4"
7-
import { op } from "./op"
87

98
export const initAnalytics = async () => {
109
tracker.manager.appendUserProperties({
@@ -16,8 +15,6 @@ export const initAnalytics = async () => {
1615

1716
setFirebaseTracker(ga4)
1817

19-
setOpenPanelTracker(op)
20-
2118
let session: AuthSession | undefined
2219
try {
2320
const queryData = JSON.parse(window.localStorage.getItem(QUERY_PERSIST_KEY) ?? "{}")

apps/desktop/layer/renderer/src/lib/load-language.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const loadLanguageAndApply = async (lang: string) => {
7474
}
7575
EventBus.dispatch("I18N_UPDATE", "")
7676
} else {
77+
if (ELECTRON) return
7778
let importFilePath = ""
7879

7980
if (IN_ELECTRON) {

0 commit comments

Comments
 (0)