TelegramAuth + TelegramAuthBot + WatchTogether; README/AGENT
- mods/TelegramAuth, mods/TelegramAuthBot, mods/WatchTogether: копии из образа с enable: true (правило 1), секции в config/init.conf - TelegramAuth в API-режиме (enable: false -> accsdb/гейт не поднимается), TelegramAuthBot: бот @GatusMonBot, long polling - WatchTogether: customPlugins watchtogether.js, relay /wt/c/ - README: секция про SQLite/volume (первый запуск), таблица модулей, состояние Tg-notify и TelegramAuth, раздел WatchTogether - AGENT: правило 10 дополнено секретами init.conf, §12 переписан, добавлен §13 WatchTogether, список mods/ в §1 - в git bot_token и mutations_api_secret оставлены пустыми (правило 10), реальные значения только в рабочем файле на сервере
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Shared.Models.Events;
|
||||
using Shared.Models.Module;
|
||||
using Shared.Models.Module.Interfaces;
|
||||
using Shared.Services;
|
||||
using TelegramAuthBot.Models;
|
||||
using TelegramAuthBot.Services;
|
||||
|
||||
namespace TelegramAuthBot
|
||||
{
|
||||
public class ModInit : IModuleLoaded, IModuleConfigure
|
||||
{
|
||||
public static TelegramAuthBotConf conf = new();
|
||||
|
||||
public void Configure(ConfigureModel app)
|
||||
{
|
||||
SyncConfFromInit();
|
||||
app.services.AddHostedService<TelegramAuthBotHostedService>();
|
||||
}
|
||||
|
||||
public void Loaded(InitspaceModel initspace)
|
||||
{
|
||||
SyncConfFromInit();
|
||||
EventListener.UpdateInitFile += SyncConfFromInit;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EventListener.UpdateInitFile -= SyncConfFromInit;
|
||||
}
|
||||
|
||||
static void SyncConfFromInit()
|
||||
{
|
||||
conf = ModuleInvoke.Init("TelegramAuthBot", DefaultConfTemplate());
|
||||
|
||||
if (conf.enable && string.IsNullOrWhiteSpace(conf.bot_token))
|
||||
{
|
||||
var msg = "TelegramAuthBot: enable=true, но bot_token пустой — проверьте секцию TelegramAuthBot в init.conf рядом с Core.dll.";
|
||||
Console.WriteLine(msg);
|
||||
TelegramAuthBotSerilog.Log.Warning("{Message}", msg);
|
||||
}
|
||||
}
|
||||
|
||||
static TelegramAuthBotConf DefaultConfTemplate() =>
|
||||
new()
|
||||
{
|
||||
enable = true,
|
||||
bot_token = "",
|
||||
lampac_base_url = "http://127.0.0.1:9118",
|
||||
request_timeout_sec = 10,
|
||||
service_display_name = "Lampac NextGen Bot",
|
||||
mutations_api_secret = ""
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user