mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-13 03:50:02 -04:00
SSR and marketplace shit
This commit is contained in:
parent
99efa86c58
commit
ad195b22db
12 changed files with 123 additions and 22 deletions
|
@ -1,9 +1,10 @@
|
||||||
import { defineConfig } from "astro/config";
|
import { defineConfig } from "astro/config";
|
||||||
import tailwind from "@astrojs/tailwind";
|
import tailwind from "@astrojs/tailwind";
|
||||||
import icon from "astro-icon";
|
import icon from "astro-icon";
|
||||||
|
|
||||||
import svelte from "@astrojs/svelte";
|
import svelte from "@astrojs/svelte";
|
||||||
|
|
||||||
|
import node from "@astrojs/node";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
integrations: [tailwind(), icon(), svelte()],
|
integrations: [tailwind(), icon(), svelte()],
|
||||||
|
@ -19,7 +20,15 @@ export default defineConfig({
|
||||||
target: "http://localhost:8080",
|
target: "http://localhost:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
|
"/api/packages": {
|
||||||
|
target: "http://localhost:8080",
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
output: "server",
|
||||||
|
adapter: node({
|
||||||
|
mode: "hybrid",
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
18
package-lock.json
generated
18
package-lock.json
generated
|
@ -9,6 +9,7 @@
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.8.2",
|
"@astrojs/check": "^0.8.2",
|
||||||
|
"@astrojs/node": "^8.3.2",
|
||||||
"@astrojs/svelte": "^5.7.0",
|
"@astrojs/svelte": "^5.7.0",
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@fastify/compress": "^7.0.3",
|
"@fastify/compress": "^7.0.3",
|
||||||
|
@ -328,6 +329,18 @@
|
||||||
"vfile": "^6.0.2"
|
"vfile": "^6.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@astrojs/node": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@astrojs/node/-/node-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-Upv0D+9b3RXp7XViQTtrijaDqihHWbVHLdJQ2sxtPOEtw2GDrVxuC6LmXIUew5YvJ9Ylmpst6KizVwO8d/K9/Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"send": "^0.18.0",
|
||||||
|
"server-destroy": "^1.0.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"astro": "^4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@astrojs/prism": {
|
"node_modules/@astrojs/prism": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.1.0.tgz",
|
||||||
|
@ -8917,6 +8930,11 @@
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/server-destroy": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/server-destroy/-/server-destroy-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ=="
|
||||||
|
},
|
||||||
"node_modules/set-blocking": {
|
"node_modules/set-blocking": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.8.2",
|
"@astrojs/check": "^0.8.2",
|
||||||
|
"@astrojs/node": "^8.3.2",
|
||||||
"@astrojs/svelte": "^5.7.0",
|
"@astrojs/svelte": "^5.7.0",
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@fastify/compress": "^7.0.3",
|
"@fastify/compress": "^7.0.3",
|
||||||
|
|
20
server.js
20
server.js
|
@ -3,11 +3,12 @@ import { createServer } from "node:http";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { Sequelize, DataTypes } from "sequelize";
|
import { Sequelize, DataTypes } from "sequelize";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
import { handler as ssrHandler } from "./dist/server/entry.mjs";
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
const app = express();
|
const app = express();
|
||||||
const publicPath = "dist";
|
const publicPath = "dist/client";
|
||||||
const sequelize = new Sequelize("database", "user", "password", {
|
const sequelize = new Sequelize("database", "user", "password", {
|
||||||
host: "localhost",
|
host: "localhost",
|
||||||
dialect: "sqlite",
|
dialect: "sqlite",
|
||||||
|
@ -27,6 +28,9 @@ const catalog_assets = sequelize.define("catalog_assets", {
|
||||||
description: {
|
description: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
},
|
},
|
||||||
|
author: {
|
||||||
|
type: DataTypes.TEXT,
|
||||||
|
},
|
||||||
image: {
|
image: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT,
|
||||||
},
|
},
|
||||||
|
@ -53,10 +57,6 @@ const catalog_assets = sequelize.define("catalog_assets", {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(express.static(publicPath));
|
|
||||||
app.use("/images/", express.static("./database_assets/image"));
|
|
||||||
app.use("/videos/", express.static("./database_assets/video"));
|
|
||||||
|
|
||||||
app.get("/api", function (request, reply) {
|
app.get("/api", function (request, reply) {
|
||||||
reply.send({ hello: "world" });
|
reply.send({ hello: "world" });
|
||||||
});
|
});
|
||||||
|
@ -83,6 +83,7 @@ app.get("/api/catalog-assets", async (request, reply) => {
|
||||||
acc[asset.package_name] = {
|
acc[asset.package_name] = {
|
||||||
title: asset.title,
|
title: asset.title,
|
||||||
description: asset.description,
|
description: asset.description,
|
||||||
|
author: asset.author,
|
||||||
image: asset.image,
|
image: asset.image,
|
||||||
tags: asset.tags,
|
tags: asset.tags,
|
||||||
version: asset.version,
|
version: asset.version,
|
||||||
|
@ -128,6 +129,7 @@ app.get("/api/packages/:package", async (request, reply) => {
|
||||||
title: package_row.get("title"),
|
title: package_row.get("title"),
|
||||||
description: package_row.get("description"),
|
description: package_row.get("description"),
|
||||||
image: package_row.get("image"),
|
image: package_row.get("image"),
|
||||||
|
author: package_row.get("author"),
|
||||||
tags: package_row.get("tags"),
|
tags: package_row.get("tags"),
|
||||||
version: package_row.get("version"),
|
version: package_row.get("version"),
|
||||||
background_image: package_row.get("background_image"),
|
background_image: package_row.get("background_image"),
|
||||||
|
@ -141,10 +143,16 @@ app.get("/api/packages/:package", async (request, reply) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use("/images/", express.static("./database_assets/image"));
|
||||||
|
app.use("/videos/", express.static("./database_assets/video"));
|
||||||
|
app.use(ssrHandler);
|
||||||
|
app.use(express.static(publicPath));
|
||||||
|
|
||||||
// await catalog_assets.create({
|
// await catalog_assets.create({
|
||||||
// package_name: "koaku.fortnite.jpeg",
|
// package_name: "com.dababy.fortnite",
|
||||||
// title: "fortnite.jpeg",
|
// title: "fortnite.jpeg",
|
||||||
// image: "fortnite.jpg",
|
// image: "fortnite.jpg",
|
||||||
|
// author: "DaBaby LETS GOOOOOOOOOOOOOOOOOOOOOOO"
|
||||||
// version: "6.9.420",
|
// version: "6.9.420",
|
||||||
// description: "a man in a blessings shirt sticking his tounge out",
|
// description: "a man in a blessings shirt sticking his tounge out",
|
||||||
// tags: ["Fortnite", "Shit out my ass"],
|
// tags: ["Fortnite", "Shit out my ass"],
|
||||||
|
|
|
@ -11,18 +11,36 @@
|
||||||
{#await assetPromise}
|
{#await assetPromise}
|
||||||
Loading assets...
|
Loading assets...
|
||||||
{:then assets}
|
{:then assets}
|
||||||
<ul>
|
<div class="flex flex-row gap-6">
|
||||||
{#each Object.entries(assets) as [key, asset]}
|
{#each Object.entries(assets) as [key, asset]}
|
||||||
<div class="bg-bg-primary">
|
<a href={"/assets/" + key}>
|
||||||
<h2>{asset.title}</h2>
|
<div
|
||||||
<p>{asset.description}</p>
|
class="bg-navbar-color w-64 rounded-3xl shadow-lg overflow-hidden transition-transform duration-300 hover:scale-105"
|
||||||
<img src={"/images/" + asset.image} alt={asset.title} />
|
>
|
||||||
<p><strong>Tags:</strong> {asset.tags.join(", ")}</p>
|
<img
|
||||||
<p><strong>Version:</strong> {asset.version}</p>
|
src={"/images/" + asset.image}
|
||||||
<p><strong>Type:</strong> {asset.type}</p>
|
alt={asset.title}
|
||||||
</div>
|
class="w-full h-40 object-cover"
|
||||||
|
/>
|
||||||
|
<div class="p-6 text-sm">
|
||||||
|
<div class="font-semibold mb-2">
|
||||||
|
{asset.title}
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">{asset.description}</div>
|
||||||
|
<div>
|
||||||
|
<strong>Tags:</strong>
|
||||||
|
{asset.tags.join(", ")}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Version:</strong>
|
||||||
|
{asset.version}
|
||||||
|
</div>
|
||||||
|
<div><strong>Type:</strong> {asset.type}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</div>
|
||||||
{:catch someError}
|
{:catch someError}
|
||||||
System error: {someError.message}.
|
System error: {someError.message}.
|
||||||
{/await}
|
{/await}
|
||||||
|
|
|
@ -8,12 +8,17 @@ export function getStaticPaths() {
|
||||||
];
|
];
|
||||||
return STATIC_PATHS;
|
return STATIC_PATHS;
|
||||||
}
|
}
|
||||||
|
export const prerender = true;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Catalog">
|
<Layout title="Catalog">
|
||||||
<div>
|
<div
|
||||||
The Nebula Catalog is a place for you to find user-created themes and
|
class="flex flex-wrap mt-16 w-full fixed inset-0 h-[calc(100%-4rem)] z-0 bg-primary flex-col items-center"
|
||||||
plugins.
|
>
|
||||||
|
<div>
|
||||||
|
The Nebula Catalog is a place for you to find user-created themes and
|
||||||
|
plugins.
|
||||||
|
</div>
|
||||||
|
<CatalogCard client:only="svelte" />
|
||||||
</div>
|
</div>
|
||||||
<CatalogCard client:only="svelte" />
|
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
@ -7,6 +7,7 @@ export function getStaticPaths() {
|
||||||
];
|
];
|
||||||
return STATIC_PATHS;
|
return STATIC_PATHS;
|
||||||
}
|
}
|
||||||
|
export const prerender = true;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Chango Games">
|
<Layout title="Chango Games">
|
||||||
|
|
|
@ -9,7 +9,7 @@ export function getStaticPaths() {
|
||||||
];
|
];
|
||||||
return STATIC_PATHS;
|
return STATIC_PATHS;
|
||||||
}
|
}
|
||||||
|
export const prerender = true;
|
||||||
const lang = getLangFromUrl(Astro.url);
|
const lang = getLangFromUrl(Astro.url);
|
||||||
const t = useTranslations(lang);
|
const t = useTranslations(lang);
|
||||||
---
|
---
|
||||||
|
|
|
@ -16,6 +16,7 @@ export function getStaticPaths() {
|
||||||
];
|
];
|
||||||
return STATIC_PATHS;
|
return STATIC_PATHS;
|
||||||
}
|
}
|
||||||
|
export const prerender = true;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Settings">
|
<Layout title="Settings">
|
||||||
|
|
|
@ -13,6 +13,7 @@ export function getStaticPaths() {
|
||||||
];
|
];
|
||||||
return STATIC_PATHS;
|
return STATIC_PATHS;
|
||||||
}
|
}
|
||||||
|
export const prerender = true;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Settings">
|
<Layout title="Settings">
|
||||||
|
|
|
@ -13,6 +13,7 @@ export function getStaticPaths() {
|
||||||
];
|
];
|
||||||
return STATIC_PATHS;
|
return STATIC_PATHS;
|
||||||
}
|
}
|
||||||
|
export const prerender = true;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Settings">
|
<Layout title="Settings">
|
||||||
|
|
38
src/pages/assets/[...package_name].astro
Normal file
38
src/pages/assets/[...package_name].astro
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
const { package_name } = Astro.params;
|
||||||
|
import Layout from "../../layouts/Layout.astro";
|
||||||
|
const response = await fetch(
|
||||||
|
new URL("/api/packages/" + package_name, Astro.url)
|
||||||
|
);
|
||||||
|
const assets_json = await response.json();
|
||||||
|
---
|
||||||
|
|
||||||
|
<Layout title="Package">
|
||||||
|
<div
|
||||||
|
class="flex flex-wrap mt-16 w-full fixed inset-0 h-[calc(100%-4rem)] z-0 bg-primary flex-col items-center"
|
||||||
|
>
|
||||||
|
{
|
||||||
|
assets_json.error ? (
|
||||||
|
<h1 class="text-text-color text-3xl">
|
||||||
|
Unexpected error. Are you sure you typed the name right?
|
||||||
|
</h1>
|
||||||
|
) : (
|
||||||
|
<div class="flex flex-row items-center text-text-color">
|
||||||
|
<img
|
||||||
|
src={"/images/" + assets_json.image}
|
||||||
|
alt={assets_json.title}
|
||||||
|
class="w-96 h-72 object-cover rounded-xl"
|
||||||
|
/>
|
||||||
|
<div class="flex flex-col ml-7">
|
||||||
|
<div class="text-xl">{assets_json.type}</div>
|
||||||
|
<div class="text-3xl">{assets_json.title}</div>
|
||||||
|
<div class="text-xl">{assets_json.description}</div>
|
||||||
|
<button class="border-text-color border-2 rounded-lg w-40">
|
||||||
|
Install
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</Layout>
|
Loading…
Add table
Add a link
Reference in a new issue