From 9ea046c01169e0ebedd5f8d18239b9a877294173 Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Sun, 24 Sep 2023 04:27:16 +0000 Subject: [PATCH] Refactor: firefishjs imports --- packages/backend/src/models/schema/user.ts | 2 +- packages/backend/test/e2e/users.ts | 16 +- packages/backend/test/utils.ts | 6 +- packages/client/src/account.ts | 12 +- .../src/components/MkAbuseReportWindow.vue | 4 +- .../client/src/components/MkCropperDialog.vue | 8 +- packages/client/src/components/MkCwButton.vue | 4 +- .../client/src/components/MkDrive.file.vue | 6 +- .../client/src/components/MkDrive.folder.vue | 14 +- .../src/components/MkDrive.navFolder.vue | 14 +- packages/client/src/components/MkDrive.vue | 65 +- .../src/components/MkDriveFileThumbnail.vue | 4 +- .../src/components/MkDriveSelectDialog.vue | 8 +- .../client/src/components/MkDriveWindow.vue | 4 +- .../client/src/components/MkEmojiPicker.vue | 8 +- .../src/components/MkFeaturedPhotos.vue | 4 +- .../client/src/components/MkFollowButton.vue | 6 +- .../client/src/components/MkImageViewer.vue | 4 +- packages/client/src/components/MkMedia.vue | 4 +- .../client/src/components/MkMediaBanner.vue | 4 +- .../client/src/components/MkMediaList.vue | 8 +- packages/client/src/components/MkNote.vue | 8 +- .../client/src/components/MkNoteDetailed.vue | 12 +- .../client/src/components/MkNoteHeader.vue | 4 +- .../client/src/components/MkNoteSimple.vue | 4 +- packages/client/src/components/MkNoteSub.vue | 12 +- .../client/src/components/MkNotification.vue | 4 +- .../client/src/components/MkPagination.vue | 8 +- packages/client/src/components/MkPoll.vue | 4 +- packages/client/src/components/MkPostForm.vue | 24 +- .../src/components/MkPostFormDialog.vue | 20 +- .../client/src/components/MkReactedUsers.vue | 6 +- .../components/MkReactionsViewer.reaction.vue | 4 +- .../src/components/MkReactionsViewer.vue | 4 +- .../client/src/components/MkRenoteButton.vue | 4 +- .../src/components/MkSubNoteContent.vue | 4 +- .../client/src/components/MkUserCardMini.vue | 4 +- packages/client/src/components/MkUserInfo.vue | 4 +- .../src/components/MkUserOnlineIndicator.vue | 4 +- .../client/src/components/MkUserPreview.vue | 4 +- .../src/components/MkUserSelectDialog.vue | 10 +- .../components/MkUserSelectLocalDialog.vue | 10 +- .../src/components/MkVisibilityPicker.vue | 8 +- .../client/src/components/global/MkAcct.vue | 4 +- .../client/src/components/global/MkAvatar.vue | 4 +- .../src/components/global/MkUserName.vue | 4 +- packages/client/src/filters/user.ts | 8 +- packages/client/src/instance.ts | 4 +- packages/client/src/os.ts | 10 +- packages/client/src/pages/_error_.vue | 4 +- .../client/src/pages/admin/overview.user.vue | 4 +- packages/client/src/pages/clip.vue | 4 +- .../pages/messaging/messaging-room.form.vue | 8 +- .../messaging/messaging-room.message.vue | 4 +- .../src/pages/messaging/messaging-room.vue | 12 +- packages/client/src/pages/note.vue | 8 +- packages/client/src/pages/settings/theme.vue | 2 +- packages/client/src/pages/share.vue | 10 +- packages/client/src/pages/user-info.vue | 4 +- packages/client/src/pages/user/clips.vue | 4 +- .../client/src/pages/user/follow-list.vue | 4 +- packages/client/src/pages/user/followers.vue | 4 +- packages/client/src/pages/user/following.vue | 4 +- packages/client/src/pages/user/gallery.vue | 4 +- packages/client/src/pages/user/home.vue | 4 +- .../client/src/pages/user/index.activity.vue | 4 +- .../client/src/pages/user/index.photos.vue | 10 +- .../client/src/pages/user/index.timeline.vue | 4 +- packages/client/src/pages/user/index.vue | 4 +- packages/client/src/pages/user/pages.vue | 4 +- packages/client/src/pages/user/reactions.vue | 4 +- packages/client/src/scripts/get-note-menu.ts | 8 +- .../client/src/scripts/get-note-summary.ts | 4 +- packages/client/src/scripts/page-metadata.ts | 6 +- packages/client/src/scripts/upload.ts | 4 +- .../client/src/scripts/use-note-capture.ts | 4 +- packages/client/src/stream.ts | 4 +- packages/client/src/types/menu.ts | 8 +- .../src/ui/_common_/statusbar-federation.vue | 4 +- .../src/ui/_common_/statusbar-user-list.vue | 4 +- packages/firefish-js/README.md | 2 +- packages/firefish-js/etc/misskey-js.api.md | 2681 ----------------- packages/firefish-js/test-d/api.ts | 24 +- packages/firefish-js/test-d/streaming.ts | 10 +- packages/megalodon/src/misskey/web_socket.ts | 2 +- packages/sw/src/scripts/operations.ts | 12 +- packages/sw/src/types.ts | 6 +- 87 files changed, 312 insertions(+), 2990 deletions(-) delete mode 100644 packages/firefish-js/etc/misskey-js.api.md diff --git a/packages/backend/src/models/schema/user.ts b/packages/backend/src/models/schema/user.ts index d625308f0..61c20a898 100644 --- a/packages/backend/src/models/schema/user.ts +++ b/packages/backend/src/models/schema/user.ts @@ -24,7 +24,7 @@ export const packedUserLiteSchema = { type: "string", nullable: true, optional: false, - example: "misskey.example.com", + example: "firefish.example.com", description: "The local host is represented with `null`.", }, avatarUrl: { diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 86e254aeb..28d5468ec 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -15,7 +15,7 @@ import { failedApiCall, uploadFile, } from "../utils.js"; -import type * as misskey from "misskey-js"; +import type * as firefish from "firefish-js"; import type { INestApplicationContext } from "@nestjs/common"; describe("ユーザー", () => { @@ -34,16 +34,16 @@ describe("ユーザー", () => { }; // BUG misskey-jsとjson-schemaと実際に返ってくるデータが全部違う - type UserLite = misskey.entities.UserLite & { + type UserLite = firefish.entities.UserLite & { badgeRoles: any[]; }; type UserDetailedNotMe = UserLite & - misskey.entities.UserDetailed & { + firefish.entities.UserDetailed & { roles: any[]; }; - type MeDetailed = UserDetailedNotMe & misskey.entities.MeDetailed; + type MeDetailed = UserDetailedNotMe & firefish.entities.MeDetailed; type User = MeDetailed & { token: string }; @@ -183,12 +183,12 @@ describe("ユーザー", () => { let root: User; let alice: User; - let aliceNote: misskey.entities.Note; - let alicePage: misskey.entities.Page; - let aliceList: misskey.entities.UserList; + let aliceNote: firefish.entities.Note; + let alicePage: firefish.entities.Page; + let aliceList: firefish.entities.UserList; let bob: User; - let bobNote: misskey.entities.Note; + let bobNote: firefish.entities.Note; let carol: User; let dave: User; diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 79d622b54..ff2dd79de 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -6,7 +6,7 @@ import * as childProcess from "child_process"; import * as http from "node:http"; import { SIGKILL } from "constants"; import WebSocket from "ws"; -import * as misskey from "firefish-js"; +import * as firefish from "firefish-js"; import fetch from "node-fetch"; import FormData from "form-data"; import { DataSource } from "typeorm"; @@ -113,8 +113,8 @@ export const signup = async (params?: any): Promise => { export const post = async ( user: any, - params?: misskey.Endpoints["notes/create"]["req"], -): Promise => { + params?: firefish.Endpoints["notes/create"]["req"], +): Promise => { const q = Object.assign( { text: "test", diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index 13408b525..bb526846e 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -1,5 +1,5 @@ import { defineAsyncComponent, reactive } from "vue"; -import type * as misskey from "firefish-js"; +import type * as firefish from "firefish-js"; import { i18n } from "./i18n"; import { del, get, set } from "@/scripts/idb-proxy"; import { apiUrl } from "@/config"; @@ -8,7 +8,7 @@ import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; // TODO: 他のタブと永続化されたstateを同期 -type Account = misskey.entities.MeDetailed; +type Account = firefish.entities.MeDetailed; const accountData = localStorage.getItem("account"); @@ -150,8 +150,8 @@ export async function openAccountMenu( opts: { includeCurrentAccount?: boolean; withExtraOperation: boolean; - active?: misskey.entities.UserDetailed["id"]; - onChoose?: (account: misskey.entities.UserDetailed) => void; + active?: firefish.entities.UserDetailed["id"]; + onChoose?: (account: firefish.entities.UserDetailed) => void; }, ev: MouseEvent, ) { @@ -183,7 +183,7 @@ export async function openAccountMenu( ); } - async function switchAccount(account: misskey.entities.UserDetailed) { + async function switchAccount(account: firefish.entities.UserDetailed) { const storedAccounts = await getAccounts(); const token = storedAccounts.find((x) => x.id === account.id).token; switchAccountWithToken(token); @@ -200,7 +200,7 @@ export async function openAccountMenu( userIds: storedAccounts.map((x) => x.id), }); - function createItem(account: misskey.entities.UserDetailed) { + function createItem(account: firefish.entities.UserDetailed) { return { type: "user", user: account, diff --git a/packages/client/src/components/MkAbuseReportWindow.vue b/packages/client/src/components/MkAbuseReportWindow.vue index ed4737894..383978943 100644 --- a/packages/client/src/components/MkAbuseReportWindow.vue +++ b/packages/client/src/components/MkAbuseReportWindow.vue @@ -41,7 +41,7 @@ diff --git a/packages/client/src/components/MkDriveWindow.vue b/packages/client/src/components/MkDriveWindow.vue index 24daea977..f116b6e8f 100644 --- a/packages/client/src/components/MkDriveWindow.vue +++ b/packages/client/src/components/MkDriveWindow.vue @@ -15,13 +15,13 @@ diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index 99dc6e652..5deee1f88 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -191,7 +191,7 @@