From a7301d1de9d814aba91d934a8e009173536f06f3 Mon Sep 17 00:00:00 2001 From: ZYFDroid Date: Thu, 24 Feb 2022 17:17:38 +0800 Subject: [PATCH] Fix crash when load resource pack without meta.json Limit resource pack network access --- EPUBium Desktop/EPUBium Desktop.csproj | 4 ++-- EPUBium Desktop/Form1.cs | 14 +++++++++++-- EPUBium Desktop/FrmChangeResource.cs | 22 ++++++++++++++------- EPUBium Desktop/Properties/AssemblyInfo.cs | 4 ++-- EPUBium Desktop/htdocs.pak | Bin 1297381 -> 1389002 bytes EPUBium Desktop/htdocs/index.html | 12 +++++++---- 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/EPUBium Desktop/EPUBium Desktop.csproj b/EPUBium Desktop/EPUBium Desktop.csproj index ed00cdf..fb40e38 100644 --- a/EPUBium Desktop/EPUBium Desktop.csproj +++ b/EPUBium Desktop/EPUBium Desktop.csproj @@ -50,13 +50,13 @@ bin\x64\Release\ TRACE true - embedded + none x64 7.3 prompt true Off - true + false icon.ico diff --git a/EPUBium Desktop/Form1.cs b/EPUBium Desktop/Form1.cs index 6b0093f..c5340b9 100644 --- a/EPUBium Desktop/Form1.cs +++ b/EPUBium Desktop/Form1.cs @@ -123,17 +123,27 @@ void initWebView2() webView.DocumentTitleChanged += WebView_DocumentTitleChanged; webView.Settings.IsPinchZoomEnabled = false; webView.Settings.IsSwipeNavigationEnabled = false; - webView.AddWebResourceRequestedFilter("http://epub.zyf-internal.com/*", CoreWebView2WebResourceContext.All); + webView.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All); resourceHandler = new ResourceHandler(webView.Environment); webView.WebResourceRequested += WebView_WebResourceRequested; + webView.FrameNavigationStarting += WebView_FrameNavigationStarting; } + + private void WebView_FrameNavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e) + { + if (!e.Uri.StartsWith(urlbase)) + { + e.Cancel = true; + } + } + const string urlbase = "http://epub.zyf-internal.com"; private void WebView_WebResourceRequested(object sender, CoreWebView2WebResourceRequestedEventArgs e) { e.Response = handleRequest(e.Request); e.GetDeferral().Complete(); } - + public CoreWebView2WebResourceResponse handleRequest(CoreWebView2WebResourceRequest request) { if (request.Uri.StartsWith(urlbase)) diff --git a/EPUBium Desktop/FrmChangeResource.cs b/EPUBium Desktop/FrmChangeResource.cs index f3c6438..5f79f8d 100644 --- a/EPUBium Desktop/FrmChangeResource.cs +++ b/EPUBium Desktop/FrmChangeResource.cs @@ -86,8 +86,14 @@ void loadData() resPackInfo.metadata = new ResPackMeta(); } } - resPackInfo.metadata.safeValue(file); } + else + { + resPackInfo.metadata = new ResPackMeta(); + + } + + resPackInfo.metadata.safeValue(file); } catch { } } @@ -122,21 +128,23 @@ class ResPackMeta public void safeValue(string filename) { - name = name.Trim() == "" ? null : name; - description = description.Trim() == "" ? null : description; - author = author.Trim() == "" ? null : author; - version = name.Trim() == "" ? null : version; - link = name.Trim() == "" ? null : link; - name = name ?? Path.GetFileName(filename); description = description ?? ""; author = author ?? ""; version = version ?? ""; link = link ?? ""; + + name = name.Trim() == "" ? Path.GetFileName(filename) : name; + + } public override string ToString() { + if(version == "" || author == "") + { + return $"{name}\r\n \r\n "; + } return $"{name} v{version}\r\n{description}\r\n作者:{author}"; } } diff --git a/EPUBium Desktop/Properties/AssemblyInfo.cs b/EPUBium Desktop/Properties/AssemblyInfo.cs index 8c5cfc3..90610e1 100644 --- a/EPUBium Desktop/Properties/AssemblyInfo.cs +++ b/EPUBium Desktop/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.0.0.1")] +[assembly: AssemblyFileVersion("3.0.0.1")] diff --git a/EPUBium Desktop/htdocs.pak b/EPUBium Desktop/htdocs.pak index 3e17b1caf34b2042382752aa767399a9031b68bb..a061a9dd3797d73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D`F@DoPtgO=+j>BU5JRI>xFp0@T{+MEv3wTw%tw zApA7K49_|&vUXJ!QaUJ|6b(g7(NXk7RW-bxVO?*}qI(u5gzM;?PV;sAl2==()!>(TR5aeirgLRDwqATSNoc zuz)-bFYpxV@a7`Y;_oSlNPYqRh4maMo%|WF Z`4XEB^9PJdm5e?%`T~tiwpB*->o3@z3RM6A diff --git a/EPUBium Desktop/htdocs/index.html b/EPUBium Desktop/htdocs/index.html index 8b98a0a..e86a549 100644 --- a/EPUBium Desktop/htdocs/index.html +++ b/EPUBium Desktop/htdocs/index.html @@ -113,11 +113,15 @@ }); $(function (){ + loadFolderList(); + loadAll(); + }) + + function loadFolderList(){ $.ajax({url:"/api/folders",success:function (result) { menuController.folders = JSON.parse(result); }}); - loadAll(); - }) + } function loadFolder(folder){ $.ajax({url:"/api/folder/"+folder.UUID,success:function (result) { @@ -180,12 +184,12 @@ unblockloading(); toast(result); loadAll(); - loadFolder(); + loadFolderList(); }, err:function(a,b,c){ toast("扫描出错"); loadAll(); - loadFolder(); + loadFolderList(); } }); }