From c0dbf1d8da3625dd1d936a9acb4c69b4a295553b Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Fri, 11 Aug 2023 20:19:25 -0700 Subject: [PATCH] refactor: :recycle: Misskey entities -> Firefish entities --- packages/backend/src/index.ts | 2 +- packages/backend/src/models/schema/user.ts | 2 +- packages/backend/test/e2e/users.ts | 18 ++--- packages/backend/test/utils.ts | 6 +- packages/client/src/account.ts | 12 ++-- .../src/components/MkAbuseReportWindow.vue | 4 +- .../client/src/components/MkCropperDialog.vue | 11 ++-- 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 | 6 +- 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 +- packages/client/src/pages/about-firefish.vue | 8 +-- .../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/2fa.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/src/streaming.ts | 2 +- packages/firefish-js/test-d/api.ts | 24 +++---- packages/firefish-js/test-d/streaming.ts | 10 +-- packages/sw/src/scripts/operations.ts | 12 ++-- packages/sw/src/types.ts | 6 +- pnpm-lock.yaml | 9 +-- 88 files changed, 324 insertions(+), 317 deletions(-) diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 278f630f70..62251afcfe 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -1,5 +1,5 @@ /** - * Misskey Entry Point! + * Firefish Entry Point! */ import { EventEmitter } from "node:events"; diff --git a/packages/backend/src/models/schema/user.ts b/packages/backend/src/models/schema/user.ts index 4c840d0bac..9df02a0e98 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 721ffc2f59..6c425284b1 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("ユーザー", () => { @@ -33,17 +33,17 @@ describe("ユーザー", () => { }, {}); }; - // BUG misskey-jsとjson-schemaと実際に返ってくるデータが全部違う - type UserLite = misskey.entities.UserLite & { + // BUG firefish-jsとjson-schemaと実際に返ってくるデータが全部違う + 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 }; @@ -181,12 +181,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 79d622b54b..ff2dd79de9 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 31014c49d8..a5b481ac81 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 ed4737894a..c6c8b837b9 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 24daea977b..e938c455ae 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 11db10dddf..4a5d10a1a6 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -179,7 +179,7 @@