mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 03:32:20 +08:00
CLI: Add file browser toggle
This commit is contained in:
parent
4d0e52c87d
commit
ca0d206500
|
@ -41,6 +41,7 @@ namespace BililiveRecorder.Cli
|
|||
new Option<string?>(new []{ "--http-bind", "--bind", "-b" }, () => null, "Bind address for http service"),
|
||||
new Option<string?>(new []{ "--http-basic-user" }, () => null, "Web interface username"),
|
||||
new Option<string?>(new []{ "--http-basic-pass" }, () => null, "Web interface password"),
|
||||
new Option<bool>(new []{ "--enable-file-browser" }, () => true, "Enable file browser located at '/file'"),
|
||||
new Option<LogEventLevel>(new []{ "--loglevel", "--log", "-l" }, () => LogEventLevel.Information, "Minimal log level output to console"),
|
||||
new Option<LogEventLevel>(new []{ "--logfilelevel", "--flog" }, () => LogEventLevel.Debug, "Minimal log level output to file"),
|
||||
new Option<string?>(new []{ "--cert-pem-path", "--pem" }, "Path of the certificate pem file"),
|
||||
|
@ -58,6 +59,7 @@ namespace BililiveRecorder.Cli
|
|||
new Option<string?>(new []{ "--http-bind", "--bind", "-b" }, () => null, "Bind address for http service"),
|
||||
new Option<string?>(new []{ "--http-basic-user" }, () => null, "Web interface username"),
|
||||
new Option<string?>(new []{ "--http-basic-pass" }, () => null, "Web interface password"),
|
||||
new Option<bool>(new []{ "--enable-file-browser" }, () => true, "Enable file browser located at '/file'"),
|
||||
new Option<LogEventLevel>(new []{ "--loglevel", "--log", "-l" }, () => LogEventLevel.Information, "Minimal log level output to console"),
|
||||
new Option<LogEventLevel>(new []{ "--logfilelevel", "--flog" }, () => LogEventLevel.Debug, "Minimal log level output to file"),
|
||||
new Option<string?>(new []{ "--cert-pem-path", "--pem" }, "Path of the certificate pem file"),
|
||||
|
@ -173,6 +175,8 @@ namespace BililiveRecorder.Cli
|
|||
{
|
||||
services.AddSingleton(recorderAccessProxy);
|
||||
|
||||
services.AddSingleton(new BililiveRecorderFileExplorerSettings(sharedArguments.EnableFileBrowser));
|
||||
|
||||
if (sharedArguments.HttpBasicUser is not null || sharedArguments.HttpBasicPass is not null)
|
||||
{
|
||||
services.AddSingleton(new BasicAuthCredential(sharedArguments.HttpBasicUser ?? string.Empty, sharedArguments.HttpBasicPass ?? string.Empty));
|
||||
|
@ -430,6 +434,8 @@ namespace BililiveRecorder.Cli
|
|||
|
||||
public string? HttpBasicPass { get; set; } = null;
|
||||
|
||||
public bool EnableFileBrowser { get; set; }
|
||||
|
||||
public string? CertPemPath { get; set; } = null;
|
||||
|
||||
public string? CertKeyPath { get; set; } = null;
|
||||
|
|
12
BililiveRecorder.Web/BililiveRecorderFileExplorerSettings.cs
Normal file
12
BililiveRecorder.Web/BililiveRecorderFileExplorerSettings.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace BililiveRecorder.Web
|
||||
{
|
||||
public class BililiveRecorderFileExplorerSettings
|
||||
{
|
||||
public BililiveRecorderFileExplorerSettings(bool enable)
|
||||
{
|
||||
this.Enable = enable;
|
||||
}
|
||||
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
}
|
|
@ -202,6 +202,8 @@ namespace BililiveRecorder.Web
|
|||
;
|
||||
|
||||
try
|
||||
{
|
||||
if (app.ApplicationServices.GetService<BililiveRecorderFileExplorerSettings>()?.Enable ?? false)
|
||||
{
|
||||
var sharedRecordingFiles = new SharedOptions
|
||||
{
|
||||
|
@ -211,6 +213,7 @@ namespace BililiveRecorder.Web
|
|||
};
|
||||
app.UseStaticFiles(new StaticFileOptions(sharedRecordingFiles)).UseDirectoryBrowser(new DirectoryBrowserOptions(sharedRecordingFiles));
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
app
|
||||
|
|
|
@ -98,6 +98,12 @@
|
|||
<p class="path">/ui</p>
|
||||
</div>
|
||||
</a>
|
||||
<a href="/file">
|
||||
<div class="card">
|
||||
<p class="name">录播文件浏览器</p>
|
||||
<p class="path">/file</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="group">
|
||||
<h2>REST API</h2>
|
||||
|
|
Loading…
Reference in New Issue
Block a user