mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Merge pull request #272 from BinaryAlley/bugfix/remove-hardcoded-signalr-url
Removes the hardcoded SignalR URL from the web client
This commit is contained in:
1 file changed
+6
-1
@@ -2,9 +2,11 @@
|
|||||||
/library/manage
|
/library/manage
|
||||||
*@
|
*@
|
||||||
|
|
||||||
|
@using Lumina.Presentation.Web.Common.DTO.Configuration
|
||||||
@using Lumina.Presentation.Web.Common.DTO.Libraries
|
@using Lumina.Presentation.Web.Common.DTO.Libraries
|
||||||
@using Lumina.Presentation.Web.Common.Services
|
@using Lumina.Presentation.Web.Common.Services
|
||||||
@using Microsoft.AspNetCore.Mvc.Localization
|
@using Microsoft.AspNetCore.Mvc.Localization
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
@using System.Collections.Generic
|
@using System.Collections.Generic
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@using System.Text.Json
|
@using System.Text.Json
|
||||||
@@ -13,10 +15,13 @@
|
|||||||
@{
|
@{
|
||||||
// Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler.
|
// Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler.
|
||||||
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
|
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
|
||||||
|
var serverConfiguration = _serverConfigurationOptions.Value;
|
||||||
|
string scanProgressHubUrl = $"{serverConfiguration.BaseAddress}:{serverConfiguration.Port}/scanProgressHub";
|
||||||
}
|
}
|
||||||
|
|
||||||
@inject IUrlService _urlService
|
@inject IUrlService _urlService
|
||||||
@inject IViewLocalizer _localizer
|
@inject IViewLocalizer _localizer
|
||||||
|
@inject IOptionsSnapshot<ServerConfigurationDto> _serverConfigurationOptions
|
||||||
|
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
|
|
||||||
@@ -258,7 +263,7 @@
|
|||||||
// SignalR.
|
// SignalR.
|
||||||
const accessTokenUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.GET_API_ACCESS_TOKEN)';
|
const accessTokenUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.GET_API_ACCESS_TOKEN)';
|
||||||
const signalRConnection = new signalR.HubConnectionBuilder()
|
const signalRConnection = new signalR.HubConnectionBuilder()
|
||||||
.withUrl('http://localhost:5214/scanProgressHub', {
|
.withUrl('@scanProgressHubUrl', {
|
||||||
accessTokenFactory: async () => {
|
accessTokenFactory: async () => {
|
||||||
const tokenResponse = await callApiGetAsync(accessTokenUrl);
|
const tokenResponse = await callApiGetAsync(accessTokenUrl);
|
||||||
return tokenResponse ? tokenResponse.token : null;
|
return tokenResponse ? tokenResponse.token : null;
|
||||||
|
|||||||
Reference in new issue
Block a user