feat(link_codes): linking method between telegram and website

This commit is contained in:
2026-08-18 21:10:57 +07:00
parent 7ae3c98585
commit 771d44d34c
12 changed files with 247 additions and 9 deletions

View File

@@ -7,19 +7,15 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env")
### Internal settings ###
postgres_user: str = Field()
postgres_password: str = Field()
postgres_host: str = Field()
postgres_port: str = Field()
postgres_db: str = Field()
private_key_fp: str = Field()
public_key_fp: str = Field()
access_token_ttl: int = Field(description="Access token TTL (minutes)")
pally_shop_id: str = Field()
pally_token: str = Field()
### Telegram ###
bot_username: str = Field()
### Remnawave ###
remnawave_base_url: str = Field()
@@ -27,12 +23,23 @@ class Settings(BaseSettings):
remnawave_token: str = Field()
remnawave_default_squads_raw: str = Field(alias="REMNAWAVE_DEFAULT_SQUADS_UUIDS")
###
### Finance ###
minimal_deposit: int = Field()
referal_bonus: int = Field(30)
#### Pally ####
pally_shop_id: str = Field()
pally_token: str = Field()
### Security related ###
private_key_fp: str = Field()
public_key_fp: str = Field()
access_token_ttl: int = Field(description="Access token TTL (minutes)")
link_code_ttl: int = Field(8, description="Link Code TTL (minutes)")
min_password_length: int = Field(8)
link_code_length: int = Field(8)
password_security_threshold: int = Field(2)
@computed_field
@@ -61,5 +68,10 @@ class Settings(BaseSettings):
with open(self.public_key_fp, "rb") as f:
return f.read()
@computed_field
@property
def bot_url(self) -> str:
return "https://t.me/" + self.bot_username.lstrip("@")
cfg = Settings() # type: ignore