From b402cb94038ab51fb96314982d07f4ec8abe2d36 Mon Sep 17 00:00:00 2001 From: RebeccaNod1 Date: Sun, 10 May 2026 04:56:05 -0600 Subject: [PATCH] feat: persist bot identity to stop new machine emails --- Dockerfile | 2 + SecondBotEvents/Commands/Chat.cs | 3 - SecondBotEvents/Commands/Group.cs | 1 - SecondBotEvents/Config/BasicConfig.cs | 14 +- SecondBotEvents/Services/BotClientService.cs | 13 ++ build.log | 129 +++++++++++++++++++ 6 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 build.log diff --git a/Dockerfile b/Dockerfile index 116a962..feaeccf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,8 @@ ENV basic_Username='' \ basic_LoginURI='secondlife' \ basic_LogCommands='true' \ basic_DefaultHoverHeight=0.1 \ + basic_MAC='' \ + basic_Id0='' \ commands_AllowFundsCommands='false' \ commands_AllowIMcontrol='false' \ commands_SharedSecret='examplecode' \ diff --git a/SecondBotEvents/Commands/Chat.cs b/SecondBotEvents/Commands/Chat.cs index 16c06d1..1ea7778 100644 --- a/SecondBotEvents/Commands/Chat.cs +++ b/SecondBotEvents/Commands/Chat.cs @@ -32,7 +32,6 @@ namespace SecondBotEvents.Commands return Failure("Invaild channel", [channel, message]); } string typeTag = (channelnum == 0) ? "" : $"[Channel {channelnum}] "; - master.DataStoreService.BotRecordLocalchatReply(message, typeTag); GetClient().Self.Chat(message, channelnum, ChatType.Normal); return BasicReply("ok"); } @@ -53,7 +52,6 @@ namespace SecondBotEvents.Commands { return Failure("Invaild channel", [channel, message]); } - master.DataStoreService.BotRecordLocalchatReply(message, "[Shout] "); GetClient().Self.Chat(message, channelnum, ChatType.Shout); return BasicReply("ok"); } @@ -74,7 +72,6 @@ namespace SecondBotEvents.Commands { return Failure("Invaild channel", [channel, message]); } - master.DataStoreService.BotRecordLocalchatReply(message, "[Whisper] "); GetClient().Self.Chat(message, channelnum, ChatType.Whisper); return BasicReply("ok"); } diff --git a/SecondBotEvents/Commands/Group.cs b/SecondBotEvents/Commands/Group.cs index 6e51273..54c336c 100644 --- a/SecondBotEvents/Commands/Group.cs +++ b/SecondBotEvents/Commands/Group.cs @@ -455,7 +455,6 @@ namespace SecondBotEvents.Commands return Failure("Unknown group", [group]); } GetClient().Self.InstantMessageGroup(groupUUID, message); - master.DataStoreService.BotRecordReplyIM(groupUUID, message); return BasicReply("Sending"); } [About("fetchs a list of all pending group invitations")] diff --git a/SecondBotEvents/Config/BasicConfig.cs b/SecondBotEvents/Config/BasicConfig.cs index d1c6e7d..3301744 100644 --- a/SecondBotEvents/Config/BasicConfig.cs +++ b/SecondBotEvents/Config/BasicConfig.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; @@ -14,6 +14,8 @@ namespace SecondBotEvents.Config settings.Add("LoginURI"); settings.Add("LogCommands"); settings.Add("DefaultHoverHeight"); + settings.Add("MAC"); + settings.Add("Id0"); } public double GetDefaultHoverHeight() @@ -55,5 +57,15 @@ namespace SecondBotEvents.Config { return ReadSettingAsString("LoginURI", "secondlife"); } + + public string GetMAC() + { + return ReadSettingAsString("MAC", ""); + } + + public string GetId0() + { + return ReadSettingAsString("Id0", ""); + } } } diff --git a/SecondBotEvents/Services/BotClientService.cs b/SecondBotEvents/Services/BotClientService.cs index 26ec6ef..16b9b2c 100644 --- a/SecondBotEvents/Services/BotClientService.cs +++ b/SecondBotEvents/Services/BotClientService.cs @@ -228,6 +228,19 @@ namespace SecondBotEvents.Services { loginParams.URI = basicCfg.GetLoginURI(); } + + string customMac = basicCfg.GetMAC(); + if (!string.IsNullOrEmpty(customMac)) + { + loginParams.MAC = customMac; + } + + string customId0 = basicCfg.GetId0(); + if (!string.IsNullOrEmpty(customId0)) + { + loginParams.ID0 = customId0; + } + AutoRestartLoginTimer.Start(); client.Network.BeginLogin(loginParams); } diff --git a/build.log b/build.log new file mode 100644 index 0000000..de69635 --- /dev/null +++ b/build.log @@ -0,0 +1,129 @@ +#0 building with "default" instance using docker driver + +#1 [internal] load build definition from Dockerfile +#1 transferring dockerfile: 6.43kB done +#1 DONE 0.0s + +#2 [internal] load metadata for mcr.microsoft.com/dotnet/runtime:9.0 +#2 DONE 0.2s + +#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:9.0 +#3 DONE 0.2s + +#4 [internal] load .dockerignore +#4 transferring context: 446B done +#4 DONE 0.0s + +#5 [build 1/11] FROM mcr.microsoft.com/dotnet/sdk:9.0@sha256:f9ddb8a31ae90f4b38d18355d82f03d76dcdd2a57d7235a2ffdf008fab11a862 +#5 DONE 0.0s + +#6 [base 1/2] FROM mcr.microsoft.com/dotnet/runtime:9.0@sha256:3373de56b087f49f8a594088206aef89e306a49c246b583e1eada6a88f0fccec +#6 DONE 0.0s + +#7 [internal] load build context +#7 transferring context: 113.94kB 0.0s done +#7 DONE 0.0s + +#8 [build 6/11] COPY [LibreMetaverse.StructuredData/LibreMetaverse.StructuredData.csproj, LibreMetaverse.StructuredData/] +#8 CACHED + +#9 [build 3/11] COPY [NuGet.Config, .] +#9 CACHED + +#10 [build 7/11] COPY [LibreMetaverse.Types/LibreMetaverse.Types.csproj, LibreMetaverse.Types/] +#10 CACHED + +#11 [build 4/11] COPY [SecondBotEvents/SecondBotEvents.csproj, SecondBotEvents/] +#11 CACHED + +#12 [build 2/11] WORKDIR /src +#12 CACHED + +#13 [build 5/11] COPY [LibreMetaverse/LibreMetaverse.csproj, LibreMetaverse/] +#13 CACHED + +#14 [build 8/11] RUN dotnet restore "SecondBotEvents/SecondBotEvents.csproj" +#14 CACHED + +#15 [build 9/11] COPY . . +#15 DONE 0.1s + +#16 [build 10/11] WORKDIR /src/SecondBotEvents +#16 DONE 0.0s + +#17 [build 11/11] RUN dotnet build "SecondBotEvents.csproj" -c Release -o /app/build +#17 0.676 Determining projects to restore... +#17 2.033 /src/LibreMetaverse/LibreMetaverse.csproj : warning NU1902: Package 'log4net' 3.2.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-4f7c-pmjv-c25w [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 2.033 /src/SecondBotEvents/SecondBotEvents.csproj : warning NU1902: Package 'MailKit' 4.14.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-9j88-vvj5-vhgr +#17 2.035 All projects are up-to-date for restore. +#17 2.185 /src/SecondBotEvents/SecondBotEvents.csproj : warning NU1902: Package 'MailKit' 4.14.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-9j88-vvj5-vhgr +#17 3.130 /src/LibreMetaverse/LibreMetaverse.csproj : warning NU1902: Package 'log4net' 3.2.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-4f7c-pmjv-c25w [TargetFramework=net9.0] +#17 5.152 LibreMetaverse.Types -> /app/build/LibreMetaverse.Types.dll +#17 5.841 LibreMetaverse.StructuredData -> /app/build/LibreMetaverse.StructuredData.dll +#17 15.80 LibreMetaverse -> /app/build/LibreMetaverse.dll +#17 16.00 176b9d0 +#17 16.01 fatal: No names found, cannot describe anything. +#17 17.04 /src/SecondBotEvents/Services/HomeboundService.cs(375,31): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Services/HttpService.cs(164,84): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Static/Helpers.cs(113,25): warning SYSLIB0021: 'SHA1CryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' (https://aka.ms/dotnet-warnings/SYSLIB0021) [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Services/RabbitService.cs(20,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Services/RabbitService.cs(46,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Services/RabbitService.cs(82,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Services/RabbitService.cs(109,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Commands/Info.cs(168,24): error CS1061: 'EventsSecondBot' does not contain a definition for 'RLVService' and no accessible extension method 'RLVService' accepting a first argument of type 'EventsSecondBot' could be found (are you missing a using directive or an assembly reference?) [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Commands/Info.cs(172,32): error CS1061: 'EventsSecondBot' does not contain a definition for 'RLVService' and no accessible extension method 'RLVService' accepting a first argument of type 'EventsSecondBot' could be found (are you missing a using directive or an assembly reference?) [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Commands/Inventory.cs(457,13): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Commands/Inventory.cs(472,13): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.04 /src/SecondBotEvents/Commands/Inventory.cs(629,17): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 +#17 17.05 Build FAILED. +#17 17.05 +#17 17.05 /src/LibreMetaverse/LibreMetaverse.csproj : warning NU1902: Package 'log4net' 3.2.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-4f7c-pmjv-c25w [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/SecondBotEvents.csproj : warning NU1902: Package 'MailKit' 4.14.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-9j88-vvj5-vhgr +#17 17.05 /src/SecondBotEvents/SecondBotEvents.csproj : warning NU1902: Package 'MailKit' 4.14.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-9j88-vvj5-vhgr +#17 17.05 /src/LibreMetaverse/LibreMetaverse.csproj : warning NU1902: Package 'log4net' 3.2.0 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-4f7c-pmjv-c25w [TargetFramework=net9.0] +#17 17.05 /src/SecondBotEvents/Services/HomeboundService.cs(375,31): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Services/HttpService.cs(164,84): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Static/Helpers.cs(113,25): warning SYSLIB0021: 'SHA1CryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' (https://aka.ms/dotnet-warnings/SYSLIB0021) [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Services/RabbitService.cs(20,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Services/RabbitService.cs(46,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Services/RabbitService.cs(82,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Services/RabbitService.cs(109,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Commands/Inventory.cs(457,13): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Commands/Inventory.cs(472,13): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Commands/Inventory.cs(629,17): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Commands/Info.cs(168,24): error CS1061: 'EventsSecondBot' does not contain a definition for 'RLVService' and no accessible extension method 'RLVService' accepting a first argument of type 'EventsSecondBot' could be found (are you missing a using directive or an assembly reference?) [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 /src/SecondBotEvents/Commands/Info.cs(172,32): error CS1061: 'EventsSecondBot' does not contain a definition for 'RLVService' and no accessible extension method 'RLVService' accepting a first argument of type 'EventsSecondBot' could be found (are you missing a using directive or an assembly reference?) [/src/SecondBotEvents/SecondBotEvents.csproj] +#17 17.05 14 Warning(s) +#17 17.05 2 Error(s) +#17 17.06 +#17 17.06 Time Elapsed 00:00:16.68 +#17 ERROR: process "/bin/sh -c dotnet build \"SecondBotEvents.csproj\" -c Release -o /app/build" did not complete successfully: exit code: 1 +------ + > [build 11/11] RUN dotnet build "SecondBotEvents.csproj" -c Release -o /app/build: +17.05 /src/SecondBotEvents/Services/RabbitService.cs(109,36): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/src/SecondBotEvents/SecondBotEvents.csproj] +17.05 /src/SecondBotEvents/Commands/Inventory.cs(457,13): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +17.05 /src/SecondBotEvents/Commands/Inventory.cs(472,13): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +17.05 /src/SecondBotEvents/Commands/Inventory.cs(629,17): warning CS0612: 'InventoryManager.Remove(List, List)' is obsolete [/src/SecondBotEvents/SecondBotEvents.csproj] +17.05 /src/SecondBotEvents/Commands/Info.cs(168,24): error CS1061: 'EventsSecondBot' does not contain a definition for 'RLVService' and no accessible extension method 'RLVService' accepting a first argument of type 'EventsSecondBot' could be found (are you missing a using directive or an assembly reference?) [/src/SecondBotEvents/SecondBotEvents.csproj] +17.05 /src/SecondBotEvents/Commands/Info.cs(172,32): error CS1061: 'EventsSecondBot' does not contain a definition for 'RLVService' and no accessible extension method 'RLVService' accepting a first argument of type 'EventsSecondBot' could be found (are you missing a using directive or an assembly reference?) [/src/SecondBotEvents/SecondBotEvents.csproj] +17.05 14 Warning(s) +17.05 2 Error(s) +17.06 +17.06 Time Elapsed 00:00:16.68 +------ + + 4 warnings found (use docker --debug to expand): + - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "basic_Password") (line 25) + - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "chatgpt_ApiKey") (line 25) + - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "smtp_Token") (line 25) + - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 174) +Dockerfile:16 +-------------------- + 14 | COPY . . + 15 | WORKDIR "/src/SecondBotEvents" + 16 | >>> RUN dotnet build "SecondBotEvents.csproj" -c Release -o /app/build + 17 | + 18 | FROM build AS publish +-------------------- +ERROR: failed to build: failed to solve: process "/bin/sh -c dotnet build \"SecondBotEvents.csproj\" -c Release -o /app/build" did not complete successfully: exit code: 1