feat: update webui & injected script

This commit is contained in:
genteure 2022-08-27 15:50:38 +08:00
parent ca755d5ec5
commit 7ddd782919
3 changed files with 14 additions and 7 deletions

View File

@ -15,7 +15,13 @@ namespace BililiveRecorder.Web
[ApiExplorerSettings(IgnoreApi = true)]
public sealed class DynamicHtmlController : Controller
{
private static readonly MinifyMarkupFormatter formatter = new MinifyMarkupFormatter
{
ShouldKeepEmptyAttributes = true,
};
private static string? cachedIndexHtml;
private readonly CompositeFileProvider fileProvider;
public DynamicHtmlController(CompositeFileProvider fileProvider)
@ -86,7 +92,7 @@ namespace BililiveRecorder.Web
this.Response.ContentType = "text/html; encoding=utf-8";
using var writer = new StreamWriter(this.Response.Body);
document.ToHtml(writer, new MinifyMarkupFormatter());
document.ToHtml(writer, formatter);
}
}
}

View File

@ -3,22 +3,23 @@
if (currentScript && "string" === typeof currentScript.dataset.href) {
const SERVER_PATH = currentScript.dataset.href;
const baseTag = document.getElementsByTagName('base')[0];
console.log("SERVER_PATH: " + SERVER_PATH);
const pathname = location.pathname;
console.log("location.pathname: " + pathname);
const log = console.log;
log("SERVER_PATH: " + SERVER_PATH);
log("location.pathname: " + pathname);
if (SERVER_PATH.length === 0) {
let BASE = pathname + '/';
baseTag.href = BASE;
console.log("base path: " + BASE);
log("base path: " + BASE);
} else if (pathname.endsWith(SERVER_PATH)) {
var i = pathname.lastIndexOf(SERVER_PATH);
if (i > -1) {
let BASE = pathname.slice(0, i) + '/';
baseTag.href = BASE;
console.log("base path: " + BASE);
log("base path: " + BASE);
}
} else {
console.log('????');
log('????');
}
}
const init = document.getElementById('delayed-init');

@ -1 +1 @@
Subproject commit 517c2a659f26f4fea088036650de502aa7f8621f
Subproject commit 9889bd1bd15ba56952fc6a0aa369da85f1c1d154