Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge branch dev to main #246

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,276 changes: 4,276 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
"format": "prettier --write --plugin-search-dir=. ."
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.6",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"@sveltejs/adapter-static": "3.0.2",
"@sveltejs/kit": "2.5.18",
"@sveltejs/vite-plugin-svelte": "3.1.1",
"@typescript-eslint/eslint-plugin": "7.16.0",
"@typescript-eslint/parser": "7.16.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-svelte": "2.42.0",
"fuse.js": "^7.0.0",
"imagetools-core": "^6.0.3",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"imagetools-core": "7.0.1",
"prettier": "3.3.2",
"prettier-plugin-svelte": "3.2.5",
"qrious": "^4.0.2",
"sass": "^1.69.6",
"semver": "^7.5.4",
"sass": "1.77.8",
"semver": "7.6.2",
"sirv-cli": "^2.0.2",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"svelte-meta-tags": "^3.1.0",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vite-imagetools": "^6.2.8"
"svelte": "4.2.18",
"svelte-check": "3.8.4",
"svelte-meta-tags": "3.1.2",
"tslib": "2.6.3",
"typescript": "5.5.3",
"vite": "5.3.3",
"vite-imagetools": "7.0.4"
},
"type": "module",
"dependencies": {
Expand Down
74 changes: 26 additions & 48 deletions src/data/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ import * as settings from './settings';
// API Endpoints
import type {
Patch,
Repository,
Metadata,
Asset,
Contributable,
Release,
TeamMember,
DonationPlatform,
CryptoWallet,
Social,
Info,
About,
CompatiblePackage
} from '$lib/types';

export type ReposData = { repositories: Repository[] };
export type ContributorsData = { contributables: Contributable[] };
export type PatchesData = { patches: Patch[]; packages: string[] };
export type ReleaseData = { metadata: Metadata; assets: Asset[] };
export type ReleaseData = { release: Release };
export type TeamData = { members: TeamMember[] };
export type InfoData = { info: Info };
export type AboutData = { about: About };
export type DonationData = { wallets: CryptoWallet[]; platforms: DonationPlatform[] };
export type SocialsData = { socials: Social[] };

Expand All @@ -27,25 +26,24 @@ async function get_json(endpoint: string) {
return await fetch(url).then((r) => r.json());
}

async function repositories(): Promise<ReposData> {
const json = await get_json('contributors');
return { repositories: json.repositories };
async function contributors(): Promise<ContributorsData> {
const json = await get_json('v3/contributors');
return { contributables: json };
}

async function manager(): Promise<ReleaseData> {
const json = await get_json('v2/revanced-manager/releases/latest');
// console.log(json.release.metadata.tag_name);
console.log(json.release.assets[0].browser_download_url);
return { metadata: json.release.metadata, assets: json.release.assets };
const json = await get_json('v3/manager/latest');

return { release: json };
}

async function patches(): Promise<PatchesData> {
const json = await get_json('v2/patches/latest');
const json = await get_json('v3/patches/latest/list');
const packagesWithCount: { [key: string]: number } = {};

// gets packages and patch count
for (let i = 0; i < json.patches.length; i++) {
json.patches[i].compatiblePackages?.forEach((pkg: CompatiblePackage) => {
for (let i = 0; i < json.length; i++) {
json[i].compatiblePackages?.forEach((pkg: CompatiblePackage) => {
packagesWithCount[pkg.name] = (packagesWithCount[pkg.name] || 0) + 1;
});
}
Expand All @@ -54,27 +52,17 @@ async function patches(): Promise<PatchesData> {
const packages = Object.keys(packagesWithCount);
packages.sort((a, b) => packagesWithCount[b] - packagesWithCount[a]);

return { patches: json.patches, packages };
return { patches: json, packages };
}

async function team(): Promise<TeamData> {
const json = await get_json('v2/team/members');
return { members: json.members };
}

async function info(): Promise<InfoData> {
const json = await get_json('v2/info');
return { info: json.info };
}

async function donate(): Promise<DonationData> {
const json = await get_json('v2/donations');
return { wallets: json.donations.wallets, platforms: json.donations.links };
const json = await get_json('v3/team');
return { members: json };
}

async function socials(): Promise<SocialsData> {
const json = await get_json('v2/socials');
return { socials: json.socials };
async function about(): Promise<AboutData> {
const json = await get_json('v3/about');
return { about: json };
}

export const staleTime = 5 * 60 * 1000;
Expand All @@ -89,29 +77,19 @@ export const queries = {
queryFn: patches,
staleTime
},
repositories: {
queryKey: ['repositories'],
queryFn: repositories,
contributors: {
queryKey: ['contributors'],
queryFn: contributors,
staleTime
},
team: {
queryKey: ['team'],
queryFn: team,
staleTime
},
info: {
about: {
queryKey: ['info'],
queryFn: info,
staleTime
},
donate: {
queryKey: ['donate'],
queryFn: donate,
staleTime
},
socials: {
queryKey: ['socials'],
queryFn: socials,
queryFn: about,
staleTime
}
};
15 changes: 7 additions & 8 deletions src/layout/Footer/FooterHost.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import Query from '$lib/components/Query.svelte';
import FooterSection from './FooterSection.svelte';

const infoQuery = createQuery(['info'], queries.info);
const socialsQuery = createQuery(['socials'], queries.socials);
const aboutQuery = createQuery(['about'], queries.about);
</script>

<!-- squiggly divider line -->
Expand All @@ -33,11 +32,11 @@
<div class="footer-top">
<section class="main-content">
<img src="/logo.svg" class="logo-image" alt="ReVanced Logo" />
<Query query={infoQuery} let:data>
<Query query={aboutQuery} let:data>
{#if data}
<div>
<p>
{data.info.about}
{data.about.about}
</p>
</div>
{/if}
Expand All @@ -52,10 +51,10 @@
<li><a href="/contributors">Contributors</a></li>
<li><a href="/donate">Donate</a></li>
</FooterSection>
<Query query={socialsQuery} let:data>
<Query query={aboutQuery} let:data>
{#if data}
<FooterSection title="Socials">
{#each data.socials as { name, url }}
{#each data.about.socials as { name, url }}
<li>
<a href={url} target="_blank" rel="noreferrer">{name}</a>
</li>
Expand All @@ -65,12 +64,12 @@
</Query>
</section>
</div>
<Query query={infoQuery} let:data>
<Query query={aboutQuery} let:data>
{#if data}
<div class="footer-bottom">
<div id="logo-name"><span>Re</span>Vanced</div>
<a href="/donate"><div>Donate</div></a>
<a href="mailto:{data.info.contact.email}"><div>Email</div></a>
<a href="mailto:{data.about.contact.email}"><div>Email</div></a>
</div>
{/if}
</Query>
Expand Down
10 changes: 3 additions & 7 deletions src/layout/Hero/SocialHost.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import { createQuery } from '@tanstack/svelte-query';
import Query from '$lib/components/Query.svelte';

const query = createQuery(['socials'], queries.socials);
const aboutQuery = createQuery(['about'], queries.about);
</script>

<div class="social-host">
<Query {query} let:data>
<Query query={aboutQuery} let:data>
{#if data}
{#each data.socials.filter((s) => s.name != 'Website') as social}
{#each data.about.socials.filter((s) => s.name != 'Website') as social}
<SocialButton {social} />
{/each}
{/if}
Expand All @@ -23,16 +23,12 @@
padding: 0 max(6.5%, calc(50vw - 50rem));
align-items: center;
user-select: none;
position: absolute;
display: flex;
bottom: 2rem;
gap: 1rem;
left: 0;
}

@media screen and (max-width: 767px) {
.social-host {
left: 0;
width: 100%;
display: flex;
flex-wrap: wrap;
Expand Down
6 changes: 2 additions & 4 deletions src/layout/Navbar/NavHost.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@
<Navigation href="/" label="Home">Home</Navigation>
<Navigation queryKey="manager" href="/download" label="Download">Download</Navigation>
<Navigation queryKey="patches" href="/patches" label="Patches">Patches</Navigation>
<Navigation queryKey="repositories" href="/contributors" label="Contributors">
<Navigation queryKey="contributors" href="/contributors" label="Contributors">
Contributors
</Navigation>
<Navigation queryKey={['donate', 'team']} href="/donate" label="Donate">
Donate
</Navigation>
<Navigation queryKey={['about', 'team']} href="/donate" label="Donate">Donate</Navigation>
</ul>
</div>
<div id="secondary-navigation">
Expand Down
28 changes: 13 additions & 15 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export interface Contributor {
login: string;
name: string;
avatar_url: string;
html_url: string;
url: string;
contributions: number;
}

export interface Repository {
export interface Contributable {
name: string;
contributors: Contributor[];
}
Expand Down Expand Up @@ -33,24 +34,20 @@ export interface PatchOption {

export interface Asset {
name: string;
content_type: string;
browser_download_url: string;
download_url: string;
}

export interface Metadata {
tag_name: string;
name: string;
draft: boolean;
prerelease: boolean;
export interface Release {
version: string;
created_at: string;
published_at: string;
body: string;
description: string;
assets: Asset[];
}

export interface TeamMember {
login: string;
name: string;
avatar_url: string;
html_url: string;
url: string;
bio?: string;
}

Expand All @@ -70,6 +67,7 @@ export interface DonationPlatform {
export interface Social {
name: string;
url: string;
preferred: boolean;
}

interface Donations {
Expand All @@ -81,7 +79,7 @@ interface Contact {
email: string;
}

export interface Info {
export interface About {
name: string;
about: string;
contact: Contact;
Expand Down
7 changes: 6 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@
<Wave />

<style>
main {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.wrap {
margin-inline: auto;
width: min(87%, 100rem);
margin-top: 7rem;
}
.wrappezoid {
height: calc(100vh - 120px);
height: calc(100vh - 225px);
display: flex;
flex-direction: row;
justify-content: center;
Expand Down
4 changes: 2 additions & 2 deletions src/routes/contributors/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { queries } from '$data/api';
import { createQuery } from '@tanstack/svelte-query';

const query = createQuery(['repositories'], queries.repositories);
const query = createQuery(['contributors'], queries.contributors);
</script>

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