use chemical with wisp, cleanup

This commit is contained in:
Nebelung 2024-10-13 19:14:49 +00:00
parent fcd6718d0c
commit 408fa074bb
25 changed files with 2362 additions and 5177 deletions

11
.gitpod.yml Normal file
View file

@ -0,0 +1,11 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
tasks:
- init: pnpm install && pnpm run build
command: pnpm run start

View file

@ -2,7 +2,6 @@
## Simple, Super & Squeaky clean.
## https://radiusowski.site
Owned by Owski and Proudparrot2.
Developed by Radius Dev team.
@ -20,4 +19,3 @@ We are getting things handled for self-hosting, for now try making an iframe to
DM The Owners!
Owski9 is owski09 on discord!
ProudParrot2 is proudparrot2 on discord as well.

4801
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,11 @@
{
"name": "radius",
"description": "Simple, Super & Squeaky clean.",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "node server.mjs",
"build": "next build",
"start": "next start",
"lint": "next lint"
"start": "NODE_ENV=production node server.mjs"
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
@ -20,6 +19,7 @@
"@radix-ui/react-toast": "^1.2.2",
"@radix-ui/react-tooltip": "^1.1.3",
"@tomphttp/bare-server-node": "^2.0.4",
"chemicaljs": "^2.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"framer-motion": "^11.11.8",

1941
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

24
server.mjs Normal file
View file

@ -0,0 +1,24 @@
import { ChemicalServer } from "chemicaljs";
import next from "next";
const [app, listen] = new ChemicalServer({
default: "uv",
uv: true,
rammerhead: false,
});
const port = process.env.PORT || 3000;
const dev = process.env.NODE_ENV !== "production";
const nextApp = next({ dev });
const handle = nextApp.getRequestHandler();
nextApp.prepare().then(() => {
app.serveChemical();
app.all("*", (req, res) => {
return handle(req, res);
});
listen(port, () => {
console.log(`Radius listening on port ${port}`);
});
});

View file

@ -1,32 +1,32 @@
'use client'
import { useState, useEffect } from 'react'
import App from '@/components/game'
"use client";
import { useState, useEffect } from "react";
import App from "@/components/game";
interface AppData {
title: string
image: string
url: string
title: string;
image: string;
url: string;
}
export default function Apps() {
const [Apps, setApps] = useState<AppData[]>([])
const [Apps, setApps] = useState<AppData[]>([]);
useEffect(() => {
async function fetchApps() {
try {
const response = await fetch('/apps.json')
const response = await fetch("/apps.json");
if (!response.ok) {
throw new Error('Failed to fetch data')
throw new Error("Failed to fetch data");
}
const data: AppData[] = await response.json()
setApps(data)
const data: AppData[] = await response.json();
setApps(data);
} catch (error) {
console.error('Error fetching data:', error)
console.error("Error fetching data:", error);
}
}
fetchApps()
}, [])
fetchApps();
}, []);
return (
<div>
@ -39,5 +39,5 @@ export default function Apps() {
))}
</div>
</div>
)
);
}

View file

@ -1,32 +1,32 @@
'use client'
import { useState, useEffect } from 'react'
import Game from '@/components/game'
"use client";
import { useState, useEffect } from "react";
import Game from "@/components/game";
interface GameData {
title: string
image: string
url: string
title: string;
image: string;
url: string;
}
export default function Games() {
const [games, setGames] = useState<GameData[]>([])
const [games, setGames] = useState<GameData[]>([]);
useEffect(() => {
async function fetchGames() {
try {
const response = await fetch('/games.json')
const response = await fetch("/games.json");
if (!response.ok) {
throw new Error('Failed to fetch data')
throw new Error("Failed to fetch data");
}
const data: GameData[] = await response.json()
setGames(data)
const data: GameData[] = await response.json();
setGames(data);
} catch (error) {
console.error('Error fetching data:', error)
console.error("Error fetching data:", error);
}
}
fetchGames()
}, [])
fetchGames();
}, []);
return (
<div>
@ -39,5 +39,5 @@ export default function Games() {
))}
</div>
</div>
)
);
}

View file

