Skip to content

Commit b615f16

Browse files
authored
chore: Merge branch dev to main (#316)
2 parents 4dfb3a2 + 012e798 commit b615f16

File tree

10 files changed

+105
-13
lines changed

10 files changed

+105
-13
lines changed

src/app.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
%sveltekit.head%
2222
</head>
2323

24-
<body>
24+
<body style="background-color: var(--background-one)">
2525
<div style="display: contents">%sveltekit.body%</div>
2626
</body>
2727
</html>

src/app.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ html {
2323
body {
2424
margin: 0;
2525
padding: 0;
26-
background-color: var(--background-one);
2726
}
2827

2928
html,

src/data/api/settings.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export function api_base_url(): string {
1616
if (browser) {
1717
const apiUrl = localStorage.getItem(URL_KEY) || default_api_url;
1818

19-
set_about_info(apiUrl);
20-
2119
return apiUrl;
2220
}
2321

@@ -46,11 +44,11 @@ export function set_api_base_url(url?: string) {
4644
localStorage.removeItem(URL_KEY);
4745
} else {
4846
localStorage.setItem(URL_KEY, url);
49-
set_about_info(url);
5047
}
48+
set_about_info(api_base_url());
5149
}
5250

53-
function set_about_info(apiUrl: string) {
51+
export function set_about_info(apiUrl: string) {
5452
if (!localStorage.getItem(STATUS_KEY) || !localStorage.getItem(EMAIL_KEY)) {
5553
fetch(`${apiUrl}/v4/about`)
5654
.then((response) => (response.ok ? response.json() : null))

src/layout/Banners/StatusBanner.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
<Banner
1212
title="API service is currently down"
13-
description="Some features of the site might be impacted. If this issue persists, reach out to mailto:{email()}"
14-
buttonText={statusUrl ? 'View status' : undefined}
13+
description="Some features of the site might be impacted. If this issue persists, reach out to {email()}."
14+
buttonText={statusUrl ? 'Check status' : undefined}
1515
buttonOnClick={statusUrl ? handleClick : undefined}
1616
level="caution"
1717
permanent
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<script lang="ts">
2+
import Divider from '$lib/components/Divider.svelte';
3+
import { email } from '$data/api/settings';
4+
import Dialog from '$layout/Dialogs/Dialog.svelte';
5+
import Button from '$lib/components/Button.svelte';
6+
import Input from '$lib/components/Input.svelte';
7+
8+
export let showEmailDialog: boolean;
9+
10+
let enableInputSeconds = 15;
11+
let keyword: string = '';
12+
13+
let interval: NodeJS.Timeout;
14+
function closeDialog() {
15+
showEmailDialog = false;
16+
clearInterval(interval);
17+
enableInputSeconds = 15;
18+
keyword = '';
19+
}
20+
21+
$: if (showEmailDialog && !interval && enableInputSeconds != 0) {
22+
interval = setInterval(() => {
23+
if (enableInputSeconds <= 0) {
24+
clearInterval(interval);
25+
return;
26+
}
27+
enableInputSeconds -= 1;
28+
}, 1000);
29+
}
30+
</script>
31+
32+
<Dialog bind:dialogOpen={showEmailDialog} notDismissible>
33+
<svelte:fragment slot="title">Abuse notice</svelte:fragment>
34+
<svelte:fragment slot="description">
35+
<p>
36+
This E-Mail address is <b>not</b> for support, help, bug reports or feature requests. It must
37+
have a subject and body and have the keyword <span style="user-select: none;">'Reficio'</span>
38+
in either, otherwise your mail will be
39+
<b>ignored</b>.
40+
</p>
41+
<br />
42+
{#if enableInputSeconds == 0}
43+
<span>Enter the keyword, then click "Send".</span>
44+
<br />
45+
<br />
46+
<Input placeholder="Keyword" type="text" bind:value={keyword}></Input>
47+
{:else}
48+
<span>Read above and wait <b>{enableInputSeconds}</b> seconds.</span>
49+
{/if}
50+
</svelte:fragment>
51+
<svelte:fragment slot="buttons">
52+
{#if keyword.toLowerCase() === 'reficio'}
53+
<Button type="text"><a href="mailto:{email()}">Send</a></Button>
54+
{/if}
55+
<Button type="filled" on:click={closeDialog}>Close</Button>
56+
</svelte:fragment>
57+
</Dialog>
58+
59+
<style>
60+
a {
61+
text-decoration: none;
62+
color: var(--text-four);
63+
font-weight: 600;
64+
}
65+
</style>

src/layout/Footer/FooterHost.svelte

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,23 @@
1010
import { RV_DMCA_GUID } from '$env/static/public';
1111
import { onMount } from 'svelte';
1212
import Divider from '$lib/components/Divider.svelte';
13-
import { email } from '$data/api/settings';
13+
import Button from '$lib/components/Button.svelte';
14+
import EmailDialog from '$layout/Dialogs/EmailDialog.svelte';
1415
1516
const aboutQuery = createQuery(queries.about());
1617
1718
let location: string;
1819
20+
let showEmailDialog = false;
21+
1922
onMount(() => {
2023
// DMCA Protection Badge
2124
location = document.location.href;
2225
});
2326
</script>
2427

28+
<EmailDialog bind:showEmailDialog />
29+
2530
<Divider horizontalPadding={'15px'} />
2631
<footer in:fly={{ y: 10, easing: quintOut, duration: 750 }}>
2732
<div class="top">
@@ -60,8 +65,16 @@
6065

6166
<div class="bottom">
6267
<div id="logo-name"><span>Re</span>Vanced</div>
63-
<a href="/donate"><div>Donate</div></a>
64-
<a href="mailto:{email()}"><div>Email</div></a>
68+
<Button type="text" style="color: var(--text-four); font-weight: 600;">
69+
<a href="/donate">Donate</a>
70+
</Button>
71+
<Button
72+
type="text"
73+
style="color: var(--text-four); font-weight: 600;"
74+
on:click={() => (showEmailDialog = true)}
75+
>
76+
E-Mail
77+
</Button>
6578
<!-- DMCA Protection Badge -->
6679
<a
6780
href="//www.dmca.com/Protection/Status.aspx?ID={RV_DMCA_GUID}&refurl={location}"
@@ -78,7 +91,6 @@
7891

7992
<style lang="scss">
8093
footer {
81-
background-color: var(--background-one);
8294
max-width: min(87%, 100rem);
8395
padding: 5rem 0rem;
8496
margin: 0 auto;

src/lib/components/Button.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
export let label: string = '';
1313
export let disabled: boolean = false;
1414
export let toolTipText: string | undefined = undefined;
15+
export let style: string = '';
1516
1617
$: type = $$slots.default ? type : 'icon';
1718
</script>
@@ -26,6 +27,7 @@
2627
<button
2728
on:click
2829
class={`${type} ${variant}`}
30+
style="{style}"
2931
class:disabled
3032
aria-label={label}
3133
type={functionType}

src/routes/+layout.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import { events as themeEvents } from '$util/themeEvents';
2525
2626
import FooterHost from '$layout/Footer/FooterHost.svelte';
27+
import { api_base_url, set_about_info } from '$data/api/settings';
2728
2829
const queryClient = new QueryClient({
2930
defaultOptions: {
@@ -50,6 +51,7 @@
5051
);
5152
5253
onMount(() => {
54+
set_about_info(api_base_url());
5355
new DateTriggerEventHandler(themeEvents);
5456
5557
isRestoring.set(true);

src/routes/announcements/[slug]/AdminButtons.svelte

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import Show from 'svelte-material-icons/EyeOutline.svelte';
1717
import Hide from 'svelte-material-icons/EyeOffOutline.svelte';
1818
import Unarchive from 'svelte-material-icons/ArchiveArrowUpOutline.svelte';
19+
import { formatUTC } from '$util/formatUtc';
1920
2021
export let isEditing: boolean;
2122
export let isCreating: boolean;
@@ -67,6 +68,11 @@
6768
const save = async () => {
6869
if (!isValid()) return;
6970
71+
Object.assign(draftInputs, {
72+
created_at: formatUTC(draftInputs.created_at),
73+
archived_at: formatUTC(draftInputs.archived_at)
74+
});
75+
7076
await admin.update_announcement(announcementIdNumber!, sanitize(draftInputs));
7177
await $query?.refetch();
7278
@@ -76,8 +82,13 @@
7682
const createAnnouncement = async () => {
7783
if (!isValid()) return;
7884
85+
Object.assign(draftInputs, {
86+
created_at: formatUTC(draftInputs.created_at),
87+
archived_at: formatUTC(draftInputs.archived_at)
88+
});
89+
7990
await admin.create_announcement(sanitize(draftInputs));
80-
await client.invalidateQueries(queries['announcements']());
91+
await client.invalidateQueries(queries.announcements());
8192
goto('/announcements', { invalidateAll: true });
8293
};
8394

src/util/formatUtc.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import moment from 'moment';
2+
3+
export const formatUTC = (d: any) => d && moment(d).utc().format('YYYY-MM-DDTHH:mm[Z]');

0 commit comments

Comments
 (0)