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