chore:检测config.ini是否对webengine沙箱有要求

This commit is contained in:
2025-09-19 20:11:49 +08:00
parent 161b268c24
commit be6fb10019
2 changed files with 17 additions and 1 deletions

View File

@@ -261,3 +261,18 @@ QJsonObject Utils::parseFeatureJsonFile()
return jsonDoc.object(); return jsonDoc.object();
} }
/**
* @brief Utils::shouldDisableWebEngineSandbox 检查是否应关闭webengine沙箱
* @return bool true: 配置文件中设置了关闭沙箱 false: 未设置或设置为false
*/
bool Utils::shouldDisableWebEngineSandbox()
{
// WARNING: 请在 组织名称 和 应用程序名称 初始化完成后调用
QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat);
// 检查配置文件中[webengine]部分的noSandbox配置项
// 如果配置存在且值为true则返回true否则返回false
qDebug()<<"shaxiang"<<config.value("webengine/noSandbox", false).toBool();
return config.value("webengine/noSandbox", false).toBool();
}

View File

@@ -18,6 +18,7 @@ public:
static void setQPAPlatform(); static void setQPAPlatform();
static void checkUOSDeveloperMode(); static void checkUOSDeveloperMode();
static QJsonObject parseFeatureJsonFile(); static QJsonObject parseFeatureJsonFile();
static bool shouldDisableWebEngineSandbox(); // 新增函数声明
}; };
#endif // UTILS_H #endif // UTILS_H