Skip to content

Commit

Permalink
update blazor sample for .Net Core 3.0.100 release
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-pdftron committed Sep 26, 2019
1 parent 0632d23 commit 42a01ef
Show file tree
Hide file tree
Showing 953 changed files with 95,888 additions and 95,892 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
bin
obj
15 changes: 9 additions & 6 deletions App.razor 100755 → 100644
@@ -1,7 +1,10 @@
<CascadingAuthenticationState>
<Router AppAssembly="typeof(Startup).Assembly">
<NotFoundContent>
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</NotFoundContent>
</Router>
</CascadingAuthenticationState>
</LayoutView>
</NotFound>
</Router>
1 change: 0 additions & 1 deletion BlazorWebViewerServer.csproj 100755 → 100644
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

</Project>
Empty file modified Data/WeatherForecast.cs 100755 → 100644
Empty file.
Empty file modified Data/WeatherForecastService.cs 100755 → 100644
Empty file.
Empty file modified Pages/Counter.razor 100755 → 100644
Empty file.
Empty file modified Pages/Error.razor 100755 → 100644
Empty file.
Empty file modified Pages/FetchData.razor 100755 → 100644
Empty file.
Empty file modified Pages/Index.razor 100755 → 100644
Empty file.
6 changes: 4 additions & 2 deletions Pages/WebViewer.razor 100755 → 100644
Expand Up @@ -5,8 +5,10 @@
<div id='viewer' style='width: 1024px; height: 600px; margin: 0 auto;'></div>

@code {
protected override async void OnAfterRender()
protected override async void OnAfterRender(bool firstRender)
{
await JSRuntime.InvokeAsync<object>("webviewerFunctions.initWebViewer");
if (firstRender) {
await JSRuntime.InvokeAsync<object>("webviewerFunctions.initWebViewer");
}
}
}
5 changes: 2 additions & 3 deletions Pages/_Host.cshtml 100755 → 100644
Expand Up @@ -11,12 +11,11 @@
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<script src="WebViewer/lib/webviewer.min.js"></script>
<script src="lib/webviewer.min.js"></script>
</head>
<body>
<app>
@* Remove the following line of code to disable prerendering *@
@(await Html.RenderStaticComponentAsync<App>())
@(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
</app>

<script src="_framework/blazor.server.js"></script>
Expand Down
1 change: 0 additions & 1 deletion Pages/_Imports.razor

This file was deleted.

Empty file modified Program.cs 100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions Properties/launchSettings.json 100755 → 100644
Expand Up @@ -3,8 +3,8 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:42054",
"sslPort": 44365
"applicationUrl": "http://localhost:4702",
"sslPort": 44344
}
},
"profiles": {
Expand Down
Empty file modified Shared/MainLayout.razor 100755 → 100644
Empty file.
28 changes: 9 additions & 19 deletions Startup.cs 100755 → 100644
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -11,7 +10,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using BlazorWebViewerServer.Data;
using Microsoft.AspNetCore.ResponseCompression;
using System.IO;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.FileProviders;

Expand Down Expand Up @@ -49,37 +48,28 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseHsts();
}

app.UseHttpsRedirection();

app.UseRouting();

app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub<App>(selector: "app");
endpoints.MapFallbackToPage("/_Host");
});

var provider = new FileExtensionContentTypeProvider();
// Add new MIME type mappings
provider.Mappings[".res"] = "application/octet-stream";
provider.Mappings[".pexe"] = "application/x-pnacl";
provider.Mappings[".nmf"] = "application/octet-stream";
provider.Mappings[".mem"] = "application/octet-stream";
provider.Mappings[".wasm"] = "application/wasm";

app.UseStaticFiles();

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),
ContentTypeProvider = provider
});

