cache and info update
This commit is contained in:
parent
84cc45028b
commit
742b1da1ee
2 changed files with 16 additions and 3 deletions
|
|
@ -1,11 +1,24 @@
|
||||||
import type { Handle } from '@sveltejs/kit';
|
import type { Handle } from '@sveltejs/kit';
|
||||||
import info from '$lib';
|
import info from '$lib';
|
||||||
|
|
||||||
export const handle: Handle = async ({ event, resolve }) => !event.request.headers.get('user-agent')?.includes('curl') ? await resolve(event) : new Response(`\
|
export const handle: Handle = async ({ event, resolve }) => {
|
||||||
|
if (event.request.headers.get('user-agent')?.includes('curl')) {
|
||||||
|
return new Response(`\
|
||||||
\
|
\
|
||||||
\x1b[1m${info.subtitle}\x1b[0m
|
\x1b[1m"${info.quote}"\x1b[0m
|
||||||
${info.description}
|
${info.description}
|
||||||
|
|
||||||
\x1b[2;3m${info.title} - ${event.request.headers.get('user-agent')} version ;)\x1b[0m\n\
|
\x1b[2;3m${info.title} - ${event.request.headers.get('user-agent')} version ;)\x1b[0m\n\
|
||||||
\
|
\
|
||||||
`);
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await resolve(event);
|
||||||
|
const { pathname } = event.url;
|
||||||
|
|
||||||
|
if (/\.(png|jpe?g|gif|webp|avif|svg|ico|mp3|ogg|wav|woff2?|ttf|otf)$/i.test(pathname)) {
|
||||||
|
response.headers.set('Cache-Control', 'public, max-age=31536000, immutable');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
@ -207,7 +207,7 @@ export default {
|
||||||
},
|
},
|
||||||
socials: {
|
socials: {
|
||||||
protonmail: "mailto:admin@satr14.my.id",
|
protonmail: "mailto:admin@satr14.my.id",
|
||||||
github: "https://github.com/SX-9",
|
github: "https://github.com/satr14washere",
|
||||||
discord: "https://discord.com/users/882595027132493864",
|
discord: "https://discord.com/users/882595027132493864",
|
||||||
reddit: "https://reddit.com/u/Frequent_Outside_741",
|
reddit: "https://reddit.com/u/Frequent_Outside_741",
|
||||||
steam: "https://steamcommunity.com/id/satr14",
|
steam: "https://steamcommunity.com/id/satr14",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue