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,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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
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";
|
||||
async function getItem(item) {
|
||||
try {
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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,
|
||||
|
@ -14,7 +26,7 @@ const settings = {
|
|||
marketPlaceSettings,
|
||||
tabSettings,
|
||||
proxySettings
|
||||
}
|
||||
};
|
||||
|
||||
//export all of the stuffs
|
||||
export {
|
||||
|
@ -32,4 +44,4 @@ export {
|
|||
type PackageType,
|
||||
type Package,
|
||||
type SearchEngine
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,14 +5,14 @@ const AppearanceSettings = {
|
|||
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 = [];
|
||||
themes ? (themes = JSON.parse(themes)) : (themes = []);
|
||||
if (!themes.find((theme: any) => theme === packageName)) {
|
||||
themes.push(packageName);
|
||||
localStorage.setItem(AppearanceSettings.themes, JSON.stringify(themes));
|
||||
|
@ -26,7 +26,7 @@ const marketPlaceSettings = {
|
|||
return new Promise<void>((resolve) => {
|
||||
if (p === "theme") {
|
||||
let items = localStorage.getItem(AppearanceSettings.themes) as any;
|
||||
items ? items = JSON.parse(items) : items = [];
|
||||
items ? (items = JSON.parse(items)) : (items = []);
|
||||
if (items.find((theme: any) => theme === packageName)) {
|
||||
const idx = items.indexOf(packageName);
|
||||
items.splice(idx, 1);
|
||||
|
@ -37,7 +37,12 @@ const marketPlaceSettings = {
|
|||
}
|
||||
});
|
||||
},
|
||||
changeTheme: async function(reset: Boolean, payload?: any, videoSource?: string, bgSource?: string) {
|
||||
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);
|
||||
|
@ -45,7 +50,7 @@ const marketPlaceSettings = {
|
|||
}
|
||||
function resetVideo() {
|
||||
localStorage.removeItem(AppearanceSettings.video);
|
||||
const source = document.getElementById('nebulaVideo')! as HTMLVideoElement;
|
||||
const source = document.getElementById("nebulaVideo")! as HTMLVideoElement;
|
||||
source.src = "";
|
||||
}
|
||||
function resetBGImage() {
|
||||
|
@ -67,7 +72,7 @@ const marketPlaceSettings = {
|
|||
if (!localStorage.getItem(AppearanceSettings.video)) {
|
||||
localStorage.setItem(AppearanceSettings.video, videoSource as string);
|
||||
}
|
||||
source.src = `/videos/${videoSource ? videoSource : localStorage.getItem(AppearanceSettings.video)}`
|
||||
source.src = `/videos/${videoSource ? videoSource : localStorage.getItem(AppearanceSettings.video)}`;
|
||||
}
|
||||
if (bgSource || localStorage.getItem(AppearanceSettings.image)) {
|
||||
resetVideo();
|
||||
|
@ -77,7 +82,7 @@ const marketPlaceSettings = {
|
|||
localStorage.setItem(AppearanceSettings.image, bgSource as string);
|
||||
}
|
||||
image.style.display = "block";
|
||||
image.src = `/images/${bgSource ? bgSource : localStorage.getItem(AppearanceSettings.image)}`
|
||||
image.src = `/images/${bgSource ? bgSource : localStorage.getItem(AppearanceSettings.image)}`;
|
||||
}
|
||||
if (payload) {
|
||||
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
|
||||
|
@ -85,14 +90,13 @@ const marketPlaceSettings = {
|
|||
localStorage.setItem(AppearanceSettings.stylePayload, payload);
|
||||
}
|
||||
stylesheet.href = `/styles/${localStorage.getItem(AppearanceSettings.stylePayload)}`;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (localStorage.getItem(AppearanceSettings.stylePayload)) {
|
||||
const stylesheet = document.getElementById("stylesheet")! as HTMLLinkElement;
|
||||
stylesheet.href = `/styles/${localStorage.getItem(AppearanceSettings.stylePayload)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { AppearanceSettings, marketPlaceSettings };
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -4,14 +4,14 @@ 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 PackageType = "theme" | "plugin";
|
||||
interface Package {
|
||||
theme?: {
|
||||
payload: string,
|
||||
video?: string
|
||||
bgImage?: string
|
||||
}
|
||||
plugin?: {}
|
||||
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
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue