mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-27 14:28:08 +09:00
[mastodon-client] general code cleanup, rename megalodon package
This commit is contained in:
parent
fbeb809874
commit
8347855a11
@ -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",
|
||||
|
@ -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";
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
./src
|
||||
tsconfig.json
|
@ -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"));
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user