fix: user url

This commit is contained in:
Mar0xy 2023-09-25 02:56:43 +02:00
parent 645907851d
commit 485173c915
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -71,12 +71,12 @@ namespace MisskeyAPI {
export const user = (u: Entity.User, host: string | null = null): MegalodonEntity.Account => {
host ? host = host.replace("https://", "") : null;
let acct = u.username
if (u.host) {
acct = `${u.username}@${u.host}`
}
if (host) {
acct = `${u.username}@${host}`
}
if (u.host) {
acct = `${u.username}@${u.host}`
}
return {
id: u.id,
username: u.username,
@ -92,7 +92,7 @@ namespace MisskeyAPI {
following_count: 0,
statuses_count: 0,
note: '',
url: acct,
url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct,
avatar: u.avatarUrl,
avatar_static: u.avatarColor,
header: '',
@ -107,12 +107,12 @@ namespace MisskeyAPI {
export const userDetail = (u: Entity.UserDetail, host: string | null = null): MegalodonEntity.Account => {
host ? host = host.replace("https://", "") : null;
let acct = u.username
if (u.host) {
acct = `${u.username}@${u.host}`
}
if (host) {
acct = `${u.username}@${host}`
}
if (u.host) {
acct = `${u.username}@${u.host}`
}
return {
id: u.id,
username: u.username,
@ -128,7 +128,7 @@ namespace MisskeyAPI {
following_count: u.followingCount,
statuses_count: u.notesCount,
note: u.description ? u.description : '',
url: acct,
url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct,
avatar: u.avatarUrl,
avatar_static: u.avatarColor,
header: u.bannerUrl,