mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
feat: 增加 FireFox 站点隔离机制开关
This commit is contained in:
@@ -306,7 +306,9 @@ export async function initBrowserBase(config, options = {}) {
|
||||
// 禁用背景模糊滤镜 (高 CPU 消耗)
|
||||
'layout.css.backdrop-filter.enabled': false,
|
||||
// 告诉网页用户倾向于减少动画 (触发网页自身的优化)
|
||||
'ui.prefersReducedMotion': 1
|
||||
'ui.prefersReducedMotion': 1,
|
||||
// 站点隔离
|
||||
...(browserConfig.fission === false ? { 'fission.autostart': false } : {})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ export function getBrowserConfig() {
|
||||
return {
|
||||
path: browser.path || '',
|
||||
headless: browser.headless || false,
|
||||
fission: browser.fission !== false, // 默认 true
|
||||
proxy: {
|
||||
enable: proxy.enable || false,
|
||||
type: proxy.type || 'http',
|
||||
@@ -104,6 +105,7 @@ export function saveBrowserConfig(data) {
|
||||
|
||||
if (data.path !== undefined) config.browser.path = data.path;
|
||||
if (data.headless !== undefined) config.browser.headless = data.headless;
|
||||
if (data.fission !== undefined) config.browser.fission = data.fission;
|
||||
|
||||
if (data.proxy) {
|
||||
if (!config.browser.proxy) config.browser.proxy = {};
|
||||
|
||||
@@ -77,6 +77,11 @@ export function validateBrowserConfig(data) {
|
||||
errors.push('headless 必须是布尔值');
|
||||
}
|
||||
|
||||
// Fission 校验
|
||||
if (data.fission !== undefined && typeof data.fission !== 'boolean') {
|
||||
errors.push('fission 必须是布尔值');
|
||||
}
|
||||
|
||||
// Proxy 校验
|
||||
if (data.proxy) {
|
||||
if (data.proxy.enable !== undefined && typeof data.proxy.enable !== 'boolean') {
|
||||
|
||||
Reference in New Issue
Block a user