mirror of
https://github.com/openmax-server/server.git
synced 2026-06-17 00:18:26 +03:00
Различные фиксы (#14)
* Исключаем только ошибку валидации * Небольшие правки вебсокета тамтама * Теперь номера брутить чутка сложнее * Авторизация теперь проверяется для некоторых команд * Теперь проверяется orign у вебсокета тамтама * Дополнил пример env * Починил немного сокет тамтама
This commit is contained in:
@@ -43,4 +43,7 @@ class ServerConfig:
|
||||
### Telegram bot
|
||||
telegram_bot_token = os.getenv("telegram_bot_token") or "123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
telegram_bot_enabled = bool(os.getenv("telegram_bot_enabled")) or True
|
||||
telegram_whitelist_ids = [x.strip() for x in os.getenv("telegram_whitelist_ids", "").split(",") if x.strip()]
|
||||
telegram_whitelist_ids = [x.strip() for x in os.getenv("telegram_whitelist_ids", "").split(",") if x.strip()]
|
||||
|
||||
### origins
|
||||
origins = [x.strip() for x in os.getenv("origins", "").split(",") if x.strip()] if os.getenv("origins") else None
|
||||
@@ -46,6 +46,38 @@ class Tools:
|
||||
}
|
||||
else:
|
||||
return contact
|
||||
|
||||
def generate_profile_tt(
|
||||
self, id=1, phone=70000000000, avatarUrl=None,
|
||||
photoId=None, updateTime=0,
|
||||
firstName="Test", lastName="Account", options=[],
|
||||
description=None, username=None
|
||||
):
|
||||
contact = {
|
||||
"id": id,
|
||||
"updateTime": updateTime,
|
||||
"phone": phone,
|
||||
"names": [
|
||||
{
|
||||
"name": f"{firstName} {lastName}",
|
||||
"type": "TT"
|
||||
}
|
||||
],
|
||||
"options": options
|
||||
}
|
||||
|
||||
if avatarUrl:
|
||||
contact["photoId"] = photoId
|
||||
contact["baseUrl"] = avatarUrl
|
||||
contact["baseRawUrl"] = avatarUrl
|
||||
|
||||
if description:
|
||||
contact["description"] = description
|
||||
|
||||
if username:
|
||||
contact["link"] = "https://tamtam.chat/" + username
|
||||
|
||||
return contact
|
||||
|
||||
def generate_chat(self, id, owner, type, participants, lastMessage, lastEventTime):
|
||||
"""Генерация чата"""
|
||||
@@ -182,4 +214,8 @@ class Tools:
|
||||
}
|
||||
|
||||
# Возвращаем
|
||||
return message, int(row.get("time"))
|
||||
return message, int(row.get("time"))
|
||||
|
||||
async def auth_required(self, userPhone, coro, *args):
|
||||
if userPhone:
|
||||
await coro(*args)
|
||||
|
||||
Reference in New Issue
Block a user