forked from sim0n00ps/OF-DL
Fix docker builds
This commit is contained in:
parent
487de58274
commit
85c9bc1f57
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -3,6 +3,11 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
* text=auto
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Shell scripts should use LF line endings (avoid /bin/sh^M issues in containers)
|
||||||
|
###############################################################################
|
||||||
|
*.sh text eol=lf
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Set default behavior for command prompt diff.
|
# Set default behavior for command prompt diff.
|
||||||
#
|
#
|
||||||
|
|||||||
@ -8,11 +8,12 @@ RUN apk --no-cache --repository community add \
|
|||||||
# Copy source code
|
# Copy source code
|
||||||
COPY ["OF DL.sln", "/src/OF DL.sln"]
|
COPY ["OF DL.sln", "/src/OF DL.sln"]
|
||||||
COPY ["OF DL", "/src/OF DL"]
|
COPY ["OF DL", "/src/OF DL"]
|
||||||
|
COPY ["OF DL.Core", "/src/OF DL.Core"]
|
||||||
|
|
||||||
WORKDIR "/src"
|
WORKDIR "/src"
|
||||||
|
|
||||||
# Build release
|
# Build release
|
||||||
RUN dotnet publish -p:WarningLevel=0 -p:Version=$VERSION -c Release --self-contained true -p:PublishSingleFile=true -o out
|
RUN dotnet publish "OF DL/OF DL.csproj" -p:WarningLevel=0 -p:Version=$VERSION -c Release -o out
|
||||||
|
|
||||||
# Generate default config.conf files
|
# Generate default config.conf files
|
||||||
RUN /src/out/OF\ DL --non-interactive || true && \
|
RUN /src/out/OF\ DL --non-interactive || true && \
|
||||||
|
|||||||
@ -20,6 +20,21 @@ public class ConfigService(ILoggingService loggingService) : IConfigService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
IsCliNonInteractive = false;
|
IsCliNonInteractive = false;
|
||||||
|
if (args.Length > 0)
|
||||||
|
{
|
||||||
|
const string nonInteractiveArg = "--non-interactive";
|
||||||
|
if (args.Any(a => a.Equals(nonInteractiveArg, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
IsCliNonInteractive = true;
|
||||||
|
Log.Debug("NonInteractiveMode set via command line");
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Debug("Additional arguments:");
|
||||||
|
foreach (string argument in args)
|
||||||
|
{
|
||||||
|
Log.Debug(argument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Migrate from config.json to config.conf if needed
|
// Migrate from config.json to config.conf if needed
|
||||||
await MigrateFromJsonToConfAsync();
|
await MigrateFromJsonToConfAsync();
|
||||||
@ -43,21 +58,10 @@ public class ConfigService(ILoggingService loggingService) : IConfigService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for command-line arguments
|
if (IsCliNonInteractive && !CurrentConfig.NonInteractiveMode)
|
||||||
if (args.Length > 0)
|
|
||||||
{
|
{
|
||||||
const string NON_INTERACTIVE_ARG = "--non-interactive";
|
CurrentConfig.NonInteractiveMode = true;
|
||||||
if (args.Any(a => a.Equals(NON_INTERACTIVE_ARG, StringComparison.OrdinalIgnoreCase)))
|
Log.Debug("NonInteractiveMode overridden to true via command line");
|
||||||
{
|
|
||||||
IsCliNonInteractive = true;
|
|
||||||
Log.Debug("NonInteractiveMode set via command line");
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Debug("Additional arguments:");
|
|
||||||
foreach (string argument in args)
|
|
||||||
{
|
|
||||||
Log.Debug(argument);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -94,9 +94,9 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
if (!await configService.LoadConfigurationAsync(args))
|
if (!await configService.LoadConfigurationAsync(args))
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine("\n[red]config.conf is not valid, check your syntax![/]\n");
|
AnsiConsole.MarkupLine("\n[red]config.conf is not valid, check your syntax![/]\n");
|
||||||
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
|
||||||
if (!configService.IsCliNonInteractive)
|
if (!configService.IsCliNonInteractive)
|
||||||
{
|
{
|
||||||
|
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,10 +146,9 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
Console.Write(
|
Console.Write(
|
||||||
"OF-DL requires Windows 10 or higher when being run on Windows. Your reported version is: {0}\n\n",
|
"OF-DL requires Windows 10 or higher when being run on Windows. Your reported version is: {0}\n\n",
|
||||||
startupResult.OsVersionString);
|
startupResult.OsVersionString);
|
||||||
Console.Write("Press any key to continue.\n");
|
|
||||||
|
|
||||||
if (!configService.CurrentConfig.NonInteractiveMode)
|
if (!configService.CurrentConfig.NonInteractiveMode)
|
||||||
{
|
{
|
||||||
|
Console.Write("Press any key to continue.\n");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,12 +157,17 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
|
|
||||||
if (!startupResult.FfmpegFound)
|
if (!startupResult.FfmpegFound)
|
||||||
{
|
{
|
||||||
AnsiConsole.Markup(
|
|
||||||
"[red]Cannot locate FFmpeg; please modify config.conf with the correct path. Press any key to exit.[/]");
|
|
||||||
if (!configService.CurrentConfig.NonInteractiveMode)
|
if (!configService.CurrentConfig.NonInteractiveMode)
|
||||||
{
|
{
|
||||||
|
AnsiConsole.Markup(
|
||||||
|
"[red]Cannot locate FFmpeg; please modify config.conf with the correct path. Press any key to exit.[/]");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AnsiConsole.Markup(
|
||||||
|
"[red]Cannot locate FFmpeg; please modify config.conf with the correct path.[/]");
|
||||||
|
}
|
||||||
|
|
||||||
Environment.Exit(4);
|
Environment.Exit(4);
|
||||||
}
|
}
|
||||||
@ -210,7 +214,11 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
AnsiConsole.MarkupLine(
|
AnsiConsole.MarkupLine(
|
||||||
"\n[red]Auth failed. Please try again or use other authentication methods detailed here:[/]\n");
|
"\n[red]Auth failed. Please try again or use other authentication methods detailed here:[/]\n");
|
||||||
AnsiConsole.MarkupLine("[link]https://docs.ofdl.tools/config/auth[/]\n");
|
AnsiConsole.MarkupLine("[link]https://docs.ofdl.tools/config/auth[/]\n");
|
||||||
Console.ReadKey();
|
if (!configService.CurrentConfig.NonInteractiveMode)
|
||||||
|
{
|
||||||
|
Console.WriteLine("\nPress any key to exit.");
|
||||||
|
Console.ReadKey();
|
||||||
|
}
|
||||||
Environment.Exit(2);
|
Environment.Exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,9 +242,9 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
ex.InnerException.StackTrace);
|
ex.InnerException.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("\nPress any key to exit.");
|
|
||||||
if (!configService.CurrentConfig.NonInteractiveMode)
|
if (!configService.CurrentConfig.NonInteractiveMode)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("\nPress any key to exit.");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,9 +745,6 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
AnsiConsole.MarkupLine(
|
AnsiConsole.MarkupLine(
|
||||||
"[red]You may also want to try using the browser extension which is documented here:[/]\n");
|
"[red]You may also want to try using the browser extension which is documented here:[/]\n");
|
||||||
AnsiConsole.MarkupLine("[link]https://docs.ofdl.tools/config/auth/#legacy-methods[/]");
|
AnsiConsole.MarkupLine("[link]https://docs.ofdl.tools/config/auth/#legacy-methods[/]");
|
||||||
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
|
||||||
|
|
||||||
Console.ReadKey();
|
|
||||||
Environment.Exit(2);
|
Environment.Exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,14 +754,14 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowAuthMissingError();
|
ShowAuthMissingError(configService.CurrentConfig.NonInteractiveMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (configService.CurrentConfig.NonInteractiveMode)
|
if (configService.CurrentConfig.NonInteractiveMode)
|
||||||
{
|
{
|
||||||
ShowAuthMissingError();
|
ShowAuthMissingError(configService.CurrentConfig.NonInteractiveMode);
|
||||||
}
|
}
|
||||||
else if (!configService.CurrentConfig.DisableBrowserAuth)
|
else if (!configService.CurrentConfig.DisableBrowserAuth)
|
||||||
{
|
{
|
||||||
@ -764,21 +769,24 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowAuthMissingError();
|
ShowAuthMissingError(configService.CurrentConfig.NonInteractiveMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ShowAuthMissingError()
|
private static void ShowAuthMissingError(bool nonInteractiveMode)
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine(
|
AnsiConsole.MarkupLine(
|
||||||
"\n[red]auth.json is missing. The file can be generated automatically when OF-DL is run in the standard, interactive mode.[/]\n");
|
"\n[red]auth.json is missing. The file can be generated automatically when OF-DL is run in the standard, interactive mode.[/]\n");
|
||||||
AnsiConsole.MarkupLine(
|
AnsiConsole.MarkupLine(
|
||||||
"[red]You may also want to try using the browser extension which is documented here:[/]\n");
|
"[red]You may also want to try using the browser extension which is documented here:[/]\n");
|
||||||
AnsiConsole.MarkupLine("[link]https://docs.ofdl.tools/config/auth/#legacy-methods[/]");
|
AnsiConsole.MarkupLine("[link]https://docs.ofdl.tools/config/auth/#legacy-methods[/]");
|
||||||
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
|
||||||
|
|
||||||
Console.ReadKey();
|
if (!nonInteractiveMode)
|
||||||
|
{
|
||||||
|
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
||||||
|
Console.ReadKey();
|
||||||
|
}
|
||||||
Environment.Exit(2);
|
Environment.Exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -881,11 +889,11 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine("\n[red]rules.json is not valid, check your JSON syntax![/]\n");
|
AnsiConsole.MarkupLine("\n[red]rules.json is not valid, check your JSON syntax![/]\n");
|
||||||
AnsiConsole.MarkupLine("[red]Please ensure you are using the latest version of the software.[/]\n");
|
AnsiConsole.MarkupLine("[red]Please ensure you are using the latest version of the software.[/]\n");
|
||||||
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
|
||||||
Log.Error("rules.json processing failed: {Error}", result.RulesJsonError);
|
Log.Error("rules.json processing failed: {Error}", result.RulesJsonError);
|
||||||
|
|
||||||
if (!configService.CurrentConfig.NonInteractiveMode)
|
if (!configService.CurrentConfig.NonInteractiveMode)
|
||||||
{
|
{
|
||||||
|
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user