@ -1,76 +1,106 @@
'use client'
import Sidebar from '@/components/sidebar'
import { Button } from '@/components/ui/button'
import { encodeXor, formatSearch } from '@/lib/utils'
import { useEffect, useRef, useState } from 'react'
import store from 'store2'
import * as Lucide from 'lucide-react'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
"use client";
import Sidebar from "@/components/sidebar";
import { Button } from "@/components/ui/button";
import { encodeXor } from "@/lib/utils";
import { useEffect, useRef, useState } from "react";
import store from "store2";
import * as Lucide from "lucide-react";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
interface ContentWindow extends Window {
__uv$location: Location
__uv$location: Location;
}
declare global {
interface Window {
chemical: any;
}
}
export default function Route({ params }: { params: { route: string[] } }) {
const ref = useRef<HTMLIFrameElement>(null)
const [open, setOpen] = useState(false)
const route = params.route.join('/')
const ref = useRef<HTMLIFrameElement>(null);
const [open, setOpen] = useState(false);
const route = params.route.join("/");
const [tabIcon, setTabIcon] = useState('')
const [tabName, setTabName] = useState('')
const [shortcutted, setShortcutted] = useState(false)
const [tabIcon, setTabIcon] = useState("");
const [tabName, setTabName] = useState("");
const [shortcutted, setShortcutted] = useState(false);
useEffect(() => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/uv/sw.js', {
scope: '/uv/service'
})
.then(() => {
if (ref.current) {
ref.current.src = '/uv/service/' + encodeXor(formatSearch(atob(decodeURIComponent(route))))
async function go() {
if (ref.current) {
ref.current.src = await window.chemical.encode(
atob(decodeURIComponent(route)),
{
autoHttps: true,
searchEngine: "https://www.google.com/search?q=%s",
}
})
);
}
}
}, [])
go();
}, []);
function triggerShortcut() {
store.set('shortcuts', [], false)
if (!ref.current || !ref.current.contentWindow) return
const contentWindow = ref.current.contentWindow as ContentWindow
if (!('__uv$location' in contentWindow)) return
const shortcuts: any[] = store('shortcuts')
store.set("shortcuts", [], false);
if (!ref.current || !ref.current.contentWindow) return;
const contentWindow = ref.current.contentWindow as ContentWindow;
if (!("__uv$location" in contentWindow)) return;
const shortcuts: any[] = store("shortcuts");
if (shortcuts.some((value) => value.url == contentWindow.__uv$location.href)) {
if (
shortcuts.some((value) => value.url == contentWindow.__uv$location.href)
) {
store(
'shortcuts',
shortcuts.filter((value) => value.url !== contentWindow.__uv$location.href)
)
setShortcutted(false)
"shortcuts",
shortcuts.filter(
(value) => value.url !== contentWindow.__uv$location.href
)
);
setShortcutted(false);
} else {
store('shortcuts', [
...store('shortcuts'),
store("shortcuts", [
...store("shortcuts"),
{
image: (contentWindow.document.querySelector("link[rel*='icon']") as HTMLLinkElement)?.href || `${contentWindow.__uv$location.origin}/favicon.ico`,
image:
(
contentWindow.document.querySelector(
"link[rel*='icon']"
) as HTMLLinkElement
)?.href || `${contentWindow.__uv$location.origin}/favicon.ico`,
title: contentWindow.document.title,
url: contentWindow.__uv$location.href
}
])
setShortcutted(true)
url: contentWindow.__uv$location.href,
},
]);
setShortcutted(true);
}
}
function handleLoad() {
if (!ref.current || !ref.current.contentWindow) return
const contentWindow = ref.current.contentWindow as ContentWindow
if (!ref.current || !ref.current.contentWindow) return;
const contentWindow = ref.current.contentWindow as ContentWindow;
setTabName(contentWindow.document.title)
setTabIcon((contentWindow.document.querySelector("link[rel*='icon']") as HTMLLinkElement)?.href || `${contentWindow.__uv$location.origin}/favicon.ico`)
setTabName(contentWindow.document.title);
setTabIcon(
(
contentWindow.document.querySelector(
"link[rel*='icon']"
) as HTMLLinkElement
)?.href || `${contentWindow.__uv$location.origin}/favicon.ico`
);
store.set('shortcuts', [], false)
const shortcuts: any[] = store('shortcuts')
if (shortcuts.some((value) => value.url == contentWindow.__uv$location.href)) {
setShortcutted(true)
store.set("shortcuts", [], false);
const shortcuts: any[] = store("shortcuts");
if (
shortcuts.some((value) => value.url == contentWindow.__uv$location.href)
) {
setShortcutted(true);
}
}
return (
@ -81,8 +111,14 @@ export default function Route({ params }: { params: { route: string[] } }) {
<Lucide.Menu className="h-7 w-7" />
</Button>
<div className="flex items-center gap-2">
{tabIcon ? <img src={tabIcon} className="h-8 w-8" /> : <Lucide.Radius className="h-8 w-8 rotate-180" />}
<h1 className="text-xl font-bold">{tabName ? tabName : 'Radius'}</h1>
{tabIcon ? (
<img src={tabIcon} className="h-8 w-8" />
) : (
<Lucide.Radius className="h-8 w-8 rotate-180" />
)}
<h1 className="text-xl font-bold">
{tabName ? tabName : "Radius"}
</h1>
</div>
</div>
<div className="flex items-center gap-2 z-50">
@ -108,7 +144,9 @@ export default function Route({ params }: { params: { route: string[] } }) {
<Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" size="icon" onClick={triggerShortcut}>
<Lucide.Star className={shortcutted ? 'fill-foreground' : 'fill-none'} />
<Lucide.Star
className={shortcutted ? "fill-foreground" : "fill-none"}
/>
</Button>
</TooltipTrigger>
<TooltipContent>Shortcut</TooltipContent>
@ -118,14 +156,30 @@ export default function Route({ params }: { params: { route: string[] } }) {
<Sidebar open={open} onOpenChange={setOpen} />
</div>
<iframe ref={ref} onLoad={handleLoad} className="h-[calc(100vh-3.5rem)] w-full"></iframe>
<iframe
ref={ref}
onLoad={handleLoad}
className="h-[calc(100vh-3.5rem)] w-full"
></iframe>
<div className="flex items-center justify-center fixed h-full w-full pointer-events-none -z-10">
<svg aria-hidden="true" className="w-20 h-20 animate-spin text-gray-600 fill-primary" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor" />
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill" />
<svg
aria-hidden="true"
className="w-20 h-20 animate-spin text-gray-600 fill-primary"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"
/>
</svg>
</div>
</div>
)
);
}

View file

@ -1,34 +1,33 @@
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import './globals.css'
import Navbar from '@/components/navbar'
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import Navbar from "@/components/navbar";
import { Themes } from "./providers";
const inter = Inter({ subsets: ['latin'] })
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: 'Radius',
description: ''
}
title: "Radius",
description: "",
};
export default function RootLayout({
children
children,
}: Readonly<{
children: React.ReactNode
children: React.ReactNode;
}>) {
return (
<html lang="en">
<head>
<link rel="icon" href="/icon.png" />
<script src="/chemical.js"></script>
</head>
<body className={inter.className}>
<Themes>
<Navbar />
<div className="pt-14">{children}</div>
</Themes>
</body>
</html>
)
);
}

