Skip to content

Commit b2ab8b7

Browse files
committed
fix: Stop using SSWR and update deps
1 parent 3ab11da commit b2ab8b7

File tree

4 files changed

+60
-48
lines changed

4 files changed

+60
-48
lines changed

bun.lockb

96.2 KB
Binary file not shown.

package.json

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
{
2-
"name": "revanced-counterfeits",
3-
"version": "0.0.1",
4-
"devDependencies": {
5-
"@eslint/compat": "^1.2.5",
6-
"@eslint/js": "^9.18.0",
7-
"@sveltejs/adapter-static": "^3.0.8",
8-
"@sveltejs/kit": "^2.16.0",
9-
"@sveltejs/vite-plugin-svelte": "^5.0.0",
10-
"eslint": "^9.18.0",
11-
"eslint-config-prettier": "^10.0.1",
12-
"eslint-plugin-svelte": "^3.0.0",
13-
"globals": "^16.0.0",
14-
"prettier": "^3.4.2",
15-
"prettier-plugin-svelte": "^3.3.3",
16-
"svelte": "^5.0.0",
17-
"svelte-check": "^4.0.0",
18-
"typescript": "^5.0.0",
19-
"typescript-eslint": "^8.20.0",
20-
"vite": "^6.2.6"
21-
},
22-
"private": true,
23-
"scripts": {
24-
"dev": "vite dev",
25-
"build": "vite build",
26-
"preview": "vite preview",
27-
"prepare": "svelte-kit sync || echo ''",
28-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
29-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
30-
"format": "prettier --write .",
31-
"lint": "prettier --check . && eslint ."
32-
},
33-
"type": "module",
34-
"dependencies": {
35-
"@iconify-json/mdi": "^1.2.3",
36-
"sswr": "^2.2.0",
37-
"unplugin-icons": "^22.1.0"
38-
}
2+
"name": "revanced-counterfeits",
3+
"version": "0.0.1",
4+
"devDependencies": {
5+
"@eslint/compat": "^1.2.9",
6+
"@eslint/js": "^9.27.0",
7+
"@sveltejs/adapter-static": "^3.0.8",
8+
"@sveltejs/kit": "^2.21.1",
9+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
10+
"eslint": "^9.27.0",
11+
"eslint-config-prettier": "^10.1.5",
12+
"eslint-plugin-svelte": "^3.9.0",
13+
"globals": "^16.2.0",
14+
"prettier": "^3.5.3",
15+
"prettier-plugin-svelte": "^3.4.0",
16+
"svelte": "^5.33.10",
17+
"svelte-check": "^4.2.1",
18+
"typescript": "^5.8.3",
19+
"typescript-eslint": "^8.33.0",
20+
"vite": "^6.3.5"
21+
},
22+
"private": true,
23+
"scripts": {
24+
"dev": "vite dev",
25+
"build": "vite build",
26+
"preview": "vite preview",
27+
"prepare": "svelte-kit sync || echo ''",
28+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
29+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
30+
"format": "prettier --write .",
31+
"lint": "prettier --check . && eslint ."
32+
},
33+
"type": "module",
34+
"dependencies": {
35+
"@iconify-json/mdi": "^1.2.3",
36+
"unplugin-icons": "^22.1.0"
37+
}
3938
}

src/lib/components/molecules/Embed.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
title: string;
44
image?: string;
55
description?: string;
6-
websiteUrl: string | null;
6+
websiteUrl?: string;
77
themeColor?: string;
88
};
99
let { title, image, description, websiteUrl, themeColor }: Props = $props();

src/routes/+page.svelte

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
3-
import { useSWR } from 'sswr';
43
54
import type { BackendAbout } from '$types';
65
import { RV_API_URL } from '$env/static/public';
76
87
import Footer from '$components/organisms/Footer.svelte';
98
import Embed from '$components/molecules/Embed.svelte';
109
11-
const { data: about } = useSWR<BackendAbout>(`${RV_API_URL}/v4/about`);
12-
let referrer: string | null = $state(null);
13-
let websiteUrl: string = $state('https://revanced.app');
10+
let about = $state<BackendAbout | null>(null);
11+
let websiteUrl = $state<string | undefined>(undefined);
12+
let referrer = $state<string | null>(null);
13+
14+
async function fetchAbout() {
15+
try {
16+
const res = await fetch(`${RV_API_URL}/v4/about`);
17+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
18+
const json: BackendAbout = await res.json();
19+
about = json;
20+
} catch (err) {
21+
console.error('Failed to fetch about:', err);
22+
}
23+
}
1424
1525
$effect(() => {
16-
if ($about) websiteUrl = $about.socials[0].url;
26+
if (about)
27+
websiteUrl = about.socials.find((socials) => socials.name.toLowerCase() == 'website')?.url;
1728
});
1829
1930
onMount(() => {
31+
fetchAbout();
2032
referrer = document.referrer;
2133
});
2234
</script>
@@ -41,6 +53,7 @@
4153
<span class="good"><a href={websiteUrl}>ReVanced</a></span>
4254
<span class="bad">counterfeit</span>
4355
</h1>
56+
<br />
4457
<p>
4558
If you just landed on this page, you may have been redirected here from a
4659
<span class="bad">counterfeit</span> website.
@@ -138,8 +151,8 @@
138151
<section>
139152
<h2>Official links</h2>
140153
<ul>
141-
{#if $about}
142-
{#each $about.socials as { name, url }}
154+
{#if about}
155+
{#each about.socials as { name, url }}
143156
<li><strong>{name}:</strong> <a class="good" href={url}>{url}</a></li>
144157
{/each}
145158
{/if}
@@ -148,7 +161,7 @@
148161
</div>
149162
</main>
150163

151-
<Footer about={$about} {websiteUrl} />
164+
<Footer {about} {websiteUrl} />
152165

153166
<style>
154167
:root {
@@ -204,7 +217,7 @@
204217
205218
.good {
206219
background-color: #1f62ff55;
207-
color: #1f62ff;
220+
color: var(--primary);
208221
border-bottom: 1px solid #1f62ff;
209222
box-shadow: 0 0 5px #1f62ff;
210223
@@ -241,7 +254,7 @@
241254
}
242255
}
243256
a {
244-
color: #1f62ff;
257+
color: var(--primary);
245258
text-decoration: none;
246259
247260
&:hover {

0 commit comments

Comments
 (0)