Skip to content

Commit fbf57c1

Browse files
committed
refactor: avoid duplicate code
1 parent 211f97b commit fbf57c1

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/routes/+page.svelte

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
1111
const { data: about } = useSWR<BackendAbout>(`${RV_API_URL}/v4/about`);
1212
let referrer: string | null = $state(null);
13+
let websiteUrl: string | null = $state(null);
14+
15+
$effect(() => {
16+
if ($about) websiteUrl = $about.socials[0].url;
17+
});
1318
1419
onMount(() => {
1520
referrer = document.referrer || window.location.href;
@@ -32,7 +37,7 @@
3237
<section class="hero">
3338
<h1>
3439
You may be a victim of<br />
35-
<span class="good"><a href={$about?.socials[0].url}>ReVanced</a></span>
40+
<span class="good"><a href={websiteUrl}>ReVanced</a></span>
3641
<span class="bad">counterfeit</span>
3742
</h1>
3843
<p>
@@ -45,23 +50,23 @@
4550
<h2>What is going on?</h2>
4651
<p>
4752
Some counterfeiters have been trying to impersonate
48-
<span class="good"><a href={$about?.socials[0].url}>ReVanced</a></span>
53+
<span class="good"><a href={websiteUrl}>ReVanced</a></span>
4954
by creating fake websites and took advantage of this by creating
5055
<span class="bad">counterfeit</span>
5156
versions, which are designed to look official but are not.
5257
</p>
5358
<p>
54-
<span class="good"><a href={$about?.socials[0].url}>ReVanced</a></span> has aquired a couple
55-
of domains that were previously used by counterfeiters via a
59+
<span class="good"><a href={websiteUrl}>ReVanced</a></span> has aquired a couple of domains
60+
that were previously used by counterfeiters via a
5661
<a href="https://www.wipo.int/amc/en/domains/guide/#What_is_the">
5762
Uniform Domain Name Dispute Resolution
5863
</a>.
5964
<br />
6065
The counterfeit domains are now redirecting to this page. If you were redirected here, it means
6166
you may have been a victim of counterfeit.
6267
</p>
63-
<a href={$about?.socials[0].url}>
64-
Visit the official website at <span class="good">{$about?.socials[0].url}</span>
68+
<a href={websiteUrl}>
69+
Visit the official website at <span class="good">{websiteUrl}</span>
6570
</a>
6671
</section>
6772

@@ -74,13 +79,13 @@
7479
<ul>
7580
<li>
7681
You visited counterfeit website that is not
77-
<span class="good"><a href={$about?.socials[0].url}>revanced.app</a></span>
82+
<span class="good"><a href={websiteUrl}>revanced.app</a></span>
7883
(PS: You just came from <span class="probably-bad">{referrer}</span>).
7984
</li>
8085
<li>
8186
You downloaded ReVanced from any website
8287
<strong>other than</strong>
83-
<span class="good"><a href={$about?.socials[0].url}>revanced.app</a></span>.
88+
<span class="good"><a href={websiteUrl}>revanced.app</a></span>.
8489
</li>
8590
<li>You used a pre-patched APK not obtained officially.</li>
8691
</ul>
@@ -94,16 +99,16 @@
9499
<h2>Known counterfeits</h2>
95100
<p>
96101
These are the known counterfeit domains that have been used to impersonate
97-
<span class="good"><a href={$about?.socials[0].url}>ReVanced</a></span>.
102+
<span class="good"><a href={websiteUrl}>ReVanced</a></span>.
98103
</p>
99104
<ul>
100105
<li>
101106
<span class="bad">revanced.net</span>(Now redirects to
102-
<span class="good"><a href={$about?.socials[0].url}>revanced.app</a></span>)
107+
<span class="good"><a href={websiteUrl}>revanced.app</a></span>)
103108
</li>
104109
<li>
105110
<span class="bad">revanced.dev</span> (Now redirects to
106-
<span class="good"><a href={$about?.socials[0].url}>revanced.app</a></span>)
111+
<span class="good"><a href={websiteUrl}>revanced.app</a></span>)
107112
</li>
108113
<li><span class="bad">revanced.to</span></li>
109114
<li><span class="bad">revancedextended.com</span></li>
@@ -118,17 +123,17 @@
118123
<section>
119124
<h2>I downloaded counterfeit, what should I do?</h2>
120125
<p>
121-
If you downloaded a <span class="good"><a href={$about?.socials[0].url}>ReVanced</a></span> version
122-
from one of the websites listed above or any unofficial source, you are strongly recommend to:
126+
If you downloaded a <span class="good"><a href={websiteUrl}>ReVanced</a></span> version from
127+
one of the websites listed above or any unofficial source, you are strongly recommend to:
123128
</p>
124129
<ul>
125130
<li>Uninstall the counterfeit version.</li>
126131

127132
<li>Change passwords for any accounts accessed while using the counterfeit app.</li>
128133
<li>Run a full security check on your device and accounts.</li>
129134
<li>
130-
<a href={$about?.socials[0].url}>
131-
Visit the official website at <span class="good">{$about?.socials[0].url}</span>
135+
<a href={websiteUrl}>
136+
Visit the official website at <span class="good">{websiteUrl}</span>
132137
</a> and get the official version.
133138
</li>
134139
</ul>

0 commit comments

Comments
 (0)