fix: images in remotes
All checks were successful
Deploy to SFTP Server / build (push) Successful in 9m22s

This commit is contained in:
Max Richter
2025-10-22 16:00:21 +02:00
parent 2446629515
commit 24a66940e9
6 changed files with 129 additions and 131 deletions

View File

@@ -1,12 +1,12 @@
import { defineConfig } from 'astro/config';
import { i18n, filterSitemapByDefaultLocale } from "astro-i18n-aut/integration";
import { defineConfig } from "astro/config";
import { filterSitemapByDefaultLocale, i18n } from "astro-i18n-aut/integration";
import sitemap from "@astrojs/sitemap";
import Icons from 'unplugin-icons/vite'
import mdx from '@astrojs/mdx';
import glsl from 'vite-plugin-glsl';
import Icons from "unplugin-icons/vite";
import mdx from "@astrojs/mdx";
import glsl from "vite-plugin-glsl";
import svelte from "@astrojs/svelte";
import UnoCSS from 'unocss/astro'
import UnoCSS from "unocss/astro";
const defaultLocale = "de";
const locales = {
@@ -14,7 +14,7 @@ const locales = {
de: "de",
};
const DEFAULT_LAYOUT = '@layouts/Post.astro';
const DEFAULT_LAYOUT = "@layouts/Post.astro";
function setDefaultLayout() {
return function(_, file) {
@@ -27,6 +27,9 @@ export default defineConfig({
site: "https://max-richter.dev",
trailingSlash: "never",
prefetch: true,
image: {
remotePatterns: [{ protocol: "https" }],
},
build: {
format: "file",
},
@@ -34,30 +37,30 @@ export default defineConfig({
plugins: [
glsl(),
Icons({
compiler: 'svelte',
compiler: "svelte",
}),
],
server: {
watch: {
// Customize watch behavior to reduce file watchers
ignored: ['**/node_modules/**', '**/dist/**', '**/.git/**'],
usePolling: process.env.NODE_ENV === 'production',
ignored: ["**/node_modules/**", "**/dist/**", "**/.git/**"],
usePolling: process.env.NODE_ENV === "production",
},
},
},
markdown: {
remarkPlugins: [setDefaultLayout]
remarkPlugins: [setDefaultLayout],
},
integrations: [
i18n({
exclude: ["pages/**/*.json.ts", "pages/api/**/*",],
exclude: ["pages/**/*.json.ts", "pages/api/**/*"],
locales,
defaultLocale,
}),
mdx(),
svelte(),
UnoCSS({
injectReset: true
injectReset: true,
}),
sitemap({
i18n: {
@@ -66,5 +69,5 @@ export default defineConfig({
},
filter: filterSitemapByDefaultLocale({ defaultLocale }),
}),
]
],
});

View File

@@ -10,11 +10,11 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^4.3.6",
"@astrojs/check": "^0.9.5",
"@astrojs/mdx": "^4.3.7",
"@astrojs/svelte": "^7.2.0",
"@astrojs/tailwind": "^6.0.2",
"astro": "^5.14.1",
"astro": "^5.14.8",
"astro-i18n-aut": "^0.7.3",
"exifreader": "^4.32.0",
"svelte": "^5.39.8",

144
pnpm-lock.yaml generated
View File

@@ -9,23 +9,23 @@ importers:
.:
dependencies:
'@astrojs/check':
specifier: ^0.9.4
version: 0.9.4(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.3)
specifier: ^0.9.5
version: 0.9.5(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.3)
'@astrojs/mdx':
specifier: ^4.3.6
version: 4.3.6(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))
specifier: ^4.3.7
version: 4.3.7(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))
'@astrojs/svelte':
specifier: ^7.2.0
version: 7.2.0(@types/node@24.6.2)(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(jiti@2.6.1)(svelte@5.39.8)(typescript@5.9.3)(yaml@2.8.1)
version: 7.2.0(@types/node@24.6.2)(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(jiti@2.6.1)(svelte@5.39.8)(typescript@5.9.3)(yaml@2.8.1)
'@astrojs/tailwind':
specifier: ^6.0.2
version: 6.0.2(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(tailwindcss@4.1.14)
version: 6.0.2(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(tailwindcss@4.1.14)
astro:
specifier: ^5.14.1
version: 5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
specifier: ^5.14.8
version: 5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
astro-i18n-aut:
specifier: ^0.7.3
version: 0.7.3(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))
version: 0.7.3(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))
exifreader:
specifier: ^4.32.0
version: 4.32.0
@@ -96,8 +96,8 @@ packages:
'@antfu/utils@9.2.1':
resolution: {integrity: sha512-TMilPqXyii1AsiEii6l6ubRzbo76p6oshUSYPaKsmXDavyMLqjzVDkcp3pHp5ELMUNJHATcEOGxKTTsX9yYhGg==}
'@astrojs/check@0.9.4':
resolution: {integrity: sha512-IOheHwCtpUfvogHHsvu0AbeRZEnjJg3MopdLddkJE70mULItS/Vh37BHcI00mcOJcH1vhD3odbpvWokpxam7xA==}
'@astrojs/check@0.9.5':
resolution: {integrity: sha512-88vc8n2eJ1Oua74yXSGo/8ABMeypfQPGEzuoAx2awL9Ju8cE6tZ2Rz9jVx5hIExHK5gKVhpxfZj4WXm7e32g1w==}
hasBin: true
peerDependencies:
typescript: ^5.0.0
@@ -105,8 +105,8 @@ packages:
'@astrojs/compiler@2.13.0':
resolution: {integrity: sha512-mqVORhUJViA28fwHYaWmsXSzLO9osbdZ5ImUfxBarqsYdMlPbqAqGJCxsNzvppp1BEzc1mJNjOVvQqeDN8Vspw==}
'@astrojs/internal-helpers@0.7.3':
resolution: {integrity: sha512-6Pl0bQEIChuW5wqN7jdKrzWfCscW2rG/Cz+fzt4PhSQX2ivBpnhXgFUCs0M3DCYvjYHnPVG2W36X5rmFjZ62sw==}
'@astrojs/internal-helpers@0.7.4':
resolution: {integrity: sha512-lDA9MqE8WGi7T/t2BMi+EAXhs4Vcvr94Gqx3q15cFEz8oFZMO4/SFBqYr/UcmNlvW+35alowkVj+w9VhLvs5Cw==}
'@astrojs/language-server@2.15.4':
resolution: {integrity: sha512-JivzASqTPR2bao9BWsSc/woPHH7OGSGc9aMxXL4U6egVTqBycB3ZHdBJPuOCVtcGLrzdWTosAqVPz1BVoxE0+A==}
@@ -120,11 +120,11 @@ packages:
prettier-plugin-astro:
optional: true
'@astrojs/markdown-remark@6.3.7':
resolution: {integrity: sha512-KXGdq6/BC18doBCYXp08alHlWChH0hdD2B1qv9wIyOHbvwI5K6I7FhSta8dq1hBQNdun8YkKPR013D/Hm8xd0g==}
'@astrojs/markdown-remark@6.3.8':
resolution: {integrity: sha512-uFNyFWadnULWK2cOw4n0hLKeu+xaVWeuECdP10cQ3K2fkybtTlhb7J7TcScdjmS8Yps7oje9S/ehYMfZrhrgCg==}
'@astrojs/mdx@4.3.6':
resolution: {integrity: sha512-jH04tYgaqLfq3To42+z1oEcXrXUzo3BxZ4fTkb+7BEmOJkQ9/c3iIixFEC+x0GgE8lJb4SuEDGldpAv7+1yY8A==}
'@astrojs/mdx@4.3.7':
resolution: {integrity: sha512-5SRmvMyT/UMWaU2eoD+htnXtE2mUZZEH2K/nEzhuEy+iCsOSuS/DUry59WuKUJRQETi1mgJFdNR4dZLJHYVuRA==}
engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0}
peerDependencies:
astro: ^5.0.0
@@ -195,8 +195,9 @@ packages:
resolution: {integrity: sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==}
engines: {node: '>=6.9.0'}
'@capsizecss/unpack@2.4.0':
resolution: {integrity: sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q==}
'@capsizecss/unpack@3.0.0':
resolution: {integrity: sha512-+ntATQe1AlL7nTOYjwjj6w3299CgRot48wL761TUGYpYgAou3AaONZazp0PKZyCyWhudWsjhq1nvRHOvbMzhTA==}
engines: {node: '>=18'}
'@emmetio/abbreviation@2.3.3':
resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==}
@@ -962,8 +963,8 @@ packages:
peerDependencies:
astro: ^5.0.0
astro@5.14.1:
resolution: {integrity: sha512-gPa8NY7/lP8j8g81iy8UwANF3+aukKRWS68IlthZQNgykpg80ne6lbHOp6FErYycxQ1TUhgEfkXVDQZAoJx8Bg==}
astro@5.14.8:
resolution: {integrity: sha512-nKqCLs7BFvGQL9QWQOUqxHhlHtV0UMLXz1ANJygozvjcexBWS7FYkWI2LzRPMNYmbW4msIWNWnX2RvLdvI5Cnw==}
engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'}
hasBin: true
@@ -995,9 +996,6 @@ packages:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
engines: {node: '>=8'}
blob-to-buffer@1.2.9:
resolution: {integrity: sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA==}
boxen@8.0.1:
resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==}
engines: {node: '>=18'}
@@ -1108,9 +1106,6 @@ packages:
resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==}
engines: {node: '>=18'}
cross-fetch@3.2.0:
resolution: {integrity: sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==}
crossws@0.3.5:
resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==}
@@ -1740,15 +1735,6 @@ packages:
node-fetch-native@1.6.7:
resolution: {integrity: sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==}
node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
node-mock-http@1.0.3:
resolution: {integrity: sha512-jN8dK25fsfnMrVsEhluUTPkBFY+6ybu7jSB1n+ri/vOGjJxU8J9CZhpSGkHXSkFjtUhbmoncG/YG9ta5Ludqog==}
@@ -2105,9 +2091,6 @@ packages:
tiny-inflate@1.0.3:
resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==}
tinyexec@0.3.2:
resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}
tinyexec@1.0.1:
resolution: {integrity: sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw==}
@@ -2123,9 +2106,6 @@ packages:
resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==}
engines: {node: '>=6'}
tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
trim-lines@3.0.1:
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
@@ -2187,8 +2167,8 @@ packages:
unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
unifont@0.5.2:
resolution: {integrity: sha512-LzR4WUqzH9ILFvjLAUU7dK3Lnou/qd5kD+IakBtBK4S15/+x2y9VX+DcWQv6s551R6W+vzwgVS6tFg3XggGBgg==}
unifont@0.6.0:
resolution: {integrity: sha512-5Fx50fFQMQL5aeHyWnZX9122sSLckcDvcfFiBf3QYeHa7a1MKJooUy52b67moi2MJYkrfo/TWY+CoLdr/w0tTA==}
unist-util-find-after@5.0.0:
resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==}
@@ -2517,15 +2497,9 @@ packages:
web-namespaces@2.0.1:
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
webpack-virtual-modules@0.6.2:
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
which-pm-runs@1.1.0:
resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==}
engines: {node: '>=4'}
@@ -2611,7 +2585,7 @@ snapshots:
'@antfu/utils@9.2.1': {}
'@astrojs/check@0.9.4(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.3)':
'@astrojs/check@0.9.5(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.3)':
dependencies:
'@astrojs/language-server': 2.15.4(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.3)
chokidar: 4.0.3
@@ -2624,7 +2598,7 @@ snapshots:
'@astrojs/compiler@2.13.0': {}
'@astrojs/internal-helpers@0.7.3': {}
'@astrojs/internal-helpers@0.7.4': {}
'@astrojs/language-server@2.15.4(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.3)':
dependencies:
@@ -2652,9 +2626,9 @@ snapshots:
transitivePeerDependencies:
- typescript
'@astrojs/markdown-remark@6.3.7':
'@astrojs/markdown-remark@6.3.8':
dependencies:
'@astrojs/internal-helpers': 0.7.3
'@astrojs/internal-helpers': 0.7.4
'@astrojs/prism': 3.3.0
github-slugger: 2.0.0
hast-util-from-html: 2.0.3
@@ -2678,12 +2652,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@astrojs/mdx@4.3.6(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))':
'@astrojs/mdx@4.3.7(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))':
dependencies:
'@astrojs/markdown-remark': 6.3.7
'@astrojs/markdown-remark': 6.3.8
'@mdx-js/mdx': 3.1.1
acorn: 8.15.0
astro: 5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
astro: 5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
es-module-lexer: 1.7.0
estree-util-visit: 2.0.0
hast-util-to-html: 9.0.5
@@ -2707,10 +2681,10 @@ snapshots:
stream-replace-string: 2.0.0
zod: 3.25.76
'@astrojs/svelte@7.2.0(@types/node@24.6.2)(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(jiti@2.6.1)(svelte@5.39.8)(typescript@5.9.3)(yaml@2.8.1)':
'@astrojs/svelte@7.2.0(@types/node@24.6.2)(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(jiti@2.6.1)(svelte@5.39.8)(typescript@5.9.3)(yaml@2.8.1)':
dependencies:
'@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.39.8)(vite@6.3.6(@types/node@24.6.2)(jiti@2.6.1)(yaml@2.8.1))
astro: 5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
astro: 5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
svelte: 5.39.8
svelte2tsx: 0.7.44(svelte@5.39.8)(typescript@5.9.3)
typescript: 5.9.3
@@ -2729,9 +2703,9 @@ snapshots:
- tsx
- yaml
'@astrojs/tailwind@6.0.2(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(tailwindcss@4.1.14)':
'@astrojs/tailwind@6.0.2(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1))(tailwindcss@4.1.14)':
dependencies:
astro: 5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
astro: 5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
autoprefixer: 10.4.21(postcss@8.5.6)
postcss: 8.5.6
postcss-load-config: 4.0.2(postcss@8.5.6)
@@ -2804,13 +2778,9 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1
'@capsizecss/unpack@2.4.0':
'@capsizecss/unpack@3.0.0':
dependencies:
blob-to-buffer: 1.2.9
cross-fetch: 3.2.0
fontkit: 2.0.4
transitivePeerDependencies:
- encoding
'@emmetio/abbreviation@2.3.3':
dependencies:
@@ -3569,9 +3539,9 @@ snapshots:
astro-font@1.1.0: {}
astro-i18n-aut@0.7.3(astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)):
astro-i18n-aut@0.7.3(astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)):
dependencies:
astro: 5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
astro: 5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1)
dedent: 1.7.0
fast-glob: 3.3.3
fs-extra: 11.3.2
@@ -3579,13 +3549,13 @@ snapshots:
transitivePeerDependencies:
- babel-plugin-macros
astro@5.14.1(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1):
astro@5.14.8(@types/node@24.6.2)(jiti@2.6.1)(rollup@4.52.4)(typescript@5.9.3)(yaml@2.8.1):
dependencies:
'@astrojs/compiler': 2.13.0
'@astrojs/internal-helpers': 0.7.3
'@astrojs/markdown-remark': 6.3.7
'@astrojs/internal-helpers': 0.7.4
'@astrojs/markdown-remark': 6.3.8
'@astrojs/telemetry': 3.3.0
'@capsizecss/unpack': 2.4.0
'@capsizecss/unpack': 3.0.0
'@oslojs/encoding': 1.1.0
'@rollup/pluginutils': 5.3.0(rollup@4.52.4)
acorn: 8.15.0
@@ -3627,11 +3597,11 @@ snapshots:
semver: 7.7.2
shiki: 3.13.0
smol-toml: 1.4.2
tinyexec: 0.3.2
tinyexec: 1.0.1
tinyglobby: 0.2.15
tsconfck: 3.1.6(typescript@5.9.3)
ultrahtml: 1.6.0
unifont: 0.5.2
unifont: 0.6.0
unist-util-visit: 5.0.0
unstorage: 1.17.1
vfile: 6.0.3
@@ -3663,7 +3633,6 @@ snapshots:
- '@vercel/kv'
- aws4fetch
- db0
- encoding
- idb-keyval
- ioredis
- jiti
@@ -3703,8 +3672,6 @@ snapshots:
binary-extensions@2.3.0: {}
blob-to-buffer@1.2.9: {}
boxen@8.0.1:
dependencies:
ansi-align: 3.0.1
@@ -3804,12 +3771,6 @@ snapshots:
cookie@1.0.2: {}
cross-fetch@3.2.0:
dependencies:
node-fetch: 2.7.0
transitivePeerDependencies:
- encoding
crossws@0.3.5:
dependencies:
uncrypto: 0.1.3
@@ -4783,10 +4744,6 @@ snapshots:
node-fetch-native@1.6.7: {}
node-fetch@2.7.0:
dependencies:
whatwg-url: 5.0.0
node-mock-http@1.0.3: {}
node-releases@2.0.23: {}
@@ -5263,8 +5220,6 @@ snapshots:
tiny-inflate@1.0.3: {}
tinyexec@0.3.2: {}
tinyexec@1.0.1: {}
tinyglobby@0.2.15:
@@ -5278,8 +5233,6 @@ snapshots:
totalist@3.0.1: {}
tr46@0.0.3: {}
trim-lines@3.0.1: {}
trough@2.2.0: {}
@@ -5337,7 +5290,7 @@ snapshots:
trough: 2.2.0
vfile: 6.0.3
unifont@0.5.2:
unifont@0.6.0:
dependencies:
css-tree: 3.1.0
ofetch: 1.4.1
@@ -5614,15 +5567,8 @@ snapshots:
web-namespaces@2.0.1: {}
webidl-conversions@3.0.1: {}
webpack-virtual-modules@0.6.2: {}
whatwg-url@5.0.0:
dependencies:
tr46: 0.0.3
webidl-conversions: 3.0.1
which-pm-runs@1.1.0: {}
widest-line@5.0.0:

