Skip to content

Commit d00cac5

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

File tree

6 files changed

+61
-49
lines changed

6 files changed

+61
-49
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
RV_API_URL=
2+
RV_WEBSITE_URL=
23
RV_DMCA_GUID=
34
RV_GOOGLE_TAG_MANAGER_ID=

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
- name: Build
4343
env:
4444
RV_API_URL: ${{ vars.RV_API_URL }}
45+
RV_WEBSITE_URL: "https://revanced.app"
4546
RV_GOOGLE_TAG_MANAGER_ID: ${{ vars.RV_GOOGLE_TAG_MANAGER_ID }}
4647
RV_DMCA_GUID: ${{ vars.RV_DMCA_GUID }}
4748
run: bun run build

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: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
3-
import { useSWR } from 'sswr';
43
54
import type { BackendAbout } from '$types';
6-
import { RV_API_URL } from '$env/static/public';
5+
import { RV_API_URL, RV_WEBSITE_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>(RV_WEBSITE_URL);
12+
let referrer = $state<string | null>(null);
13+
14+
async function fetchAbout() {
15+
const res = await fetch(`${RV_API_URL}/v4/about`);
16+
if (res.ok) {
17+
about = await res.json();
18+
} else {
19+
console.error('Failed to fetch about:', `HTTP ${res.status}`);
20+
}
21+
}
1422
1523
$effect(() => {
16-
if ($about) websiteUrl = $about.socials[0].url;
24+
if (about)
25+
websiteUrl = about.socials.find((socials) => socials.name.toLowerCase() == 'website')?.url;
1726
});
1827
1928
onMount(() => {
29+
fetchAbout();
2030
referrer = document.referrer;
2131
});
2232
</script>
@@ -41,6 +51,7 @@
4151
<span class="good"><a href={websiteUrl}>ReVanced</a></span>
4252
<span class="bad">counterfeit</span>
4353
</h1>
54+
<br />
4455
<p>
4556
If you just landed on this page, you may have been redirected here from a
4657
<span class="bad">counterfeit</span> website.
@@ -138,8 +149,8 @@
138149
<section>
139150
<h2>Official links</h2>
140151
<ul>
141-
{#if $about}
142-
{#each $about.socials as { name, url }}
152+
{#if about}
153+
{#each about.socials as { name, url }}
143154
<li><strong>{name}:</strong> <a class="good" href={url}>{url}</a></li>
144155
{/each}
145156
{/if}
@@ -148,7 +159,7 @@
148159
</div>
149160
</main>
150161

151-
<Footer about={$about} {websiteUrl} />
162+
<Footer {about} {websiteUrl} />
152163

153164
<style>
154165
:root {
@@ -204,7 +215,7 @@
204215
205216
.good {
206217
background-color: #1f62ff55;
207-
color: #1f62ff;
218+
color: var(--primary);
208219
border-bottom: 1px solid #1f62ff;
209220
box-shadow: 0 0 5px #1f62ff;
210221
@@ -241,7 +252,7 @@
241252
}
242253
}
243254
a {
244-
color: #1f62ff;
255+
color: var(--primary);
245256
text-decoration: none;
246257
247258
&:hover {

0 commit comments

Comments
 (0)