voice state - also there was no git history here so im just force pushing

This commit is contained in:
CEF Server 2024-05-11 07:40:39 +00:00
commit 9c41144985
9 changed files with 207 additions and 0 deletions

15
cef_3M/util.py Normal file
View file

@ -0,0 +1,15 @@
import hashlib
import re
from fastapi import UploadFile
safeName = re.compile(r"[^\w\d\.-]")
# If this gets too out of hand, put an async breakpoint to allow other things to be handled while the hash occurs
async def SHA256(f: UploadFile) -> str:
sha = hashlib.sha256()
while data := await f.read(65535):
sha.update(data)
await f.seek(0)
return sha.hexdigest()