Implement connectApp logic, add app url and icon

This commit is contained in:
artur
2024-02-08 14:15:45 +03:00
parent caf8f9a82b
commit 48c07ad1c0
11 changed files with 350 additions and 90 deletions

View File

@@ -3,14 +3,23 @@ import { ACTIONS, ACTION_TYPE, NIP46_RELAYS } from '../consts'
import { DbPending, DbPerm } from '@/modules/db'
import { MetaEvent } from '@/types/meta-event'
export async function call(cb: () => any) {
export async function call(cb: () => any, err?: (e: string) => void) {
try {
return await cb()
} catch (e) {
} catch (e: any) {
console.log(`Error: ${e}`)
err?.(e.toString());
}
}
export const getDomain = (url: string) => {
try {
return new URL(url).hostname
} catch {
return ''
}
}
export const getShortenNpub = (npub = '') => {
return npub.substring(0, 10) + '...' + npub.slice(-4)
}