View file

@ -1,45 +1,46 @@
'use client'
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardTitle } from '@/components/ui/card';
import { ShieldX } from 'lucide-react';
import Image from 'next/image';
"use client";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardTitle } from "@/components/ui/card";
import { ShieldX } from "lucide-react";
import Image from "next/image";
export default function PageNotFound() {
return (
<div className="flex h-screen items-center justify-center">
{/* Container for mobile and desktop layouts */}
<div className="flex flex-col lg:flex-row items-center justify-center space-y-6 lg:space-y-0 lg:space-x-8">
{/* Cat gif on top for mobile, on the left for larger screens */}
<div className="flex-shrink-0">
<Image
src="/kitty.gif"
width={300} // dont adjust unless you're weird
height={300}
alt="kitty"
className="rounded-lg" // rounded corner for kitty
/>
</div>
return (
<div className="flex h-screen items-center justify-center">
{/* Container for mobile and desktop layouts */}
<div className="flex flex-col lg:flex-row items-center justify-center space-y-6 lg:space-y-0 lg:space-x-8">
{/* Cat gif on top for mobile, on the left for larger screens */}
<div className="flex-shrink-0">
<Image
src="/kitty.gif"
width={300} // dont adjust unless you're weird
height={300}
alt="kitty"
className="rounded-lg" // rounded corner for kitty
/>
</div>
{/* the error card */}
<Card className="flex h-96 w-96 flex-col items-center justify-center">
<CardTitle className="mx-auto mb-2 flex flex-col items-center justify-center">
<ShieldX className="h-14 w-14" />
<h2 className="mt-2 text-3xl font-semibold">404 Error</h2>
</CardTitle>
<CardContent className="mt-4 text-center text-base">
Click below to go to the home page.<br /> 404 - Page not found
</CardContent>
<CardContent className="mt-4">
<Button
type="button"
onClick={() => (window.location.href = '/')}
className="text-muted-background text-black"
>
Go Home
</Button>
</CardContent>
</Card>
</div>
</div>
);
{/* the error card */}
<Card className="flex h-96 w-96 flex-col items-center justify-center">
<CardTitle className="mx-auto mb-2 flex flex-col items-center justify-center">
<ShieldX className="h-14 w-14" />
<h2 className="mt-2 text-3xl font-semibold">404 Error</h2>
</CardTitle>
<CardContent className="mt-4 text-center text-base">
Click below to go to the home page.
<br /> 404 - Page not found
</CardContent>
<CardContent className="mt-4">
<Button
type="button"
onClick={() => (window.location.href = "/")}
className="text-muted-background text-black"
>
Go Home
</Button>
</CardContent>
</Card>
</div>
</div>
);
}

