1更新cef版本到138 2其他一些小改动
This commit is contained in:
1 parent
800ccb857d
commit
c5be88568c
161 files changed
+1670
-6757
No files matched your search
@@ -3,7 +3,7 @@ using AllBase.Helper;
|
||||
using AllBase.Model.Result;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using TemuKJD.DashBoardForms;
|
||||
//using TemuKJD.DashBoardForms;
|
||||
using TemuKJD.Helper;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using Microsoft.Win32;
|
||||
@@ -20,7 +20,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Hosting;
|
||||
//using System.Web.Hosting;
|
||||
using System.Windows.Forms;
|
||||
using Work;
|
||||
using Work.BLL.Tools;
|
||||
@@ -122,7 +122,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
continue;
|
||||
|
||||
string cookies = "";
|
||||
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
List<Cookie> cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null));
|
||||
if (cookieList != null && cookieList.Count > 0)
|
||||
{
|
||||
foreach (var cookie in cookieList)
|
||||
@@ -213,7 +213,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
else
|
||||
{
|
||||
var cookie2 = shop.Cookies2;
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
cefWebBrowser.Load("https://agentseller.temu.com");
|
||||
}
|
||||
@@ -233,7 +233,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
continue;
|
||||
|
||||
string cookies2 = "";
|
||||
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.GetCookieManager(null));
|
||||
if (cookieList2 != null && cookieList2.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < cookieList2.Count; i++)
|
||||
@@ -375,10 +375,10 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
if (cefWebBrowser == null)
|
||||
{
|
||||
//cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
|
||||
if (!string.IsNullOrEmpty(InitUrl))
|
||||
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
|
||||
if (!string.IsNullOrEmpty(InitUrl)) //temu国际版不支持无痕模式多开,此处改为true,每次创建cefwebbrowser时删除cookie
|
||||
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, true);
|
||||
else
|
||||
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
|
||||
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, true);
|
||||
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
|
||||
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
|
||||
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
|
||||
@@ -413,21 +413,26 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
|
||||
if (this.openType != EnumOpenType.login)
|
||||
{
|
||||
var cookie2 = shop.Cookies2;
|
||||
var t2 = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.RequestContext.GetCookieManager(null));
|
||||
t2.Wait(5000);
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
splitContainer1.Panel1.Controls.Add(cefWebBrowser);
|
||||
//cefWebBrowser.Load(shopMainUrl);
|
||||
}));
|
||||
// cef138必须init后方可设置或删除cookie
|
||||
while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
|
||||
Thread.Sleep(20);
|
||||
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
|
||||
|
||||
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
|
||||
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.GetCookieManager(null));
|
||||
t.Wait(5000);
|
||||
|
||||
if (this.openType != EnumOpenType.login)
|
||||
{
|
||||
var cookie2 = shop.Cookies2;
|
||||
var t2 = CEFBrowser.SetCookieAsync(shopCookieHead2, cookie2, cefWebBrowser.GetCookieManager(null));
|
||||
t2.Wait(5000);
|
||||
}
|
||||
|
||||
//根据登录的具体店铺设置local storage
|
||||
if (!string.IsNullOrEmpty(shop.ShopId))
|
||||
|
||||
Reference in new issue
Block a user