diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index 65e86cd..b21a606 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -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;
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 6da84b6..abcc18a 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -1,6 +1,6 @@
---
-import Layout from "@layouts/Layout.astro";
import Loading from "@components/Loading.astro";
+import Layout from "@layouts/Layout.astro";
---
diff --git a/src/utils/settings/index.ts b/src/utils/settings/index.ts
index 0d7a630..1a604d4 100644
--- a/src/utils/settings/index.ts
+++ b/src/utils/settings/index.ts
@@ -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
+};
diff --git a/src/utils/settings/marketplace.ts b/src/utils/settings/marketplace.ts
index 721a12e..1899850 100644
--- a/src/utils/settings/marketplace.ts
+++ b/src/utils/settings/marketplace.ts
@@ -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((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((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((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((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 };
diff --git a/src/utils/settings/proxy.ts b/src/utils/settings/proxy.ts
index 5fe708f..8ff07a9 100644
--- a/src/utils/settings/proxy.ts
+++ b/src/utils/settings/proxy.ts
@@ -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",
diff --git a/src/utils/settings/types.ts b/src/utils/settings/types.ts
index 21d76d6..152189a 100644
--- a/src/utils/settings/types.ts
+++ b/src/utils/settings/types.ts
@@ -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 = {
ddg: "https://duckduckgo.com/?q=%s",
@@ -24,4 +24,16 @@ const WispServerURLS: Record = {
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
+};