From 73bb66a3f1d6b9b99333073c309368a9b2c3cc06 Mon Sep 17 00:00:00 2001 From: Natty Date: Mon, 31 Jul 2023 11:34:11 +0200 Subject: [PATCH] Misskey instance host fixes --- create-circle.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/create-circle.js b/create-circle.js index f66bbe9..ca65ec8 100644 --- a/create-circle.js +++ b/create-circle.js @@ -373,7 +373,8 @@ class MisskeyApiClient extends ApiClient { let id = null; for (const user of Array.isArray(lookup) ? lookup : []) { - if (user["host"] === handle.instance && user["username"] === handle.name) { + if ((user["host"] === handle.instance || this._instance === handle.instance && user["host"] === null) + && user["username"] === handle.name) { id = user["id"]; break; } @@ -456,7 +457,7 @@ class MisskeyApiClient extends ApiClient { avatar: renote["user"]["avatarUrl"], bot: renote["user"]["isBot"] || false, name: renote["user"]["name"], - handle: parseHandle(renote["user"]["username"], renote["user"]["host"]) + handle: parseHandle(renote["user"]["username"], renote["user"]["host"] ?? this._instance) })); } @@ -478,7 +479,7 @@ class MisskeyApiClient extends ApiClient { } return response.map(reply => { - const handle = parseHandle(reply["user"]["username"], reply["user"]["host"]); + const handle = parseHandle(reply["user"]["username"], reply["user"]["host"] ?? this._instance); return { id: reply.id, @@ -520,7 +521,7 @@ class MisskeyApiClient extends ApiClient { avatar: reaction["user"]["avatarUrl"], bot: reaction["user"]["isBot"] || false, name: reaction["user"]["name"], - handle: parseHandle(reaction["user"]["username"], reaction["user"]["host"]) + handle: parseHandle(reaction["user"]["username"], reaction["user"]["host"] ?? this._instance), })); }