From b456823df3bc64e24cb601844fc922c2529d32fa Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sat, 19 Oct 2024 04:47:18 -0600 Subject: [PATCH] Just a bunch of changes --- package.json | 1 + pnpm-lock.yaml | 17 ++++++++ server/server.ts | 9 ++++- src/components/SidebarButton.astro | 4 +- src/components/catalog/CatalogCard.svelte | 2 +- src/layouts/Layout.astro | 40 ++----------------- src/layouts/SettingsLayout.astro | 4 +- src/layouts/SettingsSection.astro | 2 +- src/pages/[lang]/catalog/[...page].astro | 4 +- .../catalog/package/[...packageName].astro | 4 +- src/pages/[lang]/index.astro | 10 ++--- src/pages/[lang]/settings/appearance.astro | 4 +- src/pages/[lang]/settings/credits.astro | 4 +- src/pages/index.astro | 21 +++++----- tailwind.config.mjs | 3 ++ 15 files changed, 64 insertions(+), 65 deletions(-) diff --git a/package.json b/package.json index edf95c3..9525292 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@astrojs/svelte": "^5.7.2", "@astrojs/tailwind": "^5.1.2", "@fastify/compress": "^8.0.1", + "@fastify/helmet": "^12.0.1", "@fastify/middie": "^9.0.2", "@fastify/multipart": "^9.0.1", "@fastify/static": "^8.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2007d11..1d34332 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: '@fastify/compress': specifier: ^8.0.1 version: 8.0.1 + '@fastify/helmet': + specifier: ^12.0.1 + version: 12.0.1 '@fastify/middie': specifier: ^9.0.2 version: 9.0.2 @@ -698,6 +701,9 @@ packages: '@fastify/fast-json-stringify-compiler@5.0.1': resolution: {integrity: sha512-f2d3JExJgFE3UbdFcpPwqNUEoHWmt8pAKf8f+9YuLESdefA0WgqxeT6DrGL4Yrf/9ihXNSKOqpjEmurV405meA==} + '@fastify/helmet@12.0.1': + resolution: {integrity: sha512-kkjBcedWwdflRThovGuvN9jB2QQLytBqArCFPdMIb7o2Fp0l/H3xxYi/6x/SSRuH/FFt9qpTGIfJz2bfnMrLqA==} + '@fastify/merge-json-schemas@0.1.1': resolution: {integrity: sha512-fERDVz7topgNjtXsJTTW1JKLy0rhuLRcquYqNR9rF7OcVpCa2OVW49ZPDIhaRRCaUuvVxI+N416xUoF76HNSXA==} @@ -2085,6 +2091,10 @@ packages: hastscript@8.0.0: resolution: {integrity: sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==} + helmet@7.2.0: + resolution: {integrity: sha512-ZRiwvN089JfMXokizgqEPXsl2Guk094yExfoDXR0cBYWxtBbaSww/w+vT4WEJsBW2iTUi1GgZ6swmoug3Oy4Xw==} + engines: {node: '>=16.0.0'} + html-escaper@3.0.3: resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==} @@ -4632,6 +4642,11 @@ snapshots: dependencies: fast-json-stringify: 6.0.0 + '@fastify/helmet@12.0.1': + dependencies: + fastify-plugin: 5.0.1 + helmet: 7.2.0 + '@fastify/merge-json-schemas@0.1.1': dependencies: fast-deep-equal: 3.1.3 @@ -6300,6 +6315,8 @@ snapshots: property-information: 6.5.0 space-separated-tokens: 2.0.2 + helmet@7.2.0: {} + html-escaper@3.0.3: {} html-minifier-terser@7.2.0: diff --git a/server/server.ts b/server/server.ts index 84aec4f..1c7d2cf 100644 --- a/server/server.ts +++ b/server/server.ts @@ -6,6 +6,7 @@ import fastifyCompress from "@fastify/compress"; import fastifyMiddie from "@fastify/middie"; import fastifyMultipart from "@fastify/multipart"; import fastifyStatic from "@fastify/static"; +import fastifyHelmet from "@fastify/helmet"; import chalk from "chalk"; import Fastify, { FastifyReply, FastifyRequest } from "fastify"; import gradient from "gradient-string"; @@ -30,9 +31,15 @@ await app.register(fastifyCompress, { await app.register(fastifyMultipart); +await app.register(fastifyHelmet, { + xPoweredBy: false, + crossOriginEmbedderPolicy: true, + crossOriginOpenerPolicy: true, + contentSecurityPolicy: false //Disabled because astro DOES NOT LIKE IT +}); + await app.register(fastifyStatic, { root: fileURLToPath(new URL("../dist/client", import.meta.url)), - decorateReply: false }); //Our marketplace API. Not middleware as I don't want to deal with that LOL. Just a function that passes our app to it. diff --git a/src/components/SidebarButton.astro b/src/components/SidebarButton.astro index 9437d2d..de5e324 100644 --- a/src/components/SidebarButton.astro +++ b/src/components/SidebarButton.astro @@ -4,13 +4,13 @@ const { title, route } = Astro.props;
{title}
diff --git a/src/components/catalog/CatalogCard.svelte b/src/components/catalog/CatalogCard.svelte index dfe036b..d95b51b 100644 --- a/src/components/catalog/CatalogCard.svelte +++ b/src/components/catalog/CatalogCard.svelte @@ -11,7 +11,7 @@ async function getAssets() { const assets = getAssets(); -
+

Loading...

diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index c5d6b3c..b06948c 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -28,7 +28,10 @@ const { title, noHeader } = Astro.props; + as="style" + crossorigin="anonymous" + /> + {title} @@ -87,44 +90,9 @@ const { title, noHeader } = Astro.props; diff --git a/src/layouts/SettingsLayout.astro b/src/layouts/SettingsLayout.astro index de86f7b..79025c2 100644 --- a/src/layouts/SettingsLayout.astro +++ b/src/layouts/SettingsLayout.astro @@ -7,9 +7,9 @@ import SidebarButton from "@components/SidebarButton.astro"; import { Icon } from "astro-icon/components"; --- -
+
-
+
diff --git a/src/layouts/SettingsSection.astro b/src/layouts/SettingsSection.astro index 3a55383..0afb938 100644 --- a/src/layouts/SettingsSection.astro +++ b/src/layouts/SettingsSection.astro @@ -2,7 +2,7 @@ const { title, subtitle } = Astro.props; --- -
+

{title}
diff --git a/src/pages/[lang]/catalog/[...page].astro b/src/pages/[lang]/catalog/[...page].astro index 82f0fc3..0a4654a 100644 --- a/src/pages/[lang]/catalog/[...page].astro +++ b/src/pages/[lang]/catalog/[...page].astro @@ -18,13 +18,13 @@ const lastPage = assetsJson.pages; --- -
+

Nebula Catalog

The Nebula Catalog is a place for you to find user-created themes and plugins.

-
+
{/* The first page. If the user is on this page, or the one after it, don't show it. */} {parseInt(page!) > 2 && ( 1 diff --git a/src/pages/[lang]/catalog/package/[...packageName].astro b/src/pages/[lang]/catalog/package/[...packageName].astro index 6bd5504..9618d67 100644 --- a/src/pages/[lang]/catalog/package/[...packageName].astro +++ b/src/pages/[lang]/catalog/package/[...packageName].astro @@ -6,7 +6,7 @@ const assetsJson = await response.json(); --- -
+
{assetsJson.error &&

Unexpected error. Is the name right?

} {!assetsJson.error &&
@@ -21,7 +21,7 @@ const assetsJson = await response.json(); {!assetsJson.background_video && !assetsJson.backgroundImage && {assetsJson.title}}

{assetsJson.type}

-

{assetsJson.title}

+

{assetsJson.title}

By: {assetsJson.author}

{assetsJson.description}