radius
This commit is contained in:
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export interface Item {
|
||||
title: string
|
||||
image: string
|
||||
url: string
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { type ClassValue, clsx } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import { useRouter } from 'next/navigation'
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export const fetcher = (url: string) => fetch(url).then((res) => res.json())
|
||||
|
||||
export function encodeXor(str: string) {
|
||||
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()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*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)));
|
||||
@@ -0,0 +1,12 @@
|
||||
/*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',
|
||||
};
|
||||
Reference in New Issue
Block a user