mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-30 06:34:36 +02:00
feat: add member gpg keys
This commit is contained in:
parent
60301fc30b
commit
80cdb3be6a
@ -5,7 +5,7 @@ import pkgutil
|
|||||||
from api.utils.versioning import get_version
|
from api.utils.versioning import get_version
|
||||||
|
|
||||||
# Dynamically import all modules in the 'api' package, excluding subdirectories
|
# Dynamically import all modules in the 'api' package, excluding subdirectories
|
||||||
versioned_blueprints = {}
|
versioned_blueprints: dict[str, list] = {}
|
||||||
for finder, module_name, ispkg in pkgutil.iter_modules(["api"]):
|
for finder, module_name, ispkg in pkgutil.iter_modules(["api"]):
|
||||||
if not ispkg:
|
if not ispkg:
|
||||||
# Import the module
|
# Import the module
|
||||||
|
@ -102,13 +102,14 @@ class Contributor(dict):
|
|||||||
html_url: str,
|
html_url: str,
|
||||||
contributions: Optional[int] = None,
|
contributions: Optional[int] = None,
|
||||||
bio: Optional[str] = None,
|
bio: Optional[str] = None,
|
||||||
|
keys: Optional[str] = None,
|
||||||
):
|
):
|
||||||
match contributions, bio:
|
match contributions, bio, keys:
|
||||||
case None, None:
|
case None, None, None:
|
||||||
dict.__init__(
|
dict.__init__(
|
||||||
self, login=login, avatar_url=avatar_url, html_url=html_url, bio=bio
|
self, login=login, avatar_url=avatar_url, html_url=html_url, bio=bio, keys=keys
|
||||||
)
|
)
|
||||||
case int(_), None:
|
case int(_), None, None:
|
||||||
dict.__init__(
|
dict.__init__(
|
||||||
self,
|
self,
|
||||||
login=login,
|
login=login,
|
||||||
@ -116,7 +117,7 @@ class Contributor(dict):
|
|||||||
html_url=html_url,
|
html_url=html_url,
|
||||||
contributions=contributions,
|
contributions=contributions,
|
||||||
)
|
)
|
||||||
case None, str(_):
|
case None, str(_), None:
|
||||||
dict.__init__(
|
dict.__init__(
|
||||||
self,
|
self,
|
||||||
login=login,
|
login=login,
|
||||||
@ -124,7 +125,7 @@ class Contributor(dict):
|
|||||||
html_url=html_url,
|
html_url=html_url,
|
||||||
bio=bio,
|
bio=bio,
|
||||||
)
|
)
|
||||||
case int(_), str(_):
|
case int(_), str(_), str(_):
|
||||||
dict.__init__(
|
dict.__init__(
|
||||||
self,
|
self,
|
||||||
login=login,
|
login=login,
|
||||||
@ -132,6 +133,16 @@ class Contributor(dict):
|
|||||||
html_url=html_url,
|
html_url=html_url,
|
||||||
contributions=contributions,
|
contributions=contributions,
|
||||||
bio=bio,
|
bio=bio,
|
||||||
|
keys=keys,
|
||||||
|
)
|
||||||
|
case None, str(_), str(_):
|
||||||
|
dict.__init__(
|
||||||
|
self,
|
||||||
|
login=login,
|
||||||
|
avatar_url=avatar_url,
|
||||||
|
html_url=html_url,
|
||||||
|
bio=bio,
|
||||||
|
keys=keys,
|
||||||
)
|
)
|
||||||
case _:
|
case _:
|
||||||
raise ValueError("Invalid arguments")
|
raise ValueError("Invalid arguments")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
from operator import eq
|
from operator import eq
|
||||||
from typing import Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
from aiohttp import ClientResponse
|
from aiohttp import ClientResponse
|
||||||
@ -107,6 +107,11 @@ class Github(Backend):
|
|||||||
contributor,
|
contributor,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if team_view:
|
||||||
|
filter_contributor[
|
||||||
|
"keys"
|
||||||
|
] = f"{base_url.replace('api.', '')}/{filter_contributor['login']}.gpg"
|
||||||
|
|
||||||
return Contributor(**filter_contributor)
|
return Contributor(**filter_contributor)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -372,7 +377,7 @@ class Github(Backend):
|
|||||||
list[dict[str, str]]: A JSON object containing the contributors.
|
list[dict[str, str]]: A JSON object containing the contributors.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def transform(data: dict, repository: GithubRepository) -> list:
|
def transform(data: dict, repository: GithubRepository) -> dict[str, Any]:
|
||||||
"""Transforms a dictionary from the input list into a list of dictionaries with the desired structure.
|
"""Transforms a dictionary from the input list into a list of dictionaries with the desired structure.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
This module provides endpoints for pinging the API.
|
This module provides endpoints for pinging the API.
|
||||||
|
|
||||||
Routes:
|
Routes:
|
||||||
- HEAD /ping: Ping the API.
|
- GET /ping: Ping the API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from sanic import Blueprint, HTTPResponse, Request, response
|
from sanic import Blueprint, HTTPResponse, Request, response
|
||||||
from sanic_ext import openapi
|
from sanic_ext import openapi
|
||||||
|
|
||||||
ping: Blueprint = Blueprint(os.path.basename(__file__).strip(".py"))
|
ping: Blueprint = Blueprint(os.path.basename(__file__).rstrip(".py"))
|
||||||
|
|
||||||
|
|
||||||
@ping.head("/ping")
|
@ping.get("/ping")
|
||||||
@openapi.summary("Ping the API")
|
@openapi.summary("Ping the API")
|
||||||
async def root(request: Request) -> HTTPResponse:
|
async def root(request: Request) -> HTTPResponse:
|
||||||
"""
|
"""
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# API Configuration
|
# API Configuration
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
backend: str = "github"
|
backend: str = "github"
|
||||||
redis: dict[str, str | int] = {"host": "localhost", "port": 6379}
|
redis: dict[str, str | int] = {"host": "localhost", "port": 6379}
|
||||||
hostnames: list[str] = [
|
hostnames: list[str] = [
|
||||||
@ -137,7 +140,7 @@ links: list[dict[str, str | bool]] = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
default_info: dict[str, str | list[str | bool] | bool] = {
|
default_info: dict[str, Any] = {
|
||||||
"name": "ReVanced",
|
"name": "ReVanced",
|
||||||
"about": "ReVanced was born out of Vanced's discontinuation and it is our goal to continue the legacy of what Vanced left behind. Thanks to ReVanced Patcher, it's possible to create long-lasting patches for nearly any Android app. ReVanced's patching system is designed to allow patches to work on new versions of the apps automatically with bare minimum maintenance.",
|
"about": "ReVanced was born out of Vanced's discontinuation and it is our goal to continue the legacy of what Vanced left behind. Thanks to ReVanced Patcher, it's possible to create long-lasting patches for nearly any Android app. ReVanced's patching system is designed to allow patches to work on new versions of the apps automatically with bare minimum maintenance.",
|
||||||
"branding": {
|
"branding": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user