+3
-2
astro.config.mjs
+3
-2
astro.config.mjs
+107
-7
pnpm-lock.yaml
+107
-7
pnpm-lock.yaml
···
10
10
dependencies:
11
11
astro:
12
12
specifier: ^5.1.8
13
-
version: 5.1.8(rollup@4.31.0)(typescript@5.7.3)
13
+
version: 5.1.8(@types/node@22.10.10)(rollup@4.31.0)(terser@5.37.0)(typescript@5.7.3)
14
14
15
15
packages:
16
16
···
306
306
cpu: [x64]
307
307
os: [win32]
308
308
309
+
'@jridgewell/gen-mapping@0.3.8':
310
+
resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
311
+
engines: {node: '>=6.0.0'}
312
+
313
+
'@jridgewell/resolve-uri@3.1.2':
314
+
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
315
+
engines: {node: '>=6.0.0'}
316
+
317
+
'@jridgewell/set-array@1.2.1':
318
+
resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==}
319
+
engines: {node: '>=6.0.0'}
320
+
321
+
'@jridgewell/source-map@0.3.6':
322
+
resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==}
323
+
309
324
'@jridgewell/sourcemap-codec@1.5.0':
310
325
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
326
+
327
+
'@jridgewell/trace-mapping@0.3.25':
328
+
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
311
329
312
330
'@nodelib/fs.scandir@2.1.5':
313
331
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
···
470
488
'@types/nlcst@2.0.3':
471
489
resolution: {integrity: sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==}
472
490
491
+
'@types/node@22.10.10':
492
+
resolution: {integrity: sha512-X47y/mPNzxviAGY5TcYPtYL8JsY3kAq2n8fMmKoRCxq/c4v4pyGNCzM2R6+M5/umG4ZfHuT+sgqDYqWc9rJ6ww==}
493
+
473
494
'@types/unist@3.0.3':
474
495
resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
475
496
···
540
561
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
541
562
engines: {node: '>=8'}
542
563
564
+
buffer-from@1.1.2:
565
+
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
566
+
543
567
camelcase@8.0.0:
544
568
resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
545
569
engines: {node: '>=16'}
···
592
616
593
617
comma-separated-tokens@2.0.3:
594
618
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
619
+
620
+
commander@2.20.3:
621
+
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
595
622
596
623
common-ancestor-path@1.0.1:
597
624
resolution: {integrity: sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==}
···
1216
1243
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
1217
1244
engines: {node: '>=0.10.0'}
1218
1245
1246
+
source-map-support@0.5.21:
1247
+
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
1248
+
1249
+
source-map@0.6.1:
1250
+
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
1251
+
engines: {node: '>=0.10.0'}
1252
+
1219
1253
space-separated-tokens@2.0.2:
1220
1254
resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
1221
1255
···
1244
1278
strip-bom@3.0.0:
1245
1279
resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
1246
1280
engines: {node: '>=4'}
1281
+
1282
+
terser@5.37.0:
1283
+
resolution: {integrity: sha512-B8wRRkmre4ERucLM/uXx4MOV5cbnOlVAqUst+1+iLKPI0dOgFO28f84ptoQt9HEI537PMzfYa/d+GEPKTRXmYA==}
1284
+
engines: {node: '>=10'}
1285
+
hasBin: true
1247
1286
1248
1287
tinyexec@0.3.2:
1249
1288
resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}
···
1288
1327
1289
1328
uncrypto@0.1.3:
1290
1329
resolution: {integrity: sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==}
1330
+
1331
+
undici-types@6.20.0:
1332
+
resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
1291
1333
1292
1334
unenv@1.10.0:
1293
1335
resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==}
···
1707
1749
'@img/sharp-win32-x64@0.33.5':
1708
1750
optional: true
1709
1751
1752
+
'@jridgewell/gen-mapping@0.3.8':
1753
+
dependencies:
1754
+
'@jridgewell/set-array': 1.2.1
1755
+
'@jridgewell/sourcemap-codec': 1.5.0
1756
+
'@jridgewell/trace-mapping': 0.3.25
1757
+
optional: true
1758
+
1759
+
'@jridgewell/resolve-uri@3.1.2':
1760
+
optional: true
1761
+
1762
+
'@jridgewell/set-array@1.2.1':
1763
+
optional: true
1764
+
1765
+
'@jridgewell/source-map@0.3.6':
1766
+
dependencies:
1767
+
'@jridgewell/gen-mapping': 0.3.8
1768
+
'@jridgewell/trace-mapping': 0.3.25
1769
+
optional: true
1770
+
1710
1771
'@jridgewell/sourcemap-codec@1.5.0': {}
1772
+
1773
+
'@jridgewell/trace-mapping@0.3.25':
1774
+
dependencies:
1775
+
'@jridgewell/resolve-uri': 3.1.2
1776
+
'@jridgewell/sourcemap-codec': 1.5.0
1777
+
optional: true
1711
1778
1712
1779
'@nodelib/fs.scandir@2.1.5':
1713
1780
dependencies:
···
1845
1912
dependencies:
1846
1913
'@types/unist': 3.0.3
1847
1914
1915
+
'@types/node@22.10.10':
1916
+
dependencies:
1917
+
undici-types: 6.20.0
1918
+
optional: true
1919
+
1848
1920
'@types/unist@3.0.3': {}
1849
1921
1850
1922
'@ungap/structured-clone@1.2.1': {}
···
1876
1948
1877
1949
array-iterate@2.0.1: {}
1878
1950
1879
-
astro@5.1.8(rollup@4.31.0)(typescript@5.7.3):
1951
+
astro@5.1.8(@types/node@22.10.10)(rollup@4.31.0)(terser@5.37.0)(typescript@5.7.3):
1880
1952
dependencies:
1881
1953
'@astrojs/compiler': 2.10.3
1882
1954
'@astrojs/internal-helpers': 0.4.2
···
1928
2000
unist-util-visit: 5.0.0
1929
2001
unstorage: 1.14.4
1930
2002
vfile: 6.0.3
1931
-
vite: 6.0.11
1932
-
vitefu: 1.0.5(vite@6.0.11)
2003
+
vite: 6.0.11(@types/node@22.10.10)(terser@5.37.0)
2004
+
vitefu: 1.0.5(vite@6.0.11(@types/node@22.10.10)(terser@5.37.0))
1933
2005
which-pm: 3.0.0
1934
2006
xxhash-wasm: 1.1.0
1935
2007
yargs-parser: 21.1.1
···
1996
2068
dependencies:
1997
2069
fill-range: 7.1.1
1998
2070
2071
+
buffer-from@1.1.2:
2072
+
optional: true
2073
+
1999
2074
camelcase@8.0.0: {}
2000
2075
2001
2076
ccount@2.0.1: {}
···
2047
2122
optional: true
2048
2123
2049
2124
comma-separated-tokens@2.0.3: {}
2125
+
2126
+
commander@2.20.3:
2127
+
optional: true
2050
2128
2051
2129
common-ancestor-path@1.0.1: {}
2052
2130
···
2980
3058
2981
3059
source-map-js@1.2.1: {}
2982
3060
3061
+
source-map-support@0.5.21:
3062
+
dependencies:
3063
+
buffer-from: 1.1.2
3064
+
source-map: 0.6.1
3065
+
optional: true
3066
+
3067
+
source-map@0.6.1:
3068
+
optional: true
3069
+
2983
3070
space-separated-tokens@2.0.2: {}
2984
3071
2985
3072
sprintf-js@1.0.3: {}
···
3011
3098
3012
3099
strip-bom@3.0.0: {}
3013
3100
3101
+
terser@5.37.0:
3102
+
dependencies:
3103
+
'@jridgewell/source-map': 0.3.6
3104
+
acorn: 8.14.0
3105
+
commander: 2.20.3
3106
+
source-map-support: 0.5.21
3107
+
optional: true
3108
+
3014
3109
tinyexec@0.3.2: {}
3015
3110
3016
3111
to-regex-range@5.0.1:
···
3037
3132
ultrahtml@1.5.3: {}
3038
3133
3039
3134
uncrypto@0.1.3: {}
3135
+
3136
+
undici-types@6.20.0:
3137
+
optional: true
3040
3138
3041
3139
unenv@1.10.0:
3042
3140
dependencies:
···
3124
3222
'@types/unist': 3.0.3
3125
3223
vfile-message: 4.0.2
3126
3224
3127
-
vite@6.0.11:
3225
+
vite@6.0.11(@types/node@22.10.10)(terser@5.37.0):
3128
3226
dependencies:
3129
3227
esbuild: 0.24.2
3130
3228
postcss: 8.5.1
3131
3229
rollup: 4.31.0
3132
3230
optionalDependencies:
3231
+
'@types/node': 22.10.10
3133
3232
fsevents: 2.3.3
3233
+
terser: 5.37.0
3134
3234
3135
-
vitefu@1.0.5(vite@6.0.11):
3235
+
vitefu@1.0.5(vite@6.0.11(@types/node@22.10.10)(terser@5.37.0)):
3136
3236
optionalDependencies:
3137
-
vite: 6.0.11
3237
+
vite: 6.0.11(@types/node@22.10.10)(terser@5.37.0)
3138
3238
3139
3239
web-namespaces@2.0.1: {}
3140
3240
+7
-28
src/dong-io.ts
+7
-28
src/dong-io.ts
···
66
66
]);
67
67
};
68
68
69
-
// base 64 overload
70
69
export async function readDong(
71
70
dongFile: File,
72
-
opts?: { b64: true }
71
+
73
72
): Promise<
74
73
| {
75
-
image: { data: string; mime: string };
76
-
audio: { data: string; mime: string };
77
-
}
78
-
| string
79
-
>;
80
-
// standard overload
81
-
export async function readDong(
82
-
dongFile: File,
83
-
opts?: { b64: false }
84
-
): Promise<
85
-
| {
86
-
image: { data: Uint8Array; mime: string };
87
-
audio: { data: Uint8Array; mime: string };
88
-
}
89
-
| string
90
-
>;
91
-
92
-
export async function readDong(
93
-
dongFile: File,
94
-
opts?: { b64: boolean }
95
-
): Promise<
96
-
| {
97
-
image: { data: Uint8Array | string; mime: string };
98
-
audio: { data: Uint8Array | string; mime: string };
74
+
image: { data: Uint8Array; b64?: string; mime: string };
75
+
audio: { data: Uint8Array; b64?: string; mime: string };
99
76
}
100
77
| string
101
78
> {
···
133
110
return {
134
111
image: {
135
112
mime: imgMimeType,
136
-
data: opts?.b64 ? uint8array64(imageBytes) : imageBytes,
113
+
data: uint8array64(imageBytes),
114
+
b64: uint8array64(imageBytes),
137
115
},
138
116
audio: {
139
117
mime: audMimeType,
140
-
data: opts?.b64 ? uint8array64(audioBytes) : audioBytes,
118
+
data: uint8array64(audioBytes),
119
+
b64: uint8array64(audioBytes),
141
120
},
142
121
};
143
122
}
+1
src/layouts/Base.astro
+1
src/layouts/Base.astro
+6
-3
src/pages/index.astro
+6
-3
src/pages/index.astro
···
131
131
132
132
// do not append as this is only for playing audio
133
133
// loaded here to prevent overlaying the sound
134
-
const audio = document.createElement("audio");
134
+
const audio = new Audio();
135
135
136
136
dongSelect.type = "file";
137
137
dongSelect.accept = ".dong";
···
161
161
// get files
162
162
const dongFile = dongSelect.files[0];
163
163
164
-
const res = await readDong(dongFile, { b64: true });
164
+
const res = await readDong(dongFile);
165
165
if (typeof res === "string") {
166
166
errormsg.innerText = res;
167
167
return;
168
168
}
169
169
170
-
image.src = `data:${res.image.mime};base64,${res.image.data}`;
170
+
image.src = `data:${res.image.mime};base64,${res.image.b64}`;
171
171
172
172
// audio play
173
173
audio.src = `data:${res.audio.mime};base64,${res.audio.data}`;
···
190
190
191
191
button {
192
192
background-color: var(--accent);
193
+
&:empty {
194
+
display: none;
195
+
}
193
196
}
194
197
195
198
body {