From 80e9850f750ef55e735961db3ef5b795912166ba Mon Sep 17 00:00:00 2001 From: Benjamin Halko Date: Sat, 14 Oct 2023 08:53:17 -0700 Subject: [PATCH] only add single logo to api --- api/branding.py | 31 ------------------------------- api/models/branding.py | 18 ------------------ api/models/info.py | 2 +- config.py | 26 +------------------------- tests/test_branding.py | 15 --------------- 5 files changed, 2 insertions(+), 90 deletions(-) delete mode 100644 api/branding.py delete mode 100644 api/models/branding.py delete mode 100644 tests/test_branding.py diff --git a/api/branding.py b/api/branding.py deleted file mode 100644 index fff06002..00000000 --- a/api/branding.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -This module provides a blueprint for the branding endpoint. - -Routes: - - GET /branding: Get ReVanced branding. -""" - -from sanic import Blueprint, Request -from sanic.response import JSONResponse, json -from sanic_ext import openapi - -from api.models.branding import BrandingResponseModel -from config import branding_links, api_version - -branding: Blueprint = Blueprint("branding", version=api_version) - - -@branding.get("/branding") -@openapi.definition( - summary="Get ReVanced branding", - response=[BrandingResponseModel], -) -async def root(request: Request) -> JSONResponse: - """ - Returns a JSONResponse with a dictionary containing ReVanced branding links. - - **Returns:** - - JSONResponse: A Sanic JSONResponse instance containing a dictionary with the branding links. - """ - data: dict[str, dict] = {"branding": branding_links} - return json(data, status=200) diff --git a/api/models/branding.py b/api/models/branding.py deleted file mode 100644 index 043e75ba..00000000 --- a/api/models/branding.py +++ /dev/null @@ -1,18 +0,0 @@ -from pydantic import BaseModel - - -class BrandingFields(BaseModel): - """ - Implements the fields for a brand link. - """ - - assettype: str - url: str - - -class BrandingResponseModel(BaseModel): - """ - A Pydantic BaseModel that represents a dictionary of branding links. - """ - - branding: list[BrandingFields] diff --git a/api/models/info.py b/api/models/info.py index c6d29ac6..9a2bb66b 100644 --- a/api/models/info.py +++ b/api/models/info.py @@ -19,8 +19,8 @@ class InfoFields(BaseModel): name: str about: str + branding: str contact: ContactFields - branding: list[BrandingFields] socials: list[SocialFields] donations: DonationFields diff --git a/config.py b/config.py index 5154ff91..ddf609a9 100644 --- a/config.py +++ b/config.py @@ -53,31 +53,6 @@ "revanced-releases-api", ] -# Branding - -branding_links: dict[str, str] = { - { - "assettype": "logo", - "url": "https://github.com/ReVanced/revanced-branding/raw/main/assets/revanced-logo/revanced-logo.svg", - }, - { - "assettype": "horizontal-light", - "url": "https://github.com/ReVanced/revanced-branding/raw/main/assets/revanced-headline/revanced-headline-horizontal-light.svg", - }, - { - "assettype": "horizontal-dark", - "url": "https://github.com/ReVanced/revanced-branding/raw/main/assets/revanced-headline/revanced-headline-horizontal-dark.svg", - }, - { - "assettype": "vertical-light", - "url": "https://github.com/ReVanced/revanced-branding/raw/main/assets/revanced-headline/revanced-headline-vertical-light.svg", - }, - { - "assettype": "vertical-dark", - "url": "https://github.com/ReVanced/revanced-branding/raw/main/assets/revanced-headline/revanced-headline-vertical-dark.svg", - }, -} - # Social Links social_links: list[dict[str, str | bool]] = [ @@ -145,6 +120,7 @@ default_info: dict[str, str | list[str | bool] | bool] = { "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.", + "branding": "https://raw.githubusercontent.com/ReVanced/revanced-branding/main/assets/revanced-logo/revanced-logo.svg", "contact": {"email": "contact@revanced.app"}, "socials": social_links, "donations": {"wallets": wallets, "links": links}, diff --git a/tests/test_branding.py b/tests/test_branding.py deleted file mode 100644 index 99d83e51..00000000 --- a/tests/test_branding.py +++ /dev/null @@ -1,15 +0,0 @@ -import pytest -from sanic import Sanic - -from api.models.branding import BrandingResponseModel - -from config import api_version - -# branding - - -@pytest.mark.asyncio -async def test_branding(app: Sanic): - _, response = await app.asgi_client.get(f"/{api_version}/branding") - assert response.status == 200 - assert BrandingResponseModel(**response.json)