Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.

Commit 278af26

Browse files
Merge branch 'develop' of https://github.com/meower-media-co/meower-server into events-rewrite
2 parents 02efdae + 97f0ff2 commit 278af26

File tree

6 files changed

+37
-8
lines changed

6 files changed

+37
-8
lines changed

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ GRPC_AUTH_ADDRESS="0.0.0.0:5000"
1919
GRPC_AUTH_TOKEN=
2020

2121
GRPC_UPLOADS_ADDRESS=
22-
GRPC_UPLOADS_TOKEN=
22+
GRPC_UPLOADS_TOKEN=
23+
24+
CHAT_EMOJIS_LIMIT=250
25+
CHAT_STICKERS_LIMIT=50

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
![](https://raw.githubusercontent.com/meower-media/server/add-branding/branding/server%20banner.svg)
2+
13
# server
24

35
the go stuff, in cmd/* and pkg/* has no security features, so be careful!!!
46

5-
this branch is the subject of a major rewrite
7+
this branch is the subject of a major rewrite

branding/server banner.svg

Lines changed: 22 additions & 0 deletions
Loading

python/rest_api/v0/chats.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from quart_schema import validate_querystring, validate_request
33
from pydantic import BaseModel, Field
44
from typing import Optional, Literal
5-
import pymongo, uuid, time, re
5+
import pymongo, uuid, time, re, os
66

77
import security
88
from database import db, get_total_pages
@@ -205,7 +205,7 @@ async def update_chat(chat_id, data: ChatBody):
205205
if data.icon is None or chat["icon"] == data.icon:
206206
app.supporter.create_post(chat_id, "Server", f"@{request.user} changed the icon of the group chat.", chat_members=chat["members"])
207207
if data.allow_pinning is not None:
208-
chat["allow_pinning"] = data.allow_pinning
208+
updated_vals["allow_pinning"] = data.allow_pinning
209209

210210
# Update chat
211211
db.chats.update_one({"_id": chat_id}, {"$set": updated_vals})
@@ -650,12 +650,12 @@ async def create_chat_emote(chat_id: str, emote_type: Literal["emojis", "sticker
650650
if chat["type"] != 1 and chat["owner"] != request.user:
651651
abort(403)
652652

653-
# Make sure there's not too many emotes in the chat (100 for emojis, 25 for stickers)
653+
# Make sure there's not too many emotes in the chat (250 for emojis, 50 for stickers)
654654
if emote_type == "emojis":
655-
if db.chat_emojis.count_documents({"chat_id": chat_id}, limit=100) >= 100:
655+
if db.chat_emojis.count_documents({"chat_id": chat_id}, limit=250) >= int(os.getenv("CHAT_EMOJIS_LIMIT", 250)):
656656
return {"error": True, "type": "tooManyEmojis"}, 403
657657
elif emote_type == "stickers":
658-
if db.chat_stickers.count_documents({"chat_id": chat_id}, limit=25) >= 25:
658+
if db.chat_stickers.count_documents({"chat_id": chat_id}, limit=50) >= int(os.getenv("CHAT_STICKERS_LIMIT", 50)):
659659
return {"error": True, "type": "tooManyStickers"}, 403
660660

661661
# Claim file

python/rest_api/v0/home.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class Config:
3131
@home_bp.get("/")
3232
@validate_querystring(GetHomeQueryArgs)
3333
async def get_home_posts(query_args: GetHomeQueryArgs):
34+
if not request.user:
35+
query_args.page = 1
3436
query = {"post_origin": "home", "isDeleted": False}
3537
return {
3638
"error": False,

python/rest_api/v0/me.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async def get_me():
7979
db.usersv0.update_one({"_id": request.user}, {"$set": {"last_seen": int(time.time())}})
8080

8181
# Get and return account
82-
return security.get_account(request.user, include_config=True), 200
82+
return {"error": False, **security.get_account(request.user, include_config=True)}, 200
8383

8484

8585
@me_bp.delete("/")

0 commit comments

Comments
 (0)