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,38 @@
|
||||
using Shared.Models.AppConf;
|
||||
using Shared.Models.Module;
|
||||
|
||||
namespace TelegramAuth.Models
|
||||
{
|
||||
public class TelegramAuthConf : ModuleBaseConf
|
||||
{
|
||||
public bool enable { get; set; }
|
||||
|
||||
public string? data_dir { get; set; }
|
||||
|
||||
public string legacy_import_path { get; set; } = "";
|
||||
|
||||
public bool enable_import { get; set; } = true;
|
||||
|
||||
public bool enable_cleanup { get; set; } = true;
|
||||
|
||||
public int max_active_devices_per_user { get; set; }
|
||||
|
||||
public string mutations_api_secret { get; set; } = "";
|
||||
|
||||
public long[]? owner_telegram_ids { get; set; }
|
||||
|
||||
public bool auto_provision_users { get; set; }
|
||||
|
||||
public string auto_provision_role { get; set; } = "user";
|
||||
|
||||
public string auto_provision_lang { get; set; } = "ru";
|
||||
|
||||
public int auto_provision_expires_days { get; set; }
|
||||
|
||||
public bool auto_provision_activate_immediately { get; set; }
|
||||
|
||||
public int accsdb_sync_group_admin { get; set; } = 100;
|
||||
|
||||
public int accsdb_sync_group_user { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TelegramAuth.Models
|
||||
{
|
||||
public class LegacyDeviceRecord
|
||||
{
|
||||
public string uid { get; set; } = "";
|
||||
public string? label { get; set; }
|
||||
public string? bound_at { get; set; }
|
||||
public string? last_seen { get; set; }
|
||||
public string? last_ip { get; set; }
|
||||
public string? fingerprint { get; set; }
|
||||
}
|
||||
|
||||
public class LegacyTokenRecord
|
||||
{
|
||||
public string token { get; set; } = "";
|
||||
public string telegram_id { get; set; } = "";
|
||||
public string tg_username { get; set; } = "";
|
||||
public DateTime? created_at { get; set; }
|
||||
public DateTime? expires_at { get; set; }
|
||||
public string approved_by { get; set; } = "";
|
||||
public List<LegacyDeviceRecord> devices { get; set; } = new();
|
||||
}
|
||||
|
||||
public class DeviceRecord
|
||||
{
|
||||
public string Uid { get; set; } = "";
|
||||
public string? Name { get; set; }
|
||||
public DateTime LinkedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? LastSeenAt { get; set; }
|
||||
public bool Active { get; set; } = true;
|
||||
public string Source { get; set; } = "import";
|
||||
}
|
||||
|
||||
public class TelegramAccsProfile
|
||||
{
|
||||
[JsonProperty("group")]
|
||||
public int? group { get; set; }
|
||||
|
||||
[JsonProperty("IsPasswd")]
|
||||
public bool? IsPasswd { get; set; }
|
||||
|
||||
public bool? ban { get; set; }
|
||||
|
||||
public string? ban_msg { get; set; }
|
||||
|
||||
public string? comment { get; set; }
|
||||
|
||||
[JsonProperty("params")]
|
||||
public Dictionary<string, object>? @params { get; set; }
|
||||
|
||||
public List<string>? ids { get; set; }
|
||||
}
|
||||
|
||||
public class TelegramUserRecord
|
||||
{
|
||||
public string TelegramId { get; set; } = "";
|
||||
public string TgUsername { get; set; } = "";
|
||||
public string Role { get; set; } = "user";
|
||||
public string Lang { get; set; } = "ru";
|
||||
public string? ApprovedBy { get; set; }
|
||||
public DateTime? CreatedAt { get; set; }
|
||||
public DateTime? ExpiresAt { get; set; }
|
||||
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public bool RegistrationPending { get; set; }
|
||||
|
||||
public List<DeviceRecord> Devices { get; set; } = new();
|
||||
|
||||
[JsonProperty("accs")]
|
||||
public TelegramAccsProfile? Accs { get; set; }
|
||||
}
|
||||
|
||||
public class AuthStatusResponse
|
||||
{
|
||||
public bool Authorized { get; set; }
|
||||
public bool Pending { get; set; }
|
||||
public bool RegistrationPending { get; set; }
|
||||
public string? Message { get; set; }
|
||||
public string? TelegramId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Role { get; set; }
|
||||
public DateTime? ExpiresAt { get; set; }
|
||||
public int DeviceCount { get; set; }
|
||||
}
|
||||
|
||||
public class BindStartRequest
|
||||
{
|
||||
public string Uid { get; set; } = "";
|
||||
}
|
||||
|
||||
public class DeviceSetNameRequest
|
||||
{
|
||||
[JsonProperty("uid", Required = Required.Always)]
|
||||
public string Uid { get; set; } = "";
|
||||
[JsonProperty("name")]
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceReactivateRequest
|
||||
{
|
||||
public string TelegramId { get; set; } = "";
|
||||
public string Uid { get; set; } = "";
|
||||
}
|
||||
|
||||
public class DeviceUnbindRequest
|
||||
{
|
||||
public string TelegramId { get; set; } = "";
|
||||
public string Uid { get; set; } = "";
|
||||
}
|
||||
|
||||
public class BindCompleteRequest
|
||||
{
|
||||
public string Uid { get; set; } = "";
|
||||
public string TelegramId { get; set; } = "";
|
||||
public string? Username { get; set; }
|
||||
public string? DeviceName { get; set; }
|
||||
}
|
||||
|
||||
public class ImportResult
|
||||
{
|
||||
public int ImportedUsers { get; set; }
|
||||
public int ImportedDevices { get; set; }
|
||||
public int ImportedAdmins { get; set; }
|
||||
public int ImportedLangs { get; set; }
|
||||
}
|
||||
|
||||
public class AdminSetUserDisabledRequest
|
||||
{
|
||||
public string TelegramId { get; set; } = "";
|
||||
public bool Disabled { get; set; } = true;
|
||||
}
|
||||
|
||||
public class AdminPendingDecisionRequest
|
||||
{
|
||||
public string TelegramId { get; set; } = "";
|
||||
[JsonProperty("approve")]
|
||||
public bool Approve { get; set; } = true;
|
||||
}
|
||||
|
||||
public class BindDeviceOutcome
|
||||
{
|
||||
public bool NewUserProvisioned { get; set; }
|
||||
public bool PendingAdminApproval { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user