diff --git a/packages/backend/package.json b/packages/backend/package.json index 2037490924..0600644899 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -28,7 +28,7 @@ "@bull-board/api": "5.2.0", "@bull-board/koa": "5.2.0", "@bull-board/ui": "5.2.0", - "@calckey/megalodon": "workspace:*", + "megalodon": "workspace:*", "@discordapp/twemoji": "14.1.2", "@elastic/elasticsearch": "7.17.0", "@koa/cors": "3.4.3", diff --git a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts index 21d62bbec1..753f73ead5 100644 --- a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts +++ b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts @@ -1,5 +1,5 @@ import Router from "@koa/router"; -import megalodon, { MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { MegalodonInterface } from "megalodon"; import { apiAuthMastodon } from "./endpoints/auth.js"; import { apiAccountMastodon } from "./endpoints/account.js"; import { apiStatusMastodon } from "./endpoints/status.js"; diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 825d0f5183..37c6283a11 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -1,4 +1,4 @@ -import { Entity } from "@calckey/megalodon"; +import { Entity } from "megalodon"; import { convertId, IdType } from "../index.js"; function simpleConvert(data: any) { @@ -21,6 +21,9 @@ export function convertFilter(filter: Entity.Filter) { export function convertList(list: Entity.List) { return simpleConvert(list); } +export function convertFeaturedTag(tag: Entity.FeaturedTag) { + return simpleConvert(tag); +} export function convertNotification(notification: Entity.Notification) { notification.account = convertAccount(notification.account); diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 7ca45eebba..3fb1c9cbe4 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -7,6 +7,7 @@ import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; import { convertId, IdType } from "../../index.js"; import { convertAccount, + convertFeaturedTag, convertList, convertRelationship, convertStatus, @@ -174,7 +175,7 @@ export function apiAccountMastodon(router: Router): void { const data = await client.getAccountFeaturedTags( convertId(ctx.params.id, IdType.CalckeyId), ); - ctx.body = data.data.map((account) => convertAccount(account)); + ctx.body = data.data.map((tag) => convertFeaturedTag(tag)); } catch (e: any) { console.error(e); console.error(e.response.data); @@ -367,7 +368,7 @@ export function apiAccountMastodon(router: Router): void { const client = getClient(BASE_URL, accessTokens); try { const data = await client.getFeaturedTags(); - ctx.body = data.data.map((account) => convertAccount(account)); + ctx.body = data.data.map((tag) => convertFeaturedTag(tag)); } catch (e: any) { console.error(e); console.error(e.response.data); @@ -381,7 +382,7 @@ export function apiAccountMastodon(router: Router): void { const client = getClient(BASE_URL, accessTokens); try { const data = await client.getFollowedTags(); - ctx.body = data.data.map((account) => convertAccount(account)); + ctx.body = data.data; } catch (e: any) { console.error(e); console.error(e.response.data); diff --git a/packages/backend/src/server/api/mastodon/endpoints/auth.ts b/packages/backend/src/server/api/mastodon/endpoints/auth.ts index e2cfc47aff..b55cb6388c 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/auth.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/auth.ts @@ -1,4 +1,4 @@ -import megalodon, { MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { MegalodonInterface } from "megalodon"; import Router from "@koa/router"; import { koaBody } from "koa-body"; import { getClient } from "../ApiMastodonCompatibleService.js"; diff --git a/packages/backend/src/server/api/mastodon/endpoints/filter.ts b/packages/backend/src/server/api/mastodon/endpoints/filter.ts index c99031b0c7..6daad31b68 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/filter.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/filter.ts @@ -1,4 +1,4 @@ -import megalodon, { MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { MegalodonInterface } from "megalodon"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; import { IdType, convertId } from "../../index.js"; diff --git a/packages/backend/src/server/api/mastodon/endpoints/meta.ts b/packages/backend/src/server/api/mastodon/endpoints/meta.ts index 8499d62bb2..2df4af82a5 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/meta.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/meta.ts @@ -1,4 +1,4 @@ -import { Entity } from "@calckey/megalodon"; +import { Entity } from "megalodon"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Users, Notes } from "@/models/index.js"; import { IsNull, MoreThan } from "typeorm"; diff --git a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts index ac091855f4..64f1886dd4 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts @@ -1,4 +1,4 @@ -import megalodon, { MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { MegalodonInterface } from "megalodon"; import Router from "@koa/router"; import { koaBody } from "koa-body"; import { convertId, IdType } from "../../index.js"; diff --git a/packages/backend/src/server/api/mastodon/endpoints/search.ts b/packages/backend/src/server/api/mastodon/endpoints/search.ts index 9a07db4dcc..df35b91167 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/search.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/search.ts @@ -1,8 +1,8 @@ -import megalodon, { MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { MegalodonInterface } from "megalodon"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; import axios from "axios"; -import { Converter } from "@calckey/megalodon"; +import { Converter } from "megalodon"; import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; import { convertAccount, convertStatus } from "../converters.js"; diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts index 1eebac2db2..93fa77d365 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts @@ -1,5 +1,5 @@ import Router from "@koa/router"; -import megalodon, { Entity, MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { Entity, MegalodonInterface } from "megalodon"; import { getClient } from "../ApiMastodonCompatibleService.js"; import { statusModel } from "./status.js"; import Autolinker from "autolinker"; diff --git a/packages/backend/src/server/api/stream/index.ts b/packages/backend/src/server/api/stream/index.ts index e268b580f5..18ac38e0a5 100644 --- a/packages/backend/src/server/api/stream/index.ts +++ b/packages/backend/src/server/api/stream/index.ts @@ -25,7 +25,7 @@ import { readNotification } from "../common/read-notification.js"; import channels from "./channels/index.js"; import type Channel from "./channel.js"; import type { StreamEventEmitter, StreamMessages } from "./types.js"; -import { Converter } from "@calckey/megalodon"; +import { Converter } from "megalodon"; import { getClient } from "../mastodon/ApiMastodonCompatibleService.js"; import { toTextWithReaction } from "../mastodon/endpoints/timeline.js"; diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 270a8666de..efff6dd236 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -22,7 +22,7 @@ import { createTemp } from "@/misc/create-temp.js"; import { publishMainStream } from "@/services/stream.js"; import * as Acct from "@/misc/acct.js"; import { envOption } from "@/env.js"; -import megalodon, { MegalodonInterface } from "@calckey/megalodon"; +import megalodon, { MegalodonInterface } from "megalodon"; import activityPub from "./activitypub.js"; import nodeinfo from "./nodeinfo.js"; import wellKnown from "./well-known.js"; diff --git a/packages/megalodon/.npmignore b/packages/megalodon/.npmignore deleted file mode 100644 index fd54d1deb4..0000000000 --- a/packages/megalodon/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -./src -tsconfig.json diff --git a/packages/megalodon/lib/src/misskey/api_client.js b/packages/megalodon/lib/src/misskey/api_client.js index d08be592a8..9ce065189c 100644 --- a/packages/megalodon/lib/src/misskey/api_client.js +++ b/packages/megalodon/lib/src/misskey/api_client.js @@ -53,7 +53,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); var axios_1 = __importDefault(require("axios")); var dayjs_1 = __importDefault(require("dayjs")); var form_data_1 = __importDefault(require("form-data")); -var default_1 = require("../default"); +var default_1 = require("@/default"); var proxy_config_1 = __importDefault(require("../proxy_config")); var web_socket_1 = __importDefault(require("./web_socket")); var notification_1 = __importDefault(require("./notification")); diff --git a/packages/megalodon/package.json b/packages/megalodon/package.json index 5e9d809670..43479b2e73 100644 --- a/packages/megalodon/package.json +++ b/packages/megalodon/package.json @@ -1,8 +1,6 @@ { - "name": "@calckey/megalodon", - "private": false, - "version": "5.1.23", - "description": "Mastodon+Calckey API client for node.js and browser", + "name": "megalodon", + "private": true, "main": "./lib/src/index.js", "typings": "./lib/src/index.d.ts", "scripts": { @@ -11,26 +9,6 @@ "doc": "typedoc --out ../docs ./src", "test": "NODE_ENV=test jest -u --maxWorkers=3" }, - "engines": { - "node": ">=15.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://codeberg.org/calckey/megalodon.git" - }, - "keywords": [ - "mastodon", - "client", - "api", - "streaming", - "rest", - "proxy" - ], - "author": "thatonecalculator", - "license": "MIT", - "bugs": { - "url": "https://codeberg.org/calckey/megalodon/issues" - }, "jest": { "moduleFileExtensions": [ "ts", @@ -54,7 +32,6 @@ }, "testEnvironment": "node" }, - "homepage": "https://codeberg.org/calckey/megalodon", "dependencies": { "@types/oauth": "^0.9.0", "@types/ws": "^8.5.4", @@ -78,6 +55,7 @@ "@types/object-assign-deep": "^0.4.0", "@types/parse-link-header": "^2.0.0", "@types/uuid": "^9.0.0", + "@types/node": "18.11.18", "@typescript-eslint/eslint-plugin": "^5.49.0", "@typescript-eslint/parser": "^5.49.0", "@types/async-lock": "1.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a27cb847fe..c5e7f1fada 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -90,9 +90,6 @@ importers: '@bull-board/ui': specifier: 5.2.0 version: 5.2.0 - '@calckey/megalodon': - specifier: workspace:* - version: link:../megalodon '@discordapp/twemoji': specifier: 14.1.2 version: 14.1.2 @@ -267,6 +264,9 @@ importers: koa-views: specifier: 7.0.2 version: 7.0.2(@types/koa@2.13.5)(ejs@3.1.9)(pug@3.0.2) + megalodon: + specifier: workspace:* + version: link:../megalodon meilisearch: specifier: 0.33.0 version: 0.33.0 @@ -983,6 +983,9 @@ importers: '@types/jest': specifier: ^29.4.0 version: 29.4.0 + '@types/node': + specifier: 18.11.18 + version: 18.11.18 '@types/object-assign-deep': specifier: ^0.4.0 version: 0.4.0