summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core')
-rw-r--r--packages/backend/src/core/ChatService.ts2
-rw-r--r--packages/backend/src/core/EmailService.ts6
-rw-r--r--packages/backend/src/core/GlobalEventService.ts2
-rw-r--r--packages/backend/src/core/InternalStorageService.ts4
-rw-r--r--packages/backend/src/core/MfmService.ts4
-rw-r--r--packages/backend/src/core/NoteCreateService.ts2
-rw-r--r--packages/backend/src/core/NoteDeleteService.ts4
-rw-r--r--packages/backend/src/core/NotePiningService.ts4
-rw-r--r--packages/backend/src/core/PushNotificationService.ts2
-rw-r--r--packages/backend/src/core/RemoteUserResolveService.ts2
-rw-r--r--packages/backend/src/core/UserFollowingService.ts2
-rw-r--r--packages/backend/src/core/UserSearchService.ts2
-rw-r--r--packages/backend/src/core/UtilityService.ts8
-rw-r--r--packages/backend/src/core/WebAuthnService.ts6
-rw-r--r--packages/backend/src/core/activitypub/ApDbResolverService.ts4
-rw-r--r--packages/backend/src/core/activitypub/ApInboxService.ts2
-rw-r--r--packages/backend/src/core/activitypub/ApRendererService.ts48
-rw-r--r--packages/backend/src/core/activitypub/ApRequestService.ts4
-rw-r--r--packages/backend/src/core/activitypub/models/ApPersonService.ts5
-rw-r--r--packages/backend/src/core/entities/DriveFileEntityService.ts2
-rw-r--r--packages/backend/src/core/entities/MetaEntityService.ts2
-rw-r--r--packages/backend/src/core/entities/UserEntityService.ts6
22 files changed, 63 insertions, 60 deletions
diff --git a/packages/backend/src/core/ChatService.ts b/packages/backend/src/core/ChatService.ts
index 5cd336a097..b1a79090aa 100644
--- a/packages/backend/src/core/ChatService.ts
+++ b/packages/backend/src/core/ChatService.ts
@@ -379,7 +379,7 @@ export class ChatService {
if (this.userEntityService.isLocalUser(toUser)) this.globalEventService.publishChatUserStream(message.toUserId, message.fromUserId, 'deleted', message.id);
if (this.userEntityService.isLocalUser(fromUser) && this.userEntityService.isRemoteUser(toUser)) {
- //const activity = this.apRendererService.addContext(this.apRendererService.renderDelete(this.apRendererService.renderTombstone(`${this.config.url}/notes/${message.id}`), fromUser));
+ //const activity = this.apRendererService.addContext(this.apRendererService.renderDelete(this.apRendererService.renderTombstone(`${this.config.webUrl}/notes/${message.id}`), fromUser));
//this.queueService.deliver(fromUser, activity, toUser.inbox);
}
} else if (message.toRoomId) {
diff --git a/packages/backend/src/core/EmailService.ts b/packages/backend/src/core/EmailService.ts
index 384704b252..eb5490101b 100644
--- a/packages/backend/src/core/EmailService.ts
+++ b/packages/backend/src/core/EmailService.ts
@@ -42,8 +42,8 @@ export class EmailService {
public async sendEmail(to: string, subject: string, html: string, text: string) {
if (!this.meta.enableEmail) return;
- const iconUrl = `${this.config.url}/static-assets/mi-white.png`;
- const emailSettingUrl = `${this.config.url}/settings/email`;
+ const iconUrl = `${this.config.webUrl}/static-assets/mi-white.png`;
+ const emailSettingUrl = `${this.config.webUrl}/settings/email`;
const enableAuth = this.meta.smtpUser != null && this.meta.smtpUser !== '';
@@ -135,7 +135,7 @@ export class EmailService {
</footer>
</main>
<nav>
- <a href="${ this.config.url }">${ this.config.host }</a>
+ <a href="${ this.config.webUrl }">${ this.config.webHost }</a>
</nav>
</body>
</html>`;
diff --git a/packages/backend/src/core/GlobalEventService.ts b/packages/backend/src/core/GlobalEventService.ts
index da5982abf6..a6d6baf2cb 100644
--- a/packages/backend/src/core/GlobalEventService.ts
+++ b/packages/backend/src/core/GlobalEventService.ts
@@ -351,7 +351,7 @@ export class GlobalEventService {
{ type: type, body: null } :
{ type: type, body: value };
- this.redisForPub.publish(this.config.host, JSON.stringify({
+ this.redisForPub.publish(this.config.webHost, JSON.stringify({
channel: channel,
message: message,
}));
diff --git a/packages/backend/src/core/InternalStorageService.ts b/packages/backend/src/core/InternalStorageService.ts
index 4fb8a93e49..f189d55d11 100644
--- a/packages/backend/src/core/InternalStorageService.ts
+++ b/packages/backend/src/core/InternalStorageService.ts
@@ -39,14 +39,14 @@ export class InternalStorageService {
public saveFromPath(key: string, srcPath: string) {
fs.mkdirSync(path, { recursive: true });
fs.copyFileSync(srcPath, this.resolvePath(key));
- return `${this.config.url}/files/${key}`;
+ return `${this.config.webUrl}/files/${key}`;
}
@bindThis
public saveFromBuffer(key: string, data: Buffer) {
fs.mkdirSync(path, { recursive: true });
fs.writeFileSync(this.resolvePath(key), data);
- return `${this.config.url}/files/${key}`;
+ return `${this.config.webUrl}/files/${key}`;
}
@bindThis
diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts
index 274966d921..b633839de8 100644
--- a/packages/backend/src/core/MfmService.ts
+++ b/packages/backend/src/core/MfmService.ts
@@ -357,7 +357,7 @@ export class MfmService {
},
hashtag: (node) => {
- return `<a href="${escapeHtml(`${this.config.url}/tags/${encodeURIComponent(node.props.hashtag)}`)}" rel="tag">#${escapeHtml(node.props.hashtag)}</a>`;
+ return `<a href="${escapeHtml(`${this.config.webUrl}/tags/${encodeURIComponent(node.props.hashtag)}`)}" rel="tag">#${escapeHtml(node.props.hashtag)}</a>`;
},
inlineCode: (node) => {
@@ -386,7 +386,7 @@ export class MfmService {
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username.toLowerCase() === username.toLowerCase() && remoteUser.host?.toLowerCase() === host?.toLowerCase());
const href = remoteUserInfo
? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri)
- : `${this.config.url}/${acct.endsWith(`@${this.config.url}`) ? acct.substring(0, acct.length - this.config.url.length - 1) : acct}`;
+ : `${this.config.webUrl}/${acct.endsWith(`@${this.config.localUrl}`) ? acct.substring(0, acct.length - this.config.localUrl.length - 1) : acct}`;
try {
const url = new URL(href);
return `<a href="${escapeHtml(url.href)}" class="u-url mention">${escapeHtml(acct)}</a>`;
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 748f2cbad9..7fb5515959 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -950,7 +950,7 @@ export class NoteCreateService implements OnApplicationShutdown {
if (data.localOnly) return null;
const content = this.isRenote(data) && !this.isQuote(data)
- ? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.url}/notes/${data.renote.id}`, note)
+ ? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.webUrl}/notes/${data.renote.id}`, note)
: this.apRendererService.renderCreate(await this.apRendererService.renderNote(note, false), note);
return this.apRendererService.addContext(content);
diff --git a/packages/backend/src/core/NoteDeleteService.ts b/packages/backend/src/core/NoteDeleteService.ts
index af1f0eda9a..dee115b548 100644
--- a/packages/backend/src/core/NoteDeleteService.ts
+++ b/packages/backend/src/core/NoteDeleteService.ts
@@ -84,8 +84,8 @@ export class NoteDeleteService {
}
const content = this.apRendererService.addContext(renote
- ? this.apRendererService.renderUndo(this.apRendererService.renderAnnounce(renote.uri ?? `${this.config.url}/notes/${renote.id}`, note), user)
- : this.apRendererService.renderDelete(this.apRendererService.renderTombstone(`${this.config.url}/notes/${note.id}`), user));
+ ? this.apRendererService.renderUndo(this.apRendererService.renderAnnounce(renote.uri ?? `${this.config.webUrl}/notes/${renote.id}`, note), user)
+ : this.apRendererService.renderDelete(this.apRendererService.renderTombstone(`${this.config.webUrl}/notes/${note.id}`), user));
this.deliverToConcerned(user, note, content);
}
diff --git a/packages/backend/src/core/NotePiningService.ts b/packages/backend/src/core/NotePiningService.ts
index d38b48b65d..3665dd5f03 100644
--- a/packages/backend/src/core/NotePiningService.ts
+++ b/packages/backend/src/core/NotePiningService.ts
@@ -117,8 +117,8 @@ export class NotePiningService {
if (!this.userEntityService.isLocalUser(user)) return;
- const target = `${this.config.url}/users/${user.id}/collections/featured`;
- const item = `${this.config.url}/notes/${noteId}`;
+ const target = `${this.config.webUrl}/users/${user.id}/collections/featured`;
+ const item = `${this.config.webUrl}/notes/${noteId}`;
const content = this.apRendererService.addContext(isAddition ? this.apRendererService.renderAdd(user, target, item) : this.apRendererService.renderRemove(user, target, item));
this.apDeliverManagerService.deliverToFollowers(user, content);
diff --git a/packages/backend/src/core/PushNotificationService.ts b/packages/backend/src/core/PushNotificationService.ts
index 9333c1ebc5..e9ded5f282 100644
--- a/packages/backend/src/core/PushNotificationService.ts
+++ b/packages/backend/src/core/PushNotificationService.ts
@@ -77,7 +77,7 @@ export class PushNotificationService implements OnApplicationShutdown {
if (!this.meta.enableServiceWorker || this.meta.swPublicKey == null || this.meta.swPrivateKey == null) return;
// アプリケーションの連絡先と、サーバーサイドの鍵ペアの情報を登録
- push.setVapidDetails(this.config.url,
+ push.setVapidDetails(this.config.webUrl,
this.meta.swPublicKey,
this.meta.swPrivateKey);
diff --git a/packages/backend/src/core/RemoteUserResolveService.ts b/packages/backend/src/core/RemoteUserResolveService.ts
index a2f1b73cdb..55c03e9777 100644
--- a/packages/backend/src/core/RemoteUserResolveService.ts
+++ b/packages/backend/src/core/RemoteUserResolveService.ts
@@ -56,7 +56,7 @@ export class RemoteUserResolveService {
host = this.utilityService.toPuny(host);
- if (host === this.utilityService.toPuny(this.config.host)) {
+ if (host === this.utilityService.toPuny(this.config.localHost)) {
this.logger.info(`return local user: ${usernameLower}`);
return await this.usersRepository.findOneBy({ usernameLower, host: IsNull() }).then(u => {
if (u == null) {
diff --git a/packages/backend/src/core/UserFollowingService.ts b/packages/backend/src/core/UserFollowingService.ts
index e7a6be99fb..9d2ab73fe8 100644
--- a/packages/backend/src/core/UserFollowingService.ts
+++ b/packages/backend/src/core/UserFollowingService.ts
@@ -536,7 +536,7 @@ export class UserFollowingService implements OnModuleInit {
}
if (this.userEntityService.isLocalUser(follower) && this.userEntityService.isRemoteUser(followee)) {
- const content = this.apRendererService.addContext(this.apRendererService.renderFollow(follower as MiPartialLocalUser, followee as MiPartialRemoteUser, requestId ?? `${this.config.url}/follows/${followRequest.id}`));
+ const content = this.apRendererService.addContext(this.apRendererService.renderFollow(follower as MiPartialLocalUser, followee as MiPartialRemoteUser, requestId ?? `${this.config.webUrl}/follows/${followRequest.id}`));
this.queueService.deliver(follower, content, followee.inbox, false);
}
}
diff --git a/packages/backend/src/core/UserSearchService.ts b/packages/backend/src/core/UserSearchService.ts
index 4be7bd9bdb..15245c39b7 100644
--- a/packages/backend/src/core/UserSearchService.ts
+++ b/packages/backend/src/core/UserSearchService.ts
@@ -198,7 +198,7 @@ export class UserSearchService {
}
if (params.host) {
- if (params.host === this.config.hostname || params.host === '.') {
+ if (params.host === this.config.localHostname || params.host === '.') {
userQuery.andWhere('user.host IS NULL');
} else {
userQuery.andWhere('user.host LIKE :host', {
diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts
index e3ceebccae..38390d0a2c 100644
--- a/packages/backend/src/core/UtilityService.ts
+++ b/packages/backend/src/core/UtilityService.ts
@@ -26,18 +26,20 @@ export class UtilityService {
@bindThis
public getFullApAccount(username: string, host: string | null): string {
- return host ? `${username}@${this.toPuny(host)}` : `${username}@${this.toPuny(this.config.host)}`;
+ return host ? `${username}@${this.toPuny(host)}` : `${username}@${this.toPuny(this.config.localHost)}`;
}
@bindThis
public isSelfHost(host: string | null): boolean {
if (host == null) return true;
- return this.toPuny(this.config.host) === this.toPuny(host);
+ return (this.toPuny(this.config.localHost) === this.toPuny(host)) ||
+ (this.toPuny(this.config.webHost) === this.toPuny(host))
}
@bindThis
public isUriLocal(uri: string): boolean {
- return this.punyHost(uri) === this.toPuny(this.config.host);
+ return (this.punyHost(uri) === this.toPuny(this.config.localHost)) ||
+ (this.punyHost(uri) === this.toPuny(this.config.webHost))
}
// メールアドレスのバリデーションを行う
diff --git a/packages/backend/src/core/WebAuthnService.ts b/packages/backend/src/core/WebAuthnService.ts
index 31c8d67c60..f0dc9dc104 100644
--- a/packages/backend/src/core/WebAuthnService.ts
+++ b/packages/backend/src/core/WebAuthnService.ts
@@ -46,9 +46,9 @@ export class WebAuthnService {
@bindThis
public getRelyingParty(): { origin: string; rpId: string; rpName: string; rpIcon?: string; } {
return {
- origin: this.config.url,
- rpId: this.config.hostname,
- rpName: this.meta.name ?? this.config.host,
+ origin: this.config.webUrl,
+ rpId: this.config.webHostname,
+ rpName: this.meta.name ?? this.config.webHost,
rpIcon: this.meta.iconUrl ?? undefined,
};
}
diff --git a/packages/backend/src/core/activitypub/ApDbResolverService.ts b/packages/backend/src/core/activitypub/ApDbResolverService.ts
index 5c16744a77..69933aaef6 100644
--- a/packages/backend/src/core/activitypub/ApDbResolverService.ts
+++ b/packages/backend/src/core/activitypub/ApDbResolverService.ts
@@ -65,9 +65,9 @@ export class ApDbResolverService implements OnApplicationShutdown {
const separator = '/';
const uri = new URL(getApId(value));
- if (this.utilityService.toPuny(uri.host) !== this.utilityService.toPuny(this.config.host)) {
+ if ((this.utilityService.toPuny(uri.host) !== this.utilityService.toPuny(this.config.localHost)) &&
+ (this.utilityService.toPuny(uri.host) !== this.utilityService.toPuny(this.config.webHost)))
return { local: false, uri: uri.href };
- }
const [, type, id, ...rest] = uri.pathname.split(separator);
return {
diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts
index ff47ca930d..1173c4bcce 100644
--- a/packages/backend/src/core/activitypub/ApInboxService.ts
+++ b/packages/backend/src/core/activitypub/ApInboxService.ts
@@ -549,7 +549,7 @@ export class ApInboxService {
const uris = getApIds(activity.object);
const userIds = uris
- .filter(uri => uri.startsWith(this.config.url + '/users/'))
+ .filter(uri => uri.startsWith(this.config.webUrl + '/users/'))
.map(uri => uri.split('/').at(-1))
.filter(x => x != null);
const users = await this.usersRepository.findBy({
diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts
index 8c461b6031..d50d72d188 100644
--- a/packages/backend/src/core/activitypub/ApRendererService.ts
+++ b/packages/backend/src/core/activitypub/ApRendererService.ts
@@ -110,7 +110,7 @@ export class ApRendererService {
}
return {
- id: `${this.config.url}/notes/${note.id}/activity`,
+ id: `${this.config.webUrl}/notes/${note.id}/activity`,
actor: this.userEntityService.genLocalUserUri(note.userId),
type: 'Announce',
published: this.idService.parse(note.id).date.toISOString(),
@@ -133,7 +133,7 @@ export class ApRendererService {
return {
type: 'Block',
- id: `${this.config.url}/blocks/${block.id}`,
+ id: `${this.config.webUrl}/blocks/${block.id}`,
actor: this.userEntityService.genLocalUserUri(block.blockerId),
object: block.blockee.uri,
};
@@ -142,7 +142,7 @@ export class ApRendererService {
@bindThis
public renderCreate(object: IObject, note: MiNote): ICreate {
const activity: ICreate = {
- id: `${this.config.url}/notes/${note.id}/activity`,
+ id: `${this.config.webUrl}/notes/${note.id}/activity`,
actor: this.userEntityService.genLocalUserUri(note.userId),
type: 'Create',
published: this.idService.parse(note.id).date.toISOString(),
@@ -179,7 +179,7 @@ export class ApRendererService {
@bindThis
public renderEmoji(emoji: MiEmoji): IApEmoji {
return {
- id: `${this.config.url}/emojis/${emoji.name}`,
+ id: `${this.config.webUrl}/emojis/${emoji.name}`,
type: 'Emoji',
name: `:${emoji.name}:`,
updated: emoji.updatedAt != null ? emoji.updatedAt.toISOString() : new Date().toISOString(),
@@ -209,7 +209,7 @@ export class ApRendererService {
@bindThis
public renderFollowRelay(relay: MiRelay, relayActor: MiLocalUser): IFollow {
return {
- id: `${this.config.url}/activities/follow-relay/${relay.id}`,
+ id: `${this.config.webUrl}/activities/follow-relay/${relay.id}`,
type: 'Follow',
actor: this.userEntityService.genLocalUserUri(relayActor.id),
object: 'https://www.w3.org/ns/activitystreams#Public',
@@ -233,7 +233,7 @@ export class ApRendererService {
requestId?: string,
): IFollow {
return {
- id: requestId ?? `${this.config.url}/follows/${follower.id}/${followee.id}`,
+ id: requestId ?? `${this.config.webUrl}/follows/${follower.id}/${followee.id}`,
type: 'Follow',
actor: this.userEntityService.getUserUri(follower),
object: this.userEntityService.getUserUri(followee),
@@ -244,7 +244,7 @@ export class ApRendererService {
public renderHashtag(tag: string): IApHashtag {
return {
type: 'Hashtag',
- href: `${this.config.url}/tags/${encodeURIComponent(tag)}`,
+ href: `${this.config.webUrl}/tags/${encodeURIComponent(tag)}`,
name: `#${tag}`,
};
}
@@ -294,7 +294,7 @@ export class ApRendererService {
@bindThis
public renderKey(user: MiLocalUser, key: MiUserKeypair, postfix?: string): IKey {
return {
- id: `${this.config.url}/users/${user.id}${postfix ?? '/publickey'}`,
+ id: `${this.config.webUrl}/users/${user.id}${postfix ?? '/publickey'}`,
type: 'Key',
owner: this.userEntityService.genLocalUserUri(user.id),
publicKeyPem: createPublicKey(key.publicKey).export({
@@ -310,9 +310,9 @@ export class ApRendererService {
const object: ILike = {
type: 'Like',
- id: `${this.config.url}/likes/${noteReaction.id}`,
- actor: `${this.config.url}/users/${noteReaction.userId}`,
- object: note.uri ? note.uri : `${this.config.url}/notes/${noteReaction.noteId}`,
+ id: `${this.config.webUrl}/likes/${noteReaction.id}`,
+ actor: `${this.config.webUrl}/users/${noteReaction.userId}`,
+ object: note.uri ? note.uri : `${this.config.webUrl}/notes/${noteReaction.noteId}`,
content: reaction,
_misskey_reaction: reaction,
};
@@ -344,7 +344,7 @@ export class ApRendererService {
const actor = this.userEntityService.getUserUri(src);
const target = this.userEntityService.getUserUri(dst);
return {
- id: `${this.config.url}/moves/${src.id}/${dst.id}`,
+ id: `${this.config.webUrl}/moves/${src.id}/${dst.id}`,
actor,
type: 'Move',
object: actor,
@@ -376,7 +376,7 @@ export class ApRendererService {
if (dive) {
inReplyTo = await this.renderNote(inReplyToNote, false);
} else {
- inReplyTo = `${this.config.url}/notes/${inReplyToNote.id}`;
+ inReplyTo = `${this.config.webUrl}/notes/${inReplyToNote.id}`;
}
}
}
@@ -391,7 +391,7 @@ export class ApRendererService {
const renote = await this.notesRepository.findOneBy({ id: note.renoteId });
if (renote) {
- quote = renote.uri ? renote.uri : `${this.config.url}/notes/${renote.id}`;
+ quote = renote.uri ? renote.uri : `${this.config.webUrl}/notes/${renote.id}`;
}
}
@@ -467,7 +467,7 @@ export class ApRendererService {
} as const : {};
return {
- id: `${this.config.url}/notes/${note.id}`,
+ id: `${this.config.webUrl}/notes/${note.id}`,
type: 'Note',
attributedTo,
summary: summary ?? undefined,
@@ -548,9 +548,9 @@ export class ApRendererService {
followers: `${id}/followers`,
following: `${id}/following`,
featured: `${id}/collections/featured`,
- sharedInbox: `${this.config.url}/inbox`,
- endpoints: { sharedInbox: `${this.config.url}/inbox` },
- url: `${this.config.url}/@${user.username}`,
+ sharedInbox: `${this.config.webUrl}/inbox`,
+ endpoints: { sharedInbox: `${this.config.webUrl}/inbox` },
+ url: `${this.config.webUrl}/@${user.username}`,
preferredUsername: user.username,
name: user.name,
summary: profile.description ? this.mfmService.toHtml(mfm.parse(profile.description)) : null,
@@ -592,7 +592,7 @@ export class ApRendererService {
public renderQuestion(user: { id: MiUser['id'] }, note: MiNote, poll: MiPoll): IQuestion {
return {
type: 'Question',
- id: `${this.config.url}/questions/${note.id}`,
+ id: `${this.config.webUrl}/questions/${note.id}`,
actor: this.userEntityService.genLocalUserUri(user.id),
content: note.text ?? '',
[poll.multiple ? 'anyOf' : 'oneOf']: poll.choices.map((text, i) => ({
@@ -649,7 +649,7 @@ export class ApRendererService {
@bindThis
public renderUpdate(object: string | IObject, user: { id: MiUser['id'] }): IUpdate {
return {
- id: `${this.config.url}/users/${user.id}#updates/${new Date().getTime()}`,
+ id: `${this.config.webUrl}/users/${user.id}#updates/${new Date().getTime()}`,
actor: this.userEntityService.genLocalUserUri(user.id),
type: 'Update',
to: ['https://www.w3.org/ns/activitystreams#Public'],
@@ -661,13 +661,13 @@ export class ApRendererService {
@bindThis
public renderVote(user: { id: MiUser['id'] }, vote: MiPollVote, note: MiNote, poll: MiPoll, pollOwner: MiRemoteUser): ICreate {
return {
- id: `${this.config.url}/users/${user.id}#votes/${vote.id}/activity`,
+ id: `${this.config.webUrl}/users/${user.id}#votes/${vote.id}/activity`,
actor: this.userEntityService.genLocalUserUri(user.id),
type: 'Create',
to: [pollOwner.uri],
published: new Date().toISOString(),
object: {
- id: `${this.config.url}/users/${user.id}#votes/${vote.id}`,
+ id: `${this.config.webUrl}/users/${user.id}#votes/${vote.id}`,
type: 'Note',
attributedTo: this.userEntityService.genLocalUserUri(user.id),
to: [pollOwner.uri],
@@ -680,7 +680,7 @@ export class ApRendererService {
@bindThis
public addContext<T extends IObject>(x: T): T & { '@context': any; id: string; } {
if (typeof x === 'object' && x.id == null) {
- x.id = `${this.config.url}/${randomUUID()}`;
+ x.id = `${this.config.webUrl}/${randomUUID()}`;
}
return Object.assign({ '@context': CONTEXT }, x as T & { id: string });
@@ -692,7 +692,7 @@ export class ApRendererService {
const jsonLd = this.jsonLdService.use();
jsonLd.debug = false;
- activity = await jsonLd.signRsaSignature2017(activity, keypair.privateKey, `${this.config.url}/users/${user.id}#main-key`);
+ activity = await jsonLd.signRsaSignature2017(activity, keypair.privateKey, `${this.config.webUrl}/users/${user.id}#main-key`);
return activity;
}
diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts
index d14b82dc92..df10d076cd 100644
--- a/packages/backend/src/core/activitypub/ApRequestService.ts
+++ b/packages/backend/src/core/activitypub/ApRequestService.ts
@@ -163,7 +163,7 @@ export class ApRequestService {
const req = ApRequestCreator.createSignedPost({
key: {
privateKeyPem: keypair.privateKey,
- keyId: `${this.config.url}/users/${user.id}#main-key`,
+ keyId: `${this.config.webUrl}/users/${user.id}#main-key`,
},
url,
body,
@@ -192,7 +192,7 @@ export class ApRequestService {
const req = ApRequestCreator.createSignedGet({
key: {
privateKeyPem: keypair.privateKey,
- keyId: `${this.config.url}/users/${user.id}#main-key`,
+ keyId: `${this.config.webUrl}/users/${user.id}#main-key`,
},
url,
additionalHeaders: {
diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts
index ebe8e9c964..5336177965 100644
--- a/packages/backend/src/core/activitypub/models/ApPersonService.ts
+++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts
@@ -233,7 +233,7 @@ export class ApPersonService implements OnModuleInit {
if (cached) return cached;
// URIがこのサーバーを指しているならデータベースからフェッチ
- if (uri.startsWith(`${this.config.url}/`)) {
+ if (uri.startsWith(`${this.config.webUrl}/`) || uri.startsWith(`${this.config.localUrl}/`)) {
const id = uri.split('/').pop();
const u = await this.usersRepository.findOneBy({ id }) as MiLocalUser | null;
if (u) this.cacheService.uriPersonCache.set(uri, u);
@@ -305,7 +305,8 @@ export class ApPersonService implements OnModuleInit {
if (typeof uri !== 'string') throw new Error('uri is not string');
const host = this.utilityService.punyHost(uri);
- if (host === this.utilityService.toPuny(this.config.host)) {
+ if ((host === this.utilityService.toPuny(this.config.localHost)) ||
+ (host === this.utilityService.toPuny(this.config.webHost))) {
throw new StatusError('cannot resolve local user', 400, 'cannot resolve local user');
}
diff --git a/packages/backend/src/core/entities/DriveFileEntityService.ts b/packages/backend/src/core/entities/DriveFileEntityService.ts
index 1865d494c4..10e333c04b 100644
--- a/packages/backend/src/core/entities/DriveFileEntityService.ts
+++ b/packages/backend/src/core/entities/DriveFileEntityService.ts
@@ -123,7 +123,7 @@ export class DriveFileEntityService {
const key = file.webpublicAccessKey;
if (key && !key.match('/')) { // 古いものはここにオブジェクトストレージキーが入ってるので除外
- const url = `${this.config.url}/files/${key}`;
+ const url = `${this.config.webUrl}/files/${key}`;
if (mode === 'avatar') return this.getProxiedUrl(file.uri, 'avatar');
return url;
}
diff --git a/packages/backend/src/core/entities/MetaEntityService.ts b/packages/backend/src/core/entities/MetaEntityService.ts
index 8e56ddbc02..29790c79a0 100644
--- a/packages/backend/src/core/entities/MetaEntityService.ts
+++ b/packages/backend/src/core/entities/MetaEntityService.ts
@@ -74,7 +74,7 @@ export class MetaEntityService {
name: instance.name,
shortName: instance.shortName,
- uri: this.config.url,
+ uri: this.config.webUrl,
description: instance.description,
langs: instance.langs,
tosUrl: instance.termsOfServiceUrl,
diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts
index 0f4051e7b8..eae9ade0d2 100644
--- a/packages/backend/src/core/entities/UserEntityService.ts
+++ b/packages/backend/src/core/entities/UserEntityService.ts
@@ -383,10 +383,10 @@ export class UserEntityService implements OnModuleInit {
@bindThis
public getIdenticonUrl(user: MiUser): string {
- if ((user.host == null || user.host === this.config.host) && user.username.includes('.') && this.meta.iconUrl) { // ローカルのシステムアカウントの場合
+ if ((user.host == null || user.host === this.config.localHost) && user.username.includes('.') && this.meta.iconUrl) { // ローカルのシステムアカウントの場合
return this.meta.iconUrl;
} else {
- return `${this.config.url}/identicon/${user.username.toLowerCase()}@${user.host ?? this.config.host}`;
+ return `${this.config.webUrl}/identicon/${user.username.toLowerCase()}@${user.host ?? this.config.localHost}`;
}
}
@@ -398,7 +398,7 @@ export class UserEntityService implements OnModuleInit {
@bindThis
public genLocalUserUri(userId: string): string {
- return `${this.config.url}/users/${userId}`;
+ return `${this.config.webUrl}/users/${userId}`;
}
public async pack<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(