From dc5ade88785f220e9518396aa453d26bab5e9a9a Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 00:34:20 +0500 Subject: [PATCH 01/15] feat: `--eula` argument to accept EULA without prompting --- Core/LocalAdmin.cs | 13 ++++++++++++- README.md | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 2acaa63..40ff822 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -44,6 +44,7 @@ public sealed class LocalAdmin : IDisposable private static bool _ignoreNextRestart; private static bool _noTerminalTitle; private static int _restarts = -1, _restartsLimit = 4, _restartsTimeWindow = 480; //480 seconds = 8 minutes + private static bool _autoEula; internal readonly CommandService CommandService = new(); private readonly string _scpslExecutable; @@ -181,7 +182,13 @@ internal async Task Start(string[] args) { await LoadJsonOrTerminate(); - if (DataJson!.EulaAccepted == null) + var isEulaNotAccepted = DataJson!.EulaAccepted == null; + + if (isEulaNotAccepted && _autoEula) + { + DataJson.EulaAccepted = DateTime.UtcNow; + } + else if (isEulaNotAccepted) { ConsoleUtil.WriteLine($"Welcome to LocalAdmin version {VersionString}!", ConsoleColor.Cyan); ConsoleUtil.WriteLine("Before starting please read and accept the SCP:SL EULA.", ConsoleColor.Cyan); @@ -378,6 +385,10 @@ internal async Task Start(string[] args) _noTerminalTitle = true; break; + case "--eula": + _autoEula = true; + break; + case "--": capture = CaptureArgs.ArgsPassthrough; break; diff --git a/README.md b/README.md index 943de2c..ecb4407 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,4 @@ Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` | --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | | --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | +| --eula | | Accepts the End User License Agreement (EULA) without prompting. | \ No newline at end of file From ba8ea76772fbd8396013c35f12ae0268372bd090 Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 01:20:04 +0500 Subject: [PATCH 02/15] fix: change argument check condition. Added check for env variable. --- Core/LocalAdmin.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 40ff822..811cf44 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -44,7 +44,6 @@ public sealed class LocalAdmin : IDisposable private static bool _ignoreNextRestart; private static bool _noTerminalTitle; private static int _restarts = -1, _restartsLimit = 4, _restartsTimeWindow = 480; //480 seconds = 8 minutes - private static bool _autoEula; internal readonly CommandService CommandService = new(); private readonly string _scpslExecutable; @@ -184,7 +183,10 @@ internal async Task Start(string[] args) var isEulaNotAccepted = DataJson!.EulaAccepted == null; - if (isEulaNotAccepted && _autoEula) + var autoEula = Environment.GetEnvironmentVariable("EULA")?.ToUpperInvariant() is "1" or "TRUE" + || args.Contains("--eula"); + + if (isEulaNotAccepted && autoEula) { DataJson.EulaAccepted = DateTime.UtcNow; } @@ -385,10 +387,6 @@ internal async Task Start(string[] args) _noTerminalTitle = true; break; - case "--eula": - _autoEula = true; - break; - case "--": capture = CaptureArgs.ArgsPassthrough; break; From 683837be7b8809e21032fb5083de1b6cb7ead05d Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 02:06:38 +0500 Subject: [PATCH 03/15] docs(readme): env variable notation, hyperlinks to eula --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ecb4407..d4f1e57 100644 --- a/README.md +++ b/README.md @@ -9,25 +9,25 @@ Windows: `LocalAdmin.exe [port] [arguments] [-- arguments passthrough]` Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` # Arguments list -| Long version | Short version | Description | -| --- | --- | --- | -| --reconfigure | -r | Opens configuration editor. | -| --config [path to file] | | Changes LocalAdmin config path. | -| --logs [path to logs folder] | | Changes LocalAdmin logs directory. | -| --gameLogs [path to logs folder] | | Changes game logs directory.
**It applies only to the Log Cleaner in LocalAdmin, not the game itself!** | -| --useDefault | -d | Uses the default config if no config is present. | -| --printStd | -s | Redirects stdout and stderr of the game to the LocalAdmin live view. | -| --noSetCursor | -c | Disables setting console cursor position. | -| --printControl | -p | Enables printing control messages. | -| --noLogs | -l | Disables LocalAdmin logging. | -| --noAutoFlush | -n | Disables auto flush of LocalAdmin log files.
**Not compatible with --noLogs argument.** | -| --noAlign | -a | Disables multiline log entries alignment. | -| --noTerminalTitle | -t | Disables LocalAdmin status in the terminal title. | -| --dismissPluginManagerSecurityWarning | | Dismisses Plugin Manager security warning. | -| --disableTrueColor | | Disables True Color output. | -| --skipHomeCheck | | Skips `home` env var checking on startup (linux only). | -| --restartsLimit | | Specifies a limit of auto-restarts in a specified time window.
Setting this argument to 0 disables auto-restarts.
Setting this argument to -1 disables the limit.
*Default value: 4* | -| --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | +| Long version | Short version | Description | +| --- | --- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --reconfigure | -r | Opens configuration editor. | +| --config [path to file] | | Changes LocalAdmin config path. | +| --logs [path to logs folder] | | Changes LocalAdmin logs directory. | +| --gameLogs [path to logs folder] | | Changes game logs directory.
**It applies only to the Log Cleaner in LocalAdmin, not the game itself!** | +| --useDefault | -d | Uses the default config if no config is present. | +| --printStd | -s | Redirects stdout and stderr of the game to the LocalAdmin live view. | +| --noSetCursor | -c | Disables setting console cursor position. | +| --printControl | -p | Enables printing control messages. | +| --noLogs | -l | Disables LocalAdmin logging. | +| --noAutoFlush | -n | Disables auto flush of LocalAdmin log files.
**Not compatible with --noLogs argument.** | +| --noAlign | -a | Disables multiline log entries alignment. | +| --noTerminalTitle | -t | Disables LocalAdmin status in the terminal title. | +| --dismissPluginManagerSecurityWarning | | Dismisses Plugin Manager security warning. | +| --disableTrueColor | | Disables True Color output. | +| --skipHomeCheck | | Skips `home` env var checking on startup (linux only). | +| --restartsLimit | | Specifies a limit of auto-restarts in a specified time window.
Setting this argument to 0 disables auto-restarts.
Setting this argument to -1 disables the limit.
*Default value: 4* | +| --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | -| --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --eula | | Accepts the End User License Agreement (EULA) without prompting. | \ No newline at end of file +| --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | +| --eula | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file From 035dd2e4d316448d030400674d178e0cc7f108a8 Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 02:17:09 +0500 Subject: [PATCH 04/15] feat: added log for auto-accepted eula --- Core/LocalAdmin.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 811cf44..0a3a0de 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -188,6 +188,7 @@ internal async Task Start(string[] args) if (isEulaNotAccepted && autoEula) { + ConsoleUtil.WriteLine("EULA was auto-accepted due to the provided argument or environment variable", ConsoleColor.Yellow); DataJson.EulaAccepted = DateTime.UtcNow; } else if (isEulaNotAccepted) From 3eb71f6413c6bd174f926d5a5e1e17a22f2ab57e Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 02:23:36 +0500 Subject: [PATCH 05/15] docs(readme): fix formatter bomb --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d4f1e57..4bf1084 100644 --- a/README.md +++ b/README.md @@ -9,25 +9,25 @@ Windows: `LocalAdmin.exe [port] [arguments] [-- arguments passthrough]` Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` # Arguments list -| Long version | Short version | Description | -| --- | --- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| --reconfigure | -r | Opens configuration editor. | -| --config [path to file] | | Changes LocalAdmin config path. | -| --logs [path to logs folder] | | Changes LocalAdmin logs directory. | -| --gameLogs [path to logs folder] | | Changes game logs directory.
**It applies only to the Log Cleaner in LocalAdmin, not the game itself!** | -| --useDefault | -d | Uses the default config if no config is present. | -| --printStd | -s | Redirects stdout and stderr of the game to the LocalAdmin live view. | -| --noSetCursor | -c | Disables setting console cursor position. | -| --printControl | -p | Enables printing control messages. | -| --noLogs | -l | Disables LocalAdmin logging. | -| --noAutoFlush | -n | Disables auto flush of LocalAdmin log files.
**Not compatible with --noLogs argument.** | -| --noAlign | -a | Disables multiline log entries alignment. | -| --noTerminalTitle | -t | Disables LocalAdmin status in the terminal title. | -| --dismissPluginManagerSecurityWarning | | Dismisses Plugin Manager security warning. | -| --disableTrueColor | | Disables True Color output. | -| --skipHomeCheck | | Skips `home` env var checking on startup (linux only). | -| --restartsLimit | | Specifies a limit of auto-restarts in a specified time window.
Setting this argument to 0 disables auto-restarts.
Setting this argument to -1 disables the limit.
*Default value: 4* | -| --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | +| Long version | Short version | Description | +| --- | --- | --- | +| --reconfigure | -r | Opens configuration editor. | +| --config [path to file] | | Changes LocalAdmin config path. | +| --logs [path to logs folder] | | Changes LocalAdmin logs directory. | +| --gameLogs [path to logs folder] | | Changes game logs directory.
**It applies only to the Log Cleaner in LocalAdmin, not the game itself!** | +| --useDefault | -d | Uses the default config if no config is present. | +| --printStd | -s | Redirects stdout and stderr of the game to the LocalAdmin live view. | +| --noSetCursor | -c | Disables setting console cursor position. | +| --printControl | -p | Enables printing control messages. | +| --noLogs | -l | Disables LocalAdmin logging. | +| --noAutoFlush | -n | Disables auto flush of LocalAdmin log files.
**Not compatible with --noLogs argument.** | +| --noAlign | -a | Disables multiline log entries alignment. | +| --noTerminalTitle | -t | Disables LocalAdmin status in the terminal title. | +| --dismissPluginManagerSecurityWarning | | Dismisses Plugin Manager security warning. | +| --disableTrueColor | | Disables True Color output. | +| --skipHomeCheck | | Skips `home` env var checking on startup (linux only). | +| --restartsLimit | | Specifies a limit of auto-restarts in a specified time window.
Setting this argument to 0 disables auto-restarts.
Setting this argument to -1 disables the limit.
*Default value: 4* | +| --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | -| --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --eula | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file +| --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | +| --eula | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file From b93ab914f63441be2113ca1fdd413d505a5a6b7c Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 14:06:39 +0500 Subject: [PATCH 06/15] feat: rename env variable to `SLLA_EULA` --- Core/LocalAdmin.cs | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 0a3a0de..428d5c1 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -183,7 +183,7 @@ internal async Task Start(string[] args) var isEulaNotAccepted = DataJson!.EulaAccepted == null; - var autoEula = Environment.GetEnvironmentVariable("EULA")?.ToUpperInvariant() is "1" or "TRUE" + var autoEula = Environment.GetEnvironmentVariable("SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE" || args.Contains("--eula"); if (isEulaNotAccepted && autoEula) diff --git a/README.md b/README.md index 4bf1084..edd8201 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` | --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | | --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --eula | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file +| --eula | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file From 60672f52a9b711c7cf8418e492d1181f364ac8e4 Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 20:29:46 +0500 Subject: [PATCH 07/15] refactor: Moved if statement. Moved console message. --- Core/LocalAdmin.cs | 91 ++++++++++++++++++++++++---------------------- README.md | 2 +- 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 428d5c1..a1811ed 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -44,6 +44,7 @@ public sealed class LocalAdmin : IDisposable private static bool _ignoreNextRestart; private static bool _noTerminalTitle; private static int _restarts = -1, _restartsLimit = 4, _restartsTimeWindow = 480; //480 seconds = 8 minutes + private static bool _autoEula; internal readonly CommandService CommandService = new(); private readonly string _scpslExecutable; @@ -181,57 +182,56 @@ internal async Task Start(string[] args) { await LoadJsonOrTerminate(); - var isEulaNotAccepted = DataJson!.EulaAccepted == null; - - var autoEula = Environment.GetEnvironmentVariable("SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE" - || args.Contains("--eula"); - - if (isEulaNotAccepted && autoEula) - { - ConsoleUtil.WriteLine("EULA was auto-accepted due to the provided argument or environment variable", ConsoleColor.Yellow); - DataJson.EulaAccepted = DateTime.UtcNow; - } - else if (isEulaNotAccepted) + if (DataJson!.EulaAccepted == null) { - ConsoleUtil.WriteLine($"Welcome to LocalAdmin version {VersionString}!", ConsoleColor.Cyan); - ConsoleUtil.WriteLine("Before starting please read and accept the SCP:SL EULA.", ConsoleColor.Cyan); - ConsoleUtil.WriteLine("You can find it on the following website: https://link.scpslgame.com/eula", ConsoleColor.Cyan); - ConsoleUtil.WriteLine("", ConsoleColor.Cyan); - ConsoleUtil.WriteLine("Do you accept the EULA? [yes/no]", ConsoleColor.Cyan); + if (args.Contains("--acceptEULA", StringComparer.Ordinal) || + Environment.GetEnvironmentVariable("SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE") + { + DataJson!.EulaAccepted = DateTime.UtcNow; + _autoEula = true; + } + else + { - ReadInput((input) => - { - if (input == null) - return false; + ConsoleUtil.WriteLine($"Welcome to LocalAdmin version {VersionString}!", ConsoleColor.Cyan); + ConsoleUtil.WriteLine("Before starting please read and accept the SCP:SL EULA.", ConsoleColor.Cyan); + ConsoleUtil.WriteLine("You can find it on the following website: https://link.scpslgame.com/eula", ConsoleColor.Cyan); + ConsoleUtil.WriteLine("", ConsoleColor.Cyan); + ConsoleUtil.WriteLine("Do you accept the EULA? [yes/no]", ConsoleColor.Cyan); - switch (input.ToLowerInvariant()) + ReadInput((input) => { - case "y": - case "yes": - case "1": - DataJson.EulaAccepted = DateTime.UtcNow; - return true; - - case "n": - case "no": - case "nope": - case "0": - ConsoleUtil.WriteLine("You have to accept the EULA to use LocalAdmin and SCP: Secret Laboratory Dedicated Server.", ConsoleColor.Red); - Terminate(); - return true; - - default: + if (input == null) return false; - } - }, () => { }, - () => - { - ConsoleUtil.WriteLine("Do you accept the EULA? [yes/no]", ConsoleColor.Red); - }); + switch (input.ToLowerInvariant()) + { + case "y": + case "yes": + case "1": + DataJson.EulaAccepted = DateTime.UtcNow; + return true; + + case "n": + case "no": + case "nope": + case "0": + ConsoleUtil.WriteLine( + "You have to accept the EULA to use LocalAdmin and SCP: Secret Laboratory Dedicated Server.", + ConsoleColor.Red); + Terminate(); + return true; + + default: + return false; + } - if (!_exit) - await SaveJsonOrTerminate(); + }, () => { }, + () => { ConsoleUtil.WriteLine("Do you accept the EULA? [yes/no]", ConsoleColor.Red); }); + + if (!_exit) + await SaveJsonOrTerminate(); + } } var reconfigure = false; @@ -545,6 +545,9 @@ internal async Task Start(string[] args) _readerTask!.Start(); + if (_autoEula) + ConsoleUtil.WriteLine("EULA was auto-accepted due to the provided argument or environment variable", ConsoleColor.Yellow); + if (!EnableLogging) ConsoleUtil.WriteLine("Logging has been disabled.", ConsoleColor.Red); else if (!AutoFlush) diff --git a/README.md b/README.md index edd8201..eeda0f5 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` | --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | | --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --eula | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file +| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file From 3c8c71ee3e00c2af3fffeb912c211f46ca8a21b9 Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 20:30:10 +0500 Subject: [PATCH 08/15] refactor: removed empty space --- Core/LocalAdmin.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index a1811ed..0ed1564 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -192,7 +192,6 @@ internal async Task Start(string[] args) } else { - ConsoleUtil.WriteLine($"Welcome to LocalAdmin version {VersionString}!", ConsoleColor.Cyan); ConsoleUtil.WriteLine("Before starting please read and accept the SCP:SL EULA.", ConsoleColor.Cyan); ConsoleUtil.WriteLine("You can find it on the following website: https://link.scpslgame.com/eula", ConsoleColor.Cyan); From 0b25584da74b64d136bc3518f417a357c4b856cd Mon Sep 17 00:00:00 2001 From: FakeMan Date: Mon, 19 Aug 2024 21:57:15 +0500 Subject: [PATCH 09/15] feat: add SaveJsonOrTerminate when using auto eula --- Core/LocalAdmin.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 0ed1564..6b66934 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -189,6 +189,8 @@ internal async Task Start(string[] args) { DataJson!.EulaAccepted = DateTime.UtcNow; _autoEula = true; + + await SaveJsonOrTerminate(); } else { From cc351a78997ef95f53d2fc5242e26ba79b60f716 Mon Sep 17 00:00:00 2001 From: Damir <72656712+fakeman2332@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:58:10 +0500 Subject: [PATCH 10/15] docs(readme): fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Jurczyk --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eeda0f5..592f124 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` | --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | | --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Also, you can set `SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file +| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Alternatively, you can set `SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file From e41ed7b3e07378f18bc5858e1ec2db56de963557 Mon Sep 17 00:00:00 2001 From: Damir <72656712+fakeman2332@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:52:12 +0500 Subject: [PATCH 11/15] feat: changed eula auto-accept log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Jurczyk --- Core/LocalAdmin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 6b66934..4d0ed06 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -547,7 +547,7 @@ internal async Task Start(string[] args) _readerTask!.Start(); if (_autoEula) - ConsoleUtil.WriteLine("EULA was auto-accepted due to the provided argument or environment variable", ConsoleColor.Yellow); + ConsoleUtil.WriteLine("SCP: Secret Laboratory EULA (https://link.scpslgame.com/eula) was accepted by providing a startup argument or setting an environment variable.", ConsoleColor.Yellow); if (!EnableLogging) ConsoleUtil.WriteLine("Logging has been disabled.", ConsoleColor.Red); From c7c17e452195cc449a61285f7196cd9e0e2c5d1f Mon Sep 17 00:00:00 2001 From: FakeMan Date: Tue, 20 Aug 2024 23:56:42 +0500 Subject: [PATCH 12/15] refactor: replaced `_autoEula` to local variable --- Core/LocalAdmin.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 4d0ed06..e5c9d5d 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -44,7 +44,6 @@ public sealed class LocalAdmin : IDisposable private static bool _ignoreNextRestart; private static bool _noTerminalTitle; private static int _restarts = -1, _restartsLimit = 4, _restartsTimeWindow = 480; //480 seconds = 8 minutes - private static bool _autoEula; internal readonly CommandService CommandService = new(); private readonly string _scpslExecutable; @@ -182,13 +181,15 @@ internal async Task Start(string[] args) { await LoadJsonOrTerminate(); + var autoEula = false; + if (DataJson!.EulaAccepted == null) { if (args.Contains("--acceptEULA", StringComparer.Ordinal) || Environment.GetEnvironmentVariable("SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE") { DataJson!.EulaAccepted = DateTime.UtcNow; - _autoEula = true; + autoEula = true; await SaveJsonOrTerminate(); } @@ -546,7 +547,7 @@ internal async Task Start(string[] args) _readerTask!.Start(); - if (_autoEula) + if (autoEula) ConsoleUtil.WriteLine("SCP: Secret Laboratory EULA (https://link.scpslgame.com/eula) was accepted by providing a startup argument or setting an environment variable.", ConsoleColor.Yellow); if (!EnableLogging) From 7486b8499322373348f1f28b965961521a85879b Mon Sep 17 00:00:00 2001 From: FakeMan Date: Wed, 21 Aug 2024 00:47:05 +0500 Subject: [PATCH 13/15] refactor: rename env variable to ACCEPT_SLLA_EULA --- Core/LocalAdmin.cs | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index e5c9d5d..18b6646 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -186,7 +186,7 @@ internal async Task Start(string[] args) if (DataJson!.EulaAccepted == null) { if (args.Contains("--acceptEULA", StringComparer.Ordinal) || - Environment.GetEnvironmentVariable("SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE") + Environment.GetEnvironmentVariable("ACCEPT_SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE") { DataJson!.EulaAccepted = DateTime.UtcNow; autoEula = true; diff --git a/README.md b/README.md index 592f124..9919c41 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` | --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | | --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Alternatively, you can set `SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file +| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Alternatively, you can set `ACCEPT_SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file From 9a7d203fee92d8c03afddb5bae21ee236550344d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jurczyk?= Date: Tue, 20 Aug 2024 21:55:36 +0200 Subject: [PATCH 14/15] Update Core/LocalAdmin.cs --- Core/LocalAdmin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/LocalAdmin.cs b/Core/LocalAdmin.cs index 18b6646..4dee638 100644 --- a/Core/LocalAdmin.cs +++ b/Core/LocalAdmin.cs @@ -186,7 +186,7 @@ internal async Task Start(string[] args) if (DataJson!.EulaAccepted == null) { if (args.Contains("--acceptEULA", StringComparer.Ordinal) || - Environment.GetEnvironmentVariable("ACCEPT_SLLA_EULA")?.ToUpperInvariant() is "1" or "TRUE") + Environment.GetEnvironmentVariable("ACCEPT_SCPSL_EULA")?.ToUpperInvariant() is "1" or "TRUE") { DataJson!.EulaAccepted = DateTime.UtcNow; autoEula = true; From accca52a29f6ef328e1f75c1f5bd6f71cb50fc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jurczyk?= Date: Tue, 20 Aug 2024 21:55:43 +0200 Subject: [PATCH 15/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9919c41..2437e17 100644 --- a/README.md +++ b/README.md @@ -30,4 +30,4 @@ Linux: `./LocalAdmin [port] [arguments] [-- arguments passthrough]` | --restartsTimeWindow | | Specifies a time window (in seconds) for the auto-restarts limit.
Setting this argument to 0 disables resetting the amount of auto-restarts after a specified amount of time.
*Default value: 480* | | --logLengthLimit | | Specifies the limit of characters in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` characters.
Setting this argument to 0 disables the limit.
*Default value: 25G* | | --logEntriesLimit | | Specifies the limit of entries in LocalAdmin log file.
Suffixes `k`, `M`, `G` and `T` are supported, eg. `5G` is equal to `5000000000` entries.
Setting this argument to 0 disables the limit.
*Default value: 10G* | -| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Alternatively, you can set `ACCEPT_SLLA_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file +| --acceptEULA | | Accepts the [End User License Agreement (EULA)](https://link.scpslgame.com/eula) without prompting. Alternatively, you can set `ACCEPT_SCPSL_EULA=TRUE` in environment variables to automatically accept the [EULA](https://link.scpslgame.com/eula). | \ No newline at end of file