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 -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()
}