chore: Bump API (#263)

This commit is contained in:
oSumAtrIX 2024-11-06 01:36:41 +01:00 committed by GitHub
parent 486e9ef62e
commit 68f8c1fd59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 37 additions and 39 deletions

View File

@ -41,6 +41,15 @@ async function patches(): Promise<PatchesData> {
const json = await get_json('v3/patches/list'); const json = await get_json('v3/patches/list');
const packagesWithCount: { [key: string]: number } = {}; const packagesWithCount: { [key: string]: number } = {};
json.forEach((patch) => {
if (!patch.compatiblePackages) return;
patch.compatiblePackages = Object.keys(patch.compatiblePackages).map((name) => ({
name,
versions: patch.compatiblePackages[name]
}));
});
// gets packages and patch count // gets packages and patch count
for (let i = 0; i < json.length; i++) { for (let i = 0; i < json.length; i++) {
json[i].compatiblePackages?.forEach((pkg: CompatiblePackage) => { json[i].compatiblePackages?.forEach((pkg: CompatiblePackage) => {

View File

@ -7,41 +7,38 @@ export interface Contributor {
export interface Contributable { export interface Contributable {
name: string; name: string;
url: string;
contributors: Contributor[]; contributors: Contributor[];
} }
export interface Patch { export interface Patch {
name: string; name: string;
description: string; description: string;
compatiblePackages: CompatiblePackage[];
use: boolean; use: boolean;
requiresIntegrations: boolean; compatiblePackages: CompatiblePackage[] | null;
options: PatchOption[]; options: PatchOption[];
} }
export interface CompatiblePackage { export interface CompatiblePackage {
name: string; name: string;
versions: string[]; versions: string[] | null;
} }
export interface PatchOption { export interface PatchOption {
key: string; key: string;
default: any; title: string | null;
title: string;
description: string; description: string;
required: boolean; required: boolean;
} type: string;
default: any | null;
export interface Asset { values: any[] | null;
name: string;
download_url: string;
} }
export interface Release { export interface Release {
version: string; version: string;
created_at: string; created_at: string;
description: string; description: string;
assets: Asset[]; download_url: string;
} }
export interface TeamMember { export interface TeamMember {
@ -52,7 +49,7 @@ export interface TeamMember {
gpg_key: GpgKey; gpg_key: GpgKey;
} }
expose interface GpgKey { export interface GpgKey {
id: string; id: string;
url: string; url: string;
} }

View File

@ -52,9 +52,9 @@
</div> </div>
<div class="repos"> <div class="repos">
<Query {query} let:data> <Query {query} let:data>
{#each data.contributables as { contributors, name: repo }} {#each data.contributables as { name, url, contributors }}
<div in:fly={{ y: 10, easing: quintOut, duration: 750 }}> <div in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
<ContributorHost {contributors} {repo} /> <ContributorHost {name} {url} {contributors} />
</div> </div>
{/each} {/each}
</Query> </Query>

View File

@ -1,16 +1,16 @@
<script lang="ts"> <script lang="ts">
import { friendlyName } from '$util/friendlyName';
import { slide } from 'svelte/transition'; import { slide } from 'svelte/transition';
import { quintOut } from 'svelte/easing'; import { quintOut } from 'svelte/easing';
import type { Contributor } from '$lib/types'; import type { Contributor } from '$lib/types';
import ContributorButton from './ContributorPerson.svelte'; import ContributorButton from './ContributorPerson.svelte';
export let contributors: Contributor[]; export let contributors: Contributor[];
export let repo: string; export let name: string;
export let url: string;
let expanded = true; let expanded = true;
let bots = ['semantic-release-bot', 'revanced-bot']; let bots = ['semantic-release-bot', 'revanced-bot'];
let repo_name = friendlyName(repo);
</script> </script>
<div class="section-container"> <div class="section-container">
@ -20,8 +20,8 @@
on:click={() => (expanded = !expanded)} on:click={() => (expanded = !expanded)}
on:keypress={() => (expanded = !expanded)} on:keypress={() => (expanded = !expanded)}
> >
<a href="https://github.com/ReVanced/{repo}" rel="noreferrer" target="_blank" on:click|stopPropagation> <a href="{url}" rel="noreferrer" target="_blank" on:click|stopPropagation>
<h4>{repo_name}</h4> <h4>{name}</h4>
</a> </a>
<img <img
id="arrow" id="arrow"

View File

@ -31,22 +31,22 @@
</a> </a>
<div class="verified-badge"> <div class="verified-badge">
<ToolTip <ToolTip
content="<p><b>{member.name}</b> is verified with this GPG Key ID:</p> <a class='gpg-url' href={member content="<p>GPG key ID:</p> <a class='gpg-url' href={member.gpg_key
.gpg_key.url} rel='noreferrer' target='_blank'>{member.gpg_key.id}</a>" .url} rel='noreferrer' target='_blank'>{member.gpg_key.id}</a>"
html={true} html={true}
> >
<div class="desktop-verified"> <div class="desktop">
<a href={member.gpg_key.url} rel="noreferrer" target="_blank"> <a href={member.gpg_key.url} rel="noreferrer" target="_blank">
<Svg svgHeight={16} viewBoxHeight={16}> <Svg svgHeight={16} viewBoxHeight={16}>
<path d={verifiedIconPath} /> <path d={verifiedIconPath} />
</Svg> </Svg>
</a> </a>
</div> </div>
<div class="mobile-verified"> <div class="mobile">
<Svg svgHeight={16} viewBoxHeight={16}> <Svg svgHeight={16} viewBoxHeight={16}>
<path d={verifiedIconPath} /> <path d={verifiedIconPath} />
</Svg> </Svg>
<h5>Verified</h5> <h5>GPG key</h5>
</div> </div>
</ToolTip> </ToolTip>
</div> </div>
@ -90,18 +90,18 @@
.verified-badge { .verified-badge {
display: flex; display: flex;
align-items: center; align-items: center;
fill: var(--secondary); fill: var(--secondary) !important;
line-height: 16px; line-height: 16px;
height: 16px; height: 16px;
.mobile-verified { .mobile {
display: none; display: none;
} }
@media screen and (width <= 768px) { @media screen and (width <= 768px) {
.desktop-verified { .desktop {
display: none; display: none;
} }
.mobile-verified { .mobile {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;

View File

@ -75,7 +75,7 @@
<Query {query} let:data> <Query {query} let:data>
<Button <Button
type="text" type="text"
href={data.release.assets[0].download_url} href={data.release.download_url}
on:click={() => (warningDialogue = false)}>Okay</Button on:click={() => (warningDialogue = false)}>Okay</Button
> >
</Query> </Query>
@ -97,7 +97,7 @@
on:click={handleClick} on:click={handleClick}
type="filled" type="filled"
icon="download" icon="download"
href={data.release.assets[0].download_url} href={data.release.download_url}
> >
{data.release.version} {data.release.version}
</Button> </Button>

View File

@ -35,7 +35,7 @@
<h5>{patch.description}</h5> <h5>{patch.description}</h5>
{/if} {/if}
<ul class="info-container"> <ul class="info-container">
{#if !patch.compatiblePackages?.length} {#if !patch.compatiblePackages}
<li class="patch-info">🌎 Universal patch</li> <li class="patch-info">🌎 Universal patch</li>
{:else} {:else}
{#each patch.compatiblePackages as pkg} {#each patch.compatiblePackages as pkg}

View File

@ -1,8 +0,0 @@
export function friendlyName(text: string): string {
return text
.replace(/-/g, ' ')
.replace(/\brevanced\b/g, 'ReVanced')
.replace(/\bcli\b/g, 'CLI')
.replace(/api/g, 'API')
.replace(/(?:^|\s)\S/g, (x: string) => x.toUpperCase());
}