mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-21 18:13:56 +00:00
feat: nicer patches + filtering, use stores again
This commit is contained in:
14
src/data/ContributorsStore.ts
Normal file
14
src/data/ContributorsStore.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { readable } from 'svelte/store';
|
||||
import type { Repository } from '$lib/types';
|
||||
|
||||
export type ContribData = { repositories: Repository[] };
|
||||
|
||||
const fetchContributors = async (): Promise<ContribData> => {
|
||||
const response = await fetch('https://releases.rvcd.win/contributors');
|
||||
const data = await response.json();
|
||||
return data;
|
||||
};
|
||||
|
||||
export const ContributorsStore = readable(fetchContributors());
|
||||
|
||||
|
||||
23
src/data/PatchesStore.ts
Normal file
23
src/data/PatchesStore.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { readable } from 'svelte/store';
|
||||
import type { Patch } from '$lib/types';
|
||||
|
||||
export type PatchesData = { patches: Patch[]; packages: string[] };
|
||||
|
||||
const fetchPatches = async (): Promise<PatchesData> => {
|
||||
const response = await fetch('https://releases.rvcd.win/patches');
|
||||
const patches = await response.json();
|
||||
let packages: string[] = [];
|
||||
|
||||
// gets packages
|
||||
for (let i = 0; i < patches.length; i++) {
|
||||
patches[i].compatiblePackages.forEach((pkg: Patch) => {
|
||||
let index = packages.findIndex((x) => x == pkg.name);
|
||||
if (index === -1) {
|
||||
packages.push(pkg.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
return { patches, packages };
|
||||
};
|
||||
|
||||
export const PatchesStore = readable(fetchPatches());
|
||||
Reference in New Issue
Block a user