Misskey instance host fixes

This commit is contained in:
Natty 2023-07-31 11:34:11 +02:00
parent e4aab98452
commit 73bb66a3f1
No known key found for this signature in database
GPG key ID: BF6CB659ADEE60EC

View file

@ -373,7 +373,8 @@ class MisskeyApiClient extends ApiClient {
let id = null; let id = null;
for (const user of Array.isArray(lookup) ? lookup : []) { 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"]; id = user["id"];
break; break;
} }
@ -456,7 +457,7 @@ class MisskeyApiClient extends ApiClient {
avatar: renote["user"]["avatarUrl"], avatar: renote["user"]["avatarUrl"],
bot: renote["user"]["isBot"] || false, bot: renote["user"]["isBot"] || false,
name: renote["user"]["name"], 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 => { 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 { return {
id: reply.id, id: reply.id,
@ -520,7 +521,7 @@ class MisskeyApiClient extends ApiClient {
avatar: reaction["user"]["avatarUrl"], avatar: reaction["user"]["avatarUrl"],
bot: reaction["user"]["isBot"] || false, bot: reaction["user"]["isBot"] || false,
name: reaction["user"]["name"], name: reaction["user"]["name"],
handle: parseHandle(reaction["user"]["username"], reaction["user"]["host"]) handle: parseHandle(reaction["user"]["username"], reaction["user"]["host"] ?? this._instance),
})); }));
} }