mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-07-12 20:31:21 +00:00
22 lines
575 B
TypeScript
22 lines
575 B
TypeScript
export const createAvatarLink = (qortalName: string)=> {
|
|
return `/arbitrary/THUMBNAIL/${encodeURIComponent(qortalName)}/qortal_avatar?async=true`
|
|
}
|
|
|
|
const removeTrailingSlash = (str: string) => str.replace(/\/$/, '');
|
|
|
|
export const createQortalLink = (
|
|
type: 'APP' | 'WEBSITE',
|
|
appName: string,
|
|
path: string
|
|
) => {
|
|
const encodedAppName = encodeURIComponent(appName);
|
|
let link = `qortal://${type}/${encodedAppName}`;
|
|
|
|
if (path) {
|
|
link += path.startsWith('/')
|
|
? removeTrailingSlash(path)
|
|
: '/' + removeTrailingSlash(path);
|
|
}
|
|
|
|
return link;
|
|
}; |