View file

@ -1,31 +1,30 @@
'use client'
import Shortcut from '@/components/shortcut'
import { Input } from '@/components/ui/input'
import { Flame, Radius, Search } from 'lucide-react'
import { useEffect, useState } from 'react'
import { useRouter } from 'next/navigation'
import { Item } from '@/lib/types'
import store from 'store2'
"use client";
import Shortcut from "@/components/shortcut";
import { Input } from "@/components/ui/input";
import { Flame, Radius, Search } from "lucide-react";
import { useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { Item } from "@/lib/types";
import store from "store2";
export default function Home() {
const router = useRouter()
const [shortcuts, setShortcuts] = useState<Item[]>([])
const [splashText, setSplashText] = useState<string>('')
const router = useRouter();
const [shortcuts, setShortcuts] = useState<Item[]>([]);
const [splashText, setSplashText] = useState<string>("");
useEffect(() => {
fetch('/splash.json')
.then(response => response.json())
.then(data => {
fetch("/splash.json")
.then((response) => response.json())
.then((data) => {
const randomIndex = Math.floor(Math.random() * data.length);
setSplashText(data[randomIndex].splash);
})
.catch(error => console.error('Error fetching splash text:', error));
.catch((error) => console.error("Error fetching splash text:", error));
store.set('shortcuts', [], false)
const data: Item[] = store('shortcuts')
setShortcuts(data)
}, [])
store.set("shortcuts", [], false);
const data: Item[] = store("shortcuts");
setShortcuts(data);
}, []);
return (
<div>
@ -40,22 +39,37 @@ export default function Home() {
className="w-[26rem] px-9 h-12 rounded-lg"
placeholder="Search the web"
onKeyDown={(e) => {
if (e.key !== 'Enter') return
router.push(`/go/${btoa(e.currentTarget.value)}`)
if (e.key !== "Enter") return;
router.push(`/go/${btoa(e.currentTarget.value)}`);
}}
/>
<Search className="h-4 w-4 text-muted-foreground absolute top-1/2 -translate-y-1/2 left-3" />
</div>
</div>
<p style={{ fontSize: '1rem', fontWeight: 'normal', marginTop: '0.4rem' }}>{splashText}</p>
<p
style={{
fontSize: "1rem",
fontWeight: "normal",
marginTop: "0.4rem",
}}
>
{splashText}
</p>
{shortcuts.length > 0 && (
<div className="py-2 flex flex-wrap gap-2 justify-center">
{shortcuts.map((shortcut: Item) => {
return <Shortcut key={shortcut.title} image={shortcut.image} title={shortcut.title} url={shortcut.url} />
return (
<Shortcut
key={shortcut.title}
image={shortcut.image}
title={shortcut.title}
url={shortcut.url}
/>
);
})}
</div>
)}
</div>
</div>
)
);
}

View file

@ -1,51 +1,58 @@
'use client'
"use client";
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { z } from 'zod'
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { Button } from '@/components/ui/button'
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'
import { Button } from "@/components/ui/button";
import {
Form,
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from '@/components/ui/input'
import { Separator } from '@/components/ui/separator'
import { Save, RotateCcw } from 'lucide-react'
import { useState } from 'react'
import { toast } from 'sonner'
import { Input } from "@/components/ui/input";
import { Separator } from "@/components/ui/separator";
import { Save, RotateCcw } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
const formSchema = z.object({
backgroundImage: z.string().url('Please provide a valid URL'),
backgroundImage: z.string().url("Please provide a valid URL"),
description: z.string().optional(),
})
});
export default function Settings() {
const [submitting, setSubmitting] = useState(false)
const [submitting, setSubmitting] = useState(false);
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
backgroundImage: '',
backgroundImage: "",
},
})
});
function onSubmit(values: z.infer<typeof formSchema>) {
setSubmitting(true)
setSubmitting(true);
document.body.style.backgroundImage = `url(${values.backgroundImage})`
document.body.style.backgroundSize = 'cover'
document.body.style.backgroundPosition = 'center'
document.body.style.backgroundImage = `url(${values.backgroundImage})`;
document.body.style.backgroundSize = "cover";
document.body.style.backgroundPosition = "center";
setTimeout(() => {
setSubmitting(false)
toast.success('Settings saved')
}, 1000)
setSubmitting(false);
toast.success("Settings saved");
}, 1000);
console.log(values)
console.log(values);
}
function onReset() {
form.reset()
document.body.style.backgroundImage = ''
toast('Settings reset')
form.reset();
document.body.style.backgroundImage = "";
toast("Settings reset");
}
return (
@ -53,7 +60,10 @@ export default function Settings() {
<h1 className="text-4xl font-semibold">Appearance</h1>
<Separator />
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="w-1/2 space-y-4">
<form
onSubmit={form.handleSubmit(onSubmit)}
className="w-1/2 space-y-4"
>
<FormField
control={form.control}
name="backgroundImage"
@ -80,5 +90,5 @@ export default function Settings() {
</form>
</Form>
</div>
)
);
}

