upd: megalodon to v7
This commit is contained in:
parent
b4674ce65c
commit
afda15260f
234 changed files with 21334 additions and 7675 deletions
|
@ -20,7 +20,7 @@ export function getClient(BASE_URL: string, authorization: string | undefined):
|
|||
const accessTokenArr = authorization?.split(" ") ?? [null];
|
||||
const accessToken = accessTokenArr[accessTokenArr.length - 1];
|
||||
const generator = (megalodon as any).default;
|
||||
const client = generator(BASE_URL, accessToken) as MegalodonInterface;
|
||||
const client = generator('misskey', BASE_URL, accessToken) as MegalodonInterface;
|
||||
return client;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ export class MastodonApiServerService {
|
|||
const accessTokens = _request.headers.authorization;
|
||||
const client = getClient(BASE_URL, accessTokens);
|
||||
try {
|
||||
const data = await client.getAccountFeaturedTags(convertId(_request.params.id, IdType.SharkeyId));
|
||||
const data = await client.getFeaturedTags();
|
||||
reply.send(data.data.map((tag) => convertFeaturedTag(tag)));
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
|
|
|
@ -83,8 +83,6 @@ export function convertNotification(notification: Entity.Notification) {
|
|||
notification.id = convertId(notification.id, IdConvertType.MastodonId);
|
||||
if (notification.status)
|
||||
notification.status = convertStatus(notification.status);
|
||||
if (notification.reaction)
|
||||
notification.reaction = convertReaction(notification.reaction);
|
||||
return notification;
|
||||
}
|
||||
|
||||
|
@ -120,8 +118,6 @@ export function convertStatus(status: Entity.Status) {
|
|||
}));
|
||||
if (status.poll) status.poll = convertPoll(status.poll);
|
||||
if (status.reblog) status.reblog = convertStatus(status.reblog);
|
||||
if (status.quote) status.quote = convertStatus(status.quote);
|
||||
status.reactions = status.reactions.map(convertReaction);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ export class apiAccountMastodon {
|
|||
acct.source = {
|
||||
note: acct.note,
|
||||
fields: acct.fields,
|
||||
privacy: await (this.client as any).getDefaultPostPrivacy(),
|
||||
privacy: "",
|
||||
sensitive: false,
|
||||
language: "",
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ export class apiAccountMastodon {
|
|||
|
||||
public async lookup() {
|
||||
try {
|
||||
const data = await this.client.search((this.request.query as any).acct, "accounts");
|
||||
const data = await this.client.search((this.request.query as any).acct, { type: "accounts" });
|
||||
return convertAccount(data.data.accounts[0]);
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue