Implement connectApp logic, add app url and icon
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user