View File

@@ -1,6 +1,7 @@
---
import type { ImageMetadata } from "astro";
import { Picture as AstroImage } from "astro:assets";
import { inferRemoteSize } from 'astro/assets/utils';
import { generateThumbHash, getExifData } from "@helpers/image";
import sharp from "sharp";
interface Props {
@@ -14,14 +15,16 @@ interface Props {
maxWidth?: number;
}
async function checkImage(src: string) {
async function checkImage(image: ImageMetadata) {
const src = image.src;
try {
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return true;
const res = await sharp(src).metadata();
const res = await inferRemoteSize(src);
if (res.format) {
image.format = res.format;
return true;
}else {
console.log("Failed to fetch: ", src);
console.log("Failed to load: ", src);
}
return false;
} catch (err) {
@@ -39,8 +42,8 @@ const {
maxWidth,
} = Astro.props;
let thumbhash = hash && image.fsPath ? await generateThumbHash(image) : "";
const imageOk = await checkImage(image.src);
let thumbhash = hash && await generateThumbHash(image);
const imageOk = await checkImage(image);
let exif = imageOk && (await getExifData(image));
@@ -81,5 +84,5 @@ const sizes = [
.join(", ")}>
<slot />
</AstroImage>
) : "Image not ok"
) : undefined
}

View File

@@ -8,11 +8,32 @@ export async function generateThumbHash(
) {
const scaleFactor = 100 / Math.max(image.width, image.height);
const smallWidth = Math.floor(image.width * scaleFactor);
const smallHeight = Math.floor(image.height * scaleFactor);
let smallWidth = Math.floor(image.width * scaleFactor);
let smallHeight = Math.floor(image.height * scaleFactor);
try {
const smallImg = await sharp(image.fsPath)
const imagePath = (image as ImageMetadata & { fsPath: string }).fsPath ??
image.src;
let sp;
if (imagePath.startsWith("https://") || imagePath.startsWith("http://")) {
const res = await fetch(imagePath);
if (!res.ok) {
return;
}
sp = sharp(await res.arrayBuffer());
} else {
sp = sharp(imagePath);
}
if (!smallWidth || !smallHeight) {
const meta = await sp.metadata();
const scaleFactor = 100 / Math.max(meta.width, meta.height);
smallWidth = Math.floor(meta.width * scaleFactor);
smallHeight = Math.floor(meta.height * scaleFactor);
}
const smallImg = await sp
.resize(smallWidth, smallHeight)
.withMetadata()
.raw()
@@ -22,7 +43,10 @@ export async function generateThumbHash(
const buffer = rgbaToThumbHash(smallWidth, smallHeight, smallImg);
return Buffer.from(buffer).toString("base64");
} catch (error) {
console.log(`Could not generate thumbhash for ${image.fsPath}`, error);
console.log(
`Could not generate thumbhash for ${image.fsPath ?? image.src}`,
error,
);
return "";
}
}
@@ -45,9 +69,17 @@ const allowedExif = [
export async function getExifData(image: ImageMetadata) {
if (image.format === "svg") return undefined; // SVGs don't have EXIF data")
const imagePath = (image as ImageMetadata & { fsPath: string }).fsPath;
const imagePath = (image as ImageMetadata & { fsPath: string }).fsPath ??
image.src;
try {
const buffer = await sharp(imagePath).toBuffer();
let buffer: ArrayBuffer;
if (imagePath.startsWith("https://") || imagePath.startsWith("http://")) {
const res = await fetch(imagePath);
buffer = await res.arrayBuffer();
} else {
buffer = await sharp(imagePath).toBuffer() as unknown as ArrayBuffer;
}
const tags = await ExifReader.load(buffer, { async: true });
@@ -62,7 +94,7 @@ export async function getExifData(image: ImageMetadata) {
return hasExif ? out : undefined;
} catch (error) {
console.log(`Error reading EXIF data from ${imagePath}`, error);
console.log(`Error reading EXIF data from ${JSON.stringify(image)}`, error);
return undefined;
}
}

View File

@@ -3,6 +3,7 @@ import Layout from "@layouts/Layout.astro";
import HeroCard from "@components/HeroCard.astro";
import * as memorium from "@helpers/memorium";
import { resources as resourceTypes } from "../resources.ts";
import markdownToText from "@helpers/markdownToText";
const { resourceType } = Astro.params;
@@ -10,7 +11,7 @@ async function safeGetResource(resType) {
try {
return await memorium.listResource(resourceType);
} catch (error) {
return {content:[]};
return { content: [] };
}
}
@@ -26,6 +27,19 @@ export async function getStaticPaths() {
};
});
}
function getImageUrl(input: string): string {
if (!input) {
return;
}
if (input.startsWith("https://") || input.startsWith("http://")) {
return input;
}
if (input.startsWith("/")) {
return `https://marka.max-richter.dev${input}`;
}
return `https://marka.max-richter.dev/${input}`;
}
---
<Layout title="Max Richter">
@@ -40,7 +54,7 @@ export async function getStaticPaths() {
data: {
title: resource.content.name,
cover: {
src: `https://marka.max-richter.dev/${resource.content.image}`,
src: getImageUrl(resource.content.image),
},
},
}}