View file

@ -1,6 +1,6 @@
'use client'
"use client";
import { Separator } from '@/components/ui/separator'
import { Separator } from "@/components/ui/separator";
export default function Credits() {
return (
@ -15,8 +15,9 @@ export default function Credits() {
<li>Sparkzil</li>
<li>Scaratek</li>
<li>fwxe</li>
<li>Nebelung</li>
</ul>
</div>
</div>
)
);
}

View file

@ -1,33 +1,50 @@
'use client'
"use client";
import { Button } from '@/components/ui/button'
import { Users, Link, Palette } from 'lucide-react'
import NextLink from 'next/link'
import { Button } from "@/components/ui/button";
import { Users, Link, Palette } from "lucide-react";
import NextLink from "next/link";
import { usePathname } from 'next/navigation'
import { usePathname } from "next/navigation";
export default function SettingsLayout({ children }: Readonly<{ children: React.ReactNode }>) {
const pathname = usePathname()
export default function SettingsLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
const pathname = usePathname();
return (
<div className="flex">
<div className="flex w-1/4 flex-col gap-2 p-4 pl-8 pt-8">
<NextLink href="/settings/appearance/">
<Button variant={pathname?.includes('/settings/appearance') ? 'secondary' : 'ghost'} className="w-full items-center justify-start gap-2">
<Button
variant={
pathname?.includes("/settings/appearance") ? "secondary" : "ghost"
}
className="w-full items-center justify-start gap-2"
>
<Palette className="h-5 w-5" /> Appearance
</Button>
</NextLink>
<NextLink href="/settings/credits/">
<Button variant={pathname?.includes('/settings/credits') ? 'secondary' : 'ghost'} className="w-full items-center justify-start gap-2">
<Button
variant={
pathname?.includes("/settings/credits") ? "secondary" : "ghost"
}
className="w-full items-center justify-start gap-2"
>
<Users className="h-5 w-5" /> Credits
</Button>
</NextLink>
<NextLink href="/settings/links/">
<Button variant={pathname?.includes('/settings/links') ? 'secondary' : 'ghost'} className="w-full items-center justify-start gap-2">
<Button
variant={
pathname?.includes("/settings/links") ? "secondary" : "ghost"
}
className="w-full items-center justify-start gap-2"
>
<Link className="h-5 w-5" /> Social Links
</Button>
</NextLink>
</div>
<div className="w-3/4 px-12 py-8">{children}</div>
</div>
)
);
}

