mirror of
https://github.com/revanced/revanced-releases-api.git
synced 2025-05-06 16:54:25 +02:00

* feat: resolves #5, resolves #4 (#7) * Implements client generation and management * fix announcements endpoints * change annoucements model * bump deps * sync with main * refactor: adopt some functional standards in Releases.py * feat: add new workflows * chore: remove unused files * refactor: update build badge * refactor: move files around and delete unused ones * feat: add authentication endpoints * refactor: clean up code on Clients.py controller * fix: fix the client secret update endpoint * refactor: clean up authentication code * feat: add authentication to client endpoints * chore: bump deps * feat: add admin user generation * feature: add /changelogs endpoint (#10) * feat: move endpoints into custom routers, resolves #12 (#14) * refactor: import routers from old branch * refactor: import InternalCache removal * refactor: move routes into dedicated routers * fix: fixes entrypoint * refactor: add documentation and bump libs * docs: update description (#16) * feat: implement cdn mirrors endpoints, closes #15 (#17) * feat: add cdn mirror endpoints * refactor: change API version in docs * docs: fix titles on API docs page Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
23 lines
635 B
Python
23 lines
635 B
Python
import os
|
|
import toml
|
|
from redis import asyncio as aioredis
|
|
|
|
# Load config
|
|
|
|
config: dict = toml.load("config.toml")
|
|
|
|
# Redis connection parameters
|
|
|
|
redis_config: dict[ str, str | int ] = {
|
|
"url": f"redis://{os.environ['REDIS_URL']}",
|
|
"port": os.environ['REDIS_PORT'],
|
|
}
|
|
|
|
class RedisConnector:
|
|
"""Implements the RedisConnector class for the ReVanced API"""
|
|
|
|
@staticmethod
|
|
def connect(database: str) -> aioredis.Redis:
|
|
"""Connect to Redis"""
|
|
redis_url = f"{redis_config['url']}:{redis_config['port']}/{database}"
|
|
return aioredis.from_url(redis_url, encoding="utf-8", decode_responses=True) |