Files
prodik b6acef01ef 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),
  реальные значения только в рабочем файле на сервере
2026-10-04 15:03:00 +00:00

56 lines
1.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 = ""
};
}
}