Skip to content

Commit dcf3d8a

Browse files
authored
Merge pull request #453 from tp-link-extender/main
Merge main into ledgertests
2 parents 5616983 + 7598390 commit dcf3d8a

19 files changed

Lines changed: 929 additions & 167 deletions

Site/bun.lock

Lines changed: 166 additions & 107 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Site/package.json

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,39 @@
1515
"logs": "bun x pm2 logs"
1616
},
1717
"devDependencies": {
18-
"@biomejs/biome": "^2.4.10",
19-
"@types/bun": "^1.3.11",
18+
"@biomejs/biome": "^2.4.15",
19+
"@types/bun": "^1.3.14",
2020
"@types/d3-interpolate": "^3.0.4",
2121
"@types/nodemailer": "^8.0.0",
2222
"@types/nprogress": "^0.2.3",
23-
"svelte-check": "^4.4.6",
23+
"svelte-check": "^4.4.8",
2424
"vite-plugin-devtools-json": "^1.0.0"
2525
},
2626
"type": "module",
2727
"dependencies": {
2828
"@sveltejs/adapter-node": "^5.5.4",
29-
"@sveltejs/kit": "^2.55.0",
30-
"@sveltejs/vite-plugin-svelte": "^7.0.0",
31-
"@unocss/extractor-svelte": "^66.6.7",
32-
"@unocss/preset-tagify": "^66.6.7",
33-
"@unocss/transformer-directives": "^66.6.7",
34-
"@unocss/transformer-variant-group": "^66.6.7",
29+
"@sveltejs/kit": "^2.60.1",
30+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
31+
"@threlte/core": "^8.5.14",
32+
"@threlte/extras": "^9.19.0",
33+
"@unocss/extractor-svelte": "^66.6.8",
34+
"@unocss/preset-tagify": "^66.6.8",
35+
"@unocss/transformer-directives": "^66.6.8",
36+
"@unocss/transformer-variant-group": "^66.6.8",
3537
"arktype": "^2.2.0",
3638
"d3-interpolate": "^3.0.1",
3739
"melt": "^0.44.0",
38-
"nodemailer": "^8.0.4",
40+
"nodemailer": "^8.0.7",
3941
"nprogress": "^0.2.0",
4042
"picocolors": "^1.1.1",
4143
"sharp": "^0.34.5",
4244
"surrealdb": "^2.0.3",
43-
"svelte": "^5.55.1",
45+
"svelte": "^5.55.8",
46+
"svelte-inview": "^4.0.4",
4447
"sveltekit-superforms": "^2.30.1",
45-
"typescript": "^6.0.2",
46-
"unocss": "^66.6.7",
47-
"vite": "^8.0.3"
48+
"typescript": "^6.0.3",
49+
"unocss": "^66.6.8",
50+
"vite": "^8.0.13"
4851
},
4952
"trustedDependencies": [
5053
"@biomejs/biome",

Site/src/components/Footer.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
{/if}
2626
</div>
2727
<div class="sm:text-right <sm:pt-4">
28-
<div class="flex <sm:flex-col sm:gap-3 justify-end pb-2">
28+
<div class="flex <sm:flex-col sm:gap-4 justify-end pb-2">
29+
<a class="light-text" href="/about">About</a>
2930
{#if data.user && data.pages.includes("Statistics")}
3031
<a class="light-text" href="/statistics">Statistics</a>
3132
{/if}

Site/src/lib/server/imageAsset.ts

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sharp, { type ResizeOptions } from "sharp"
1+
import sharp from "sharp"
22

33
/**
44
* Creates an image asset based off a file object
@@ -10,19 +10,17 @@ import sharp, { type ResizeOptions } from "sharp"
1010
* const id = // Load from database
1111
* save(id)
1212
*/
13-
export async function imageAsset(file: File, sharpOptions?: ResizeOptions) {
14-
const { buffer } = await sharp(await file.arrayBuffer())
15-
.resize(256, 256, {
16-
fit: "contain",
17-
...sharpOptions,
18-
})
19-
.png()
20-
.toBuffer()
21-
.catch(() => {
22-
throw new Error("Image asset failed to upload")
23-
})
24-
25-
return (id: number) => Bun.write(`../data/assets/${id}`, buffer)
13+
export async function imageAsset(file: File) {
14+
try {
15+
const img = new Bun.Image(file)
16+
.resize(256, 256, { fit: "inside" })
17+
.png()
18+
return (id: number) => img.write(`../data/assets/${id}`)
19+
} catch (err) {
20+
const e = err as Error
21+
console.error(e)
22+
throw new Error("Image asset failed to upload")
23+
}
2624
}
2725

2826
/**
@@ -35,19 +33,15 @@ export async function imageAsset(file: File, sharpOptions?: ResizeOptions) {
3533
* const id = // Load from database
3634
* save(id)
3735
*/
38-
export async function clothingAsset(file: File, sharpOptions?: ResizeOptions) {
39-
const { buffer } = await sharp(await file.arrayBuffer())
40-
.resize(585, 559, {
41-
fit: "fill",
42-
...sharpOptions,
43-
})
44-
.png()
45-
.toBuffer()
46-
.catch(() => {
47-
throw new Error("Image asset failed to upload")
48-
})
49-
50-
return (id: number) => Bun.write(`../data/assets/${id}`, buffer)
36+
export async function clothingAsset(file: File) {
37+
try {
38+
const img = new Bun.Image(file).resize(585, 559, { fit: "fill" }).png()
39+
return (id: number) => img.write(`../data/assets/${id}`)
40+
} catch (err) {
41+
const e = err as Error
42+
console.error(e)
43+
throw new Error("Clothing asset failed to upload")
44+
}
5145
}
5246

5347
/**
@@ -60,19 +54,15 @@ export async function clothingAsset(file: File, sharpOptions?: ResizeOptions) {
6054
* const id = // Load from database
6155
* save(id)
6256
*/
63-
export async function thumbnail(b: ArrayBuffer, sharpOptions?: ResizeOptions) {
64-
const { buffer } = await sharp(b)
65-
.resize(420, 420, {
66-
fit: "fill",
67-
...sharpOptions,
68-
})
69-
.webp() // sorry avif, but webp is just magic (just here)
70-
.toBuffer()
71-
.catch(() => {
72-
throw new Error("Thumbnail failed to upload")
73-
})
74-
75-
return (id: number) => Bun.write(`../data/thumbnails/${id}`, buffer)
57+
export async function thumbnail(b: ArrayBuffer) {
58+
try {
59+
const img = new Bun.Image(b).resize(420, 420, { fit: "fill" }).webp()
60+
return (id: number) => img.write(`../data/thumbnails/${id}`)
61+
} catch (err) {
62+
const e = err as Error
63+
console.error(e)
64+
throw new Error("Thumbnail failed to upload")
65+
}
7666
}
7767

7868
const tShirtOpts = Object.freeze({

0 commit comments

Comments
 (0)