View file

@ -1,7 +1,7 @@
'use client'
"use client";
import NextLink from 'next/link'
import { Separator } from '@/components/ui/separator'
import NextLink from "next/link";
import { Separator } from "@/components/ui/separator";
export default function SocialLinks() {
return (
@ -14,13 +14,17 @@ export default function SocialLinks() {
<li>TikTok: @radiusproxy</li>
<li>YouTube: @RadiusProxy</li>
<li>
Discord:{' '}
<NextLink href="https://discord.gg/JrAxQz7Qkw" target="_blank" className="text-blue-500 underline">
Discord:{" "}
<NextLink
href="https://discord.gg/JrAxQz7Qkw"
target="_blank"
className="text-blue-500 underline"
>
Join Now!
</NextLink>
</li>
</ul>
</div>
</div>
)
);
}

View file

@ -1,29 +0,0 @@
import fs from 'fs'
import { notFound } from 'next/navigation'
import { NextRequest } from 'next/server'
export async function GET(_req: NextRequest, { params }: { params: { uv: string } }) {
const requestedFile = params.uv
if (requestedFile === 'uv.config.js' || requestedFile === 'sw.js') {
const file = fs.readFileSync(process.cwd() + `/src/lib/uv/${requestedFile}`)
const fileBlob = new Blob([file])
return new Response(fileBlob, {
headers: {
'Content-Type': 'application/javascript'
}
})
} else {
try {
const res = await fetch(`https://unpkg.com/@titaniumnetwork-dev/ultraviolet@2.0.0/dist/${requestedFile}`)
const file = await res.text()
const fileBlob = new Blob([file])
return new Response(fileBlob, {
headers: {
'Content-Type': 'application/javascript'
}
})
} catch {
notFound()
}
}
}

6
src/lib/types.d.ts vendored
View file

@ -1,5 +1,5 @@
export interface Item {
title: string
image: string
url: string
title: string;
image: string;
url: string;
}

View file

@ -1,32 +1,20 @@
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
import { useRouter } from 'next/navigation'
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}
export const fetcher = (url: string) => fetch(url).then((res) => res.json())
export const fetcher = (url: string) => fetch(url).then((res) => res.json());
export function encodeXor(str: string) {
if (!str) return str
if (!str) return str;
return encodeURIComponent(
str
.toString()
.split('')
.map((char, ind) => (ind % 2 ? String.fromCharCode(char.charCodeAt(NaN) ^ 2) : char))
.join('')
)
}
export function formatSearch(input: string): string {
try {
return new URL(input).toString()
} catch (e) {}
try {
const url = new URL(`http://${input}`)
if (url.hostname.includes('.')) return url.toString()
} catch (e) {}
return new URL(`https://google.com/search?q=${input}`).toString()
.split("")
.map((char, ind) =>
ind % 2 ? String.fromCharCode(char.charCodeAt(NaN) ^ 2) : char
)
.join("")
);
}

View file

@ -1,14 +0,0 @@
/*global UVServiceWorker,__uv$config*/
/*
* Stock service worker script.
* Users can provide their own sw.js if they need to extend the functionality of the service worker.
* Ideally, this will be registered under the scope in uv.config.js so it will not need to be modified.
* However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally.
*/
importScripts('/uv/uv.bundle.js');
importScripts('/uv/uv.config.js');
importScripts(__uv$config.sw || '/uv/uv.sw.js');
const sw = new UVServiceWorker();
self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event)));

