mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-13 03:50:02 -04:00
Chore: format
This commit is contained in:
parent
a68f0c7e42
commit
8cb2513610
10 changed files with 200 additions and 172 deletions
|
@ -1,19 +1,19 @@
|
||||||
:root {
|
:root {
|
||||||
--background-primary: rgba(0, 0, 0, 0) ;
|
--background-primary: rgba(0, 0, 0, 0);
|
||||||
--background-lighter: #000 ;
|
--background-lighter: #000;
|
||||||
--navbar-color: #000 ;
|
--navbar-color: #000;
|
||||||
--navbar-height: 60px ;
|
--navbar-height: 60px;
|
||||||
--navbar-text-color: greenyellow ;
|
--navbar-text-color: greenyellow;
|
||||||
--navbar-link-color: greenyellow ;
|
--navbar-link-color: greenyellow;
|
||||||
--navbar-link-hover-color: green ;
|
--navbar-link-hover-color: green;
|
||||||
--navbar-font: "Roboto" ;
|
--navbar-font: "Roboto";
|
||||||
--input-text-color: greenyellow ;
|
--input-text-color: greenyellow;
|
||||||
--input-placeholder-color: white ;
|
--input-placeholder-color: white;
|
||||||
--input-background-color: #000 ;
|
--input-background-color: #000;
|
||||||
--input-border-color: greenyellow ;
|
--input-border-color: greenyellow;
|
||||||
--input-border-size: 1.3px ;
|
--input-border-size: 1.3px;
|
||||||
--navbar-logo-filter: none ;
|
--navbar-logo-filter: none;
|
||||||
--dropdown-option-hover-color: #312a49 ;
|
--dropdown-option-hover-color: #312a49;
|
||||||
--tab-color: var(--black) ;
|
--tab-color: var(--black);
|
||||||
--border-color: greenyellow ;
|
--border-color: greenyellow;
|
||||||
}
|
}
|
||||||
|
|
10
server.js
10
server.js
|
@ -299,11 +299,11 @@ app.use(express.static(publicPath));
|
||||||
// image: "cyber_monay.jpg",
|
// image: "cyber_monay.jpg",
|
||||||
// author: "Nebula Services",
|
// author: "Nebula Services",
|
||||||
// version: "1.0.0",
|
// version: "1.0.0",
|
||||||
// description: 'A parody of the famous "Cyber Monay" hack!',
|
// description: 'A parody of the famous "Cyber Monay" hack!',
|
||||||
// tags: ["Hacking", "Animated", "Funny"],
|
// tags: ["Hacking", "Animated", "Funny"],
|
||||||
// payload: "com.nebula.cybermonay.css",
|
// payload: "com.nebula.cybermonay.css",
|
||||||
// background_video: "cyber_monay_test.mp4",
|
// background_video: "cyber_monay_test.mp4",
|
||||||
//type: "theme",
|
//type: "theme",
|
||||||
//});
|
//});
|
||||||
|
|
||||||
// await catalog_assets.create({
|
// await catalog_assets.create({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Settings } from "@utils/settings/index";
|
|
||||||
import { Suspense } from "@svelte-drama/suspense";
|
import { Suspense } from "@svelte-drama/suspense";
|
||||||
|
import { Settings } from "@utils/settings/index";
|
||||||
export let page;
|
export let page;
|
||||||
async function getAssets() {
|
async function getAssets() {
|
||||||
const response = await fetch("/api/catalog-assets?page=" + page);
|
const response = await fetch("/api/catalog-assets?page=" + page);
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Suspense } from "@svelte-drama/suspense";
|
import { Suspense } from "@svelte-drama/suspense";
|
||||||
import { Settings, settings } from '@utils/settings/index';
|
import { Settings, settings } from "@utils/settings/index";
|
||||||
import Parent from "./Parent.svelte";
|
import Parent from "./Parent.svelte";
|
||||||
async function getItem(item) {
|
async function getItem(item) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/packages/${item}`);
|
const response = await fetch(`/api/packages/${item}`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
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 getAssets() {
|
async function getAssets() {
|
||||||
const items = JSON.parse(localStorage.getItem(Settings.AppearanceSettings.themes)) || [];
|
const items = JSON.parse(localStorage.getItem(Settings.AppearanceSettings.themes)) || [];
|
||||||
const promises = items.map(getItem);
|
const promises = items.map(getItem);
|
||||||
const dataArray = await Promise.all(promises);
|
const dataArray = await Promise.all(promises);
|
||||||
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;
|
||||||
}
|
}
|
||||||
let assets = getAssets();
|
let assets = getAssets();
|
||||||
let compRef = [];
|
let compRef = [];
|
||||||
</script>
|
</script>
|
||||||
<Suspense let:suspend>
|
<Suspense let:suspend>
|
||||||
<div class="rounded-3xl bg-navbar-color w-64 flex flex-col cursor-pointer">
|
<div class="rounded-3xl bg-navbar-color w-64 flex flex-col cursor-pointer">
|
||||||
|
|
|
@ -4,8 +4,8 @@ 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;
|
||||||
noHeader?: string;
|
noHeader?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, noHeader } = Astro.props;
|
const { title, noHeader } = Astro.props;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import Layout from "@layouts/Layout.astro";
|
|
||||||
import Loading from "@components/Loading.astro";
|
import Loading from "@components/Loading.astro";
|
||||||
|
import Layout from "@layouts/Layout.astro";
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Loading..." noHeader="true">
|
<Layout title="Loading..." noHeader="true">
|
||||||
|
|
|
@ -1,8 +1,20 @@
|
||||||
//Combine all of the other settings into one object. And export that (along with types and other things)
|
//Combine all of the other settings into one object. And export that (along with types and other things)
|
||||||
import { AppearanceSettings, marketPlaceSettings } from "./marketplace";
|
import { AppearanceSettings, marketPlaceSettings } from "./marketplace";
|
||||||
import { TabSettings, tabSettings, cloak } from "./tab";
|
|
||||||
import { ProxySettings, proxySettings } from "./proxy";
|
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 = {
|
const Settings = {
|
||||||
AppearanceSettings,
|
AppearanceSettings,
|
||||||
|
@ -11,25 +23,25 @@ const Settings = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
marketPlaceSettings,
|
marketPlaceSettings,
|
||||||
tabSettings,
|
tabSettings,
|
||||||
proxySettings
|
proxySettings
|
||||||
}
|
};
|
||||||
|
|
||||||
//export all of the stuffs
|
//export all of the stuffs
|
||||||
export {
|
export {
|
||||||
Settings,
|
Settings,
|
||||||
settings,
|
settings,
|
||||||
SearchEngines,
|
SearchEngines,
|
||||||
WispServerURLS,
|
WispServerURLS,
|
||||||
wispUrl,
|
wispUrl,
|
||||||
cloak,
|
cloak,
|
||||||
type TabCloaks,
|
type TabCloaks,
|
||||||
type AbCloaks,
|
type AbCloaks,
|
||||||
type OpenIn,
|
type OpenIn,
|
||||||
type Proxy,
|
type Proxy,
|
||||||
type Transport,
|
type Transport,
|
||||||
type PackageType,
|
type PackageType,
|
||||||
type Package,
|
type Package,
|
||||||
type SearchEngine
|
type SearchEngine
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,98 +1,102 @@
|
||||||
//marketplace code & handlers
|
//marketplace code & handlers
|
||||||
import { type Package, type PackageType } from "./types";
|
import { type Package, type PackageType } from "./types";
|
||||||
const AppearanceSettings = {
|
const AppearanceSettings = {
|
||||||
themes: "nebula||themes",
|
themes: "nebula||themes",
|
||||||
stylePayload: "nebula||stylepayload",
|
stylePayload: "nebula||stylepayload",
|
||||||
video: "nebula||video",
|
video: "nebula||video",
|
||||||
image: "nebula||image"
|
image: "nebula||image"
|
||||||
}
|
};
|
||||||
|
|
||||||
const marketPlaceSettings = {
|
const marketPlaceSettings = {
|
||||||
install: function(p: Package, packageName: string, payload?: any) {
|
install: function (p: Package, packageName: string, payload?: any) {
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
if (p.theme) {
|
if (p.theme) {
|
||||||
let themes = localStorage.getItem(AppearanceSettings.themes) as any;
|
let themes = localStorage.getItem(AppearanceSettings.themes) as any;
|
||||||
themes ? themes = JSON.parse(themes) : themes = [];
|
themes ? (themes = JSON.parse(themes)) : (themes = []);
|
||||||
if (!themes.find((theme: any) => theme === packageName)) {
|
if (!themes.find((theme: any) => theme === packageName)) {
|
||||||
themes.push(packageName);
|
themes.push(packageName);
|
||||||
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(themes));
|
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(themes));
|
||||||
this.changeTheme(false, payload, p.theme.video, p.theme.bgImage);
|
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";
|
|
||||||
}
|
}
|
||||||
function resetVideo() {
|
resolve();
|
||||||
localStorage.removeItem(AppearanceSettings.video);
|
}
|
||||||
const source = document.getElementById('nebulaVideo')! as HTMLVideoElement;
|
});
|
||||||
source.src = "";
|
},
|
||||||
}
|
uninstall: function (p: PackageType, packageName: string) {
|
||||||
function resetBGImage() {
|
return new Promise<void>((resolve) => {
|
||||||
localStorage.removeItem(AppearanceSettings.image);
|
if (p === "theme") {
|
||||||
const image = document.getElementById("nebulaImage")! as HTMLImageElement;
|
let items = localStorage.getItem(AppearanceSettings.themes) as any;
|
||||||
image.style.display = "none";
|
items ? (items = JSON.parse(items)) : (items = []);
|
||||||
image.src = "";
|
if (items.find((theme: any) => theme === packageName)) {
|
||||||
}
|
const idx = items.indexOf(packageName);
|
||||||
if (reset === true) {
|
items.splice(idx, 1);
|
||||||
await resetCSS();
|
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(items));
|
||||||
await resetCSS();
|
this.changeTheme(true);
|
||||||
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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
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 };
|
export { AppearanceSettings, marketPlaceSettings };
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//Proxy specific settings.
|
//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 = {
|
const ProxySettings = {
|
||||||
proxy: "nebula||proxy",
|
proxy: "nebula||proxy",
|
||||||
openIn: "nebula||open",
|
openIn: "nebula||open",
|
||||||
|
|
|
@ -3,15 +3,15 @@ type TabCloaks = "default" | "google" | "wikipedia" | "canvas" | "classroom" | "
|
||||||
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";
|
||||||
type PackageType = "theme" | "plugin"
|
type PackageType = "theme" | "plugin";
|
||||||
interface Package {
|
interface Package {
|
||||||
theme?: {
|
theme?: {
|
||||||
payload: string,
|
payload: string;
|
||||||
video?: string
|
video?: string;
|
||||||
bgImage?: string
|
bgImage?: string;
|
||||||
}
|
};
|
||||||
plugin?: {}
|
plugin?: {};
|
||||||
}
|
}
|
||||||
const SearchEngines: Record<string, string> = {
|
const SearchEngines: Record<string, string> = {
|
||||||
ddg: "https://duckduckgo.com/?q=%s",
|
ddg: "https://duckduckgo.com/?q=%s",
|
||||||
|
@ -24,4 +24,16 @@ const WispServerURLS: Record<string, string> = {
|
||||||
ruby: "wss://ruby.rubynetwork.co/wisp/"
|
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
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue