mirror of
https://github.com/openmax-server/server.git
synced 2026-05-26 13:31:43 +03:00
Различные фиксы (#14)
* Исключаем только ошибку валидации * Небольшие правки вебсокета тамтама * Теперь номера брутить чутка сложнее * Авторизация теперь проверяется для некоторых команд * Теперь проверяется orign у вебсокета тамтама * Дополнил пример env * Починил немного сокет тамтама
This commit is contained in:
@@ -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