app.UseDirectoryBrowser(new DirectoryBrowserOptions
app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseEndpoints(endpoints =>
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"))
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions _Imports.razor 100755 → 100644
@@ -1,7 +1,9 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using BlazorWebViewerServer
@using BlazorWebViewerServer.Shared
Empty file modified appsettings.Development.json 100755 → 100644
Empty file.
Empty file modified appsettings.json 100755 → 100644
Empty file.
3 changes: 0 additions & 3 deletions wwwroot/WebViewer/lib/ui/src/constants/defaultTool.js

This file was deleted.

Empty file modified wwwroot/css/bootstrap/bootstrap.min.css 100755 → 100644
Empty file.
Empty file modified wwwroot/css/bootstrap/bootstrap.min.css.map 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/FONT-LICENSE 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/ICON-LICENSE 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/README.md 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/font/fonts/open-iconic.eot 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/font/fonts/open-iconic.otf 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/font/fonts/open-iconic.svg 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified wwwroot/css/open-iconic/font/fonts/open-iconic.ttf 100755 → 100644
Empty file.
Empty file modified wwwroot/css/open-iconic/font/fonts/open-iconic.woff 100755 → 100644
Empty file.
Empty file modified wwwroot/css/site.css 100755 → 100644
Empty file.
Empty file modified wwwroot/favicon.ico 100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions wwwroot/js/webviewerScripts.js 100755 → 100644
Expand Up @@ -2,10 +2,10 @@ window.webviewerFunctions = {
initWebViewer: function () {
const viewerElement = document.getElementById('viewer');
WebViewer({
path: 'WebViewer/lib',
path: 'lib',
initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf', // replace with your own PDF file
}, viewerElement).then((instance) => {
// call apis here
})
}
};
};
52 changes: 26 additions & 26 deletions wwwroot/WebViewer/lib/core/.htaccess → wwwroot/lib/core/.htaccess 100755 → 100644
@@ -1,27 +1,27 @@
AddType image/vnd.microsoft.icon .cur
AddType application/json .json
AddType text/cache-manifest .appcache
AddType application/octet-stream .mem
AddType application/octet-stream .res
AddType application/x-pnacl .pexe
AddType application/octet-stream .nmf
AddType application/wasm .wasm

<IfModule mod_headers.c>
<FilesMatch ".*\.(gz)\..*">
# Serve correct encoding type.
# We make the assumption that gzip is always supported.
Header set Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped files separately.
Header set Vary Accept-Encoding
</FilesMatch>

<FilesMatch ".*\.(br)\..*">
# Serve correct encoding type.
# Note that we only serve the brotli file with Content-Encoding: br if the client told us it supports it.
SetEnvIf Accept-Encoding ".*br.*" SUPPORT_BROTLI
Header set Content-Encoding br env=SUPPORT_BROTLI
# Force proxies to cache brotli encoded & non-brotli encoded files separately.
Header set Vary Accept-Encoding
</FilesMatch>
AddType image/vnd.microsoft.icon .cur
AddType application/json .json
AddType text/cache-manifest .appcache
AddType application/octet-stream .mem
AddType application/octet-stream .res
AddType application/x-pnacl .pexe
AddType application/octet-stream .nmf
AddType application/wasm .wasm

<IfModule mod_headers.c>
<FilesMatch ".*\.(gz)\..*">
# Serve correct encoding type.
# We make the assumption that gzip is always supported.
Header set Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped files separately.
Header set Vary Accept-Encoding
</FilesMatch>

<FilesMatch ".*\.(br)\..*">
# Serve correct encoding type.
# Note that we only serve the brotli file with Content-Encoding: br if the client told us it supports it.
SetEnvIf Accept-Encoding ".*br.*" SUPPORT_BROTLI
Header set Content-Encoding br env=SUPPORT_BROTLI
# Force proxies to cache brotli encoded & non-brotli encoded files separately.
Header set Vary Accept-Encoding
</FilesMatch>
</IfModule>
38 changes: 19 additions & 19 deletions wwwroot/WebViewer/lib/core/CORSWorker.js → wwwroot/lib/core/CORSWorker.js 100755 → 100644
@@ -1,20 +1,20 @@
/* eslint-env worker */
function getWorkerParams(src) {
var params = {};
var search = decodeURIComponent(src.slice(1));
var definitions = search.split('&');
definitions.forEach(function(val) {
var parts = val.split('=', 2);
params[parts[0]] = parts[1];
});
return params;
}

var params = getWorkerParams(self.location.hash);
if (params.path) {
self.workerBasePath = params.path;
self.pdfWorkerPath = params.path + 'pdf/';
self.officeWorkerPath = params.path + 'office/';
}

/* eslint-env worker */
function getWorkerParams(src) {
var params = {};
var search = decodeURIComponent(src.slice(1));
var definitions = search.split('&');
definitions.forEach(function(val) {
var parts = val.split('=', 2);
params[parts[0]] = parts[1];
});
return params;
}

var params = getWorkerParams(self.location.hash);
if (params.path) {
self.workerBasePath = params.path;
self.pdfWorkerPath = params.path + 'pdf/';
self.officeWorkerPath = params.path + 'office/';
}

importScripts(params.file);

0 comments on commit 42a01ef

Please sign in to comment.