File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed
apps/desktop/src/main/src Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 1
- import url from "node:url"
2
-
3
1
import { electronApp , optimizer } from "@electron-toolkit/utils"
4
2
import { callWindowExpose } from "@follow/shared/bridge"
5
3
import { APP_PROTOCOL } from "@follow/shared/constants"
@@ -77,7 +75,7 @@ function bootstrap() {
77
75
protocol . handle ( "app" , ( request ) => {
78
76
try {
79
77
const urlObj = new URL ( request . url )
80
- return net . fetch ( url . pathToFileURL ( urlObj . pathname ) . toString ( ) )
78
+ return net . fetch ( `file:// ${ urlObj . pathname } ` )
81
79
} catch {
82
80
logger . error ( "app protocol error" , request . url )
83
81
return new Response ( "Not found" , { status : 404 } )
Original file line number Diff line number Diff line change @@ -32,12 +32,22 @@ export const registerAppTray = () => {
32
32
click : showWindow ,
33
33
} ,
34
34
{
35
- role : "help" ,
36
35
label : t ( "menu.help" ) ,
37
36
submenu : [
38
- { role : "reload" , label : t ( "menu.reload" ) } ,
39
- { role : "forceReload" , label : t ( "menu.forceReload" ) } ,
40
- { role : "toggleDevTools" , label : t ( "menu.toggleDevTools" ) } ,
37
+ {
38
+ label : t ( "menu.reload" ) ,
39
+ click : ( ) => {
40
+ const mainWindow = getMainWindowOrCreate ( )
41
+ mainWindow . webContents . reload ( )
42
+ } ,
43
+ } ,
44
+ {
45
+ label : t ( "menu.toggleDevTools" ) ,
46
+ click : ( ) => {
47
+ const mainWindow = getMainWindowOrCreate ( )
48
+ mainWindow . webContents . toggleDevTools ( )
49
+ } ,
50
+ } ,
41
51
{
42
52
label : t ( "menu.openLogFile" ) ,
43
53
click : async ( ) => {
Original file line number Diff line number Diff line change 1
1
import path from "node:path"
2
- import { fileURLToPath } from "node:url"
2
+ import { fileURLToPath , pathToFileURL } from "node:url"
3
3
4
4
import { is } from "@electron-toolkit/utils"
5
5
import { APP_PROTOCOL } from "@follow/shared"
@@ -150,7 +150,8 @@ export function createWindow(
150
150
const dynamicRenderEntry = loadDynamicRenderEntry ( )
151
151
logger . info ( "load dynamic render entry" , dynamicRenderEntry )
152
152
const appLoadFileEntry = dynamicRenderEntry || path . resolve ( __dirname , "../renderer/index.html" )
153
- const appLoadEntry = `app://follow.is${ appLoadFileEntry } ${ options ?. extraPath || "" } `
153
+
154
+ const appLoadEntry = `app://follow.is${ pathToFileURL ( appLoadFileEntry ) . pathname } ${ options ?. extraPath || "" } `
154
155
155
156
window . loadURL ( appLoadEntry )
156
157
logger . log ( "load URL" , appLoadEntry )
You can’t perform that action at this time.
0 commit comments