summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/mastodon/MastodonConverters.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--packages/backend/src/server/api/mastodon/MastodonConverters.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/backend/src/server/api/mastodon/MastodonConverters.ts b/packages/backend/src/server/api/mastodon/MastodonConverters.ts
index df8d68042a..02fa9ac85e 100644
--- a/packages/backend/src/server/api/mastodon/MastodonConverters.ts
+++ b/packages/backend/src/server/api/mastodon/MastodonConverters.ts
@@ -72,7 +72,7 @@ export class MastodonConverters {
private encode(u: MiUser, m: IMentionedRemoteUsers): MastodonEntity.Mention {
let acct = u.username;
- let acctUrl = `https://${u.host || this.config.host}/@${u.username}`;
+ let acctUrl = `https://${u.host || this.config.webHost}/@${u.username}`;
let url: string | null = null;
if (u.host) {
const info = m.find(r => r.username === u.username && r.host === u.host);
@@ -150,7 +150,7 @@ export class MastodonConverters {
public async convertAccount(account: Entity.Account | MiUser): Promise<MastodonEntity.Account> {
const user = await this.getUser(account.id);
const profile = await this.userProfilesRepository.findOneBy({ userId: user.id });
- const emojis = await this.customEmojiService.populateEmojis(user.emojis, user.host ? user.host : this.config.host);
+ const emojis = await this.customEmojiService.populateEmojis(user.emojis, user.host ? user.host : this.config.localHost);
const emoji: Entity.Emoji[] = [];
Object.entries(emojis).forEach(entry => {
const [key, value] = entry;
@@ -162,10 +162,10 @@ export class MastodonConverters {
category: undefined,
});
});
- const fqn = `${user.username}@${user.host ?? this.config.hostname}`;
+ const fqn = `${user.username}@${user.host ?? this.config.localHostname}`;
let acct = user.username;
- let acctUrl = `https://${user.host || this.config.host}/@${user.username}`;
- const acctUri = `https://${this.config.host}/users/${user.id}`;
+ let acctUrl = `https://${user.host || this.config.webHost}/@${user.username}`;
+ const acctUri = `https://${this.config.webHost}/users/${user.id}`;
if (user.host) {
acct = `${user.username}@${user.host}`;
acctUrl = `https://${user.host}/@${user.username}`;
@@ -228,7 +228,7 @@ export class MastodonConverters {
const isQuote = renote && (edit.cw || edit.newText || edit.fileIds.length > 0 || note.replyId);
const quoteUri = isQuote
- ? renote.url ?? renote.uri ?? `${this.config.url}/notes/${renote.id}`
+ ? renote.url ?? renote.uri ?? `${this.config.webUrl}/notes/${renote.id}`
: null;
const item = {
@@ -258,7 +258,7 @@ export class MastodonConverters {
const noteUser = hints?.user ?? note.user ?? await this.getUser(status.account.id);
const mentionedRemoteUsers = JSON.parse(note.mentionedRemoteUsers);
- const emojis = await this.customEmojiService.populateEmojis(note.emojis, noteUser.host ? noteUser.host : this.config.host);
+ const emojis = await this.customEmojiService.populateEmojis(note.emojis, noteUser.host ? noteUser.host : this.config.localHost);
const emoji: Entity.Emoji[] = [];
Object.entries(emojis).forEach(entry => {
const [key, value] = entry;
@@ -280,7 +280,7 @@ export class MastodonConverters {
const tags = note.tags.map(tag => {
return {
name: tag,
- url: `${this.config.url}/tags/${tag}`,
+ url: `${this.config.webUrl}/tags/${tag}`,
} as Entity.Tag;
});
@@ -291,7 +291,7 @@ export class MastodonConverters {
const quoteUri = Promise.resolve(renote).then(renote => {
if (!renote || !isQuote) return null;
- return renote.url ?? renote.uri ?? `${this.config.url}/notes/${renote.id}`;
+ return renote.url ?? renote.uri ?? `${this.config.webUrl}/notes/${renote.id}`;
});
const text = note.text;
@@ -306,8 +306,8 @@ export class MastodonConverters {
// noinspection ES6MissingAwait
return await awaitAll({
id: note.id,
- uri: note.uri ?? `https://${this.config.host}/notes/${note.id}`,
- url: note.url ?? note.uri ?? `https://${this.config.host}/notes/${note.id}`,
+ uri: note.uri ?? `https://${this.config.webHost}/notes/${note.id}`,
+ url: note.url ?? note.uri ?? `https://${this.config.webHost}/notes/${note.id}`,
account: convertedAccount,
in_reply_to_id: note.replyId,
in_reply_to_account_id: note.replyUserId,