forked from git-hub-cc/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge.config.js
More file actions
130 lines (128 loc) · 4.96 KB
/
forge.config.js
File metadata and controls
130 lines (128 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// forge.config.js
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');
const path = require('path');
module.exports = {
packagerConfig: {
asar: true,
icon: path.resolve(__dirname, 'src/renderer/assets/app'),
extraResource: [],
// =========================================================================
// 【核心新增】文件关联配置
// 此配置会告知操作系统,我们的应用可以作为某些文件类型的默认打开方式。
// 这对于 Windows 和 macOS 的安装包都有效。
// =========================================================================
fileAssociations: [
{
ext: 'mp4',
name: 'MP4 Video File',
role: 'Viewer',
icon: path.resolve(__dirname, 'src/renderer/assets/app.ico'), // Windows 使用 .ico
},
{
ext: 'mkv',
name: 'MKV Video File',
role: 'Viewer',
icon: path.resolve(__dirname, 'src/renderer/assets/app.ico'),
},
{
ext: 'webm',
name: 'WebM Video File',
role: 'Viewer',
icon: path.resolve(__dirname, 'src/renderer/assets/app.ico'),
},
{
ext: 'mp3',
name: 'MP3 Audio File',
role: 'Viewer',
icon: path.resolve(__dirname, 'src/renderer/assets/app.ico'),
},
{
ext: 'flac',
name: 'FLAC Audio File',
role: 'Viewer',
icon: path.resolve(__dirname, 'src/renderer/assets/app.ico'),
},
],
// =========================================================================
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
name: 'Player',
setupIcon: path.resolve(__dirname, 'src/renderer/assets/app.ico'),
}
},
// =========================================================================
// 【核心修改】将 maker-zip 更换为 maker-dmg 以支持 macOS 上的文件关联
// .dmg 安装包是 macOS 的标准分发方式,能更好地与系统集成。
// =========================================================================
{
name: '@electron-forge/maker-dmg',
platforms: ['darwin'],
config: {
// DMG 安装包的配置可以根据需要添加,例如背景图、窗口大小等
// background: path.resolve(__dirname, 'src/renderer/assets/dmg-background.png'), // (可选) 示例背景图
format: 'ULFO'
}
},
// =========================================================================
{
name: '@electron-forge/maker-deb',
config: {
// =========================================================================
// 【核心新增】为 Debian/Ubuntu 添加 MIME 类型支持
// =========================================================================
options: {
mimeType: [
'video/mp4',
'video/x-matroska',
'video/webm',
'audio/mpeg',
'audio/flac',
],
},
// =========================================================================
},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
plugins: [
{
name: '@electron-forge/plugin-vite',
config: {
build: [
{
entry: 'src/backend/main-api.js',
config: 'vite.main.config.mjs',
},
{
entry: 'src/preload/preload.js',
config: 'vite.preload.config.mjs',
},
],
renderer: [
{
name: 'main_window',
html: 'src/renderer/index.html',
config: 'vite.renderer.config.mjs',
},
],
},
},
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};