feat: telegram commands, app settings, bot polling, webhook handling, UI improvements
Adds telegram bot command system with 13 commands (search, latest, random, etc.), webhook/polling handlers, rate limiting, app settings page, and various UI/UX improvements across all entity pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
from uuid import uuid4
|
||||
|
||||
from sqlmodel import JSON, Column, Field, SQLModel
|
||||
|
||||
@@ -44,6 +45,9 @@ class TelegramBot(SQLModel, table=True):
|
||||
icon: str = Field(default="")
|
||||
bot_username: str = Field(default="")
|
||||
bot_id: int = Field(default=0)
|
||||
webhook_path_id: str = Field(default_factory=lambda: uuid4().hex)
|
||||
update_mode: str = Field(default="polling") # "polling" or "webhook"
|
||||
commands_config: dict[str, Any] = Field(default_factory=dict, sa_column=Column(JSON))
|
||||
created_at: datetime = Field(default_factory=_utcnow)
|
||||
|
||||
|
||||
@@ -106,6 +110,7 @@ class TrackingConfig(SQLModel, table=True):
|
||||
|
||||
# Memory mode
|
||||
memory_enabled: bool = Field(default=False)
|
||||
memory_source: str = Field(default="albums") # "albums" or "native"
|
||||
memory_times: str = Field(default="09:00")
|
||||
memory_collection_mode: str = Field(default="combined")
|
||||
memory_limit: int = Field(default=10)
|
||||
@@ -221,13 +226,22 @@ class EventLog(SQLModel, table=True):
|
||||
__tablename__ = "event_log"
|
||||
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
tracker_id: int | None = Field(default=None, foreign_key="tracker.id")
|
||||
tracker_id: int | None = Field(default=None, foreign_key="tracker.id", index=True)
|
||||
tracker_name: str = Field(default="")
|
||||
provider_id: int | None = Field(default=None)
|
||||
provider_id: int | None = Field(default=None, index=True)
|
||||
provider_name: str = Field(default="")
|
||||
event_type: str
|
||||
event_type: str = Field(index=True)
|
||||
collection_id: str
|
||||
collection_name: str
|
||||
assets_count: int = Field(default=0)
|
||||
details: dict[str, Any] = Field(default_factory=dict, sa_column=Column(JSON))
|
||||
created_at: datetime = Field(default_factory=_utcnow)
|
||||
|
||||
|
||||
class AppSetting(SQLModel, table=True):
|
||||
"""Key-value app-level settings (admin-configurable)."""
|
||||
|
||||
__tablename__ = "app_setting"
|
||||
|
||||
key: str = Field(primary_key=True)
|
||||
value: str = Field(default="")
|
||||
|
||||
Reference in New Issue
Block a user