Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
- 新增「设置 → 其他设置 → 主窗口使用软件内置的圆角及阴影」设置(#2360)
*默认启用,关闭后将使用系统原生的窗口样式,该设置重启软件后生效*
- 开放API新增播放器声音大小、静音、播放进度控制,详情看接入文档(#2386)

### 变更

- 更新代理配置规则,现在不启用代理时,图片、音频加载将不再走系统代理(#2382 @Folltoshe)
26 changes: 13 additions & 13 deletions src/main/modules/winMain/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ export const createWindow = () => {
const { shouldUseDarkColors, theme } = global.lx.theme
const ses = session.fromPartition('persist:win-main')
const proxy = getProxy()
if (proxy) {
void ses.setProxy({
proxyRules: `http://${proxy.host}:${proxy.port}`,
})
}
setSesProxy(ses, proxy?.host, proxy?.port)

/**
* Initial window options
Expand Down Expand Up @@ -131,19 +127,23 @@ export const closeWindow = () => {
browserWindow.close()
}

export const setProxy = () => {
if (!browserWindow) return
const proxy = getProxy()
if (proxy) {
void browserWindow.webContents.session.setProxy({
proxyRules: `http://${proxy.host}:${proxy.port}`,
const setSesProxy = (ses: Electron.Session, host?: string, port?: string | number) => {
if (host) {
void ses.setProxy({
mode: 'fixed_servers',
proxyRules: `http://${host}:${port}`,
})
} else {
void browserWindow.webContents.session.setProxy({
proxyRules: '',
void ses.setProxy({
mode: 'direct',
})
}
}
export const setProxy = () => {
if (!browserWindow) return
const proxy = getProxy()
setSesProxy(browserWindow.webContents.session, proxy?.host, proxy?.port)
}


export const sendEvent = <T = any>(name: string, params?: T) => {
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/core/useApp/useSettingSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ export default () => {
sync.client.host = host
})

watch(() => appSetting['network.proxy.enable'], enable => {
proxy.enable = enable
})
watch(() => appSetting['network.proxy.enable'], enable => {
proxy.enable = enable
})
Expand Down