- 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), реальные значения только в рабочем файле на сервере
152 lines
4.3 KiB
C#
152 lines
4.3 KiB
C#
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; }
|
|
}
|
|
}
|