Skip to content

Commit

Permalink
修复问题:从JavaScript传输长字符串导致NamedPipe失效。
Browse files Browse the repository at this point in the history
增加功能:在EmbeddedFileResource,LocalFileResource和ZippedResource的注册器中添加了OnFallback处理函数,通过该函数指定当请求URL不存在时重新指向一个存在的文件来处理当前请求的URL,此功能主要为了解决使用了BrowserRouter的各种前端框架在路由地址刷新页面时提示404的问题。
  • Loading branch information
XuanchenLin committed Dec 5, 2020
1 parent de7dbb5 commit 6e2c4d0
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 106 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ What's New in NanUI version 0.8
- Rewrite the HostWindow, 3 new styles were added.
- Add ZipFile Resource Handler.

### 2020/12/5
- 修复了JavaScript不能传大于1K数据内容的问题
- 为资源控制器增加了OnFallback处理函数,现在可以支持各类前端框架的浏览器路由了(之前是建议使用哈希路由)
- 尝试添加了对Blazor WebAssembly使用嵌入式打包的支持(.NET5.0)

### 2020/11/19

- ΪAppBuilder������UseApplicationContext������VSTO��������ʲô����Ҫ�����������Ŀ���Ϳ���ʹ�������������ʼ��NanUI��CEF��
- �����VSTO��Ŀ�����쳣�����⣨��������NamePipe�������淶��ɣ���
- 为AppBuilder添加了UseApplicationContext方法。VSTO或者其他什么不需要启动窗体的项目类型可以使用这个方法来初始化NanUI和CEF。
- 解决了VSTO项目中抛异常的问题(该问题由NamePipe命名不规范造成)。
10 changes: 3 additions & 7 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Please consider rewarding the project author or sponsoring the project so that t
### Current Version:

- **Chromium** `80.0.3987.163`
- **NanUI** `0.8.80.120`
- **NanUI** `0.8.80.120`

### Requirement

Expand All @@ -47,22 +47,19 @@ Please consider rewarding the project author or sponsoring the project so that t

### Compile the source code

NanUI supports the framework from .NET 4.6.2 to the latest .NET 5.0, if you need to compile NanUI source code, you need to use __Visual Studio 2019 16.8 or higher__, and you need to install the corresponding .NET framework version:
NanUI supports the framework from .NET 4.6.2 to the latest .NET 5.0, if you need to compile NanUI source code, you need to use **Visual Studio 2019 16.8 or higher**, and you need to install the corresponding .NET framework version:

- .NET 4.6.2/4.7/4.7.1/4.7.2/4.8 SDK
- .NET Core 3.1 SDK
- .NET 5.0 SDK

If you only want to compile NanUI for a specific framework platform, please modify the `TargetFrameworks` property value in the project file yourself.


---


## Getting Start

If you want to learn more about NanUI or want to use NanUI for development as soon as possible, please navigate to [Welcome to NanUI](docs/README.md) to get documentation and sample code.

If you want to learn more about NanUI or want to use NanUI for development as soon as possible, please navigate to [Welcome to NanUI](docs/README.en-US.md) to get documentation and sample code.

The source code contains a sample project FormiumClient, you can quickly learn the relevant knowledge of NanUI through the source code of this project, it will also teach you how to use HTML / CSS / JavaScript to create your application.

Expand All @@ -76,7 +73,6 @@ The source code contains a sample project FormiumClient, you can quickly learn t

![Formium Client](docs/images/formium-client-preview-enUS.png)


## License

NanUI is MIT licensed. **The copyright of NanUI project is owned by the project's founder and developer Xuanchen Lin**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ private JavaScriptValue Hello(Formium owner, JavaScriptValue[] arguments)
{
var msg = arguments.FirstOrDefault(x => x.IsString)?.GetString() ?? "hello world";

if (owner.WindowState != FormWindowState.Maximized)
{
owner.WindowState = FormWindowState.Maximized;
}
else
{
owner.WindowState = FormWindowState.Normal;
}

MessageBox.Show(owner.HostWindow, msg, "Hello from JavaScript", MessageBoxButtons.OK, MessageBoxIcon.Information);

return null;
}
Expand Down
5 changes: 4 additions & 1 deletion src/FormiumClient/FormiumClient.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1;net472;net5.0-windows;</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>Resources\DemoIcon.ico</ApplicationIcon>
Expand All @@ -16,6 +16,9 @@
<EmbeddedResource Include="wwwroot\**" />
</ItemGroup>




