Compare commits
No commits in common. "76342553ad9a48417ed760e7641580bda82a5b52" and "6e8495374082ecb87a4e4071553f2af97a4dd0d6" have entirely different histories.
76342553ad
...
6e84953740
|
@ -18,6 +18,7 @@
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"echarts": "^5.6.0",
|
"echarts": "^5.6.0",
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
|
"konva": "^9.3.20",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"log-symbols": "^7.0.0",
|
"log-symbols": "^7.0.0",
|
||||||
"lucide-vue-next": "^0.525.0",
|
"lucide-vue-next": "^0.525.0",
|
||||||
|
@ -3737,8 +3738,7 @@
|
||||||
"url": "https://github.com/sponsors/lavrton"
|
"url": "https://github.com/sponsors/lavrton"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/lightningcss": {
|
"node_modules/lightningcss": {
|
||||||
"version": "1.29.2",
|
"version": "1.29.2",
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"echarts": "^5.6.0",
|
"echarts": "^5.6.0",
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
|
"konva": "^9.3.20",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"log-symbols": "^7.0.0",
|
"log-symbols": "^7.0.0",
|
||||||
"lucide-vue-next": "^0.525.0",
|
"lucide-vue-next": "^0.525.0",
|
||||||
|
|
|
@ -64,37 +64,6 @@ try
|
||||||
};
|
};
|
||||||
options.Authority = $"http://{Global.LocalHost}:5000";
|
options.Authority = $"http://{Global.LocalHost}:5000";
|
||||||
options.RequireHttpsMetadata = false;
|
options.RequireHttpsMetadata = false;
|
||||||
|
|
||||||
// We have to hook the OnMessageReceived event in order to
|
|
||||||
// allow the JWT authentication handler to read the access
|
|
||||||
// token from the query string when a WebSocket or
|
|
||||||
// Server-Sent Events request comes in.
|
|
||||||
|
|
||||||
// Sending the access token in the query string is required when using WebSockets or ServerSentEvents
|
|
||||||
// due to a limitation in Browser APIs. We restrict it to only calls to the
|
|
||||||
// SignalR hub in this code.
|
|
||||||
// See https://docs.microsoft.com/aspnet/core/signalr/security#access-token-logging
|
|
||||||
// for more information about security considerations when using
|
|
||||||
// the query string to transmit the access token.
|
|
||||||
options.Events = new JwtBearerEvents
|
|
||||||
{
|
|
||||||
OnMessageReceived = context =>
|
|
||||||
{
|
|
||||||
var accessToken = context.Request.Query["access_token"];
|
|
||||||
|
|
||||||
// If the request is for our hub...
|
|
||||||
var path = context.HttpContext.Request.Path;
|
|
||||||
if (!string.IsNullOrEmpty(accessToken) && (
|
|
||||||
path.StartsWithSegments("/hubs/JtagHub") ||
|
|
||||||
path.StartsWithSegments("/hubs/ProgressHub")
|
|
||||||
))
|
|
||||||
{
|
|
||||||
// Read the token out of the query string
|
|
||||||
context.Token = accessToken;
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
// Add JWT Token Authorization Policy
|
// Add JWT Token Authorization Policy
|
||||||
builder.Services.AddAuthorization(options =>
|
builder.Services.AddAuthorization(options =>
|
||||||
|
|
|
@ -11,7 +11,6 @@ using server.Services;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[EnableCors("Users")]
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class VideoStreamController : ControllerBase
|
public class VideoStreamController : ControllerBase
|
||||||
{
|
{
|
||||||
|
@ -65,6 +64,7 @@ public class VideoStreamController : ControllerBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>服务状态信息</returns>
|
/// <returns>服务状态信息</returns>
|
||||||
[HttpGet("ServiceStatus")]
|
[HttpGet("ServiceStatus")]
|
||||||
|
[EnableCors("Users")]
|
||||||
[ProducesResponseType(typeof(VideoStreamServiceStatus), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(VideoStreamServiceStatus), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||||
public IResult GetServiceStatus()
|
public IResult GetServiceStatus()
|
||||||
|
@ -85,6 +85,7 @@ public class VideoStreamController : ControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("MyEndpoint")]
|
[HttpGet("MyEndpoint")]
|
||||||
|
[EnableCors("Users")]
|
||||||
[ProducesResponseType(typeof(VideoStreamEndpoint), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(VideoStreamEndpoint), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||||
public IResult MyEndpoint()
|
public IResult MyEndpoint()
|
||||||
|
@ -108,6 +109,7 @@ public class VideoStreamController : ControllerBase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>连接测试结果</returns>
|
/// <returns>连接测试结果</returns>
|
||||||
[HttpPost("TestConnection")]
|
[HttpPost("TestConnection")]
|
||||||
|
[EnableCors("Users")]
|
||||||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
|
||||||
public async Task<IResult> TestConnection()
|
public async Task<IResult> TestConnection()
|
||||||
|
@ -141,8 +143,6 @@ public class VideoStreamController : ControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("SetVideoStreamEnable")]
|
[HttpPost("SetVideoStreamEnable")]
|
||||||
[ProducesResponseType(typeof(object), StatusCodes.Status200OK)]
|
|
||||||
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
|
|
||||||
public async Task<IActionResult> SetVideoStreamEnable(bool enable)
|
public async Task<IActionResult> SetVideoStreamEnable(bool enable)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -212,18 +212,30 @@ export class AuthManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createAuthenticatedJtagHubConnection() {
|
public static createAuthenticatedJtagHubConnection() {
|
||||||
|
const token = this.getToken();
|
||||||
|
if (isNull(token)) {
|
||||||
|
router.push("/login");
|
||||||
|
throw Error("Token Null!");
|
||||||
|
}
|
||||||
|
|
||||||
return new HubConnectionBuilder()
|
return new HubConnectionBuilder()
|
||||||
.withUrl("http://127.0.0.1:5000/hubs/JtagHub", {
|
.withUrl("http://127.0.0.1:5000/hubs/JtagHub", {
|
||||||
accessTokenFactory: () => this.getToken() ?? "",
|
accessTokenFactory: () => token,
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect()
|
.withAutomaticReconnect()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createAuthenticatedProgressHubConnection() {
|
public static createAuthenticatedProgressHubConnection() {
|
||||||
|
const token = this.getToken();
|
||||||
|
if (isNull(token)) {
|
||||||
|
router.push("/login");
|
||||||
|
throw Error("Token Null!");
|
||||||
|
}
|
||||||
|
|
||||||
return new HubConnectionBuilder()
|
return new HubConnectionBuilder()
|
||||||
.withUrl("http://127.0.0.1:5000/hubs/ProgressHub", {
|
.withUrl("http://127.0.0.1:5000/hubs/ProgressHub", {
|
||||||
accessTokenFactory: () => this.getToken() ?? "",
|
accessTokenFactory: () => token,
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect()
|
.withAutomaticReconnect()
|
||||||
.build();
|
.build();
|
||||||
|
|
Loading…
Reference in New Issue