From f39db70e324d28d12f8fd53ae427c6fae06f8ac4 Mon Sep 17 00:00:00 2001 From: incognitotgt Date: Mon, 24 Jun 2024 12:21:03 -0400 Subject: [PATCH] V6.0.0 - Add basic logic for assets, use tsconfig aliases, fix name of type --- src/layouts/Layout.astro | 2 +- src/layouts/Main.astro | 2 +- src/lib/asset-script.ts | 26 +++++++++++++++++ src/lib/asset.ts | 4 +-- src/lib/cloak.ts | 6 ++-- src/pages/ap.astro | 19 ++++++++----- src/pages/ga.astro | 21 ++++++++------ src/pages/index.astro | 61 ++++++++++++++++++++++++++-------------- src/pages/st.astro | 7 +++++ src/pages/tb.astro | 11 ++++++-- src/pages/to.astro | 15 +++++----- tsconfig.json | 6 ++++ 12 files changed, 126 insertions(+), 54 deletions(-) create mode 100644 src/lib/asset-script.ts create mode 100644 src/pages/st.astro diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index b1aecc8..7d358ec 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -8,7 +8,7 @@ declare global { }; } } -import "../global.css"; +import "@/global.css"; import { ViewTransitions } from "astro:transitions"; --- diff --git a/src/layouts/Main.astro b/src/layouts/Main.astro index fd078b7..bacd4d5 100644 --- a/src/layouts/Main.astro +++ b/src/layouts/Main.astro @@ -1,6 +1,6 @@ --- import { AppWindow, Gamepad2, LayoutGrid, Settings2, Wrench } from "lucide-astro"; -import Obfuscated from "../components/Obfuscated.astro"; +import Obfuscated from "@/components/Obfuscated.astro"; import Layout from "./Layout.astro"; const navLinks = [ { href: "/ap", text: "Apps", Icon: LayoutGrid }, diff --git a/src/lib/asset-script.ts b/src/lib/asset-script.ts new file mode 100644 index 0000000..c7b817f --- /dev/null +++ b/src/lib/asset-script.ts @@ -0,0 +1,26 @@ +import type { Asset } from "@/lib/asset"; +document.addEventListener("astro:page-load", () => { + const buttons = document.querySelectorAll( + "[data-asset]", + ) as NodeListOf; + for (const button of buttons) { + button.addEventListener("click", () => { + const asset: Asset = JSON.parse(button.dataset.asset!); + if (asset.say) alert(asset.say); + if (asset.link) { + sessionStorage.setItem("goUrl", asset.link); + return location.replace("/tb"); + } + if (asset.links) { + const selection = prompt( + `Select a link to go to: ${asset.links.map(({ name }, idx) => `\n${name}: ${idx + 1}`).join("")}`, + ); + if (!selection) return; + const link = asset.links[Number.parseInt(selection) - 1]; + if (!link) return alert("Invalid selection"); + sessionStorage.setItem("goUrl", link.url); + return location.replace("/tb"); + } + }); + } +}); diff --git a/src/lib/asset.ts b/src/lib/asset.ts index 4894331..938cc6e 100644 --- a/src/lib/asset.ts +++ b/src/lib/asset.ts @@ -1,11 +1,11 @@ export const ASSET_URL = "https://raw.githubusercontent.com/UseInterstellar/Interstellar-Assets/main"; -export type App = { +export type Asset = { name: string; image: string; link?: string; - links?: { name: string; url: string }; + links?: { name: string; url: string }[]; say?: string; partial?: boolean | string; error?: boolean | string; diff --git a/src/lib/cloak.ts b/src/lib/cloak.ts index ebab394..f6d5068 100644 --- a/src/lib/cloak.ts +++ b/src/lib/cloak.ts @@ -17,10 +17,8 @@ function getRandomURL() { return randomURLS[randRange(0, randomURLS.length)]; } -function randRange(min: number, max: number) { - return Math.floor(Math.random() * (max - min) + min); -} - +const randRange = (min: number, max: number) => + Math.floor(Math.random() * (max - min) + min); if (!localStorage.getItem("ab")) localStorage.setItem("ab", "true"); if ( diff --git a/src/pages/ap.astro b/src/pages/ap.astro index bf349e5..223743a 100644 --- a/src/pages/ap.astro +++ b/src/pages/ap.astro @@ -1,10 +1,10 @@ --- import { Image } from "astro:assets"; import { LayoutGrid } from "lucide-astro"; -import Obfuscated from "../components/Obfuscated.astro"; -import Layout from "../layouts/Main.astro"; -import { ASSET_URL, type App } from "../lib/asset"; -const apps: App[] = await (await fetch(`${ASSET_URL}/json/apps.json`)).json(); +import Obfuscated from "@/components/Obfuscated.astro"; +import Layout from "@/layouts/Main.astro"; +import { ASSET_URL, type Asset } from "@/lib/asset"; +const apps: Asset[] = await (await fetch(`${ASSET_URL}/json/apps.json`)).json(); --- @@ -16,14 +16,19 @@ const apps: App[] = await (await fetch(`${ASSET_URL}/json/apps.json`)).json();
{ apps.map((app) => ( - + )) }
+ diff --git a/src/pages/ga.astro b/src/pages/ga.astro index 583633c..2df2d47 100644 --- a/src/pages/ga.astro +++ b/src/pages/ga.astro @@ -1,10 +1,10 @@ --- import { Image } from "astro:assets"; import { Gamepad2 } from "lucide-astro"; -import Obfuscated from "../components/Obfuscated.astro"; -import Layout from "../layouts/Main.astro"; -import { ASSET_URL } from "../lib/asset"; -const games = await (await fetch(`${ASSET_URL}/json/games.json`)).json(); +import Obfuscated from "@/components/Obfuscated.astro"; +import Layout from "@/layouts/Main.astro"; +import { ASSET_URL, type Asset } from "@/lib/asset"; +const games: Asset[] = await (await fetch(`${ASSET_URL}/json/games.json`)).json(); --- @@ -15,15 +15,20 @@ const games = await (await fetch(`${ASSET_URL}/json/games.json`)).json();
{ - games.map((game: any) => ( - + games.map((game) => ( + )) }
+ diff --git a/src/pages/index.astro b/src/pages/index.astro index a8ff651..29ec830 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,38 +1,57 @@ --- -import Layout from "../layouts/Main.astro"; +import Layout from "@/layouts/Main.astro"; +const splashText = [ + "Over 8 Million Users since 2023", + "Fastest growing proxy server", + "Made by xBubbo", + "Check out discord.gg/interstellar :)", + "Thanks for using the site", + "Follow us on Tiktok (@useinterstellar)", + "Subscribe to us on YouTube (@unblocking)", + "Subscribe to my Youtube (@xbubbo)", + "Check out the settings page", + "Check out our Patreon (https://www.patreon.com/gointerstellar)", +]; --- - + -

Interstellar

-
- +
+

Interstellar

+
+ {splashText[Math.floor(Math.random() * splashText.length)]} + +
diff --git a/src/pages/st.astro b/src/pages/st.astro new file mode 100644 index 0000000..d296aa4 --- /dev/null +++ b/src/pages/st.astro @@ -0,0 +1,7 @@ +--- +import Layout from "@/layouts/Main.astro"; +--- + + +
settings
+
diff --git a/src/pages/tb.astro b/src/pages/tb.astro index a2f51fb..7b8867c 100644 --- a/src/pages/tb.astro +++ b/src/pages/tb.astro @@ -1,8 +1,13 @@ --- -import Layout from "../layouts/Layout.astro"; -export const prerender = true; +import Layout from "@/layouts/Layout.astro"; --- -
tabs
+ home +
+ diff --git a/src/pages/to.astro b/src/pages/to.astro index 702c8ae..a15eb89 100644 --- a/src/pages/to.astro +++ b/src/pages/to.astro @@ -1,10 +1,10 @@ --- import { Image } from "astro:assets"; import { Wrench } from "lucide-astro"; -import Obfuscated from "../components/Obfuscated.astro"; -import Layout from "../layouts/Main.astro"; -import { ASSET_URL } from "../lib/asset"; -const tools = await (await fetch(`${ASSET_URL}/json/tools.json`)).json(); +import Obfuscated from "@/components/Obfuscated.astro"; +import Layout from "@/layouts/Main.astro"; +import { ASSET_URL, type Asset } from "@/lib/asset"; +const tools: Asset[] = await (await fetch(`${ASSET_URL}/json/tools.json`)).json(); --- @@ -15,15 +15,16 @@ const tools = await (await fetch(`${ASSET_URL}/json/tools.json`)).json();
{ - tools.map((tool: any) => ( - + tools.map((tool) => ( + )) }
+ diff --git a/tsconfig.json b/tsconfig.json index 63b7fa3..a89441d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,10 @@ { "extends": "astro/tsconfigs/strict", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + }, + }, "exclude": ["node_modules", "dist", "public/assets/bundled/**"] }