<ItemGroup>
<ProjectReference Include="..\NetDimension.NanUI.DataServiceResource\NetDimension.NanUI.DataServiceResource.csproj" />
<ProjectReference Include="..\NetDimension.NanUI.EmbeddedFileResource\NetDimension.NanUI.EmbeddedFileResource.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/FormiumClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void Main()
// You can configure your application settings of NanUI here.
#if DEBUG
// Use this setting if your application running in DEBUG mode, it will allow user to open or clode DevTools by right-clicking mouse button and selecting menu items on context menu.
//app.UseDebuggingMode();
app.UseDebuggingMode();
#endif
// Use this setting if you want only one instance can be run.
Expand All @@ -67,7 +67,7 @@ static void Main()
app.RegisterJavaScriptExtension(() => new DemoWindowJavaScriptExtension());
// Clear all cached files such as cookies, histories, localstorages, etc.
app.ClearCacheFile();
// app.ClearCacheFile();
app.UseEmbeddedFileResource("http", "main.app.local", "wwwroot");
Expand Down
6 changes: 3 additions & 3 deletions src/FormiumClient/wwwroot/asset-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"files": {
"main.css": "/static/css/main.2b8db81a.chunk.css",
"main.js": "/static/js/main.chunk.fdf36a87.js",
"runtime-main.js": "/static/js/runtime-main.bundle.cbbdafdb.js",
"runtime-main.js": "/static/js/runtime-main.bundle.f0ae42f8.js",
"static/js/2.chunk.974a62a2.js": "/static/js/2.chunk.974a62a2.js",
"static/css/3.1fbc00f4.chunk.css": "/static/css/3.1fbc00f4.chunk.css",
"static/js/3.chunk.0db370c4.js": "/static/js/3.chunk.0db370c4.js",
"static/css/4.0e433876.chunk.css": "/static/css/4.0e433876.chunk.css",
"static/js/4.chunk.e308debb.js": "/static/js/4.chunk.e308debb.js",
"static/css/5.ff6790b0.chunk.css": "/static/css/5.ff6790b0.chunk.css",
"static/js/5.chunk.b783c538.js": "/static/js/5.chunk.b783c538.js",
"static/js/5.chunk.cfa90940.js": "/static/js/5.chunk.cfa90940.js",
"static/css/6.f06018c2.chunk.css": "/static/css/6.f06018c2.chunk.css",
"static/js/6.chunk.5cd5cd6b.js": "/static/js/6.chunk.5cd5cd6b.js",
"static/js/7.chunk.d36c8593.js": "/static/js/7.chunk.d36c8593.js",
Expand All @@ -32,7 +32,7 @@
"static/media/window.aa79edc4.svg": "/static/media/window.aa79edc4.svg"
},
"entrypoints": [
"static/js/runtime-main.bundle.cbbdafdb.js",
"static/js/runtime-main.bundle.f0ae42f8.js",
"static/js/2.chunk.974a62a2.js",
"static/css/main.2b8db81a.chunk.css",
"static/js/main.chunk.fdf36a87.js"
Expand Down
2 changes: 1 addition & 1 deletion src/FormiumClient/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><title>React App</title><link href="/static/css/main.2b8db81a.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="formium-app"></div><script>!function(e){function t(t){for(var n,o,u=t[0],i=t[1],f=t[2],l=0,d=[];l<u.length;l++)o=u[l],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(s&&s(t);d.length;)d.shift()();return c.push.apply(c,f||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var i=r[o];0!==a[i]&&(n=!1)}n&&(c.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={1:0},a={1:0},c=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{3:1,4:1,5:1,6:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{3:"1fbc00f4",4:"0e433876",5:"ff6790b0",6:"f06018c2",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0"}[e]+".chunk.css",a=u.p+n,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var f=(s=c[i]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(f===n||f===a))return t()}var l=document.getElementsByTagName("style");for(i=0;i<l.length;i++){var s;if((f=(s=l[i]).getAttribute("data-href"))===n||f===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],d.parentNode.removeChild(d),r(c)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+".chunk."+{3:"0db370c4",4:"e308debb",5:"b783c538",6:"5cd5cd6b",7:"d36c8593",8:"9c7a702c",9:"8265c0c9"}[e]+".js"}(e);var f=new Error;c=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var l=setTimeout((function(){c({type:"timeout",target:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpformium-client-frontend"]=this["webpackJsonpformium-client-frontend"]||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var s=f;r()}([])</script><script src="/static/js/2.chunk.974a62a2.js"></script><script src="/static/js/main.chunk.fdf36a87.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><title>React App</title><link href="/static/css/main.2b8db81a.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="formium-app"></div><script>!function(e){function t(t){for(var n,o,u=t[0],i=t[1],f=t[2],l=0,d=[];l<u.length;l++)o=u[l],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(s&&s(t);d.length;)d.shift()();return c.push.apply(c,f||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var i=r[o];0!==a[i]&&(n=!1)}n&&(c.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={1:0},a={1:0},c=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{3:1,4:1,5:1,6:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{3:"1fbc00f4",4:"0e433876",5:"ff6790b0",6:"f06018c2",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0"}[e]+".chunk.css",a=u.p+n,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var f=(s=c[i]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(f===n||f===a))return t()}var l=document.getElementsByTagName("style");for(i=0;i<l.length;i++){var s;if((f=(s=l[i]).getAttribute("data-href"))===n||f===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],d.parentNode.removeChild(d),r(c)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+".chunk."+{3:"0db370c4",4:"e308debb",5:"cfa90940",6:"5cd5cd6b",7:"d36c8593",8:"9c7a702c",9:"8265c0c9"}[e]+".js"}(e);var f=new Error;c=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var l=setTimeout((function(){c({type:"timeout",target:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpformium-client-frontend"]=this["webpackJsonpformium-client-frontend"]||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var s=f;r()}([])</script><script src="/static/js/2.chunk.974a62a2.js"></script><script src="/static/js/main.chunk.fdf36a87.js"></script></body></html>
1 change: 0 additions & 1 deletion src/FormiumClient/wwwroot/static/js/5.chunk.b783c538.js

This file was deleted.

1 change: 1 addition & 0 deletions src/FormiumClient/wwwroot/static/js/5.chunk.cfa90940.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6e2c4d0

Please sign in to comment.