@bouko/electron 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/csp/index.js +1 -3
- package/dist/files/dialog.d.ts +1 -1
- package/dist/files/index.d.ts +0 -1
- package/dist/files/index.js +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/ipc/index.d.ts +6 -2
- package/dist/ipc/index.js +31 -2
- package/package.json +2 -33
package/dist/csp/index.js
CHANGED
|
@@ -33,8 +33,7 @@ export const devCsp = "default-src 'self' http://localhost:* blob: data:; " +
|
|
|
33
33
|
"worker-src 'self' blob: http://localhost:*; " +
|
|
34
34
|
`connect-src 'self' blob: http://localhost:* ws://localhost:* ${getEnv("DB_URL")};`;
|
|
35
35
|
export const setupCspPolicy = () => session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
|
|
36
|
-
if (details.url.startsWith("file://") ||
|
|
37
|
-
details.url.startsWith("http://localhost")) {
|
|
36
|
+
if (details.url.startsWith("file://") || details.url.startsWith("http://localhost")) {
|
|
38
37
|
callback({
|
|
39
38
|
responseHeaders: {
|
|
40
39
|
...details.responseHeaders,
|
|
@@ -43,6 +42,5 @@ export const setupCspPolicy = () => session.defaultSession.webRequest.onHeadersR
|
|
|
43
42
|
});
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
|
-
// Do NOT touch third-party pages (SoundCloud, etc.)
|
|
47
45
|
callback({ responseHeaders: details.responseHeaders });
|
|
48
46
|
});
|
package/dist/files/dialog.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BrowserWindow } from "electron";
|
|
|
2
2
|
type Props = {
|
|
3
3
|
window: BrowserWindow;
|
|
4
4
|
title: string;
|
|
5
|
-
defaultPath
|
|
5
|
+
defaultPath: "music";
|
|
6
6
|
};
|
|
7
7
|
export declare function choosePath({ window, title, defaultPath }: Props): Promise<string | null>;
|
|
8
8
|
export {};
|
package/dist/files/index.d.ts
CHANGED
package/dist/files/index.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/ipc/index.d.ts
CHANGED
package/dist/ipc/index.js
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ipcMain, BrowserWindow } from "electron";
|
|
2
|
+
import { choosePath } from "../files/dialog";
|
|
3
|
+
export class IpcManager {
|
|
4
|
+
id;
|
|
5
|
+
constructor(id) {
|
|
6
|
+
this.id = id;
|
|
7
|
+
}
|
|
8
|
+
on(channel, cb) {
|
|
9
|
+
ipcMain.handle(`${this.id}:${channel}`, (_, params) => cb(params));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function setupAppIpc() {
|
|
13
|
+
ipcMain.on("app:minimize", (event) => {
|
|
14
|
+
const window = BrowserWindow.fromWebContents(event.sender);
|
|
15
|
+
window?.minimize();
|
|
16
|
+
});
|
|
17
|
+
ipcMain.on("app:close", (event) => {
|
|
18
|
+
const window = BrowserWindow.fromWebContents(event.sender);
|
|
19
|
+
window?.close();
|
|
20
|
+
});
|
|
21
|
+
ipcMain.on("app:choose-path", async (event) => {
|
|
22
|
+
const window = BrowserWindow.fromWebContents(event.sender);
|
|
23
|
+
if (!window)
|
|
24
|
+
return;
|
|
25
|
+
return await choosePath({
|
|
26
|
+
window: window,
|
|
27
|
+
title: "Choose Vault Folder",
|
|
28
|
+
defaultPath: "music"
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,72 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "@bouko/electron",
|
|
4
|
-
|
|
5
|
-
"version": "1.0.5",
|
|
6
|
-
|
|
4
|
+
"version": "1.0.6",
|
|
7
5
|
"description": "",
|
|
8
|
-
|
|
9
6
|
"keywords": [],
|
|
10
|
-
|
|
11
7
|
"author": "",
|
|
12
|
-
|
|
13
8
|
"license": "ISC",
|
|
14
|
-
|
|
15
9
|
"main": "./dist/index.js",
|
|
16
|
-
|
|
17
10
|
"types": "./dist/index.d.ts",
|
|
18
|
-
|
|
19
11
|
"files": [
|
|
20
|
-
|
|
21
12
|
"dist"
|
|
22
|
-
|
|
23
13
|
],
|
|
24
|
-
|
|
25
14
|
"publishConfig": {
|
|
26
|
-
|
|
27
15
|
"access": "public"
|
|
28
|
-
|
|
29
16
|
},
|
|
30
|
-
|
|
31
17
|
"exports": {
|
|
32
|
-
|
|
33
18
|
".": "./dist/index.js",
|
|
34
|
-
|
|
35
19
|
"./styles.css": "./dist/styles.css"
|
|
36
|
-
|
|
37
20
|
},
|
|
38
|
-
|
|
39
21
|
"engines": {},
|
|
40
22
|
|
|
41
23
|
"scripts": {
|
|
42
|
-
|
|
43
24
|
"build": "tsc",
|
|
44
|
-
|
|
45
25
|
"postbuild": "node ./scripts/copy-styles.mjs"
|
|
46
|
-
|
|
47
26
|
},
|
|
48
27
|
|
|
49
28
|
"dependencies": {
|
|
50
|
-
|
|
51
29
|
"@bouko/react": "^3.1.3",
|
|
52
|
-
|
|
53
30
|
"@bouko/ts": "^0.3.8",
|
|
54
|
-
|
|
55
31
|
"path": "^0.12.7"
|
|
56
|
-
|
|
57
32
|
},
|
|
58
33
|
|
|
59
34
|
"devDependencies": {
|
|
60
|
-
|
|
61
35
|
"@types/react": "^19.2.13",
|
|
62
|
-
|
|
63
36
|
"electron": "^39.2.7",
|
|
64
|
-
|
|
65
37
|
"react-router-dom": "^7.12.0",
|
|
66
|
-
|
|
67
38
|
"typescript": "^5.9.3"
|
|
68
|
-
|
|
69
39
|
}
|
|
70
40
|
|
|
71
|
-
}
|
|
72
|
-
|
|
41
|
+
}
|