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
+3 -3
View File
@@ -1,5 +1,5 @@
export interface Item {
title: string
image: string
url: string
title: string;
image: string;
url: string;
}
+11 -23
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('')
)
.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()
}
-14
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)));
-12
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',
};