blob: 1f0eba7ebe300969c90fe4b16fbf8c1d359e5947 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<script lang="ts">
import { dumpUser } from '$lib/AniList/user';
import RateLimited from '$lib/Error/RateLimited.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)}
Loading user ... 50%
{:then dump}
{@const decoded = decodeJSON(dump.about)}
<pre>{JSON.stringify(dump, null, 2)}</pre>
{#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}
</InputTemplate>
<style>
pre {
margin: 0;
}
</style>
|