mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-12 19:40:02 -04:00
Run a format
This commit is contained in:
parent
8d726133bc
commit
8f1feb8cff
36 changed files with 565 additions and 592 deletions
|
@ -1,13 +1,13 @@
|
|||
import { defineConfig } from "astro/config";
|
||||
import tailwind from "@astrojs/tailwind";
|
||||
import icon from "astro-icon";
|
||||
import svelte from "@astrojs/svelte";
|
||||
import node from "@astrojs/node";
|
||||
import svelte from "@astrojs/svelte";
|
||||
import tailwind from "@astrojs/tailwind";
|
||||
import { baremuxPath } from "@mercuryworkshop/bare-mux";
|
||||
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
|
||||
import { libcurlPath } from "@mercuryworkshop/libcurl-transport";
|
||||
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
||||
import icon from "astro-icon";
|
||||
import { defineConfig } from "astro/config";
|
||||
import { viteStaticCopy } from "vite-plugin-static-copy";
|
||||
import { baremuxPath } from '@mercuryworkshop/bare-mux';
|
||||
import { epoxyPath } from '@mercuryworkshop/epoxy-transport';
|
||||
import { libcurlPath } from '@mercuryworkshop/libcurl-transport';
|
||||
import { uvPath } from '@titaniumnetwork-dev/ultraviolet';
|
||||
export default defineConfig({
|
||||
integrations: [tailwind(), icon(), svelte()],
|
||||
vite: {
|
||||
|
@ -15,23 +15,23 @@ export default defineConfig({
|
|||
viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
src: `${uvPath}/**/*`.replace(/\\/g, '/'),
|
||||
dest: 'uv',
|
||||
src: `${uvPath}/**/*`.replace(/\\/g, "/"),
|
||||
dest: "uv",
|
||||
overwrite: false
|
||||
},
|
||||
{
|
||||
src: `${epoxyPath}/**/*`.replace(/\\/g, '/'),
|
||||
dest: 'epoxy',
|
||||
src: `${epoxyPath}/**/*`.replace(/\\/g, "/"),
|
||||
dest: "epoxy",
|
||||
overwrite: false
|
||||
},
|
||||
{
|
||||
src: `${libcurlPath}/**/*`.replace(/\\/g, '/'),
|
||||
dest: 'libcurl',
|
||||
src: `${libcurlPath}/**/*`.replace(/\\/g, "/"),
|
||||
dest: "libcurl",
|
||||
overwrite: false
|
||||
},
|
||||
{
|
||||
src: `${baremuxPath}/**/*`.replace(/\\/g, '/'),
|
||||
dest: 'baremux',
|
||||
src: `${baremuxPath}/**/*`.replace(/\\/g, "/"),
|
||||
dest: "baremux",
|
||||
overwrite: false
|
||||
}
|
||||
]
|
||||
|
@ -42,39 +42,39 @@ export default defineConfig({
|
|||
"/api/catalog-assets": {
|
||||
target: "http://localhost:8080/api/catalog-assets",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api\/catalog-assets/, ""),
|
||||
rewrite: (path) => path.replace(/^\/api\/catalog-assets/, "")
|
||||
},
|
||||
"/images": {
|
||||
target: "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/videos": {
|
||||
target: "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/wisp/" : {
|
||||
"/wisp/": {
|
||||
target: "ws://localhost:8080/wisp/",
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewrite: (path) => path.replace(/^\/wisp\//, '')
|
||||
rewrite: (path) => path.replace(/^\/wisp\//, "")
|
||||
},
|
||||
"/styles": {
|
||||
target: "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/api/packages": {
|
||||
target: "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
changeOrigin: true
|
||||
},
|
||||
"/api/catalog-pages": {
|
||||
target: "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
output: "server",
|
||||
adapter: node({
|
||||
mode: "hybrid",
|
||||
}),
|
||||
mode: "hybrid"
|
||||
})
|
||||
});
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "concurrently \"astro dev\" \"node server.js\"",
|
||||
"start": "astro dev",
|
||||
"start": "node server.js",
|
||||
"build": "astro check && astro build",
|
||||
"bstart": "astro build && node server.js",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
"astro": "astro",
|
||||
"format:code": "biome format . --write",
|
||||
"format:imports": "biome check . --write",
|
||||
"format": "concurrently -m 1 \"npm:format:code\" \"npm:format:imports\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.8.3",
|
||||
|
|
12
public/sw.js
12
public/sw.js
|
@ -1,10 +1,10 @@
|
|||
importScripts('/epoxy/index.js');
|
||||
importScripts('/libcurl/index.js');
|
||||
importScripts('/uv/uv.bundle.js');
|
||||
importScripts('/uv/uv.config.js');
|
||||
importScripts(__uv$config.sw || '/uv/uv.sw.js');
|
||||
importScripts("/epoxy/index.js");
|
||||
importScripts("/libcurl/index.js");
|
||||
importScripts("/uv/uv.bundle.js");
|
||||
importScripts("/uv/uv.config.js");
|
||||
importScripts(__uv$config.sw || "/uv/uv.sw.js");
|
||||
const uv = new UVServiceWorker();
|
||||
self.addEventListener('fetch', function (event) {
|
||||
self.addEventListener("fetch", function (event) {
|
||||
if (event.request.url.startsWith(location.origin + __uv$config.prefix)) {
|
||||
event.respondWith(
|
||||
(async function () {
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
self.__uv$config = {
|
||||
prefix: '/~/uv/',
|
||||
bare: '/bare/',
|
||||
prefix: "/~/uv/",
|
||||
bare: "/bare/",
|
||||
encodeUrl: function encode(str) {
|
||||
if (!str) return str;
|
||||
return encodeURIComponent(
|
||||
str
|
||||
.toString()
|
||||
.split('')
|
||||
.split("")
|
||||
.map((char, ind) => (ind % 2 ? String.fromCharCode(char.charCodeAt() ^ 3) : char))
|
||||
.join('')
|
||||
.join("")
|
||||
);
|
||||
},
|
||||
decodeUrl: function decode(str) {
|
||||
if (!str) return str;
|
||||
let [input, ...search] = str.split('?');
|
||||
let [input, ...search] = str.split("?");
|
||||
|
||||
return (
|
||||
decodeURIComponent(input)
|
||||
.split('')
|
||||
.split("")
|
||||
.map((char, ind) => (ind % 2 ? String.fromCharCode(char.charCodeAt(0) ^ 3) : char))
|
||||
.join('') + (search.length ? '?' + search.join('?') : '')
|
||||
.join("") + (search.length ? "?" + search.join("?") : "")
|
||||
);
|
||||
},
|
||||
handler: '/uv/uv.handler.js',
|
||||
client: '/uv/uv.client.js',
|
||||
bundle: '/uv/uv.bundle.js',
|
||||
config: '/uv/uv.config.js',
|
||||
sw: '/uv/uv.sw.js'
|
||||
handler: "/uv/uv.handler.js",
|
||||
client: "/uv/uv.client.js",
|
||||
bundle: "/uv/uv.bundle.js",
|
||||
config: "/uv/uv.config.js",
|
||||
sw: "/uv/uv.sw.js"
|
||||
};
|
||||
|
|
100
server.js
100
server.js
|
@ -1,12 +1,12 @@
|
|||
import express from "express";
|
||||
import fs from "fs";
|
||||
import { createServer } from "node:http";
|
||||
import path from "path";
|
||||
import wisp from "wisp-server-node";
|
||||
import { Sequelize, DataTypes } from "sequelize";
|
||||
import { fileURLToPath } from "url";
|
||||
import { handler as ssrHandler } from "./dist/server/entry.mjs";
|
||||
import express from "express";
|
||||
import multer from "multer";
|
||||
import fs from "fs";
|
||||
import { DataTypes, Sequelize } from "sequelize";
|
||||
import wisp from "wisp-server-node";
|
||||
import { handler as ssrHandler } from "./dist/server/entry.mjs";
|
||||
|
||||
const config = JSON.parse(fs.readFileSync("config.json", "utf8"));
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
@ -18,7 +18,7 @@ const sequelize = new Sequelize("database", "user", "password", {
|
|||
dialect: "sqlite",
|
||||
logging: false,
|
||||
// SQLite only
|
||||
storage: "database.sqlite",
|
||||
storage: "database.sqlite"
|
||||
});
|
||||
|
||||
// Auth middleware
|
||||
|
@ -43,7 +43,7 @@ var image_storage = multer.diskStorage({
|
|||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, file.originalname); //Appending extension
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var video_storage = multer.diskStorage({
|
||||
|
@ -52,7 +52,7 @@ var video_storage = multer.diskStorage({
|
|||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, file.originalname); //Appending extension
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var style_storage = multer.diskStorage({
|
||||
|
@ -61,7 +61,7 @@ var style_storage = multer.diskStorage({
|
|||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, file.originalname); //Appending extension
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var script_storage = multer.diskStorage({
|
||||
|
@ -70,7 +70,7 @@ var script_storage = multer.diskStorage({
|
|||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, file.originalname); //Appending extension
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var image_upload = multer({ storage: image_storage });
|
||||
|
@ -81,41 +81,41 @@ var script_upload = multer({ storage: script_storage });
|
|||
const catalog_assets = sequelize.define("catalog_assets", {
|
||||
package_name: {
|
||||
type: DataTypes.TEXT,
|
||||
unique: true,
|
||||
unique: true
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.TEXT,
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
description: {
|
||||
type: DataTypes.TEXT,
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
author: {
|
||||
type: DataTypes.TEXT,
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
image: {
|
||||
type: DataTypes.TEXT,
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
tags: {
|
||||
type: DataTypes.JSON,
|
||||
allowNull: true,
|
||||
allowNull: true
|
||||
},
|
||||
version: {
|
||||
type: DataTypes.TEXT,
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
background_image: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
allowNull: true
|
||||
},
|
||||
background_video: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
allowNull: true
|
||||
},
|
||||
payload: {
|
||||
type: DataTypes.TEXT,
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
type: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
type: DataTypes.TEXT
|
||||
}
|
||||
});
|
||||
|
||||
app.use(express.json());
|
||||
|
@ -142,7 +142,7 @@ app.get("/api/catalog-assets", async (request, reply) => {
|
|||
|
||||
const db_assets = await catalog_assets.findAll({
|
||||
offset: offset,
|
||||
limit: 20,
|
||||
limit: 20
|
||||
});
|
||||
|
||||
const assets = db_assets.reduce((acc, asset) => {
|
||||
|
@ -156,7 +156,7 @@ app.get("/api/catalog-assets", async (request, reply) => {
|
|||
background_image: asset.background_image,
|
||||
background_video: asset.background_video,
|
||||
payload: asset.payload,
|
||||
type: asset.type,
|
||||
type: asset.type
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
||||
|
@ -173,7 +173,7 @@ app.get("/api/packages/:package", async (request, reply) => {
|
|||
console.log(request.params.package);
|
||||
|
||||
const package_row = await catalog_assets.findOne({
|
||||
where: { package_name: request.params.package },
|
||||
where: { package_name: request.params.package }
|
||||
});
|
||||
|
||||
if (!package_row) {
|
||||
|
@ -190,7 +190,7 @@ app.get("/api/packages/:package", async (request, reply) => {
|
|||
background_image: package_row.get("background_image"),
|
||||
background_video: package_row.get("background_video"),
|
||||
payload: package_row.get("payload"),
|
||||
type: package_row.get("type"),
|
||||
type: package_row.get("type")
|
||||
};
|
||||
reply.send(details);
|
||||
} catch (error) {
|
||||
|
@ -200,11 +200,7 @@ app.get("/api/packages/:package", async (request, reply) => {
|
|||
|
||||
// This API is responsible for image uploads
|
||||
// PSK authentication required.
|
||||
app.post(
|
||||
"/api/upload-image",
|
||||
auth_psk,
|
||||
image_upload.single("file"),
|
||||
(req, res) => {
|
||||
app.post("/api/upload-image", auth_psk, image_upload.single("file"), (req, res) => {
|
||||
console.log("Request file:", req.file);
|
||||
|
||||
if (!req.file) {
|
||||
|
@ -214,64 +210,48 @@ app.post(
|
|||
console.log(req.file.originalname);
|
||||
res.json({
|
||||
message: "File uploaded successfully",
|
||||
filename: req.file.originalname,
|
||||
filename: req.file.originalname
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// This API is responsible for video uploads
|
||||
// PSK authentication required.
|
||||
app.post(
|
||||
"/api/upload-video",
|
||||
auth_psk,
|
||||
video_upload.single("file"),
|
||||
(req, res) => {
|
||||
app.post("/api/upload-video", auth_psk, video_upload.single("file"), (req, res) => {
|
||||
if (!req.file) {
|
||||
return res.status(400).json({ error: "No file uploaded" });
|
||||
}
|
||||
|
||||
res.json({
|
||||
message: "File uploaded successfully",
|
||||
filename: req.file.originalname,
|
||||
filename: req.file.originalname
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// This API is responsible for stylesheet uploads
|
||||
// PSK authentication required.
|
||||
app.post(
|
||||
"/api/upload-style",
|
||||
auth_psk,
|
||||
style_upload.single("file"),
|
||||
(req, res) => {
|
||||
app.post("/api/upload-style", auth_psk, style_upload.single("file"), (req, res) => {
|
||||
if (!req.file) {
|
||||
return res.status(400).json({ error: "No file uploaded" });
|
||||
}
|
||||
|
||||
res.json({
|
||||
message: "File uploaded successfully",
|
||||
filename: req.file.originalname,
|
||||
filename: req.file.originalname
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// This API is responsible for script/plugin uploads
|
||||
// PSK authentication required.
|
||||
app.post(
|
||||
"/api/upload-script",
|
||||
auth_psk,
|
||||
script_upload.single("file"),
|
||||
(req, res) => {
|
||||
app.post("/api/upload-script", auth_psk, script_upload.single("file"), (req, res) => {
|
||||
if (!req.file) {
|
||||
return res.status(400).json({ error: "No file uploaded" });
|
||||
}
|
||||
|
||||
res.json({
|
||||
message: "File uploaded successfully",
|
||||
filename: req.file.originalname,
|
||||
filename: req.file.originalname
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// This API is responsible for creating packages in the database.
|
||||
// PSK authentication required.
|
||||
|
@ -288,7 +268,7 @@ app.post("/api/create-package", auth_psk, async function (req, res) {
|
|||
payload: req.body.payload,
|
||||
background_video: req.body.background_video_path,
|
||||
background_image: req.body.background_image_path,
|
||||
type: req.body.type,
|
||||
type: req.body.type
|
||||
});
|
||||
res.send({ hello: "world" });
|
||||
});
|
||||
|
@ -342,5 +322,5 @@ server.on("upgrade", (req, socket, head) => {
|
|||
});
|
||||
|
||||
server.listen({
|
||||
port: 8080,
|
||||
port: 8080
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
import { Icon } from "astro-icon/components";
|
||||
import { getLangFromUrl, useTranslations } from "../i18n/utils";
|
||||
import { isMobileNavOpen } from "../store.js";
|
||||
import Logo from "./Logo.astro";
|
||||
import HeaderButton from "./HeaderButton.astro";
|
||||
import { Icon } from "astro-icon/components";
|
||||
import Logo from "./Logo.astro";
|
||||
|
||||
const lang = getLangFromUrl(Astro.url);
|
||||
const t = useTranslations(lang);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
import { Icon } from "astro-icon/components";
|
||||
import { getLangFromUrl, useTranslations } from "../i18n/utils";
|
||||
import HeaderButton from "./HeaderButton.astro";
|
||||
import { Icon } from "astro-icon/components";
|
||||
const lang = getLangFromUrl(Astro.url);
|
||||
const t = useTranslations(lang);
|
||||
---
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<script>
|
||||
export let page;
|
||||
let assetPromise = get_assets();
|
||||
async function get_assets() {
|
||||
export let page;
|
||||
let assetPromise = get_assets();
|
||||
async function get_assets() {
|
||||
const response = await fetch("/api/catalog-assets?page=" + page);
|
||||
const data = await response.json();
|
||||
return data.assets;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="text-3xl roboto font-bold text-text-color p-10">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
let assetPromise = get_all_assets();
|
||||
async function logItem(item) {
|
||||
let assetPromise = get_all_assets();
|
||||
async function logItem(item) {
|
||||
// hell
|
||||
try {
|
||||
const response = await fetch(`/api/packages/${item}`);
|
||||
|
@ -8,15 +8,15 @@
|
|||
|
||||
return {
|
||||
...data,
|
||||
package_name: item,
|
||||
package_name: item
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("error: failed to fetch", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function get_all_assets() {
|
||||
async function get_all_assets() {
|
||||
let items = JSON.parse(localStorage.getItem("installed_themes")) || [];
|
||||
const promises = items.map(logItem);
|
||||
const dataArray = await Promise.all(promises);
|
||||
|
@ -24,9 +24,9 @@
|
|||
const accumulatedData = dataArray.filter((data) => data !== null);
|
||||
console.log(JSON.stringify(accumulatedData));
|
||||
return accumulatedData;
|
||||
}
|
||||
}
|
||||
|
||||
function install(assets_json, package_name) {
|
||||
function install(assets_json, package_name) {
|
||||
if (assets_json.background_video) {
|
||||
localStorage.setItem("background_video", assets_json.background_video);
|
||||
} else {
|
||||
|
@ -41,16 +41,16 @@
|
|||
localStorage.setItem("stylesheet", "/styles/" + assets_json.payload);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function reset_theme() {
|
||||
function reset_theme() {
|
||||
localStorage.removeItem("background_video");
|
||||
localStorage.removeItem("background_image");
|
||||
localStorage.removeItem("stylesheet");
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function delete_theme(key) {
|
||||
function delete_theme(key) {
|
||||
let items = JSON.parse(localStorage.getItem("installed_themes")) || [];
|
||||
|
||||
const index = items.indexOf(key);
|
||||
|
@ -60,7 +60,7 @@
|
|||
localStorage.setItem("installed_themes", JSON.stringify(items));
|
||||
|
||||
reset_theme();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#await assetPromise}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<script lang="ts">
|
||||
import toast from 'svelte-french-toast';
|
||||
import { type ToastType, type Position, type Props } from "@utils/toast.ts";
|
||||
export let toastProp: Props;
|
||||
function handleToast(toastProp: Props) {
|
||||
switch(toastProp.toastType) {
|
||||
import { type Position, type Props, type ToastType } from "@utils/toast.ts";
|
||||
import toast from "svelte-french-toast";
|
||||
export let toastProp: Props;
|
||||
function handleToast(toastProp: Props) {
|
||||
switch (toastProp.toastType) {
|
||||
case "success":
|
||||
toast.success(toastProp.text, {
|
||||
style: 'background: var(--navbar-color); color: var(--input-text-color);',
|
||||
style: "background: var(--navbar-color); color: var(--input-text-color);",
|
||||
icon: toastProp.emoji,
|
||||
position: toastProp.position ?? 'bottom-right',
|
||||
position: toastProp.position ?? "bottom-right",
|
||||
duration: toastProp.duration
|
||||
});
|
||||
break;
|
||||
case "error":
|
||||
toast.error(toastProp.text, {
|
||||
style: 'background: var(--navbar-color); color: var(--input-text-color);',
|
||||
style: "background: var(--navbar-color); color: var(--input-text-color);",
|
||||
icon: toastProp.emoji,
|
||||
position: toastProp.position ?? 'bottom-right',
|
||||
position: toastProp.position ?? "bottom-right",
|
||||
duration: toastProp.duration
|
||||
});
|
||||
break;
|
||||
|
@ -25,17 +25,17 @@
|
|||
break;
|
||||
case "multiline":
|
||||
toast(toastProp.text, {
|
||||
style: 'background: var(--navbar-color); color: var(--input-text-color);',
|
||||
style: "background: var(--navbar-color); color: var(--input-text-color);",
|
||||
icon: toastProp.emoji,
|
||||
position: toastProp.position ?? 'bottom-right',
|
||||
position: toastProp.position ?? "bottom-right",
|
||||
duration: toastProp.duration
|
||||
})
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new Error("Something isn't right...");
|
||||
break
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- A hacky way to get this to be called. Just click this button (preferably via an EVENT) (see ../../utils/toast.ts) -->
|
||||
<button id={toastProp.id} class:invisible={'invisible'} class:hidden={'hidden'} class={toastProp.class} on:click={() => {return handleToast(toastProp)}}>Auto clicked for toast notifs</button>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { Toaster } from "svelte-french-toast";
|
||||
import { Toaster } from "svelte-french-toast";
|
||||
</script>
|
||||
|
||||
<div class="hidden" id="toastwrapper">
|
||||
|
|
|
@ -5,5 +5,5 @@ export const defaultLang = "en_US";
|
|||
|
||||
export const ui = {
|
||||
en_US,
|
||||
jp,
|
||||
jp
|
||||
};
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { ui, defaultLang } from "./ui";
|
||||
import { defaultLang, ui } from "./ui";
|
||||
|
||||
export const STATIC_PATHS = [
|
||||
{ params: { lang: "en_US" } },
|
||||
{ params: { lang: "jp" } },
|
||||
];
|
||||
export const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||
|
||||
export function getLangFromUrl(url: URL) {
|
||||
const [, lang] = url.pathname.split("/");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
import Header from "@components/Header.astro";
|
||||
import { ViewTransitions } from "astro:transitions";
|
||||
import Header from "@components/Header.astro";
|
||||
import MobileNavigation from "@components/MobileNavigation.astro";
|
||||
import SettingsLoader from '@components/settings/Loader.astro';
|
||||
import SettingsLoader from "@components/settings/Loader.astro";
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
---
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
export function getStaticPaths() {
|
||||
const STATIC_PATHS = [
|
||||
{ params: { lang: "en_US" } },
|
||||
{ params: { lang: "jp" } },
|
||||
];
|
||||
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||
return STATIC_PATHS;
|
||||
}
|
||||
export const prerender = true;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
---
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import Logo from "@components/Logo.astro";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
|
||||
export function getStaticPaths() {
|
||||
const STATIC_PATHS = [
|
||||
{ params: { lang: "en_US" } },
|
||||
{ params: { lang: "jp" } },
|
||||
];
|
||||
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||
return STATIC_PATHS;
|
||||
}
|
||||
export const prerender = true;
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
---
|
||||
import InstalledThemes from "@components/catalog/InstalledThemes.svelte";
|
||||
import ThemeCard from "@components/settings/ThemeCard.astro";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import SettingsLayout from "@layouts/SettingsLayout.astro";
|
||||
import SettingsSection from "@layouts/SettingsSection.astro";
|
||||
import { getLangFromUrl, useTranslations } from "../../../i18n/utils";
|
||||
import ThemeCard from "@components/settings/ThemeCard.astro";
|
||||
import { Icon } from "astro-icon/components";
|
||||
import fortnite from "../../../assets/fortnite.jpg";
|
||||
import ClassicNebula from "../../../assets/classic_theme.png";
|
||||
import InstalledThemes from "@components/catalog/InstalledThemes.svelte";
|
||||
import fortnite from "../../../assets/fortnite.jpg";
|
||||
import { getLangFromUrl, useTranslations } from "../../../i18n/utils";
|
||||
const lang = getLangFromUrl(Astro.url);
|
||||
const t = useTranslations(lang);
|
||||
export function getStaticPaths() {
|
||||
const STATIC_PATHS = [
|
||||
{ params: { lang: "en_US" } },
|
||||
{ params: { lang: "jp" } },
|
||||
];
|
||||
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||
return STATIC_PATHS;
|
||||
}
|
||||
export const prerender = true;
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
---
|
||||
import SettingsCard from "@components/settings/SettingsCard.astro";
|
||||
import Toast from "@components/toasts/Toast.svelte";
|
||||
import ToastWrapper from "@components/toasts/ToastWrapper.svelte";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import SettingsLayout from "@layouts/SettingsLayout.astro";
|
||||
import SettingsSection from "@layouts/SettingsSection.astro";
|
||||
import SettingsCard from "@components/settings/SettingsCard.astro";
|
||||
import ToastWrapper from "@components/toasts/ToastWrapper.svelte";
|
||||
import Toast from "@components/toasts/Toast.svelte";
|
||||
import { getLangFromUrl, useTranslations } from "../../../i18n/utils";
|
||||
|
||||
const lang = getLangFromUrl(Astro.url);
|
||||
const t = useTranslations(lang);
|
||||
export function getStaticPaths() {
|
||||
const STATIC_PATHS = [
|
||||
{ params: { lang: "en_US" } },
|
||||
{ params: { lang: "jp" } },
|
||||
];
|
||||
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||
return STATIC_PATHS;
|
||||
}
|
||||
export const prerender = true;
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
---
|
||||
import SettingsCard from "@components/settings/SettingsCard.astro";
|
||||
import Toast from "@components/toasts/Toast.svelte";
|
||||
import ToastWrapper from "@components/toasts/ToastWrapper.svelte";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import SettingsLayout from "@layouts/SettingsLayout.astro";
|
||||
import SettingsSection from "@layouts/SettingsSection.astro";
|
||||
import SettingsCard from "@components/settings/SettingsCard.astro";
|
||||
import ToastWrapper from "@components/toasts/ToastWrapper.svelte";
|
||||
import Toast from "@components/toasts/Toast.svelte";
|
||||
import { getLangFromUrl, useTranslations } from "../../../i18n/utils";
|
||||
const lang = getLangFromUrl(Astro.url);
|
||||
const t = useTranslations(lang);
|
||||
export function getStaticPaths() {
|
||||
const STATIC_PATHS = [
|
||||
{ params: { lang: "en_US" } },
|
||||
{ params: { lang: "jp" } },
|
||||
];
|
||||
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||
return STATIC_PATHS;
|
||||
}
|
||||
export const prerender = true;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
const { package_name } = Astro.params;
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
const response = await fetch(
|
||||
new URL("/api/packages/" + package_name, Astro.url)
|
||||
);
|
||||
const response = await fetch(new URL("/api/packages/" + package_name, Astro.url));
|
||||
const assets_json = await response.json();
|
||||
---
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import CatalogCard from "@components/catalog/CatalogCard.svelte";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import Pagnation from "./pagnation.astro";
|
||||
|
||||
const { page } = Astro.params;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import Card from "@components/Card.astro";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
---
|
||||
|
||||
loading...
|
||||
|
|
|
@ -1,49 +1,53 @@
|
|||
import { WispServerURLS, Settings } from "./settings";
|
||||
import { Settings, WispServerURLS } from "./settings";
|
||||
function loadProxyScripts() {
|
||||
//wrap everything in a promise to avoid race conditions
|
||||
return new Promise<void>((resolve) => {
|
||||
//create and append then scripts tags to the body (this is how we lazy load things)
|
||||
const epoxyScript = document.createElement('script');
|
||||
epoxyScript.src = '/epoxy/index.js';
|
||||
const epoxyScript = document.createElement("script");
|
||||
epoxyScript.src = "/epoxy/index.js";
|
||||
epoxyScript.defer = true;
|
||||
document.body.appendChild(epoxyScript);
|
||||
const libCurlScript = document.createElement('script');
|
||||
libCurlScript.src = '/libcurl/index.js';
|
||||
const libCurlScript = document.createElement("script");
|
||||
libCurlScript.src = "/libcurl/index.js";
|
||||
libCurlScript.defer = true;
|
||||
document.body.appendChild(libCurlScript);
|
||||
const uvBundle = document.createElement('script');
|
||||
uvBundle.src = '/uv/uv.bundle.js';
|
||||
const uvBundle = document.createElement("script");
|
||||
uvBundle.src = "/uv/uv.bundle.js";
|
||||
uvBundle.defer = true;
|
||||
document.body.appendChild(uvBundle);
|
||||
const uvConfig = document.createElement('script');
|
||||
uvConfig.src = '/uv/uv.config.js';
|
||||
const uvConfig = document.createElement("script");
|
||||
uvConfig.src = "/uv/uv.config.js";
|
||||
uvConfig.defer = true;
|
||||
document.body.appendChild(uvConfig);
|
||||
const bareMux = document.createElement('script');
|
||||
bareMux.src = '/baremux/bare.cjs';
|
||||
const bareMux = document.createElement("script");
|
||||
bareMux.src = "/baremux/bare.cjs";
|
||||
bareMux.defer = true;
|
||||
document.body.appendChild(bareMux);
|
||||
const checkScripts = setInterval(() => {
|
||||
//If both of these aren't defined this will repeat until they are
|
||||
//this allows use to wait for all of the scripts to be ready *before* we setup the serviceworker
|
||||
if (typeof EpxMod !== 'undefined' && typeof BareMux !== 'undefined') {
|
||||
if (typeof EpxMod !== "undefined" && typeof BareMux !== "undefined") {
|
||||
clearInterval(checkScripts);
|
||||
resolve();
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function setTransport(transport?: string) {
|
||||
//wrap in a promise so we don't register sw until a transport is set.
|
||||
const wispServer = localStorage.getItem(Settings.ProxySettings.wispServerURL);
|
||||
return new Promise<void>((resolve) => {
|
||||
switch(transport) {
|
||||
switch (transport) {
|
||||
case "epoxy":
|
||||
BareMux.SetTransport("EpxMod.EpoxyClient", { wisp: wispServer ? WispServerURLS[wispServer] : WispServerURLS.default });
|
||||
BareMux.SetTransport("EpxMod.EpoxyClient", {
|
||||
wisp: wispServer ? WispServerURLS[wispServer] : WispServerURLS.default
|
||||
});
|
||||
break;
|
||||
case "libcurl":
|
||||
BareMux.SetTransport("CurlMod.LibcurlClient", { wisp: wispServer? WispServerURLS[wispServer]: WispServerURLS.default});
|
||||
BareMux.SetTransport("CurlMod.LibcurlClient", {
|
||||
wisp: wispServer ? WispServerURLS[wispServer] : WispServerURLS.default
|
||||
});
|
||||
break;
|
||||
}
|
||||
resolve();
|
||||
|
@ -53,15 +57,15 @@ function setTransport(transport?: string) {
|
|||
function initSw() {
|
||||
//this is wrapped in a promise to mostly solve the bare-mux v1 problems
|
||||
return new Promise<void>((resolve) => {
|
||||
if ('serviceWorker' in navigator) {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready.then(async () => {
|
||||
console.debug('Service worker ready!');
|
||||
console.debug("Service worker ready!");
|
||||
await loadProxyScripts();
|
||||
resolve();
|
||||
});
|
||||
navigator.serviceWorker.register('/sw.js', { scope: '/' });
|
||||
navigator.serviceWorker.register("/sw.js", { scope: "/" });
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export { initSw, setTransport }
|
||||
export { initSw, setTransport };
|
||||
|
|
|
@ -12,7 +12,7 @@ function search(input: string, template: string) {
|
|||
// eg: example.com, https://example.com/test?q=param
|
||||
const url = new URL(`http://${input}`);
|
||||
// only if the hostname has a TLD/subdomain
|
||||
if (url.hostname.includes('.')) return url.toString();
|
||||
if (url.hostname.includes(".")) return url.toString();
|
||||
} catch (err) {
|
||||
// input was not valid URL
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ function search(input: string, template: string) {
|
|||
|
||||
// Attempts to convert the input to a fully qualified URL have failed
|
||||
// Treat the input as a search query
|
||||
return template.replace('%s', encodeURIComponent(input));
|
||||
return template.replace("%s", encodeURIComponent(input));
|
||||
}
|
||||
|
||||
export { search }
|
||||
export { search };
|
||||
|
|
|
@ -3,47 +3,47 @@ const wispUrl = (location.protocol === "https:" ? "wss://" : "ws://") + location
|
|||
const TabSettings = {
|
||||
tabCloak: "nebula||tabCloak",
|
||||
abblob: "nebula||abBlob"
|
||||
}
|
||||
};
|
||||
const ProxySettings = {
|
||||
proxy: "nebula||proxy",
|
||||
openIn: "nebula||open",
|
||||
searchEngine: "nebula||searchEngine",
|
||||
wispServerURL: 'nebula||wisp',
|
||||
transport: 'nebula||transport'
|
||||
}
|
||||
wispServerURL: "nebula||wisp",
|
||||
transport: "nebula||transport"
|
||||
};
|
||||
const Settings = {
|
||||
TabSettings,
|
||||
ProxySettings
|
||||
}
|
||||
};
|
||||
|
||||
type TabCloaks = "default" | "google" | "wikipedia" | "canvas" | "classroom" | "powerschool";
|
||||
type AbCloaks = "a:b" | "blob";
|
||||
type OpenIn = 'a:b' | 'blob' | 'direct' | 'embed';
|
||||
type OpenIn = "a:b" | "blob" | "direct" | "embed";
|
||||
type Proxy = "automatic" | "uv" | "rh";
|
||||
type Transport = "epoxy" | "libcurl";
|
||||
const SearchEngines: Record<string, string> = {
|
||||
ddg: "https://duckduckgo.com/?q=%s",
|
||||
google: "https://google.com/search?q=%s",
|
||||
bing: "https://bing.com/search?q=%s"
|
||||
}
|
||||
};
|
||||
type SearchEngine = "ddg" | "google" | "bing";
|
||||
const WispServerURLS: Record<string, string> = {
|
||||
'default': wispUrl,
|
||||
'ruby': 'wss://ruby.rubynetwork.co/wisp/'
|
||||
}
|
||||
default: wispUrl,
|
||||
ruby: "wss://ruby.rubynetwork.co/wisp/"
|
||||
};
|
||||
|
||||
function cloak(cloak: AbCloaks | string, redirect: string, url: string) {
|
||||
switch(cloak) {
|
||||
switch (cloak) {
|
||||
case "a:b":
|
||||
window.location.replace(redirect);
|
||||
const win = window.open();
|
||||
win!.document.body.style.margin = '0';
|
||||
win!.document.body.style.height = '100vh';
|
||||
const iframe = win!.document.createElement('iframe');
|
||||
iframe.style.border = 'none';
|
||||
iframe.style.width = '100%';
|
||||
iframe.style.height = '100%';
|
||||
iframe.style.margin = '0';
|
||||
win!.document.body.style.margin = "0";
|
||||
win!.document.body.style.height = "100vh";
|
||||
const iframe = win!.document.createElement("iframe");
|
||||
iframe.style.border = "none";
|
||||
iframe.style.width = "100%";
|
||||
iframe.style.height = "100%";
|
||||
iframe.style.margin = "0";
|
||||
iframe.src = url;
|
||||
win!.document.body.appendChild(iframe);
|
||||
break;
|
||||
|
@ -62,18 +62,18 @@ function cloak(cloak: AbCloaks | string, redirect: string, url: string) {
|
|||
</html>
|
||||
`;
|
||||
window.location.replace("https://google.com");
|
||||
const blob = new Blob([htmlContent], { type: 'text/html' });
|
||||
const blob = new Blob([htmlContent], { type: "text/html" });
|
||||
const blobURL = URL.createObjectURL(blob);
|
||||
window.open(blobURL, '_blank');
|
||||
window.open(blobURL, "_blank");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const tabSettings = {
|
||||
cloakTab: function(cloak: TabCloaks | string) {
|
||||
cloakTab: function (cloak: TabCloaks | string) {
|
||||
const faviconElement = document.getElementById("favicon") as HTMLLinkElement;
|
||||
localStorage.setItem(Settings.TabSettings.tabCloak, cloak);
|
||||
switch(cloak) {
|
||||
switch (cloak) {
|
||||
case "google":
|
||||
document.title = "Google";
|
||||
faviconElement.href = "/cloaks/google.png";
|
||||
|
@ -102,28 +102,28 @@ const tabSettings = {
|
|||
return;
|
||||
}
|
||||
},
|
||||
abCloak: function(type: AbCloaks | string) {
|
||||
abCloak: function (type: AbCloaks | string) {
|
||||
localStorage.setItem(Settings.TabSettings.abblob, type);
|
||||
cloak(type as AbCloaks, 'https://google.com', window.location.href);
|
||||
cloak(type as AbCloaks, "https://google.com", window.location.href);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const proxySettings = {
|
||||
changeProxy: function(proxy: Proxy | string) {
|
||||
changeProxy: function (proxy: Proxy | string) {
|
||||
localStorage.setItem(Settings.ProxySettings.proxy, proxy);
|
||||
},
|
||||
openIn: function(type: OpenIn | string) {
|
||||
openIn: function (type: OpenIn | string) {
|
||||
localStorage.setItem(Settings.ProxySettings.openIn, type);
|
||||
},
|
||||
setSearchEngine: function(searchEngine: SearchEngine | string) {
|
||||
setSearchEngine: function (searchEngine: SearchEngine | string) {
|
||||
localStorage.setItem(Settings.ProxySettings.searchEngine, searchEngine);
|
||||
},
|
||||
setWispURL: function(server: string) {
|
||||
setWispURL: function (server: string) {
|
||||
localStorage.setItem(Settings.ProxySettings.wispServerURL, server);
|
||||
},
|
||||
setTransport: function(transport: Transport | string) {
|
||||
setTransport: function (transport: Transport | string) {
|
||||
localStorage.setItem(Settings.ProxySettings.transport, transport);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { tabSettings, proxySettings, Settings, WispServerURLS, SearchEngines, cloak }
|
||||
export { tabSettings, proxySettings, Settings, WispServerURLS, SearchEngines, cloak };
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
type ToastType = "success" | "error" | "multiline";
|
||||
type Position = "top-left" | "top-middle" | "top-right" | "bottom-left" | "bottom-right" | "bottom-center";
|
||||
type Position =
|
||||
| "top-left"
|
||||
| "top-middle"
|
||||
| "top-right"
|
||||
| "bottom-left"
|
||||
| "bottom-right"
|
||||
| "bottom-center";
|
||||
interface Props {
|
||||
toastType: ToastType;
|
||||
text: string;
|
||||
|
@ -19,4 +25,4 @@ function toast(query: string) {
|
|||
element.click();
|
||||
}
|
||||
|
||||
export { type ToastType, type Position, type Props, toast }
|
||||
export { type ToastType, type Position, type Props, toast };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { vitePreprocess } from '@astrojs/svelte';
|
||||
import { vitePreprocess } from "@astrojs/svelte";
|
||||
|
||||
export default {
|
||||
preprocess: vitePreprocess(),
|
||||
}
|
||||
preprocess: vitePreprocess()
|
||||
};
|
||||
|
|
|
@ -13,9 +13,9 @@ export default {
|
|||
"input-text": "var(--input-text-color)",
|
||||
"input-border-color": "var(--input-border-color)",
|
||||
"dropdown-option-hover-color": "var(--dropdown-option-hover-color)",
|
||||
"border-color": "var(--border-color)",
|
||||
"border-color": "var(--border-color)"
|
||||
},
|
||||
extend: {},
|
||||
extend: {}
|
||||
},
|
||||
plugins: [],
|
||||
plugins: []
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// This is a test file to upload files to the Nebula server
|
||||
import { FormData, File } from "formdata-node";
|
||||
import { fileFromPath } from "formdata-node/file-from-path";
|
||||
import fs from "fs";
|
||||
// This is a test file to upload files to the Nebula server
|
||||
import { File, FormData } from "formdata-node";
|
||||
import { fileFromPath } from "formdata-node/file-from-path";
|
||||
|
||||
const config = JSON.parse(fs.readFileSync("config.json", "utf8"));
|
||||
const form = new FormData();
|
||||
|
@ -13,8 +13,8 @@ console.log(config.marketplace_psk);
|
|||
console.log(form);
|
||||
await fetch("http://localhost:8080/api/upload-image", {
|
||||
headers: {
|
||||
PSK: config.marketplace_psk,
|
||||
PSK: config.marketplace_psk
|
||||
},
|
||||
method: "post",
|
||||
body: form,
|
||||
body: form
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"paths": {
|
||||
"@components/*": ["src/components/*"],
|
||||
"@layouts/*": ["src/layouts/*"],
|
||||
"@utils/*" : ["src/utils/*"]
|
||||
"@utils/*": ["src/utils/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue