Chore: format

This commit is contained in:
MotorTruck1221 2024-10-12 02:19:02 -06:00
parent a68f0c7e42
commit 8cb2513610
No known key found for this signature in database
GPG key ID: 08F417E2B8B61EA4
10 changed files with 200 additions and 172 deletions

View file

@ -1,19 +1,19 @@
:root {
--background-primary: rgba(0, 0, 0, 0) ;
--background-lighter: #000 ;
--navbar-color: #000 ;
--navbar-height: 60px ;
--navbar-text-color: greenyellow ;
--navbar-link-color: greenyellow ;
--navbar-link-hover-color: green ;
--navbar-font: "Roboto" ;
--input-text-color: greenyellow ;
--input-placeholder-color: white ;
--input-background-color: #000 ;
--input-border-color: greenyellow ;
--input-border-size: 1.3px ;
--navbar-logo-filter: none ;
--dropdown-option-hover-color: #312a49 ;
--tab-color: var(--black) ;
--border-color: greenyellow ;
--background-primary: rgba(0, 0, 0, 0);
--background-lighter: #000;
--navbar-color: #000;
--navbar-height: 60px;
--navbar-text-color: greenyellow;
--navbar-link-color: greenyellow;
--navbar-link-hover-color: green;
--navbar-font: "Roboto";
--input-text-color: greenyellow;
--input-placeholder-color: white;
--input-background-color: #000;
--input-border-color: greenyellow;
--input-border-size: 1.3px;
--navbar-logo-filter: none;
--dropdown-option-hover-color: #312a49;
--tab-color: var(--black);
--border-color: greenyellow;
}

View file

@ -299,11 +299,11 @@ app.use(express.static(publicPath));
// image: "cyber_monay.jpg",
// author: "Nebula Services",
// version: "1.0.0",
// description: 'A parody of the famous "Cyber Monay" hack!',
// tags: ["Hacking", "Animated", "Funny"],
// payload: "com.nebula.cybermonay.css",
// background_video: "cyber_monay_test.mp4",
//type: "theme",
// description: 'A parody of the famous "Cyber Monay" hack!',
// tags: ["Hacking", "Animated", "Funny"],
// payload: "com.nebula.cybermonay.css",
// background_video: "cyber_monay_test.mp4",
//type: "theme",
//});
// await catalog_assets.create({

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { Settings } from "@utils/settings/index";
import { Suspense } from "@svelte-drama/suspense";
import { Settings } from "@utils/settings/index";
export let page;
async function getAssets() {
const response = await fetch("/api/catalog-assets?page=" + page);

View file

@ -1,30 +1,30 @@
<script lang="ts">
import { Suspense } from "@svelte-drama/suspense";
import { Settings, settings } from '@utils/settings/index';
import Parent from "./Parent.svelte";
async function getItem(item) {
try {
const response = await fetch(`/api/packages/${item}`);
const data = await response.json();
return {
...data,
package_name: item
};
} catch (error) {
console.error("error: failed to fetch", error);
return null;
}
}
async function getAssets() {
const items = JSON.parse(localStorage.getItem(Settings.AppearanceSettings.themes)) || [];
const promises = items.map(getItem);
const dataArray = await Promise.all(promises);
const accumulatedData = dataArray.filter((data) => data !== null);
console.log(JSON.stringify(accumulatedData));
return accumulatedData;
}
let assets = getAssets();
let compRef = [];
import { Suspense } from "@svelte-drama/suspense";
import { Settings, settings } from "@utils/settings/index";
import Parent from "./Parent.svelte";
async function getItem(item) {
try {
const response = await fetch(`/api/packages/${item}`);
const data = await response.json();
return {
...data,
package_name: item
};
} catch (error) {
console.error("error: failed to fetch", error);
return null;
}
}
async function getAssets() {
const items = JSON.parse(localStorage.getItem(Settings.AppearanceSettings.themes)) || [];
const promises = items.map(getItem);
const dataArray = await Promise.all(promises);
const accumulatedData = dataArray.filter((data) => data !== null);
console.log(JSON.stringify(accumulatedData));
return accumulatedData;
}
let assets = getAssets();
let compRef = [];
</script>
<Suspense let:suspend>
<div class="rounded-3xl bg-navbar-color w-64 flex flex-col cursor-pointer">

View file

@ -4,8 +4,8 @@ import Header from "@components/Header.astro";
import MobileNavigation from "@components/MobileNavigation.astro";
import SettingsLoader from "@components/settings/Loader.astro";
interface Props {
title: string;
noHeader?: string;
title: string;
noHeader?: string;
}
const { title, noHeader } = Astro.props;

View file

@ -1,6 +1,6 @@
---
import Layout from "@layouts/Layout.astro";
import Loading from "@components/Loading.astro";
import Layout from "@layouts/Layout.astro";
---
<Layout title="Loading..." noHeader="true">

View file

@ -1,8 +1,20 @@
//Combine all of the other settings into one object. And export that (along with types and other things)
import { AppearanceSettings, marketPlaceSettings } from "./marketplace";
import { TabSettings, tabSettings, cloak } from "./tab";
import { ProxySettings, proxySettings } from "./proxy";
import { type TabCloaks, type AbCloaks, type OpenIn, type Proxy, type Transport, type PackageType, type Package, SearchEngines, type SearchEngine, WispServerURLS, wispUrl } from "./types";
import { TabSettings, cloak, tabSettings } from "./tab";
import {
type AbCloaks,
type OpenIn,
type Package,
type PackageType,
type Proxy,
type SearchEngine,
SearchEngines,
type TabCloaks,
type Transport,
WispServerURLS,
wispUrl
} from "./types";
const Settings = {
AppearanceSettings,
@ -11,25 +23,25 @@ const Settings = {
};
const settings = {
marketPlaceSettings,
tabSettings,
proxySettings
}
marketPlaceSettings,
tabSettings,
proxySettings
};
//export all of the stuffs
export {
Settings,
settings,
SearchEngines,
WispServerURLS,
wispUrl,
cloak,
type TabCloaks,
type AbCloaks,
type OpenIn,
type Proxy,
type Transport,
type PackageType,
type Package,
type SearchEngine
}
Settings,
settings,
SearchEngines,
WispServerURLS,
wispUrl,
cloak,
type TabCloaks,
type AbCloaks,
type OpenIn,
type Proxy,
type Transport,
type PackageType,
type Package,
type SearchEngine
};

View file

@ -1,98 +1,102 @@
//marketplace code & handlers
import { type Package, type PackageType } from "./types";
const AppearanceSettings = {
themes: "nebula||themes",
stylePayload: "nebula||stylepayload",
video: "nebula||video",
image: "nebula||image"
}
themes: "nebula||themes",
stylePayload: "nebula||stylepayload",
video: "nebula||video",
image: "nebula||image"
};
const marketPlaceSettings = {
install: function(p: Package, packageName: string, payload?: any) {
return new Promise<void>((resolve) => {
if (p.theme) {
let themes = localStorage.getItem(AppearanceSettings.themes) as any;
themes ? themes = JSON.parse(themes) : themes = [];
if (!themes.find((theme: any) => theme === packageName)) {
themes.push(packageName);
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(themes));
this.changeTheme(false, payload, p.theme.video, p.theme.bgImage);
}
resolve();
}
});
},
uninstall: function(p: PackageType, packageName: string) {
return new Promise<void>((resolve) => {
if (p === "theme") {
let items = localStorage.getItem(AppearanceSettings.themes) as any;
items ? items = JSON.parse(items) : items = [];
if (items.find((theme: any) => theme === packageName)) {
const idx = items.indexOf(packageName);
items.splice(idx, 1);
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(items));
this.changeTheme(true);
}
resolve();
}
});
},
changeTheme: async function(reset: Boolean, payload?: any, videoSource?: string, bgSource?: string) {
async function resetCSS() {
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
localStorage.removeItem(AppearanceSettings.stylePayload);
stylesheet.href = "/nebula.css";
const marketPlaceSettings = {
install: function (p: Package, packageName: string, payload?: any) {
return new Promise<void>((resolve) => {
if (p.theme) {
let themes = localStorage.getItem(AppearanceSettings.themes) as any;
themes ? (themes = JSON.parse(themes)) : (themes = []);
if (!themes.find((theme: any) => theme === packageName)) {
themes.push(packageName);
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(themes));
this.changeTheme(false, payload, p.theme.video, p.theme.bgImage);
}
function resetVideo() {
localStorage.removeItem(AppearanceSettings.video);
const source = document.getElementById('nebulaVideo')! as HTMLVideoElement;
source.src = "";
}
function resetBGImage() {
localStorage.removeItem(AppearanceSettings.image);
const image = document.getElementById("nebulaImage")! as HTMLImageElement;
image.style.display = "none";
image.src = "";
}
if (reset === true) {
await resetCSS();
await resetCSS();
resetBGImage();
resetVideo();
}
if (videoSource || localStorage.getItem(AppearanceSettings.video)) {
resetBGImage();
resetVideo();
const source = document.getElementById("nebulaVideo")! as HTMLVideoElement;
if (!localStorage.getItem(AppearanceSettings.video)) {
localStorage.setItem(AppearanceSettings.video, videoSource as string);
}
source.src = `/videos/${videoSource ? videoSource : localStorage.getItem(AppearanceSettings.video)}`
}
if (bgSource || localStorage.getItem(AppearanceSettings.image)) {
resetVideo();
resetBGImage();
const image = document.getElementById("nebulaImage")! as HTMLImageElement;
if (!localStorage.getItem(AppearanceSettings.image)) {
localStorage.setItem(AppearanceSettings.image, bgSource as string);
}
image.style.display = "block";
image.src = `/images/${bgSource ? bgSource : localStorage.getItem(AppearanceSettings.image)}`
}
if (payload) {
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
if (localStorage.getItem(AppearanceSettings.stylePayload) !== payload) {
localStorage.setItem(AppearanceSettings.stylePayload, payload);
}
stylesheet.href = `/styles/${localStorage.getItem(AppearanceSettings.stylePayload)}`;
}
else {
if (localStorage.getItem(AppearanceSettings.stylePayload)) {
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
stylesheet.href = `/styles/${localStorage.getItem(AppearanceSettings.stylePayload)}`;
}
resolve();
}
});
},
uninstall: function (p: PackageType, packageName: string) {
return new Promise<void>((resolve) => {
if (p === "theme") {
let items = localStorage.getItem(AppearanceSettings.themes) as any;
items ? (items = JSON.parse(items)) : (items = []);
if (items.find((theme: any) => theme === packageName)) {
const idx = items.indexOf(packageName);
items.splice(idx, 1);
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(items));
this.changeTheme(true);
}
resolve();
}
});
},
changeTheme: async function (
reset: Boolean,
payload?: any,
videoSource?: string,
bgSource?: string
) {
async function resetCSS() {
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
localStorage.removeItem(AppearanceSettings.stylePayload);
stylesheet.href = "/nebula.css";
}
}
function resetVideo() {
localStorage.removeItem(AppearanceSettings.video);
const source = document.getElementById("nebulaVideo")! as HTMLVideoElement;
source.src = "";
}
function resetBGImage() {
localStorage.removeItem(AppearanceSettings.image);
const image = document.getElementById("nebulaImage")! as HTMLImageElement;
image.style.display = "none";
image.src = "";
}
if (reset === true) {
await resetCSS();
await resetCSS();
resetBGImage();
resetVideo();
}
if (videoSource || localStorage.getItem(AppearanceSettings.video)) {
resetBGImage();
resetVideo();
const source = document.getElementById("nebulaVideo")! as HTMLVideoElement;
if (!localStorage.getItem(AppearanceSettings.video)) {
localStorage.setItem(AppearanceSettings.video, videoSource as string);
}
source.src = `/videos/${videoSource ? videoSource : localStorage.getItem(AppearanceSettings.video)}`;
}
if (bgSource || localStorage.getItem(AppearanceSettings.image)) {
resetVideo();
resetBGImage();
const image = document.getElementById("nebulaImage")! as HTMLImageElement;
if (!localStorage.getItem(AppearanceSettings.image)) {
localStorage.setItem(AppearanceSettings.image, bgSource as string);
}
image.style.display = "block";
image.src = `/images/${bgSource ? bgSource : localStorage.getItem(AppearanceSettings.image)}`;
}
if (payload) {
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
if (localStorage.getItem(AppearanceSettings.stylePayload) !== payload) {
localStorage.setItem(AppearanceSettings.stylePayload, payload);
}
stylesheet.href = `/styles/${localStorage.getItem(AppearanceSettings.stylePayload)}`;
} else {
if (localStorage.getItem(AppearanceSettings.stylePayload)) {
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
stylesheet.href = `/styles/${localStorage.getItem(AppearanceSettings.stylePayload)}`;
}
}
}
};
export { AppearanceSettings, marketPlaceSettings };