View file

@ -1,12 +0,0 @@
/*global Ultraviolet*/
self.__uv$config = {
prefix: '/uv/service/',
bare: '/api/bare/',
encodeUrl: Ultraviolet.codec.xor.encode,
decodeUrl: Ultraviolet.codec.xor.decode,
handler: '/uv/uv.handler.js',
client: '/uv/uv.client.js',
bundle: '/uv/uv.bundle.js',
config: '/uv/uv.config.js',
sw: '/uv/uv.sw.js',
};

View file

@ -1,20 +0,0 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import { createBareServer } from '@tomphttp/bare-server-node'
const bare = createBareServer('/api/bare/', {
logErrors: false,
localAddress: undefined,
maintainer: {
email: 'contact@proudparrot2.tech',
website: 'https://github.com/proudparrot2/'
}
})
export const config = {
api: {
externalResolver: true
}
}
export default function handler(req: NextApiRequest, res: NextApiResponse) {
bare.routeRequest(req, res)
}

View file

@ -1,82 +1,89 @@
/** @type {import('tailwindcss').Config} */
const defaultTheme = require('tailwindcss/defaultTheme')
const defaultTheme = require("tailwindcss/defaultTheme");
const svgToDataUri = require('mini-svg-data-uri')
const svgToDataUri = require("mini-svg-data-uri");
const colors = require('tailwindcss/colors')
const { default: flattenColorPalette } = require('tailwindcss/lib/util/flattenColorPalette')
const colors = require("tailwindcss/colors");
const {
default: flattenColorPalette,
} = require("tailwindcss/lib/util/flattenColorPalette");
const config = {
darkMode: ['class'],
content: ['./pages/**/*.{ts,tsx}', './components/**/*.{ts,tsx}', './app/**/*.{ts,tsx}', './src/**/*.{ts,tsx}'],
prefix: '',
darkMode: ["class"],
content: [
"./pages/**/*.{ts,tsx}",
"./components/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
"./src/**/*.{ts,tsx}",
],
prefix: "",
theme: {
container: {
center: true,
padding: '2rem',
padding: "2rem",
screens: {
'2xl': '1400px'
}
"2xl": "1400px",
},
},
extend: {
colors: {
border: 'hsl(var(--border))',
input: 'hsl(var(--input))',
ring: 'hsl(var(--ring))',
background: 'hsl(var(--background))',
foreground: 'hsl(var(--foreground))',
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: 'hsl(var(--primary))',
foreground: 'hsl(var(--primary-foreground))'
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
DEFAULT: 'hsl(var(--secondary))',
foreground: 'hsl(var(--secondary-foreground))'
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
destructive: {
DEFAULT: 'hsl(var(--destructive))',
foreground: 'hsl(var(--destructive-foreground))'
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
muted: {
DEFAULT: 'hsl(var(--muted))',
foreground: 'hsl(var(--muted-foreground))'
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: 'hsl(var(--accent))',
foreground: 'hsl(var(--accent-foreground))'
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
},
popover: {
DEFAULT: 'hsl(var(--popover))',
foreground: 'hsl(var(--popover-foreground))'
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
card: {
DEFAULT: 'hsl(var(--card))',
foreground: 'hsl(var(--card-foreground))'
}
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
},
borderRadius: {
lg: 'var(--radius)',
md: 'calc(var(--radius) - 2px)',
sm: 'calc(var(--radius) - 4px)'
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
keyframes: {
'accordion-down': {
from: { height: '0' },
to: { height: 'var(--radix-accordion-content-height)' }
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
'accordion-up': {
from: { height: 'var(--radix-accordion-content-height)' },
to: { height: '0' }
}
},
animation: {
'accordion-down': 'accordion-down 0.2s ease-out',
'accordion-up': 'accordion-up 0.2s ease-out'
}
}
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [require('tailwindcss-animate')]
}
plugins: [require("tailwindcss-animate")],
};
module.exports = config
module.exports = config;