浏览代码

Z991239-1017 #comment fea chromium中cef启动路径修复,国产化机器使用UrlFulture

陈良瑜80374463 5 年之前
父节点
当前提交
6841843937
共有 2 个文件被更改,包括 25 次插入8 次删除
  1. 24 7
      Module/mod_chromium/CModTools.cpp
  2. 1 1
      Module/mod_chromium/CModTools.h

+ 24 - 7
Module/mod_chromium/CModTools.cpp

@@ -61,10 +61,25 @@ std::pair<bool, std::string> CModTools::getMainUrl()
 	this->m_pEntity->GetFunction()->GetPath("Base", strChromiumPath);
 	strChromiumPath.Append(CSimpleStringA(SPLIT_SLASH_STR) + "bin" + SPLIT_SLASH_STR + "Chromium" + SPLIT_SLASH_STR);
 
+	//get major version
+	CSystemStaticInfo sysInfo;
+	m_pEntity->GetFunction()->GetSystemStaticInfo(sysInfo);
+	auto majorVersion = sysInfo.MachineVersion.GetMajor();
+
+
 	auto configRet = ReadCenterConfigStr();
 	CSimpleStringA strUrl;
 	bool isOpenExtend = false;
-	if (std::get<1>(configRet).Compare(""))
+	if(majorVersion >= 5)
+	{
+		auto mainUrl = std::get<3>(configRet);
+		std::vector<std::string> urlArr;
+		urlArr.push_back(mainUrl.GetData());
+		DetectActiveHttp(urlArr);
+		strUrl = mainUrl;
+		isOpenExtend = false;
+	}
+	else if (std::get<1>(configRet).Compare(""))
 	{
 		auto mainUrl = std::get<1>(configRet);
 		auto exUrl = std::get<2>(configRet);
@@ -110,7 +125,8 @@ std::string CModTools::generateCefclientCmd(bool isExtend, std::string mainUrl)
 	CSimpleStringA cachePath;
 	this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
 	cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR) + "cefCache");
-	//strCmdLine.Append(" --hide-controls=true --cache-path=").Append(cachePath);
+	//strCmdLine.Append(" --hide-controls=true")
+	strCmdLine.Append(" --cache-path=").Append(cachePath);
 	strCmdLine.Append(" --no-sandbox");
 	DbgEx("cmdline : %s", strCmdLine.GetData());
 
@@ -201,8 +217,8 @@ void CModTools::RestartProxyServer(){
 	return;
 }
 
-std::tuple<CSimpleStringA, CSimpleStringA, CSimpleStringA> CModTools::ReadCenterConfigStr(CSimpleStringA entityName){
-	CSimpleStringA str = "", strNew = "", strEx = "";
+std::tuple<CSimpleStringA, CSimpleStringA, CSimpleStringA, CSimpleStringA> CModTools::ReadCenterConfigStr(CSimpleStringA entityName){
+	CSimpleStringA str = "", strNew = "", strEx = "", strFulture = "";
 	CSmartPointer<IConfigInfo> spCerConfig;
 	ErrorCodeEnum err = this->m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, spCerConfig);
 	if (entityName == "")
@@ -213,10 +229,11 @@ std::tuple<CSimpleStringA, CSimpleStringA, CSimpleStringA> CModTools::ReadCenter
 	table.AddEntryString(entityName, "UserMgrUrl", str, "");
 	table.AddEntryString(entityName, "UserMgrUrlNoSidebar", strNew, "");
 	table.AddEntryString(entityName, "UserMgrUrlNoSidebarMuti", strEx, "");
+	table.AddEntryString(entityName, "UserMgrUrlFulture", strFulture, "");
 	if (Error_Succeed == table.Load(spCerConfig))
-		DbgEx(CSimpleString::Format("read centersetting config : UserMgrUrl-%s, UserMgrUrlNoSidebar-%s, UserMgrUrlNoSidebarMuti-%s",
-			str.GetData(), strNew.GetData(), strEx.GetData()));
-	return std::make_tuple(str, strNew, strEx);
+		DbgEx(CSimpleString::Format("read centersetting config : UserMgrUrl-%s, UserMgrUrlNoSidebar-%s, UserMgrUrlNoSidebarMuti-%s, UserMgrUrlFulture-%s",
+			str.GetData(), strNew.GetData(), strEx.GetData(), strFulture.GetData()));
+	return std::make_tuple(str, strNew, strEx, strFulture);
 }
 
 std::pair<CSimpleStringA, int> CModTools::ReadConfig() {

+ 1 - 1
Module/mod_chromium/CModTools.h

@@ -25,7 +25,7 @@ public:
 	bool killAllChromium();	//通过taskkill 关闭掉所有的cefclient
 	void RestartProxyServer();
 	std::pair<CSimpleStringA, int>  ReadConfig();	//读本地配置,已废弃
-	std::tuple<CSimpleStringA, CSimpleStringA, CSimpleStringA> ReadCenterConfigStr(CSimpleStringA entityName = "");
+	std::tuple<CSimpleStringA, CSimpleStringA, CSimpleStringA, CSimpleStringA> ReadCenterConfigStr(CSimpleStringA entityName = "");
 private:
 	std::pair<bool, std::string> getMainUrl();
 	std::string generateCefclientCmd(bool isExtend, std::string mainUrl);