View file

@ -1,5 +1,5 @@
//Proxy specific settings.
import { type Proxy, type OpenIn, type SearchEngine, type Transport } from "./types";
import { type OpenIn, type Proxy, type SearchEngine, type Transport } from "./types";
const ProxySettings = {
proxy: "nebula||proxy",
openIn: "nebula||open",

View file

@ -3,15 +3,15 @@ type TabCloaks = "default" | "google" | "wikipedia" | "canvas" | "classroom" | "
type AbCloaks = "a:b" | "blob";
type OpenIn = "a:b" | "blob" | "direct" | "embed";
type Proxy = "automatic" | "uv" | "rh";
type Transport = "epoxy" | "libcurl";
type PackageType = "theme" | "plugin"
type Transport = "epoxy" | "libcurl";
type PackageType = "theme" | "plugin";
interface Package {
theme?: {
payload: string,
video?: string
bgImage?: string
}
plugin?: {}
theme?: {
payload: string;
video?: string;
bgImage?: string;
};
plugin?: {};
}
const SearchEngines: Record<string, string> = {
ddg: "https://duckduckgo.com/?q=%s",
@ -24,4 +24,16 @@ const WispServerURLS: Record<string, string> = {
ruby: "wss://ruby.rubynetwork.co/wisp/"
};
export { type TabCloaks, type AbCloaks, type OpenIn, type Proxy, type Transport, type PackageType, type Package, SearchEngines, type SearchEngine, WispServerURLS, wispUrl }
export {
type TabCloaks,
type AbCloaks,
type OpenIn,
type Proxy,
type Transport,
type PackageType,
type Package,
SearchEngines,
type SearchEngine,
WispServerURLS,
wispUrl
};