Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Jul 30, 2024
1 parent 70f6645 commit d81502d
Show file tree
Hide file tree
Showing 34 changed files with 59 additions and 419 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
webAssembly: {
loadBootResource: function (type, name, defaultUri, integrity) {
if (integrity != null && integrity != '')
return `${defaultUri}?assetVer=${integrity}`;
return `${defaultUri}?v=${integrity}`;
return null; // default blazor asset loading mechanism.
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using Bit.BlazorUI.Demo.Server.Services

@inject FileVersionProvider _fileVersionProvider
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider _fileVersionProvider
@inject IHttpContextAccessor _httpContextAccessor;

@code {
[Parameter] public bool AppendVersion { get; set; } = true;
Expand All @@ -11,7 +11,7 @@

protected override void OnInitialized()
{
href = AppendVersion ? _fileVersionProvider.AddFileVersionToPath(Href) : Href;
href = AppendVersion ? _fileVersionProvider.AddFileVersionToPath(_httpContextAccessor.HttpContext!.Request.PathBase, Href) : Href;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using Bit.BlazorUI.Demo.Server.Services

@inject FileVersionProvider _fileVersionProvider
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider _fileVersionProvider
@inject IHttpContextAccessor _httpContextAccessor;

@code {
[Parameter] public bool AppendVersion { get; set; } = true;
Expand All @@ -12,7 +12,7 @@

protected override void OnInitialized()
{
src = (Src is not null && AppendVersion) ? _fileVersionProvider.AddFileVersionToPath(Src) : Src;
src = (Src is not null && AppendVersion) ? _fileVersionProvider.AddFileVersionToPath(_httpContextAccessor.HttpContext!.Request.PathBase, Src) : Src;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public static void AddBlazor(this IServiceCollection services, IConfiguration co
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();

services.AddMemoryCache();
services.TryAddTransient<FileVersionProvider>();
services.AddMvc();

services.AddClientWebServices();
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ self.externalAssets = [
"url": "/"
},
{
"url": "_framework\/blazor.web.js?assetVer=8.0.303"
"url": "_framework\/blazor.web.js?v=8.0.303"
},
{
"url": "https://www.googletagmanager.com/gtag/js?id=G-G1ET5L69QF"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ self.externalAssets = [
"url": "app.css"
},
{
"url": "_framework\/blazor.web.js?assetVer=8.0.303"
"url": "_framework\/blazor.web.js?v=8.0.303"
},
{
"url": "Bit.Bswup.NewDemo.styles.css"
Expand Down
2 changes: 1 addition & 1 deletion src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ function createNewAssetRequest(asset) {
if (asset.url === DEFAULT_URL && self.noPrerenderQuery) {
assetUrl = `${asset.url}?${self.noPrerenderQuery}&v=${asset.hash || self.assetsManifest.version}`;
} else {
assetUrl = `${asset.url}?assetVer=${asset.hash || self.assetsManifest.version}`;
assetUrl = `${asset.url}?v=${asset.hash || self.assetsManifest.version}`;
}
const requestInit: RequestInit = asset.hash && self.enableIntegrityCheck
? { cache: 'no-store', integrity: asset.hash, headers: [['cache-control', 'public, max-age=3153600']] }
Expand Down
2 changes: 1 addition & 1 deletion src/Bup/Bit.Bup/Scripts/bit-bup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ declare const Blazor: any;
if (type === 'manifest') return url; // since this is the file containing the resources list lets the blazor itself handle it
if (type === 'dotnetjs') return url; // blazor itself handles this specific resource and needs to have its url

const resourceUrl = `${url}?assetVer=${integrity}`;
const resourceUrl = `${url}?v=${integrity}`;
const requestInit: RequestInit = options.integrityCheck
? { cache: 'no-store', integrity: integrity, headers: [['cache-control', 'public, max-age=3153600']] }
: { cache: 'no-store', headers: [['cache-control', 'public, max-age=3153600']] };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ self.externalAssets = [
"url": "/"
},
{
url: "_framework/blazor.web.js?assetVer=8.0.303"
url: "_framework/blazor.web.js?v=8.0.303"
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private static void ConfiureMiddlewares(this WebApplication app)

app.UseSwaggerUI(options =>
{
options.InjectJavascript($"/scripts/swagger-utils.js?assetVer={Environment.TickCount64}");
options.InjectJavascript($"/scripts/swagger-utils.js?v={Environment.TickCount64}");
});

app.MapGet("/api/minimal-api-sample/{routeParameter}", (string routeParameter, [FromQuery] string queryStringParameter) => new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
webAssembly: {
loadBootResource: function (type, name, defaultUri, integrity) {
if (integrity != null && integrity != '')
return `${defaultUri}?assetVer=${integrity}`;
return `${defaultUri}?v=${integrity}`;
return null; // default blazor asset loading mechanism.
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using Boilerplate.Server.Web.Services

@inject FileVersionProvider _fileVersionProvider
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider _fileVersionProvider
@inject IHttpContextAccessor _httpContextAccessor;

@code {
[Parameter] public bool AppendVersion { get; set; } = true;
Expand All @@ -11,7 +11,7 @@

protected override void OnInitialized()
{
href = AppendVersion ? _fileVersionProvider.AddFileVersionToPath(Href) : Href;
href = AppendVersion ? _fileVersionProvider.AddFileVersionToPath(_httpContextAccessor.HttpContext!.Request.PathBase, Href) : Href;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using Boilerplate.Server.Web.Services

@inject FileVersionProvider _fileVersionProvider
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider _fileVersionProvider
@inject IHttpContextAccessor _httpContextAccessor;

@code {
[Parameter] public bool AppendVersion { get; set; } = true;
Expand All @@ -12,7 +12,7 @@

protected override void OnInitialized()
{
src = (Src is not null && AppendVersion) ? _fileVersionProvider.AddFileVersionToPath(Src) : Src;
src = (Src is not null && AppendVersion) ? _fileVersionProvider.AddFileVersionToPath(_httpContextAccessor.HttpContext!.Request.PathBase, Src) : Src;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ private static void AddBlazor(WebApplicationBuilder builder)
{
var services = builder.Services;
var configuration = builder.Configuration;
var env = builder.Environment;

services.TryAddTransient<IAuthTokenProvider, ServerSideAuthTokenProvider>();

Expand Down Expand Up @@ -89,8 +88,6 @@ private static void AddBlazor(WebApplicationBuilder builder)
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();

services.AddMemoryCache();
services.TryAddSingleton(env.WebRootFileProvider)
services.TryAddTransient<FileVersionProvider>();
services.AddMvc();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
webAssembly: {
loadBootResource: function (type, name, defaultUri, integrity) {
if (integrity != null && integrity != '')
return `${defaultUri}?assetVer=${integrity}`;
return `${defaultUri}?v=${integrity}`;
return null; // default blazor asset loading mechanism.
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using Bit.Websites.Careers.Server.Services

@inject FileVersionProvider _fileVersionProvider
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider _fileVersionProvider
@inject IHttpContextAccessor _httpContextAccessor;

@code {
[Parameter] public bool AppendVersion { get; set; } = true;
Expand All @@ -11,7 +11,7 @@

protected override void OnInitialized()
{
href = AppendVersion ? _fileVersionProvider.AddFileVersionToPath(Href) : Href;
href = AppendVersion ? _fileVersionProvider.AddFileVersionToPath(_httpContextAccessor.HttpContext!.Request.PathBase, Href) : Href;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using Bit.Websites.Careers.Server.Services

@inject FileVersionProvider _fileVersionProvider
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@inject IFileVersionProvider _fileVersionProvider
@inject IHttpContextAccessor _httpContextAccessor;

@code {
[Parameter] public bool AppendVersion { get; set; } = true;
Expand All @@ -12,7 +12,7 @@

protected override void OnInitialized()
{
src = (Src is not null && AppendVersion) ? _fileVersionProvider.AddFileVersionToPath(Src) : Src;
src = (Src is not null && AppendVersion) ? _fileVersionProvider.AddFileVersionToPath(_httpContextAccessor.HttpContext!.Request.PathBase, Src) : Src;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public static void AddBlazor(this IServiceCollection services, IConfiguration co
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();

services.AddMemoryCache();
services.TryAddTransient<FileVersionProvider>();
services.AddMvc();
}

public static void AddSwaggerGen(this IServiceCollection services)
Expand Down
Loading

0 comments on commit d81502d

Please sign in to comment.