aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Tools/DumpProfile.svelte
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-09 00:41:20 -0700
committerFuwn <[email protected]>2024-10-09 00:41:43 -0700
commit998b63a35256ac985a5a2714dd1ca451af4dfd8a (patch)
tree50796121a9d5ab0330fdc5d7e098bda2860d9726 /src/lib/Tools/DumpProfile.svelte
parentfeat(graphql): add badgeCount field (diff)
downloaddue.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.tar.xz
due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.zip
chore(prettier): use spaces instead of tabs
Diffstat (limited to 'src/lib/Tools/DumpProfile.svelte')
-rw-r--r--src/lib/Tools/DumpProfile.svelte80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/lib/Tools/DumpProfile.svelte b/src/lib/Tools/DumpProfile.svelte
index a6adba6d..45d4ffc9 100644
--- a/src/lib/Tools/DumpProfile.svelte
+++ b/src/lib/Tools/DumpProfile.svelte
@@ -1,52 +1,52 @@
<script lang="ts">
- import { dumpUser } from '$lib/Data/AniList/user';
- import RateLimited from '$lib/Error/RateLimited.svelte';
- import Skeleton from '$lib/Loading/Skeleton.svelte';
- import InputTemplate from './InputTemplate.svelte';
- import LZString from 'lz-string';
-
- let submission = '';
-
- // Credit: @hoh
- const decodeJSON = (about: string): JSON | null => {
- const match = (about || '').match(/^\[\]\(json([A-Za-z0-9+/=]+)\)/);
-
- if (match)
- try {
- return JSON.parse(atob(match[1]));
- } catch {
- try {
- return JSON.parse(LZString.decompressFromBase64(match[1]));
- } catch {
- return null;
- }
- }
-
- return null;
- };
+ import { dumpUser } from '$lib/Data/AniList/user';
+ import RateLimited from '$lib/Error/RateLimited.svelte';
+ import Skeleton from '$lib/Loading/Skeleton.svelte';
+ import InputTemplate from './InputTemplate.svelte';
+ import LZString from 'lz-string';
+
+ let submission = '';
+
+ // Credit: @hoh
+ const decodeJSON = (about: string): JSON | null => {
+ const match = (about || '').match(/^\[\]\(json([A-Za-z0-9+/=]+)\)/);
+
+ if (match)
+ try {
+ return JSON.parse(atob(match[1]));
+ } catch {
+ try {
+ return JSON.parse(LZString.decompressFromBase64(match[1]));
+ } catch {
+ return null;
+ }
+ }
+
+ return null;
+ };
</script>
<!-- svelte-ignore missing-declaration -->
<InputTemplate field="Username" bind:submission event="Dump User" submitText="Dump">
- {#await dumpUser(submission)}
- <Skeleton card={false} count={1} height="500px" />
- {:then dump}
- {@const decoded = decodeJSON(dump.about)}
+ {#await dumpUser(submission)}
+ <Skeleton card={false} count={1} height="500px" />
+ {:then dump}
+ {@const decoded = decodeJSON(dump.about)}
- <pre>{JSON.stringify(dump, null, 2)}</pre>
+ <pre>{JSON.stringify(dump, null, 2)}</pre>
- {#if decoded && (dump.about || '').includes('[](json')}
- <p />
+ {#if decoded && (dump.about || '').includes('[](json')}
+ <p />
- <pre>{JSON.stringify(decoded, null, 2).replaceAll(/\\n/g, '\n')}</pre>
- {/if}
- {:catch}
- <RateLimited type="User" list={false} />
- {/await}
+ <pre>{JSON.stringify(decoded, null, 2).replaceAll(/\\n/g, '\n')}</pre>
+ {/if}
+ {:catch}
+ <RateLimited type="User" list={false} />
+ {/await}
</InputTemplate>
<style>
- pre {
- margin: 0;
- }
+ pre {
+ margin: 0;
+ }
</style>