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
1 changed files with 8 additions and 8 deletions

View File

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