From 623cadf9815bfec8ea17deb2a66304f14be5eb84 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 4 Dec 2023 23:12:10 -0800 Subject: [PATCH] Revert "chore: lint import order" This reverts commit 8d3c35c0c6521d3f394386705c4e8242f69398ee. --- packages/backend/src/boot/index.ts | 2 +- packages/backend/src/boot/master.ts | 10 +- packages/backend/src/boot/worker.ts | 2 +- packages/backend/src/config/load.ts | 4 +- packages/backend/src/daemons/queue-stats.ts | 2 +- packages/backend/src/daemons/server-stats.ts | 6 +- packages/backend/src/db/elasticsearch.ts | 2 +- packages/backend/src/db/meilisearch.ts | 2 +- packages/backend/src/db/postgre.ts | 110 +++++++-------- packages/backend/src/db/redis.ts | 2 +- packages/backend/src/mfm/to-html.ts | 6 +- packages/backend/src/misc/antenna-cache.ts | 4 +- packages/backend/src/misc/before-shutdown.ts | 2 + packages/backend/src/misc/cache.ts | 2 +- packages/backend/src/misc/captcha.ts | 6 +- .../backend/src/misc/check-hit-antenna.ts | 10 +- packages/backend/src/misc/check-word-mute.ts | 2 +- packages/backend/src/misc/convert-host.ts | 2 +- packages/backend/src/misc/detect-language.ts | 2 +- packages/backend/src/misc/download-url.ts | 8 +- packages/backend/src/misc/emoji-meta.ts | 2 +- .../misc/extract-custom-emojis-from-mfm.ts | 2 +- packages/backend/src/misc/extract-hashtags.ts | 2 +- .../backend/src/misc/fetch-proxy-account.ts | 2 +- packages/backend/src/misc/fetch.ts | 4 +- packages/backend/src/misc/gen-id.ts | 2 +- packages/backend/src/misc/get-file-info.ts | 8 +- packages/backend/src/misc/keypair-store.ts | 4 +- packages/backend/src/misc/password.ts | 2 +- packages/backend/src/misc/populate-emojis.ts | 10 +- .../backend/src/misc/process-masto-notes.ts | 12 +- packages/backend/src/misc/reaction-lib.ts | 6 +- packages/backend/src/misc/schema.ts | 58 ++++---- .../backend/src/misc/show-machine-info.ts | 2 +- .../backend/src/misc/skipped-instances.ts | 8 +- packages/backend/src/misc/webhook-cache.ts | 4 +- .../src/models/entities/abuse-user-report.ts | 6 +- .../src/models/entities/access-token.ts | 12 +- packages/backend/src/models/entities/ad.ts | 2 +- .../src/models/entities/announcement-read.ts | 8 +- .../src/models/entities/announcement.ts | 2 +- .../backend/src/models/entities/antenna.ts | 10 +- packages/backend/src/models/entities/app.ts | 4 +- .../models/entities/attestation-challenge.ts | 12 +- .../src/models/entities/auth-session.ts | 12 +- .../backend/src/models/entities/blocking.ts | 6 +- .../src/models/entities/channel-following.ts | 6 +- .../models/entities/channel-note-pining.ts | 8 +- .../backend/src/models/entities/channel.ts | 6 +- .../backend/src/models/entities/clip-note.ts | 6 +- packages/backend/src/models/entities/clip.ts | 6 +- .../backend/src/models/entities/drive-file.ts | 8 +- .../src/models/entities/drive-folder.ts | 8 +- packages/backend/src/models/entities/emoji.ts | 2 +- .../src/models/entities/follow-request.ts | 6 +- .../backend/src/models/entities/following.ts | 6 +- .../src/models/entities/gallery-like.ts | 6 +- .../src/models/entities/gallery-post.ts | 6 +- .../backend/src/models/entities/hashtag.ts | 4 +- .../backend/src/models/entities/instance.ts | 2 +- .../src/models/entities/messaging-message.ts | 10 +- packages/backend/src/models/entities/meta.ts | 4 +- .../src/models/entities/moderation-log.ts | 6 +- .../backend/src/models/entities/muted-note.ts | 6 +- .../backend/src/models/entities/muting.ts | 6 +- .../backend/src/models/entities/note-edit.ts | 6 +- .../src/models/entities/note-favorite.ts | 6 +- .../src/models/entities/note-reaction.ts | 8 +- .../src/models/entities/note-thread-muting.ts | 6 +- .../src/models/entities/note-unread.ts | 8 +- .../src/models/entities/note-watching.ts | 8 +- packages/backend/src/models/entities/note.ts | 12 +- .../src/models/entities/notification.ts | 14 +- .../backend/src/models/entities/page-like.ts | 6 +- packages/backend/src/models/entities/page.ts | 6 +- .../models/entities/password-reset-request.ts | 6 +- .../backend/src/models/entities/poll-vote.ts | 8 +- packages/backend/src/models/entities/poll.ts | 6 +- .../backend/src/models/entities/promo-note.ts | 6 +- .../backend/src/models/entities/promo-read.ts | 6 +- .../models/entities/registration-tickets.ts | 2 +- .../src/models/entities/registry-item.ts | 6 +- packages/backend/src/models/entities/relay.ts | 2 +- .../src/models/entities/renote-muting.ts | 4 +- .../backend/src/models/entities/signin.ts | 6 +- .../src/models/entities/sw-subscription.ts | 6 +- .../src/models/entities/used-username.ts | 2 +- .../models/entities/user-group-invitation.ts | 8 +- .../src/models/entities/user-group-joining.ts | 8 +- .../backend/src/models/entities/user-group.ts | 6 +- .../backend/src/models/entities/user-ip.ts | 2 +- .../src/models/entities/user-keypair.ts | 4 +- .../src/models/entities/user-list-joining.ts | 8 +- .../backend/src/models/entities/user-list.ts | 6 +- .../src/models/entities/user-note-pining.ts | 6 +- .../src/models/entities/user-pending.ts | 2 +- .../src/models/entities/user-profile.ts | 8 +- .../src/models/entities/user-publickey.ts | 6 +- .../src/models/entities/user-security-key.ts | 12 +- packages/backend/src/models/entities/user.ts | 4 +- .../backend/src/models/entities/webhook.ts | 6 +- packages/backend/src/models/index.ts | 112 ++++++++-------- .../models/repositories/abuse-user-report.ts | 2 +- .../backend/src/models/repositories/app.ts | 4 +- .../src/models/repositories/auth-session.ts | 6 +- .../src/models/repositories/blocking.ts | 8 +- .../src/models/repositories/channel.ts | 4 +- .../backend/src/models/repositories/clip.ts | 4 +- .../src/models/repositories/drive-file.ts | 12 +- .../src/models/repositories/drive-folder.ts | 4 +- .../backend/src/models/repositories/emoji.ts | 2 +- .../src/models/repositories/follow-request.ts | 2 +- .../src/models/repositories/following.ts | 8 +- .../src/models/repositories/gallery-post.ts | 6 +- .../src/models/repositories/hashtag.ts | 2 +- .../src/models/repositories/instance.ts | 2 +- .../models/repositories/messaging-message.ts | 4 +- .../models/repositories/moderation-logs.ts | 2 +- .../backend/src/models/repositories/muting.ts | 8 +- .../src/models/repositories/note-favorite.ts | 2 +- .../src/models/repositories/note-reaction.ts | 6 +- .../backend/src/models/repositories/note.ts | 38 +++--- .../src/models/repositories/notification.ts | 22 +-- .../backend/src/models/repositories/page.ts | 8 +- .../src/models/repositories/user-group.ts | 2 +- .../src/models/repositories/user-list.ts | 2 +- .../backend/src/models/repositories/user.ts | 28 ++-- packages/backend/src/queue/index.ts | 20 +-- packages/backend/src/queue/initialize.ts | 2 +- .../processors/background/index-all-notes.ts | 10 +- .../src/queue/processors/db/delete-account.ts | 12 +- .../queue/processors/db/delete-drive-files.ts | 8 +- .../queue/processors/db/export-blocking.ts | 12 +- .../processors/db/export-custom-emojis.ts | 16 +-- .../queue/processors/db/export-following.ts | 14 +- .../src/queue/processors/db/export-mute.ts | 12 +- .../src/queue/processors/db/export-notes.ts | 14 +- .../queue/processors/db/export-user-lists.ts | 12 +- .../queue/processors/db/import-blocking.ts | 10 +- .../processors/db/import-custom-emojis.ts | 12 +- .../processors/db/import-firefish-post.ts | 20 +-- .../queue/processors/db/import-following.ts | 12 +- .../queue/processors/db/import-masto-post.ts | 16 +-- .../src/queue/processors/db/import-muting.ts | 18 +-- .../src/queue/processors/db/import-posts.ts | 8 +- .../queue/processors/db/import-user-lists.ts | 22 +-- .../backend/src/queue/processors/db/index.ts | 18 +-- .../backend/src/queue/processors/deliver.ts | 14 +- .../processors/ended-poll-notification.ts | 2 +- .../backend/src/queue/processors/inbox.ts | 32 ++--- .../object-storage/clean-remote-files.ts | 6 +- .../processors/object-storage/delete-file.ts | 2 +- .../queue/processors/object-storage/index.ts | 4 +- .../system/check-expired-mutings.ts | 4 +- .../queue/processors/system/clean-charts.ts | 4 +- .../src/queue/processors/system/clean.ts | 2 +- .../src/queue/processors/system/index.ts | 6 +- .../processors/system/local-emoji-size.ts | 4 +- .../queue/processors/system/resync-charts.ts | 2 +- .../queue/processors/system/tick-charts.ts | 4 +- .../queue/processors/system/verify-links.ts | 2 +- .../src/queue/processors/webhook-deliver.ts | 8 +- packages/backend/src/queue/queues.ts | 4 +- .../src/remote/activitypub/audience.ts | 12 +- .../src/remote/activitypub/check-fetch.ts | 18 +-- .../src/remote/activitypub/db-resolver.ts | 14 +- .../src/remote/activitypub/deliver-manager.ts | 8 +- .../activitypub/kernel/accept/follow.ts | 4 +- .../remote/activitypub/kernel/accept/index.ts | 8 +- .../remote/activitypub/kernel/add/index.ts | 4 +- .../activitypub/kernel/announce/index.ts | 6 +- .../activitypub/kernel/announce/note.ts | 20 +-- .../remote/activitypub/kernel/block/index.ts | 8 +- .../remote/activitypub/kernel/create/index.ts | 10 +- .../remote/activitypub/kernel/create/note.ts | 10 +- .../remote/activitypub/kernel/delete/actor.ts | 4 +- .../remote/activitypub/kernel/delete/index.ts | 6 +- .../remote/activitypub/kernel/delete/note.ts | 6 +- .../remote/activitypub/kernel/flag/index.ts | 8 +- .../src/remote/activitypub/kernel/follow.ts | 2 +- .../src/remote/activitypub/kernel/index.ts | 64 ++++----- .../src/remote/activitypub/kernel/like.ts | 4 +- .../src/remote/activitypub/kernel/read.ts | 6 +- .../activitypub/kernel/reject/follow.ts | 6 +- .../remote/activitypub/kernel/reject/index.ts | 8 +- .../remote/activitypub/kernel/remove/index.ts | 4 +- .../remote/activitypub/kernel/undo/accept.ts | 4 +- .../activitypub/kernel/undo/announce.ts | 4 +- .../remote/activitypub/kernel/undo/block.ts | 8 +- .../remote/activitypub/kernel/undo/follow.ts | 6 +- .../remote/activitypub/kernel/undo/index.ts | 18 +-- .../remote/activitypub/kernel/undo/like.ts | 4 +- .../remote/activitypub/kernel/update/index.ts | 8 +- .../remote/activitypub/misc/get-note-html.ts | 4 +- .../remote/activitypub/misc/html-to-mfm.ts | 4 +- .../remote/activitypub/misc/ld-signature.ts | 4 +- .../src/remote/activitypub/models/image.ts | 14 +- .../src/remote/activitypub/models/mention.ts | 8 +- .../src/remote/activitypub/models/note.ts | 84 ++++++------ .../src/remote/activitypub/models/person.ts | 68 +++++----- .../src/remote/activitypub/models/question.ts | 6 +- .../src/remote/activitypub/models/tag.ts | 2 +- .../backend/src/remote/activitypub/perform.ts | 2 +- .../activitypub/renderer/follow-user.ts | 2 +- .../src/remote/activitypub/renderer/index.ts | 2 +- .../src/remote/activitypub/renderer/key.ts | 4 +- .../src/remote/activitypub/renderer/like.ts | 4 +- .../remote/activitypub/renderer/mention.ts | 2 +- .../src/remote/activitypub/renderer/note.ts | 20 +-- .../src/remote/activitypub/renderer/person.ts | 10 +- .../remote/activitypub/renderer/question.ts | 2 +- .../src/remote/activitypub/renderer/read.ts | 2 +- .../src/remote/activitypub/renderer/vote.ts | 2 +- .../backend/src/remote/activitypub/request.ts | 4 +- .../src/remote/activitypub/resolver.ts | 28 ++-- packages/backend/src/remote/resolve-user.ts | 10 +- packages/backend/src/server/activitypub.ts | 38 +++--- .../src/server/activitypub/featured.ts | 16 +-- .../src/server/activitypub/followers.ts | 24 ++-- .../src/server/activitypub/following.ts | 18 +-- .../backend/src/server/activitypub/outbox.ts | 24 ++-- packages/backend/src/server/api/2fa.ts | 2 +- .../backend/src/server/api/api-handler.ts | 4 +- .../backend/src/server/api/authenticate.ts | 10 +- packages/backend/src/server/api/call.ts | 14 +- .../api/common/generate-muted-user-query.ts | 4 +- .../common/generated-muted-renote-query.ts | 2 +- .../backend/src/server/api/common/getters.ts | 2 +- .../src/server/api/common/inject-featured.ts | 6 +- .../src/server/api/common/inject-promo.ts | 4 +- .../api/common/read-messaging-message.ts | 24 ++-- .../server/api/common/read-notification.ts | 10 +- .../backend/src/server/api/common/signin.ts | 2 +- .../backend/src/server/api/common/signup.ts | 24 ++-- packages/backend/src/server/api/define.ts | 4 +- packages/backend/src/server/api/endpoints.ts | 58 ++++---- .../api/endpoints/admin/abuse-user-reports.ts | 2 +- .../api/endpoints/admin/accounts/create.ts | 2 +- .../api/endpoints/admin/accounts/delete.ts | 6 +- .../api/endpoints/admin/accounts/hosted.ts | 4 +- .../server/api/endpoints/admin/ad/create.ts | 4 +- .../server/api/endpoints/admin/ad/delete.ts | 2 +- .../src/server/api/endpoints/admin/ad/list.ts | 2 +- .../server/api/endpoints/admin/ad/update.ts | 2 +- .../endpoints/admin/announcements/create.ts | 4 +- .../endpoints/admin/announcements/delete.ts | 2 +- .../api/endpoints/admin/announcements/list.ts | 4 +- .../endpoints/admin/announcements/update.ts | 2 +- .../server/api/endpoints/admin/delete-2fa.ts | 4 +- .../api/endpoints/admin/delete-account.ts | 2 +- .../admin/delete-all-files-of-a-user.ts | 2 +- .../api/endpoints/admin/delete-passkeys.ts | 4 +- .../admin/drive-capacity-override.ts | 2 +- .../admin/drive/clean-remote-files.ts | 2 +- .../api/endpoints/admin/drive/cleanup.ts | 4 +- .../server/api/endpoints/admin/drive/files.ts | 2 +- .../endpoints/admin/emoji/add-aliases-bulk.ts | 4 +- .../server/api/endpoints/admin/emoji/add.ts | 14 +- .../server/api/endpoints/admin/emoji/copy.ts | 10 +- .../api/endpoints/admin/emoji/delete-bulk.ts | 6 +- .../api/endpoints/admin/emoji/delete.ts | 6 +- .../api/endpoints/admin/emoji/import-zip.ts | 2 +- .../api/endpoints/admin/emoji/list-remote.ts | 8 +- .../server/api/endpoints/admin/emoji/list.ts | 4 +- .../admin/emoji/remove-aliases-bulk.ts | 4 +- .../endpoints/admin/emoji/set-aliases-bulk.ts | 4 +- .../admin/emoji/set-category-bulk.ts | 4 +- .../endpoints/admin/emoji/set-license-bulk.ts | 4 +- .../api/endpoints/admin/emoji/update.ts | 4 +- .../admin/federation/delete-all-files.ts | 2 +- .../refresh-remote-instance-metadata.ts | 4 +- .../admin/federation/remove-all-following.ts | 2 +- .../admin/federation/update-instance.ts | 4 +- .../api/endpoints/admin/get-index-stats.ts | 2 +- .../src/server/api/endpoints/admin/invite.ts | 6 +- .../src/server/api/endpoints/admin/meta.ts | 2 +- .../api/endpoints/admin/moderators/add.ts | 2 +- .../api/endpoints/admin/moderators/remove.ts | 2 +- .../api/endpoints/admin/promo/create.ts | 4 +- .../server/api/endpoints/admin/queue/clear.ts | 2 +- .../endpoints/admin/queue/deliver-delayed.ts | 2 +- .../endpoints/admin/queue/inbox-delayed.ts | 2 +- .../server/api/endpoints/admin/queue/stats.ts | 4 +- .../server/api/endpoints/admin/relays/add.ts | 2 +- .../api/endpoints/admin/reset-password.ts | 4 +- .../admin/resolve-abuse-user-report.ts | 8 +- .../api/endpoints/admin/search/index-all.ts | 2 +- .../api/endpoints/admin/send-mod-mail.ts | 10 +- .../server/api/endpoints/admin/server-info.ts | 6 +- .../endpoints/admin/show-moderation-logs.ts | 2 +- .../server/api/endpoints/admin/show-users.ts | 2 +- .../api/endpoints/admin/silence-user.ts | 2 +- .../api/endpoints/admin/suspend-user.ts | 6 +- .../api/endpoints/admin/unsilence-user.ts | 2 +- .../api/endpoints/admin/unsuspend-user.ts | 2 +- .../server/api/endpoints/admin/update-meta.ts | 4 +- .../src/server/api/endpoints/admin/vacuum.ts | 2 +- .../src/server/api/endpoints/announcements.ts | 4 +- .../server/api/endpoints/antennas/create.ts | 4 +- .../server/api/endpoints/antennas/delete.ts | 2 +- .../src/server/api/endpoints/antennas/list.ts | 2 +- .../server/api/endpoints/antennas/markread.ts | 2 +- .../server/api/endpoints/antennas/notes.ts | 12 +- .../src/server/api/endpoints/antennas/show.ts | 2 +- .../server/api/endpoints/antennas/update.ts | 2 +- .../src/server/api/endpoints/ap/get.ts | 4 +- .../src/server/api/endpoints/ap/show.ts | 26 ++-- .../src/server/api/endpoints/app/create.ts | 8 +- .../src/server/api/endpoints/app/show.ts | 2 +- .../src/server/api/endpoints/auth/accept.ts | 6 +- .../api/endpoints/auth/session/generate.ts | 6 +- .../server/api/endpoints/auth/session/show.ts | 2 +- .../api/endpoints/auth/session/userkey.ts | 2 +- .../server/api/endpoints/blocking/create.ts | 8 +- .../server/api/endpoints/blocking/delete.ts | 8 +- .../src/server/api/endpoints/blocking/list.ts | 2 +- .../server/api/endpoints/channels/create.ts | 6 +- .../server/api/endpoints/channels/featured.ts | 2 +- .../server/api/endpoints/channels/follow.ts | 4 +- .../server/api/endpoints/channels/followed.ts | 2 +- .../server/api/endpoints/channels/owned.ts | 2 +- .../server/api/endpoints/channels/search.ts | 6 +- .../src/server/api/endpoints/channels/show.ts | 2 +- .../server/api/endpoints/channels/timeline.ts | 4 +- .../server/api/endpoints/channels/unfollow.ts | 2 +- .../server/api/endpoints/channels/update.ts | 2 +- .../api/endpoints/charts/active-users.ts | 2 +- .../server/api/endpoints/charts/ap-request.ts | 2 +- .../src/server/api/endpoints/charts/drive.ts | 2 +- .../server/api/endpoints/charts/federation.ts | 2 +- .../server/api/endpoints/charts/hashtag.ts | 2 +- .../server/api/endpoints/charts/instance.ts | 2 +- .../src/server/api/endpoints/charts/notes.ts | 2 +- .../server/api/endpoints/charts/user/drive.ts | 2 +- .../server/api/endpoints/charts/user/notes.ts | 2 +- .../api/endpoints/charts/user/reactions.ts | 2 +- .../src/server/api/endpoints/charts/users.ts | 2 +- .../server/api/endpoints/clips/add-note.ts | 6 +- .../src/server/api/endpoints/clips/create.ts | 2 +- .../src/server/api/endpoints/clips/delete.ts | 2 +- .../src/server/api/endpoints/clips/list.ts | 2 +- .../src/server/api/endpoints/clips/notes.ts | 10 +- .../server/api/endpoints/clips/remove-note.ts | 4 +- .../src/server/api/endpoints/clips/show.ts | 2 +- .../src/server/api/endpoints/clips/update.ts | 2 +- .../endpoints/compatibility/custom-emojis.ts | 6 +- .../src/server/api/endpoints/drive/files.ts | 2 +- .../endpoints/drive/files/attached-notes.ts | 2 +- .../endpoints/drive/files/check-existence.ts | 2 +- .../api/endpoints/drive/files/create.ts | 10 +- .../api/endpoints/drive/files/delete.ts | 6 +- .../server/api/endpoints/drive/files/find.ts | 2 +- .../api/endpoints/drive/files/update.ts | 4 +- .../endpoints/drive/files/upload-from-url.ts | 6 +- .../src/server/api/endpoints/drive/folders.ts | 2 +- .../api/endpoints/drive/folders/create.ts | 6 +- .../api/endpoints/drive/folders/delete.ts | 4 +- .../api/endpoints/drive/folders/find.ts | 2 +- .../api/endpoints/drive/folders/show.ts | 2 +- .../api/endpoints/drive/folders/update.ts | 4 +- .../src/server/api/endpoints/drive/stream.ts | 2 +- .../backend/src/server/api/endpoints/emoji.ts | 2 +- .../api/endpoints/export-custom-emojis.ts | 2 +- .../api/endpoints/federation/followers.ts | 2 +- .../api/endpoints/federation/following.ts | 2 +- .../api/endpoints/federation/instances.ts | 4 +- .../api/endpoints/federation/show-instance.ts | 4 +- .../server/api/endpoints/federation/stats.ts | 2 +- .../federation/update-remote-user.ts | 4 +- .../server/api/endpoints/federation/users.ts | 2 +- .../src/server/api/endpoints/fetch-rss.ts | 6 +- .../server/api/endpoints/following/create.ts | 10 +- .../server/api/endpoints/following/delete.ts | 8 +- .../api/endpoints/following/invalidate.ts | 8 +- .../endpoints/following/requests/accept.ts | 4 +- .../endpoints/following/requests/cancel.ts | 8 +- .../api/endpoints/following/requests/list.ts | 2 +- .../endpoints/following/requests/reject.ts | 4 +- .../server/api/endpoints/gallery/featured.ts | 2 +- .../server/api/endpoints/gallery/popular.ts | 2 +- .../src/server/api/endpoints/gallery/posts.ts | 4 +- .../api/endpoints/gallery/posts/create.ts | 8 +- .../api/endpoints/gallery/posts/delete.ts | 2 +- .../api/endpoints/gallery/posts/like.ts | 4 +- .../api/endpoints/gallery/posts/show.ts | 2 +- .../api/endpoints/gallery/posts/unlike.ts | 2 +- .../api/endpoints/gallery/posts/update.ts | 6 +- .../api/endpoints/get-online-users-count.ts | 2 +- .../src/server/api/endpoints/get-sounds.ts | 2 +- .../src/server/api/endpoints/hashtags/list.ts | 2 +- .../server/api/endpoints/hashtags/search.ts | 4 +- .../src/server/api/endpoints/hashtags/show.ts | 4 +- .../server/api/endpoints/hashtags/trend.ts | 12 +- .../server/api/endpoints/hashtags/users.ts | 4 +- .../src/server/api/endpoints/i/2fa/done.ts | 4 +- .../server/api/endpoints/i/2fa/key-done.ts | 14 +- .../api/endpoints/i/2fa/password-less.ts | 4 +- .../api/endpoints/i/2fa/register-key.ts | 12 +- .../server/api/endpoints/i/2fa/register.ts | 8 +- .../server/api/endpoints/i/2fa/remove-key.ts | 2 +- .../server/api/endpoints/i/2fa/unregister.ts | 6 +- .../server/api/endpoints/i/2fa/update-key.ts | 6 +- .../src/server/api/endpoints/i/apps.ts | 2 +- .../server/api/endpoints/i/authorized-apps.ts | 2 +- .../server/api/endpoints/i/change-password.ts | 4 +- .../server/api/endpoints/i/delete-account.ts | 4 +- .../server/api/endpoints/i/export-blocking.ts | 4 +- .../api/endpoints/i/export-following.ts | 4 +- .../src/server/api/endpoints/i/export-mute.ts | 4 +- .../server/api/endpoints/i/export-notes.ts | 4 +- .../api/endpoints/i/export-user-lists.ts | 4 +- .../src/server/api/endpoints/i/favorites.ts | 2 +- .../server/api/endpoints/i/gallery/likes.ts | 2 +- .../server/api/endpoints/i/gallery/posts.ts | 2 +- .../endpoints/i/get-word-muted-notes-count.ts | 2 +- .../server/api/endpoints/i/import-blocking.ts | 6 +- .../api/endpoints/i/import-following.ts | 6 +- .../server/api/endpoints/i/import-muting.ts | 6 +- .../server/api/endpoints/i/import-posts.ts | 8 +- .../api/endpoints/i/import-user-lists.ts | 6 +- .../src/server/api/endpoints/i/known-as.ts | 10 +- .../src/server/api/endpoints/i/move.ts | 14 +- .../server/api/endpoints/i/notifications.ts | 12 +- .../src/server/api/endpoints/i/page-likes.ts | 2 +- .../src/server/api/endpoints/i/pages.ts | 2 +- .../backend/src/server/api/endpoints/i/pin.ts | 4 +- .../i/read-all-messaging-messages.ts | 4 +- .../api/endpoints/i/read-all-unread-notes.ts | 4 +- .../api/endpoints/i/read-announcement.ts | 4 +- .../api/endpoints/i/regenerate-token.ts | 8 +- .../api/endpoints/i/registry/get-all.ts | 2 +- .../api/endpoints/i/registry/get-detail.ts | 2 +- .../api/endpoints/i/registry/get-unsecure.ts | 4 +- .../server/api/endpoints/i/registry/get.ts | 2 +- .../endpoints/i/registry/keys-with-type.ts | 2 +- .../server/api/endpoints/i/registry/keys.ts | 2 +- .../server/api/endpoints/i/registry/remove.ts | 2 +- .../server/api/endpoints/i/registry/scopes.ts | 2 +- .../server/api/endpoints/i/registry/set.ts | 6 +- .../server/api/endpoints/i/revoke-token.ts | 2 +- .../server/api/endpoints/i/signin-history.ts | 2 +- .../src/server/api/endpoints/i/unpin.ts | 4 +- .../server/api/endpoints/i/update-email.ts | 14 +- .../src/server/api/endpoints/i/update.ts | 26 ++-- .../api/endpoints/i/user-group-invites.ts | 2 +- .../server/api/endpoints/i/webhooks/create.ts | 6 +- .../server/api/endpoints/i/webhooks/delete.ts | 2 +- .../server/api/endpoints/i/webhooks/list.ts | 2 +- .../server/api/endpoints/i/webhooks/show.ts | 2 +- .../server/api/endpoints/i/webhooks/update.ts | 4 +- .../server/api/endpoints/messaging/history.ts | 2 +- .../api/endpoints/messaging/messages.ts | 26 ++-- .../endpoints/messaging/messages/create.ts | 18 +-- .../endpoints/messaging/messages/delete.ts | 4 +- .../api/endpoints/messaging/messages/read.ts | 10 +- .../backend/src/server/api/endpoints/meta.ts | 10 +- .../server/api/endpoints/miauth/gen-token.ts | 4 +- .../src/server/api/endpoints/mute/create.ts | 8 +- .../src/server/api/endpoints/mute/delete.ts | 4 +- .../src/server/api/endpoints/mute/list.ts | 4 +- .../src/server/api/endpoints/my/apps.ts | 2 +- .../backend/src/server/api/endpoints/notes.ts | 2 +- .../server/api/endpoints/notes/children.ts | 8 +- .../src/server/api/endpoints/notes/clips.ts | 8 +- .../api/endpoints/notes/conversation.ts | 2 +- .../src/server/api/endpoints/notes/create.ts | 26 ++-- .../src/server/api/endpoints/notes/delete.ts | 10 +- .../src/server/api/endpoints/notes/edit.ts | 56 ++++---- .../api/endpoints/notes/favorites/create.ts | 4 +- .../api/endpoints/notes/favorites/delete.ts | 2 +- .../server/api/endpoints/notes/featured.ts | 4 +- .../api/endpoints/notes/global-timeline.ts | 14 +- .../api/endpoints/notes/hybrid-timeline.ts | 20 +-- .../api/endpoints/notes/local-timeline.ts | 20 +-- .../server/api/endpoints/notes/mentions.ts | 14 +- .../endpoints/notes/polls/recommendation.ts | 4 +- .../server/api/endpoints/notes/polls/vote.ts | 26 ++-- .../server/api/endpoints/notes/reactions.ts | 6 +- .../api/endpoints/notes/reactions/create.ts | 6 +- .../api/endpoints/notes/reactions/delete.ts | 8 +- .../endpoints/notes/recommended-timeline.ts | 20 +-- .../src/server/api/endpoints/notes/renotes.ts | 12 +- .../src/server/api/endpoints/notes/replies.ts | 8 +- .../api/endpoints/notes/search-by-tag.ts | 12 +- .../src/server/api/endpoints/notes/search.ts | 20 +-- .../src/server/api/endpoints/notes/show.ts | 2 +- .../endpoints/notes/thread-muting/create.ts | 8 +- .../endpoints/notes/thread-muting/delete.ts | 2 +- .../server/api/endpoints/notes/timeline.ts | 18 +-- .../server/api/endpoints/notes/translate.ts | 8 +- .../server/api/endpoints/notes/unrenote.ts | 10 +- .../api/endpoints/notes/user-list-timeline.ts | 10 +- .../api/endpoints/notes/watching/create.ts | 6 +- .../api/endpoints/notes/watching/delete.ts | 6 +- .../api/endpoints/notifications/create.ts | 2 +- .../notifications/mark-all-as-read.ts | 4 +- .../api/endpoints/notifications/read.ts | 2 +- .../src/server/api/endpoints/page-push.ts | 4 +- .../src/server/api/endpoints/pages/create.ts | 4 +- .../src/server/api/endpoints/pages/like.ts | 2 +- .../src/server/api/endpoints/pages/show.ts | 4 +- .../src/server/api/endpoints/pages/unlike.ts | 2 +- .../src/server/api/endpoints/pages/update.ts | 6 +- .../src/server/api/endpoints/patrons.ts | 8 +- .../src/server/api/endpoints/pinned-users.ts | 10 +- .../src/server/api/endpoints/promo/read.ts | 4 +- .../api/endpoints/renote-mute/create.ts | 4 +- .../api/endpoints/renote-mute/delete.ts | 2 +- .../server/api/endpoints/renote-mute/list.ts | 2 +- .../api/endpoints/request-reset-password.ts | 12 +- .../server/api/endpoints/reset-password.ts | 4 +- .../src/server/api/endpoints/server-info.ts | 4 +- .../api/endpoints/username/available.ts | 6 +- .../backend/src/server/api/endpoints/users.ts | 4 +- .../src/server/api/endpoints/users/clips.ts | 2 +- .../server/api/endpoints/users/followers.ts | 6 +- .../server/api/endpoints/users/following.ts | 6 +- .../api/endpoints/users/gallery/posts.ts | 2 +- .../users/get-frequently-replied-users.ts | 6 +- .../api/endpoints/users/groups/create.ts | 4 +- .../users/groups/invitations/accept.ts | 4 +- .../api/endpoints/users/groups/invite.ts | 16 +-- .../api/endpoints/users/groups/joined.ts | 4 +- .../api/endpoints/users/groups/leave.ts | 2 +- .../server/api/endpoints/users/groups/pull.ts | 4 +- .../server/api/endpoints/users/groups/show.ts | 2 +- .../api/endpoints/users/groups/transfer.ts | 4 +- .../api/endpoints/users/lists/create.ts | 2 +- .../server/api/endpoints/users/lists/pull.ts | 6 +- .../server/api/endpoints/users/lists/push.ts | 6 +- .../src/server/api/endpoints/users/notes.ts | 12 +- .../src/server/api/endpoints/users/pages.ts | 2 +- .../server/api/endpoints/users/reactions.ts | 4 +- .../api/endpoints/users/recommendation.ts | 14 +- .../api/endpoints/users/report-abuse.ts | 18 +-- .../users/search-by-username-and-host.ts | 8 +- .../src/server/api/endpoints/users/search.ts | 8 +- .../src/server/api/endpoints/users/show.ts | 12 +- packages/backend/src/server/api/index.ts | 24 ++-- packages/backend/src/server/api/limiter.ts | 6 +- .../mastodon/ApiMastodonCompatibleService.ts | 22 +-- .../src/server/api/mastodon/converters.ts | 2 +- .../server/api/mastodon/endpoints/account.ts | 14 +- .../server/api/mastodon/endpoints/filter.ts | 2 +- .../src/server/api/mastodon/endpoints/meta.ts | 6 +- .../api/mastodon/endpoints/notifications.ts | 4 +- .../server/api/mastodon/endpoints/search.ts | 4 +- .../server/api/mastodon/endpoints/status.ts | 12 +- .../server/api/mastodon/endpoints/timeline.ts | 8 +- .../src/server/api/openapi/gen-spec.ts | 4 +- .../backend/src/server/api/private/signin.ts | 30 ++--- .../src/server/api/private/signup-pending.ts | 6 +- .../backend/src/server/api/private/signup.ts | 18 +-- .../src/server/api/private/verify-email.ts | 4 +- .../backend/src/server/api/stream/channel.ts | 6 +- .../src/server/api/stream/channels/antenna.ts | 6 +- .../src/server/api/stream/channels/channel.ts | 8 +- .../api/stream/channels/global-timeline.ts | 4 +- .../src/server/api/stream/channels/hashtag.ts | 6 +- .../api/stream/channels/home-timeline.ts | 8 +- .../api/stream/channels/hybrid-timeline.ts | 10 +- .../src/server/api/stream/channels/index.ts | 24 ++-- .../api/stream/channels/local-timeline.ts | 4 +- .../src/server/api/stream/channels/main.ts | 2 +- .../server/api/stream/channels/messaging.ts | 10 +- .../stream/channels/recommended-timeline.ts | 10 +- .../server/api/stream/channels/user-list.ts | 6 +- .../backend/src/server/api/stream/index.ts | 30 ++--- .../backend/src/server/api/stream/types.ts | 22 +-- packages/backend/src/server/api/streaming.ts | 4 +- .../src/server/file/byte-range-readable.ts | 4 +- packages/backend/src/server/file/index.ts | 4 +- .../src/server/file/send-drive-file.ts | 22 +-- packages/backend/src/server/index.ts | 32 ++--- packages/backend/src/server/nodeinfo.ts | 10 +- packages/backend/src/server/proxy/index.ts | 2 +- .../backend/src/server/proxy/proxy-media.ts | 18 +-- packages/backend/src/server/web/feed.ts | 6 +- packages/backend/src/server/web/index.ts | 36 ++--- packages/backend/src/server/web/manifest.ts | 4 +- .../backend/src/server/web/url-preview.ts | 10 +- packages/backend/src/server/well-known.ts | 6 +- .../src/services/add-note-to-antenna.ts | 6 +- .../backend/src/services/blocking/create.ts | 22 +-- .../backend/src/services/blocking/delete.ts | 10 +- .../src/services/chart/charts/active-users.ts | 2 +- .../src/services/chart/charts/drive.ts | 2 +- .../src/services/chart/charts/federation.ts | 4 +- .../src/services/chart/charts/hashtag.ts | 4 +- .../src/services/chart/charts/instance.ts | 8 +- .../src/services/chart/charts/notes.ts | 6 +- .../services/chart/charts/per-user-drive.ts | 4 +- .../chart/charts/per-user-following.ts | 6 +- .../services/chart/charts/per-user-notes.ts | 6 +- .../chart/charts/per-user-reactions.ts | 6 +- .../src/services/chart/charts/users.ts | 6 +- packages/backend/src/services/chart/core.ts | 24 ++-- .../backend/src/services/chart/entities.ts | 24 ++-- packages/backend/src/services/chart/index.ts | 18 +-- .../src/services/create-notification.ts | 16 +-- .../src/services/create-system-user.ts | 20 +-- .../backend/src/services/detect-sensitive.ts | 2 +- .../backend/src/services/drive/add-file.ts | 50 +++---- .../backend/src/services/drive/delete-file.ts | 10 +- .../drive/generate-video-thumbnail.ts | 2 +- .../src/services/drive/internal-storage.ts | 2 +- packages/backend/src/services/drive/s3.ts | 4 +- .../src/services/drive/upload-from-url.ts | 6 +- .../src/services/fetch-instance-metadata.ts | 10 +- packages/backend/src/services/fetch-rel-me.ts | 2 +- .../backend/src/services/following/create.ts | 36 ++--- .../backend/src/services/following/delete.ts | 18 +-- .../backend/src/services/following/reject.ts | 10 +- .../services/following/requests/accept-all.ts | 2 +- .../src/services/following/requests/accept.ts | 12 +- .../src/services/following/requests/cancel.ts | 12 +- .../src/services/following/requests/create.ts | 12 +- packages/backend/src/services/i/pin.ts | 16 +-- packages/backend/src/services/i/update.ts | 10 +- .../src/services/insert-moderation-log.ts | 2 +- .../backend/src/services/instance-actor.ts | 4 +- packages/backend/src/services/logger.ts | 4 +- .../backend/src/services/messages/create.ts | 32 ++--- .../backend/src/services/messages/delete.ts | 10 +- packages/backend/src/services/note/create.ts | 126 +++++++++--------- packages/backend/src/services/note/delete.ts | 34 ++--- .../backend/src/services/note/polls/update.ts | 8 +- .../backend/src/services/note/polls/vote.ts | 10 +- .../src/services/note/reaction/create.ts | 38 +++--- .../src/services/note/reaction/delete.ts | 16 +-- packages/backend/src/services/note/read.ts | 12 +- packages/backend/src/services/note/unread.ts | 4 +- packages/backend/src/services/note/unwatch.ts | 2 +- packages/backend/src/services/note/watch.ts | 6 +- .../backend/src/services/push-notification.ts | 10 +- .../register-or-fetch-instance-doc.ts | 6 +- packages/backend/src/services/relay.ts | 16 +-- packages/backend/src/services/send-email.ts | 4 +- packages/backend/src/services/stream.ts | 12 +- packages/backend/src/services/suspend-user.ts | 10 +- .../backend/src/services/unsuspend-user.ts | 12 +- .../backend/src/services/update-hashtag.ts | 6 +- packages/backend/src/services/user-cache.ts | 4 +- .../backend/src/services/user-list/push.ts | 14 +- .../services/validate-email-for-account.ts | 4 +- 645 files changed, 2587 insertions(+), 2585 deletions(-) diff --git a/packages/backend/src/boot/index.ts b/packages/backend/src/boot/index.ts index 37c4ab098..489350a15 100644 --- a/packages/backend/src/boot/index.ts +++ b/packages/backend/src/boot/index.ts @@ -5,11 +5,11 @@ import Xev from "xev"; import Logger from "@/services/logger.js"; import { envOption } from "../env.js"; -import os from "node:os"; // for typeorm import "reflect-metadata"; import { masterMain } from "./master.js"; import { workerMain } from "./worker.js"; +import os from "node:os"; const logger = new Logger("core", "cyan"); const clusterLogger = logger.createSubLogger("cluster", "orange", false); diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts index f330d69f4..84767a92c 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -1,18 +1,18 @@ -import cluster from "node:cluster"; import * as fs from "node:fs"; -import * as os from "node:os"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; +import * as os from "node:os"; +import cluster from "node:cluster"; import chalk from "chalk"; import chalkTemplate from "chalk-template"; import semver from "semver"; +import Logger from "@/services/logger.js"; import loadConfig from "@/config/load.js"; import type { Config } from "@/config/types.js"; -import { db, initDb } from "@/db/postgre.js"; import { envOption } from "@/env.js"; import { showMachineInfo } from "@/misc/show-machine-info.js"; -import Logger from "@/services/logger.js"; +import { db, initDb } from "@/db/postgre.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/boot/worker.ts b/packages/backend/src/boot/worker.ts index b407004ac..0acdcd97c 100644 --- a/packages/backend/src/boot/worker.ts +++ b/packages/backend/src/boot/worker.ts @@ -1,6 +1,6 @@ import cluster from "node:cluster"; -import os from "node:os"; import { initDb } from "@/db/postgre.js"; +import os from "node:os"; /** * Init worker process diff --git a/packages/backend/src/config/load.ts b/packages/backend/src/config/load.ts index e5279d2b2..2ff330926 100644 --- a/packages/backend/src/config/load.ts +++ b/packages/backend/src/config/load.ts @@ -3,10 +3,10 @@ */ import * as fs from "node:fs"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; import * as yaml from "js-yaml"; -import type { Mixin, Source } from "./types.js"; +import type { Source, Mixin } from "./types.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/daemons/queue-stats.ts b/packages/backend/src/daemons/queue-stats.ts index 82e8226e9..c358518fa 100644 --- a/packages/backend/src/daemons/queue-stats.ts +++ b/packages/backend/src/daemons/queue-stats.ts @@ -1,5 +1,5 @@ -import { deliverQueue, inboxQueue } from "@/queue/queues.js"; import Xev from "xev"; +import { deliverQueue, inboxQueue } from "@/queue/queues.js"; const ev = new Xev(); diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index aad5d6b36..dc7493381 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -1,8 +1,8 @@ -import meilisearch from "@/db/meilisearch.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import * as osUtils from "os-utils"; import si from "systeminformation"; import Xev from "xev"; +import * as osUtils from "os-utils"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import meilisearch from "@/db/meilisearch.js"; const ev = new Xev(); diff --git a/packages/backend/src/db/elasticsearch.ts b/packages/backend/src/db/elasticsearch.ts index f6ecc1b72..2640e7f91 100644 --- a/packages/backend/src/db/elasticsearch.ts +++ b/packages/backend/src/db/elasticsearch.ts @@ -1,5 +1,5 @@ -import config from "@/config/index.js"; import * as elasticsearch from "@elastic/elasticsearch"; +import config from "@/config/index.js"; const index = { settings: { diff --git a/packages/backend/src/db/meilisearch.ts b/packages/backend/src/db/meilisearch.ts index 676298628..1f294058e 100644 --- a/packages/backend/src/db/meilisearch.ts +++ b/packages/backend/src/db/meilisearch.ts @@ -1,9 +1,9 @@ import { Health, Index, MeiliSearch, Stats } from "meilisearch"; import { dbLogger } from "./logger.js"; -import * as url from "url"; import config from "@/config/index.js"; import { Note } from "@/models/entities/note.js"; +import * as url from "url"; import { ILocalUser } from "@/models/entities/user.js"; import { Followings, Users } from "@/models/index.js"; diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index 7d4666bba..d68f919a7 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -2,76 +2,76 @@ import pg from "pg"; pg.types.setTypeParser(20, Number); -import config from "@/config/index.js"; -import * as highlight from "cli-highlight"; import type { Logger } from "typeorm"; import { DataSource } from "typeorm"; +import * as highlight from "cli-highlight"; +import config from "@/config/index.js"; -import { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; -import { AccessToken } from "@/models/entities/access-token.js"; -import { Ad } from "@/models/entities/ad.js"; -import { AnnouncementRead } from "@/models/entities/announcement-read.js"; -import { Announcement } from "@/models/entities/announcement.js"; -import { Antenna } from "@/models/entities/antenna.js"; -import { App } from "@/models/entities/app.js"; -import { AttestationChallenge } from "@/models/entities/attestation-challenge.js"; -import { AuthSession } from "@/models/entities/auth-session.js"; -import { Blocking } from "@/models/entities/blocking.js"; -import { ChannelFollowing } from "@/models/entities/channel-following.js"; -import { ChannelNotePining } from "@/models/entities/channel-note-pining.js"; -import { Channel } from "@/models/entities/channel.js"; -import { ClipNote } from "@/models/entities/clip-note.js"; -import { Clip } from "@/models/entities/clip.js"; +import { User } from "@/models/entities/user.js"; import { DriveFile } from "@/models/entities/drive-file.js"; import { DriveFolder } from "@/models/entities/drive-folder.js"; -import { Emoji } from "@/models/entities/emoji.js"; -import { FollowRequest } from "@/models/entities/follow-request.js"; -import { Following } from "@/models/entities/following.js"; -import { GalleryLike } from "@/models/entities/gallery-like.js"; -import { GalleryPost } from "@/models/entities/gallery-post.js"; -import { Hashtag } from "@/models/entities/hashtag.js"; -import { Instance } from "@/models/entities/instance.js"; -import { MessagingMessage } from "@/models/entities/messaging-message.js"; -import { Meta } from "@/models/entities/meta.js"; -import { ModerationLog } from "@/models/entities/moderation-log.js"; -import { MutedNote } from "@/models/entities/muted-note.js"; -import { Muting } from "@/models/entities/muting.js"; -import { NoteEdit } from "@/models/entities/note-edit.js"; -import { NoteFavorite } from "@/models/entities/note-favorite.js"; +import { AccessToken } from "@/models/entities/access-token.js"; +import { App } from "@/models/entities/app.js"; +import { PollVote } from "@/models/entities/poll-vote.js"; +import { Note } from "@/models/entities/note.js"; import { NoteReaction } from "@/models/entities/note-reaction.js"; +import { NoteWatching } from "@/models/entities/note-watching.js"; import { NoteThreadMuting } from "@/models/entities/note-thread-muting.js"; import { NoteUnread } from "@/models/entities/note-unread.js"; -import { NoteWatching } from "@/models/entities/note-watching.js"; -import { Note } from "@/models/entities/note.js"; import { Notification } from "@/models/entities/notification.js"; -import { PageLike } from "@/models/entities/page-like.js"; -import { Page } from "@/models/entities/page.js"; -import { PasswordResetRequest } from "@/models/entities/password-reset-request.js"; -import { PollVote } from "@/models/entities/poll-vote.js"; +import { Meta } from "@/models/entities/meta.js"; +import { Following } from "@/models/entities/following.js"; +import { Instance } from "@/models/entities/instance.js"; +import { Muting } from "@/models/entities/muting.js"; +import { RenoteMuting } from "@/models/entities/renote-muting.js"; +import { SwSubscription } from "@/models/entities/sw-subscription.js"; +import { Blocking } from "@/models/entities/blocking.js"; +import { UserList } from "@/models/entities/user-list.js"; +import { UserListJoining } from "@/models/entities/user-list-joining.js"; +import { UserGroup } from "@/models/entities/user-group.js"; +import { UserGroupJoining } from "@/models/entities/user-group-joining.js"; +import { UserGroupInvitation } from "@/models/entities/user-group-invitation.js"; +import { Hashtag } from "@/models/entities/hashtag.js"; +import { NoteFavorite } from "@/models/entities/note-favorite.js"; +import { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; +import { RegistrationTicket } from "@/models/entities/registration-tickets.js"; +import { MessagingMessage } from "@/models/entities/messaging-message.js"; +import { Signin } from "@/models/entities/signin.js"; +import { AuthSession } from "@/models/entities/auth-session.js"; +import { FollowRequest } from "@/models/entities/follow-request.js"; +import { Emoji } from "@/models/entities/emoji.js"; +import { UserNotePining } from "@/models/entities/user-note-pining.js"; import { Poll } from "@/models/entities/poll.js"; +import { UserKeypair } from "@/models/entities/user-keypair.js"; +import { UserPublickey } from "@/models/entities/user-publickey.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { UserSecurityKey } from "@/models/entities/user-security-key.js"; +import { AttestationChallenge } from "@/models/entities/attestation-challenge.js"; +import { Page } from "@/models/entities/page.js"; +import { PageLike } from "@/models/entities/page-like.js"; +import { GalleryPost } from "@/models/entities/gallery-post.js"; +import { GalleryLike } from "@/models/entities/gallery-like.js"; +import { ModerationLog } from "@/models/entities/moderation-log.js"; +import { UsedUsername } from "@/models/entities/used-username.js"; +import { Announcement } from "@/models/entities/announcement.js"; +import { AnnouncementRead } from "@/models/entities/announcement-read.js"; +import { Clip } from "@/models/entities/clip.js"; +import { ClipNote } from "@/models/entities/clip-note.js"; +import { Antenna } from "@/models/entities/antenna.js"; import { PromoNote } from "@/models/entities/promo-note.js"; import { PromoRead } from "@/models/entities/promo-read.js"; -import { RegistrationTicket } from "@/models/entities/registration-tickets.js"; -import { RegistryItem } from "@/models/entities/registry-item.js"; import { Relay } from "@/models/entities/relay.js"; -import { RenoteMuting } from "@/models/entities/renote-muting.js"; -import { Signin } from "@/models/entities/signin.js"; -import { SwSubscription } from "@/models/entities/sw-subscription.js"; -import { UsedUsername } from "@/models/entities/used-username.js"; -import { UserGroupInvitation } from "@/models/entities/user-group-invitation.js"; -import { UserGroupJoining } from "@/models/entities/user-group-joining.js"; -import { UserGroup } from "@/models/entities/user-group.js"; -import { UserIp } from "@/models/entities/user-ip.js"; -import { UserKeypair } from "@/models/entities/user-keypair.js"; -import { UserListJoining } from "@/models/entities/user-list-joining.js"; -import { UserList } from "@/models/entities/user-list.js"; -import { UserNotePining } from "@/models/entities/user-note-pining.js"; +import { MutedNote } from "@/models/entities/muted-note.js"; +import { Channel } from "@/models/entities/channel.js"; +import { ChannelFollowing } from "@/models/entities/channel-following.js"; +import { ChannelNotePining } from "@/models/entities/channel-note-pining.js"; +import { RegistryItem } from "@/models/entities/registry-item.js"; +import { Ad } from "@/models/entities/ad.js"; +import { PasswordResetRequest } from "@/models/entities/password-reset-request.js"; import { UserPending } from "@/models/entities/user-pending.js"; -import { UserProfile } from "@/models/entities/user-profile.js"; -import { UserPublickey } from "@/models/entities/user-publickey.js"; -import { UserSecurityKey } from "@/models/entities/user-security-key.js"; -import { User } from "@/models/entities/user.js"; import { Webhook } from "@/models/entities/webhook.js"; +import { UserIp } from "@/models/entities/user-ip.js"; +import { NoteEdit } from "@/models/entities/note-edit.js"; import { entities as charts } from "@/services/chart/entities.js"; import { dbLogger } from "./logger.js"; diff --git a/packages/backend/src/db/redis.ts b/packages/backend/src/db/redis.ts index aa7ffbb41..215effd8e 100644 --- a/packages/backend/src/db/redis.ts +++ b/packages/backend/src/db/redis.ts @@ -1,5 +1,5 @@ -import config from "@/config/index.js"; import Redis from "ioredis"; +import config from "@/config/index.js"; export function createConnection() { let source = config.redis; diff --git a/packages/backend/src/mfm/to-html.ts b/packages/backend/src/mfm/to-html.ts index c2f4a9e78..47ee0c889 100644 --- a/packages/backend/src/mfm/to-html.ts +++ b/packages/backend/src/mfm/to-html.ts @@ -1,8 +1,8 @@ -import config from "@/config/index.js"; -import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; -import { intersperse } from "@/prelude/array.js"; import { Window } from "happy-dom"; import type * as mfm from "mfm-js"; +import config from "@/config/index.js"; +import { intersperse } from "@/prelude/array.js"; +import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; export function toHtml( nodes: mfm.MfmNode[] | null, diff --git a/packages/backend/src/misc/antenna-cache.ts b/packages/backend/src/misc/antenna-cache.ts index a4fc87414..7f199c396 100644 --- a/packages/backend/src/misc/antenna-cache.ts +++ b/packages/backend/src/misc/antenna-cache.ts @@ -1,6 +1,6 @@ -import { subscriber } from "@/db/redis.js"; -import type { Antenna } from "@/models/entities/antenna.js"; import { Antennas } from "@/models/index.js"; +import type { Antenna } from "@/models/entities/antenna.js"; +import { subscriber } from "@/db/redis.js"; let antennasFetched = false; let antennas: Antenna[] = []; diff --git a/packages/backend/src/misc/before-shutdown.ts b/packages/backend/src/misc/before-shutdown.ts index 721e1af1b..082041835 100644 --- a/packages/backend/src/misc/before-shutdown.ts +++ b/packages/backend/src/misc/before-shutdown.ts @@ -1,5 +1,7 @@ // https://gist.github.com/nfantone/1eaa803772025df69d07f4dbf5df7e58 +"use strict"; + /** * @callback BeforeShutdownListener * @param {string} [signalOrEvent] The exit signal or event name received on the process. diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index b86dd6ed3..913258f05 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -1,6 +1,6 @@ import { redisClient } from "@/db/redis.js"; +import { encode, decode } from "msgpackr"; import { ChainableCommander } from "ioredis"; -import { decode, encode } from "msgpackr"; export class Cache { private ttl: number; diff --git a/packages/backend/src/misc/captcha.ts b/packages/backend/src/misc/captcha.ts index 4da04905f..b3b3dca39 100644 --- a/packages/backend/src/misc/captcha.ts +++ b/packages/backend/src/misc/captcha.ts @@ -1,7 +1,7 @@ -import { URLSearchParams } from "node:url"; -import config from "@/config/index.js"; -import { getAgentByUrl } from "@/misc/fetch.js"; import fetch from "node-fetch"; +import { URLSearchParams } from "node:url"; +import { getAgentByUrl } from "@/misc/fetch.js"; +import config from "@/config/index.js"; export async function verifyRecaptcha(secret: string, response: string) { const result = await getCaptchaResponse( diff --git a/packages/backend/src/misc/check-hit-antenna.ts b/packages/backend/src/misc/check-hit-antenna.ts index 6d2a01ac0..1f4f2f2fa 100644 --- a/packages/backend/src/misc/check-hit-antenna.ts +++ b/packages/backend/src/misc/check-hit-antenna.ts @@ -1,12 +1,12 @@ -import * as Acct from "@/misc/acct.js"; -import { Cache } from "@/misc/cache.js"; -import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { getFullApAccount } from "@/misc/convert-host.js"; -import type { Packed } from "@/misc/schema.js"; import type { Antenna } from "@/models/entities/antenna.js"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, UserProfiles } from "@/models/index.js"; +import { getFullApAccount } from "@/misc/convert-host.js"; +import * as Acct from "@/misc/acct.js"; +import type { Packed } from "@/misc/schema.js"; +import { Cache } from "@/misc/cache.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; const blockingCache = new Cache("blocking", 60 * 5); const mutedWordsCache = new Cache("mutedWords", 60 * 5); diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index c5348d168..5686aef2f 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -1,5 +1,5 @@ -import type { Note } from "@/models/entities/note.js"; import RE2 from "re2"; +import type { Note } from "@/models/entities/note.js"; type NoteLike = { userId: Note["userId"]; diff --git a/packages/backend/src/misc/convert-host.ts b/packages/backend/src/misc/convert-host.ts index 3d7a7abbd..856ce3c12 100644 --- a/packages/backend/src/misc/convert-host.ts +++ b/packages/backend/src/misc/convert-host.ts @@ -1,6 +1,6 @@ import { URL } from "node:url"; -import { toASCII } from "punycode"; import config from "@/config/index.js"; +import { toASCII } from "punycode"; export function getFullApAccount(username: string, host: string | null) { return host diff --git a/packages/backend/src/misc/detect-language.ts b/packages/backend/src/misc/detect-language.ts index 15763d5af..6147247de 100644 --- a/packages/backend/src/misc/detect-language.ts +++ b/packages/backend/src/misc/detect-language.ts @@ -1,5 +1,5 @@ -import * as mfm from "mfm-js"; import { detect } from "tinyld"; +import * as mfm from "mfm-js"; export default function detectLanguage(text: string): string { const nodes = mfm.parse(text); diff --git a/packages/backend/src/misc/download-url.ts b/packages/backend/src/misc/download-url.ts index 0112dcfba..83680c175 100644 --- a/packages/backend/src/misc/download-url.ts +++ b/packages/backend/src/misc/download-url.ts @@ -1,13 +1,13 @@ import * as fs from "node:fs"; import * as stream from "node:stream"; import * as util from "node:util"; -import config from "@/config/index.js"; -import Logger from "@/services/logger.js"; -import chalk from "chalk"; import got, * as Got from "got"; +import { httpAgent, httpsAgent, StatusError } from "./fetch.js"; +import config from "@/config/index.js"; +import chalk from "chalk"; +import Logger from "@/services/logger.js"; import IPCIDR from "ip-cidr"; import PrivateIp from "private-ip"; -import { StatusError, httpAgent, httpsAgent } from "./fetch.js"; const pipeline = util.promisify(stream.pipeline); diff --git a/packages/backend/src/misc/emoji-meta.ts b/packages/backend/src/misc/emoji-meta.ts index 360cf9314..2b9365b82 100644 --- a/packages/backend/src/misc/emoji-meta.ts +++ b/packages/backend/src/misc/emoji-meta.ts @@ -2,9 +2,9 @@ import probeImageSize from "probe-image-size"; import { Mutex } from "redis-semaphore"; import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import { redisClient } from "@/db/redis.js"; import Logger from "@/services/logger.js"; import { Cache } from "./cache.js"; +import { redisClient } from "@/db/redis.js"; export type Size = { width: number; diff --git a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts index f79f8c431..7de32e6d6 100644 --- a/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts +++ b/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts @@ -1,5 +1,5 @@ -import { unique } from "@/prelude/array.js"; import * as mfm from "mfm-js"; +import { unique } from "@/prelude/array.js"; export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { const emojiNodes = mfm.extract(nodes, (node) => { diff --git a/packages/backend/src/misc/extract-hashtags.ts b/packages/backend/src/misc/extract-hashtags.ts index 2b575e8a9..826e36221 100644 --- a/packages/backend/src/misc/extract-hashtags.ts +++ b/packages/backend/src/misc/extract-hashtags.ts @@ -1,5 +1,5 @@ -import { unique } from "@/prelude/array.js"; import * as mfm from "mfm-js"; +import { unique } from "@/prelude/array.js"; export function extractHashtags(nodes: mfm.MfmNode[]): string[] { const hashtagNodes = mfm.extract(nodes, (node) => node.type === "hashtag"); diff --git a/packages/backend/src/misc/fetch-proxy-account.ts b/packages/backend/src/misc/fetch-proxy-account.ts index 4aa20cbcb..a277db6fb 100644 --- a/packages/backend/src/misc/fetch-proxy-account.ts +++ b/packages/backend/src/misc/fetch-proxy-account.ts @@ -1,6 +1,6 @@ +import { fetchMeta } from "./fetch-meta.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; -import { fetchMeta } from "./fetch-meta.js"; export async function fetchProxyAccount(): Promise { const meta = await fetchMeta(); diff --git a/packages/backend/src/misc/fetch.ts b/packages/backend/src/misc/fetch.ts index d7e8ce69f..e47ef0d47 100644 --- a/packages/backend/src/misc/fetch.ts +++ b/packages/backend/src/misc/fetch.ts @@ -1,10 +1,10 @@ import * as http from "node:http"; import * as https from "node:https"; import type { URL } from "node:url"; -import config from "@/config/index.js"; import CacheableLookup from "cacheable-lookup"; -import { HttpProxyAgent, HttpsProxyAgent } from "hpagent"; import fetch from "node-fetch"; +import { HttpProxyAgent, HttpsProxyAgent } from "hpagent"; +import config from "@/config/index.js"; export async function getJson( url: string, diff --git a/packages/backend/src/misc/gen-id.ts b/packages/backend/src/misc/gen-id.ts index 5da622b97..737bbe488 100644 --- a/packages/backend/src/misc/gen-id.ts +++ b/packages/backend/src/misc/gen-id.ts @@ -1,8 +1,8 @@ import config from "@/config/index.js"; import { nativeCreateId, - nativeGetTimestamp, nativeInitIdGenerator, + nativeGetTimestamp, } from "native-utils/built/index.js"; const length = Math.min(Math.max(config.cuid?.length ?? 16, 16), 24); diff --git a/packages/backend/src/misc/get-file-info.ts b/packages/backend/src/misc/get-file-info.ts index a008e9c29..76964890e 100644 --- a/packages/backend/src/misc/get-file-info.ts +++ b/packages/backend/src/misc/get-file-info.ts @@ -1,17 +1,17 @@ -import * as crypto from "node:crypto"; import * as fs from "node:fs"; +import * as crypto from "node:crypto"; import { join } from "node:path"; import * as stream from "node:stream"; import * as util from "node:util"; -import { detectSensitive } from "@/services/detect-sensitive.js"; -import { encode } from "blurhash"; import { FSWatcher } from "chokidar"; import { fileTypeFromFile } from "file-type"; +import probeImageSize from "probe-image-size"; import FFmpeg from "fluent-ffmpeg"; import isSvg from "is-svg"; import { type predictionType } from "nsfwjs"; -import probeImageSize from "probe-image-size"; import sharp from "sharp"; +import { encode } from "blurhash"; +import { detectSensitive } from "@/services/detect-sensitive.js"; import { createTempDir } from "./create-temp.js"; const pipeline = util.promisify(stream.pipeline); diff --git a/packages/backend/src/misc/keypair-store.ts b/packages/backend/src/misc/keypair-store.ts index b8c0ed5dc..625577359 100644 --- a/packages/backend/src/misc/keypair-store.ts +++ b/packages/backend/src/misc/keypair-store.ts @@ -1,6 +1,6 @@ -import type { UserKeypair } from "@/models/entities/user-keypair.js"; -import type { User } from "@/models/entities/user.js"; import { UserKeypairs } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import type { UserKeypair } from "@/models/entities/user-keypair.js"; import { Cache } from "./cache.js"; const cache = new Cache("keypairStore", 60 * 30); diff --git a/packages/backend/src/misc/password.ts b/packages/backend/src/misc/password.ts index 52c139342..c63f89f5c 100644 --- a/packages/backend/src/misc/password.ts +++ b/packages/backend/src/misc/password.ts @@ -1,5 +1,5 @@ -import * as argon2 from "argon2"; import bcrypt from "bcryptjs"; +import * as argon2 from "argon2"; export async function hashPassword(password: string): Promise { return argon2.hash(password); diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index d509a9f5b..795a267f9 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -1,13 +1,13 @@ -import config from "@/config/index.js"; -import { redisClient } from "@/db/redis.js"; +import { In, IsNull } from "typeorm"; +import { Emojis } from "@/models/index.js"; import type { Emoji } from "@/models/entities/emoji.js"; import type { Note } from "@/models/entities/note.js"; -import { Emojis } from "@/models/index.js"; -import { query } from "@/prelude/url.js"; -import { In, IsNull } from "typeorm"; import { Cache } from "./cache.js"; import { isSelfHost, toPunyNullable } from "./convert-host.js"; import { decodeReaction } from "./reaction-lib.js"; +import config from "@/config/index.js"; +import { query } from "@/prelude/url.js"; +import { redisClient } from "@/db/redis.js"; const cache = new Cache("populateEmojis", 60 * 60 * 12); diff --git a/packages/backend/src/misc/process-masto-notes.ts b/packages/backend/src/misc/process-masto-notes.ts index 886574218..1327b4cff 100644 --- a/packages/backend/src/misc/process-masto-notes.ts +++ b/packages/backend/src/misc/process-masto-notes.ts @@ -1,13 +1,13 @@ import * as fs from "node:fs"; -import * as Path from "node:path"; -import { Users } from "@/models/index.js"; -import { addFile } from "@/services/drive/add-file.js"; import Logger from "@/services/logger.js"; -import decompress from "decompress"; -import gunzip from "gunzip-maybe"; -import * as tar from "tar-stream"; import { createTemp, createTempDir } from "./create-temp.js"; import { downloadUrl } from "./download-url.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { Users } from "@/models/index.js"; +import * as tar from "tar-stream"; +import gunzip from "gunzip-maybe"; +import decompress from "decompress"; +import * as Path from "node:path"; const logger = new Logger("process-masto-notes"); diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index b3e4903fa..db88b0590 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -1,8 +1,8 @@ -import { Emojis } from "@/models/index.js"; -import { IsNull } from "typeorm"; -import { toPunyNullable } from "./convert-host.js"; import { emojiRegex } from "./emoji-regex.js"; import { fetchMeta } from "./fetch-meta.js"; +import { Emojis } from "@/models/index.js"; +import { toPunyNullable } from "./convert-host.js"; +import { IsNull } from "typeorm"; export function convertReactions(reactions: Record) { const result = new Map(); diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index 4e0fdc5d4..6e03d30d9 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -1,36 +1,36 @@ -import { packedAntennaSchema } from "@/models/schema/antenna.js"; -import { packedAppSchema } from "@/models/schema/app.js"; -import { packedBlockingSchema } from "@/models/schema/blocking.js"; -import { packedChannelSchema } from "@/models/schema/channel.js"; -import { packedClipSchema } from "@/models/schema/clip.js"; -import { packedDriveFileSchema } from "@/models/schema/drive-file.js"; -import { packedDriveFolderSchema } from "@/models/schema/drive-folder.js"; -import { packedEmojiSchema } from "@/models/schema/emoji.js"; -import { packedFederationInstanceSchema } from "@/models/schema/federation-instance.js"; -import { packedFollowingSchema } from "@/models/schema/following.js"; -import { packedGalleryPostSchema } from "@/models/schema/gallery-post.js"; -import { packedHashtagSchema } from "@/models/schema/hashtag.js"; -import { packedMessagingMessageSchema } from "@/models/schema/messaging-message.js"; -import { packedMutingSchema } from "@/models/schema/muting.js"; -import { packedNoteEdit } from "@/models/schema/note-edit.js"; -import { packedNoteFavoriteSchema } from "@/models/schema/note-favorite.js"; -import { packedNoteReactionSchema } from "@/models/schema/note-reaction.js"; -import { packedNoteSchema } from "@/models/schema/note.js"; -import { packedNotificationSchema } from "@/models/schema/notification.js"; -import { packedPageSchema } from "@/models/schema/page.js"; -import { packedQueueCountSchema } from "@/models/schema/queue.js"; -import { packedRenoteMutingSchema } from "@/models/schema/renote-muting.js"; -import { packedUserGroupSchema } from "@/models/schema/user-group.js"; -import { packedUserListSchema } from "@/models/schema/user-list.js"; import { - packedMeDetailedOnlySchema, - packedMeDetailedSchema, - packedUserDetailedNotMeOnlySchema, - packedUserDetailedNotMeSchema, - packedUserDetailedSchema, packedUserLiteSchema, + packedUserDetailedNotMeOnlySchema, + packedMeDetailedOnlySchema, + packedUserDetailedNotMeSchema, + packedMeDetailedSchema, + packedUserDetailedSchema, packedUserSchema, } from "@/models/schema/user.js"; +import { packedNoteSchema } from "@/models/schema/note.js"; +import { packedUserListSchema } from "@/models/schema/user-list.js"; +import { packedAppSchema } from "@/models/schema/app.js"; +import { packedMessagingMessageSchema } from "@/models/schema/messaging-message.js"; +import { packedNotificationSchema } from "@/models/schema/notification.js"; +import { packedDriveFileSchema } from "@/models/schema/drive-file.js"; +import { packedDriveFolderSchema } from "@/models/schema/drive-folder.js"; +import { packedFollowingSchema } from "@/models/schema/following.js"; +import { packedMutingSchema } from "@/models/schema/muting.js"; +import { packedRenoteMutingSchema } from "@/models/schema/renote-muting.js"; +import { packedBlockingSchema } from "@/models/schema/blocking.js"; +import { packedNoteReactionSchema } from "@/models/schema/note-reaction.js"; +import { packedHashtagSchema } from "@/models/schema/hashtag.js"; +import { packedPageSchema } from "@/models/schema/page.js"; +import { packedUserGroupSchema } from "@/models/schema/user-group.js"; +import { packedNoteFavoriteSchema } from "@/models/schema/note-favorite.js"; +import { packedChannelSchema } from "@/models/schema/channel.js"; +import { packedAntennaSchema } from "@/models/schema/antenna.js"; +import { packedClipSchema } from "@/models/schema/clip.js"; +import { packedFederationInstanceSchema } from "@/models/schema/federation-instance.js"; +import { packedQueueCountSchema } from "@/models/schema/queue.js"; +import { packedGalleryPostSchema } from "@/models/schema/gallery-post.js"; +import { packedEmojiSchema } from "@/models/schema/emoji.js"; +import { packedNoteEdit } from "@/models/schema/note-edit.js"; export const refs = { UserLite: packedUserLiteSchema, diff --git a/packages/backend/src/misc/show-machine-info.ts b/packages/backend/src/misc/show-machine-info.ts index 7b5db8d2a..d3a28cbd3 100644 --- a/packages/backend/src/misc/show-machine-info.ts +++ b/packages/backend/src/misc/show-machine-info.ts @@ -1,6 +1,6 @@ import * as os from "node:os"; -import type Logger from "@/services/logger.js"; import sysUtils from "systeminformation"; +import type Logger from "@/services/logger.js"; export async function showMachineInfo(parentLogger: Logger) { const logger = parentLogger.createSubLogger("machine"); diff --git a/packages/backend/src/misc/skipped-instances.ts b/packages/backend/src/misc/skipped-instances.ts index 59d5a2fc6..785393022 100644 --- a/packages/backend/src/misc/skipped-instances.ts +++ b/packages/backend/src/misc/skipped-instances.ts @@ -1,8 +1,8 @@ -import { DAY } from "@/const.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { Instance } from "@/models/entities/instance.js"; -import { Instances } from "@/models/index.js"; import { Brackets } from "typeorm"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Instances } from "@/models/index.js"; +import type { Instance } from "@/models/entities/instance.js"; +import { DAY } from "@/const.js"; import { shouldBlockInstance } from "./should-block-instance.js"; // Threshold from last contact after which an instance will be considered diff --git a/packages/backend/src/misc/webhook-cache.ts b/packages/backend/src/misc/webhook-cache.ts index 6ffbde5cb..1eda5eaec 100644 --- a/packages/backend/src/misc/webhook-cache.ts +++ b/packages/backend/src/misc/webhook-cache.ts @@ -1,6 +1,6 @@ -import { subscriber } from "@/db/redis.js"; -import type { Webhook } from "@/models/entities/webhook.js"; import { Webhooks } from "@/models/index.js"; +import type { Webhook } from "@/models/entities/webhook.js"; +import { subscriber } from "@/db/redis.js"; let webhooksFetched = false; let webhooks: Webhook[] = []; diff --git a/packages/backend/src/models/entities/abuse-user-report.ts b/packages/backend/src/models/entities/abuse-user-report.ts index 47063cca5..cb4d55851 100644 --- a/packages/backend/src/models/entities/abuse-user-report.ts +++ b/packages/backend/src/models/entities/abuse-user-report.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class AbuseUserReport { diff --git a/packages/backend/src/models/entities/access-token.ts b/packages/backend/src/models/entities/access-token.ts index 260f3f832..8b950b171 100644 --- a/packages/backend/src/models/entities/access-token.ts +++ b/packages/backend/src/models/entities/access-token.ts @@ -1,14 +1,14 @@ import { - Column, Entity, - Index, - JoinColumn, - ManyToOne, PrimaryColumn, + Index, + Column, + ManyToOne, + JoinColumn, } from "typeorm"; -import { id } from "../id.js"; -import { App } from "./app.js"; import { User } from "./user.js"; +import { App } from "./app.js"; +import { id } from "../id.js"; @Entity() export class AccessToken { diff --git a/packages/backend/src/models/entities/ad.ts b/packages/backend/src/models/entities/ad.ts index 0fad2bdbb..80d54ddd5 100644 --- a/packages/backend/src/models/entities/ad.ts +++ b/packages/backend/src/models/entities/ad.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { Entity, Index, Column, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/announcement-read.ts b/packages/backend/src/models/entities/announcement-read.ts index 68dcbffc0..79af9e48e 100644 --- a/packages/backend/src/models/entities/announcement-read.ts +++ b/packages/backend/src/models/entities/announcement-read.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { Announcement } from "./announcement.js"; import { User } from "./user.js"; +import { Announcement } from "./announcement.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "announcementId"], { unique: true }) diff --git a/packages/backend/src/models/entities/announcement.ts b/packages/backend/src/models/entities/announcement.ts index baa69ebe8..7872c0fe1 100644 --- a/packages/backend/src/models/entities/announcement.ts +++ b/packages/backend/src/models/entities/announcement.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { Entity, Index, Column, PrimaryColumn } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/antenna.ts b/packages/backend/src/models/entities/antenna.ts index b535afc1e..633dcc1d2 100644 --- a/packages/backend/src/models/entities/antenna.ts +++ b/packages/backend/src/models/entities/antenna.ts @@ -1,15 +1,15 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { UserGroupJoining } from "./user-group-joining.js"; -import { UserList } from "./user-list.js"; import { User } from "./user.js"; +import { id } from "../id.js"; +import { UserList } from "./user-list.js"; +import { UserGroupJoining } from "./user-group-joining.js"; @Entity() export class Antenna { diff --git a/packages/backend/src/models/entities/app.ts b/packages/backend/src/models/entities/app.ts index 30f893c1a..a41e35aa9 100644 --- a/packages/backend/src/models/entities/app.ts +++ b/packages/backend/src/models/entities/app.ts @@ -1,6 +1,6 @@ -import { Column, Entity, Index, ManyToOne, PrimaryColumn } from "typeorm"; -import { id } from "../id.js"; +import { Entity, PrimaryColumn, Column, Index, ManyToOne } from "typeorm"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class App { diff --git a/packages/backend/src/models/entities/attestation-challenge.ts b/packages/backend/src/models/entities/attestation-challenge.ts index 1fe363a23..6a3a9c8ed 100644 --- a/packages/backend/src/models/entities/attestation-challenge.ts +++ b/packages/backend/src/models/entities/attestation-challenge.ts @@ -1,13 +1,13 @@ import { - Column, - Entity, - Index, - JoinColumn, - ManyToOne, PrimaryColumn, + Entity, + JoinColumn, + Column, + ManyToOne, + Index, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class AttestationChallenge { diff --git a/packages/backend/src/models/entities/auth-session.ts b/packages/backend/src/models/entities/auth-session.ts index c7028cff0..b31dca56c 100644 --- a/packages/backend/src/models/entities/auth-session.ts +++ b/packages/backend/src/models/entities/auth-session.ts @@ -1,14 +1,14 @@ import { - Column, Entity, - Index, - JoinColumn, - ManyToOne, PrimaryColumn, + Index, + Column, + ManyToOne, + JoinColumn, } from "typeorm"; -import { id } from "../id.js"; -import { App } from "./app.js"; import { User } from "./user.js"; +import { App } from "./app.js"; +import { id } from "../id.js"; @Entity() export class AuthSession { diff --git a/packages/backend/src/models/entities/blocking.ts b/packages/backend/src/models/entities/blocking.ts index edbbca9c1..55f677a98 100644 --- a/packages/backend/src/models/entities/blocking.ts +++ b/packages/backend/src/models/entities/blocking.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["blockerId", "blockeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/channel-following.ts b/packages/backend/src/models/entities/channel-following.ts index 9c1ac9eac..ee329fa50 100644 --- a/packages/backend/src/models/entities/channel-following.ts +++ b/packages/backend/src/models/entities/channel-following.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; +import { User } from "./user.js"; import { id } from "../id.js"; import { Channel } from "./channel.js"; -import { User } from "./user.js"; @Entity() @Index(["followerId", "followeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/channel-note-pining.ts b/packages/backend/src/models/entities/channel-note-pining.ts index adef9a461..67d1d48cc 100644 --- a/packages/backend/src/models/entities/channel-note-pining.ts +++ b/packages/backend/src/models/entities/channel-note-pining.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { Channel } from "./channel.js"; import { Note } from "./note.js"; +import { Channel } from "./channel.js"; +import { id } from "../id.js"; @Entity() @Index(["channelId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/channel.ts b/packages/backend/src/models/entities/channel.ts index 06b835c0f..ea22fed50 100644 --- a/packages/backend/src/models/entities/channel.ts +++ b/packages/backend/src/models/entities/channel.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; +import { User } from "./user.js"; import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; -import { User } from "./user.js"; @Entity() export class Channel { diff --git a/packages/backend/src/models/entities/clip-note.ts b/packages/backend/src/models/entities/clip-note.ts index 1e2c0f89a..1697474a8 100644 --- a/packages/backend/src/models/entities/clip-note.ts +++ b/packages/backend/src/models/entities/clip-note.ts @@ -1,14 +1,14 @@ import { - Column, Entity, Index, JoinColumn, + Column, ManyToOne, PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { Clip } from "./clip.js"; import { Note } from "./note.js"; +import { Clip } from "./clip.js"; +import { id } from "../id.js"; @Entity() @Index(["noteId", "clipId"], { unique: true }) diff --git a/packages/backend/src/models/entities/clip.ts b/packages/backend/src/models/entities/clip.ts index 8f5ce524e..9554703a4 100644 --- a/packages/backend/src/models/entities/clip.ts +++ b/packages/backend/src/models/entities/clip.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class Clip { diff --git a/packages/backend/src/models/entities/drive-file.ts b/packages/backend/src/models/entities/drive-file.ts index 1174a628f..da93f32a8 100644 --- a/packages/backend/src/models/entities/drive-file.ts +++ b/packages/backend/src/models/entities/drive-file.ts @@ -1,15 +1,15 @@ -import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; -import { DriveFolder } from "./drive-folder.js"; import { User } from "./user.js"; +import { DriveFolder } from "./drive-folder.js"; +import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; @Entity() @Index(["userId", "folderId", "id"]) diff --git a/packages/backend/src/models/entities/drive-folder.ts b/packages/backend/src/models/entities/drive-folder.ts index bc4ef9d30..0bb2c7a3d 100644 --- a/packages/backend/src/models/entities/drive-folder.ts +++ b/packages/backend/src/models/entities/drive-folder.ts @@ -1,13 +1,13 @@ import { - Column, - Entity, - Index, JoinColumn, ManyToOne, + Entity, PrimaryColumn, + Index, + Column, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class DriveFolder { diff --git a/packages/backend/src/models/entities/emoji.ts b/packages/backend/src/models/entities/emoji.ts index 760213e67..87b525dc5 100644 --- a/packages/backend/src/models/entities/emoji.ts +++ b/packages/backend/src/models/entities/emoji.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { PrimaryColumn, Entity, Index, Column } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/follow-request.ts b/packages/backend/src/models/entities/follow-request.ts index 3e4bf423b..281eab917 100644 --- a/packages/backend/src/models/entities/follow-request.ts +++ b/packages/backend/src/models/entities/follow-request.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["followerId", "followeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/following.ts b/packages/backend/src/models/entities/following.ts index 841553e5f..ea8f32565 100644 --- a/packages/backend/src/models/entities/following.ts +++ b/packages/backend/src/models/entities/following.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["followerId", "followeeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/gallery-like.ts b/packages/backend/src/models/entities/gallery-like.ts index 8393930ae..259feb8bb 100644 --- a/packages/backend/src/models/entities/gallery-like.ts +++ b/packages/backend/src/models/entities/gallery-like.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; +import { User } from "./user.js"; import { id } from "../id.js"; import { GalleryPost } from "./gallery-post.js"; -import { User } from "./user.js"; @Entity() @Index(["userId", "postId"], { unique: true }) diff --git a/packages/backend/src/models/entities/gallery-post.ts b/packages/backend/src/models/entities/gallery-post.ts index 601d323a8..938348659 100644 --- a/packages/backend/src/models/entities/gallery-post.ts +++ b/packages/backend/src/models/entities/gallery-post.ts @@ -1,14 +1,14 @@ import { - Column, Entity, Index, JoinColumn, - ManyToOne, + Column, PrimaryColumn, + ManyToOne, } from "typeorm"; +import { User } from "./user.js"; import { id } from "../id.js"; import type { DriveFile } from "./drive-file.js"; -import { User } from "./user.js"; @Entity() export class GalleryPost { diff --git a/packages/backend/src/models/entities/hashtag.ts b/packages/backend/src/models/entities/hashtag.ts index 60a4c4049..7b3df1cc2 100644 --- a/packages/backend/src/models/entities/hashtag.ts +++ b/packages/backend/src/models/entities/hashtag.ts @@ -1,6 +1,6 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; -import { id } from "../id.js"; +import { Entity, PrimaryColumn, Index, Column } from "typeorm"; import type { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class Hashtag { diff --git a/packages/backend/src/models/entities/instance.ts b/packages/backend/src/models/entities/instance.ts index d2e147803..7b7701d07 100644 --- a/packages/backend/src/models/entities/instance.ts +++ b/packages/backend/src/models/entities/instance.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { Entity, PrimaryColumn, Index, Column } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/messaging-message.ts b/packages/backend/src/models/entities/messaging-message.ts index 38fcb92d3..d1da00eae 100644 --- a/packages/backend/src/models/entities/messaging-message.ts +++ b/packages/backend/src/models/entities/messaging-message.ts @@ -1,15 +1,15 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { DriveFile } from "./drive-file.js"; -import { UserGroup } from "./user-group.js"; import { User } from "./user.js"; +import { DriveFile } from "./drive-file.js"; +import { id } from "../id.js"; +import { UserGroup } from "./user-group.js"; @Entity() export class MessagingMessage { diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index b8e71368d..c1e3be58f 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -1,7 +1,7 @@ -import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm"; +import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from "typeorm"; import { id } from "../id.js"; -import type { Clip } from "./clip.js"; import { User } from "./user.js"; +import type { Clip } from "./clip.js"; @Entity() export class Meta { diff --git a/packages/backend/src/models/entities/moderation-log.ts b/packages/backend/src/models/entities/moderation-log.ts index dd8113951..26bf1cdfa 100644 --- a/packages/backend/src/models/entities/moderation-log.ts +++ b/packages/backend/src/models/entities/moderation-log.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class ModerationLog { diff --git a/packages/backend/src/models/entities/muted-note.ts b/packages/backend/src/models/entities/muted-note.ts index 5d9566a19..0ee245aea 100644 --- a/packages/backend/src/models/entities/muted-note.ts +++ b/packages/backend/src/models/entities/muted-note.ts @@ -1,15 +1,15 @@ import { - Column, Entity, Index, JoinColumn, + Column, ManyToOne, PrimaryColumn, } from "typeorm"; -import { mutedNoteReasons } from "../../types.js"; -import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; +import { id } from "../id.js"; +import { mutedNoteReasons } from "../../types.js"; @Entity() @Index(["noteId", "userId"], { unique: true }) diff --git a/packages/backend/src/models/entities/muting.ts b/packages/backend/src/models/entities/muting.ts index b4c3a580b..603619b46 100644 --- a/packages/backend/src/models/entities/muting.ts +++ b/packages/backend/src/models/entities/muting.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["muterId", "muteeId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-edit.ts b/packages/backend/src/models/entities/note-edit.ts index fea5c3520..8761e2b15 100644 --- a/packages/backend/src/models/entities/note-edit.ts +++ b/packages/backend/src/models/entities/note-edit.ts @@ -1,14 +1,14 @@ import { - Column, Entity, - Index, JoinColumn, + Column, ManyToOne, PrimaryColumn, + Index, } from "typeorm"; +import { Note } from "./note.js"; import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; -import { Note } from "./note.js"; @Entity() export class NoteEdit { diff --git a/packages/backend/src/models/entities/note-favorite.ts b/packages/backend/src/models/entities/note-favorite.ts index 5076695c2..19641ecf4 100644 --- a/packages/backend/src/models/entities/note-favorite.ts +++ b/packages/backend/src/models/entities/note-favorite.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-reaction.ts b/packages/backend/src/models/entities/note-reaction.ts index 35bac22b0..5e2a8d3e8 100644 --- a/packages/backend/src/models/entities/note-reaction.ts +++ b/packages/backend/src/models/entities/note-reaction.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { Note } from "./note.js"; import { User } from "./user.js"; +import { Note } from "./note.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-thread-muting.ts b/packages/backend/src/models/entities/note-thread-muting.ts index 1b2bbebdc..7e5fad59a 100644 --- a/packages/backend/src/models/entities/note-thread-muting.ts +++ b/packages/backend/src/models/entities/note-thread-muting.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "threadId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-unread.ts b/packages/backend/src/models/entities/note-unread.ts index a85db9095..95695cbc8 100644 --- a/packages/backend/src/models/entities/note-unread.ts +++ b/packages/backend/src/models/entities/note-unread.ts @@ -1,15 +1,15 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; +import { User } from "./user.js"; +import { Note } from "./note.js"; import { id } from "../id.js"; import type { Channel } from "./channel.js"; -import { Note } from "./note.js"; -import { User } from "./user.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note-watching.ts b/packages/backend/src/models/entities/note-watching.ts index 8bc296df5..724b084af 100644 --- a/packages/backend/src/models/entities/note-watching.ts +++ b/packages/backend/src/models/entities/note-watching.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { Note } from "./note.js"; import { User } from "./user.js"; +import { Note } from "./note.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index 3c6fb9d1a..2b9de38cb 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -1,16 +1,16 @@ import { - Column, Entity, Index, JoinColumn, - ManyToOne, + Column, PrimaryColumn, + ManyToOne, } from "typeorm"; -import { noteVisibilities } from "../../types.js"; -import { id } from "../id.js"; -import { Channel } from "./channel.js"; -import type { DriveFile } from "./drive-file.js"; import { User } from "./user.js"; +import type { DriveFile } from "./drive-file.js"; +import { id } from "../id.js"; +import { noteVisibilities } from "../../types.js"; +import { Channel } from "./channel.js"; @Entity() @Index("IDX_NOTE_TAGS", { synchronize: false }) diff --git a/packages/backend/src/models/entities/notification.ts b/packages/backend/src/models/entities/notification.ts index ea1a0f8c2..da23f7d3e 100644 --- a/packages/backend/src/models/entities/notification.ts +++ b/packages/backend/src/models/entities/notification.ts @@ -1,18 +1,18 @@ -import { notificationTypes } from "@/types.js"; import { - Column, Entity, Index, JoinColumn, ManyToOne, + Column, PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { AccessToken } from "./access-token.js"; -import { FollowRequest } from "./follow-request.js"; -import { Note } from "./note.js"; -import { UserGroupInvitation } from "./user-group-invitation.js"; import { User } from "./user.js"; +import { id } from "../id.js"; +import { Note } from "./note.js"; +import { FollowRequest } from "./follow-request.js"; +import { UserGroupInvitation } from "./user-group-invitation.js"; +import { AccessToken } from "./access-token.js"; +import { notificationTypes } from "@/types.js"; @Entity() export class Notification { diff --git a/packages/backend/src/models/entities/page-like.ts b/packages/backend/src/models/entities/page-like.ts index f93221e28..6304e0b24 100644 --- a/packages/backend/src/models/entities/page-like.ts +++ b/packages/backend/src/models/entities/page-like.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; +import { User } from "./user.js"; import { id } from "../id.js"; import { Page } from "./page.js"; -import { User } from "./user.js"; @Entity() @Index(["userId", "pageId"], { unique: true }) diff --git a/packages/backend/src/models/entities/page.ts b/packages/backend/src/models/entities/page.ts index f80ac570b..d0733c8ce 100644 --- a/packages/backend/src/models/entities/page.ts +++ b/packages/backend/src/models/entities/page.ts @@ -1,14 +1,14 @@ import { - Column, Entity, Index, JoinColumn, - ManyToOne, + Column, PrimaryColumn, + ManyToOne, } from "typeorm"; +import { User } from "./user.js"; import { id } from "../id.js"; import { DriveFile } from "./drive-file.js"; -import { User } from "./user.js"; @Entity() @Index(["userId", "name"], { unique: true }) diff --git a/packages/backend/src/models/entities/password-reset-request.ts b/packages/backend/src/models/entities/password-reset-request.ts index 483351960..ab0bccbbe 100644 --- a/packages/backend/src/models/entities/password-reset-request.ts +++ b/packages/backend/src/models/entities/password-reset-request.ts @@ -1,10 +1,10 @@ import { - Column, + PrimaryColumn, Entity, Index, - JoinColumn, + Column, ManyToOne, - PrimaryColumn, + JoinColumn, } from "typeorm"; import { id } from "../id.js"; import { User } from "./user.js"; diff --git a/packages/backend/src/models/entities/poll-vote.ts b/packages/backend/src/models/entities/poll-vote.ts index e14734a77..d59a720c3 100644 --- a/packages/backend/src/models/entities/poll-vote.ts +++ b/packages/backend/src/models/entities/poll-vote.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { Note } from "./note.js"; import { User } from "./user.js"; +import { Note } from "./note.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "noteId", "choice"], { unique: true }) diff --git a/packages/backend/src/models/entities/poll.ts b/packages/backend/src/models/entities/poll.ts index ae6be5998..c117d4e73 100644 --- a/packages/backend/src/models/entities/poll.ts +++ b/packages/backend/src/models/entities/poll.ts @@ -1,15 +1,15 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, OneToOne, - PrimaryColumn, } from "typeorm"; -import { noteVisibilities } from "../../types.js"; import { id } from "../id.js"; import { Note } from "./note.js"; import type { User } from "./user.js"; +import { noteVisibilities } from "../../types.js"; @Entity() export class Poll { diff --git a/packages/backend/src/models/entities/promo-note.ts b/packages/backend/src/models/entities/promo-note.ts index 142634c2e..caa64927e 100644 --- a/packages/backend/src/models/entities/promo-note.ts +++ b/packages/backend/src/models/entities/promo-note.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, OneToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { Note } from "./note.js"; import type { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class PromoNote { diff --git a/packages/backend/src/models/entities/promo-read.ts b/packages/backend/src/models/entities/promo-read.ts index a5a54af4b..b31877dc3 100644 --- a/packages/backend/src/models/entities/promo-read.ts +++ b/packages/backend/src/models/entities/promo-read.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/registration-tickets.ts b/packages/backend/src/models/entities/registration-tickets.ts index cb4547fb8..549f05d07 100644 --- a/packages/backend/src/models/entities/registration-tickets.ts +++ b/packages/backend/src/models/entities/registration-tickets.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { PrimaryColumn, Entity, Index, Column } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/registry-item.ts b/packages/backend/src/models/entities/registry-item.ts index d2c70f7ba..d044222e6 100644 --- a/packages/backend/src/models/entities/registry-item.ts +++ b/packages/backend/src/models/entities/registry-item.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; // TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい @Entity() diff --git a/packages/backend/src/models/entities/relay.ts b/packages/backend/src/models/entities/relay.ts index 5b3ebef55..c7509dcf4 100644 --- a/packages/backend/src/models/entities/relay.ts +++ b/packages/backend/src/models/entities/relay.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { PrimaryColumn, Entity, Index, Column } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/renote-muting.ts b/packages/backend/src/models/entities/renote-muting.ts index 793c39df6..e8856492f 100644 --- a/packages/backend/src/models/entities/renote-muting.ts +++ b/packages/backend/src/models/entities/renote-muting.ts @@ -1,10 +1,10 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; import { User } from "./user.js"; diff --git a/packages/backend/src/models/entities/signin.ts b/packages/backend/src/models/entities/signin.ts index 6ecb452eb..517e71c8f 100644 --- a/packages/backend/src/models/entities/signin.ts +++ b/packages/backend/src/models/entities/signin.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class Signin { diff --git a/packages/backend/src/models/entities/sw-subscription.ts b/packages/backend/src/models/entities/sw-subscription.ts index 9e65fff53..f7823fbaa 100644 --- a/packages/backend/src/models/entities/sw-subscription.ts +++ b/packages/backend/src/models/entities/sw-subscription.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class SwSubscription { diff --git a/packages/backend/src/models/entities/used-username.ts b/packages/backend/src/models/entities/used-username.ts index b7937f648..d00a25991 100644 --- a/packages/backend/src/models/entities/used-username.ts +++ b/packages/backend/src/models/entities/used-username.ts @@ -1,4 +1,4 @@ -import { Column, Entity, PrimaryColumn } from "typeorm"; +import { PrimaryColumn, Entity, Column } from "typeorm"; @Entity() export class UsedUsername { diff --git a/packages/backend/src/models/entities/user-group-invitation.ts b/packages/backend/src/models/entities/user-group-invitation.ts index 7af3ad614..fa2655ab6 100644 --- a/packages/backend/src/models/entities/user-group-invitation.ts +++ b/packages/backend/src/models/entities/user-group-invitation.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { UserGroup } from "./user-group.js"; import { User } from "./user.js"; +import { UserGroup } from "./user-group.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "userGroupId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-group-joining.ts b/packages/backend/src/models/entities/user-group-joining.ts index a60d6f039..78f820d0e 100644 --- a/packages/backend/src/models/entities/user-group-joining.ts +++ b/packages/backend/src/models/entities/user-group-joining.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { UserGroup } from "./user-group.js"; import { User } from "./user.js"; +import { UserGroup } from "./user-group.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "userGroupId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-group.ts b/packages/backend/src/models/entities/user-group.ts index 9e374858c..23876ec8b 100644 --- a/packages/backend/src/models/entities/user-group.ts +++ b/packages/backend/src/models/entities/user-group.ts @@ -1,13 +1,13 @@ import { - Column, Entity, Index, JoinColumn, - ManyToOne, + Column, PrimaryColumn, + ManyToOne, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class UserGroup { diff --git a/packages/backend/src/models/entities/user-ip.ts b/packages/backend/src/models/entities/user-ip.ts index b7226c52e..adef48e4c 100644 --- a/packages/backend/src/models/entities/user-ip.ts +++ b/packages/backend/src/models/entities/user-ip.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm"; +import { Entity, Index, Column, PrimaryGeneratedColumn } from "typeorm"; import { id } from "../id.js"; import type { User } from "./user.js"; diff --git a/packages/backend/src/models/entities/user-keypair.ts b/packages/backend/src/models/entities/user-keypair.ts index eb0e25932..f98384f53 100644 --- a/packages/backend/src/models/entities/user-keypair.ts +++ b/packages/backend/src/models/entities/user-keypair.ts @@ -1,6 +1,6 @@ -import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from "typeorm"; -import { id } from "../id.js"; +import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from "typeorm"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class UserKeypair { diff --git a/packages/backend/src/models/entities/user-list-joining.ts b/packages/backend/src/models/entities/user-list-joining.ts index a692deca7..4caa71ad3 100644 --- a/packages/backend/src/models/entities/user-list-joining.ts +++ b/packages/backend/src/models/entities/user-list-joining.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; -import { UserList } from "./user-list.js"; import { User } from "./user.js"; +import { UserList } from "./user-list.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "userListId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-list.ts b/packages/backend/src/models/entities/user-list.ts index add0454a4..3c95d44d6 100644 --- a/packages/backend/src/models/entities/user-list.ts +++ b/packages/backend/src/models/entities/user-list.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class UserList { diff --git a/packages/backend/src/models/entities/user-note-pining.ts b/packages/backend/src/models/entities/user-note-pining.ts index 2417f73a4..c30fe1e02 100644 --- a/packages/backend/src/models/entities/user-note-pining.ts +++ b/packages/backend/src/models/entities/user-note-pining.ts @@ -1,14 +1,14 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { Note } from "./note.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() @Index(["userId", "noteId"], { unique: true }) diff --git a/packages/backend/src/models/entities/user-pending.ts b/packages/backend/src/models/entities/user-pending.ts index f36decc17..18ae5ad99 100644 --- a/packages/backend/src/models/entities/user-pending.ts +++ b/packages/backend/src/models/entities/user-pending.ts @@ -1,4 +1,4 @@ -import { Column, Entity, Index, PrimaryColumn } from "typeorm"; +import { PrimaryColumn, Entity, Index, Column } from "typeorm"; import { id } from "../id.js"; @Entity() diff --git a/packages/backend/src/models/entities/user-profile.ts b/packages/backend/src/models/entities/user-profile.ts index 7f6bafedc..a4c2e0975 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -1,15 +1,15 @@ -import { ffVisibility, notificationTypes } from "@/types.js"; import { - Column, Entity, + Column, Index, - JoinColumn, OneToOne, + JoinColumn, PrimaryColumn, } from "typeorm"; +import { ffVisibility, notificationTypes } from "@/types.js"; import { id } from "../id.js"; -import { Page } from "./page.js"; import { User } from "./user.js"; +import { Page } from "./page.js"; // TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも // ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン diff --git a/packages/backend/src/models/entities/user-publickey.ts b/packages/backend/src/models/entities/user-publickey.ts index ea13e049f..e39b084d3 100644 --- a/packages/backend/src/models/entities/user-publickey.ts +++ b/packages/backend/src/models/entities/user-publickey.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, OneToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class UserPublickey { diff --git a/packages/backend/src/models/entities/user-security-key.ts b/packages/backend/src/models/entities/user-security-key.ts index ae721d7e3..511cab4ae 100644 --- a/packages/backend/src/models/entities/user-security-key.ts +++ b/packages/backend/src/models/entities/user-security-key.ts @@ -1,13 +1,13 @@ import { - Column, - Entity, - Index, - JoinColumn, - ManyToOne, PrimaryColumn, + Entity, + JoinColumn, + Column, + ManyToOne, + Index, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; @Entity() export class UserSecurityKey { diff --git a/packages/backend/src/models/entities/user.ts b/packages/backend/src/models/entities/user.ts index c5e633766..2d5e5dca3 100644 --- a/packages/backend/src/models/entities/user.ts +++ b/packages/backend/src/models/entities/user.ts @@ -1,9 +1,9 @@ import { - Column, Entity, + Column, Index, - JoinColumn, OneToOne, + JoinColumn, PrimaryColumn, } from "typeorm"; import { id } from "../id.js"; diff --git a/packages/backend/src/models/entities/webhook.ts b/packages/backend/src/models/entities/webhook.ts index fa8b61457..47fd79966 100644 --- a/packages/backend/src/models/entities/webhook.ts +++ b/packages/backend/src/models/entities/webhook.ts @@ -1,13 +1,13 @@ import { - Column, + PrimaryColumn, Entity, Index, JoinColumn, + Column, ManyToOne, - PrimaryColumn, } from "typeorm"; -import { id } from "../id.js"; import { User } from "./user.js"; +import { id } from "../id.js"; export const webhookEventTypes = [ "mention", diff --git a/packages/backend/src/models/index.ts b/packages/backend/src/models/index.ts index f842f024c..c1f37cf6d 100644 --- a/packages/backend/src/models/index.ts +++ b/packages/backend/src/models/index.ts @@ -1,70 +1,70 @@ import { db } from "@/db/postgre.js"; -import { AccessToken } from "./entities/access-token.js"; -import { Ad } from "./entities/ad.js"; -import { AnnouncementRead } from "./entities/announcement-read.js"; import { Announcement } from "./entities/announcement.js"; -import { AttestationChallenge } from "./entities/attestation-challenge.js"; -import { ChannelFollowing } from "./entities/channel-following.js"; -import { ChannelNotePining } from "./entities/channel-note-pining.js"; -import { ClipNote } from "./entities/clip-note.js"; +import { AnnouncementRead } from "./entities/announcement-read.js"; +import { Poll } from "./entities/poll.js"; +import { PollVote } from "./entities/poll-vote.js"; import { Meta } from "./entities/meta.js"; -import { MutedNote } from "./entities/muted-note.js"; -import { NoteEdit } from "./entities/note-edit.js"; +import { SwSubscription } from "./entities/sw-subscription.js"; +import { NoteWatching } from "./entities/note-watching.js"; import { NoteThreadMuting } from "./entities/note-thread-muting.js"; import { NoteUnread } from "./entities/note-unread.js"; -import { NoteWatching } from "./entities/note-watching.js"; -import { PasswordResetRequest } from "./entities/password-reset-request.js"; -import { PollVote } from "./entities/poll-vote.js"; -import { Poll } from "./entities/poll.js"; -import { PromoNote } from "./entities/promo-note.js"; -import { PromoRead } from "./entities/promo-read.js"; import { RegistrationTicket } from "./entities/registration-tickets.js"; -import { RegistryItem } from "./entities/registry-item.js"; -import { SwSubscription } from "./entities/sw-subscription.js"; -import { UsedUsername } from "./entities/used-username.js"; -import { UserGroupJoining } from "./entities/user-group-joining.js"; -import { UserIp } from "./entities/user-ip.js"; -import { UserKeypair } from "./entities/user-keypair.js"; -import { UserListJoining } from "./entities/user-list-joining.js"; -import { UserNotePining } from "./entities/user-note-pining.js"; -import { UserPending } from "./entities/user-pending.js"; -import { UserProfile } from "./entities/user-profile.js"; -import { UserPublickey } from "./entities/user-publickey.js"; -import { UserSecurityKey } from "./entities/user-security-key.js"; -import { Webhook } from "./entities/webhook.js"; -import { AbuseUserReportRepository } from "./repositories/abuse-user-report.js"; -import { AntennaRepository } from "./repositories/antenna.js"; -import { AppRepository } from "./repositories/app.js"; -import { AuthSessionRepository } from "./repositories/auth-session.js"; -import { BlockingRepository } from "./repositories/blocking.js"; -import { ChannelRepository } from "./repositories/channel.js"; -import { ClipRepository } from "./repositories/clip.js"; +import { UserRepository } from "./repositories/user.js"; +import { NoteRepository } from "./repositories/note.js"; import { DriveFileRepository } from "./repositories/drive-file.js"; import { DriveFolderRepository } from "./repositories/drive-folder.js"; -import { EmojiRepository } from "./repositories/emoji.js"; -import { FollowRequestRepository } from "./repositories/follow-request.js"; -import { FollowingRepository } from "./repositories/following.js"; -import { GalleryLikeRepository } from "./repositories/gallery-like.js"; -import { GalleryPostRepository } from "./repositories/gallery-post.js"; -import { HashtagRepository } from "./repositories/hashtag.js"; -import { InstanceRepository } from "./repositories/instance.js"; -import { MessagingMessageRepository } from "./repositories/messaging-message.js"; -import { ModerationLogRepository } from "./repositories/moderation-logs.js"; -import { MutingRepository } from "./repositories/muting.js"; -import { NoteFavoriteRepository } from "./repositories/note-favorite.js"; -import { NoteReactionRepository } from "./repositories/note-reaction.js"; -import { NoteRepository } from "./repositories/note.js"; -import { NotificationRepository } from "./repositories/notification.js"; -import { PageLikeRepository } from "./repositories/page-like.js"; -import { PageRepository } from "./repositories/page.js"; -import { RelayRepository } from "./repositories/relay.js"; -import { RenoteMutingRepository } from "./repositories/renote-muting.js"; +import { AccessToken } from "./entities/access-token.js"; +import { UserNotePining } from "./entities/user-note-pining.js"; import { SigninRepository } from "./repositories/signin.js"; -import { UserGroupInvitationRepository } from "./repositories/user-group-invitation.js"; -import { UserGroupRepository } from "./repositories/user-group.js"; +import { MessagingMessageRepository } from "./repositories/messaging-message.js"; import { UserListRepository } from "./repositories/user-list.js"; -import { UserRepository } from "./repositories/user.js"; +import { UserListJoining } from "./entities/user-list-joining.js"; +import { UserGroupRepository } from "./repositories/user-group.js"; +import { UserGroupJoining } from "./entities/user-group-joining.js"; +import { UserGroupInvitationRepository } from "./repositories/user-group-invitation.js"; +import { FollowRequestRepository } from "./repositories/follow-request.js"; +import { MutingRepository } from "./repositories/muting.js"; +import { RenoteMutingRepository } from "./repositories/renote-muting.js"; +import { BlockingRepository } from "./repositories/blocking.js"; +import { NoteReactionRepository } from "./repositories/note-reaction.js"; +import { NotificationRepository } from "./repositories/notification.js"; +import { NoteFavoriteRepository } from "./repositories/note-favorite.js"; +import { UserPublickey } from "./entities/user-publickey.js"; +import { UserKeypair } from "./entities/user-keypair.js"; +import { AppRepository } from "./repositories/app.js"; +import { FollowingRepository } from "./repositories/following.js"; +import { AbuseUserReportRepository } from "./repositories/abuse-user-report.js"; +import { AuthSessionRepository } from "./repositories/auth-session.js"; +import { UserProfile } from "./entities/user-profile.js"; +import { AttestationChallenge } from "./entities/attestation-challenge.js"; +import { UserSecurityKey } from "./entities/user-security-key.js"; +import { HashtagRepository } from "./repositories/hashtag.js"; +import { PageRepository } from "./repositories/page.js"; +import { PageLikeRepository } from "./repositories/page-like.js"; +import { GalleryPostRepository } from "./repositories/gallery-post.js"; +import { GalleryLikeRepository } from "./repositories/gallery-like.js"; +import { ModerationLogRepository } from "./repositories/moderation-logs.js"; +import { UsedUsername } from "./entities/used-username.js"; +import { ClipRepository } from "./repositories/clip.js"; +import { ClipNote } from "./entities/clip-note.js"; +import { AntennaRepository } from "./repositories/antenna.js"; +import { PromoNote } from "./entities/promo-note.js"; +import { PromoRead } from "./entities/promo-read.js"; +import { EmojiRepository } from "./repositories/emoji.js"; +import { RelayRepository } from "./repositories/relay.js"; +import { ChannelRepository } from "./repositories/channel.js"; +import { MutedNote } from "./entities/muted-note.js"; +import { ChannelFollowing } from "./entities/channel-following.js"; +import { ChannelNotePining } from "./entities/channel-note-pining.js"; +import { RegistryItem } from "./entities/registry-item.js"; +import { Ad } from "./entities/ad.js"; +import { PasswordResetRequest } from "./entities/password-reset-request.js"; +import { UserPending } from "./entities/user-pending.js"; +import { InstanceRepository } from "./repositories/instance.js"; +import { Webhook } from "./entities/webhook.js"; +import { UserIp } from "./entities/user-ip.js"; +import { NoteEdit } from "./entities/note-edit.js"; export const Announcements = db.getRepository(Announcement); export const AnnouncementReads = db.getRepository(AnnouncementRead); diff --git a/packages/backend/src/models/repositories/abuse-user-report.ts b/packages/backend/src/models/repositories/abuse-user-report.ts index 071c399ac..07afef48c 100644 --- a/packages/backend/src/models/repositories/abuse-user-report.ts +++ b/packages/backend/src/models/repositories/abuse-user-report.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; +import { Users } from "../index.js"; import { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { Users } from "../index.js"; export const AbuseUserReportRepository = db .getRepository(AbuseUserReport) diff --git a/packages/backend/src/models/repositories/app.ts b/packages/backend/src/models/repositories/app.ts index abad561f6..af3dfb81a 100644 --- a/packages/backend/src/models/repositories/app.ts +++ b/packages/backend/src/models/repositories/app.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { App } from "@/models/entities/app.js"; -import type { User } from "../entities/user.js"; import { AccessTokens } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; +import type { User } from "../entities/user.js"; export const AppRepository = db.getRepository(App).extend({ async pack( diff --git a/packages/backend/src/models/repositories/auth-session.ts b/packages/backend/src/models/repositories/auth-session.ts index c129f734f..d3e1d45d6 100644 --- a/packages/backend/src/models/repositories/auth-session.ts +++ b/packages/backend/src/models/repositories/auth-session.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import { AuthSession } from "@/models/entities/auth-session.js"; -import type { User } from "@/models/entities/user.js"; -import { awaitAll } from "@/prelude/await-all.js"; import { Apps } from "../index.js"; +import { AuthSession } from "@/models/entities/auth-session.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import type { User } from "@/models/entities/user.js"; export const AuthSessionRepository = db.getRepository(AuthSession).extend({ async pack( diff --git a/packages/backend/src/models/repositories/blocking.ts b/packages/backend/src/models/repositories/blocking.ts index 280631e70..3dfa74e76 100644 --- a/packages/backend/src/models/repositories/blocking.ts +++ b/packages/backend/src/models/repositories/blocking.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; -import { Blocking } from "@/models/entities/blocking.js"; -import type { User } from "@/models/entities/user.js"; -import { awaitAll } from "@/prelude/await-all.js"; import { Users } from "../index.js"; +import { Blocking } from "@/models/entities/blocking.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import type { Packed } from "@/misc/schema.js"; +import type { User } from "@/models/entities/user.js"; export const BlockingRepository = db.getRepository(Blocking).extend({ async pack( diff --git a/packages/backend/src/models/repositories/channel.ts b/packages/backend/src/models/repositories/channel.ts index 9012c5e65..7800a6594 100644 --- a/packages/backend/src/models/repositories/channel.ts +++ b/packages/backend/src/models/repositories/channel.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { Channel } from "@/models/entities/channel.js"; +import type { Packed } from "@/misc/schema.js"; +import { DriveFiles, ChannelFollowings, NoteUnreads } from "../index.js"; import type { User } from "@/models/entities/user.js"; -import { ChannelFollowings, DriveFiles, NoteUnreads } from "../index.js"; export const ChannelRepository = db.getRepository(Channel).extend({ async pack( diff --git a/packages/backend/src/models/repositories/clip.ts b/packages/backend/src/models/repositories/clip.ts index 87c796aed..0c21691bf 100644 --- a/packages/backend/src/models/repositories/clip.ts +++ b/packages/backend/src/models/repositories/clip.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { Clip } from "@/models/entities/clip.js"; -import { awaitAll } from "@/prelude/await-all.js"; +import type { Packed } from "@/misc/schema.js"; import { Users } from "../index.js"; +import { awaitAll } from "@/prelude/await-all.js"; export const ClipRepository = db.getRepository(Clip).extend({ async pack(src: Clip["id"] | Clip): Promise> { diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts index 2de8d7fa8..1b4f477d3 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -1,13 +1,13 @@ -import config from "@/config/index.js"; import { db } from "@/db/postgre.js"; -import { deepClone } from "@/misc/clone.js"; -import { toPuny } from "@/misc/convert-host.js"; -import type { Packed } from "@/misc/schema.js"; import { DriveFile } from "@/models/entities/drive-file.js"; import type { User } from "@/models/entities/user.js"; +import { toPuny } from "@/misc/convert-host.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { appendQuery, query } from "@/prelude/url.js"; -import { DriveFolders, Users } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; +import config from "@/config/index.js"; +import { query, appendQuery } from "@/prelude/url.js"; +import { Users, DriveFolders } from "../index.js"; +import { deepClone } from "@/misc/clone.js"; type PackOptions = { detail?: boolean; diff --git a/packages/backend/src/models/repositories/drive-folder.ts b/packages/backend/src/models/repositories/drive-folder.ts index 7c73d2617..9823561d0 100644 --- a/packages/backend/src/models/repositories/drive-folder.ts +++ b/packages/backend/src/models/repositories/drive-folder.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; +import { DriveFolders, DriveFiles } from "../index.js"; import { DriveFolder } from "@/models/entities/drive-folder.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { DriveFiles, DriveFolders } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; export const DriveFolderRepository = db.getRepository(DriveFolder).extend({ async pack( diff --git a/packages/backend/src/models/repositories/emoji.ts b/packages/backend/src/models/repositories/emoji.ts index 0589097a6..e9a940f95 100644 --- a/packages/backend/src/models/repositories/emoji.ts +++ b/packages/backend/src/models/repositories/emoji.ts @@ -1,6 +1,6 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { Emoji } from "@/models/entities/emoji.js"; +import type { Packed } from "@/misc/schema.js"; export const EmojiRepository = db.getRepository(Emoji).extend({ async pack(src: Emoji["id"] | Emoji): Promise> { diff --git a/packages/backend/src/models/repositories/follow-request.ts b/packages/backend/src/models/repositories/follow-request.ts index 17100c157..cef6ea722 100644 --- a/packages/backend/src/models/repositories/follow-request.ts +++ b/packages/backend/src/models/repositories/follow-request.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; import { FollowRequest } from "@/models/entities/follow-request.js"; -import type { User } from "@/models/entities/user.js"; import { Users } from "../index.js"; +import type { User } from "@/models/entities/user.js"; export const FollowRequestRepository = db.getRepository(FollowRequest).extend({ async pack( diff --git a/packages/backend/src/models/repositories/following.ts b/packages/backend/src/models/repositories/following.ts index 12e5380ce..b102365e0 100644 --- a/packages/backend/src/models/repositories/following.ts +++ b/packages/backend/src/models/repositories/following.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; -import { Following } from "@/models/entities/following.js"; -import type { User } from "@/models/entities/user.js"; -import { awaitAll } from "@/prelude/await-all.js"; import { Users } from "../index.js"; +import { Following } from "@/models/entities/following.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import type { Packed } from "@/misc/schema.js"; +import type { User } from "@/models/entities/user.js"; type LocalFollowerFollowing = Following & { followerHost: null; diff --git a/packages/backend/src/models/repositories/gallery-post.ts b/packages/backend/src/models/repositories/gallery-post.ts index 3d91d47ce..b4206b0bf 100644 --- a/packages/backend/src/models/repositories/gallery-post.ts +++ b/packages/backend/src/models/repositories/gallery-post.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { GalleryPost } from "@/models/entities/gallery-post.js"; -import type { User } from "@/models/entities/user.js"; +import type { Packed } from "@/misc/schema.js"; +import { Users, DriveFiles, GalleryLikes } from "../index.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { DriveFiles, GalleryLikes, Users } from "../index.js"; +import type { User } from "@/models/entities/user.js"; export const GalleryPostRepository = db.getRepository(GalleryPost).extend({ async pack( diff --git a/packages/backend/src/models/repositories/hashtag.ts b/packages/backend/src/models/repositories/hashtag.ts index e3b90c153..7bd76c1c7 100644 --- a/packages/backend/src/models/repositories/hashtag.ts +++ b/packages/backend/src/models/repositories/hashtag.ts @@ -1,6 +1,6 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { Hashtag } from "@/models/entities/hashtag.js"; +import type { Packed } from "@/misc/schema.js"; export const HashtagRepository = db.getRepository(Hashtag).extend({ async pack(src: Hashtag): Promise> { diff --git a/packages/backend/src/models/repositories/instance.ts b/packages/backend/src/models/repositories/instance.ts index f2cce2ac5..667ec948d 100644 --- a/packages/backend/src/models/repositories/instance.ts +++ b/packages/backend/src/models/repositories/instance.ts @@ -1,10 +1,10 @@ import { db } from "@/db/postgre.js"; +import { Instance } from "@/models/entities/instance.js"; import type { Packed } from "@/misc/schema.js"; import { shouldBlockInstance, shouldSilenceInstance, } from "@/misc/should-block-instance.js"; -import { Instance } from "@/models/entities/instance.js"; export const InstanceRepository = db.getRepository(Instance).extend({ async pack(instance: Instance): Promise> { diff --git a/packages/backend/src/models/repositories/messaging-message.ts b/packages/backend/src/models/repositories/messaging-message.ts index 85d2053a6..6c0987bf0 100644 --- a/packages/backend/src/models/repositories/messaging-message.ts +++ b/packages/backend/src/models/repositories/messaging-message.ts @@ -1,8 +1,8 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { MessagingMessage } from "@/models/entities/messaging-message.js"; +import { Users, DriveFiles, UserGroups } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; import type { User } from "@/models/entities/user.js"; -import { DriveFiles, UserGroups, Users } from "../index.js"; export const MessagingMessageRepository = db .getRepository(MessagingMessage) diff --git a/packages/backend/src/models/repositories/moderation-logs.ts b/packages/backend/src/models/repositories/moderation-logs.ts index 03f91c6f8..3858b9509 100644 --- a/packages/backend/src/models/repositories/moderation-logs.ts +++ b/packages/backend/src/models/repositories/moderation-logs.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; +import { Users } from "../index.js"; import { ModerationLog } from "@/models/entities/moderation-log.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { Users } from "../index.js"; export const ModerationLogRepository = db.getRepository(ModerationLog).extend({ async pack(src: ModerationLog["id"] | ModerationLog) { diff --git a/packages/backend/src/models/repositories/muting.ts b/packages/backend/src/models/repositories/muting.ts index 29686c337..4d0201d5a 100644 --- a/packages/backend/src/models/repositories/muting.ts +++ b/packages/backend/src/models/repositories/muting.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; -import { Muting } from "@/models/entities/muting.js"; -import type { User } from "@/models/entities/user.js"; -import { awaitAll } from "@/prelude/await-all.js"; import { Users } from "../index.js"; +import { Muting } from "@/models/entities/muting.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import type { Packed } from "@/misc/schema.js"; +import type { User } from "@/models/entities/user.js"; export const MutingRepository = db.getRepository(Muting).extend({ async pack( diff --git a/packages/backend/src/models/repositories/note-favorite.ts b/packages/backend/src/models/repositories/note-favorite.ts index a472fb936..ba43e3c3b 100644 --- a/packages/backend/src/models/repositories/note-favorite.ts +++ b/packages/backend/src/models/repositories/note-favorite.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; import { NoteFavorite } from "@/models/entities/note-favorite.js"; -import type { User } from "@/models/entities/user.js"; import { Notes } from "../index.js"; +import type { User } from "@/models/entities/user.js"; export const NoteFavoriteRepository = db.getRepository(NoteFavorite).extend({ async pack( diff --git a/packages/backend/src/models/repositories/note-reaction.ts b/packages/backend/src/models/repositories/note-reaction.ts index 4c182b243..4075c7d43 100644 --- a/packages/backend/src/models/repositories/note-reaction.ts +++ b/packages/backend/src/models/repositories/note-reaction.ts @@ -1,9 +1,9 @@ import { db } from "@/db/postgre.js"; -import { decodeReaction } from "@/misc/reaction-lib.js"; -import type { Packed } from "@/misc/schema.js"; import { NoteReaction } from "@/models/entities/note-reaction.js"; -import type { User } from "@/models/entities/user.js"; import { Notes, Users } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; +import { decodeReaction } from "@/misc/reaction-lib.js"; +import type { User } from "@/models/entities/user.js"; export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ async pack( diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index e946c30e0..60e5a8d5c 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -1,28 +1,28 @@ -import { db } from "@/db/postgre.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { In } from "typeorm"; +import * as mfm from "mfm-js"; +import { Note } from "@/models/entities/note.js"; +import type { User } from "@/models/entities/user.js"; +import { + Users, + PollVotes, + DriveFiles, + NoteReactions, + Followings, + Polls, + Channels, +} from "../index.js"; +import type { Packed } from "@/misc/schema.js"; import { nyaize } from "@/misc/nyaize.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import { convertReactions, decodeReaction } from "@/misc/reaction-lib.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; import { aggregateNoteEmojis, populateEmojis, prefetchEmojis, } from "@/misc/populate-emojis.js"; -import { convertReactions, decodeReaction } from "@/misc/reaction-lib.js"; -import type { Packed } from "@/misc/schema.js"; -import type { NoteReaction } from "@/models/entities/note-reaction.js"; -import { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; -import { awaitAll } from "@/prelude/await-all.js"; -import * as mfm from "mfm-js"; -import { In } from "typeorm"; -import { - Channels, - DriveFiles, - Followings, - NoteReactions, - PollVotes, - Polls, - Users, -} from "../index.js"; +import { db } from "@/db/postgre.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; export async function populatePoll(note: Note, meId: User["id"] | null) { const poll = await Polls.findOneByOrFail({ noteId: note.id }); diff --git a/packages/backend/src/models/repositories/notification.ts b/packages/backend/src/models/repositories/notification.ts index 9dd493421..90dfbd739 100644 --- a/packages/backend/src/models/repositories/notification.ts +++ b/packages/backend/src/models/repositories/notification.ts @@ -1,18 +1,18 @@ -import { db } from "@/db/postgre.js"; -import { aggregateNoteEmojis, prefetchEmojis } from "@/misc/populate-emojis.js"; -import type { Packed } from "@/misc/schema.js"; -import type { NoteReaction } from "@/models/entities/note-reaction.js"; -import type { Note } from "@/models/entities/note.js"; -import { Notification } from "@/models/entities/notification.js"; -import type { User } from "@/models/entities/user.js"; -import { awaitAll } from "@/prelude/await-all.js"; import { In } from "typeorm"; +import { Notification } from "@/models/entities/notification.js"; +import { awaitAll } from "@/prelude/await-all.js"; +import type { Packed } from "@/misc/schema.js"; +import type { Note } from "@/models/entities/note.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; +import type { User } from "@/models/entities/user.js"; +import { aggregateNoteEmojis, prefetchEmojis } from "@/misc/populate-emojis.js"; +import { db } from "@/db/postgre.js"; import { - AccessTokens, - NoteReactions, + Users, Notes, UserGroupInvitations, - Users, + AccessTokens, + NoteReactions, } from "../index.js"; export const NotificationRepository = db.getRepository(Notification).extend({ diff --git a/packages/backend/src/models/repositories/page.ts b/packages/backend/src/models/repositories/page.ts index 0f335164b..d9241c362 100644 --- a/packages/backend/src/models/repositories/page.ts +++ b/packages/backend/src/models/repositories/page.ts @@ -1,10 +1,10 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; import { Page } from "@/models/entities/page.js"; -import type { User } from "@/models/entities/user.js"; +import type { Packed } from "@/misc/schema.js"; import { awaitAll } from "@/prelude/await-all.js"; -import { DriveFiles, PageLikes, Users } from "../index.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { User } from "@/models/entities/user.js"; +import { Users, DriveFiles, PageLikes } from "../index.js"; export const PageRepository = db.getRepository(Page).extend({ async pack( diff --git a/packages/backend/src/models/repositories/user-group.ts b/packages/backend/src/models/repositories/user-group.ts index 6a70f83d9..daec94490 100644 --- a/packages/backend/src/models/repositories/user-group.ts +++ b/packages/backend/src/models/repositories/user-group.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { UserGroup } from "@/models/entities/user-group.js"; import { UserGroupJoinings } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; export const UserGroupRepository = db.getRepository(UserGroup).extend({ async pack(src: UserGroup["id"] | UserGroup): Promise> { diff --git a/packages/backend/src/models/repositories/user-list.ts b/packages/backend/src/models/repositories/user-list.ts index 33133a05d..e3abeac3f 100644 --- a/packages/backend/src/models/repositories/user-list.ts +++ b/packages/backend/src/models/repositories/user-list.ts @@ -1,7 +1,7 @@ import { db } from "@/db/postgre.js"; -import type { Packed } from "@/misc/schema.js"; import { UserList } from "@/models/entities/user-list.js"; import { UserListJoinings } from "../index.js"; +import type { Packed } from "@/misc/schema.js"; export const UserListRepository = db.getRepository(UserList).extend({ async pack(src: UserList["id"] | UserList): Promise> { diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 506179776..be1dbc453 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -1,41 +1,41 @@ -import config from "@/config/index.js"; -import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from "@/const.js"; -import { db } from "@/db/postgre.js"; -import { Cache } from "@/misc/cache.js"; -import { populateEmojis } from "@/misc/populate-emojis.js"; -import type { Packed } from "@/misc/schema.js"; +import { In, Not } from "typeorm"; +import Ajv from "ajv"; import type { ILocalUser, IRemoteUser } from "@/models/entities/user.js"; import { User } from "@/models/entities/user.js"; +import config from "@/config/index.js"; +import type { Packed } from "@/misc/schema.js"; import type { Promiseable } from "@/prelude/await-all.js"; import { awaitAll } from "@/prelude/await-all.js"; +import { populateEmojis } from "@/misc/populate-emojis.js"; +import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from "@/const.js"; +import { Cache } from "@/misc/cache.js"; +import { db } from "@/db/postgre.js"; +import { isActor, getApId } from "@/remote/activitypub/type.js"; import DbResolver from "@/remote/activitypub/db-resolver.js"; -import { createPerson } from "@/remote/activitypub/models/person.js"; import Resolver from "@/remote/activitypub/resolver.js"; -import { getApId, isActor } from "@/remote/activitypub/type.js"; -import Ajv from "ajv"; -import { In, Not } from "typeorm"; -import type { Instance } from "../entities/instance.js"; +import { createPerson } from "@/remote/activitypub/models/person.js"; import { AnnouncementReads, Announcements, Blockings, ChannelFollowings, DriveFiles, - FollowRequests, Followings, + FollowRequests, Instances, MessagingMessages, Mutings, - NoteUnreads, + RenoteMutings, Notes, + NoteUnreads, Notifications, Pages, - RenoteMutings, UserGroupJoinings, UserNotePinings, UserProfiles, UserSecurityKeys, } from "../index.js"; +import type { Instance } from "../entities/instance.js"; const userInstanceCache = new Cache( "userInstance", diff --git a/packages/backend/src/queue/index.ts b/packages/backend/src/queue/index.ts index 051dd9681..0500737a4 100644 --- a/packages/backend/src/queue/index.ts +++ b/packages/backend/src/queue/index.ts @@ -3,32 +3,32 @@ import { v4 as uuid } from "uuid"; import config from "@/config/index.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Webhook, webhookEventTypes } from "@/models/entities/webhook.js"; import type { IActivity } from "@/remote/activitypub/type.js"; +import type { Webhook, webhookEventTypes } from "@/models/entities/webhook.js"; import { envOption } from "../env.js"; -import { Note } from "@/models/entities/note.js"; -import { getJobInfo } from "./get-job-info.js"; -import { queueLogger } from "./logger.js"; -import processBackground from "./processors/background/index.js"; -import processDb from "./processors/db/index.js"; import processDeliver from "./processors/deliver.js"; -import { endedPollNotification } from "./processors/ended-poll-notification.js"; import processInbox from "./processors/inbox.js"; +import processDb from "./processors/db/index.js"; import processObjectStorage from "./processors/object-storage/index.js"; import processSystemQueue from "./processors/system/index.js"; import processWebhookDeliver from "./processors/webhook-deliver.js"; +import processBackground from "./processors/background/index.js"; +import { endedPollNotification } from "./processors/ended-poll-notification.js"; +import { queueLogger } from "./logger.js"; +import { getJobInfo } from "./get-job-info.js"; import { - backgroundQueue, + systemQueue, dbQueue, deliverQueue, - endedPollNotificationQueue, inboxQueue, objectStorageQueue, - systemQueue, + endedPollNotificationQueue, webhookDeliverQueue, + backgroundQueue, } from "./queues.js"; import type { ThinUser } from "./types.js"; +import { Note } from "@/models/entities/note.js"; function renderError(e: Error): any { return { diff --git a/packages/backend/src/queue/initialize.ts b/packages/backend/src/queue/initialize.ts index a85ab3963..16e623d13 100644 --- a/packages/backend/src/queue/initialize.ts +++ b/packages/backend/src/queue/initialize.ts @@ -1,5 +1,5 @@ -import config from "@/config/index.js"; import Bull from "bull"; +import config from "@/config/index.js"; export function initialize(name: string, limitPerSec = -1) { return new Bull(name, { diff --git a/packages/backend/src/queue/processors/background/index-all-notes.ts b/packages/backend/src/queue/processors/background/index-all-notes.ts index 07a7b756d..262724cbd 100644 --- a/packages/backend/src/queue/processors/background/index-all-notes.ts +++ b/packages/backend/src/queue/processors/background/index-all-notes.ts @@ -1,12 +1,12 @@ import type Bull from "bull"; import type { DoneCallback } from "bull"; -import meilisearch from "@/db/meilisearch.js"; -import { Note } from "@/models/entities/note.js"; -import { Notes } from "@/models/index.js"; -import { index } from "@/services/note/create.js"; -import { MoreThan } from "typeorm"; import { queueLogger } from "../../logger.js"; +import { Notes } from "@/models/index.js"; +import { MoreThan } from "typeorm"; +import { index } from "@/services/note/create.js"; +import { Note } from "@/models/entities/note.js"; +import meilisearch from "@/db/meilisearch.js"; const logger = queueLogger.createSubLogger("index-all-notes"); diff --git a/packages/backend/src/queue/processors/db/delete-account.ts b/packages/backend/src/queue/processors/db/delete-account.ts index 336db4332..adb93484b 100644 --- a/packages/backend/src/queue/processors/db/delete-account.ts +++ b/packages/backend/src/queue/processors/db/delete-account.ts @@ -1,13 +1,13 @@ -import meilisearch from "@/db/meilisearch.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Note } from "@/models/entities/note.js"; +import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; import { DriveFiles, Notes, UserProfiles, Users } from "@/models/index.js"; import type { DbUserDeleteJobData } from "@/queue/types.js"; +import type { Note } from "@/models/entities/note.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { MoreThan } from "typeorm"; import { deleteFileSync } from "@/services/drive/delete-file.js"; import { sendEmail } from "@/services/send-email.js"; -import type Bull from "bull"; -import { MoreThan } from "typeorm"; -import { queueLogger } from "../../logger.js"; +import meilisearch from "@/db/meilisearch.js"; const logger = queueLogger.createSubLogger("delete-account"); diff --git a/packages/backend/src/queue/processors/db/delete-drive-files.ts b/packages/backend/src/queue/processors/db/delete-drive-files.ts index 8bff6382f..28e477132 100644 --- a/packages/backend/src/queue/processors/db/delete-drive-files.ts +++ b/packages/backend/src/queue/processors/db/delete-drive-files.ts @@ -1,10 +1,10 @@ import type Bull from "bull"; -import { DriveFiles, Users } from "@/models/index.js"; -import type { DbUserJobData } from "@/queue/types.js"; -import { deleteFileSync } from "@/services/drive/delete-file.js"; -import { MoreThan } from "typeorm"; import { queueLogger } from "../../logger.js"; +import { deleteFileSync } from "@/services/drive/delete-file.js"; +import { Users, DriveFiles } from "@/models/index.js"; +import { MoreThan } from "typeorm"; +import type { DbUserJobData } from "@/queue/types.js"; const logger = queueLogger.createSubLogger("delete-drive-files"); diff --git a/packages/backend/src/queue/processors/db/export-blocking.ts b/packages/backend/src/queue/processors/db/export-blocking.ts index 75ba44d36..90da76b87 100644 --- a/packages/backend/src/queue/processors/db/export-blocking.ts +++ b/packages/backend/src/queue/processors/db/export-blocking.ts @@ -1,14 +1,14 @@ -import * as fs from "node:fs"; import type Bull from "bull"; +import * as fs from "node:fs"; -import { getFullApAccount } from "@/misc/convert-host.js"; -import { createTemp } from "@/misc/create-temp.js"; -import { Blockings, Users } from "@/models/index.js"; -import type { DbUserJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; +import { getFullApAccount } from "@/misc/convert-host.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { Users, Blockings } from "@/models/index.js"; import { MoreThan } from "typeorm"; -import { queueLogger } from "../../logger.js"; +import type { DbUserJobData } from "@/queue/types.js"; const logger = queueLogger.createSubLogger("export-blocking"); diff --git a/packages/backend/src/queue/processors/db/export-custom-emojis.ts b/packages/backend/src/queue/processors/db/export-custom-emojis.ts index a664bc59b..86de43af4 100644 --- a/packages/backend/src/queue/processors/db/export-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/export-custom-emojis.ts @@ -1,16 +1,16 @@ -import * as fs from "node:fs"; import type Bull from "bull"; +import * as fs from "node:fs"; -import config from "@/config/index.js"; +import mime from "mime-types"; +import archiver from "archiver"; +import { queueLogger } from "../../logger.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { format as dateFormat } from "date-fns"; +import { Users, Emojis } from "@/models/index.js"; import { createTemp, createTempDir } from "@/misc/create-temp.js"; import { downloadUrl } from "@/misc/download-url.js"; -import { Emojis, Users } from "@/models/index.js"; -import { addFile } from "@/services/drive/add-file.js"; -import archiver from "archiver"; -import { format as dateFormat } from "date-fns"; -import mime from "mime-types"; +import config from "@/config/index.js"; import { IsNull } from "typeorm"; -import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("export-custom-emojis"); diff --git a/packages/backend/src/queue/processors/db/export-following.ts b/packages/backend/src/queue/processors/db/export-following.ts index 0c8e432a6..80e8e6b92 100644 --- a/packages/backend/src/queue/processors/db/export-following.ts +++ b/packages/backend/src/queue/processors/db/export-following.ts @@ -1,15 +1,15 @@ -import * as fs from "node:fs"; import type Bull from "bull"; +import * as fs from "node:fs"; -import { getFullApAccount } from "@/misc/convert-host.js"; -import { createTemp } from "@/misc/create-temp.js"; -import type { Following } from "@/models/entities/following.js"; -import { Followings, Mutings, Users } from "@/models/index.js"; -import type { DbUserJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; +import { getFullApAccount } from "@/misc/convert-host.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { Users, Followings, Mutings } from "@/models/index.js"; import { In, MoreThan, Not } from "typeorm"; -import { queueLogger } from "../../logger.js"; +import type { DbUserJobData } from "@/queue/types.js"; +import type { Following } from "@/models/entities/following.js"; const logger = queueLogger.createSubLogger("export-following"); diff --git a/packages/backend/src/queue/processors/db/export-mute.ts b/packages/backend/src/queue/processors/db/export-mute.ts index a0be219ad..87b140b76 100644 --- a/packages/backend/src/queue/processors/db/export-mute.ts +++ b/packages/backend/src/queue/processors/db/export-mute.ts @@ -1,14 +1,14 @@ -import * as fs from "node:fs"; import type Bull from "bull"; +import * as fs from "node:fs"; -import { getFullApAccount } from "@/misc/convert-host.js"; -import { createTemp } from "@/misc/create-temp.js"; -import { Mutings, Users } from "@/models/index.js"; -import type { DbUserJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; +import { getFullApAccount } from "@/misc/convert-host.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { Users, Mutings } from "@/models/index.js"; import { IsNull, MoreThan } from "typeorm"; -import { queueLogger } from "../../logger.js"; +import type { DbUserJobData } from "@/queue/types.js"; const logger = queueLogger.createSubLogger("export-mute"); diff --git a/packages/backend/src/queue/processors/db/export-notes.ts b/packages/backend/src/queue/processors/db/export-notes.ts index fb2e282cb..bf53f8360 100644 --- a/packages/backend/src/queue/processors/db/export-notes.ts +++ b/packages/backend/src/queue/processors/db/export-notes.ts @@ -1,15 +1,15 @@ -import * as fs from "node:fs"; import type Bull from "bull"; +import * as fs from "node:fs"; -import { createTemp } from "@/misc/create-temp.js"; -import type { Note } from "@/models/entities/note.js"; -import type { Poll } from "@/models/entities/poll.js"; -import { DriveFiles, Notes, Polls, Users } from "@/models/index.js"; -import type { DbUserJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; +import { Users, Notes, Polls, DriveFiles } from "@/models/index.js"; import { MoreThan } from "typeorm"; -import { queueLogger } from "../../logger.js"; +import type { Note } from "@/models/entities/note.js"; +import type { Poll } from "@/models/entities/poll.js"; +import type { DbUserJobData } from "@/queue/types.js"; +import { createTemp } from "@/misc/create-temp.js"; const logger = queueLogger.createSubLogger("export-notes"); diff --git a/packages/backend/src/queue/processors/db/export-user-lists.ts b/packages/backend/src/queue/processors/db/export-user-lists.ts index 860170065..e0c9cd8f3 100644 --- a/packages/backend/src/queue/processors/db/export-user-lists.ts +++ b/packages/backend/src/queue/processors/db/export-user-lists.ts @@ -1,14 +1,14 @@ -import * as fs from "node:fs"; import type Bull from "bull"; +import * as fs from "node:fs"; -import { getFullApAccount } from "@/misc/convert-host.js"; -import { createTemp } from "@/misc/create-temp.js"; -import { UserListJoinings, UserLists, Users } from "@/models/index.js"; -import type { DbUserJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; import { addFile } from "@/services/drive/add-file.js"; import { format as dateFormat } from "date-fns"; +import { getFullApAccount } from "@/misc/convert-host.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { Users, UserLists, UserListJoinings } from "@/models/index.js"; import { In } from "typeorm"; -import { queueLogger } from "../../logger.js"; +import type { DbUserJobData } from "@/queue/types.js"; const logger = queueLogger.createSubLogger("export-user-lists"); diff --git a/packages/backend/src/queue/processors/db/import-blocking.ts b/packages/backend/src/queue/processors/db/import-blocking.ts index ff07ed121..290c9dbce 100644 --- a/packages/backend/src/queue/processors/db/import-blocking.ts +++ b/packages/backend/src/queue/processors/db/import-blocking.ts @@ -1,14 +1,14 @@ import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; import * as Acct from "@/misc/acct.js"; -import { isSelfHost, toPuny } from "@/misc/convert-host.js"; -import { downloadTextFile } from "@/misc/download-text-file.js"; -import { DriveFiles, Users } from "@/models/index.js"; -import type { DbUserImportJobData } from "@/queue/types.js"; import { resolveUser } from "@/remote/resolve-user.js"; +import { downloadTextFile } from "@/misc/download-text-file.js"; +import { isSelfHost, toPuny } from "@/misc/convert-host.js"; +import { Users, DriveFiles } from "@/models/index.js"; +import type { DbUserImportJobData } from "@/queue/types.js"; import block from "@/services/blocking/create.js"; import { IsNull } from "typeorm"; -import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-blocking"); diff --git a/packages/backend/src/queue/processors/db/import-custom-emojis.ts b/packages/backend/src/queue/processors/db/import-custom-emojis.ts index 4f46f49c9..9e8b3b174 100644 --- a/packages/backend/src/queue/processors/db/import-custom-emojis.ts +++ b/packages/backend/src/queue/processors/db/import-custom-emojis.ts @@ -1,17 +1,17 @@ +import type Bull from "bull"; import * as fs from "node:fs"; import AdmZip from "adm-zip"; -import type Bull from "bull"; -import * as path from "path"; -import { db } from "@/db/postgre.js"; +import { queueLogger } from "../../logger.js"; import { createTempDir } from "@/misc/create-temp.js"; import { downloadUrl } from "@/misc/download-url.js"; -import { genId } from "@/misc/gen-id.js"; import { DriveFiles, Emojis } from "@/models/index.js"; import type { DbUserImportJobData } from "@/queue/types.js"; import { addFile } from "@/services/drive/add-file.js"; +import { genId } from "@/misc/gen-id.js"; +import { db } from "@/db/postgre.js"; import probeImageSize from "probe-image-size"; -import { queueLogger } from "../../logger.js"; +import * as path from "path"; const logger = queueLogger.createSubLogger("import-custom-emojis"); @@ -92,7 +92,7 @@ export async function importCustomEmojis( } else { logger.info("starting emoji import without metadata"); // Since we lack metadata, we import into a randomized category name instead - const categoryName = genId(); + let categoryName = genId(); let containedEmojis = fs.readdirSync(outputPath); diff --git a/packages/backend/src/queue/processors/db/import-firefish-post.ts b/packages/backend/src/queue/processors/db/import-firefish-post.ts index 2c71c3d9f..4ec88d32c 100644 --- a/packages/backend/src/queue/processors/db/import-firefish-post.ts +++ b/packages/backend/src/queue/processors/db/import-firefish-post.ts @@ -1,15 +1,15 @@ -import { genId } from "@/misc/gen-id.js"; import * as Post from "@/misc/post.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Note } from "@/models/entities/note.js"; -import { Users } from "@/models/index.js"; -import { NoteEdits, Notes } from "@/models/index.js"; -import { createImportCkPostJob } from "@/queue/index.js"; -import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; import create from "@/services/note/create.js"; -import type Bull from "bull"; +import { Users } from "@/models/index.js"; +import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; import { queueLogger } from "../../logger.js"; +import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type Bull from "bull"; +import { createImportCkPostJob } from "@/queue/index.js"; +import { Notes, NoteEdits } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; +import { genId } from "@/misc/gen-id.js"; const logger = queueLogger.createSubLogger("import-firefish-post"); @@ -39,7 +39,7 @@ export async function importCkPost( */ const urls = (post.files || []) .map((x: any) => x.url) - .filter((x: string) => x.startsWith("http")); + .filter((x: String) => x.startsWith("http")); const files: DriveFile[] = []; for (const url of urls) { try { diff --git a/packages/backend/src/queue/processors/db/import-following.ts b/packages/backend/src/queue/processors/db/import-following.ts index 1789c8e9b..b1a7cd2c9 100644 --- a/packages/backend/src/queue/processors/db/import-following.ts +++ b/packages/backend/src/queue/processors/db/import-following.ts @@ -1,14 +1,14 @@ -import follow from "@/services/following/create.js"; import { IsNull } from "typeorm"; +import follow from "@/services/following/create.js"; import * as Acct from "@/misc/acct.js"; -import { isSelfHost, toPuny } from "@/misc/convert-host.js"; -import { downloadTextFile } from "@/misc/download-text-file.js"; -import { DriveFiles, Users } from "@/models/index.js"; -import type { DbUserImportJobData } from "@/queue/types.js"; import { resolveUser } from "@/remote/resolve-user.js"; -import type Bull from "bull"; +import { downloadTextFile } from "@/misc/download-text-file.js"; +import { isSelfHost, toPuny } from "@/misc/convert-host.js"; +import { Users, DriveFiles } from "@/models/index.js"; +import type { DbUserImportJobData } from "@/queue/types.js"; import { queueLogger } from "../../logger.js"; +import type Bull from "bull"; const logger = queueLogger.createSubLogger("import-following"); diff --git a/packages/backend/src/queue/processors/db/import-masto-post.ts b/packages/backend/src/queue/processors/db/import-masto-post.ts index f775e388f..c484ac0e1 100644 --- a/packages/backend/src/queue/processors/db/import-masto-post.ts +++ b/packages/backend/src/queue/processors/db/import-masto-post.ts @@ -1,15 +1,15 @@ -import { genId } from "@/misc/gen-id.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Note } from "@/models/entities/note.js"; +import create from "@/services/note/create.js"; import { Users } from "@/models/index.js"; -import { NoteEdits, Notes } from "@/models/index.js"; import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; +import type Bull from "bull"; import { htmlToMfm } from "@/remote/activitypub/misc/html-to-mfm.js"; import { resolveNote } from "@/remote/activitypub/models/note.js"; import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import create from "@/services/note/create.js"; -import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { Notes, NoteEdits } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; +import { genId } from "@/misc/gen-id.js"; const logger = queueLogger.createSubLogger("import-masto-post"); @@ -55,7 +55,7 @@ export async function importMastoPost( if (files.length == 0) { const urls = post.object.attachment .map((x: any) => x.url) - .filter((x: string) => x.startsWith("http")); + .filter((x: String) => x.startsWith("http")); files = []; for (const url of urls) { try { diff --git a/packages/backend/src/queue/processors/db/import-muting.ts b/packages/backend/src/queue/processors/db/import-muting.ts index 7ff4fad96..80e056739 100644 --- a/packages/backend/src/queue/processors/db/import-muting.ts +++ b/packages/backend/src/queue/processors/db/import-muting.ts @@ -1,15 +1,15 @@ import type Bull from "bull"; -import * as Acct from "@/misc/acct.js"; -import { isSelfHost, toPuny } from "@/misc/convert-host.js"; -import { downloadTextFile } from "@/misc/download-text-file.js"; -import { genId } from "@/misc/gen-id.js"; -import type { User } from "@/models/entities/user.js"; -import { DriveFiles, Mutings, Users } from "@/models/index.js"; -import type { DbUserImportJobData } from "@/queue/types.js"; -import { resolveUser } from "@/remote/resolve-user.js"; -import { IsNull } from "typeorm"; import { queueLogger } from "../../logger.js"; +import * as Acct from "@/misc/acct.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import { downloadTextFile } from "@/misc/download-text-file.js"; +import { isSelfHost, toPuny } from "@/misc/convert-host.js"; +import { Users, DriveFiles, Mutings } from "@/models/index.js"; +import type { DbUserImportJobData } from "@/queue/types.js"; +import type { User } from "@/models/entities/user.js"; +import { genId } from "@/misc/gen-id.js"; +import { IsNull } from "typeorm"; const logger = queueLogger.createSubLogger("import-muting"); diff --git a/packages/backend/src/queue/processors/db/import-posts.ts b/packages/backend/src/queue/processors/db/import-posts.ts index 273b61778..526489c63 100644 --- a/packages/backend/src/queue/processors/db/import-posts.ts +++ b/packages/backend/src/queue/processors/db/import-posts.ts @@ -1,13 +1,13 @@ import { downloadTextFile } from "@/misc/download-text-file.js"; import { processMastoNotes } from "@/misc/process-masto-notes.js"; -import { DriveFiles, Users } from "@/models/index.js"; +import { Users, DriveFiles } from "@/models/index.js"; +import type { DbUserImportPostsJobData } from "@/queue/types.js"; +import { queueLogger } from "../../logger.js"; +import type Bull from "bull"; import { createImportCkPostJob, createImportMastoPostJob, } from "@/queue/index.js"; -import type { DbUserImportPostsJobData } from "@/queue/types.js"; -import type Bull from "bull"; -import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-posts"); diff --git a/packages/backend/src/queue/processors/db/import-user-lists.ts b/packages/backend/src/queue/processors/db/import-user-lists.ts index 4ba5d8a63..0c23f0699 100644 --- a/packages/backend/src/queue/processors/db/import-user-lists.ts +++ b/packages/backend/src/queue/processors/db/import-user-lists.ts @@ -1,20 +1,20 @@ import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; import * as Acct from "@/misc/acct.js"; -import { isSelfHost, toPuny } from "@/misc/convert-host.js"; -import { downloadTextFile } from "@/misc/download-text-file.js"; -import { genId } from "@/misc/gen-id.js"; -import { - DriveFiles, - UserListJoinings, - UserLists, - Users, -} from "@/models/index.js"; -import type { DbUserImportJobData } from "@/queue/types.js"; import { resolveUser } from "@/remote/resolve-user.js"; import { pushUserToUserList } from "@/services/user-list/push.js"; +import { downloadTextFile } from "@/misc/download-text-file.js"; +import { isSelfHost, toPuny } from "@/misc/convert-host.js"; +import { + DriveFiles, + Users, + UserLists, + UserListJoinings, +} from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import type { DbUserImportJobData } from "@/queue/types.js"; import { IsNull } from "typeorm"; -import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("import-user-lists"); diff --git a/packages/backend/src/queue/processors/db/index.ts b/packages/backend/src/queue/processors/db/index.ts index 1245e08c7..d20fc2c71 100644 --- a/packages/backend/src/queue/processors/db/index.ts +++ b/packages/backend/src/queue/processors/db/index.ts @@ -1,21 +1,21 @@ -import type { DbJobData } from "@/queue/types.js"; import type Bull from "bull"; -import { deleteAccount } from "./delete-account.js"; +import type { DbJobData } from "@/queue/types.js"; import { deleteDriveFiles } from "./delete-drive-files.js"; -import { exportBlocking } from "./export-blocking.js"; import { exportCustomEmojis } from "./export-custom-emojis.js"; +import { exportNotes } from "./export-notes.js"; import { exportFollowing } from "./export-following.js"; import { exportMute } from "./export-mute.js"; -import { exportNotes } from "./export-notes.js"; +import { exportBlocking } from "./export-blocking.js"; import { exportUserLists } from "./export-user-lists.js"; -import { importBlocking } from "./import-blocking.js"; -import { importCustomEmojis } from "./import-custom-emojis.js"; -import { importCkPost } from "./import-firefish-post.js"; import { importFollowing } from "./import-following.js"; -import { importMastoPost } from "./import-masto-post.js"; +import { importUserLists } from "./import-user-lists.js"; +import { deleteAccount } from "./delete-account.js"; import { importMuting } from "./import-muting.js"; import { importPosts } from "./import-posts.js"; -import { importUserLists } from "./import-user-lists.js"; +import { importMastoPost } from "./import-masto-post.js"; +import { importCkPost } from "./import-firefish-post.js"; +import { importBlocking } from "./import-blocking.js"; +import { importCustomEmojis } from "./import-custom-emojis.js"; const jobs = { deleteDriveFiles, diff --git a/packages/backend/src/queue/processors/deliver.ts b/packages/backend/src/queue/processors/deliver.ts index 5d2a7e49a..65471a559 100644 --- a/packages/backend/src/queue/processors/deliver.ts +++ b/packages/backend/src/queue/processors/deliver.ts @@ -1,18 +1,18 @@ import { URL } from "node:url"; -import { toPuny } from "@/misc/convert-host.js"; -import { StatusError } from "@/misc/fetch.js"; -import { shouldSkipInstance } from "@/misc/skipped-instances.js"; -import { Instances } from "@/models/index.js"; -import type { DeliverJobData } from "@/queue/types.js"; import request from "@/remote/activitypub/request.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import Logger from "@/services/logger.js"; +import { Instances } from "@/models/index.js"; import { apRequestChart, federationChart, instanceChart, } from "@/services/chart/index.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; -import Logger from "@/services/logger.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { toPuny } from "@/misc/convert-host.js"; +import { StatusError } from "@/misc/fetch.js"; +import { shouldSkipInstance } from "@/misc/skipped-instances.js"; +import type { DeliverJobData } from "@/queue/types.js"; import type Bull from "bull"; const logger = new Logger("deliver"); diff --git a/packages/backend/src/queue/processors/ended-poll-notification.ts b/packages/backend/src/queue/processors/ended-poll-notification.ts index 140b315e8..f93b067b8 100644 --- a/packages/backend/src/queue/processors/ended-poll-notification.ts +++ b/packages/backend/src/queue/processors/ended-poll-notification.ts @@ -1,9 +1,9 @@ +import type Bull from "bull"; import { Notes, PollVotes } from "@/models/index.js"; // import { queueLogger } from "../logger.js"; import type { EndedPollNotificationJobData } from "@/queue/types.js"; import { createNotification } from "@/services/create-notification.js"; import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; -import type Bull from "bull"; // unused // const logger = queueLogger.createSubLogger("ended-poll-notification"); diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index 71cf7d458..116f279ac 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -1,28 +1,28 @@ import { URL } from "node:url"; -import { extractDbHost, toPuny } from "@/misc/convert-host.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { StatusError } from "@/misc/fetch.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import type { UserPublickey } from "@/models/entities/user-publickey.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { Instances } from "@/models/index.js"; -import { verifySignature } from "@/remote/activitypub/check-fetch.js"; -import DbResolver from "@/remote/activitypub/db-resolver.js"; -import { LdSignature } from "@/remote/activitypub/misc/ld-signature.js"; -import { resolvePerson } from "@/remote/activitypub/models/person.js"; +import type Bull from "bull"; +import httpSignature from "@peertube/http-signature"; import perform from "@/remote/activitypub/perform.js"; -import { getApId } from "@/remote/activitypub/type.js"; +import Logger from "@/services/logger.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { Instances } from "@/models/index.js"; import { apRequestChart, federationChart, instanceChart, } from "@/services/chart/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { toPuny, extractDbHost } from "@/misc/convert-host.js"; +import { getApId } from "@/remote/activitypub/type.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; -import Logger from "@/services/logger.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; -import httpSignature from "@peertube/http-signature"; -import type Bull from "bull"; import type { InboxJobData } from "../types.js"; +import DbResolver from "@/remote/activitypub/db-resolver.js"; +import { resolvePerson } from "@/remote/activitypub/models/person.js"; +import { LdSignature } from "@/remote/activitypub/misc/ld-signature.js"; +import { StatusError } from "@/misc/fetch.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import type { UserPublickey } from "@/models/entities/user-publickey.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import { verifySignature } from "@/remote/activitypub/check-fetch.js"; const logger = new Logger("inbox"); diff --git a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts index 6d9ef9557..14ad1b101 100644 --- a/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts +++ b/packages/backend/src/queue/processors/object-storage/clean-remote-files.ts @@ -1,9 +1,9 @@ import type Bull from "bull"; -import { DriveFiles } from "@/models/index.js"; -import { deleteFileSync } from "@/services/drive/delete-file.js"; -import { IsNull, MoreThan, Not } from "typeorm"; import { queueLogger } from "../../logger.js"; +import { deleteFileSync } from "@/services/drive/delete-file.js"; +import { DriveFiles } from "@/models/index.js"; +import { MoreThan, Not, IsNull } from "typeorm"; const logger = queueLogger.createSubLogger("clean-remote-files"); diff --git a/packages/backend/src/queue/processors/object-storage/delete-file.ts b/packages/backend/src/queue/processors/object-storage/delete-file.ts index 761c83cab..174aa1906 100644 --- a/packages/backend/src/queue/processors/object-storage/delete-file.ts +++ b/packages/backend/src/queue/processors/object-storage/delete-file.ts @@ -1,6 +1,6 @@ import type { ObjectStorageFileJobData } from "@/queue/types.js"; -import { deleteObjectStorageFile } from "@/services/drive/delete-file.js"; import type Bull from "bull"; +import { deleteObjectStorageFile } from "@/services/drive/delete-file.js"; export default async (job: Bull.Job) => { const key: string = job.data.key; diff --git a/packages/backend/src/queue/processors/object-storage/index.ts b/packages/backend/src/queue/processors/object-storage/index.ts index 255ff9f25..5f90d4cd0 100644 --- a/packages/backend/src/queue/processors/object-storage/index.ts +++ b/packages/backend/src/queue/processors/object-storage/index.ts @@ -1,7 +1,7 @@ -import type { ObjectStorageJobData } from "@/queue/types.js"; import type Bull from "bull"; -import cleanRemoteFiles from "./clean-remote-files.js"; +import type { ObjectStorageJobData } from "@/queue/types.js"; import deleteFile from "./delete-file.js"; +import cleanRemoteFiles from "./clean-remote-files.js"; const jobs = { deleteFile, diff --git a/packages/backend/src/queue/processors/system/check-expired-mutings.ts b/packages/backend/src/queue/processors/system/check-expired-mutings.ts index 17715fb4e..a482d0218 100644 --- a/packages/backend/src/queue/processors/system/check-expired-mutings.ts +++ b/packages/backend/src/queue/processors/system/check-expired-mutings.ts @@ -1,8 +1,8 @@ -import { Mutings } from "@/models/index.js"; -import { publishUserEvent } from "@/services/stream.js"; import type Bull from "bull"; import { In } from "typeorm"; +import { Mutings } from "@/models/index.js"; import { queueLogger } from "../../logger.js"; +import { publishUserEvent } from "@/services/stream.js"; const logger = queueLogger.createSubLogger("check-expired-mutings"); diff --git a/packages/backend/src/queue/processors/system/clean-charts.ts b/packages/backend/src/queue/processors/system/clean-charts.ts index 318a0ead3..dde5d95fe 100644 --- a/packages/backend/src/queue/processors/system/clean-charts.ts +++ b/packages/backend/src/queue/processors/system/clean-charts.ts @@ -1,8 +1,8 @@ import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; import { activeUsersChart, - apRequestChart, driveChart, federationChart, hashtagChart, @@ -13,8 +13,8 @@ import { perUserNotesChart, perUserReactionsChart, usersChart, + apRequestChart, } from "@/services/chart/index.js"; -import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("clean-charts"); diff --git a/packages/backend/src/queue/processors/system/clean.ts b/packages/backend/src/queue/processors/system/clean.ts index 8f46c43f4..fbd45b0bb 100644 --- a/packages/backend/src/queue/processors/system/clean.ts +++ b/packages/backend/src/queue/processors/system/clean.ts @@ -1,6 +1,6 @@ -import { UserIps } from "@/models/index.js"; import type Bull from "bull"; import { LessThan } from "typeorm"; +import { UserIps } from "@/models/index.js"; import { queueLogger } from "../../logger.js"; diff --git a/packages/backend/src/queue/processors/system/index.ts b/packages/backend/src/queue/processors/system/index.ts index 207a2ed6d..697d24d06 100644 --- a/packages/backend/src/queue/processors/system/index.ts +++ b/packages/backend/src/queue/processors/system/index.ts @@ -1,10 +1,10 @@ import type Bull from "bull"; -import { checkExpiredMutings } from "./check-expired-mutings.js"; +import { tickCharts } from "./tick-charts.js"; +import { resyncCharts } from "./resync-charts.js"; import { cleanCharts } from "./clean-charts.js"; +import { checkExpiredMutings } from "./check-expired-mutings.js"; import { clean } from "./clean.js"; import { setLocalEmojiSizes } from "./local-emoji-size.js"; -import { resyncCharts } from "./resync-charts.js"; -import { tickCharts } from "./tick-charts.js"; import { verifyLinks } from "./verify-links.js"; const jobs = { diff --git a/packages/backend/src/queue/processors/system/local-emoji-size.ts b/packages/backend/src/queue/processors/system/local-emoji-size.ts index 94f1693e5..d696bbd86 100644 --- a/packages/backend/src/queue/processors/system/local-emoji-size.ts +++ b/packages/backend/src/queue/processors/system/local-emoji-size.ts @@ -1,9 +1,9 @@ -import { Emojis } from "@/models/index.js"; import type Bull from "bull"; import { IsNull } from "typeorm"; +import { Emojis } from "@/models/index.js"; -import { getEmojiSize } from "@/misc/emoji-meta.js"; import { queueLogger } from "../../logger.js"; +import { getEmojiSize } from "@/misc/emoji-meta.js"; const logger = queueLogger.createSubLogger("local-emoji-size"); diff --git a/packages/backend/src/queue/processors/system/resync-charts.ts b/packages/backend/src/queue/processors/system/resync-charts.ts index bba1472d4..dbea0df73 100644 --- a/packages/backend/src/queue/processors/system/resync-charts.ts +++ b/packages/backend/src/queue/processors/system/resync-charts.ts @@ -1,7 +1,7 @@ import type Bull from "bull"; -import { driveChart, notesChart, usersChart } from "@/services/chart/index.js"; import { queueLogger } from "../../logger.js"; +import { driveChart, notesChart, usersChart } from "@/services/chart/index.js"; const logger = queueLogger.createSubLogger("resync-charts"); diff --git a/packages/backend/src/queue/processors/system/tick-charts.ts b/packages/backend/src/queue/processors/system/tick-charts.ts index 901bda888..33eed8a59 100644 --- a/packages/backend/src/queue/processors/system/tick-charts.ts +++ b/packages/backend/src/queue/processors/system/tick-charts.ts @@ -1,8 +1,8 @@ import type Bull from "bull"; +import { queueLogger } from "../../logger.js"; import { activeUsersChart, - apRequestChart, driveChart, federationChart, hashtagChart, @@ -13,8 +13,8 @@ import { perUserNotesChart, perUserReactionsChart, usersChart, + apRequestChart, } from "@/services/chart/index.js"; -import { queueLogger } from "../../logger.js"; const logger = queueLogger.createSubLogger("tick-charts"); diff --git a/packages/backend/src/queue/processors/system/verify-links.ts b/packages/backend/src/queue/processors/system/verify-links.ts index b2c1d65b8..4ee88c631 100644 --- a/packages/backend/src/queue/processors/system/verify-links.ts +++ b/packages/backend/src/queue/processors/system/verify-links.ts @@ -1,9 +1,9 @@ import type Bull from "bull"; import { UserProfiles } from "@/models/index.js"; -import { verifyLink } from "@/services/fetch-rel-me.js"; import { Not } from "typeorm"; import { queueLogger } from "../../logger.js"; +import { verifyLink } from "@/services/fetch-rel-me.js"; const logger = queueLogger.createSubLogger("verify-links"); diff --git a/packages/backend/src/queue/processors/webhook-deliver.ts b/packages/backend/src/queue/processors/webhook-deliver.ts index 19f0aec3c..12c9a0549 100644 --- a/packages/backend/src/queue/processors/webhook-deliver.ts +++ b/packages/backend/src/queue/processors/webhook-deliver.ts @@ -1,9 +1,9 @@ -import config from "@/config/index.js"; -import { StatusError, getResponse } from "@/misc/fetch.js"; -import { Webhooks } from "@/models/index.js"; -import Logger from "@/services/logger.js"; import type Bull from "bull"; +import Logger from "@/services/logger.js"; import type { WebhookDeliverJobData } from "../types.js"; +import { getResponse, StatusError } from "@/misc/fetch.js"; +import { Webhooks } from "@/models/index.js"; +import config from "@/config/index.js"; const logger = new Logger("webhook"); diff --git a/packages/backend/src/queue/queues.ts b/packages/backend/src/queue/queues.ts index 174a67af3..6b0eb2de4 100644 --- a/packages/backend/src/queue/queues.ts +++ b/packages/backend/src/queue/queues.ts @@ -1,11 +1,11 @@ import config from "@/config/index.js"; import { initialize as initializeQueue } from "./initialize.js"; import type { - DbJobData, DeliverJobData, - EndedPollNotificationJobData, InboxJobData, + DbJobData, ObjectStorageJobData, + EndedPollNotificationJobData, WebhookDeliverJobData, } from "./types.js"; diff --git a/packages/backend/src/remote/activitypub/audience.ts b/packages/backend/src/remote/activitypub/audience.ts index 6a45581e6..9d840bc57 100644 --- a/packages/backend/src/remote/activitypub/audience.ts +++ b/packages/backend/src/remote/activitypub/audience.ts @@ -1,13 +1,13 @@ +import type { ApObject } from "./type.js"; +import { getApIds } from "./type.js"; +import type Resolver from "./resolver.js"; +import { resolvePerson } from "./models/person.js"; +import { unique, concat } from "@/prelude/array.js"; +import promiseLimit from "promise-limit"; import type { CacheableRemoteUser, CacheableUser, } from "@/models/entities/user.js"; -import { concat, unique } from "@/prelude/array.js"; -import promiseLimit from "promise-limit"; -import { resolvePerson } from "./models/person.js"; -import type Resolver from "./resolver.js"; -import type { ApObject } from "./type.js"; -import { getApIds } from "./type.js"; type Visibility = "public" | "home" | "followers" | "specified"; diff --git a/packages/backend/src/remote/activitypub/check-fetch.ts b/packages/backend/src/remote/activitypub/check-fetch.ts index 77ba79525..ab46d97f8 100644 --- a/packages/backend/src/remote/activitypub/check-fetch.ts +++ b/packages/backend/src/remote/activitypub/check-fetch.ts @@ -1,17 +1,17 @@ -import type { IncomingMessage } from "http"; -import { verify } from "node:crypto"; -import { createHash } from "node:crypto"; import { URL } from "url"; +import httpSignature, { IParsedSignature } from "@peertube/http-signature"; import config from "@/config/index.js"; -import { toPuny } from "@/misc/convert-host.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import type { UserPublickey } from "@/models/entities/user-publickey.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { toSingle } from "@/prelude/array.js"; +import { toPuny } from "@/misc/convert-host.js"; import DbResolver from "@/remote/activitypub/db-resolver.js"; import { getApId } from "@/remote/activitypub/type.js"; -import httpSignature, { IParsedSignature } from "@peertube/http-signature"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import type { IncomingMessage } from "http"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import type { UserPublickey } from "@/models/entities/user-publickey.js"; +import { verify } from "node:crypto"; +import { toSingle } from "@/prelude/array.js"; +import { createHash } from "node:crypto"; export async function hasSignature(req: IncomingMessage): Promise { const meta = await fetchMeta(); diff --git a/packages/backend/src/remote/activitypub/db-resolver.ts b/packages/backend/src/remote/activitypub/db-resolver.ts index a25662b67..a753606a1 100644 --- a/packages/backend/src/remote/activitypub/db-resolver.ts +++ b/packages/backend/src/remote/activitypub/db-resolver.ts @@ -1,23 +1,23 @@ +import escapeRegexp from "escape-regexp"; import config from "@/config/index.js"; -import { Cache } from "@/misc/cache.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import type { Note } from "@/models/entities/note.js"; -import type { UserPublickey } from "@/models/entities/user-publickey.js"; import type { CacheableRemoteUser, CacheableUser, } from "@/models/entities/user.js"; +import type { UserPublickey } from "@/models/entities/user-publickey.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { - MessagingMessages, Notes, - UserPublickeys, Users, + UserPublickeys, + MessagingMessages, } from "@/models/index.js"; +import { Cache } from "@/misc/cache.js"; import { uriPersonCache, userByIdCache } from "@/services/user-cache.js"; -import escapeRegexp from "escape-regexp"; -import { resolvePerson, updatePerson } from "./models/person.js"; import type { IObject } from "./type.js"; import { getApId } from "./type.js"; +import { resolvePerson, updatePerson } from "./models/person.js"; const publicKeyCache = new Cache("publicKey", 60 * 30); const publicKeyByUserIdCache = new Cache( diff --git a/packages/backend/src/remote/activitypub/deliver-manager.ts b/packages/backend/src/remote/activitypub/deliver-manager.ts index 023a2774f..c97d1c99a 100644 --- a/packages/backend/src/remote/activitypub/deliver-manager.ts +++ b/packages/backend/src/remote/activitypub/deliver-manager.ts @@ -1,8 +1,8 @@ -import { skippedInstances } from "@/misc/skipped-instances.js"; -import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; -import { Followings, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; import { IsNull, Not } from "typeorm"; +import { Users, Followings } from "@/models/index.js"; +import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; +import { deliver } from "@/queue/index.js"; +import { skippedInstances } from "@/misc/skipped-instances.js"; //#region types interface IRecipe { diff --git a/packages/backend/src/remote/activitypub/kernel/accept/follow.ts b/packages/backend/src/remote/activitypub/kernel/accept/follow.ts index fc9a47554..e430bbf57 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/follow.ts @@ -1,8 +1,8 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import accept from "@/services/following/requests/accept.js"; -import { relayAccepted } from "@/services/relay.js"; -import DbResolver from "../../db-resolver.js"; import type { IFollow } from "../../type.js"; +import DbResolver from "../../db-resolver.js"; +import { relayAccepted } from "@/services/relay.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/accept/index.ts b/packages/backend/src/remote/activitypub/kernel/accept/index.ts index 42c4dcb3a..5c73760ff 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/index.ts @@ -1,9 +1,9 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { apLogger } from "../../logger.js"; import Resolver from "../../resolver.js"; -import type { IAccept } from "../../type.js"; -import { getApType, isFollow } from "../../type.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import acceptFollow from "./follow.js"; +import type { IAccept } from "../../type.js"; +import { isFollow, getApType } from "../../type.js"; +import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/add/index.ts b/packages/backend/src/remote/activitypub/kernel/add/index.ts index 1ef49ed77..b3606e5d9 100644 --- a/packages/backend/src/remote/activitypub/kernel/add/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/add/index.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { addPinned } from "@/services/i/pin.js"; -import { resolveNote } from "../../models/note.js"; import type { IAdd } from "../../type.js"; +import { resolveNote } from "../../models/note.js"; +import { addPinned } from "@/services/i/pin.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/announce/index.ts b/packages/backend/src/remote/activitypub/kernel/announce/index.ts index f3e85135d..975e070f9 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/index.ts @@ -1,9 +1,9 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { apLogger } from "../../logger.js"; import Resolver from "../../resolver.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import announceNote from "./note.js"; import type { IAnnounce } from "../../type.js"; import { getApId } from "../../type.js"; -import announceNote from "./note.js"; +import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/announce/note.ts b/packages/backend/src/remote/activitypub/kernel/announce/note.ts index e62cdd204..50b59932c 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/note.ts @@ -1,16 +1,16 @@ -import { getApLock } from "@/misc/app-lock.js"; -import { extractDbHost } from "@/misc/convert-host.js"; -import { StatusError } from "@/misc/fetch.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { Notes } from "@/models/index.js"; -import post from "@/services/note/create.js"; -import { parseAudience } from "../../audience.js"; -import { apLogger } from "../../logger.js"; -import { fetchNote, resolveNote } from "../../models/note.js"; import type Resolver from "../../resolver.js"; +import post from "@/services/note/create.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import type { IAnnounce } from "../../type.js"; import { getApId } from "../../type.js"; +import { fetchNote, resolveNote } from "../../models/note.js"; +import { apLogger } from "../../logger.js"; +import { extractDbHost } from "@/misc/convert-host.js"; +import { getApLock } from "@/misc/app-lock.js"; +import { parseAudience } from "../../audience.js"; +import { StatusError } from "@/misc/fetch.js"; +import { Notes } from "@/models/index.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/block/index.ts b/packages/backend/src/remote/activitypub/kernel/block/index.ts index 96d11c1a1..4dc868ba1 100644 --- a/packages/backend/src/remote/activitypub/kernel/block/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/block/index.ts @@ -1,8 +1,8 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import block from "@/services/blocking/create.js"; -import DbResolver from "../../db-resolver.js"; import type { IBlock } from "../../type.js"; +import block from "@/services/blocking/create.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import DbResolver from "../../db-resolver.js"; +import { Users } from "@/models/index.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/create/index.ts b/packages/backend/src/remote/activitypub/kernel/create/index.ts index 96dfd6761..3dcf64824 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/index.ts @@ -1,10 +1,10 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { concat, toArray, unique } from "@/prelude/array.js"; -import { apLogger } from "../../logger.js"; import Resolver from "../../resolver.js"; -import type { ICreate } from "../../type.js"; -import { getApId, getApType, isPost } from "../../type.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import createNote from "./note.js"; +import type { ICreate } from "../../type.js"; +import { getApId, isPost, getApType } from "../../type.js"; +import { apLogger } from "../../logger.js"; +import { toArray, concat, unique } from "@/prelude/array.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/create/note.ts b/packages/backend/src/remote/activitypub/kernel/create/note.ts index f0b3d177a..92b0ffb1e 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/note.ts @@ -1,11 +1,11 @@ +import type Resolver from "../../resolver.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { createNote, fetchNote } from "../../models/note.js"; +import type { IObject, ICreate } from "../../type.js"; +import { getApId } from "../../type.js"; import { getApLock } from "@/misc/app-lock.js"; import { extractDbHost } from "@/misc/convert-host.js"; import { StatusError } from "@/misc/fetch.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { createNote, fetchNote } from "../../models/note.js"; -import type Resolver from "../../resolver.js"; -import type { ICreate, IObject } from "../../type.js"; -import { getApId } from "../../type.js"; /** * Handle post creation activity diff --git a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts index da8965415..83c6442dd 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts @@ -1,7 +1,7 @@ +import { apLogger } from "../../logger.js"; +import { createDeleteAccountJob } from "@/queue/index.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; -import { createDeleteAccountJob } from "@/queue/index.js"; -import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/delete/index.ts b/packages/backend/src/remote/activitypub/kernel/delete/index.ts index 54cc691bd..f9ad52de5 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/index.ts @@ -1,9 +1,9 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { toSingle } from "@/prelude/array.js"; -import { getApId, isTombstone, validActor, validPost } from "../../type.js"; -import type { IDelete, IObject } from "../../type.js"; -import { deleteActor } from "./actor.js"; +import { getApId, isTombstone, validPost, validActor } from "../../type.js"; import deleteNote from "./note.js"; +import { deleteActor } from "./actor.js"; +import type { IDelete, IObject } from "../../type.js"; /** * Handle delete activity diff --git a/packages/backend/src/remote/activitypub/kernel/delete/note.ts b/packages/backend/src/remote/activitypub/kernel/delete/note.ts index 273be837b..4656480c2 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/note.ts @@ -1,9 +1,9 @@ -import { getApLock } from "@/misc/app-lock.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { deleteMessage } from "@/services/messages/delete.js"; import deleteNode from "@/services/note/delete.js"; -import DbResolver from "../../db-resolver.js"; import { apLogger } from "../../logger.js"; +import DbResolver from "../../db-resolver.js"; +import { getApLock } from "@/misc/app-lock.js"; +import { deleteMessage } from "@/services/messages/delete.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/flag/index.ts b/packages/backend/src/remote/activitypub/kernel/flag/index.ts index 6e9452d01..39ba8b3f4 100644 --- a/packages/backend/src/remote/activitypub/kernel/flag/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/flag/index.ts @@ -1,10 +1,10 @@ -import config from "@/config/index.js"; -import { genId } from "@/misc/gen-id.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { AbuseUserReports, Users } from "@/models/index.js"; -import { In } from "typeorm"; +import config from "@/config/index.js"; import type { IFlag } from "../../type.js"; import { getApIds } from "../../type.js"; +import { AbuseUserReports, Users } from "@/models/index.js"; +import { In } from "typeorm"; +import { genId } from "@/misc/gen-id.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/follow.ts b/packages/backend/src/remote/activitypub/kernel/follow.ts index 610608b54..1c1ef36cf 100644 --- a/packages/backend/src/remote/activitypub/kernel/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/follow.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; import follow from "@/services/following/create.js"; -import DbResolver from "../db-resolver.js"; import type { IFollow } from "../type.js"; +import DbResolver from "../db-resolver.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/index.ts b/packages/backend/src/remote/activitypub/kernel/index.ts index 225c57d4f..a90ac0234 100644 --- a/packages/backend/src/remote/activitypub/kernel/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/index.ts @@ -1,45 +1,45 @@ -import { extractDbHost } from "@/misc/convert-host.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { toArray } from "@/prelude/array.js"; -import { apLogger } from "../logger.js"; -import Resolver from "../resolver.js"; import { - getApId, - isAccept, - isAdd, - isAnnounce, - isBlock, - isCollection, - isCollectionOrOrderedCollection, isCreate, isDelete, - isFlag, - isFollow, - isLike, - isMove, - isRead, - isReject, - isRemove, - isUndo, isUpdate, + isRead, + isFollow, + isAccept, + isReject, + isAdd, + isRemove, + isAnnounce, + isLike, + isUndo, + isBlock, + isCollectionOrOrderedCollection, + isCollection, + isFlag, + isMove, + getApId, } from "../type.js"; -import type { IActivity, IObject } from "../type.js"; -import accept from "./accept/index.js"; -import add from "./add/index.js"; -import announce from "./announce/index.js"; -import block from "./block/index.js"; +import { apLogger } from "../logger.js"; +import Resolver from "../resolver.js"; import create from "./create/index.js"; import performDeleteActivity from "./delete/index.js"; -import flag from "./flag/index.js"; -import follow from "./follow.js"; -import like from "./like.js"; -import move from "./move/index.js"; -import { performReadActivity } from "./read.js"; -import reject from "./reject/index.js"; -import remove from "./remove/index.js"; -import undo from "./undo/index.js"; import performUpdateActivity from "./update/index.js"; +import { performReadActivity } from "./read.js"; +import follow from "./follow.js"; +import undo from "./undo/index.js"; +import like from "./like.js"; +import announce from "./announce/index.js"; +import accept from "./accept/index.js"; +import reject from "./reject/index.js"; +import add from "./add/index.js"; +import remove from "./remove/index.js"; +import block from "./block/index.js"; +import flag from "./flag/index.js"; +import move from "./move/index.js"; +import type { IObject, IActivity } from "../type.js"; +import { extractDbHost } from "@/misc/convert-host.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; export async function performActivity( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/like.ts b/packages/backend/src/remote/activitypub/kernel/like.ts index e4dfe80ee..7b30d1cd5 100644 --- a/packages/backend/src/remote/activitypub/kernel/like.ts +++ b/packages/backend/src/remote/activitypub/kernel/like.ts @@ -1,8 +1,8 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import create from "@/services/note/reaction/create.js"; -import { extractEmojis, fetchNote } from "../models/note.js"; import type { ILike } from "../type.js"; import { getApId } from "../type.js"; +import create from "@/services/note/reaction/create.js"; +import { fetchNote, extractEmojis } from "../models/note.js"; export default async (actor: CacheableRemoteUser, activity: ILike) => { const targetUri = getApId(activity.object); diff --git a/packages/backend/src/remote/activitypub/kernel/read.ts b/packages/backend/src/remote/activitypub/kernel/read.ts index 91f3276ec..53fa7fe63 100644 --- a/packages/backend/src/remote/activitypub/kernel/read.ts +++ b/packages/backend/src/remote/activitypub/kernel/read.ts @@ -1,9 +1,9 @@ -import { extractDbHost, isSelfHost } from "@/misc/convert-host.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { MessagingMessages } from "@/models/index.js"; -import { readUserMessagingMessage } from "@/server/api/common/read-messaging-message.js"; import type { IRead } from "../type.js"; import { getApId } from "../type.js"; +import { isSelfHost, extractDbHost } from "@/misc/convert-host.js"; +import { MessagingMessages } from "@/models/index.js"; +import { readUserMessagingMessage } from "@/server/api/common/read-messaging-message.js"; export const performReadActivity = async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/reject/follow.ts b/packages/backend/src/remote/activitypub/kernel/reject/follow.ts index 994384425..670c1556f 100644 --- a/packages/backend/src/remote/activitypub/kernel/reject/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/reject/follow.ts @@ -1,9 +1,9 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; import { remoteReject } from "@/services/following/reject.js"; -import { relayRejected } from "@/services/relay.js"; -import DbResolver from "../../db-resolver.js"; import type { IFollow } from "../../type.js"; +import DbResolver from "../../db-resolver.js"; +import { relayRejected } from "@/services/relay.js"; +import { Users } from "@/models/index.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/reject/index.ts b/packages/backend/src/remote/activitypub/kernel/reject/index.ts index dd5465b0c..10edb0f7a 100644 --- a/packages/backend/src/remote/activitypub/kernel/reject/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/reject/index.ts @@ -1,9 +1,9 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { apLogger } from "../../logger.js"; import Resolver from "../../resolver.js"; -import type { IReject } from "../../type.js"; -import { getApType, isFollow } from "../../type.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import rejectFollow from "./follow.js"; +import type { IReject } from "../../type.js"; +import { isFollow, getApType } from "../../type.js"; +import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/remove/index.ts b/packages/backend/src/remote/activitypub/kernel/remove/index.ts index f8478b7c7..0b4be6b5f 100644 --- a/packages/backend/src/remote/activitypub/kernel/remove/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/remove/index.ts @@ -1,7 +1,7 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { removePinned } from "@/services/i/pin.js"; -import { resolveNote } from "../../models/note.js"; import type { IRemove } from "../../type.js"; +import { resolveNote } from "../../models/note.js"; +import { removePinned } from "@/services/i/pin.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts index 6e3366196..7cf457046 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/accept.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/accept.ts @@ -1,8 +1,8 @@ +import unfollow from "@/services/following/delete.js"; +import type { IAccept } from "../../type.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { Followings } from "@/models/index.js"; -import unfollow from "@/services/following/delete.js"; import DbResolver from "../../db-resolver.js"; -import type { IAccept } from "../../type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts index 121e73ceb..a6e9c88c6 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/announce.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/announce.ts @@ -1,8 +1,8 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { Notes } from "@/models/index.js"; -import deleteNote from "@/services/note/delete.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import type { IAnnounce } from "../../type.js"; import { getApId } from "../../type.js"; +import deleteNote from "@/services/note/delete.js"; export const undoAnnounce = async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/block.ts b/packages/backend/src/remote/activitypub/kernel/undo/block.ts index 302edbad9..b4e1d8ee4 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/block.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/block.ts @@ -1,8 +1,8 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import unblock from "@/services/blocking/delete.js"; -import DbResolver from "../../db-resolver.js"; import type { IBlock } from "../../type.js"; +import unblock from "@/services/blocking/delete.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import DbResolver from "../../db-resolver.js"; +import { Users } from "@/models/index.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts index 9bc772867..1c4648cf9 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/follow.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/follow.ts @@ -1,9 +1,9 @@ -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { FollowRequests, Followings } from "@/models/index.js"; import unfollow from "@/services/following/delete.js"; import cancelRequest from "@/services/following/requests/cancel.js"; -import DbResolver from "../../db-resolver.js"; import type { IFollow } from "../../type.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; +import { FollowRequests, Followings } from "@/models/index.js"; +import DbResolver from "../../db-resolver.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/kernel/undo/index.ts b/packages/backend/src/remote/activitypub/kernel/undo/index.ts index b8f1db9bd..f0e2316fa 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/index.ts @@ -1,20 +1,20 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { apLogger } from "../../logger.js"; -import Resolver from "../../resolver.js"; import type { IUndo } from "../../type.js"; import { + isFollow, + isBlock, + isLike, + isAnnounce, getApType, isAccept, - isAnnounce, - isBlock, - isFollow, - isLike, } from "../../type.js"; +import unfollow from "./follow.js"; +import unblock from "./block.js"; +import undoLike from "./like.js"; import undoAccept from "./accept.js"; import { undoAnnounce } from "./announce.js"; -import unblock from "./block.js"; -import unfollow from "./follow.js"; -import undoLike from "./like.js"; +import Resolver from "../../resolver.js"; +import { apLogger } from "../../logger.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/kernel/undo/like.ts b/packages/backend/src/remote/activitypub/kernel/undo/like.ts index b32983bee..90220e203 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/like.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/like.ts @@ -1,8 +1,8 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import deleteReaction from "@/services/note/reaction/delete.js"; -import { fetchNote } from "../../models/note.js"; import type { ILike } from "../../type.js"; import { getApId } from "../../type.js"; +import deleteReaction from "@/services/note/reaction/delete.js"; +import { fetchNote } from "../../models/note.js"; /** * Process Undo.Like activity diff --git a/packages/backend/src/remote/activitypub/kernel/update/index.ts b/packages/backend/src/remote/activitypub/kernel/update/index.ts index 7c0b2f602..558a20ce0 100644 --- a/packages/backend/src/remote/activitypub/kernel/update/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/update/index.ts @@ -1,10 +1,10 @@ import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { apLogger } from "../../logger.js"; -import { updateNote } from "../../models/note.js"; -import { updatePerson } from "../../models/person.js"; -import Resolver from "../../resolver.js"; import type { IUpdate } from "../../type.js"; import { getApType, isActor } from "../../type.js"; +import { apLogger } from "../../logger.js"; +import { updateNote } from "../../models/note.js"; +import Resolver from "../../resolver.js"; +import { updatePerson } from "../../models/person.js"; /** * Handler for the Update activity diff --git a/packages/backend/src/remote/activitypub/misc/get-note-html.ts b/packages/backend/src/remote/activitypub/misc/get-note-html.ts index 2c04fca9d..7521d1213 100644 --- a/packages/backend/src/remote/activitypub/misc/get-note-html.ts +++ b/packages/backend/src/remote/activitypub/misc/get-note-html.ts @@ -1,6 +1,6 @@ -import { toHtml } from "@/mfm/to-html.js"; -import type { Note } from "@/models/entities/note.js"; import * as mfm from "mfm-js"; +import type { Note } from "@/models/entities/note.js"; +import { toHtml } from "@/mfm/to-html.js"; export default function (note: Note) { if (!note.text) return ""; diff --git a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts index 80669fead..f18958f70 100644 --- a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts +++ b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts @@ -1,6 +1,6 @@ -import { fromHtml } from "@/mfm/from-html.js"; -import { extractApHashtagObjects } from "../models/tag.js"; import type { IObject } from "../type.js"; +import { extractApHashtagObjects } from "../models/tag.js"; +import { fromHtml } from "@/mfm/from-html.js"; export function htmlToMfm(html: string, tag?: IObject | IObject[]) { const hashtagNames = extractApHashtagObjects(tag) diff --git a/packages/backend/src/remote/activitypub/misc/ld-signature.ts b/packages/backend/src/remote/activitypub/misc/ld-signature.ts index f2ebfec17..62707624b 100644 --- a/packages/backend/src/remote/activitypub/misc/ld-signature.ts +++ b/packages/backend/src/remote/activitypub/misc/ld-signature.ts @@ -1,8 +1,8 @@ import * as crypto from "node:crypto"; -import { httpAgent, httpsAgent } from "@/misc/fetch.js"; import jsonld from "jsonld"; -import fetch from "node-fetch"; import { CONTEXTS } from "./contexts.js"; +import fetch from "node-fetch"; +import { httpAgent, httpsAgent } from "@/misc/fetch.js"; // RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017 diff --git a/packages/backend/src/remote/activitypub/models/image.ts b/packages/backend/src/remote/activitypub/models/image.ts index 36eeda36c..2cf0c6c15 100644 --- a/packages/backend/src/remote/activitypub/models/image.ts +++ b/packages/backend/src/remote/activitypub/models/image.ts @@ -1,12 +1,12 @@ -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; -import { truncate } from "@/misc/truncate.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { DriveFiles } from "@/models/index.js"; import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import { apLogger } from "../logger.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import Resolver from "../resolver.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { apLogger } from "../logger.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { DriveFiles } from "@/models/index.js"; +import { truncate } from "@/misc/truncate.js"; +import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/models/mention.ts b/packages/backend/src/remote/activitypub/models/mention.ts index 4f7ff6690..e9f80bc43 100644 --- a/packages/backend/src/remote/activitypub/models/mention.ts +++ b/packages/backend/src/remote/activitypub/models/mention.ts @@ -1,9 +1,9 @@ -import type { CacheableUser } from "@/models/entities/user.js"; -import { toArray, unique } from "@/prelude/array.js"; import promiseLimit from "promise-limit"; -import Resolver from "../resolver.js"; -import type { IApMention, IObject } from "../type.js"; +import { toArray, unique } from "@/prelude/array.js"; +import type { CacheableUser } from "@/models/entities/user.js"; +import type { IObject, IApMention } from "../type.js"; import { isMention } from "../type.js"; +import Resolver from "../resolver.js"; import { resolvePerson } from "./person.js"; export async function extractApMentions( diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index c70d1acfb..d9eedb305 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -1,55 +1,55 @@ +import promiseLimit from "promise-limit"; +import * as mfm from "mfm-js"; import config from "@/config/index.js"; -import { getApLock } from "@/misc/app-lock.js"; -import { extractDbHost, toPuny } from "@/misc/convert-host.js"; -import { type Size, getEmojiSize } from "@/misc/emoji-meta.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { StatusError } from "@/misc/fetch.js"; -import { genId } from "@/misc/gen-id.js"; -import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; -import { langmap } from "@/misc/langmap.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; -import { truncate } from "@/misc/truncate.js"; -import { DriveFile } from "@/models/entities/drive-file.js"; -import type { Emoji } from "@/models/entities/emoji.js"; -import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; -import type { CacheableRemoteUser } from "@/models/entities/user.js"; -import { - DriveFiles, - Emojis, - MessagingMessages, - NoteEdits, - Notes, - Polls, -} from "@/models/index.js"; -import { UserProfiles } from "@/models/index.js"; -import { toArray, toSingle, unique } from "@/prelude/array.js"; -import { createMessage } from "@/services/messages/create.js"; +import Resolver from "../resolver.js"; import post from "@/services/note/create.js"; import { extractMentionedUsers } from "@/services/note/create.js"; -import vote from "@/services/note/polls/vote.js"; -import { publishNoteStream } from "@/services/stream.js"; -import * as mfm from "mfm-js"; -import promiseLimit from "promise-limit"; -import { In } from "typeorm"; -import { parseAudience } from "../audience.js"; -import DbResolver from "../db-resolver.js"; -import { apLogger } from "../logger.js"; +import { resolvePerson } from "./person.js"; +import { resolveImage } from "./image.js"; +import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { htmlToMfm } from "../misc/html-to-mfm.js"; -import Resolver from "../resolver.js"; +import { extractApHashtags } from "./tag.js"; +import { unique, toArray, toSingle } from "@/prelude/array.js"; +import { extractPollFromQuestion } from "./question.js"; +import vote from "@/services/note/polls/vote.js"; +import { apLogger } from "../logger.js"; +import { DriveFile } from "@/models/entities/drive-file.js"; +import { extractDbHost, toPuny } from "@/misc/convert-host.js"; +import { + Emojis, + Polls, + MessagingMessages, + Notes, + NoteEdits, + DriveFiles, +} from "@/models/index.js"; +import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; import type { IObject, IPost } from "../type.js"; import { - getApId, - getApType, - getOneApHrefNullable, getOneApId, - isEmoji, + getApId, + getOneApHrefNullable, validPost, + isEmoji, + getApType, } from "../type.js"; -import { resolveImage } from "./image.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import { genId } from "@/misc/gen-id.js"; +import { getApLock } from "@/misc/app-lock.js"; +import { createMessage } from "@/services/messages/create.js"; +import { parseAudience } from "../audience.js"; import { extractApMentions } from "./mention.js"; -import { resolvePerson } from "./person.js"; -import { extractPollFromQuestion } from "./question.js"; -import { extractApHashtags } from "./tag.js"; +import DbResolver from "../db-resolver.js"; +import { StatusError } from "@/misc/fetch.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; +import { UserProfiles } from "@/models/index.js"; +import { In } from "typeorm"; +import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; +import { truncate } from "@/misc/truncate.js"; +import { type Size, getEmojiSize } from "@/misc/emoji-meta.js"; +import { langmap } from "@/misc/langmap.js"; const logger = apLogger; diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 4ae2f815f..25a84f3f2 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -2,51 +2,51 @@ import { URL } from "node:url"; import promiseLimit from "promise-limit"; import config from "@/config/index.js"; -import { db } from "@/db/postgre.js"; -import { fromHtml } from "@/mfm/from-html.js"; -import { toPuny } from "@/misc/convert-host.js"; -import { StatusError } from "@/misc/fetch.js"; -import { genId } from "@/misc/gen-id.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { truncate } from "@/misc/truncate.js"; -import type { Emoji } from "@/models/entities/emoji.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import type { Note } from "@/models/entities/note.js"; -import { UserNotePining } from "@/models/entities/user-note-pining.js"; -import { UserProfile } from "@/models/entities/user-profile.js"; -import { UserPublickey } from "@/models/entities/user-publickey.js"; -import type { CacheableUser, IRemoteUser } from "@/models/entities/user.js"; -import { User } from "@/models/entities/user.js"; +import { updateUsertags } from "@/services/update-hashtag.js"; import { - Followings, + Users, Instances, + Followings, UserProfiles, UserPublickeys, - Users, } from "@/models/index.js"; -import { toArray } from "@/prelude/array.js"; +import type { IRemoteUser, CacheableUser } from "@/models/entities/user.js"; +import { User } from "@/models/entities/user.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import { UserNotePining } from "@/models/entities/user-note-pining.js"; +import { genId } from "@/misc/gen-id.js"; import { instanceChart, usersChart } from "@/services/chart/index.js"; +import { UserPublickey } from "@/models/entities/user-publickey.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import { toPuny } from "@/misc/convert-host.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { toArray } from "@/prelude/array.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; -import { publishInternalEvent } from "@/services/stream.js"; -import { updateUsertags } from "@/services/update-hashtag.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { truncate } from "@/misc/truncate.js"; +import { StatusError } from "@/misc/fetch.js"; import { uriPersonCache } from "@/services/user-cache.js"; +import { publishInternalEvent } from "@/services/stream.js"; +import { db } from "@/db/postgre.js"; import { apLogger } from "../logger.js"; import { htmlToMfm } from "../misc/html-to-mfm.js"; -import Resolver from "../resolver.js"; +import { fromHtml } from "@/mfm/from-html.js"; import type { IActor, IObject } from "../type.js"; import { - getApId, - getApType, - getOneApHrefNullable, - isActor, - isCollection, isCollectionOrOrderedCollection, + isCollection, + getApId, + getOneApHrefNullable, isPropertyValue, + getApType, + isActor, } from "../type.js"; -import { resolveImage } from "./image.js"; -import { extractEmojis, resolveNote } from "./note.js"; +import Resolver from "../resolver.js"; import { extractApHashtags } from "./tag.js"; +import { resolveNote, extractEmojis } from "./note.js"; +import { resolveImage } from "./image.js"; const logger = apLogger; @@ -475,10 +475,10 @@ export async function updatePerson( if (typeof person.followers === "string") { try { - const data = await fetch(person.followers, { + let data = await fetch(person.followers, { headers: { Accept: "application/json" }, }); - const json_data = JSON.parse(await data.text()); + let json_data = JSON.parse(await data.text()); followersCount = json_data.totalItems; } catch { @@ -490,10 +490,10 @@ export async function updatePerson( if (typeof person.following === "string") { try { - const data = await fetch(person.following, { + let data = await fetch(person.following, { headers: { Accept: "application/json" }, }); - const json_data = JSON.parse(await data.text()); + let json_data = JSON.parse(await data.text()); followingCount = json_data.totalItems; } catch { @@ -505,10 +505,10 @@ export async function updatePerson( if (typeof person.outbox === "string") { try { - const data = await fetch(person.outbox, { + let data = await fetch(person.outbox, { headers: { Accept: "application/json" }, }); - const json_data = JSON.parse(await data.text()); + let json_data = JSON.parse(await data.text()); notesCount = json_data.totalItems; } catch (e) { diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index 187b58d90..f5855c3e7 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -1,10 +1,10 @@ import config from "@/config/index.js"; -import type { IPoll } from "@/models/entities/poll.js"; -import { Notes, Polls } from "@/models/index.js"; -import { apLogger } from "../logger.js"; import Resolver from "../resolver.js"; import type { IObject, IQuestion } from "../type.js"; import { getApId, isQuestion } from "../type.js"; +import { apLogger } from "../logger.js"; +import { Notes, Polls } from "@/models/index.js"; +import type { IPoll } from "@/models/entities/poll.js"; export async function extractPollFromQuestion( source: string | IObject, diff --git a/packages/backend/src/remote/activitypub/models/tag.ts b/packages/backend/src/remote/activitypub/models/tag.ts index 2a8cbef38..537cdecbd 100644 --- a/packages/backend/src/remote/activitypub/models/tag.ts +++ b/packages/backend/src/remote/activitypub/models/tag.ts @@ -1,5 +1,5 @@ import { toArray } from "@/prelude/array.js"; -import type { IApHashtag, IObject } from "../type.js"; +import type { IObject, IApHashtag } from "../type.js"; import { isHashtag } from "../type.js"; export function extractApHashtags( diff --git a/packages/backend/src/remote/activitypub/perform.ts b/packages/backend/src/remote/activitypub/perform.ts index 9bb231b96..0d2cdb4a5 100644 --- a/packages/backend/src/remote/activitypub/perform.ts +++ b/packages/backend/src/remote/activitypub/perform.ts @@ -1,7 +1,7 @@ +import type { IObject } from "./type.js"; import type { CacheableRemoteUser } from "@/models/entities/user.js"; import { performActivity } from "./kernel/index.js"; import { updatePerson } from "./models/person.js"; -import type { IObject } from "./type.js"; export default async ( actor: CacheableRemoteUser, diff --git a/packages/backend/src/remote/activitypub/renderer/follow-user.ts b/packages/backend/src/remote/activitypub/renderer/follow-user.ts index e99eb2839..22ee429ff 100644 --- a/packages/backend/src/remote/activitypub/renderer/follow-user.ts +++ b/packages/backend/src/remote/activitypub/renderer/follow-user.ts @@ -1,6 +1,6 @@ import config from "@/config/index.js"; -import type { User } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; /** * Convert (local|remote)(Follower|Followee)ID to URL diff --git a/packages/backend/src/remote/activitypub/renderer/index.ts b/packages/backend/src/remote/activitypub/renderer/index.ts index 16d36bb91..c60a1f4cd 100644 --- a/packages/backend/src/remote/activitypub/renderer/index.ts +++ b/packages/backend/src/remote/activitypub/renderer/index.ts @@ -1,7 +1,7 @@ +import { v4 as uuid } from "uuid"; import config from "@/config/index.js"; import { getUserKeypair } from "@/misc/keypair-store.js"; import type { User } from "@/models/entities/user.js"; -import { v4 as uuid } from "uuid"; import { LdSignature } from "../misc/ld-signature.js"; import type { IActivity } from "../type.js"; diff --git a/packages/backend/src/remote/activitypub/renderer/key.ts b/packages/backend/src/remote/activitypub/renderer/key.ts index 3a1b4794b..084bb5361 100644 --- a/packages/backend/src/remote/activitypub/renderer/key.ts +++ b/packages/backend/src/remote/activitypub/renderer/key.ts @@ -1,7 +1,7 @@ -import { createPublicKey } from "node:crypto"; import config from "@/config/index.js"; -import type { UserKeypair } from "@/models/entities/user-keypair.js"; import type { ILocalUser } from "@/models/entities/user.js"; +import type { UserKeypair } from "@/models/entities/user-keypair.js"; +import { createPublicKey } from "node:crypto"; export default (user: ILocalUser, key: UserKeypair, postfix?: string) => ({ id: `${config.url}/users/${user.id}${postfix || "/publickey"}`, diff --git a/packages/backend/src/remote/activitypub/renderer/like.ts b/packages/backend/src/remote/activitypub/renderer/like.ts index 4190ae327..53c66c5c9 100644 --- a/packages/backend/src/remote/activitypub/renderer/like.ts +++ b/packages/backend/src/remote/activitypub/renderer/like.ts @@ -1,10 +1,10 @@ +import { IsNull } from "typeorm"; import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import type { NoteReaction } from "@/models/entities/note-reaction.js"; import type { Note } from "@/models/entities/note.js"; import { Emojis } from "@/models/index.js"; -import { IsNull } from "typeorm"; import renderEmoji from "./emoji.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; export const renderLike = async (noteReaction: NoteReaction, note: Note) => { const reaction = noteReaction.reaction; diff --git a/packages/backend/src/remote/activitypub/renderer/mention.ts b/packages/backend/src/remote/activitypub/renderer/mention.ts index a598b804e..e7f0435c1 100644 --- a/packages/backend/src/remote/activitypub/renderer/mention.ts +++ b/packages/backend/src/remote/activitypub/renderer/mention.ts @@ -1,5 +1,5 @@ import config from "@/config/index.js"; -import type { ILocalUser, User } from "@/models/entities/user.js"; +import type { User, ILocalUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; export default (mention: User) => ({ diff --git a/packages/backend/src/remote/activitypub/renderer/note.ts b/packages/backend/src/remote/activitypub/renderer/note.ts index a63118ad4..b840e2d6f 100644 --- a/packages/backend/src/remote/activitypub/renderer/note.ts +++ b/packages/backend/src/remote/activitypub/renderer/note.ts @@ -1,16 +1,16 @@ -import config from "@/config/index.js"; -import detectLanguage from "@/misc/detect-language.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Emoji } from "@/models/entities/emoji.js"; -import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; -import type { Poll } from "@/models/entities/poll.js"; -import { DriveFiles, Emojis, Notes, Polls, Users } from "@/models/index.js"; -import toHtml from "@/remote/activitypub/misc/get-note-html.js"; import { In, IsNull } from "typeorm"; -import renderDocument from "./document.js"; +import config from "@/config/index.js"; +import type { Note, IMentionedRemoteUsers } from "@/models/entities/note.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { DriveFiles, Notes, Users, Emojis, Polls } from "@/models/index.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import type { Poll } from "@/models/entities/poll.js"; +import toHtml from "@/remote/activitypub/misc/get-note-html.js"; +import detectLanguage from "@/misc/detect-language.js"; import renderEmoji from "./emoji.js"; -import renderHashtag from "./hashtag.js"; import renderMention from "./mention.js"; +import renderHashtag from "./hashtag.js"; +import renderDocument from "./document.js"; export default async function renderNote( note: Note, diff --git a/packages/backend/src/remote/activitypub/renderer/person.ts b/packages/backend/src/remote/activitypub/renderer/person.ts index 637693e07..db176a0dd 100644 --- a/packages/backend/src/remote/activitypub/renderer/person.ts +++ b/packages/backend/src/remote/activitypub/renderer/person.ts @@ -1,16 +1,16 @@ import { URL } from "node:url"; +import * as mfm from "mfm-js"; import config from "@/config/index.js"; -import { getUserKeypair } from "@/misc/keypair-store.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { DriveFiles, UserProfiles } from "@/models/index.js"; -import * as mfm from "mfm-js"; +import { getUserKeypair } from "@/misc/keypair-store.js"; import { toHtml } from "../../../mfm/to-html.js"; -import type { IIdentifier } from "../models/identifier.js"; -import renderEmoji from "./emoji.js"; -import renderHashtag from "./hashtag.js"; import renderImage from "./image.js"; import renderKey from "./key.js"; import { getEmojis } from "./note.js"; +import renderEmoji from "./emoji.js"; +import renderHashtag from "./hashtag.js"; +import type { IIdentifier } from "../models/identifier.js"; export async function renderPerson(user: ILocalUser) { const id = `${config.url}/users/${user.id}`; diff --git a/packages/backend/src/remote/activitypub/renderer/question.ts b/packages/backend/src/remote/activitypub/renderer/question.ts index 7ca995872..cb89aa758 100644 --- a/packages/backend/src/remote/activitypub/renderer/question.ts +++ b/packages/backend/src/remote/activitypub/renderer/question.ts @@ -1,7 +1,7 @@ import config from "@/config/index.js"; +import type { User } from "@/models/entities/user.js"; import type { Note } from "@/models/entities/note.js"; import type { Poll } from "@/models/entities/poll.js"; -import type { User } from "@/models/entities/user.js"; export default async function renderQuestion( user: { id: User["id"] }, diff --git a/packages/backend/src/remote/activitypub/renderer/read.ts b/packages/backend/src/remote/activitypub/renderer/read.ts index cc90ecc77..212e7e8dd 100644 --- a/packages/backend/src/remote/activitypub/renderer/read.ts +++ b/packages/backend/src/remote/activitypub/renderer/read.ts @@ -1,6 +1,6 @@ import config from "@/config/index.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import type { User } from "@/models/entities/user.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; export const renderReadActivity = ( user: { id: User["id"] }, diff --git a/packages/backend/src/remote/activitypub/renderer/vote.ts b/packages/backend/src/remote/activitypub/renderer/vote.ts index 491a8ffaf..21234a112 100644 --- a/packages/backend/src/remote/activitypub/renderer/vote.ts +++ b/packages/backend/src/remote/activitypub/renderer/vote.ts @@ -1,8 +1,8 @@ import config from "@/config/index.js"; import type { Note } from "@/models/entities/note.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; import type { PollVote } from "@/models/entities/poll-vote.js"; import type { Poll } from "@/models/entities/poll.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; export default async function renderVote( user: { id: User["id"] }, diff --git a/packages/backend/src/remote/activitypub/request.ts b/packages/backend/src/remote/activitypub/request.ts index 0dce4a21c..69c97a445 100644 --- a/packages/backend/src/remote/activitypub/request.ts +++ b/packages/backend/src/remote/activitypub/request.ts @@ -1,9 +1,9 @@ import config from "@/config/index.js"; import { getUserKeypair } from "@/misc/keypair-store.js"; import type { User } from "@/models/entities/user.js"; -import { apLogger } from "@/remote/activitypub/logger.js"; import { getResponse } from "../../misc/fetch.js"; -import { createSignedGet, createSignedPost } from "./ap-request.js"; +import { createSignedPost, createSignedGet } from "./ap-request.js"; +import { apLogger } from "@/remote/activitypub/logger.js"; export default async (user: { id: User["id"] }, url: string, object: any) => { const body = JSON.stringify(object); diff --git a/packages/backend/src/remote/activitypub/resolver.ts b/packages/backend/src/remote/activitypub/resolver.ts index e487f5ff9..c4bee109d 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -1,23 +1,23 @@ import config from "@/config/index.js"; -import { extractDbHost, isSelfHost } from "@/misc/convert-host.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { getJson } from "@/misc/fetch.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; import type { ILocalUser } from "@/models/entities/user.js"; -import { NoteReactions, Notes, Polls, Users } from "@/models/index.js"; -import { apLogger } from "@/remote/activitypub/logger.js"; -import renderCreate from "@/remote/activitypub/renderer/create.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import { renderLike } from "@/remote/activitypub/renderer/like.js"; +import { getInstanceActor } from "@/services/instance-actor.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { extractDbHost, isSelfHost } from "@/misc/convert-host.js"; +import { signedGet } from "./request.js"; +import type { IObject, ICollection, IOrderedCollection } from "./type.js"; +import { isCollectionOrOrderedCollection, getApId } from "./type.js"; +import { Notes, NoteReactions, Polls, Users } from "@/models/index.js"; +import { parseUri } from "./db-resolver.js"; import renderNote from "@/remote/activitypub/renderer/note.js"; +import { renderLike } from "@/remote/activitypub/renderer/like.js"; import { renderPerson } from "@/remote/activitypub/renderer/person.js"; import renderQuestion from "@/remote/activitypub/renderer/question.js"; -import { getInstanceActor } from "@/services/instance-actor.js"; -import { parseUri } from "./db-resolver.js"; -import { signedGet } from "./request.js"; -import type { ICollection, IObject, IOrderedCollection } from "./type.js"; -import { getApId, isCollectionOrOrderedCollection } from "./type.js"; +import renderCreate from "@/remote/activitypub/renderer/create.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import { apLogger } from "@/remote/activitypub/logger.js"; export default class Resolver { private history: Set; diff --git a/packages/backend/src/remote/resolve-user.ts b/packages/backend/src/remote/resolve-user.ts index 4d74418c5..a6c1e399a 100644 --- a/packages/backend/src/remote/resolve-user.ts +++ b/packages/backend/src/remote/resolve-user.ts @@ -1,13 +1,13 @@ import { URL } from "node:url"; -import config from "@/config/index.js"; -import { toPuny } from "@/misc/convert-host.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; import chalk from "chalk"; import { IsNull } from "typeorm"; +import config from "@/config/index.js"; +import type { User, IRemoteUser } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; +import { toPuny } from "@/misc/convert-host.js"; +import webFinger from "./webfinger.js"; import { createPerson, updatePerson } from "./activitypub/models/person.js"; import { remoteLogger } from "./logger.js"; -import webFinger from "./webfinger.js"; const logger = remoteLogger.createSubLogger("resolve-user"); diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index e8f32c772..c9c05adac 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -1,40 +1,40 @@ import Router from "@koa/router"; -import httpSignature from "@peertube/http-signature"; import bodyParser from "koa-bodyparser"; +import httpSignature from "@peertube/http-signature"; -import config from "@/config/index.js"; +import { In, IsNull, Not } from "typeorm"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import renderKey from "@/remote/activitypub/renderer/key.js"; +import { renderPerson } from "@/remote/activitypub/renderer/person.js"; +import renderEmoji from "@/remote/activitypub/renderer/emoji.js"; +import { inbox as processInbox } from "@/queue/index.js"; import { isSelfHost } from "@/misc/convert-host.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { getUserKeypair } from "@/misc/keypair-store.js"; -import type { ILocalUser, User } from "@/models/entities/user.js"; import { - Emojis, - FollowRequests, - NoteReactions, Notes, Users, + Emojis, + NoteReactions, + FollowRequests, } from "@/models/index.js"; -import { inbox as processInbox } from "@/queue/index.js"; +import type { ILocalUser, User } from "@/models/entities/user.js"; +import { renderLike } from "@/remote/activitypub/renderer/like.js"; +import { getUserKeypair } from "@/misc/keypair-store.js"; import { checkFetch, getSignatureUser, verifyDigest, } from "@/remote/activitypub/check-fetch.js"; -import renderEmoji from "@/remote/activitypub/renderer/emoji.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderKey from "@/remote/activitypub/renderer/key.js"; -import { renderLike } from "@/remote/activitypub/renderer/like.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; -import { renderPerson } from "@/remote/activitypub/renderer/person.js"; import { getInstanceActor } from "@/services/instance-actor.js"; -import Koa from "koa"; -import { In, IsNull, Not } from "typeorm"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; import Featured from "./activitypub/featured.js"; -import Followers from "./activitypub/followers.js"; import Following from "./activitypub/following.js"; +import Followers from "./activitypub/followers.js"; import Outbox, { packActivity } from "./activitypub/outbox.js"; import { serverLogger } from "./index.js"; +import config from "@/config/index.js"; +import Koa from "koa"; // Init router const router = new Router(); diff --git a/packages/backend/src/server/activitypub/featured.ts b/packages/backend/src/server/activitypub/featured.ts index b88e0d8b8..bd4923b7c 100644 --- a/packages/backend/src/server/activitypub/featured.ts +++ b/packages/backend/src/server/activitypub/featured.ts @@ -1,13 +1,13 @@ -import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Notes, UserNotePinings, Users } from "@/models/index.js"; -import { checkFetch } from "@/remote/activitypub/check-fetch.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; -import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; -import type Router from "@koa/router"; import { IsNull } from "typeorm"; +import config from "@/config/index.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import { Users, Notes, UserNotePinings } from "@/models/index.js"; +import { checkFetch } from "@/remote/activitypub/check-fetch.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { setResponseType } from "../activitypub.js"; +import type Router from "@koa/router"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/activitypub/followers.ts b/packages/backend/src/server/activitypub/followers.ts index ff5106efe..146ca5192 100644 --- a/packages/backend/src/server/activitypub/followers.ts +++ b/packages/backend/src/server/activitypub/followers.ts @@ -1,17 +1,17 @@ -import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { Following } from "@/models/entities/following.js"; -import { Followings, UserProfiles, Users } from "@/models/index.js"; -import * as url from "@/prelude/url.js"; -import { checkFetch } from "@/remote/activitypub/check-fetch.js"; -import renderFollowUser from "@/remote/activitypub/renderer/follow-user.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; -import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; -import type Router from "@koa/router"; import { IsNull, LessThan } from "typeorm"; -import type { FindOptionsWhere } from "typeorm"; +import config from "@/config/index.js"; +import * as url from "@/prelude/url.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; +import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; +import renderFollowUser from "@/remote/activitypub/renderer/follow-user.js"; +import { Users, Followings, UserProfiles } from "@/models/index.js"; +import type { Following } from "@/models/entities/following.js"; +import { checkFetch } from "@/remote/activitypub/check-fetch.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { setResponseType } from "../activitypub.js"; +import type { FindOptionsWhere } from "typeorm"; +import type Router from "@koa/router"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/activitypub/following.ts b/packages/backend/src/server/activitypub/following.ts index 542925d69..eab513ce6 100644 --- a/packages/backend/src/server/activitypub/following.ts +++ b/packages/backend/src/server/activitypub/following.ts @@ -1,17 +1,17 @@ +import { LessThan, IsNull } from "typeorm"; import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { Following } from "@/models/entities/following.js"; -import { Followings, UserProfiles, Users } from "@/models/index.js"; import * as url from "@/prelude/url.js"; -import { checkFetch } from "@/remote/activitypub/check-fetch.js"; -import renderFollowUser from "@/remote/activitypub/renderer/follow-user.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; -import type Router from "@koa/router"; -import { IsNull, LessThan } from "typeorm"; -import type { FindOptionsWhere } from "typeorm"; +import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; +import renderFollowUser from "@/remote/activitypub/renderer/follow-user.js"; +import { Users, Followings, UserProfiles } from "@/models/index.js"; +import type { Following } from "@/models/entities/following.js"; +import { checkFetch } from "@/remote/activitypub/check-fetch.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { setResponseType } from "../activitypub.js"; +import type { FindOptionsWhere } from "typeorm"; +import type Router from "@koa/router"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/activitypub/outbox.ts b/packages/backend/src/server/activitypub/outbox.ts index a0262e614..e0a380ffb 100644 --- a/packages/backend/src/server/activitypub/outbox.ts +++ b/packages/backend/src/server/activitypub/outbox.ts @@ -1,20 +1,20 @@ +import { Brackets, IsNull } from "typeorm"; import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { Note } from "@/models/entities/note.js"; -import { Notes, Users } from "@/models/index.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; +import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import renderCreate from "@/remote/activitypub/renderer/create.js"; +import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; import { countIf } from "@/prelude/array.js"; import * as url from "@/prelude/url.js"; +import { Users, Notes } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; import { checkFetch } from "@/remote/activitypub/check-fetch.js"; -import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; -import renderCreate from "@/remote/activitypub/renderer/create.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; -import renderOrderedCollectionPage from "@/remote/activitypub/renderer/ordered-collection-page.js"; -import renderOrderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; -import type Router from "@koa/router"; -import { Brackets, IsNull } from "typeorm"; -import { setResponseType } from "../activitypub.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { makePaginationQuery } from "../api/common/make-pagination-query.js"; +import { setResponseType } from "../activitypub.js"; +import type Router from "@koa/router"; export default async (ctx: Router.RouterContext) => { const verify = await checkFetch(ctx.req); diff --git a/packages/backend/src/server/api/2fa.ts b/packages/backend/src/server/api/2fa.ts index 2fd2148c5..7318f0f43 100644 --- a/packages/backend/src/server/api/2fa.ts +++ b/packages/backend/src/server/api/2fa.ts @@ -1,6 +1,6 @@ import * as crypto from "node:crypto"; -import config from "@/config/index.js"; import * as jsrsasign from "jsrsasign"; +import config from "@/config/index.js"; const ECC_PRELUDE = Buffer.from([0x04]); const NULL_BYTE = Buffer.from([0]); diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 5c64e6a15..48a33dfc6 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -1,11 +1,11 @@ import type Koa from "koa"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import type { User } from "@/models/entities/user.js"; import { UserIps } from "@/models/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import type { IEndpoint } from "./endpoints.js"; import authenticate, { AuthenticationError } from "./authenticate.js"; import call from "./call.js"; -import type { IEndpoint } from "./endpoints.js"; import { ApiError } from "./error.js"; const userIpHistories = new Map>(); diff --git a/packages/backend/src/server/api/authenticate.ts b/packages/backend/src/server/api/authenticate.ts index 4267755c4..460a0ce84 100644 --- a/packages/backend/src/server/api/authenticate.ts +++ b/packages/backend/src/server/api/authenticate.ts @@ -1,13 +1,13 @@ -import { Cache } from "@/misc/cache.js"; -import type { AccessToken } from "@/models/entities/access-token.js"; -import type { App } from "@/models/entities/app.js"; +import isNativeToken from "./common/is-native-token.js"; import type { CacheableLocalUser, ILocalUser } from "@/models/entities/user.js"; -import { AccessTokens, Apps, Users } from "@/models/index.js"; +import { Users, AccessTokens, Apps } from "@/models/index.js"; +import type { AccessToken } from "@/models/entities/access-token.js"; +import { Cache } from "@/misc/cache.js"; +import type { App } from "@/models/entities/app.js"; import { localUserByIdCache, localUserByNativeTokenCache, } from "@/services/user-cache.js"; -import isNativeToken from "./common/is-native-token.js"; const appCache = new Cache("app", 60 * 30); diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index 5048e70af..2132edd0f 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -1,15 +1,15 @@ -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { getIpHash } from "@/misc/get-ip-hash.js"; -import type { AccessToken } from "@/models/entities/access-token.js"; -import type { CacheableLocalUser } from "@/models/entities/user.js"; -import type Koa from "koa"; import { performance } from "perf_hooks"; -import compatibility from "./compatibility.js"; +import type Koa from "koa"; +import type { CacheableLocalUser } from "@/models/entities/user.js"; +import type { AccessToken } from "@/models/entities/access-token.js"; +import { getIpHash } from "@/misc/get-ip-hash.js"; +import { limiter } from "./limiter.js"; import type { IEndpointMeta } from "./endpoints.js"; import endpoints from "./endpoints.js"; +import compatibility from "./compatibility.js"; import { ApiError } from "./error.js"; -import { limiter } from "./limiter.js"; import { apiLogger } from "./logger.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; const accessDenied = { message: "Access denied.", diff --git a/packages/backend/src/server/api/common/generate-muted-user-query.ts b/packages/backend/src/server/api/common/generate-muted-user-query.ts index 78db2078b..3538fbf0a 100644 --- a/packages/backend/src/server/api/common/generate-muted-user-query.ts +++ b/packages/backend/src/server/api/common/generate-muted-user-query.ts @@ -1,7 +1,7 @@ -import type { User } from "@/models/entities/user.js"; -import { Mutings, UserProfiles } from "@/models/index.js"; import type { SelectQueryBuilder } from "typeorm"; import { Brackets } from "typeorm"; +import type { User } from "@/models/entities/user.js"; +import { Mutings, UserProfiles } from "@/models/index.js"; export function generateMutedUserQuery( q: SelectQueryBuilder, diff --git a/packages/backend/src/server/api/common/generated-muted-renote-query.ts b/packages/backend/src/server/api/common/generated-muted-renote-query.ts index 3e26d4fa4..3fcd9b28e 100644 --- a/packages/backend/src/server/api/common/generated-muted-renote-query.ts +++ b/packages/backend/src/server/api/common/generated-muted-renote-query.ts @@ -1,6 +1,6 @@ +import { Brackets, SelectQueryBuilder } from "typeorm"; import { User } from "@/models/entities/user.js"; import { RenoteMutings } from "@/models/index.js"; -import { Brackets, SelectQueryBuilder } from "typeorm"; export function generateMutedUserRenotesQueryForNotes( q: SelectQueryBuilder, diff --git a/packages/backend/src/server/api/common/getters.ts b/packages/backend/src/server/api/common/getters.ts index 9849f7835..fd7580775 100644 --- a/packages/backend/src/server/api/common/getters.ts +++ b/packages/backend/src/server/api/common/getters.ts @@ -1,6 +1,6 @@ import { IdentifiableError } from "@/misc/identifiable-error.js"; -import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; import { Notes, Users } from "@/models/index.js"; import { generateVisibilityQuery } from "./generate-visibility-query.js"; diff --git a/packages/backend/src/server/api/common/inject-featured.ts b/packages/backend/src/server/api/common/inject-featured.ts index 3d5b08ad7..30ba3eca9 100644 --- a/packages/backend/src/server/api/common/inject-featured.ts +++ b/packages/backend/src/server/api/common/inject-featured.ts @@ -1,9 +1,9 @@ +import rndstr from "rndstr"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; -import { NoteReactions, Notes, UserProfiles } from "@/models/index.js"; -import rndstr from "rndstr"; -import { generateBlockedUserQuery } from "./generate-block-query.js"; +import { Notes, UserProfiles, NoteReactions } from "@/models/index.js"; import { generateMutedUserQuery } from "./generate-muted-user-query.js"; +import { generateBlockedUserQuery } from "./generate-block-query.js"; // TODO: リアクション、Renote、返信などをしたノートは除外する diff --git a/packages/backend/src/server/api/common/inject-promo.ts b/packages/backend/src/server/api/common/inject-promo.ts index 774542b96..dcc4e5f3f 100644 --- a/packages/backend/src/server/api/common/inject-promo.ts +++ b/packages/backend/src/server/api/common/inject-promo.ts @@ -1,7 +1,7 @@ +import rndstr from "rndstr"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; -import { Notes, PromoNotes, PromoReads, Users } from "@/models/index.js"; -import rndstr from "rndstr"; +import { PromoReads, PromoNotes, Notes, Users } from "@/models/index.js"; export async function injectPromo(timeline: Note[], user?: User | null) { if (timeline.length < 5) return; diff --git a/packages/backend/src/server/api/common/read-messaging-message.ts b/packages/backend/src/server/api/common/read-messaging-message.ts index 47391867c..fc22c843a 100644 --- a/packages/backend/src/server/api/common/read-messaging-message.ts +++ b/packages/backend/src/server/api/common/read-messaging-message.ts @@ -1,21 +1,21 @@ -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; -import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js"; -import { toArray } from "@/prelude/array.js"; -import { deliver } from "@/queue/index.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import orderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; -import { renderReadActivity } from "@/remote/activitypub/renderer/read.js"; -import { pushNotification } from "@/services/push-notification.js"; import { - publishGroupMessagingStream, publishMainStream, + publishGroupMessagingStream, } from "@/services/stream.js"; import { publishMessagingStream } from "@/services/stream.js"; import { publishMessagingIndexStream } from "@/services/stream.js"; +import { pushNotification } from "@/services/push-notification.js"; +import type { User, IRemoteUser } from "@/models/entities/user.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js"; import { In } from "typeorm"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import { toArray } from "@/prelude/array.js"; +import { renderReadActivity } from "@/remote/activitypub/renderer/read.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { deliver } from "@/queue/index.js"; +import orderedCollection from "@/remote/activitypub/renderer/ordered-collection.js"; /** * Mark messages as read diff --git a/packages/backend/src/server/api/common/read-notification.ts b/packages/backend/src/server/api/common/read-notification.ts index ab30c5bbd..1fb1d642f 100644 --- a/packages/backend/src/server/api/common/read-notification.ts +++ b/packages/backend/src/server/api/common/read-notification.ts @@ -1,9 +1,9 @@ -import type { Notification } from "@/models/entities/notification.js"; -import type { User } from "@/models/entities/user.js"; -import { Notifications, Users } from "@/models/index.js"; -import { pushNotification } from "@/services/push-notification.js"; -import { publishMainStream } from "@/services/stream.js"; import { In } from "typeorm"; +import { publishMainStream } from "@/services/stream.js"; +import { pushNotification } from "@/services/push-notification.js"; +import type { User } from "@/models/entities/user.js"; +import type { Notification } from "@/models/entities/notification.js"; +import { Notifications, Users } from "@/models/index.js"; export async function readNotification( userId: User["id"], diff --git a/packages/backend/src/server/api/common/signin.ts b/packages/backend/src/server/api/common/signin.ts index 478407deb..a8a435843 100644 --- a/packages/backend/src/server/api/common/signin.ts +++ b/packages/backend/src/server/api/common/signin.ts @@ -1,9 +1,9 @@ import type Koa from "koa"; import config from "@/config/index.js"; -import { genId } from "@/misc/gen-id.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { Signins } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; import { publishMainStream } from "@/services/stream.js"; export default function (ctx: Koa.Context, user: ILocalUser, redirect = false) { diff --git a/packages/backend/src/server/api/common/signup.ts b/packages/backend/src/server/api/common/signup.ts index 58b06efc5..6beae2c78 100644 --- a/packages/backend/src/server/api/common/signup.ts +++ b/packages/backend/src/server/api/common/signup.ts @@ -1,17 +1,17 @@ import { generateKeyPair } from "node:crypto"; -import config from "@/config/index.js"; -import { db } from "@/db/postgre.js"; -import { toPunyNullable } from "@/misc/convert-host.js"; -import { genId } from "@/misc/gen-id.js"; -import { hashPassword } from "@/misc/password.js"; -import { UsedUsername } from "@/models/entities/used-username.js"; -import { UserKeypair } from "@/models/entities/user-keypair.js"; -import { UserProfile } from "@/models/entities/user-profile.js"; -import { User } from "@/models/entities/user.js"; -import { UsedUsernames, Users } from "@/models/index.js"; -import { usersChart } from "@/services/chart/index.js"; -import { IsNull } from "typeorm"; import generateUserToken from "./generate-native-user-token.js"; +import { User } from "@/models/entities/user.js"; +import { Users, UsedUsernames } from "@/models/index.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { IsNull } from "typeorm"; +import { genId } from "@/misc/gen-id.js"; +import { toPunyNullable } from "@/misc/convert-host.js"; +import { UserKeypair } from "@/models/entities/user-keypair.js"; +import { usersChart } from "@/services/chart/index.js"; +import { UsedUsername } from "@/models/entities/used-username.js"; +import { db } from "@/db/postgre.js"; +import config from "@/config/index.js"; +import { hashPassword } from "@/misc/password.js"; export async function signup(opts: { username: User["username"]; diff --git a/packages/backend/src/server/api/define.ts b/packages/backend/src/server/api/define.ts index 83ba31c36..946f86a63 100644 --- a/packages/backend/src/server/api/define.ts +++ b/packages/backend/src/server/api/define.ts @@ -1,8 +1,8 @@ import * as fs from "node:fs"; +import Ajv from "ajv"; +import type { CacheableLocalUser } from "@/models/entities/user.js"; import type { Schema, SchemaType } from "@/misc/schema.js"; import type { AccessToken } from "@/models/entities/access-token.js"; -import type { CacheableLocalUser } from "@/models/entities/user.js"; -import Ajv from "ajv"; import type { IEndpointMeta } from "./endpoints.js"; import { ApiError } from "./error.js"; diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index f79ad01ff..8cc4fb2d7 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -1,5 +1,6 @@ import type { Schema } from "@/misc/schema.js"; +import * as ep___admin_meta from "./endpoints/admin/meta.js"; import * as ep___admin_abuseUserReports from "./endpoints/admin/abuse-user-reports.js"; import * as ep___admin_accounts_create from "./endpoints/admin/accounts/create.js"; import * as ep___admin_accounts_delete from "./endpoints/admin/accounts/delete.js"; @@ -12,11 +13,7 @@ import * as ep___admin_announcements_create from "./endpoints/admin/announcement import * as ep___admin_announcements_delete from "./endpoints/admin/announcements/delete.js"; import * as ep___admin_announcements_list from "./endpoints/admin/announcements/list.js"; import * as ep___admin_announcements_update from "./endpoints/admin/announcements/update.js"; -import * as ep___admin_delete2fa from "./endpoints/admin/delete-2fa.js"; -import * as ep___admin_deleteAccount from "./endpoints/admin/delete-account.js"; import * as ep___admin_deleteAllFilesOfAUser from "./endpoints/admin/delete-all-files-of-a-user.js"; -import * as ep___admin_deletePasskeys from "./endpoints/admin/delete-passkeys.js"; -import * as ep___admin_driveCapOverride from "./endpoints/admin/drive-capacity-override.js"; import * as ep___admin_drive_cleanRemoteFiles from "./endpoints/admin/drive/clean-remote-files.js"; import * as ep___admin_drive_cleanup from "./endpoints/admin/drive/cleanup.js"; import * as ep___admin_drive_files from "./endpoints/admin/drive/files.js"; @@ -42,7 +39,6 @@ import * as ep___admin_getIndexStats from "./endpoints/admin/get-index-stats.js" import * as ep___admin_getTableStats from "./endpoints/admin/get-table-stats.js"; import * as ep___admin_getUserIps from "./endpoints/admin/get-user-ips.js"; import * as ep___admin_invite from "./endpoints/admin/invite.js"; -import * as ep___admin_meta from "./endpoints/admin/meta.js"; import * as ep___admin_moderators_add from "./endpoints/admin/moderators/add.js"; import * as ep___admin_moderators_remove from "./endpoints/admin/moderators/remove.js"; import * as ep___admin_promo_create from "./endpoints/admin/promo/create.js"; @@ -67,8 +63,11 @@ import * as ep___admin_suspendUser from "./endpoints/admin/suspend-user.js"; import * as ep___admin_unsilenceUser from "./endpoints/admin/unsilence-user.js"; import * as ep___admin_unsuspendUser from "./endpoints/admin/unsuspend-user.js"; import * as ep___admin_updateMeta from "./endpoints/admin/update-meta.js"; -import * as ep___admin_updateUserNote from "./endpoints/admin/update-user-note.js"; import * as ep___admin_vacuum from "./endpoints/admin/vacuum.js"; +import * as ep___admin_deleteAccount from "./endpoints/admin/delete-account.js"; +import * as ep___admin_delete2fa from "./endpoints/admin/delete-2fa.js"; +import * as ep___admin_deletePasskeys from "./endpoints/admin/delete-passkeys.js"; +import * as ep___admin_updateUserNote from "./endpoints/admin/update-user-note.js"; import * as ep___announcements from "./endpoints/announcements.js"; import * as ep___antennas_create from "./endpoints/antennas/create.js"; import * as ep___antennas_delete from "./endpoints/antennas/delete.js"; @@ -111,20 +110,18 @@ import * as ep___charts_user_notes from "./endpoints/charts/user/notes.js"; import * as ep___charts_user_reactions from "./endpoints/charts/user/reactions.js"; import * as ep___charts_users from "./endpoints/charts/users.js"; import * as ep___clips_addNote from "./endpoints/clips/add-note.js"; +import * as ep___clips_removeNote from "./endpoints/clips/remove-note.js"; import * as ep___clips_create from "./endpoints/clips/create.js"; import * as ep___clips_delete from "./endpoints/clips/delete.js"; import * as ep___clips_list from "./endpoints/clips/list.js"; import * as ep___clips_notes from "./endpoints/clips/notes.js"; -import * as ep___clips_removeNote from "./endpoints/clips/remove-note.js"; import * as ep___clips_show from "./endpoints/clips/show.js"; import * as ep___clips_update from "./endpoints/clips/update.js"; -import * as ep___customMOTD from "./endpoints/custom-motd.js"; -import * as ep___customSplashIcons from "./endpoints/custom-splash-icons.js"; import * as ep___drive from "./endpoints/drive.js"; import * as ep___drive_files from "./endpoints/drive/files.js"; import * as ep___drive_files_attachedNotes from "./endpoints/drive/files/attached-notes.js"; -import * as ep___drive_files_captionImage from "./endpoints/drive/files/caption-image.js"; import * as ep___drive_files_checkExistence from "./endpoints/drive/files/check-existence.js"; +import * as ep___drive_files_captionImage from "./endpoints/drive/files/caption-image.js"; import * as ep___drive_files_create from "./endpoints/drive/files/create.js"; import * as ep___drive_files_delete from "./endpoints/drive/files/delete.js"; import * as ep___drive_files_findByHash from "./endpoints/drive/files/find-by-hash.js"; @@ -148,10 +145,9 @@ import * as ep___federation_followers from "./endpoints/federation/followers.js" import * as ep___federation_following from "./endpoints/federation/following.js"; import * as ep___federation_instances from "./endpoints/federation/instances.js"; import * as ep___federation_showInstance from "./endpoints/federation/show-instance.js"; -import * as ep___federation_stats from "./endpoints/federation/stats.js"; import * as ep___federation_updateRemoteUser from "./endpoints/federation/update-remote-user.js"; import * as ep___federation_users from "./endpoints/federation/users.js"; -import * as ep___fetchRss from "./endpoints/fetch-rss.js"; +import * as ep___federation_stats from "./endpoints/federation/stats.js"; import * as ep___following_create from "./endpoints/following/create.js"; import * as ep___following_delete from "./endpoints/following/delete.js"; import * as ep___following_invalidate from "./endpoints/following/invalidate.js"; @@ -169,7 +165,6 @@ import * as ep___gallery_posts_show from "./endpoints/gallery/posts/show.js"; import * as ep___gallery_posts_unlike from "./endpoints/gallery/posts/unlike.js"; import * as ep___gallery_posts_update from "./endpoints/gallery/posts/update.js"; import * as ep___getOnlineUsersCount from "./endpoints/get-online-users-count.js"; -import * as ep___sounds from "./endpoints/get-sounds.js"; import * as ep___hashtags_list from "./endpoints/hashtags/list.js"; import * as ep___hashtags_search from "./endpoints/hashtags/search.js"; import * as ep___hashtags_show from "./endpoints/hashtags/show.js"; @@ -181,9 +176,9 @@ import * as ep___i_2fa_keyDone from "./endpoints/i/2fa/key-done.js"; import * as ep___i_2fa_passwordLess from "./endpoints/i/2fa/password-less.js"; import * as ep___i_2fa_registerKey from "./endpoints/i/2fa/register-key.js"; import * as ep___i_2fa_register from "./endpoints/i/2fa/register.js"; +import * as ep___i_2fa_updateKey from "./endpoints/i/2fa/update-key.js"; import * as ep___i_2fa_removeKey from "./endpoints/i/2fa/remove-key.js"; import * as ep___i_2fa_unregister from "./endpoints/i/2fa/unregister.js"; -import * as ep___i_2fa_updateKey from "./endpoints/i/2fa/update-key.js"; import * as ep___i_apps from "./endpoints/i/apps.js"; import * as ep___i_authorizedApps from "./endpoints/i/authorized-apps.js"; import * as ep___i_changePassword from "./endpoints/i/change-password.js"; @@ -192,6 +187,7 @@ import * as ep___i_exportBlocking from "./endpoints/i/export-blocking.js"; import * as ep___i_exportFollowing from "./endpoints/i/export-following.js"; import * as ep___i_exportMute from "./endpoints/i/export-mute.js"; import * as ep___i_exportNotes from "./endpoints/i/export-notes.js"; +import * as ep___i_importPosts from "./endpoints/i/import-posts.js"; import * as ep___i_exportUserLists from "./endpoints/i/export-user-lists.js"; import * as ep___i_favorites from "./endpoints/i/favorites.js"; import * as ep___i_gallery_likes from "./endpoints/i/gallery/likes.js"; @@ -200,7 +196,6 @@ import * as ep___i_getWordMutedNotesCount from "./endpoints/i/get-word-muted-not import * as ep___i_importBlocking from "./endpoints/i/import-blocking.js"; import * as ep___i_importFollowing from "./endpoints/i/import-following.js"; import * as ep___i_importMuting from "./endpoints/i/import-muting.js"; -import * as ep___i_importPosts from "./endpoints/i/import-posts.js"; import * as ep___i_importUserLists from "./endpoints/i/import-user-lists.js"; import * as ep___i_notifications from "./endpoints/i/notifications.js"; import * as ep___i_pageLikes from "./endpoints/i/page-likes.js"; @@ -226,21 +221,24 @@ import * as ep___i_updateEmail from "./endpoints/i/update-email.js"; import * as ep___i_update from "./endpoints/i/update.js"; import * as ep___i_userGroupInvites from "./endpoints/i/user-group-invites.js"; import * as ep___i_webhooks_create from "./endpoints/i/webhooks/create.js"; -import * as ep___i_webhooks_delete from "./endpoints/i/webhooks/delete.js"; -import * as ep___i_webhooks_list from "./endpoints/i/webhooks/list.js"; import * as ep___i_webhooks_show from "./endpoints/i/webhooks/show.js"; +import * as ep___i_webhooks_list from "./endpoints/i/webhooks/list.js"; import * as ep___i_webhooks_update from "./endpoints/i/webhooks/update.js"; -import * as ep___latestVersion from "./endpoints/latest-version.js"; +import * as ep___i_webhooks_delete from "./endpoints/i/webhooks/delete.js"; import * as ep___messaging_history from "./endpoints/messaging/history.js"; import * as ep___messaging_messages from "./endpoints/messaging/messages.js"; import * as ep___messaging_messages_create from "./endpoints/messaging/messages/create.js"; import * as ep___messaging_messages_delete from "./endpoints/messaging/messages/delete.js"; import * as ep___messaging_messages_read from "./endpoints/messaging/messages/read.js"; import * as ep___meta from "./endpoints/meta.js"; +import * as ep___sounds from "./endpoints/get-sounds.js"; import * as ep___miauth_genToken from "./endpoints/miauth/gen-token.js"; import * as ep___mute_create from "./endpoints/mute/create.js"; import * as ep___mute_delete from "./endpoints/mute/delete.js"; import * as ep___mute_list from "./endpoints/mute/list.js"; +import * as ep___renote_mute_create from "./endpoints/renote-mute/create.js"; +import * as ep___renote_mute_delete from "./endpoints/renote-mute/delete.js"; +import * as ep___renote_mute_list from "./endpoints/renote-mute/list.js"; import * as ep___my_apps from "./endpoints/my/apps.js"; import * as ep___notes from "./endpoints/notes.js"; import * as ep___notes_children from "./endpoints/notes/children.js"; @@ -255,13 +253,13 @@ import * as ep___notes_featured from "./endpoints/notes/featured.js"; import * as ep___notes_globalTimeline from "./endpoints/notes/global-timeline.js"; import * as ep___notes_hybridTimeline from "./endpoints/notes/hybrid-timeline.js"; import * as ep___notes_localTimeline from "./endpoints/notes/local-timeline.js"; +import * as ep___notes_recommendedTimeline from "./endpoints/notes/recommended-timeline.js"; import * as ep___notes_mentions from "./endpoints/notes/mentions.js"; import * as ep___notes_polls_recommendation from "./endpoints/notes/polls/recommendation.js"; import * as ep___notes_polls_vote from "./endpoints/notes/polls/vote.js"; import * as ep___notes_reactions from "./endpoints/notes/reactions.js"; import * as ep___notes_reactions_create from "./endpoints/notes/reactions/create.js"; import * as ep___notes_reactions_delete from "./endpoints/notes/reactions/delete.js"; -import * as ep___notes_recommendedTimeline from "./endpoints/notes/recommended-timeline.js"; import * as ep___notes_renotes from "./endpoints/notes/renotes.js"; import * as ep___notes_replies from "./endpoints/notes/replies.js"; import * as ep___notes_searchByTag from "./endpoints/notes/search-by-tag.js"; @@ -287,24 +285,24 @@ import * as ep___pages_like from "./endpoints/pages/like.js"; import * as ep___pages_show from "./endpoints/pages/show.js"; import * as ep___pages_unlike from "./endpoints/pages/unlike.js"; import * as ep___pages_update from "./endpoints/pages/update.js"; -import * as ep___patrons from "./endpoints/patrons.js"; import * as ep___ping from "./endpoints/ping.js"; -import * as ep___pinnedUsers from "./endpoints/pinned-users.js"; -import * as ep___promo_read from "./endpoints/promo/read.js"; import * as ep___recommendedInstances from "./endpoints/recommended-instances.js"; +import * as ep___pinnedUsers from "./endpoints/pinned-users.js"; +import * as ep___customMOTD from "./endpoints/custom-motd.js"; +import * as ep___customSplashIcons from "./endpoints/custom-splash-icons.js"; +import * as ep___latestVersion from "./endpoints/latest-version.js"; +import * as ep___patrons from "./endpoints/patrons.js"; import * as ep___release from "./endpoints/release.js"; -import * as ep___renote_mute_create from "./endpoints/renote-mute/create.js"; -import * as ep___renote_mute_delete from "./endpoints/renote-mute/delete.js"; -import * as ep___renote_mute_list from "./endpoints/renote-mute/list.js"; +import * as ep___promo_read from "./endpoints/promo/read.js"; import * as ep___requestResetPassword from "./endpoints/request-reset-password.js"; import * as ep___resetDb from "./endpoints/reset-db.js"; import * as ep___resetPassword from "./endpoints/reset-password.js"; import * as ep___serverInfo from "./endpoints/server-info.js"; import * as ep___stats from "./endpoints/stats.js"; -import * as ep___sw_register from "./endpoints/sw/register.js"; import * as ep___sw_show_registration from "./endpoints/sw/show-registration.js"; -import * as ep___sw_unregister from "./endpoints/sw/unregister.js"; import * as ep___sw_update_registration from "./endpoints/sw/update-registration.js"; +import * as ep___sw_register from "./endpoints/sw/register.js"; +import * as ep___sw_unregister from "./endpoints/sw/unregister.js"; import * as ep___test from "./endpoints/test.js"; import * as ep___username_available from "./endpoints/username/available.js"; import * as ep___users from "./endpoints/users.js"; @@ -326,8 +324,8 @@ import * as ep___users_groups_show from "./endpoints/users/groups/show.js"; import * as ep___users_groups_transfer from "./endpoints/users/groups/transfer.js"; import * as ep___users_groups_update from "./endpoints/users/groups/update.js"; import * as ep___users_lists_create from "./endpoints/users/lists/create.js"; -import * as ep___users_lists_delete_all from "./endpoints/users/lists/delete-all.js"; import * as ep___users_lists_delete from "./endpoints/users/lists/delete.js"; +import * as ep___users_lists_delete_all from "./endpoints/users/lists/delete-all.js"; import * as ep___users_lists_list from "./endpoints/users/lists/list.js"; import * as ep___users_lists_pull from "./endpoints/users/lists/pull.js"; import * as ep___users_lists_push from "./endpoints/users/lists/push.js"; @@ -343,10 +341,12 @@ import * as ep___users_searchByUsernameAndHost from "./endpoints/users/search-by import * as ep___users_search from "./endpoints/users/search.js"; import * as ep___users_show from "./endpoints/users/show.js"; import * as ep___users_stats from "./endpoints/users/stats.js"; +import * as ep___fetchRss from "./endpoints/fetch-rss.js"; +import * as ep___admin_driveCapOverride from "./endpoints/admin/drive-capacity-override.js"; -import * as ep___i_known_as from "./endpoints/i/known-as.js"; //Firefish Move import * as ep___i_move from "./endpoints/i/move.js"; +import * as ep___i_known_as from "./endpoints/i/known-as.js"; const eps = [ ["admin/meta", ep___admin_meta], diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index c2ff716c9..78034917f 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { AbuseUserReports } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index a75c9b5f9..e5972173c 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; import { signup } from "@/server/api/common/signup.js"; -import define from "@/server/api/define.js"; import { IsNull } from "typeorm"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts index b912ad6ad..423518083 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/delete.ts @@ -1,8 +1,8 @@ -import { Users } from "@/models/index.js"; -import { createDeleteAccountJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; -import { publishUserEvent } from "@/services/stream.js"; +import { Users } from "@/models/index.js"; import { doPostSuspend } from "@/services/suspend-user.js"; +import { publishUserEvent } from "@/services/stream.js"; +import { createDeleteAccountJob } from "@/queue/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts b/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts index f69878864..601cd9500 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/hosted.ts @@ -1,8 +1,8 @@ import config from "@/config/index.js"; -import { db } from "@/db/postgre.js"; import { Meta } from "@/models/entities/meta.js"; -import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { db } from "@/db/postgre.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index cd23afd83..bfe4d5446 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -1,6 +1,6 @@ -import { genId } from "@/misc/gen-id.js"; -import { Ads } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Ads } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts index 3ebb88041..802eb5ef6 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/delete.ts @@ -1,5 +1,5 @@ -import { Ads } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Ads } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 14c3f6ce6..1f39e73e5 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Ads } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index d1c5bb3ba..52f31a3ce 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -1,5 +1,5 @@ -import { Ads } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Ads } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts index 611f7de6f..8af778486 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts @@ -1,6 +1,6 @@ -import { genId } from "@/misc/gen-id.js"; -import { Announcements } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Announcements } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts index b847c246f..8b2326cda 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/delete.ts @@ -1,5 +1,5 @@ -import { Announcements } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Announcements } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index f1da1a301..a13fabd60 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -1,7 +1,7 @@ +import { Announcements, AnnouncementReads } from "@/models/index.js"; import type { Announcement } from "@/models/entities/announcement.js"; -import { AnnouncementReads, Announcements } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts index 32cef004e..03af41473 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/update.ts @@ -1,5 +1,5 @@ -import { Announcements } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Announcements } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts b/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts index 38e8f0dcd..1cf60d9c5 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-2fa.ts @@ -1,6 +1,6 @@ -import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; +import { Users, UserProfiles } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/delete-account.ts b/packages/backend/src/server/api/endpoints/admin/delete-account.ts index 2decb30d5..1b6dc31a2 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-account.ts @@ -1,6 +1,6 @@ import { Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { deleteAccount } from "@/services/delete-account.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 0dd52068d..b52f60980 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -1,6 +1,6 @@ -import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { deleteFile } from "@/services/drive/delete-file.js"; +import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts b/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts index 773aa698b..7a54f5d99 100644 --- a/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts +++ b/packages/backend/src/server/api/endpoints/admin/delete-passkeys.ts @@ -1,6 +1,6 @@ -import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; +import { Users, UserProfiles, UserSecurityKeys } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts b/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts index 2f7e2db0e..d4bb3045c 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive-capacity-override.ts @@ -1,5 +1,5 @@ -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 11fce08f2..84c04793e 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -1,5 +1,5 @@ -import { createCleanRemoteFilesJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createCleanRemoteFilesJob } from "@/queue/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts index 8ba8ae29c..e56c027ff 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/cleanup.ts @@ -1,7 +1,7 @@ -import { DriveFiles } from "@/models/index.js"; +import { IsNull } from "typeorm"; import define from "@/server/api/define.js"; import { deleteFile } from "@/services/drive/delete-file.js"; -import { IsNull } from "typeorm"; +import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index 861c7bc96..e068f1dc9 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -1,6 +1,6 @@ import { DriveFiles } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts index 1684a42b5..02b3877b8 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add-aliases-bulk.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { In } from "typeorm"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts index 2e84cd4d5..8d156e6f7 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/add.ts @@ -1,12 +1,12 @@ +import define from "@/server/api/define.js"; +import { Emojis, DriveFiles } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { ApiError } from "@/server/api/error.js"; +import rndstr from "rndstr"; +import { publishBroadcastStream } from "@/services/stream.js"; import { db } from "@/db/postgre.js"; import { getEmojiSize } from "@/misc/emoji-meta.js"; -import { genId } from "@/misc/gen-id.js"; -import { DriveFiles, Emojis } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { publishBroadcastStream } from "@/services/stream.js"; -import rndstr from "rndstr"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index 80ffd5cdf..29b1d8212 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -1,12 +1,12 @@ -import { db } from "@/db/postgre.js"; -import { getEmojiSize } from "@/misc/emoji-meta.js"; -import { genId } from "@/misc/gen-id.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; import { ApiError } from "@/server/api/error.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; import { publishBroadcastStream } from "@/services/stream.js"; +import { db } from "@/db/postgre.js"; +import { getEmojiSize } from "@/misc/emoji-meta.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts index 2c78fb67c..a5c4c8bcc 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete-bulk.ts @@ -1,8 +1,8 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { Emojis } from "@/models/index.js"; import { In } from "typeorm"; +import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts index d71791822..726f90396 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/delete.ts @@ -1,8 +1,8 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; +import { Emojis } from "@/models/index.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { ApiError } from "@/server/api/error.js"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts index 70d17c7dd..4b49e45dd 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/import-zip.ts @@ -1,5 +1,5 @@ -import { createImportCustomEmojisJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createImportCustomEmojisJob } from "@/queue/index.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index 303865059..c6246c48c 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -1,8 +1,8 @@ -import { toPuny } from "@/misc/convert-host.js"; -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import { Emojis } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; +import { toPuny } from "@/misc/convert-host.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 3dcc20434..12de0b181 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -1,7 +1,7 @@ -import type { Emoji } from "@/models/entities/emoji.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { makePaginationQuery } from "../../../common/make-pagination-query.js"; +import type { Emoji } from "@/models/entities/emoji.js"; //import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts index 41d56dfba..49d31805f 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/remove-aliases-bulk.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { In } from "typeorm"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts index d292c5066..72d7fab80 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-aliases-bulk.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { In } from "typeorm"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts index de78bab8e..89e68aa4c 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-category-bulk.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { In } from "typeorm"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts index a8ebda961..e4500e02a 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/set-license-bulk.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { In } from "typeorm"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts index 2d79918be..6fedf8620 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/update.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; -import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Emojis } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts index 714cbc46f..d1a7fb695 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -1,6 +1,6 @@ -import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { deleteFile } from "@/services/drive/delete-file.js"; +import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index 9127df49a..bf71cd250 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -1,6 +1,6 @@ -import { toPuny } from "@/misc/convert-host.js"; -import { Instances } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Instances } from "@/models/index.js"; +import { toPuny } from "@/misc/convert-host.js"; import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index ffd8ec67f..a2ce44bd5 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -1,6 +1,6 @@ -import { Followings, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import deleteFollowing from "@/services/following/delete.js"; +import { Followings, Users } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts index 7893cb403..653d187c2 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts @@ -1,6 +1,6 @@ -import { toPuny } from "@/misc/convert-host.js"; -import { Instances } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Instances } from "@/models/index.js"; +import { toPuny } from "@/misc/convert-host.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts index f50697a41..98f1f024b 100644 --- a/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts @@ -1,5 +1,5 @@ -import { db } from "@/db/postgre.js"; import define from "@/server/api/define.js"; +import { db } from "@/db/postgre.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/admin/invite.ts b/packages/backend/src/server/api/endpoints/admin/invite.ts index ce543719c..ebc523d41 100644 --- a/packages/backend/src/server/api/endpoints/admin/invite.ts +++ b/packages/backend/src/server/api/endpoints/admin/invite.ts @@ -1,7 +1,7 @@ -import { genId } from "@/misc/gen-id.js"; -import { RegistrationTickets } from "@/models/index.js"; -import define from "@/server/api/define.js"; import rndstr from "rndstr"; +import define from "@/server/api/define.js"; +import { RegistrationTickets } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 64fd38eeb..6f23ef181 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -1,6 +1,6 @@ import config from "@/config/index.js"; -import { MAX_CAPTION_TEXT_LENGTH, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts index a4b90cacc..c8b53088c 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/add.ts @@ -1,5 +1,5 @@ -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts index 6e4dadb9d..e2af1ca37 100644 --- a/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts +++ b/packages/backend/src/server/api/endpoints/admin/moderators/remove.ts @@ -1,5 +1,5 @@ -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/promo/create.ts b/packages/backend/src/server/api/endpoints/admin/promo/create.ts index e93c66599..55038fc89 100644 --- a/packages/backend/src/server/api/endpoints/admin/promo/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/promo/create.ts @@ -1,7 +1,7 @@ -import { PromoNotes } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { PromoNotes } from "@/models/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts index 9d83eda46..9895f34b4 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/clear.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/clear.ts @@ -1,5 +1,5 @@ -import { destroy } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { destroy } from "@/queue/index.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts index 8222b067b..ea8c50569 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -1,5 +1,5 @@ -import { URL } from "node:url"; import { deliverQueue } from "@/queue/queues.js"; +import { URL } from "node:url"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts index bfa2bb08c..d4f44e307 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -1,6 +1,6 @@ import { URL } from "node:url"; -import { inboxQueue } from "@/queue/queues.js"; import define from "@/server/api/define.js"; +import { inboxQueue } from "@/queue/queues.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts index c8459d807..f51c1e6d4 100644 --- a/packages/backend/src/server/api/endpoints/admin/queue/stats.ts +++ b/packages/backend/src/server/api/endpoints/admin/queue/stats.ts @@ -1,9 +1,9 @@ import { - backgroundQueue, - dbQueue, deliverQueue, inboxQueue, + dbQueue, objectStorageQueue, + backgroundQueue, } from "@/queue/queues.js"; import define from "@/server/api/define.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/relays/add.ts b/packages/backend/src/server/api/endpoints/admin/relays/add.ts index 16272e4a8..ac0084860 100644 --- a/packages/backend/src/server/api/endpoints/admin/relays/add.ts +++ b/packages/backend/src/server/api/endpoints/admin/relays/add.ts @@ -1,7 +1,7 @@ import { URL } from "node:url"; import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { addRelay } from "@/services/relay.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/reset-password.ts b/packages/backend/src/server/api/endpoints/admin/reset-password.ts index 245945dd4..5fbed130e 100644 --- a/packages/backend/src/server/api/endpoints/admin/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/admin/reset-password.ts @@ -1,8 +1,8 @@ -import { hashPassword } from "@/misc/password.js"; -import { UserProfiles, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; // import bcrypt from "bcryptjs"; import rndstr from "rndstr"; +import { Users, UserProfiles } from "@/models/index.js"; +import { hashPassword } from "@/misc/password.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index ae2b5c952..a94687cf4 100644 --- a/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/packages/backend/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -1,9 +1,9 @@ -import { AbuseUserReports, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import { renderFlag } from "@/remote/activitypub/renderer/flag.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import define from "@/server/api/define.js"; +import { AbuseUserReports, Users } from "@/models/index.js"; import { getInstanceActor } from "@/services/instance-actor.js"; +import { deliver } from "@/queue/index.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { renderFlag } from "@/remote/activitypub/renderer/flag.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/search/index-all.ts b/packages/backend/src/server/api/endpoints/admin/search/index-all.ts index 065fa04b8..531428849 100644 --- a/packages/backend/src/server/api/endpoints/admin/search/index-all.ts +++ b/packages/backend/src/server/api/endpoints/admin/search/index-all.ts @@ -1,5 +1,5 @@ -import { createIndexAllNotesJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createIndexAllNotesJob } from "@/queue/index.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts b/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts index 2c532af46..5dcbaf2e8 100644 --- a/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts +++ b/packages/backend/src/server/api/endpoints/admin/send-mod-mail.ts @@ -1,9 +1,9 @@ -import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { createNotification } from "@/services/create-notification.js"; -import { sendEmail } from "@/services/send-email.js"; import sanitizeHtml from "sanitize-html"; +import define from "@/server/api/define.js"; +import { Users, UserProfiles } from "@/models/index.js"; +import { ApiError } from "@/server/api/error.js"; +import { sendEmail } from "@/services/send-email.js"; +import { createNotification } from "@/services/create-notification.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/admin/server-info.ts b/packages/backend/src/server/api/endpoints/admin/server-info.ts index 002d590dd..ff4691969 100644 --- a/packages/backend/src/server/api/endpoints/admin/server-info.ts +++ b/packages/backend/src/server/api/endpoints/admin/server-info.ts @@ -1,8 +1,8 @@ import * as os from "node:os"; -import { db } from "@/db/postgre.js"; -import { redisClient } from "@/db/redis.js"; -import define from "@/server/api/define.js"; import si from "systeminformation"; +import define from "@/server/api/define.js"; +import { redisClient } from "@/db/redis.js"; +import { db } from "@/db/postgre.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index ed8c67617..adceda416 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { ModerationLogs } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index 9997db04a..1e6ebeda9 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -1,6 +1,6 @@ -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/silence-user.ts b/packages/backend/src/server/api/endpoints/admin/silence-user.ts index 758fa8034..8d9dcac68 100644 --- a/packages/backend/src/server/api/endpoints/admin/silence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/silence-user.ts @@ -1,5 +1,5 @@ -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { publishInternalEvent } from "@/services/stream.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 600fe0856..c6d6f47bc 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -1,10 +1,10 @@ -import type { User } from "@/models/entities/user.js"; -import { Followings, Notifications, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import deleteFollowing from "@/services/following/delete.js"; +import { Users, Followings, Notifications } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { publishUserEvent } from "@/services/stream.js"; import { doPostSuspend } from "@/services/suspend-user.js"; +import { publishUserEvent } from "@/services/stream.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts index 0e6ea19f0..6592bf443 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsilence-user.ts @@ -1,5 +1,5 @@ -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { publishInternalEvent } from "@/services/stream.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts index bf0a709a3..3289fb570 100644 --- a/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/unsuspend-user.ts @@ -1,5 +1,5 @@ -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; import { doPostUnsuspend } from "@/services/unsuspend-user.js"; diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 47786bae2..422cf49f7 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -1,7 +1,7 @@ -import { db } from "@/db/postgre.js"; import { Meta } from "@/models/entities/meta.js"; -import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { db } from "@/db/postgre.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/admin/vacuum.ts b/packages/backend/src/server/api/endpoints/admin/vacuum.ts index 3a3ba3522..d5b086bb4 100644 --- a/packages/backend/src/server/api/endpoints/admin/vacuum.ts +++ b/packages/backend/src/server/api/endpoints/admin/vacuum.ts @@ -1,6 +1,6 @@ -import { db } from "@/db/postgre.js"; import define from "@/server/api/define.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; +import { db } from "@/db/postgre.js"; export const meta = { tags: ["admin"], diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index bc2f197b7..504eb30e2 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -1,6 +1,6 @@ -import { AnnouncementReads, Announcements } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { Announcements, AnnouncementReads } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index 52ed62825..46df3aa81 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -1,6 +1,6 @@ -import { genId } from "@/misc/gen-id.js"; -import { Antennas, UserGroupJoinings, UserLists } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { genId } from "@/misc/gen-id.js"; +import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; import { publishInternalEvent } from "@/services/stream.js"; diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index e2380f23b..e5a372f19 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -1,6 +1,6 @@ -import { Antennas } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Antennas } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/antennas/list.ts b/packages/backend/src/server/api/endpoints/antennas/list.ts index 91ef9942b..2726ecc8f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/list.ts +++ b/packages/backend/src/server/api/endpoints/antennas/list.ts @@ -1,5 +1,5 @@ -import { Antennas } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Antennas } from "@/models/index.js"; export const meta = { tags: ["antennas", "account"], diff --git a/packages/backend/src/server/api/endpoints/antennas/markread.ts b/packages/backend/src/server/api/endpoints/antennas/markread.ts index f552f3450..bb5b5b77f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/markread.ts +++ b/packages/backend/src/server/api/endpoints/antennas/markread.ts @@ -1,5 +1,5 @@ -import { Antennas } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Antennas } from "@/models/index.js"; export const meta = { tags: ["antennas", "account"], diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index d57534681..1512cb928 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -1,13 +1,13 @@ +import define from "@/server/api/define.js"; +import readNote from "@/services/note/read.js"; +import { Antennas, Notes } from "@/models/index.js"; import { redisClient } from "@/db/redis.js"; import { getTimestamp } from "@/misc/gen-id.js"; -import { Antennas, Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { ApiError } from "@/server/api/error.js"; -import readNote from "@/services/note/read.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["antennas", "account", "notes"], diff --git a/packages/backend/src/server/api/endpoints/antennas/show.ts b/packages/backend/src/server/api/endpoints/antennas/show.ts index c7f8e99cd..3700052f5 100644 --- a/packages/backend/src/server/api/endpoints/antennas/show.ts +++ b/packages/backend/src/server/api/endpoints/antennas/show.ts @@ -1,6 +1,6 @@ -import { Antennas } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Antennas } from "@/models/index.js"; export const meta = { tags: ["antennas", "account"], diff --git a/packages/backend/src/server/api/endpoints/antennas/update.ts b/packages/backend/src/server/api/endpoints/antennas/update.ts index a94607617..9a71a8f9f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/update.ts +++ b/packages/backend/src/server/api/endpoints/antennas/update.ts @@ -1,6 +1,6 @@ -import { Antennas, UserGroupJoinings, UserLists } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Antennas, UserLists, UserGroupJoinings } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index 3d2cceb4b..5159ce3b4 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -1,6 +1,6 @@ -import { HOUR } from "@/const.js"; -import Resolver from "@/remote/activitypub/resolver.js"; import define from "@/server/api/define.js"; +import Resolver from "@/remote/activitypub/resolver.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index e3ffc7fa2..50eb7e9c6 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -1,20 +1,20 @@ -import { MINUTE } from "@/const.js"; -import { redisClient } from "@/db/redis.js"; +import define from "@/server/api/define.js"; +import { createPerson } from "@/remote/activitypub/models/person.js"; +import { createNote } from "@/remote/activitypub/models/note.js"; +import DbResolver from "@/remote/activitypub/db-resolver.js"; +import Resolver from "@/remote/activitypub/resolver.js"; +import { ApiError } from "@/server/api/error.js"; import { extractDbHost } from "@/misc/convert-host.js"; -import type { SchemaType } from "@/misc/schema.js"; -import { shouldBlockInstance } from "@/misc/should-block-instance.js"; +import { Users, Notes } from "@/models/index.js"; import type { Note } from "@/models/entities/note.js"; import type { CacheableLocalUser, User } from "@/models/entities/user.js"; -import { Notes, Users } from "@/models/index.js"; -import { populatePoll } from "@/models/repositories/note.js"; -import DbResolver from "@/remote/activitypub/db-resolver.js"; -import { createNote } from "@/remote/activitypub/models/note.js"; -import { createPerson } from "@/remote/activitypub/models/person.js"; +import { isActor, isPost, getApId } from "@/remote/activitypub/type.js"; +import type { SchemaType } from "@/misc/schema.js"; +import { MINUTE } from "@/const.js"; +import { shouldBlockInstance } from "@/misc/should-block-instance.js"; import { updateQuestion } from "@/remote/activitypub/models/question.js"; -import Resolver from "@/remote/activitypub/resolver.js"; -import { getApId, isActor, isPost } from "@/remote/activitypub/type.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; +import { populatePoll } from "@/models/repositories/note.js"; +import { redisClient } from "@/db/redis.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/app/create.ts b/packages/backend/src/server/api/endpoints/app/create.ts index 82e037540..e32edf129 100644 --- a/packages/backend/src/server/api/endpoints/app/create.ts +++ b/packages/backend/src/server/api/endpoints/app/create.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; -import { secureRndstr } from "@/misc/secure-rndstr.js"; -import { Apps } from "@/models/index.js"; -import { unique } from "@/prelude/array.js"; import define from "@/server/api/define.js"; +import { Apps } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { unique } from "@/prelude/array.js"; +import { secureRndstr } from "@/misc/secure-rndstr.js"; export const meta = { tags: ["app"], diff --git a/packages/backend/src/server/api/endpoints/app/show.ts b/packages/backend/src/server/api/endpoints/app/show.ts index 5cd17cb40..d6f38428c 100644 --- a/packages/backend/src/server/api/endpoints/app/show.ts +++ b/packages/backend/src/server/api/endpoints/app/show.ts @@ -1,6 +1,6 @@ -import { Apps } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Apps } from "@/models/index.js"; export const meta = { tags: ["app"], diff --git a/packages/backend/src/server/api/endpoints/auth/accept.ts b/packages/backend/src/server/api/endpoints/auth/accept.ts index 40b9841aa..088de7863 100644 --- a/packages/backend/src/server/api/endpoints/auth/accept.ts +++ b/packages/backend/src/server/api/endpoints/auth/accept.ts @@ -1,9 +1,9 @@ import * as crypto from "node:crypto"; -import { genId } from "@/misc/gen-id.js"; -import { secureRndstr } from "@/misc/secure-rndstr.js"; -import { AccessTokens, Apps, AuthSessions } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { AuthSessions, AccessTokens, Apps } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { secureRndstr } from "@/misc/secure-rndstr.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/auth/session/generate.ts b/packages/backend/src/server/api/endpoints/auth/session/generate.ts index b95256eba..bd1721104 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/generate.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/generate.ts @@ -1,9 +1,9 @@ +import { v4 as uuid } from "uuid"; import config from "@/config/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { Apps, AuthSessions } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { v4 as uuid } from "uuid"; +import { Apps, AuthSessions } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/auth/session/show.ts b/packages/backend/src/server/api/endpoints/auth/session/show.ts index 4e511d50d..70c6d54cd 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/show.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/show.ts @@ -1,6 +1,6 @@ -import { AuthSessions } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { AuthSessions } from "@/models/index.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts index ab17f7822..394681516 100644 --- a/packages/backend/src/server/api/endpoints/auth/session/userkey.ts +++ b/packages/backend/src/server/api/endpoints/auth/session/userkey.ts @@ -1,6 +1,6 @@ -import { AccessTokens, Apps, AuthSessions, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Apps, AuthSessions, AccessTokens, Users } from "@/models/index.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/blocking/create.ts b/packages/backend/src/server/api/endpoints/blocking/create.ts index bbf941aea..50154dd6c 100644 --- a/packages/backend/src/server/api/endpoints/blocking/create.ts +++ b/packages/backend/src/server/api/endpoints/blocking/create.ts @@ -1,9 +1,9 @@ -import { HOUR } from "@/const.js"; -import { Blockings, NoteWatchings, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import create from "@/services/blocking/create.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import create from "@/services/blocking/create.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Blockings, NoteWatchings, Users } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/blocking/delete.ts b/packages/backend/src/server/api/endpoints/blocking/delete.ts index 6f23bba2c..addf4bbd1 100644 --- a/packages/backend/src/server/api/endpoints/blocking/delete.ts +++ b/packages/backend/src/server/api/endpoints/blocking/delete.ts @@ -1,9 +1,9 @@ -import { HOUR } from "@/const.js"; -import { Blockings, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import deleteBlocking from "@/services/blocking/delete.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import deleteBlocking from "@/services/blocking/delete.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Blockings, Users } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index cd04b20ea..6f51a6458 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Blockings } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index 18630846e..177492ed2 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; -import type { Channel } from "@/models/entities/channel.js"; -import { Channels, DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Channels, DriveFiles } from "@/models/index.js"; +import type { Channel } from "@/models/entities/channel.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index b5fb5e20d..e0575af26 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -1,5 +1,5 @@ -import { Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Channels } from "@/models/index.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/follow.ts b/packages/backend/src/server/api/endpoints/channels/follow.ts index 4debfb081..878339827 100644 --- a/packages/backend/src/server/api/endpoints/channels/follow.ts +++ b/packages/backend/src/server/api/endpoints/channels/follow.ts @@ -1,7 +1,7 @@ -import { genId } from "@/misc/gen-id.js"; -import { ChannelFollowings, Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Channels, ChannelFollowings } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index 524952c61..94374f6be 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -1,5 +1,5 @@ -import { ChannelFollowings, Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Channels, ChannelFollowings } from "@/models/index.js"; export const meta = { tags: ["channels", "account"], diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index c1e969df8..23607b024 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Channels } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["channels", "account"], diff --git a/packages/backend/src/server/api/endpoints/channels/search.ts b/packages/backend/src/server/api/endpoints/channels/search.ts index f6e0f4d27..b2fab701c 100644 --- a/packages/backend/src/server/api/endpoints/channels/search.ts +++ b/packages/backend/src/server/api/endpoints/channels/search.ts @@ -1,8 +1,8 @@ -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import { Channels } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { Brackets } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { Channels } from "@/models/index.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/show.ts b/packages/backend/src/server/api/endpoints/channels/show.ts index cf1d32ada..c5c1b6577 100644 --- a/packages/backend/src/server/api/endpoints/channels/show.ts +++ b/packages/backend/src/server/api/endpoints/channels/show.ts @@ -1,6 +1,6 @@ -import { Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Channels } from "@/models/index.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index 93c28be22..f061acab0 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -1,7 +1,7 @@ -import { Channels, Notes } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Notes, Channels } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { activeUsersChart } from "@/services/chart/index.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/channels/unfollow.ts b/packages/backend/src/server/api/endpoints/channels/unfollow.ts index 4a7a8f073..337100039 100644 --- a/packages/backend/src/server/api/endpoints/channels/unfollow.ts +++ b/packages/backend/src/server/api/endpoints/channels/unfollow.ts @@ -1,6 +1,6 @@ -import { ChannelFollowings, Channels } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Channels, ChannelFollowings } from "@/models/index.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/channels/update.ts b/packages/backend/src/server/api/endpoints/channels/update.ts index bdd29488d..0de7a837a 100644 --- a/packages/backend/src/server/api/endpoints/channels/update.ts +++ b/packages/backend/src/server/api/endpoints/channels/update.ts @@ -1,6 +1,6 @@ -import { Channels, DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Channels, DriveFiles } from "@/models/index.js"; export const meta = { tags: ["channels"], diff --git a/packages/backend/src/server/api/endpoints/charts/active-users.ts b/packages/backend/src/server/api/endpoints/charts/active-users.ts index 7e705d24b..d5c3c4eb8 100644 --- a/packages/backend/src/server/api/endpoints/charts/active-users.ts +++ b/packages/backend/src/server/api/endpoints/charts/active-users.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { activeUsersChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users"], diff --git a/packages/backend/src/server/api/endpoints/charts/ap-request.ts b/packages/backend/src/server/api/endpoints/charts/ap-request.ts index c4450d54d..bbf72030a 100644 --- a/packages/backend/src/server/api/endpoints/charts/ap-request.ts +++ b/packages/backend/src/server/api/endpoints/charts/ap-request.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { apRequestChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts"], diff --git a/packages/backend/src/server/api/endpoints/charts/drive.ts b/packages/backend/src/server/api/endpoints/charts/drive.ts index 0d772fc54..0a5354743 100644 --- a/packages/backend/src/server/api/endpoints/charts/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/drive.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { driveChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "drive"], diff --git a/packages/backend/src/server/api/endpoints/charts/federation.ts b/packages/backend/src/server/api/endpoints/charts/federation.ts index 29ba32160..f9c75d5ec 100644 --- a/packages/backend/src/server/api/endpoints/charts/federation.ts +++ b/packages/backend/src/server/api/endpoints/charts/federation.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { federationChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts"], diff --git a/packages/backend/src/server/api/endpoints/charts/hashtag.ts b/packages/backend/src/server/api/endpoints/charts/hashtag.ts index 28826e187..bbd1b70b0 100644 --- a/packages/backend/src/server/api/endpoints/charts/hashtag.ts +++ b/packages/backend/src/server/api/endpoints/charts/hashtag.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { hashtagChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "hashtags"], diff --git a/packages/backend/src/server/api/endpoints/charts/instance.ts b/packages/backend/src/server/api/endpoints/charts/instance.ts index da3cc7186..4d746ec0b 100644 --- a/packages/backend/src/server/api/endpoints/charts/instance.ts +++ b/packages/backend/src/server/api/endpoints/charts/instance.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { instanceChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts"], diff --git a/packages/backend/src/server/api/endpoints/charts/notes.ts b/packages/backend/src/server/api/endpoints/charts/notes.ts index ca8cd2a97..b2a1b93fd 100644 --- a/packages/backend/src/server/api/endpoints/charts/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/notes.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { notesChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "notes"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/drive.ts b/packages/backend/src/server/api/endpoints/charts/user/drive.ts index a1796f699..c2745c860 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/drive.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/drive.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserDriveChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "drive", "users"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/notes.ts b/packages/backend/src/server/api/endpoints/charts/user/notes.ts index bffd38a1e..4a398d4dd 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/notes.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/notes.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserNotesChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users", "notes"], diff --git a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts index a99952cdc..fc75d40ba 100644 --- a/packages/backend/src/server/api/endpoints/charts/user/reactions.ts +++ b/packages/backend/src/server/api/endpoints/charts/user/reactions.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { perUserReactionsChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users", "reactions"], diff --git a/packages/backend/src/server/api/endpoints/charts/users.ts b/packages/backend/src/server/api/endpoints/charts/users.ts index 882579455..0dc5f3580 100644 --- a/packages/backend/src/server/api/endpoints/charts/users.ts +++ b/packages/backend/src/server/api/endpoints/charts/users.ts @@ -1,6 +1,6 @@ -import define from "@/server/api/define.js"; import { getJsonSchema } from "@/services/chart/core.js"; import { usersChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["charts", "users"], diff --git a/packages/backend/src/server/api/endpoints/clips/add-note.ts b/packages/backend/src/server/api/endpoints/clips/add-note.ts index 22d40bca5..887c8af08 100644 --- a/packages/backend/src/server/api/endpoints/clips/add-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/add-note.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; -import { ClipNotes, Clips } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; +import { ClipNotes, Clips } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; +import { genId } from "@/misc/gen-id.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["account", "notes", "clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/create.ts b/packages/backend/src/server/api/endpoints/clips/create.ts index 92860944d..df03b87b0 100644 --- a/packages/backend/src/server/api/endpoints/clips/create.ts +++ b/packages/backend/src/server/api/endpoints/clips/create.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { genId } from "@/misc/gen-id.js"; import { Clips } from "@/models/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/delete.ts b/packages/backend/src/server/api/endpoints/clips/delete.ts index 7455a2362..02d95b315 100644 --- a/packages/backend/src/server/api/endpoints/clips/delete.ts +++ b/packages/backend/src/server/api/endpoints/clips/delete.ts @@ -1,6 +1,6 @@ -import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/list.ts b/packages/backend/src/server/api/endpoints/clips/list.ts index f77b50612..d27622436 100644 --- a/packages/backend/src/server/api/endpoints/clips/list.ts +++ b/packages/backend/src/server/api/endpoints/clips/list.ts @@ -1,5 +1,5 @@ -import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips", "account"], diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index 741c89edc..13d8310e6 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -1,10 +1,10 @@ -import { ClipNotes, Clips, Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { ClipNotes, Clips, Notes } from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { ApiError } from "@/server/api/error.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["account", "notes", "clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/remove-note.ts b/packages/backend/src/server/api/endpoints/clips/remove-note.ts index 70eb23b79..c081a87ab 100644 --- a/packages/backend/src/server/api/endpoints/clips/remove-note.ts +++ b/packages/backend/src/server/api/endpoints/clips/remove-note.ts @@ -1,7 +1,7 @@ -import { ClipNotes, Clips } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; +import { ClipNotes, Clips } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["account", "notes", "clips"], diff --git a/packages/backend/src/server/api/endpoints/clips/show.ts b/packages/backend/src/server/api/endpoints/clips/show.ts index 51ed8b81a..8218a4fb7 100644 --- a/packages/backend/src/server/api/endpoints/clips/show.ts +++ b/packages/backend/src/server/api/endpoints/clips/show.ts @@ -1,6 +1,6 @@ -import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips", "account"], diff --git a/packages/backend/src/server/api/endpoints/clips/update.ts b/packages/backend/src/server/api/endpoints/clips/update.ts index f2666a421..fc88548b9 100644 --- a/packages/backend/src/server/api/endpoints/clips/update.ts +++ b/packages/backend/src/server/api/endpoints/clips/update.ts @@ -1,6 +1,6 @@ -import { Clips } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Clips } from "@/models/index.js"; export const meta = { tags: ["clips"], diff --git a/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts b/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts index 62fa84295..f6c5573af 100644 --- a/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/compatibility/custom-emojis.ts @@ -1,8 +1,8 @@ -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import type { Emoji } from "@/models/entities/emoji.js"; import { Emojis } from "@/models/index.js"; +import type { Emoji } from "@/models/entities/emoji.js"; +import { IsNull, In } from "typeorm"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; import define from "@/server/api/define.js"; -import { In, IsNull } from "typeorm"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index aa318fafd..d5dae8767 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { DriveFiles } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts index 8c15e5586..5f821fa72 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/attached-notes.ts @@ -1,6 +1,6 @@ -import { DriveFiles, Notes } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { DriveFiles, Notes } from "@/models/index.js"; export const meta = { tags: ["drive", "notes"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts index 0711ade02..2ce9fa470 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/check-existence.ts @@ -1,5 +1,5 @@ -import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index 0e20ab631..54ca5f8d1 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -1,12 +1,12 @@ -import { MINUTE } from "@/const.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; +import { addFile } from "@/services/drive/add-file.js"; +import { DriveFiles } from "@/models/index.js"; import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { DriveFiles } from "@/models/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { MINUTE } from "@/const.js"; import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { apiLogger } from "@/server/api/logger.js"; -import { addFile } from "@/services/drive/add-file.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/delete.ts b/packages/backend/src/server/api/endpoints/drive/files/delete.ts index 245c380ec..062b69b9c 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/delete.ts @@ -1,8 +1,8 @@ -import { DriveFiles } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { deleteFile } from "@/services/drive/delete-file.js"; import { publishDriveStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { DriveFiles } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/find.ts b/packages/backend/src/server/api/endpoints/drive/files/find.ts index 80b2f6add..5a243de89 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/find.ts @@ -1,5 +1,5 @@ -import { DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { DriveFiles } from "@/models/index.js"; import { IsNull } from "typeorm"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index 1a14cc53d..bde81e007 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -1,8 +1,8 @@ -import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; +import { publishDriveStream } from "@/services/stream.js"; import { DriveFiles, DriveFolders, Users } from "@/models/index.js"; +import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { publishDriveStream } from "@/services/stream.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index 172182f1c..cdfcb0308 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -1,8 +1,8 @@ -import { HOUR } from "@/const.js"; -import { DriveFiles } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; +import define from "@/server/api/define.js"; +import { DriveFiles } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index c587f8040..d02b4fac6 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { DriveFolders } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/create.ts b/packages/backend/src/server/api/endpoints/drive/folders/create.ts index 0df87debb..554e61ec9 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/create.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; -import { DriveFolders } from "@/models/index.js"; +import { publishDriveStream } from "@/services/stream.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { publishDriveStream } from "@/services/stream.js"; +import { DriveFolders } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts index e5372bb54..1954b4336 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/delete.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/delete.ts @@ -1,7 +1,7 @@ -import { DriveFiles, DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { publishDriveStream } from "@/services/stream.js"; +import { ApiError } from "@/server/api/error.js"; +import { DriveFolders, DriveFiles } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/find.ts b/packages/backend/src/server/api/endpoints/drive/folders/find.ts index 46f741d9f..d29015e78 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/find.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/find.ts @@ -1,5 +1,5 @@ -import { DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { DriveFolders } from "@/models/index.js"; import { IsNull } from "typeorm"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/drive/folders/show.ts b/packages/backend/src/server/api/endpoints/drive/folders/show.ts index 2968e61d0..611724ae4 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/show.ts @@ -1,6 +1,6 @@ -import { DriveFolders } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { DriveFolders } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/folders/update.ts b/packages/backend/src/server/api/endpoints/drive/folders/update.ts index 04b37c595..5bd880da8 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders/update.ts @@ -1,7 +1,7 @@ -import { DriveFolders } from "@/models/index.js"; +import { publishDriveStream } from "@/services/stream.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { publishDriveStream } from "@/services/stream.js"; +import { DriveFolders } from "@/models/index.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 1c92e30c7..cbd786017 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { DriveFiles } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["drive"], diff --git a/packages/backend/src/server/api/endpoints/emoji.ts b/packages/backend/src/server/api/endpoints/emoji.ts index 384c38452..2675ba7bd 100644 --- a/packages/backend/src/server/api/endpoints/emoji.ts +++ b/packages/backend/src/server/api/endpoints/emoji.ts @@ -1,7 +1,7 @@ +import { IsNull } from "typeorm"; import { Emojis } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { IsNull } from "typeorm"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts index d1e1d9dc4..ca013314e 100644 --- a/packages/backend/src/server/api/endpoints/export-custom-emojis.ts +++ b/packages/backend/src/server/api/endpoints/export-custom-emojis.ts @@ -1,6 +1,6 @@ -import { HOUR } from "@/const.js"; import { createExportCustomEmojisJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index e7117349e..2a88d27ae 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Followings } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 3d177b925..c13ee8b19 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Followings } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 6f9b6c9bd..27a6dabb4 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -1,7 +1,7 @@ +import define from "@/server/api/define.js"; +import { Instances } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import { Instances } from "@/models/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/show-instance.ts b/packages/backend/src/server/api/endpoints/federation/show-instance.ts index 7d90a4f5a..c4a6304d0 100644 --- a/packages/backend/src/server/api/endpoints/federation/show-instance.ts +++ b/packages/backend/src/server/api/endpoints/federation/show-instance.ts @@ -1,6 +1,6 @@ -import { toPuny } from "@/misc/convert-host.js"; -import { Instances } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Instances } from "@/models/index.js"; +import { toPuny } from "@/misc/convert-host.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/stats.ts b/packages/backend/src/server/api/endpoints/federation/stats.ts index 9d9b86b42..6702eeff5 100644 --- a/packages/backend/src/server/api/endpoints/federation/stats.ts +++ b/packages/backend/src/server/api/endpoints/federation/stats.ts @@ -1,7 +1,7 @@ +import { IsNull, MoreThan, Not } from "typeorm"; import { Followings, Instances } from "@/models/index.js"; import { awaitAll } from "@/prelude/await-all.js"; import define from "@/server/api/define.js"; -import { IsNull, MoreThan, Not } from "typeorm"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index cecd1109b..e8ada9e62 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -1,6 +1,6 @@ -import { updatePerson } from "@/remote/activitypub/models/person.js"; -import { getRemoteUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; +import { getRemoteUser } from "@/server/api/common/getters.js"; +import { updatePerson } from "@/remote/activitypub/models/person.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index 7960f4dd3..4e925a29e 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Users } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["federation"], diff --git a/packages/backend/src/server/api/endpoints/fetch-rss.ts b/packages/backend/src/server/api/endpoints/fetch-rss.ts index 0e7f9a378..bda3c455d 100644 --- a/packages/backend/src/server/api/endpoints/fetch-rss.ts +++ b/packages/backend/src/server/api/endpoints/fetch-rss.ts @@ -1,7 +1,7 @@ -import config from "@/config/index.js"; -import { getResponse } from "@/misc/fetch.js"; -import define from "@/server/api/define.js"; import Parser from "rss-parser"; +import { getResponse } from "@/misc/fetch.js"; +import config from "@/config/index.js"; +import define from "@/server/api/define.js"; const rssParser = new Parser(); diff --git a/packages/backend/src/server/api/endpoints/following/create.ts b/packages/backend/src/server/api/endpoints/following/create.ts index 764331068..f6e341ad7 100644 --- a/packages/backend/src/server/api/endpoints/following/create.ts +++ b/packages/backend/src/server/api/endpoints/following/create.ts @@ -1,10 +1,10 @@ -import { HOUR } from "@/const.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { Followings, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import create from "@/services/following/create.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import create from "@/services/following/create.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Followings, Users } from "@/models/index.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["following", "users"], diff --git a/packages/backend/src/server/api/endpoints/following/delete.ts b/packages/backend/src/server/api/endpoints/following/delete.ts index d382f1a90..3ef031eb2 100644 --- a/packages/backend/src/server/api/endpoints/following/delete.ts +++ b/packages/backend/src/server/api/endpoints/following/delete.ts @@ -1,9 +1,9 @@ -import { HOUR } from "@/const.js"; -import { Followings, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import deleteFollowing from "@/services/following/delete.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import deleteFollowing from "@/services/following/delete.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Followings, Users } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["following", "users"], diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index 63d55e8bd..7559062c0 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -1,9 +1,9 @@ -import { HOUR } from "@/const.js"; -import { Followings, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import deleteFollowing from "@/services/following/delete.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import deleteFollowing from "@/services/following/delete.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Followings, Users } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["following", "users"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/accept.ts b/packages/backend/src/server/api/endpoints/following/requests/accept.ts index 1296384d3..cb6b01072 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/accept.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/accept.ts @@ -1,7 +1,7 @@ -import { getUser } from "@/server/api/common/getters.js"; +import acceptFollowRequest from "@/services/following/requests/accept.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import acceptFollowRequest from "@/services/following/requests/accept.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts index b3e469483..7acb0f948 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/cancel.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/cancel.ts @@ -1,9 +1,9 @@ -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import cancelFollowRequest from "@/services/following/requests/cancel.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import cancelFollowRequest from "@/services/following/requests/cancel.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Users } from "@/models/index.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index c6021cafd..97f52d4ac 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -1,5 +1,5 @@ -import { FollowRequests } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { FollowRequests } from "@/models/index.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/following/requests/reject.ts b/packages/backend/src/server/api/endpoints/following/requests/reject.ts index f374c9327..37e7bc0ab 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/reject.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/reject.ts @@ -1,7 +1,7 @@ -import { getUser } from "@/server/api/common/getters.js"; +import { rejectFollowRequest } from "@/services/following/reject.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { rejectFollowRequest } from "@/services/following/reject.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["following", "account"], diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index 6fb706498..e20e4ab20 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -1,5 +1,5 @@ -import { GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 69333e8de..805307e45 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -1,5 +1,5 @@ -import { GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index 69f9929d5..0dd02b930 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -1,6 +1,6 @@ -import { GalleryPosts } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index dad880cf8..a74f2165c 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -1,9 +1,9 @@ -import { HOUR } from "@/const.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { GalleryPost } from "@/models/entities/gallery-post.js"; +import define from "@/server/api/define.js"; import { DriveFiles, GalleryPosts } from "@/models/index.js"; import { genId } from "@/server/api/../../misc/gen-id.js"; -import define from "@/server/api/define.js"; +import { GalleryPost } from "@/models/entities/gallery-post.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts index 896908287..360ca8c5a 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/delete.ts @@ -1,6 +1,6 @@ -import { GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts index d3d0add75..f5ccc5bc6 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/like.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/like.ts @@ -1,7 +1,7 @@ -import { genId } from "@/misc/gen-id.js"; -import { GalleryLikes, GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { GalleryPosts, GalleryLikes } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts index 00c0bdd54..7e172da45 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/show.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/show.ts @@ -1,6 +1,6 @@ -import { GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { GalleryPosts } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts index bfc4432ee..f37456a62 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/unlike.ts @@ -1,6 +1,6 @@ -import { GalleryLikes, GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { GalleryPosts, GalleryLikes } from "@/models/index.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index 0493d02d1..16c629706 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -1,7 +1,7 @@ -import { HOUR } from "@/const.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { DriveFiles, GalleryPosts } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { DriveFiles, GalleryPosts } from "@/models/index.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["gallery"], diff --git a/packages/backend/src/server/api/endpoints/get-online-users-count.ts b/packages/backend/src/server/api/endpoints/get-online-users-count.ts index 030ca1410..633e75335 100644 --- a/packages/backend/src/server/api/endpoints/get-online-users-count.ts +++ b/packages/backend/src/server/api/endpoints/get-online-users-count.ts @@ -1,7 +1,7 @@ +import { MoreThan } from "typeorm"; import { USER_ONLINE_THRESHOLD } from "@/const.js"; import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { MoreThan } from "typeorm"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/get-sounds.ts b/packages/backend/src/server/api/endpoints/get-sounds.ts index 119ca1679..4fd1498bd 100644 --- a/packages/backend/src/server/api/endpoints/get-sounds.ts +++ b/packages/backend/src/server/api/endpoints/get-sounds.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { readdir } from "fs/promises"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index a19ccfa1c..6e8016f64 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -1,5 +1,5 @@ -import { Hashtags } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Hashtags } from "@/models/index.js"; export const meta = { tags: ["hashtags"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 4709ccc7a..1dc1fb492 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -1,6 +1,6 @@ -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import { Hashtags } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Hashtags } from "@/models/index.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["hashtags"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/show.ts b/packages/backend/src/server/api/endpoints/hashtags/show.ts index 136f35804..09849dbd3 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/show.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/show.ts @@ -1,7 +1,7 @@ -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { Hashtags } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Hashtags } from "@/models/index.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; export const meta = { tags: ["hashtags"], diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index 6c41f8b82..fe8bba95f 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -1,10 +1,10 @@ -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { safeForSql } from "@/misc/safe-for-sql.js"; -import type { Note } from "@/models/entities/note.js"; -import { Notes } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { Brackets } from "typeorm"; +import define from "@/server/api/define.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Notes } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; +import { safeForSql } from "@/misc/safe-for-sql.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; /* トレンドに載るためには「『直近a分間のユニーク投稿数が今からa分前~今からb分前の間のユニーク投稿数のn倍以上』のハッシュタグの上位5位以内に入る」ことが必要 diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index 151370323..ccb70a059 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -1,6 +1,6 @@ -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Users } from "@/models/index.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/done.ts b/packages/backend/src/server/api/endpoints/i/2fa/done.ts index f10b74efe..c1a7b16a8 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/done.ts @@ -1,7 +1,7 @@ -import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; import * as OTPAuth from "otpauth"; +import define from "@/server/api/define.js"; +import { Users, UserProfiles } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts index 99f6994ea..b8104e318 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/key-done.ts @@ -1,15 +1,15 @@ -import config from "@/config/index.js"; -import { comparePassword } from "@/misc/password.js"; +import { decode } from "cbor-x"; +import define from "@/server/api/define.js"; import { - AttestationChallenges, UserProfiles, UserSecurityKeys, + AttestationChallenges, Users, } from "@/models/index.js"; -import { hash, procedures } from "@/server/api/2fa.js"; -import define from "@/server/api/define.js"; +import config from "@/config/index.js"; +import { procedures, hash } from "@/server/api/2fa.js"; import { publishMainStream } from "@/services/stream.js"; -import { decode } from "cbor-x"; +import { comparePassword } from "@/misc/password.js"; const rpIdHashReal = hash(Buffer.from(config.hostname, "utf-8")); @@ -79,7 +79,7 @@ export default define(meta, paramDef, async (ps, user) => { const credentialIdLength = authData.readUInt16BE(53); const credentialId = authData.slice(55, 55 + credentialIdLength); const publicKeyData = authData.slice(55 + credentialIdLength); - const publicKey: Map = new Map( + const publicKey: Map = new Map( Object.entries(decode(publicKeyData)).map(([key, value]) => [ Number(key), value, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts index aee935eb5..8125f817a 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/password-less.ts @@ -1,7 +1,7 @@ -import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; +import { Users, UserProfiles, UserSecurityKeys } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts index f6d58c278..8080c9390 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register-key.ts @@ -1,10 +1,10 @@ -import * as crypto from "node:crypto"; -import { promisify } from "node:util"; -import { genId } from "@/misc/gen-id.js"; -import { comparePassword } from "@/misc/password.js"; -import { AttestationChallenges, UserProfiles } from "@/models/index.js"; -import { hash } from "@/server/api/2fa.js"; import define from "@/server/api/define.js"; +import { UserProfiles, AttestationChallenges } from "@/models/index.js"; +import { promisify } from "node:util"; +import * as crypto from "node:crypto"; +import { genId } from "@/misc/gen-id.js"; +import { hash } from "@/server/api/2fa.js"; +import { comparePassword } from "@/misc/password.js"; const randomBytes = promisify(crypto.randomBytes); diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index ba0220b10..52e1df39f 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -1,9 +1,9 @@ -import config from "@/config/index.js"; -import { comparePassword } from "@/misc/password.js"; -import { UserProfiles } from "@/models/index.js"; -import define from "@/server/api/define.js"; import * as OTPAuth from "otpauth"; import * as QRCode from "qrcode"; +import config from "@/config/index.js"; +import { UserProfiles } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { comparePassword } from "@/misc/password.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts index cba8b431a..b3bc5bdfa 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/remove-key.ts @@ -1,6 +1,6 @@ import { comparePassword } from "@/misc/password.js"; -import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { UserProfiles, UserSecurityKeys, Users } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts index 392350423..c4e78eecb 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/unregister.ts @@ -1,7 +1,7 @@ -import { comparePassword } from "@/misc/password.js"; -import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import { Users, UserProfiles } from "@/models/index.js"; +import { comparePassword } from "@/misc/password.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts b/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts index 0a55937dd..d77ecc88e 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/update-key.ts @@ -1,7 +1,7 @@ -import { UserSecurityKeys, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import { Users, UserSecurityKeys } from "@/models/index.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/apps.ts b/packages/backend/src/server/api/endpoints/i/apps.ts index 9669d22c6..7e7574ec9 100644 --- a/packages/backend/src/server/api/endpoints/i/apps.ts +++ b/packages/backend/src/server/api/endpoints/i/apps.ts @@ -1,5 +1,5 @@ -import { AccessTokens } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { AccessTokens } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts index 145052289..ad66fe1fd 100644 --- a/packages/backend/src/server/api/endpoints/i/authorized-apps.ts +++ b/packages/backend/src/server/api/endpoints/i/authorized-apps.ts @@ -1,5 +1,5 @@ -import { AccessTokens, Apps } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { AccessTokens, Apps } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/change-password.ts b/packages/backend/src/server/api/endpoints/i/change-password.ts index cef86a6bb..b0dc8bba6 100644 --- a/packages/backend/src/server/api/endpoints/i/change-password.ts +++ b/packages/backend/src/server/api/endpoints/i/change-password.ts @@ -1,6 +1,6 @@ -import { comparePassword, hashPassword } from "@/misc/password.js"; -import { UserProfiles } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { UserProfiles } from "@/models/index.js"; +import { hashPassword, comparePassword } from "@/misc/password.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/delete-account.ts b/packages/backend/src/server/api/endpoints/i/delete-account.ts index 9e6ce15cd..606cde82e 100644 --- a/packages/backend/src/server/api/endpoints/i/delete-account.ts +++ b/packages/backend/src/server/api/endpoints/i/delete-account.ts @@ -1,7 +1,7 @@ -import { comparePassword } from "@/misc/password.js"; import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { deleteAccount } from "@/services/delete-account.js"; +import define from "@/server/api/define.js"; +import { comparePassword } from "@/misc/password.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-blocking.ts b/packages/backend/src/server/api/endpoints/i/export-blocking.ts index 664689d00..30e74ab2f 100644 --- a/packages/backend/src/server/api/endpoints/i/export-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/export-blocking.ts @@ -1,6 +1,6 @@ -import { HOUR } from "@/const.js"; -import { createExportBlockingJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createExportBlockingJob } from "@/queue/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-following.ts b/packages/backend/src/server/api/endpoints/i/export-following.ts index 6f574f8bf..07d2997a1 100644 --- a/packages/backend/src/server/api/endpoints/i/export-following.ts +++ b/packages/backend/src/server/api/endpoints/i/export-following.ts @@ -1,6 +1,6 @@ -import { HOUR } from "@/const.js"; -import { createExportFollowingJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createExportFollowingJob } from "@/queue/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-mute.ts b/packages/backend/src/server/api/endpoints/i/export-mute.ts index e57229784..7d22a073e 100644 --- a/packages/backend/src/server/api/endpoints/i/export-mute.ts +++ b/packages/backend/src/server/api/endpoints/i/export-mute.ts @@ -1,6 +1,6 @@ -import { HOUR } from "@/const.js"; -import { createExportMuteJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createExportMuteJob } from "@/queue/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-notes.ts b/packages/backend/src/server/api/endpoints/i/export-notes.ts index 393ab01eb..f167bb83c 100644 --- a/packages/backend/src/server/api/endpoints/i/export-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/export-notes.ts @@ -1,6 +1,6 @@ -import { DAY } from "@/const.js"; -import { createExportNotesJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createExportNotesJob } from "@/queue/index.js"; +import { DAY } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts index c77e46878..b68d889dc 100644 --- a/packages/backend/src/server/api/endpoints/i/export-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/export-user-lists.ts @@ -1,6 +1,6 @@ -import { MINUTE } from "@/const.js"; -import { createExportUserListsJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createExportUserListsJob } from "@/queue/index.js"; +import { MINUTE } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index 1e34f1370..f0961ea23 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { NoteFavorites } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["account", "notes", "favorites"], diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index 42fd9ad8c..80c90e684 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { GalleryLikes } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["account", "gallery"], diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index c654bfc31..054784842 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -1,6 +1,6 @@ import { GalleryPosts } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["account", "gallery"], diff --git a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts index f987a58ac..39cc45e82 100644 --- a/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -1,5 +1,5 @@ -import { MutedNotes } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { MutedNotes } from "@/models/index.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/i/import-blocking.ts b/packages/backend/src/server/api/endpoints/i/import-blocking.ts index 9672663e1..58314aced 100644 --- a/packages/backend/src/server/api/endpoints/i/import-blocking.ts +++ b/packages/backend/src/server/api/endpoints/i/import-blocking.ts @@ -1,8 +1,8 @@ -import { HOUR } from "@/const.js"; -import { DriveFiles } from "@/models/index.js"; -import { createImportBlockingJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createImportBlockingJob } from "@/queue/index.js"; import { ApiError } from "@/server/api/error.js"; +import { DriveFiles } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-following.ts b/packages/backend/src/server/api/endpoints/i/import-following.ts index a40b010c0..b7c475698 100644 --- a/packages/backend/src/server/api/endpoints/i/import-following.ts +++ b/packages/backend/src/server/api/endpoints/i/import-following.ts @@ -1,8 +1,8 @@ -import { HOUR } from "@/const.js"; -import { DriveFiles } from "@/models/index.js"; -import { createImportFollowingJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createImportFollowingJob } from "@/queue/index.js"; import { ApiError } from "@/server/api/error.js"; +import { DriveFiles } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-muting.ts b/packages/backend/src/server/api/endpoints/i/import-muting.ts index 750d23ec7..494fb0d42 100644 --- a/packages/backend/src/server/api/endpoints/i/import-muting.ts +++ b/packages/backend/src/server/api/endpoints/i/import-muting.ts @@ -1,8 +1,8 @@ -import { HOUR } from "@/const.js"; -import { DriveFiles } from "@/models/index.js"; -import { createImportMutingJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createImportMutingJob } from "@/queue/index.js"; import { ApiError } from "@/server/api/error.js"; +import { DriveFiles } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-posts.ts b/packages/backend/src/server/api/endpoints/i/import-posts.ts index 582807aa0..b8b52be98 100644 --- a/packages/backend/src/server/api/endpoints/i/import-posts.ts +++ b/packages/backend/src/server/api/endpoints/i/import-posts.ts @@ -1,9 +1,9 @@ +import define from "@/server/api/define.js"; +import { createImportPostsJob } from "@/queue/index.js"; +import { ApiError } from "@/server/api/error.js"; +import { DriveFiles } from "@/models/index.js"; import { DAY } from "@/const.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import { DriveFiles } from "@/models/index.js"; -import { createImportPostsJob } from "@/queue/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts index 10ce72e75..ed82a9605 100644 --- a/packages/backend/src/server/api/endpoints/i/import-user-lists.ts +++ b/packages/backend/src/server/api/endpoints/i/import-user-lists.ts @@ -1,8 +1,8 @@ -import { HOUR } from "@/const.js"; -import { DriveFiles } from "@/models/index.js"; -import { createImportUserListsJob } from "@/queue/index.js"; import define from "@/server/api/define.js"; +import { createImportUserListsJob } from "@/queue/index.js"; import { ApiError } from "@/server/api/error.js"; +import { DriveFiles } from "@/models/index.js"; +import { HOUR } from "@/const.js"; export const meta = { secure: true, diff --git a/packages/backend/src/server/api/endpoints/i/known-as.ts b/packages/backend/src/server/api/endpoints/i/known-as.ts index d6d44bf94..39bf6fff8 100644 --- a/packages/backend/src/server/api/endpoints/i/known-as.ts +++ b/packages/backend/src/server/api/endpoints/i/known-as.ts @@ -1,14 +1,14 @@ -import { DAY } from "@/const.js"; -import { parse } from "@/misc/acct.js"; import type { User } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; import { resolveUser } from "@/remote/resolve-user.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { apiLogger } from "@/server/api/logger.js"; import acceptAllFollowRequests from "@/services/following/requests/accept-all.js"; import { publishToFollowers } from "@/services/i/update.js"; import { publishMainStream } from "@/services/stream.js"; +import { DAY } from "@/const.js"; +import { apiLogger } from "@/server/api/logger.js"; +import define from "@/server/api/define.js"; +import { ApiError } from "@/server/api/error.js"; +import { parse } from "@/misc/acct.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index db0d3dfc2..c6d1205f9 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -1,18 +1,18 @@ -import config from "@/config/index.js"; -import { DAY } from "@/const.js"; -import { parse } from "@/misc/acct.js"; import type { User } from "@/models/entities/user.js"; -import { Followings, Users } from "@/models/index.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import { DAY } from "@/const.js"; import DeliverManager from "@/remote/activitypub/deliver-manager.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import { resolveUser } from "@/remote/resolve-user.js"; -import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; import { apiLogger } from "@/server/api/logger.js"; -import create from "@/services/following/create.js"; import deleteFollowing from "@/services/following/delete.js"; +import create from "@/services/following/create.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Followings, Users } from "@/models/index.js"; +import config from "@/config/index.js"; import { publishMainStream } from "@/services/stream.js"; +import { parse } from "@/misc/acct.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index 2f9043f16..b07247dd8 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -1,16 +1,16 @@ +import { Brackets } from "typeorm"; import { + Notifications, Followings, Mutings, - Notifications, - UserProfiles, Users, + UserProfiles, } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { notificationTypes } from "@/types.js"; +import read from "@/services/note/read.js"; import { readNotification } from "@/server/api/common/read-notification.js"; import define from "@/server/api/define.js"; -import read from "@/services/note/read.js"; -import { notificationTypes } from "@/types.js"; -import { Brackets } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["account", "notifications"], diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 6cf7a8c06..289d07267 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -1,6 +1,6 @@ import { PageLikes } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["account", "pages"], diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index f2912a6c9..1177d2e66 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -1,6 +1,6 @@ import { Pages } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["account", "pages"], diff --git a/packages/backend/src/server/api/endpoints/i/pin.ts b/packages/backend/src/server/api/endpoints/i/pin.ts index 106342b6d..4291541ea 100644 --- a/packages/backend/src/server/api/endpoints/i/pin.ts +++ b/packages/backend/src/server/api/endpoints/i/pin.ts @@ -1,7 +1,7 @@ -import { Users } from "@/models/index.js"; +import { addPinned } from "@/services/i/pin.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { addPinned } from "@/services/i/pin.js"; +import { Users } from "@/models/index.js"; export const meta = { tags: ["account", "notes"], diff --git a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts index 0dcd89fa8..505c424ed 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -1,6 +1,6 @@ -import { MessagingMessages, UserGroupJoinings } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import { MessagingMessages, UserGroupJoinings } from "@/models/index.js"; export const meta = { tags: ["account", "messaging"], diff --git a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts index 32439f544..6f70e55a1 100644 --- a/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/packages/backend/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -1,6 +1,6 @@ -import { NoteUnreads } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import { NoteUnreads } from "@/models/index.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/i/read-announcement.ts b/packages/backend/src/server/api/endpoints/i/read-announcement.ts index 98da5576b..a59d15b99 100644 --- a/packages/backend/src/server/api/endpoints/i/read-announcement.ts +++ b/packages/backend/src/server/api/endpoints/i/read-announcement.ts @@ -1,7 +1,7 @@ -import { genId } from "@/misc/gen-id.js"; -import { AnnouncementReads, Announcements, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { genId } from "@/misc/gen-id.js"; +import { AnnouncementReads, Announcements, Users } from "@/models/index.js"; import { publishMainStream } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts index 348167aea..c1b4325ad 100644 --- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts +++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts @@ -1,12 +1,12 @@ -import { comparePassword } from "@/misc/password.js"; -import { UserProfiles, Users } from "@/models/index.js"; -import generateUserToken from "@/server/api/common/generate-native-user-token.js"; -import define from "@/server/api/define.js"; import { publishInternalEvent, publishMainStream, publishUserEvent, } from "@/services/stream.js"; +import generateUserToken from "@/server/api/common/generate-native-user-token.js"; +import define from "@/server/api/define.js"; +import { Users, UserProfiles } from "@/models/index.js"; +import { comparePassword } from "@/misc/password.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts index b3edd0f95..c267bb144 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-all.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-all.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts index d7f269ec2..57db3c714 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-detail.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts index dd2ef8c9d..ac37beea5 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts @@ -1,6 +1,6 @@ -import { RegistryItems } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/get.ts b/packages/backend/src/server/api/endpoints/i/registry/get.ts index 96ae834d1..d25047e00 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index e261f8eed..f691552bc 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys.ts b/packages/backend/src/server/api/endpoints/i/registry/keys.ts index bc89e33a3..186e744bd 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/remove.ts b/packages/backend/src/server/api/endpoints/i/registry/remove.ts index bef2d7b2b..aa459952e 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/remove.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/remove.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts index 53d8113c0..e235ef67f 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/scopes.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/scopes.ts @@ -1,5 +1,5 @@ -import { RegistryItems } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/registry/set.ts b/packages/backend/src/server/api/endpoints/i/registry/set.ts index 0e61ef78c..7a1f8ab5f 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/set.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/set.ts @@ -1,7 +1,7 @@ -import { genId } from "@/misc/gen-id.js"; -import { RegistryItems } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import { RegistryItems } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/revoke-token.ts b/packages/backend/src/server/api/endpoints/i/revoke-token.ts index 4a86b8613..f3e811694 100644 --- a/packages/backend/src/server/api/endpoints/i/revoke-token.ts +++ b/packages/backend/src/server/api/endpoints/i/revoke-token.ts @@ -1,5 +1,5 @@ -import { AccessTokens } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { AccessTokens } from "@/models/index.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index 17802b745..14d303089 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { Signins } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/unpin.ts b/packages/backend/src/server/api/endpoints/i/unpin.ts index bba01786c..9aee1dfea 100644 --- a/packages/backend/src/server/api/endpoints/i/unpin.ts +++ b/packages/backend/src/server/api/endpoints/i/unpin.ts @@ -1,7 +1,7 @@ -import { Users } from "@/models/index.js"; +import { removePinned } from "@/services/i/pin.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { removePinned } from "@/services/i/pin.js"; +import { Users } from "@/models/index.js"; export const meta = { tags: ["account", "notes"], diff --git a/packages/backend/src/server/api/endpoints/i/update-email.ts b/packages/backend/src/server/api/endpoints/i/update-email.ts index 494f35dda..a48252ed1 100644 --- a/packages/backend/src/server/api/endpoints/i/update-email.ts +++ b/packages/backend/src/server/api/endpoints/i/update-email.ts @@ -1,13 +1,13 @@ +import { publishMainStream } from "@/services/stream.js"; +import define from "@/server/api/define.js"; +import rndstr from "rndstr"; import config from "@/config/index.js"; +import { Users, UserProfiles } from "@/models/index.js"; +import { sendEmail } from "@/services/send-email.js"; +import { ApiError } from "@/server/api/error.js"; +import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; import { HOUR } from "@/const.js"; import { comparePassword } from "@/misc/password.js"; -import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { sendEmail } from "@/services/send-email.js"; -import { publishMainStream } from "@/services/stream.js"; -import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; -import rndstr from "rndstr"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index d352db724..082108383 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -1,20 +1,20 @@ -import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { langmap } from "@/misc/langmap.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; -import type { User } from "@/models/entities/user.js"; -import { DriveFiles, Pages, UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { verifyLink } from "@/services/fetch-rel-me.js"; +import RE2 from "re2"; +import * as mfm from "mfm-js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; import acceptAllFollowRequests from "@/services/following/requests/accept-all.js"; import { publishToFollowers } from "@/services/i/update.js"; -import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; import { updateUsertags } from "@/services/update-hashtag.js"; +import { Users, DriveFiles, UserProfiles, Pages } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; import { notificationTypes } from "@/types.js"; -import * as mfm from "mfm-js"; -import RE2 from "re2"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { langmap } from "@/misc/langmap.js"; +import { verifyLink } from "@/services/fetch-rel-me.js"; +import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts index 19cab832c..99e8209a3 100644 --- a/packages/backend/src/server/api/endpoints/i/user-group-invites.ts +++ b/packages/backend/src/server/api/endpoints/i/user-group-invites.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { UserGroupInvitations } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["account", "groups"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts index 161a4a056..ee38b7637 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; -import { webhookEventTypes } from "@/models/entities/webhook.js"; -import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { genId } from "@/misc/gen-id.js"; +import { Webhooks } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; +import { webhookEventTypes } from "@/models/entities/webhook.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts b/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts index a9df7a94d..a92ed179d 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/delete.ts @@ -1,6 +1,6 @@ -import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Webhooks } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/list.ts b/packages/backend/src/server/api/endpoints/i/webhooks/list.ts index da98cb81d..f937e560c 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/list.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/list.ts @@ -1,5 +1,5 @@ -import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Webhooks } from "@/models/index.js"; export const meta = { tags: ["webhooks", "account"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/show.ts b/packages/backend/src/server/api/endpoints/i/webhooks/show.ts index 158d71b00..b24850f5e 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/show.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/show.ts @@ -1,6 +1,6 @@ -import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Webhooks } from "@/models/index.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts index f2656bbf9..4a211b915 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts @@ -1,8 +1,8 @@ -import { webhookEventTypes } from "@/models/entities/webhook.js"; -import { Webhooks } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { Webhooks } from "@/models/index.js"; import { publishInternalEvent } from "@/services/stream.js"; +import { webhookEventTypes } from "@/models/entities/webhook.js"; export const meta = { tags: ["webhooks"], diff --git a/packages/backend/src/server/api/endpoints/messaging/history.ts b/packages/backend/src/server/api/endpoints/messaging/history.ts index f9e00aa79..25418a17a 100644 --- a/packages/backend/src/server/api/endpoints/messaging/history.ts +++ b/packages/backend/src/server/api/endpoints/messaging/history.ts @@ -1,3 +1,4 @@ +import { Brackets } from "typeorm"; import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { MessagingMessages, @@ -5,7 +6,6 @@ import { UserGroupJoinings, } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { Brackets } from "typeorm"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/messaging/messages.ts b/packages/backend/src/server/api/endpoints/messaging/messages.ts index dde4c9a0d..01f702867 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages.ts @@ -1,19 +1,19 @@ -import { - MessagingMessages, - UserGroupJoinings, - UserGroups, - Users, -} from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import { - deliverReadActivity, - readGroupMessagingMessage, - readUserMessagingMessage, -} from "@/server/api/common/read-messaging-message.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { + MessagingMessages, + UserGroups, + UserGroupJoinings, + Users, +} from "@/models/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { Brackets } from "typeorm"; +import { + readUserMessagingMessage, + readGroupMessagingMessage, + deliverReadActivity, +} from "@/server/api/common/read-messaging-message.js"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index 654bd75f9..6fd38eff7 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -1,14 +1,14 @@ -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { User } from "@/models/entities/user.js"; -import { - Blockings, - DriveFiles, - UserGroupJoinings, - UserGroups, -} from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { + DriveFiles, + UserGroups, + UserGroupJoinings, + Blockings, +} from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; import { createMessage } from "@/services/messages/create.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts index dd8471aee..76691dd34 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/delete.ts @@ -1,8 +1,8 @@ -import { HOUR, SECOND } from "@/const.js"; -import { MessagingMessages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { MessagingMessages } from "@/models/index.js"; import { deleteMessage } from "@/services/messages/delete.js"; +import { SECOND, HOUR } from "@/const.js"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts index 1b4cc4d70..5aa50155c 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/read.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/read.ts @@ -1,10 +1,10 @@ -import { MessagingMessages } from "@/models/index.js"; -import { - readGroupMessagingMessage, - readUserMessagingMessage, -} from "@/server/api/common/read-messaging-message.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { MessagingMessages } from "@/models/index.js"; +import { + readUserMessagingMessage, + readGroupMessagingMessage, +} from "@/server/api/common/read-messaging-message.js"; export const meta = { tags: ["messaging"], diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 0cb137b8d..9dffad780 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -1,10 +1,10 @@ -import config from "@/config/index.js"; -import { MAX_CAPTION_TEXT_LENGTH, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Ads, Emojis, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import JSON5 from "json5"; import { IsNull, MoreThan } from "typeorm"; +import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Ads, Emojis, Users } from "@/models/index.js"; +import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["meta"], diff --git a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts index 35f18c0e4..bca09d3f0 100644 --- a/packages/backend/src/server/api/endpoints/miauth/gen-token.ts +++ b/packages/backend/src/server/api/endpoints/miauth/gen-token.ts @@ -1,7 +1,7 @@ +import define from "@/server/api/define.js"; +import { AccessTokens } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import { secureRndstr } from "@/misc/secure-rndstr.js"; -import { AccessTokens } from "@/models/index.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["auth"], diff --git a/packages/backend/src/server/api/endpoints/mute/create.ts b/packages/backend/src/server/api/endpoints/mute/create.ts index 0ff1721d6..2eb935198 100644 --- a/packages/backend/src/server/api/endpoints/mute/create.ts +++ b/packages/backend/src/server/api/endpoints/mute/create.ts @@ -1,9 +1,9 @@ -import { genId } from "@/misc/gen-id.js"; -import type { Muting } from "@/models/entities/muting.js"; -import { Mutings, NoteWatchings } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { genId } from "@/misc/gen-id.js"; +import { Mutings, NoteWatchings } from "@/models/index.js"; +import type { Muting } from "@/models/entities/muting.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/mute/delete.ts b/packages/backend/src/server/api/endpoints/mute/delete.ts index 104bc4945..8058e9a61 100644 --- a/packages/backend/src/server/api/endpoints/mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/mute/delete.ts @@ -1,7 +1,7 @@ -import { Mutings } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { Mutings } from "@/models/index.js"; import { publishUserEvent } from "@/services/stream.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index a0126468e..9619457cd 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -1,6 +1,6 @@ -import { Mutings } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { Mutings } from "@/models/index.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/my/apps.ts b/packages/backend/src/server/api/endpoints/my/apps.ts index 1147c22fa..bc75b38e5 100644 --- a/packages/backend/src/server/api/endpoints/my/apps.ts +++ b/packages/backend/src/server/api/endpoints/my/apps.ts @@ -1,5 +1,5 @@ -import { Apps } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { Apps } from "@/models/index.js"; export const meta = { tags: ["account", "app"], diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index a63f597fa..6e2d3b4f3 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -1,6 +1,6 @@ import { Notes } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index afdd9c414..d76771c34 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -1,9 +1,9 @@ import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/clips.ts b/packages/backend/src/server/api/endpoints/notes/clips.ts index f649ae459..430ed02ec 100644 --- a/packages/backend/src/server/api/endpoints/notes/clips.ts +++ b/packages/backend/src/server/api/endpoints/notes/clips.ts @@ -1,8 +1,8 @@ -import { ClipNotes, Clips } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { In } from "typeorm"; +import { ClipNotes, Clips } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["clips", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index fdb45430a..993974087 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -1,8 +1,8 @@ import type { Note } from "@/models/entities/note.js"; import { Notes } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 426b6904a..0465d09ec 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -1,22 +1,22 @@ -import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { HOUR } from "@/const.js"; -import type { Channel } from "@/models/entities/channel.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Note } from "@/models/entities/note.js"; +import { In } from "typeorm"; +import create from "@/services/note/create.js"; import type { User } from "@/models/entities/user.js"; import { - Blockings, - Channels, + Users, DriveFiles, Notes, - Users, + Channels, + Blockings, } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import create from "@/services/note/create.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { Note } from "@/models/entities/note.js"; +import type { Channel } from "@/models/entities/channel.js"; +import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; import { noteVisibilities } from "@/types.js"; -import { In } from "typeorm"; +import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; +import { HOUR } from "@/const.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/delete.ts b/packages/backend/src/server/api/endpoints/notes/delete.ts index 32a64661d..54aad1eba 100644 --- a/packages/backend/src/server/api/endpoints/notes/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/delete.ts @@ -1,9 +1,9 @@ -import { HOUR, SECOND } from "@/const.js"; -import { Users } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import deleteNote from "@/services/note/delete.js"; +import { Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; +import { SECOND, HOUR } from "@/const.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index 9e9fdd9e5..a0869e410 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -1,41 +1,41 @@ -import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { HOUR } from "@/const.js"; -import detectLanguage from "@/misc/detect-language.js"; -import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { genId } from "@/misc/gen-id.js"; -// import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; -import { langmap } from "@/misc/langmap.js"; -import type { Channel } from "@/models/entities/channel.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; -import { Poll } from "@/models/entities/poll.js"; +import { In } from "typeorm"; +import { index } from "@/services/note/create.js"; import type { IRemoteUser, User } from "@/models/entities/user.js"; import { - Blockings, - Channels, - DriveFiles, - NoteEdits, - Notes, - Polls, - UserProfiles, Users, + DriveFiles, + Notes, + Channels, + Blockings, + UserProfiles, + Polls, + NoteEdits, } from "@/models/index.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; +import type { Channel } from "@/models/entities/channel.js"; +import { MAX_NOTE_TEXT_LENGTH } from "@/const.js"; +import { noteVisibilities } from "@/types.js"; +import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; +import { HOUR } from "@/const.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { Poll } from "@/models/entities/poll.js"; +import * as mfm from "mfm-js"; import { concat } from "@/prelude/array.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; +import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; +import { extractMentionedUsers } from "@/services/note/create.js"; +import { genId } from "@/misc/gen-id.js"; +import { publishNoteStream } from "@/services/stream.js"; import DeliverManager from "@/remote/activitypub/deliver-manager.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderNote from "@/remote/activitypub/renderer/note.js"; import renderUpdate from "@/remote/activitypub/renderer/update.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { index } from "@/services/note/create.js"; -import { extractMentionedUsers } from "@/services/note/create.js"; import { deliverToRelays } from "@/services/relay.js"; -import { publishNoteStream } from "@/services/stream.js"; -import { noteVisibilities } from "@/types.js"; -import * as mfm from "mfm-js"; -import { In } from "typeorm"; +// import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; +import { langmap } from "@/misc/langmap.js"; +import detectLanguage from "@/misc/detect-language.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts index 16cf51c27..8b2c7ad3a 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/create.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; import { NoteFavorites } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; +import { genId } from "@/misc/gen-id.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes", "favorites"], diff --git a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts index b2b0ad6b0..018ef91bc 100644 --- a/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/favorites/delete.ts @@ -1,7 +1,7 @@ import { NoteFavorites } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes", "favorites"], diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index 3c15d7050..4f90145ec 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -1,7 +1,7 @@ import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import define from "@/server/api/define.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index d8e49f06e..fee660ddb 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -1,14 +1,14 @@ import { fetchMeta } from "@/misc/fetch-meta.js"; import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { activeUsersChart } from "@/services/chart/index.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index 4639b97ec..c573a0c86 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -1,17 +1,17 @@ +import { Brackets } from "typeorm"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Followings, Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import { Brackets } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 5deaeb00a..c89b8f871 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -1,17 +1,17 @@ +import { Brackets } from "typeorm"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import { Brackets } from "typeorm"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 1b606087f..44ee90938 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -1,12 +1,12 @@ -import { Followings, Notes } from "@/models/index.js"; +import { Brackets } from "typeorm"; +import read from "@/services/note/read.js"; +import { Notes, Followings } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; import { generateMutedNoteThreadQuery } from "@/server/api/common/generate-muted-note-thread-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; -import read from "@/services/note/read.js"; -import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index a792b75e9..ca0d0f03d 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -1,6 +1,6 @@ -import { Mutings, Notes, PollVotes, Polls } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { Brackets, In } from "typeorm"; +import { Polls, Mutings, Notes, PollVotes } from "@/models/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 45916e721..1680eca64 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -1,21 +1,21 @@ -import { genId } from "@/misc/gen-id.js"; -import type { IRemoteUser } from "@/models/entities/user.js"; -import { - Blockings, - NoteWatchings, - PollVotes, - Polls, - Users, -} from "@/models/index.js"; +import { Not } from "typeorm"; +import { publishNoteStream } from "@/services/stream.js"; +import { createNotification } from "@/services/create-notification.js"; import { deliver } from "@/queue/index.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderVote from "@/remote/activitypub/renderer/vote.js"; +import { + PollVotes, + NoteWatchings, + Users, + Polls, + Blockings, +} from "@/models/index.js"; +import type { IRemoteUser } from "@/models/entities/user.js"; +import { genId } from "@/misc/gen-id.js"; import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { createNotification } from "@/services/create-notification.js"; -import { publishNoteStream } from "@/services/stream.js"; -import { Not } from "typeorm"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index ed38b1af1..386a3a08d 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -1,9 +1,9 @@ -import type { NoteReaction } from "@/models/entities/note-reaction.js"; +import type { FindOptionsWhere } from "typeorm"; import { NoteReactions } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import type { FindOptionsWhere } from "typeorm"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes", "reactions"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts index 36c70c34d..c49a957da 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/create.ts @@ -1,7 +1,7 @@ -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import createReaction from "@/services/note/reaction/create.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["reactions", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts index 503015fda..f135bd7ff 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions/delete.ts @@ -1,8 +1,8 @@ -import { HOUR, SECOND } from "@/const.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import deleteReaction from "@/services/note/reaction/delete.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; +import { SECOND, HOUR } from "@/const.js"; export const meta = { tags: ["reactions", "notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts index ae8c8bd00..53ac1288a 100644 --- a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts @@ -1,17 +1,17 @@ +import { Brackets } from "typeorm"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { activeUsersChart } from "@/services/chart/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import { Brackets } from "typeorm"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index 7b7d88cda..683004ebe 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -1,11 +1,11 @@ import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { getNote } from "@/server/api/common/getters.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; import { ApiError } from "@/server/api/error.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["notes"], @@ -53,7 +53,7 @@ export default define(meta, paramDef, async (ps, user) => { throw err; }); - const query = makePaginationQuery( + let query = makePaginationQuery( Notes.createQueryBuilder("note"), ps.sinceId, ps.untilId, diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index 8da59ea85..e4341ebce 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -1,9 +1,9 @@ import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 6ede52a18..e87725e34 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -1,12 +1,12 @@ -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { safeForSql } from "@/misc/safe-for-sql.js"; +import { Brackets } from "typeorm"; import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { safeForSql } from "@/misc/safe-for-sql.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; -import { Brackets } from "typeorm"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["notes", "hashtags"], diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index 9bd33c160..4ddcf11ab 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -1,16 +1,16 @@ +import { FindManyOptions, In } from "typeorm"; +import { Notes } from "@/models/index.js"; +import { Note } from "@/models/entities/note.js"; import config from "@/config/index.js"; import es from "@/db/elasticsearch.js"; -import meilisearch, { MeilisearchNote } from "@/db/meilisearch.js"; import sonic from "@/db/sonic.js"; -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import { Note } from "@/models/entities/note.js"; -import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import meilisearch, { MeilisearchNote } from "@/db/meilisearch.js"; import define from "@/server/api/define.js"; -import { FindManyOptions, In } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["notes"], @@ -243,7 +243,7 @@ export default define(meta, paramDef, async (ps, me) => { while (found.length < ps.limit && start < noteIDs.length) { const chunk = noteIDs.slice(start, start + chunkSize); - const query: FindManyOptions = { + let query: FindManyOptions = { where: { id: In(chunk), }, diff --git a/packages/backend/src/server/api/endpoints/notes/show.ts b/packages/backend/src/server/api/endpoints/notes/show.ts index 7cbb6b3f6..1319e47d9 100644 --- a/packages/backend/src/server/api/endpoints/notes/show.ts +++ b/packages/backend/src/server/api/endpoints/notes/show.ts @@ -1,6 +1,6 @@ import { Notes } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts index 9dd3c53a0..7c40a4592 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/create.ts @@ -1,9 +1,9 @@ +import { Notes, NoteThreadMutings } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import { NoteThreadMutings, Notes } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import readNote from "@/services/note/read.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts index dc1887658..62766bedc 100644 --- a/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/thread-muting/delete.ts @@ -1,6 +1,6 @@ import { NoteThreadMutings } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index 8512149ec..0f8da62e2 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -1,16 +1,16 @@ -import { Followings, Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; -import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { Brackets } from "typeorm"; +import { Notes, Followings } from "@/models/index.js"; +import { activeUsersChart } from "@/services/chart/index.js"; +import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; import { generateRepliesQuery } from "@/server/api/common/generate-replies-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedNoteQuery } from "@/server/api/common/generate-muted-note-query.js"; +import { generateChannelQuery } from "@/server/api/common/generate-channel-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; import { generateMutedUserRenotesQueryForNotes } from "@/server/api/common/generated-muted-renote-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import { Brackets } from "typeorm"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/translate.ts b/packages/backend/src/server/api/endpoints/notes/translate.ts index 61f7041d1..d1de39993 100644 --- a/packages/backend/src/server/api/endpoints/notes/translate.ts +++ b/packages/backend/src/server/api/endpoints/notes/translate.ts @@ -1,12 +1,12 @@ import { URLSearchParams } from "node:url"; +import fetch from "node-fetch"; import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Converter } from "opencc-js"; import { getAgentByUrl } from "@/misc/fetch.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { ApiError } from "@/server/api/error.js"; import { getNote } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import fetch from "node-fetch"; -import { Converter } from "opencc-js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/unrenote.ts b/packages/backend/src/server/api/endpoints/notes/unrenote.ts index 18e49574f..4a3966123 100644 --- a/packages/backend/src/server/api/endpoints/notes/unrenote.ts +++ b/packages/backend/src/server/api/endpoints/notes/unrenote.ts @@ -1,9 +1,9 @@ -import { HOUR, SECOND } from "@/const.js"; -import { Notes, Users } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import deleteNote from "@/services/note/delete.js"; +import { Notes, Users } from "@/models/index.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; +import { SECOND, HOUR } from "@/const.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index d52f10ad0..3a87ed647 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -1,10 +1,10 @@ -import { Notes, UserListJoinings, UserLists } from "@/models/index.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { Brackets } from "typeorm"; +import { UserLists, UserListJoinings, Notes } from "@/models/index.js"; +import { activeUsersChart } from "@/services/chart/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { activeUsersChart } from "@/services/chart/index.js"; -import { Brackets } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; export const meta = { tags: ["notes", "lists"], diff --git a/packages/backend/src/server/api/endpoints/notes/watching/create.ts b/packages/backend/src/server/api/endpoints/notes/watching/create.ts index f5faf5ada..ec13f5aa2 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/create.ts @@ -1,7 +1,7 @@ -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import watch from "@/services/note/watch.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts index f4bea4410..18994fa80 100644 --- a/packages/backend/src/server/api/endpoints/notes/watching/delete.ts +++ b/packages/backend/src/server/api/endpoints/notes/watching/delete.ts @@ -1,7 +1,7 @@ -import { getNote } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import unwatch from "@/services/note/unwatch.js"; +import define from "@/server/api/define.js"; +import { getNote } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index f29a30ac3..2077cceba 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -1,5 +1,5 @@ -import define from "@/server/api/define.js"; import { createNotification } from "@/services/create-notification.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["notifications"], diff --git a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts index 06539dd15..568036380 100644 --- a/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -1,7 +1,7 @@ +import { publishMainStream } from "@/services/stream.js"; +import { pushNotification } from "@/services/push-notification.js"; import { Notifications } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { pushNotification } from "@/services/push-notification.js"; -import { publishMainStream } from "@/services/stream.js"; export const meta = { tags: ["notifications", "account"], diff --git a/packages/backend/src/server/api/endpoints/notifications/read.ts b/packages/backend/src/server/api/endpoints/notifications/read.ts index 534d3f78e..358ca062f 100644 --- a/packages/backend/src/server/api/endpoints/notifications/read.ts +++ b/packages/backend/src/server/api/endpoints/notifications/read.ts @@ -1,5 +1,5 @@ -import { readNotification } from "@/server/api/common/read-notification.js"; import define from "@/server/api/define.js"; +import { readNotification } from "@/server/api/common/read-notification.js"; export const meta = { tags: ["notifications", "account"], diff --git a/packages/backend/src/server/api/endpoints/page-push.ts b/packages/backend/src/server/api/endpoints/page-push.ts index 194129e43..1f87372d6 100644 --- a/packages/backend/src/server/api/endpoints/page-push.ts +++ b/packages/backend/src/server/api/endpoints/page-push.ts @@ -1,7 +1,7 @@ -import { Pages, Users } from "@/models/index.js"; +import { publishMainStream } from "@/services/stream.js"; +import { Users, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { publishMainStream } from "@/services/stream.js"; export const meta = { requireCredential: true, diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index cac0fd3b1..ea0f8ba83 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -1,9 +1,9 @@ -import { HOUR } from "@/const.js"; +import { Pages, DriveFiles } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import { Page } from "@/models/entities/page.js"; -import { DriveFiles, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/like.ts b/packages/backend/src/server/api/endpoints/pages/like.ts index 4a396786d..ab64b9b93 100644 --- a/packages/backend/src/server/api/endpoints/pages/like.ts +++ b/packages/backend/src/server/api/endpoints/pages/like.ts @@ -1,5 +1,5 @@ +import { Pages, PageLikes } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import { PageLikes, Pages } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index 54b6b3ccc..ac347cf13 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -1,8 +1,8 @@ -import type { Page } from "@/models/entities/page.js"; +import { IsNull } from "typeorm"; import { Pages, Users } from "@/models/index.js"; +import type { Page } from "@/models/entities/page.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { IsNull } from "typeorm"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/pages/unlike.ts b/packages/backend/src/server/api/endpoints/pages/unlike.ts index 3b020709e..428f98458 100644 --- a/packages/backend/src/server/api/endpoints/pages/unlike.ts +++ b/packages/backend/src/server/api/endpoints/pages/unlike.ts @@ -1,4 +1,4 @@ -import { PageLikes, Pages } from "@/models/index.js"; +import { Pages, PageLikes } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 3189c140a..5f434d02e 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -1,8 +1,8 @@ -import { HOUR } from "@/const.js"; -import { DriveFiles, Pages } from "@/models/index.js"; +import { Not } from "typeorm"; +import { Pages, DriveFiles } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Not } from "typeorm"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["pages"], diff --git a/packages/backend/src/server/api/endpoints/patrons.ts b/packages/backend/src/server/api/endpoints/patrons.ts index cb939caa5..12a41742b 100644 --- a/packages/backend/src/server/api/endpoints/patrons.ts +++ b/packages/backend/src/server/api/endpoints/patrons.ts @@ -1,8 +1,8 @@ -import * as fs from "node:fs"; -import { dirname } from "node:path"; -import { fileURLToPath } from "node:url"; -import { redisClient } from "@/db/redis.js"; import define from "@/server/api/define.js"; +import { redisClient } from "@/db/redis.js"; +import * as fs from "node:fs"; +import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index b75eb3f21..b32737870 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -1,9 +1,9 @@ -import * as Acct from "@/misc/acct.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { IsNull } from "typeorm"; +import { Users } from "@/models/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import * as Acct from "@/misc/acct.js"; +import type { User } from "@/models/entities/user.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/promo/read.ts b/packages/backend/src/server/api/endpoints/promo/read.ts index eb1cc1285..4b4146790 100644 --- a/packages/backend/src/server/api/endpoints/promo/read.ts +++ b/packages/backend/src/server/api/endpoints/promo/read.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; import { PromoReads } from "@/models/index.js"; -import { getNote } from "@/server/api/common/getters.js"; +import { genId } from "@/misc/gen-id.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getNote } from "@/server/api/common/getters.js"; export const meta = { tags: ["notes"], diff --git a/packages/backend/src/server/api/endpoints/renote-mute/create.ts b/packages/backend/src/server/api/endpoints/renote-mute/create.ts index 6b020c2a2..afe23f38d 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/create.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/create.ts @@ -1,9 +1,9 @@ import { genId } from "@/misc/gen-id.js"; -import { RenoteMuting } from "@/models/entities/renote-muting.js"; import { RenoteMutings } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { RenoteMuting } from "@/models/entities/renote-muting.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts index 436ff8a8e..6a824881b 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/delete.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/delete.ts @@ -1,7 +1,7 @@ import { RenoteMutings } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/renote-mute/list.ts b/packages/backend/src/server/api/endpoints/renote-mute/list.ts index 9dbea9241..b19452714 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/list.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/list.ts @@ -1,6 +1,6 @@ import { RenoteMutings } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["account"], diff --git a/packages/backend/src/server/api/endpoints/request-reset-password.ts b/packages/backend/src/server/api/endpoints/request-reset-password.ts index 802b882ed..3c78058af 100644 --- a/packages/backend/src/server/api/endpoints/request-reset-password.ts +++ b/packages/backend/src/server/api/endpoints/request-reset-password.ts @@ -1,11 +1,11 @@ -import config from "@/config/index.js"; -import { HOUR } from "@/const.js"; -import { genId } from "@/misc/gen-id.js"; -import { PasswordResetRequests, UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; -import { sendEmail } from "@/services/send-email.js"; import rndstr from "rndstr"; import { IsNull } from "typeorm"; +import config from "@/config/index.js"; +import { Users, UserProfiles, PasswordResetRequests } from "@/models/index.js"; +import { sendEmail } from "@/services/send-email.js"; +import { genId } from "@/misc/gen-id.js"; +import define from "@/server/api/define.js"; +import { HOUR } from "@/const.js"; export const meta = { tags: ["reset password"], diff --git a/packages/backend/src/server/api/endpoints/reset-password.ts b/packages/backend/src/server/api/endpoints/reset-password.ts index 8f642f884..ff5c8d987 100644 --- a/packages/backend/src/server/api/endpoints/reset-password.ts +++ b/packages/backend/src/server/api/endpoints/reset-password.ts @@ -1,6 +1,6 @@ -import { hashPassword } from "@/misc/password.js"; -import { PasswordResetRequests, UserProfiles } from "@/models/index.js"; +import { UserProfiles, PasswordResetRequests } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { hashPassword } from "@/misc/password.js"; export const meta = { tags: ["reset password"], diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index dd9ff1627..ff3bfcd10 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -1,8 +1,8 @@ import * as os from "node:os"; +import si from "systeminformation"; +import define from "@/server/api/define.js"; import meilisearch from "@/db/meilisearch.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; -import define from "@/server/api/define.js"; -import si from "systeminformation"; export const meta = { requireCredential: false, diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index 88c5964bc..cd634a798 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -1,7 +1,7 @@ -import config from "@/config/index.js"; -import { UsedUsernames, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { IsNull } from "typeorm"; +import { Users, UsedUsernames } from "@/models/index.js"; +import config from "@/config/index.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index f8a24c290..20371fce9 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -1,7 +1,7 @@ import { Users } from "@/models/index.js"; -import { generateBlockQueryForUsers } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; import define from "@/server/api/define.js"; +import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; +import { generateBlockQueryForUsers } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index f57c3cfd1..132e190bb 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -1,6 +1,6 @@ import { Clips } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["users", "clips"], diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 05847a10a..f57983d4b 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -1,9 +1,9 @@ +import { IsNull } from "typeorm"; +import { Users, Followings, UserProfiles } from "@/models/index.js"; import { toPunyNullable } from "@/misc/convert-host.js"; -import { Followings, UserProfiles, Users } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { IsNull } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 12f4e794b..84eb7cccc 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -1,9 +1,9 @@ +import { IsNull } from "typeorm"; +import { Users, Followings, UserProfiles } from "@/models/index.js"; import { toPunyNullable } from "@/misc/convert-host.js"; -import { Followings, UserProfiles, Users } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { IsNull } from "typeorm"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index dad29f435..e2edbee86 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -1,6 +1,6 @@ +import define from "@/server/api/define.js"; import { GalleryPosts } from "@/models/index.js"; import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; -import define from "@/server/api/define.js"; export const meta = { tags: ["users", "gallery"], diff --git a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts index 3a4caf983..0694bd663 100644 --- a/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/packages/backend/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -1,9 +1,9 @@ -import { Notes, Users } from "@/models/index.js"; +import { Not, In, IsNull } from "typeorm"; import { maximum } from "@/prelude/array.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { Notes, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { In, IsNull, Not } from "typeorm"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/create.ts b/packages/backend/src/server/api/endpoints/users/groups/create.ts index 797906e79..1cfb22301 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/create.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/create.ts @@ -1,7 +1,7 @@ +import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; -import type { UserGroupJoining } from "@/models/entities/user-group-joining.js"; import type { UserGroup } from "@/models/entities/user-group.js"; -import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import type { UserGroupJoining } from "@/models/entities/user-group-joining.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts index dc739da5d..a483ccd18 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -1,8 +1,8 @@ +import { UserGroupJoinings, UserGroupInvitations } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserGroupJoining } from "@/models/entities/user-group-joining.js"; -import { UserGroupInvitations, UserGroupJoinings } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/invite.ts b/packages/backend/src/server/api/endpoints/users/groups/invite.ts index bdc5f2a8e..8a1e6b31e 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/invite.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/invite.ts @@ -1,14 +1,14 @@ +import { + UserGroups, + UserGroupJoinings, + UserGroupInvitations, +} from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserGroupInvitation } from "@/models/entities/user-group-invitation.js"; -import { - UserGroupInvitations, - UserGroupJoinings, - UserGroups, -} from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; import { createNotification } from "@/services/create-notification.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/joined.ts b/packages/backend/src/server/api/endpoints/users/groups/joined.ts index aa9df7f91..5d50b5e33 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/joined.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/joined.ts @@ -1,6 +1,6 @@ -import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import { Not, In } from "typeorm"; +import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import define from "@/server/api/define.js"; -import { In, Not } from "typeorm"; export const meta = { tags: ["groups", "account"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/leave.ts b/packages/backend/src/server/api/endpoints/users/groups/leave.ts index e01b8e168..8165b1d98 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/leave.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/leave.ts @@ -1,4 +1,4 @@ -import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/users/groups/pull.ts b/packages/backend/src/server/api/endpoints/users/groups/pull.ts index a20ac7331..5e7f91d70 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/pull.ts @@ -1,7 +1,7 @@ -import { UserGroupJoinings, UserGroups } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/groups/show.ts b/packages/backend/src/server/api/endpoints/users/groups/show.ts index 20c7f0e87..0cd5a9233 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/show.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/show.ts @@ -1,4 +1,4 @@ -import { UserGroupJoinings, UserGroups } from "@/models/index.js"; +import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; diff --git a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts index e742365c0..b58ea57b7 100644 --- a/packages/backend/src/server/api/endpoints/users/groups/transfer.ts +++ b/packages/backend/src/server/api/endpoints/users/groups/transfer.ts @@ -1,7 +1,7 @@ -import { UserGroupJoinings, UserGroups } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { UserGroups, UserGroupJoinings } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["groups", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index d506b49af..c23e8f6f5 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -1,6 +1,6 @@ +import { UserLists } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { UserList } from "@/models/entities/user-list.js"; -import { UserLists } from "@/models/index.js"; import define from "@/server/api/define.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/users/lists/pull.ts b/packages/backend/src/server/api/endpoints/users/lists/pull.ts index 69dc27270..ffca5b205 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/pull.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/pull.ts @@ -1,8 +1,8 @@ -import { UserListJoinings, UserLists, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { publishUserListStream } from "@/services/stream.js"; +import { UserLists, UserListJoinings, Users } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { publishUserListStream } from "@/services/stream.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["lists", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 2aa8c425e..8dd4442d0 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -1,8 +1,8 @@ -import { Blockings, UserListJoinings, UserLists } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; +import { pushUserToUserList } from "@/services/user-list/push.js"; +import { UserLists, UserListJoinings, Blockings } from "@/models/index.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { pushUserToUserList } from "@/services/user-list/push.js"; +import { getUser } from "@/server/api/common/getters.js"; export const meta = { tags: ["lists", "users"], diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 63a74276b..1485dfa6c 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -1,12 +1,12 @@ +import { Brackets } from "typeorm"; import { Notes } from "@/models/index.js"; -import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { getUser } from "@/server/api/common/getters.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; import { ApiError } from "@/server/api/error.js"; -import { Brackets } from "typeorm"; +import { getUser } from "@/server/api/common/getters.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; +import { generateMutedUserQuery } from "@/server/api/common/generate-muted-user-query.js"; +import { generateBlockedUserQuery } from "@/server/api/common/generate-block-query.js"; export const meta = { tags: ["users", "notes"], diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index 774e48716..1af50e78a 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -1,6 +1,6 @@ import { Pages } from "@/models/index.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; export const meta = { tags: ["users", "pages"], diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index 3a41c671b..483a78865 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -1,7 +1,7 @@ import { NoteReactions, UserProfiles } from "@/models/index.js"; -import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; -import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; import define from "@/server/api/define.js"; +import { makePaginationQuery } from "@/server/api/common/make-pagination-query.js"; +import { generateVisibilityQuery } from "@/server/api/common/generate-visibility-query.js"; import { ApiError } from "@/server/api/error.js"; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 6b65d92e3..4ea0d618e 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -1,11 +1,11 @@ -import { DAY } from "@/const.js"; -import { Followings, Users } from "@/models/index.js"; -import { - generateBlockQueryForUsers, - generateBlockedUserQuery, -} from "@/server/api/common/generate-block-query.js"; -import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; +import { Users, Followings } from "@/models/index.js"; import define from "@/server/api/define.js"; +import { generateMutedUserQueryForUsers } from "@/server/api/common/generate-muted-user-query.js"; +import { + generateBlockedUserQuery, + generateBlockQueryForUsers, +} from "@/server/api/common/generate-block-query.js"; +import { DAY } from "@/const.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/report-abuse.ts b/packages/backend/src/server/api/endpoints/users/report-abuse.ts index 988dfa9da..7e9ba7238 100644 --- a/packages/backend/src/server/api/endpoints/users/report-abuse.ts +++ b/packages/backend/src/server/api/endpoints/users/report-abuse.ts @@ -1,14 +1,14 @@ -import { toHtml } from "@/mfm/to-html.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { genId } from "@/misc/gen-id.js"; -import { AbuseUserReports, UserProfiles, Users } from "@/models/index.js"; -import { getUser } from "@/server/api/common/getters.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { sendEmail } from "@/services/send-email.js"; -import { publishAdminStream } from "@/services/stream.js"; import * as mfm from "mfm-js"; import sanitizeHtml from "sanitize-html"; +import { publishAdminStream } from "@/services/stream.js"; +import { AbuseUserReports, UserProfiles, Users } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { sendEmail } from "@/services/send-email.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getUser } from "@/server/api/common/getters.js"; +import { ApiError } from "@/server/api/error.js"; +import define from "@/server/api/define.js"; +import { toHtml } from "@/mfm/to-html.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 44a10ec68..517ef615b 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -1,8 +1,8 @@ -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import type { User } from "@/models/entities/user.js"; -import { Followings, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { Brackets } from "typeorm"; +import { Followings, Users } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import define from "@/server/api/define.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index bfb1560a7..3aef6dc90 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -1,8 +1,8 @@ -import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; -import type { User } from "@/models/entities/user.js"; -import { UserProfiles, Users } from "@/models/index.js"; -import define from "@/server/api/define.js"; import { Brackets } from "typeorm"; +import { UserProfiles, Users } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import define from "@/server/api/define.js"; +import { sqlLikeEscape } from "@/misc/sql-like-escape.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index a7704a85b..61812a018 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -1,11 +1,11 @@ -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import { resolveUser } from "@/remote/resolve-user.js"; -import define from "@/server/api/define.js"; -import { ApiError } from "@/server/api/error.js"; -import { apiLogger } from "@/server/api/logger.js"; import type { FindOptionsWhere } from "typeorm"; import { In, IsNull } from "typeorm"; +import { resolveUser } from "@/remote/resolve-user.js"; +import { Users } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import define from "@/server/api/define.js"; +import { apiLogger } from "@/server/api/logger.js"; +import { ApiError } from "@/server/api/error.js"; export const meta = { tags: ["users"], diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index edce9be2b..a5970d584 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -2,31 +2,31 @@ * API Server */ -import config from "@/config/index.js"; -import { AccessTokens, Users } from "@/models/index.js"; -import cors from "@koa/cors"; -import multer from "@koa/multer"; -import Router from "@koa/router"; import Koa from "koa"; -import { koaBody } from "koa-body"; +import Router from "@koa/router"; +import multer from "@koa/multer"; import bodyParser from "koa-bodyparser"; -import handler from "./api-handler.js"; -import compatibility from "./compatibility.js"; -import endpoints from "./endpoints.js"; +import cors from "@koa/cors"; import { apiMastodonCompatible, getClient, } from "./mastodon/ApiMastodonCompatibleService.js"; -import { convertAttachment } from "./mastodon/converters.js"; +import { AccessTokens, Users } from "@/models/index.js"; +import config from "@/config/index.js"; +import endpoints from "./endpoints.js"; +import compatibility from "./compatibility.js"; +import handler from "./api-handler.js"; +import signup from "./private/signup.js"; import signin from "./private/signin.js"; import signupPending from "./private/signup-pending.js"; -import signup from "./private/signup.js"; import verifyEmail from "./private/verify-email.js"; +import { koaBody } from "koa-body"; +import { convertAttachment } from "./mastodon/converters.js"; // TODO?: should we avoid importing things from built directory? import { - IdConvertType as IdType, convertId, + IdConvertType as IdType, } from "native-utils/built/index.js"; // re-export native rust id conversion (function and enum) diff --git a/packages/backend/src/server/api/limiter.ts b/packages/backend/src/server/api/limiter.ts index edaed8f2d..f03f8754c 100644 --- a/packages/backend/src/server/api/limiter.ts +++ b/packages/backend/src/server/api/limiter.ts @@ -1,8 +1,8 @@ -import { redisClient } from "@/db/redis.js"; -import { convertMilliseconds } from "@/misc/convert-milliseconds.js"; -import Logger from "@/services/logger.js"; import Limiter from "ratelimiter"; +import Logger from "@/services/logger.js"; +import { redisClient } from "@/db/redis.js"; import type { IEndpointMeta } from "./endpoints.js"; +import { convertMilliseconds } from "@/misc/convert-milliseconds.js"; const logger = new Logger("limiter"); diff --git a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts index c58709eac..e029bc604 100644 --- a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts +++ b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts @@ -1,21 +1,21 @@ -import { Users } from "@/models/index.js"; -import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import megalodon, { MegalodonInterface } from "megalodon"; -import { IsNull } from "typeorm"; +import { apiAuthMastodon } from "./endpoints/auth.js"; +import { apiAccountMastodon } from "./endpoints/account.js"; +import { apiStatusMastodon } from "./endpoints/status.js"; +import { apiFilterMastodon } from "./endpoints/filter.js"; +import { apiTimelineMastodon } from "./endpoints/timeline.js"; +import { apiNotificationsMastodon } from "./endpoints/notifications.js"; +import { apiSearchMastodon } from "./endpoints/search.js"; +import { getInstance } from "./endpoints/meta.js"; import { convertAccount, convertAnnouncement, convertFilter, } from "./converters.js"; -import { apiAccountMastodon } from "./endpoints/account.js"; -import { apiAuthMastodon } from "./endpoints/auth.js"; -import { apiFilterMastodon } from "./endpoints/filter.js"; -import { getInstance } from "./endpoints/meta.js"; -import { apiNotificationsMastodon } from "./endpoints/notifications.js"; -import { apiSearchMastodon } from "./endpoints/search.js"; -import { apiStatusMastodon } from "./endpoints/status.js"; -import { apiTimelineMastodon } from "./endpoints/timeline.js"; +import { convertId, IdType } from "@/server/api/index.js"; +import { Users } from "@/models/index.js"; +import { IsNull } from "typeorm"; export function getClient( BASE_URL: string, diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 03217d800..30506d9c5 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -1,5 +1,5 @@ -import { IdType, convertId } from "@/server/api/index.js"; import { Entity } from "megalodon"; +import { convertId, IdType } from "@/server/api/index.js"; function simpleConvert(data: any) { // copy the object to bypass weird pass by reference bugs diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 9d9c2c54f..76c3af378 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -1,6 +1,7 @@ -import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; +import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; +import { convertId, IdType } from "@/server/api/index.js"; import { convertAccount, convertFeaturedTag, @@ -8,7 +9,6 @@ import { convertRelationship, convertStatus, } from "../converters.js"; -import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js"; const relationshipModel = { id: "", @@ -34,7 +34,7 @@ export function apiAccountMastodon(router: Router): void { const client = getClient(BASE_URL, accessTokens); try { const data = await client.verifyAccountCredentials(); - const acct = data.data; + let acct = data.data; acct.id = convertId(acct.id, IdType.MastodonId); acct.display_name = acct.display_name || acct.username; acct.url = `${BASE_URL}/@${acct.url}`; @@ -109,7 +109,7 @@ export function apiAccountMastodon(router: Router): void { return; } - const reqIds = []; + let reqIds = []; for (let i = 0; i < ids.length; i++) { reqIds.push(convertId(ids[i], IdType.FirefishId)); } @@ -120,7 +120,7 @@ export function apiAccountMastodon(router: Router): void { ); } catch (e: any) { console.error(e); - const data = e.response.data; + let data = e.response.data; data.users = users; console.error(data); ctx.status = 401; @@ -250,7 +250,7 @@ export function apiAccountMastodon(router: Router): void { const data = await client.followAccount( convertId(ctx.params.id, IdType.FirefishId), ); - const acct = convertRelationship(data.data); + let acct = convertRelationship(data.data); acct.following = true; ctx.body = acct; } catch (e: any) { @@ -271,7 +271,7 @@ export function apiAccountMastodon(router: Router): void { const data = await client.unfollowAccount( convertId(ctx.params.id, IdType.FirefishId), ); - const acct = convertRelationship(data.data); + let acct = convertRelationship(data.data); acct.following = false; ctx.body = acct; } catch (e: any) { diff --git a/packages/backend/src/server/api/mastodon/endpoints/filter.ts b/packages/backend/src/server/api/mastodon/endpoints/filter.ts index a3a6c33c3..6524fd2f6 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/filter.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/filter.ts @@ -1,6 +1,6 @@ -import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; +import { IdType, convertId } from "@/server/api/index.js"; import { convertFilter } from "../converters.js"; export function apiFilterMastodon(router: Router): void { diff --git a/packages/backend/src/server/api/mastodon/endpoints/meta.ts b/packages/backend/src/server/api/mastodon/endpoints/meta.ts index 52e43ff8c..c458798d5 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/meta.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/meta.ts @@ -1,7 +1,7 @@ -import config from "@/config/index.js"; -import { FILE_TYPE_BROWSERSAFE, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import { Entity } from "megalodon"; +import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { MAX_NOTE_TEXT_LENGTH, FILE_TYPE_BROWSERSAFE } from "@/const.js"; export async function getInstance( response: Entity.Instance, diff --git a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts index da5900467..9628eccdd 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts @@ -1,8 +1,8 @@ -import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; +import { convertId, IdType } from "@/server/api/index.js"; import { getClient } from "../ApiMastodonCompatibleService.js"; -import { convertNotification } from "../converters.js"; import { convertTimelinesArgsId } from "./timeline.js"; +import { convertNotification } from "../converters.js"; function toLimitToInt(q: any) { if (q.limit) if (typeof q.limit === "string") q.limit = parseInt(q.limit, 10); return q; diff --git a/packages/backend/src/server/api/mastodon/endpoints/search.ts b/packages/backend/src/server/api/mastodon/endpoints/search.ts index d6ef388b6..c9bbab0a4 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/search.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/search.ts @@ -1,9 +1,9 @@ import Router from "@koa/router"; +import { getClient } from "../ApiMastodonCompatibleService.js"; import axios from "axios"; import { Converter } from "megalodon"; -import { getClient } from "../ApiMastodonCompatibleService.js"; -import { convertAccount, convertStatus } from "../converters.js"; import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; +import { convertAccount, convertStatus } from "../converters.js"; export function apiSearchMastodon(router: Router): void { router.get("/v1/search", async (ctx) => { diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index 6c6c0211c..ac1cbe602 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -1,17 +1,17 @@ -import querystring from "node:querystring"; -import { emojiRegexAtStartToEnd } from "@/misc/emoji-regex.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; -import qs from "qs"; import { getClient } from "../ApiMastodonCompatibleService.js"; +import { emojiRegexAtStartToEnd } from "@/misc/emoji-regex.js"; +import querystring from "node:querystring"; +import qs from "qs"; +import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; +import { convertId, IdType } from "@/server/api/index.js"; import { convertAccount, convertAttachment, convertPoll, convertStatus, } from "../converters.js"; -import { convertTimelinesArgsId, limitToInt } from "./timeline.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; function normalizeQuery(data: any) { const str = querystring.stringify(data); diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts index 747afc089..05741c4ce 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts @@ -1,16 +1,16 @@ -import { ParsedUrlQuery } from "querystring"; -import { IdType, convertId } from "@/server/api/index.js"; import Router from "@koa/router"; import { getClient } from "../ApiMastodonCompatibleService.js"; +import { ParsedUrlQuery } from "querystring"; import { convertAccount, convertConversation, convertList, convertStatus, } from "../converters.js"; +import { convertId, IdType } from "@/server/api/index.js"; export function limitToInt(q: ParsedUrlQuery) { - const object: any = q; + let object: any = q; if (q.limit) if (typeof q.limit === "string") object.limit = parseInt(q.limit, 10); if (q.offset) @@ -27,7 +27,7 @@ export function argsToBools(q: ParsedUrlQuery) { // - https://docs.joinmastodon.org/methods/accounts/#statuses // - https://docs.joinmastodon.org/methods/timelines/#public // - https://docs.joinmastodon.org/methods/timelines/#tag - const object: any = q; + let object: any = q; if (q.only_media) if (typeof q.only_media === "string") object.only_media = toBoolean(q.only_media); diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index 02164e87f..ec8c1ca03 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -1,7 +1,7 @@ -import config from "@/config/index.js"; import endpoints from "@/server/api/endpoints.js"; +import config from "@/config/index.js"; import { errors as basicErrors } from "./errors.js"; -import { convertSchemaToOpenApiSchema, schemas } from "./schemas.js"; +import { schemas, convertSchemaToOpenApiSchema } from "./schemas.js"; export function genOpenapiSpec() { const spec = { diff --git a/packages/backend/src/server/api/private/signin.ts b/packages/backend/src/server/api/private/signin.ts index 8db5c95ff..3e70d80fe 100644 --- a/packages/backend/src/server/api/private/signin.ts +++ b/packages/backend/src/server/api/private/signin.ts @@ -1,26 +1,26 @@ -import { randomBytes } from "node:crypto"; +import type Koa from "koa"; +import * as OTPAuth from "otpauth"; +import signin from "@/server/api/common/signin.js"; import config from "@/config/index.js"; +import { + Users, + Signins, + UserProfiles, + UserSecurityKeys, + AttestationChallenges, +} from "@/models/index.js"; +import type { ILocalUser } from "@/models/entities/user.js"; import { genId } from "@/misc/gen-id.js"; -import { getIpHash } from "@/misc/get-ip-hash.js"; import { comparePassword, hashPassword, isOldAlgorithm, } from "@/misc/password.js"; -import type { ILocalUser } from "@/models/entities/user.js"; -import { - AttestationChallenges, - Signins, - UserProfiles, - UserSecurityKeys, - Users, -} from "@/models/index.js"; -import { hash, verifyLogin } from "@/server/api/2fa.js"; -import signin from "@/server/api/common/signin.js"; -import { limiter } from "@/server/api/limiter.js"; -import type Koa from "koa"; -import * as OTPAuth from "otpauth"; +import { verifyLogin, hash } from "@/server/api/2fa.js"; +import { randomBytes } from "node:crypto"; import { IsNull } from "typeorm"; +import { limiter } from "@/server/api/limiter.js"; +import { getIpHash } from "@/misc/get-ip-hash.js"; export default async (ctx: Koa.Context) => { ctx.set("Access-Control-Allow-Origin", config.url); diff --git a/packages/backend/src/server/api/private/signup-pending.ts b/packages/backend/src/server/api/private/signup-pending.ts index 3a422c91c..b92fb90b3 100644 --- a/packages/backend/src/server/api/private/signup-pending.ts +++ b/packages/backend/src/server/api/private/signup-pending.ts @@ -1,7 +1,7 @@ -import { UserPendings, UserProfiles } from "@/models/index.js"; -import signin from "@/server/api/common/signin.js"; -import { signup } from "@/server/api/common/signup.js"; import type Koa from "koa"; +import { UserPendings, UserProfiles } from "@/models/index.js"; +import { signup } from "@/server/api/common/signup.js"; +import signin from "@/server/api/common/signin.js"; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/packages/backend/src/server/api/private/signup.ts b/packages/backend/src/server/api/private/signup.ts index 511c34ff3..d60e5a191 100644 --- a/packages/backend/src/server/api/private/signup.ts +++ b/packages/backend/src/server/api/private/signup.ts @@ -1,14 +1,14 @@ -import config from "@/config/index.js"; -import { verifyHcaptcha, verifyRecaptcha } from "@/misc/captcha.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { genId } from "@/misc/gen-id.js"; -import { hashPassword } from "@/misc/password.js"; -import { RegistrationTickets, UserPendings, Users } from "@/models/index.js"; -import { signup } from "@/server/api/common/signup.js"; -import { sendEmail } from "@/services/send-email.js"; -import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; import type Koa from "koa"; import rndstr from "rndstr"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { verifyHcaptcha, verifyRecaptcha } from "@/misc/captcha.js"; +import { Users, RegistrationTickets, UserPendings } from "@/models/index.js"; +import { signup } from "@/server/api/common/signup.js"; +import config from "@/config/index.js"; +import { sendEmail } from "@/services/send-email.js"; +import { genId } from "@/misc/gen-id.js"; +import { validateEmailForAccount } from "@/services/validate-email-for-account.js"; +import { hashPassword } from "@/misc/password.js"; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/packages/backend/src/server/api/private/verify-email.ts b/packages/backend/src/server/api/private/verify-email.ts index b480b3878..e6c8295d1 100644 --- a/packages/backend/src/server/api/private/verify-email.ts +++ b/packages/backend/src/server/api/private/verify-email.ts @@ -1,6 +1,6 @@ -import { UserProfiles, Users } from "@/models/index.js"; -import { publishMainStream } from "@/services/stream.js"; import type Koa from "koa"; +import { Users, UserProfiles } from "@/models/index.js"; +import { publishMainStream } from "@/services/stream.js"; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts index 67681b993..fc8e0ce35 100644 --- a/packages/backend/src/server/api/stream/channel.ts +++ b/packages/backend/src/server/api/stream/channel.ts @@ -1,8 +1,8 @@ -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import type { Packed } from "@/misc/schema.js"; +import type Connection from "."; import type { Note } from "@/models/entities/note.js"; import { Notes } from "@/models/index.js"; -import type Connection from "."; +import type { Packed } from "@/misc/schema.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; /** * Stream channel diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts index 6aae49d15..ec5a8b175 100644 --- a/packages/backend/src/server/api/stream/channels/antenna.ts +++ b/packages/backend/src/server/api/stream/channels/antenna.ts @@ -1,8 +1,8 @@ -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; -import { Notes } from "@/models/index.js"; import Channel from "../channel.js"; +import { Notes } from "@/models/index.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; import type { StreamMessages } from "../types.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; export default class extends Channel { public readonly chName = "antenna"; diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index b668544b8..2ff4e0820 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -1,9 +1,9 @@ -import { isUserRelated } from "@/misc/is-user-related.js"; -import type { Packed } from "@/misc/schema.js"; -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; import Channel from "../channel.js"; +import { Users } from "@/models/index.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; +import type { User } from "@/models/entities/user.js"; import type { StreamMessages } from "../types.js"; +import type { Packed } from "@/misc/schema.js"; export default class extends Channel { public readonly chName = "channel"; diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index a5af7038d..e750ac92b 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -1,9 +1,9 @@ -import { getWordHardMute } from "@/misc/check-word-mute.js"; +import Channel from "../channel.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; import { isInstanceMuted } from "@/misc/is-instance-muted.js"; import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; -import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "globalTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts index d44fef110..011bb0889 100644 --- a/packages/backend/src/server/api/stream/channels/hashtag.ts +++ b/packages/backend/src/server/api/stream/channels/hashtag.ts @@ -1,7 +1,7 @@ -import { isUserRelated } from "@/misc/is-user-related.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import type { Packed } from "@/misc/schema.js"; import Channel from "../channel.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; +import type { Packed } from "@/misc/schema.js"; export default class extends Channel { public readonly chName = "hashtag"; diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 0136d3e7a..5aafe865b 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -1,8 +1,8 @@ -import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { isInstanceMuted } from "@/misc/is-instance-muted.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; -import type { Packed } from "@/misc/schema.js"; import Channel from "../channel.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; +import { isInstanceMuted } from "@/misc/is-instance-muted.js"; +import type { Packed } from "@/misc/schema.js"; export default class extends Channel { public readonly chName = "homeTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index cfca4cec5..2ec53a3fa 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -1,9 +1,9 @@ -import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { isInstanceMuted } from "@/misc/is-instance-muted.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; -import type { Packed } from "@/misc/schema.js"; import Channel from "../channel.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; +import { isInstanceMuted } from "@/misc/is-instance-muted.js"; +import type { Packed } from "@/misc/schema.js"; export default class extends Channel { public readonly chName = "hybridTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/index.ts b/packages/backend/src/server/api/stream/channels/index.ts index 60d703e52..d1127be47 100644 --- a/packages/backend/src/server/api/stream/channels/index.ts +++ b/packages/backend/src/server/api/stream/channels/index.ts @@ -1,19 +1,19 @@ -import admin from "./admin.js"; -import antenna from "./antenna.js"; -import channel from "./channel.js"; -import drive from "./drive.js"; -import globalTimeline from "./global-timeline.js"; -import hashtag from "./hashtag.js"; -import homeTimeline from "./home-timeline.js"; -import hybridTimeline from "./hybrid-timeline.js"; -import localTimeline from "./local-timeline.js"; import main from "./main.js"; -import messagingIndex from "./messaging-index.js"; -import messaging from "./messaging.js"; -import queueStats from "./queue-stats.js"; +import homeTimeline from "./home-timeline.js"; +import localTimeline from "./local-timeline.js"; +import hybridTimeline from "./hybrid-timeline.js"; import recommendedTimeline from "./recommended-timeline.js"; +import globalTimeline from "./global-timeline.js"; import serverStats from "./server-stats.js"; +import queueStats from "./queue-stats.js"; import userList from "./user-list.js"; +import antenna from "./antenna.js"; +import messaging from "./messaging.js"; +import messagingIndex from "./messaging-index.js"; +import drive from "./drive.js"; +import hashtag from "./hashtag.js"; +import channel from "./channel.js"; +import admin from "./admin.js"; export default { main, diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 3cbac3b88..40e38c24f 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -1,8 +1,8 @@ -import { getWordHardMute } from "@/misc/check-word-mute.js"; +import Channel from "../channel.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; -import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "localTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts index 2eb1d02a2..b8c72442f 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -1,8 +1,8 @@ +import Channel from "../channel.js"; import { isInstanceMuted, isUserFromMutedInstance, } from "@/misc/is-instance-muted.js"; -import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "main"; diff --git a/packages/backend/src/server/api/stream/channels/messaging.ts b/packages/backend/src/server/api/stream/channels/messaging.ts index f7746fe78..a650db8b9 100644 --- a/packages/backend/src/server/api/stream/channels/messaging.ts +++ b/packages/backend/src/server/api/stream/channels/messaging.ts @@ -1,12 +1,12 @@ -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; -import { MessagingMessages, UserGroupJoinings, Users } from "@/models/index.js"; import { - deliverReadActivity, - readGroupMessagingMessage, readUserMessagingMessage, + readGroupMessagingMessage, + deliverReadActivity, } from "@/server/api/common/read-messaging-message.js"; import Channel from "../channel.js"; +import { UserGroupJoinings, Users, MessagingMessages } from "@/models/index.js"; +import type { User, ILocalUser, IRemoteUser } from "@/models/entities/user.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; import type { StreamMessages } from "../types.js"; export default class extends Channel { diff --git a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts index 1b1a618f0..bbbc4e7a9 100644 --- a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts @@ -1,9 +1,9 @@ -import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { isInstanceMuted } from "@/misc/is-instance-muted.js"; -import { isUserRelated } from "@/misc/is-user-related.js"; -import type { Packed } from "@/misc/schema.js"; import Channel from "../channel.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { isUserRelated } from "@/misc/is-user-related.js"; +import { isInstanceMuted } from "@/misc/is-instance-muted.js"; +import type { Packed } from "@/misc/schema.js"; export default class extends Channel { public readonly chName = "recommendedTimeline"; diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index 752dfa258..d14031950 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -1,8 +1,8 @@ +import Channel from "../channel.js"; +import { UserListJoinings, UserLists } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; import { isUserRelated } from "@/misc/is-user-related.js"; import type { Packed } from "@/misc/schema.js"; -import type { User } from "@/models/entities/user.js"; -import { UserListJoinings, UserLists } from "@/models/index.js"; -import Channel from "../channel.js"; export default class extends Channel { public readonly chName = "userList"; diff --git a/packages/backend/src/server/api/stream/index.ts b/packages/backend/src/server/api/stream/index.ts index 750a7ae9f..86408a03d 100644 --- a/packages/backend/src/server/api/stream/index.ts +++ b/packages/backend/src/server/api/stream/index.ts @@ -1,32 +1,32 @@ import type { EventEmitter } from "events"; -import type { Packed } from "@/misc/schema.js"; -import type { AccessToken } from "@/models/entities/access-token.js"; -import type { Channel as ChannelModel } from "@/models/entities/channel.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; +import type * as websocket from "websocket"; +import readNote from "@/services/note/read.js"; import type { User } from "@/models/entities/user.js"; +import type { Channel as ChannelModel } from "@/models/entities/channel.js"; import { - Blockings, - ChannelFollowings, + Users, Followings, Mutings, RenoteMutings, UserProfiles, - Users, + ChannelFollowings, + Blockings, } from "@/models/index.js"; -import { readNotification } from "@/server/api/common/read-notification.js"; -import { getClient } from "@/server/api/mastodon/ApiMastodonCompatibleService.js"; -import readNote from "@/services/note/read.js"; +import type { AccessToken } from "@/models/entities/access-token.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; import { publishChannelStream, publishGroupMessagingStream, publishMessagingStream, } from "@/services/stream.js"; -import { Converter } from "megalodon"; -import type * as websocket from "websocket"; -import type Channel from "./channel.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { Packed } from "@/misc/schema.js"; +import { readNotification } from "@/server/api/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 "megalodon"; +import { getClient } from "@/server/api/mastodon/ApiMastodonCompatibleService.js"; /** * Main stream connection @@ -159,7 +159,7 @@ export default class Connection { // is Mastodon Compatible this.isMastodonCompatible = true; if (simpleObj.type === "subscribe") { - const forSubscribe = []; + let forSubscribe = []; if (simpleObj.stream === "user") { this.currentSubscribe.push(["user"]); objs = [ diff --git a/packages/backend/src/server/api/stream/types.ts b/packages/backend/src/server/api/stream/types.ts index 07c9202a6..91095a46d 100644 --- a/packages/backend/src/server/api/stream/types.ts +++ b/packages/backend/src/server/api/stream/types.ts @@ -1,20 +1,20 @@ import type { EventEmitter } from "events"; -import type { Packed } from "@/misc/schema.js"; -import type { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; -import type { Antenna } from "@/models/entities/antenna.js"; +import type Emitter from "strict-event-emitter-types"; import type { Channel } from "@/models/entities/channel.js"; +import type { User } from "@/models/entities/user.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; +import type { Note } from "@/models/entities/note.js"; +import type { Antenna } from "@/models/entities/antenna.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; import type { DriveFolder } from "@/models/entities/drive-folder.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; -import type { Note } from "@/models/entities/note.js"; -import type { Page } from "@/models/entities/page.js"; -import type { Signin } from "@/models/entities/signin.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; import type { UserList } from "@/models/entities/user-list.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; -import type { User } from "@/models/entities/user.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { AbuseUserReport } from "@/models/entities/abuse-user-report.js"; +import type { Signin } from "@/models/entities/signin.js"; +import type { Page } from "@/models/entities/page.js"; +import type { Packed } from "@/misc/schema.js"; import type { Webhook } from "@/models/entities/webhook"; -import type Emitter from "strict-event-emitter-types"; //#region Stream type-body definitions export interface InternalStreamTypes { diff --git a/packages/backend/src/server/api/streaming.ts b/packages/backend/src/server/api/streaming.ts index 96ee49ce1..14e07b748 100644 --- a/packages/backend/src/server/api/streaming.ts +++ b/packages/backend/src/server/api/streaming.ts @@ -1,12 +1,12 @@ -import { EventEmitter } from "events"; import type * as http from "node:http"; +import { EventEmitter } from "events"; import type { ParsedUrlQuery } from "querystring"; import * as websocket from "websocket"; import { subscriber as redisClient } from "@/db/redis.js"; import { Users } from "@/models/index.js"; -import authenticate from "./authenticate.js"; import MainStreamConnection from "./stream/index.js"; +import authenticate from "./authenticate.js"; export const initializeStreamingServer = (server: http.Server) => { // Init websocket server diff --git a/packages/backend/src/server/file/byte-range-readable.ts b/packages/backend/src/server/file/byte-range-readable.ts index 04d9b4ee6..96dcbc4a5 100644 --- a/packages/backend/src/server/file/byte-range-readable.ts +++ b/packages/backend/src/server/file/byte-range-readable.ts @@ -1,6 +1,6 @@ +import { Readable, ReadableOptions } from "node:stream"; import { Buffer } from "node:buffer"; import * as fs from "node:fs"; -import { Readable, ReadableOptions } from "node:stream"; interface ByteRange { start: bigint; @@ -82,7 +82,7 @@ function extractRanges( } function createBoundary(len: number): string { - const chars = []; + let chars = []; for (let i = 0; i < len; i = i + 1) { chars[i] = BOUNDARY_CHARS.charAt( Math.floor(Math.random() * BOUNDARY_CHARS.length), diff --git a/packages/backend/src/server/file/index.ts b/packages/backend/src/server/file/index.ts index 1b1e81a21..26df1de51 100644 --- a/packages/backend/src/server/file/index.ts +++ b/packages/backend/src/server/file/index.ts @@ -3,11 +3,11 @@ */ import * as fs from "node:fs"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; +import Koa from "koa"; import cors from "@koa/cors"; import Router from "@koa/router"; -import Koa from "koa"; import sendDriveFile from "./send-drive-file.js"; const _filename = fileURLToPath(import.meta.url); diff --git a/packages/backend/src/server/file/send-drive-file.ts b/packages/backend/src/server/file/send-drive-file.ts index 704bb394b..cb2993491 100644 --- a/packages/backend/src/server/file/send-drive-file.ts +++ b/packages/backend/src/server/file/send-drive-file.ts @@ -1,21 +1,21 @@ import * as fs from "node:fs"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import { contentDisposition } from "@/misc/content-disposition.js"; -import { createTemp } from "@/misc/create-temp.js"; -import { downloadUrl } from "@/misc/download-url.js"; -import { StatusError } from "@/misc/fetch.js"; -import { detectType } from "@/misc/get-file-info.js"; -import { DriveFiles } from "@/models/index.js"; -import { GenerateVideoThumbnail } from "@/services/drive/generate-video-thumbnail.js"; -import { convertToWebp } from "@/services/drive/image-processor.js"; -import { InternalStorage } from "@/services/drive/internal-storage.js"; +import { dirname } from "node:path"; import type Koa from "koa"; import send from "koa-send"; import rename from "rename"; import { serverLogger } from "../index.js"; +import { contentDisposition } from "@/misc/content-disposition.js"; +import { DriveFiles } from "@/models/index.js"; +import { InternalStorage } from "@/services/drive/internal-storage.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { downloadUrl } from "@/misc/download-url.js"; +import { detectType } from "@/misc/get-file-info.js"; +import { convertToWebp } from "@/services/drive/image-processor.js"; +import { GenerateVideoThumbnail } from "@/services/drive/generate-video-thumbnail.js"; +import { StatusError } from "@/misc/fetch.js"; import { ByteRangeReadable } from "./byte-range-readable.js"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index 883314d77..3a9f62f33 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -5,34 +5,34 @@ import cluster from "node:cluster"; import * as fs from "node:fs"; import * as http from "node:http"; -import cors from "@koa/cors"; -import Router from "@koa/router"; import Koa from "koa"; -import koaLogger from "koa-logger"; +import Router from "@koa/router"; +import cors from "@koa/cors"; import mount from "koa-mount"; +import koaLogger from "koa-logger"; import * as slow from "koa-slow"; +import { IsNull } from "typeorm"; import config from "@/config/index.js"; -import { envOption } from "@/env.js"; -import * as Acct from "@/misc/acct.js"; -import { createTemp } from "@/misc/create-temp.js"; +import Logger from "@/services/logger.js"; +import { Users } from "@/models/index.js"; import { fetchMeta } from "@/misc/fetch-meta.js"; import { genIdenticon } from "@/misc/gen-identicon.js"; -import { Users } from "@/models/index.js"; -import Logger from "@/services/logger.js"; -import { koaBody } from "koa-body"; -import removeTrailingSlash from "koa-remove-trailing-slashes"; +import { createTemp } from "@/misc/create-temp.js"; +import * as Acct from "@/misc/acct.js"; +import { envOption } from "@/env.js"; import megalodon, { MegalodonInterface } from "megalodon"; -import { IsNull } from "typeorm"; -import { v4 as uuid } from "uuid"; import activityPub from "./activitypub.js"; -import apiServer from "./api/index.js"; -import { initializeStreamingServer } from "./api/streaming.js"; -import fileServer from "./file/index.js"; import nodeinfo from "./nodeinfo.js"; +import wellKnown from "./well-known.js"; +import apiServer from "./api/index.js"; +import fileServer from "./file/index.js"; import proxyServer from "./proxy/index.js"; import webServer from "./web/index.js"; -import wellKnown from "./well-known.js"; +import { initializeStreamingServer } from "./api/streaming.js"; +import { koaBody } from "koa-body"; +import removeTrailingSlash from "koa-remove-trailing-slashes"; +import { v4 as uuid } from "uuid"; export const serverLogger = new Logger("server", "gray", false); diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 665636dc9..a1d519f3e 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -1,10 +1,10 @@ -import config from "@/config/index.js"; -import { MAX_CAPTION_TEXT_LENGTH, MAX_NOTE_TEXT_LENGTH } from "@/const.js"; -import { Cache } from "@/misc/cache.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Notes, Users } from "@/models/index.js"; import Router from "@koa/router"; +import config from "@/config/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Users, Notes } from "@/models/index.js"; import { IsNull, MoreThan } from "typeorm"; +import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; +import { Cache } from "@/misc/cache.js"; const router = new Router(); diff --git a/packages/backend/src/server/proxy/index.ts b/packages/backend/src/server/proxy/index.ts index 4cc656916..004b3779f 100644 --- a/packages/backend/src/server/proxy/index.ts +++ b/packages/backend/src/server/proxy/index.ts @@ -2,9 +2,9 @@ * Media Proxy */ +import Koa from "koa"; import cors from "@koa/cors"; import Router from "@koa/router"; -import Koa from "koa"; import { proxyMedia } from "./proxy-media.js"; // Init app diff --git a/packages/backend/src/server/proxy/proxy-media.ts b/packages/backend/src/server/proxy/proxy-media.ts index 1a8626bbc..ed607daa0 100644 --- a/packages/backend/src/server/proxy/proxy-media.ts +++ b/packages/backend/src/server/proxy/proxy-media.ts @@ -1,17 +1,17 @@ -import { promises } from "node:dns"; import * as fs from "node:fs"; import net from "node:net"; -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import { createTemp } from "@/misc/create-temp.js"; -import { downloadUrl } from "@/misc/download-url.js"; -import { StatusError } from "@/misc/fetch.js"; -import { detectType } from "@/misc/get-file-info.js"; -import { isMimeImage } from "@/misc/is-mime-image.js"; -import type { IImage } from "@/services/drive/image-processor.js"; -import { convertToWebp } from "@/services/drive/image-processor.js"; +import { promises } from "node:dns"; import type Koa from "koa"; import sharp from "sharp"; +import type { IImage } from "@/services/drive/image-processor.js"; +import { convertToWebp } from "@/services/drive/image-processor.js"; +import { createTemp } from "@/misc/create-temp.js"; +import { downloadUrl } from "@/misc/download-url.js"; +import { detectType } from "@/misc/get-file-info.js"; +import { StatusError } from "@/misc/fetch.js"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; import { serverLogger } from "../index.js"; +import { isMimeImage } from "@/misc/is-mime-image.js"; export async function proxyMedia(ctx: Koa.Context) { let url = "url" in ctx.query ? ctx.query.url : `https://${ctx.params.url}`; diff --git a/packages/backend/src/server/web/feed.ts b/packages/backend/src/server/web/feed.ts index e29528d26..50e6bfc32 100644 --- a/packages/backend/src/server/web/feed.ts +++ b/packages/backend/src/server/web/feed.ts @@ -1,8 +1,8 @@ -import config from "@/config/index.js"; -import type { User } from "@/models/entities/user.js"; -import { DriveFiles, Notes, UserProfiles, Users } from "@/models/index.js"; import { Feed } from "feed"; import { In, IsNull } from "typeorm"; +import config from "@/config/index.js"; +import type { User } from "@/models/entities/user.js"; +import { Notes, DriveFiles, UserProfiles, Users } from "@/models/index.js"; export default async function ( user: User, diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index 12119ef3c..90e40eec7 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -2,39 +2,39 @@ * Web Client Server */ -import { readFileSync } from "node:fs"; import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { readFileSync } from "node:fs"; +import Koa from "koa"; +import Router from "@koa/router"; +import send from "koa-send"; +import favicon from "koa-favicon"; +import views from "@ladjs/koa-views"; +import sharp from "sharp"; import { createBullBoard } from "@bull-board/api"; import { BullAdapter } from "@bull-board/api/bullAdapter.js"; import { KoaAdapter } from "@bull-board/koa"; -import Router from "@koa/router"; -import views from "@ladjs/koa-views"; -import Koa from "koa"; -import favicon from "koa-favicon"; -import send from "koa-send"; -import sharp from "sharp"; -import config from "@/config/index.js"; -import { DAY, MINUTE } from "@/const.js"; -import * as Acct from "@/misc/acct.js"; +import { In, IsNull } from "typeorm"; import { fetchMeta, metaToPugArgs } from "@/misc/fetch-meta.js"; -import { getNoteSummary } from "@/misc/get-note-summary.js"; +import config from "@/config/index.js"; import { + Users, + Notes, + UserProfiles, + Pages, Channels, Clips, GalleryPosts, - Notes, - Pages, - UserProfiles, - Users, } from "@/models/index.js"; +import * as Acct from "@/misc/acct.js"; +import { getNoteSummary } from "@/misc/get-note-summary.js"; import { queues } from "@/queue/queues.js"; -import { In, IsNull } from "typeorm"; import { genOpenapiSpec } from "../api/openapi/gen-spec.js"; -import packFeed from "./feed.js"; -import { manifestHandler } from "./manifest.js"; import { urlPreviewHandler } from "./url-preview.js"; +import { manifestHandler } from "./manifest.js"; +import packFeed from "./feed.js"; +import { MINUTE, DAY } from "@/const.js"; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts index 38cb6755f..bbcf639ff 100644 --- a/packages/backend/src/server/web/manifest.ts +++ b/packages/backend/src/server/web/manifest.ts @@ -1,6 +1,6 @@ -import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; import type Koa from "koa"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import config from "@/config/index.js"; import manifest from "./manifest.json" assert { type: "json" }; export const manifestHandler = async (ctx: Koa.Context) => { diff --git a/packages/backend/src/server/web/url-preview.ts b/packages/backend/src/server/web/url-preview.ts index e8362670e..c9f3b6cac 100644 --- a/packages/backend/src/server/web/url-preview.ts +++ b/packages/backend/src/server/web/url-preview.ts @@ -1,10 +1,10 @@ -import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { getJson } from "@/misc/fetch.js"; -import { query } from "@/prelude/url.js"; -import Logger from "@/services/logger.js"; import type Koa from "koa"; import summaly from "summaly"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import Logger from "@/services/logger.js"; +import config from "@/config/index.js"; +import { query } from "@/prelude/url.js"; +import { getJson } from "@/misc/fetch.js"; const logger = new Logger("url-preview"); diff --git a/packages/backend/src/server/well-known.ts b/packages/backend/src/server/well-known.ts index c70861c6c..5af3b2c84 100644 --- a/packages/backend/src/server/well-known.ts +++ b/packages/backend/src/server/well-known.ts @@ -2,12 +2,12 @@ import Router from "@koa/router"; import config from "@/config/index.js"; import * as Acct from "@/misc/acct.js"; -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; +import { links } from "./nodeinfo.js"; import { escapeAttribute, escapeValue } from "@/prelude/xml.js"; +import { Users } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; import type { FindOptionsWhere } from "typeorm"; import { IsNull } from "typeorm"; -import { links } from "./nodeinfo.js"; // Init router const router = new Router(); diff --git a/packages/backend/src/services/add-note-to-antenna.ts b/packages/backend/src/services/add-note-to-antenna.ts index b9c40e1d2..499418000 100644 --- a/packages/backend/src/services/add-note-to-antenna.ts +++ b/packages/backend/src/services/add-note-to-antenna.ts @@ -1,9 +1,9 @@ -import { redisClient } from "@/db/redis.js"; -import { getTimestamp } from "@/misc/gen-id.js"; import type { Antenna } from "@/models/entities/antenna.js"; import type { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; +import { getTimestamp } from "@/misc/gen-id.js"; +import { redisClient } from "@/db/redis.js"; import { publishAntennaStream } from "@/services/stream.js"; +import type { User } from "@/models/entities/user.js"; export async function addNoteToAntenna( antenna: Antenna, diff --git a/packages/backend/src/services/blocking/create.ts b/packages/backend/src/services/blocking/create.ts index 0ed96e5c6..321f5c8ea 100644 --- a/packages/backend/src/services/blocking/create.ts +++ b/packages/backend/src/services/blocking/create.ts @@ -1,24 +1,24 @@ -import { genId } from "@/misc/gen-id.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { renderBlock } from "@/remote/activitypub/renderer/block.js"; +import { deliver } from "@/queue/index.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; import type { Blocking } from "@/models/entities/blocking.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, + Users, FollowRequests, Followings, UserListJoinings, UserLists, - Users, } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import { webhookDeliver } from "@/queue/index.js"; -import { renderBlock } from "@/remote/activitypub/renderer/block.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderReject from "@/remote/activitypub/renderer/reject.js"; -import renderUndo from "@/remote/activitypub/renderer/undo.js"; import { perUserFollowingChart } from "@/services/chart/index.js"; -import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import { genId } from "@/misc/gen-id.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import { webhookDeliver } from "@/queue/index.js"; export default async function (blocker: User, blockee: User) { await Promise.all([ diff --git a/packages/backend/src/services/blocking/delete.ts b/packages/backend/src/services/blocking/delete.ts index 2e57525a6..271883fe8 100644 --- a/packages/backend/src/services/blocking/delete.ts +++ b/packages/backend/src/services/blocking/delete.ts @@ -1,10 +1,10 @@ +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { renderBlock } from "@/remote/activitypub/renderer/block.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { deliver } from "@/queue/index.js"; +import Logger from "@/services/logger.js"; import type { CacheableUser } from "@/models/entities/user.js"; import { Blockings, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import { renderBlock } from "@/remote/activitypub/renderer/block.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderUndo from "@/remote/activitypub/renderer/undo.js"; -import Logger from "@/services/logger.js"; const logger = new Logger("blocking/delete"); diff --git a/packages/backend/src/services/chart/charts/active-users.ts b/packages/backend/src/services/chart/charts/active-users.ts index a9e4cab57..b88fc2282 100644 --- a/packages/backend/src/services/chart/charts/active-users.ts +++ b/packages/backend/src/services/chart/charts/active-users.ts @@ -1,6 +1,6 @@ -import type { User } from "@/models/entities/user.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import type { User } from "@/models/entities/user.js"; import { name, schema } from "./entities/active-users.js"; const week = 1000 * 60 * 60 * 24 * 7; diff --git a/packages/backend/src/services/chart/charts/drive.ts b/packages/backend/src/services/chart/charts/drive.ts index 0c6904946..d94c8cce7 100644 --- a/packages/backend/src/services/chart/charts/drive.ts +++ b/packages/backend/src/services/chart/charts/drive.ts @@ -1,6 +1,6 @@ -import type { DriveFile } from "@/models/entities/drive-file.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; import { name, schema } from "./entities/drive.js"; /** diff --git a/packages/backend/src/services/chart/charts/federation.ts b/packages/backend/src/services/chart/charts/federation.ts index 6d62979f3..1a03d574d 100644 --- a/packages/backend/src/services/chart/charts/federation.ts +++ b/packages/backend/src/services/chart/charts/federation.ts @@ -1,8 +1,8 @@ -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { Followings, Instances } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import { Followings, Instances } from "@/models/index.js"; import { name, schema } from "./entities/federation.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; /** * フェデレーションに関するチャート diff --git a/packages/backend/src/services/chart/charts/hashtag.ts b/packages/backend/src/services/chart/charts/hashtag.ts index d1079d1cc..0211df857 100644 --- a/packages/backend/src/services/chart/charts/hashtag.ts +++ b/packages/backend/src/services/chart/charts/hashtag.ts @@ -1,7 +1,7 @@ -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import type { User } from "@/models/entities/user.js"; +import { Users } from "@/models/index.js"; import { name, schema } from "./entities/hashtag.js"; /** diff --git a/packages/backend/src/services/chart/charts/instance.ts b/packages/backend/src/services/chart/charts/instance.ts index fc3d2139f..d6e3483d8 100644 --- a/packages/backend/src/services/chart/charts/instance.ts +++ b/packages/backend/src/services/chart/charts/instance.ts @@ -1,9 +1,9 @@ -import { toPuny } from "@/misc/convert-host.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { Note } from "@/models/entities/note.js"; -import { DriveFiles, Followings, Notes, Users } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import { DriveFiles, Followings, Users, Notes } from "@/models/index.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { Note } from "@/models/entities/note.js"; +import { toPuny } from "@/misc/convert-host.js"; import { name, schema } from "./entities/instance.js"; /** diff --git a/packages/backend/src/services/chart/charts/notes.ts b/packages/backend/src/services/chart/charts/notes.ts index 8ade08cda..42db60d0c 100644 --- a/packages/backend/src/services/chart/charts/notes.ts +++ b/packages/backend/src/services/chart/charts/notes.ts @@ -1,8 +1,8 @@ -import type { Note } from "@/models/entities/note.js"; -import { Notes } from "@/models/index.js"; -import { IsNull, Not } from "typeorm"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import { Notes } from "@/models/index.js"; +import { Not, IsNull } from "typeorm"; +import type { Note } from "@/models/entities/note.js"; import { name, schema } from "./entities/notes.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-drive.ts b/packages/backend/src/services/chart/charts/per-user-drive.ts index c1f6197cc..18589bb84 100644 --- a/packages/backend/src/services/chart/charts/per-user-drive.ts +++ b/packages/backend/src/services/chart/charts/per-user-drive.ts @@ -1,7 +1,7 @@ -import type { DriveFile } from "@/models/entities/drive-file.js"; -import { DriveFiles } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import { DriveFiles } from "@/models/index.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; import { name, schema } from "./entities/per-user-drive.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-following.ts b/packages/backend/src/services/chart/charts/per-user-following.ts index 017b9fa4d..3e8b576f2 100644 --- a/packages/backend/src/services/chart/charts/per-user-following.ts +++ b/packages/backend/src/services/chart/charts/per-user-following.ts @@ -1,8 +1,8 @@ -import type { User } from "@/models/entities/user.js"; -import { Followings, Users } from "@/models/index.js"; -import { IsNull, Not } from "typeorm"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import { Followings, Users } from "@/models/index.js"; +import { Not, IsNull } from "typeorm"; +import type { User } from "@/models/entities/user.js"; import { name, schema } from "./entities/per-user-following.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-notes.ts b/packages/backend/src/services/chart/charts/per-user-notes.ts index 6b25d8ee6..22f3fddb7 100644 --- a/packages/backend/src/services/chart/charts/per-user-notes.ts +++ b/packages/backend/src/services/chart/charts/per-user-notes.ts @@ -1,8 +1,8 @@ -import type { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; -import { Notes } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import type { User } from "@/models/entities/user.js"; +import { Notes } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; import { name, schema } from "./entities/per-user-notes.js"; /** diff --git a/packages/backend/src/services/chart/charts/per-user-reactions.ts b/packages/backend/src/services/chart/charts/per-user-reactions.ts index 093660bd5..75def3de0 100644 --- a/packages/backend/src/services/chart/charts/per-user-reactions.ts +++ b/packages/backend/src/services/chart/charts/per-user-reactions.ts @@ -1,8 +1,8 @@ -import type { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import type { User } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import { Users } from "@/models/index.js"; import { name, schema } from "./entities/per-user-reactions.js"; /** diff --git a/packages/backend/src/services/chart/charts/users.ts b/packages/backend/src/services/chart/charts/users.ts index 0c8ea5831..6fef9ecf7 100644 --- a/packages/backend/src/services/chart/charts/users.ts +++ b/packages/backend/src/services/chart/charts/users.ts @@ -1,8 +1,8 @@ -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import { IsNull, Not } from "typeorm"; import type { KVs } from "../core.js"; import Chart from "../core.js"; +import { Users } from "@/models/index.js"; +import { Not, IsNull } from "typeorm"; +import type { User } from "@/models/entities/user.js"; import { name, schema } from "./entities/users.js"; /** diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index d14ef1792..d7a524d48 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -4,20 +4,20 @@ * Tests located in test/chart */ -import { db } from "@/db/postgre.js"; -import { getChartInsertLock } from "@/misc/app-lock.js"; -import { - addTime, - dateUTC, - isTimeBefore, - isTimeSame, - subtractTime, -} from "@/prelude/time.js"; import * as nestedProperty from "nested-property"; -import promiseLimit from "promise-limit"; -import type { Repository } from "typeorm"; -import { Between, EntitySchema, LessThan } from "typeorm"; import Logger from "../logger.js"; +import type { Repository } from "typeorm"; +import { EntitySchema, LessThan, Between } from "typeorm"; +import { + dateUTC, + isTimeSame, + isTimeBefore, + subtractTime, + addTime, +} from "@/prelude/time.js"; +import { getChartInsertLock } from "@/misc/app-lock.js"; +import { db } from "@/db/postgre.js"; +import promiseLimit from "promise-limit"; const logger = new Logger("chart", "white", process.env.NODE_ENV !== "test"); diff --git a/packages/backend/src/services/chart/entities.ts b/packages/backend/src/services/chart/entities.ts index e67d1abc2..e203dffdf 100644 --- a/packages/backend/src/services/chart/entities.ts +++ b/packages/backend/src/services/chart/entities.ts @@ -1,20 +1,20 @@ -import { entity as ActiveUsersChart } from "./charts/entities/active-users.js"; -import { entity as ApRequestChart } from "./charts/entities/ap-request.js"; -import { entity as DriveChart } from "./charts/entities/drive.js"; import { entity as FederationChart } from "./charts/entities/federation.js"; -import { entity as HashtagChart } from "./charts/entities/hashtag.js"; -import { entity as InstanceChart } from "./charts/entities/instance.js"; import { entity as NotesChart } from "./charts/entities/notes.js"; -import { entity as PerUserDriveChart } from "./charts/entities/per-user-drive.js"; -import { entity as PerUserFollowingChart } from "./charts/entities/per-user-following.js"; -import { entity as PerUserNotesChart } from "./charts/entities/per-user-notes.js"; -import { entity as PerUserReactionsChart } from "./charts/entities/per-user-reactions.js"; import { entity as UsersChart } from "./charts/entities/users.js"; +import { entity as ActiveUsersChart } from "./charts/entities/active-users.js"; +import { entity as InstanceChart } from "./charts/entities/instance.js"; +import { entity as PerUserNotesChart } from "./charts/entities/per-user-notes.js"; +import { entity as DriveChart } from "./charts/entities/drive.js"; +import { entity as PerUserReactionsChart } from "./charts/entities/per-user-reactions.js"; +import { entity as HashtagChart } from "./charts/entities/hashtag.js"; +import { entity as PerUserFollowingChart } from "./charts/entities/per-user-following.js"; +import { entity as PerUserDriveChart } from "./charts/entities/per-user-drive.js"; +import { entity as ApRequestChart } from "./charts/entities/ap-request.js"; -import { entity as TestGroupedChart } from "./charts/entities/test-grouped.js"; -import { entity as TestIntersectionChart } from "./charts/entities/test-intersection.js"; -import { entity as TestUniqueChart } from "./charts/entities/test-unique.js"; import { entity as TestChart } from "./charts/entities/test.js"; +import { entity as TestGroupedChart } from "./charts/entities/test-grouped.js"; +import { entity as TestUniqueChart } from "./charts/entities/test-unique.js"; +import { entity as TestIntersectionChart } from "./charts/entities/test-intersection.js"; export const entities = [ FederationChart.hour, diff --git a/packages/backend/src/services/chart/index.ts b/packages/backend/src/services/chart/index.ts index e45a113bb..969cdab6d 100644 --- a/packages/backend/src/services/chart/index.ts +++ b/packages/backend/src/services/chart/index.ts @@ -1,17 +1,17 @@ import { beforeShutdown } from "@/misc/before-shutdown.js"; -import ActiveUsersChart from "./charts/active-users.js"; -import ApRequestChart from "./charts/ap-request.js"; -import DriveChart from "./charts/drive.js"; import FederationChart from "./charts/federation.js"; -import HashtagChart from "./charts/hashtag.js"; -import InstanceChart from "./charts/instance.js"; import NotesChart from "./charts/notes.js"; -import PerUserDriveChart from "./charts/per-user-drive.js"; -import PerUserFollowingChart from "./charts/per-user-following.js"; -import PerUserNotesChart from "./charts/per-user-notes.js"; -import PerUserReactionsChart from "./charts/per-user-reactions.js"; import UsersChart from "./charts/users.js"; +import ActiveUsersChart from "./charts/active-users.js"; +import InstanceChart from "./charts/instance.js"; +import PerUserNotesChart from "./charts/per-user-notes.js"; +import DriveChart from "./charts/drive.js"; +import PerUserReactionsChart from "./charts/per-user-reactions.js"; +import HashtagChart from "./charts/hashtag.js"; +import PerUserFollowingChart from "./charts/per-user-following.js"; +import PerUserDriveChart from "./charts/per-user-drive.js"; +import ApRequestChart from "./charts/ap-request.js"; export const federationChart = new FederationChart(); export const notesChart = new NotesChart(); diff --git a/packages/backend/src/services/create-notification.ts b/packages/backend/src/services/create-notification.ts index d537fcd79..9bfd1a7bf 100644 --- a/packages/backend/src/services/create-notification.ts +++ b/packages/backend/src/services/create-notification.ts @@ -1,18 +1,18 @@ -import { genId } from "@/misc/gen-id.js"; -import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; -import type { Notification } from "@/models/entities/notification.js"; -import type { User } from "@/models/entities/user.js"; +import { publishMainStream } from "@/services/stream.js"; +import { pushNotification } from "@/services/push-notification.js"; import { - Followings, + Notifications, Mutings, NoteThreadMutings, - Notifications, UserProfiles, Users, + Followings, } from "@/models/index.js"; -import { pushNotification } from "@/services/push-notification.js"; -import { publishMainStream } from "@/services/stream.js"; +import { genId } from "@/misc/gen-id.js"; +import type { User } from "@/models/entities/user.js"; +import type { Notification } from "@/models/entities/notification.js"; import { sendEmailNotification } from "./send-email-notification.js"; +import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; export async function createNotification( notifieeId: User["id"], diff --git a/packages/backend/src/services/create-system-user.ts b/packages/backend/src/services/create-system-user.ts index 6ed53535d..0ebd1142f 100644 --- a/packages/backend/src/services/create-system-user.ts +++ b/packages/backend/src/services/create-system-user.ts @@ -1,14 +1,14 @@ -import { db } from "@/db/postgre.js"; -import { genId } from "@/misc/gen-id.js"; -import { genRsaKeyPair } from "@/misc/gen-key-pair.js"; -import { hashPassword } from "@/misc/password.js"; -import { UsedUsername } from "@/models/entities/used-username.js"; -import { UserKeypair } from "@/models/entities/user-keypair.js"; -import { UserProfile } from "@/models/entities/user-profile.js"; -import { User } from "@/models/entities/user.js"; -import generateNativeUserToken from "@/server/api/common/generate-native-user-token.js"; -import { IsNull } from "typeorm"; import { v4 as uuid } from "uuid"; +import generateNativeUserToken from "@/server/api/common/generate-native-user-token.js"; +import { genRsaKeyPair } from "@/misc/gen-key-pair.js"; +import { User } from "@/models/entities/user.js"; +import { UserProfile } from "@/models/entities/user-profile.js"; +import { IsNull } from "typeorm"; +import { genId } from "@/misc/gen-id.js"; +import { UserKeypair } from "@/models/entities/user-keypair.js"; +import { UsedUsername } from "@/models/entities/used-username.js"; +import { db } from "@/db/postgre.js"; +import { hashPassword } from "@/misc/password.js"; export async function createSystemUser(username: string) { const password = uuid(); diff --git a/packages/backend/src/services/detect-sensitive.ts b/packages/backend/src/services/detect-sensitive.ts index 289e2dfcf..df695e86d 100644 --- a/packages/backend/src/services/detect-sensitive.ts +++ b/packages/backend/src/services/detect-sensitive.ts @@ -1,6 +1,6 @@ import * as fs from "node:fs"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; import * as nsfw from "nsfwjs"; import si from "systeminformation"; diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index faab32910..2f3d3c6e1 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -2,37 +2,37 @@ import * as fs from "node:fs"; import { v4 as uuid } from "uuid"; -import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; -import { contentDisposition } from "@/misc/content-disposition.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { genId } from "@/misc/gen-id.js"; -import { getFileInfo } from "@/misc/get-file-info.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import { DriveFile } from "@/models/entities/drive-file.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; -import { - DriveFiles, - DriveFolders, - UserProfiles, - Users, -} from "@/models/index.js"; -import { - driveChart, - instanceChart, - perUserDriveChart, -} from "@/services/chart/index.js"; -import { publishDriveStream, publishMainStream } from "@/services/stream.js"; import type S3 from "aws-sdk/clients/s3.js"; // TODO: migrate to SDK v3 import sharp from "sharp"; import { IsNull } from "typeorm"; -import { deleteFile } from "./delete-file.js"; -import { GenerateVideoThumbnail } from "./generate-video-thumbnail.js"; +import { publishMainStream, publishDriveStream } from "@/services/stream.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { contentDisposition } from "@/misc/content-disposition.js"; +import { getFileInfo } from "@/misc/get-file-info.js"; +import { + DriveFiles, + DriveFolders, + Users, + UserProfiles, +} from "@/models/index.js"; +import { DriveFile } from "@/models/entities/drive-file.js"; +import type { IRemoteUser, User } from "@/models/entities/user.js"; +import { + driveChart, + perUserDriveChart, + instanceChart, +} from "@/services/chart/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import { FILE_TYPE_BROWSERSAFE } from "@/const.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import { getS3 } from "./s3.js"; +import { InternalStorage } from "./internal-storage.js"; import type { IImage } from "./image-processor.js"; import { convertSharpToWebp } from "./image-processor.js"; -import { InternalStorage } from "./internal-storage.js"; import { driveLogger } from "./logger.js"; -import { getS3 } from "./s3.js"; +import { GenerateVideoThumbnail } from "./generate-video-thumbnail.js"; +import { deleteFile } from "./delete-file.js"; const logger = driveLogger.createSubLogger("register", "yellow"); diff --git a/packages/backend/src/services/drive/delete-file.ts b/packages/backend/src/services/drive/delete-file.ts index 101933e50..515c1d1c6 100644 --- a/packages/backend/src/services/drive/delete-file.ts +++ b/packages/backend/src/services/drive/delete-file.ts @@ -1,15 +1,15 @@ -import { fetchMeta } from "@/misc/fetch-meta.js"; import type { DriveFile } from "@/models/entities/drive-file.js"; +import { InternalStorage } from "./internal-storage.js"; import { DriveFiles } from "@/models/index.js"; -import { createDeleteObjectStorageFileJob } from "@/queue/index.js"; import { driveChart, - instanceChart, perUserDriveChart, + instanceChart, } from "@/services/chart/index.js"; -import { v4 as uuid } from "uuid"; -import { InternalStorage } from "./internal-storage.js"; +import { createDeleteObjectStorageFileJob } from "@/queue/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; import { getS3 } from "./s3.js"; +import { v4 as uuid } from "uuid"; export async function deleteFile(file: DriveFile, isExpired = false) { if (file.storedInternal) { diff --git a/packages/backend/src/services/drive/generate-video-thumbnail.ts b/packages/backend/src/services/drive/generate-video-thumbnail.ts index 694a79656..0e3f0db58 100644 --- a/packages/backend/src/services/drive/generate-video-thumbnail.ts +++ b/packages/backend/src/services/drive/generate-video-thumbnail.ts @@ -1,7 +1,7 @@ import { createTempDir } from "@/misc/create-temp.js"; -import FFmpeg from "fluent-ffmpeg"; import type { IImage } from "./image-processor.js"; import { convertToWebp } from "./image-processor.js"; +import FFmpeg from "fluent-ffmpeg"; export async function GenerateVideoThumbnail(source: string): Promise { const [dir, cleanup] = await createTempDir(); diff --git a/packages/backend/src/services/drive/internal-storage.ts b/packages/backend/src/services/drive/internal-storage.ts index 560c272df..b2a663b3e 100644 --- a/packages/backend/src/services/drive/internal-storage.ts +++ b/packages/backend/src/services/drive/internal-storage.ts @@ -1,8 +1,8 @@ import * as fs from "node:fs"; import * as fsPromises from "node:fs/promises"; import * as Path from "node:path"; -import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; import config from "@/config/index.js"; const _filename = fileURLToPath(import.meta.url); diff --git a/packages/backend/src/services/drive/s3.ts b/packages/backend/src/services/drive/s3.ts index f7a4a57ee..d01f89cbb 100644 --- a/packages/backend/src/services/drive/s3.ts +++ b/packages/backend/src/services/drive/s3.ts @@ -1,7 +1,7 @@ import { URL } from "node:url"; -import { getAgentByUrl } from "@/misc/fetch.js"; -import type { Meta } from "@/models/entities/meta.js"; import S3 from "aws-sdk/clients/s3.js"; // TODO: migrate to SDK v3 +import type { Meta } from "@/models/entities/meta.js"; +import { getAgentByUrl } from "@/misc/fetch.js"; export function getS3(meta: Meta) { const u = diff --git a/packages/backend/src/services/drive/upload-from-url.ts b/packages/backend/src/services/drive/upload-from-url.ts index 2afa1458b..0638bcab8 100644 --- a/packages/backend/src/services/drive/upload-from-url.ts +++ b/packages/backend/src/services/drive/upload-from-url.ts @@ -1,12 +1,12 @@ import { URL } from "node:url"; +import type { User } from "@/models/entities/user.js"; import { createTemp } from "@/misc/create-temp.js"; import { downloadUrl, isPrivateIp } from "@/misc/download-url.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; import type { DriveFolder } from "@/models/entities/drive-folder.js"; -import type { User } from "@/models/entities/user.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; import { DriveFiles } from "@/models/index.js"; -import { addFile } from "./add-file.js"; import { driveLogger } from "./logger.js"; +import { addFile } from "./add-file.js"; const logger = driveLogger.createSubLogger("downloader"); diff --git a/packages/backend/src/services/fetch-instance-metadata.ts b/packages/backend/src/services/fetch-instance-metadata.ts index b399df24a..a4cc33bca 100644 --- a/packages/backend/src/services/fetch-instance-metadata.ts +++ b/packages/backend/src/services/fetch-instance-metadata.ts @@ -1,12 +1,12 @@ import { URL } from "node:url"; -import { getFetchInstanceMetadataLock } from "@/misc/app-lock.js"; -import { getAgentByUrl, getJson } from "@/misc/fetch.js"; -import type { Instance } from "@/models/entities/instance.js"; -import { Instances } from "@/models/index.js"; -import Logger from "@/services/logger.js"; import { Window } from "happy-dom"; import fetch from "node-fetch"; import tinycolor from "tinycolor2"; +import { getJson, getAgentByUrl } from "@/misc/fetch.js"; +import type { Instance } from "@/models/entities/instance.js"; +import { Instances } from "@/models/index.js"; +import { getFetchInstanceMetadataLock } from "@/misc/app-lock.js"; +import Logger from "@/services/logger.js"; const logger = new Logger("metadata", "cyan"); diff --git a/packages/backend/src/services/fetch-rel-me.ts b/packages/backend/src/services/fetch-rel-me.ts index 0bb340db4..c9a37d1c8 100644 --- a/packages/backend/src/services/fetch-rel-me.ts +++ b/packages/backend/src/services/fetch-rel-me.ts @@ -1,5 +1,5 @@ -import config from "@/config/index.js"; import { Window } from "happy-dom"; +import config from "@/config/index.js"; async function getRelMeLinks(url: string): Promise { try { diff --git a/packages/backend/src/services/following/create.ts b/packages/backend/src/services/following/create.ts index 562867e19..934b235bb 100644 --- a/packages/backend/src/services/following/create.ts +++ b/packages/backend/src/services/following/create.ts @@ -1,33 +1,33 @@ -import { genId } from "@/misc/gen-id.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import renderAccept from "@/remote/activitypub/renderer/accept.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; +import { deliver } from "@/queue/index.js"; +import createFollowRequest from "./requests/create.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import Logger from "../logger.js"; import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import type { Packed } from "@/misc/schema.js"; -import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; import type { User } from "@/models/entities/user.js"; import { - Blockings, - FollowRequests, Followings, + Users, + FollowRequests, + Blockings, Instances, UserProfiles, - Users, } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import { webhookDeliver } from "@/queue/index.js"; -import renderAccept from "@/remote/activitypub/renderer/accept.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderReject from "@/remote/activitypub/renderer/reject.js"; import { instanceChart, perUserFollowingChart, } from "@/services/chart/index.js"; +import { genId } from "@/misc/gen-id.js"; import { createNotification } from "@/services/create-notification.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; -import { publishMainStream, publishUserEvent } from "@/services/stream.js"; -import Logger from "../logger.js"; -import createFollowRequest from "./requests/create.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import type { Packed } from "@/misc/schema.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import { webhookDeliver } from "@/queue/index.js"; +import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; const logger = new Logger("following/create"); diff --git a/packages/backend/src/services/following/delete.ts b/packages/backend/src/services/following/delete.ts index 55cd1fc81..8a07244da 100644 --- a/packages/backend/src/services/following/delete.ts +++ b/packages/backend/src/services/following/delete.ts @@ -1,18 +1,18 @@ -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; -import type { User } from "@/models/entities/user.js"; -import { Followings, Instances, Users } from "@/models/index.js"; -import { deliver, webhookDeliver } from "@/queue/index.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { publishMainStream, publishUserEvent } from "@/services/stream.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderReject from "@/remote/activitypub/renderer/reject.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import renderReject from "@/remote/activitypub/renderer/reject.js"; +import { deliver, webhookDeliver } from "@/queue/index.js"; +import Logger from "../logger.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import type { User } from "@/models/entities/user.js"; +import { Followings, Users, Instances } from "@/models/index.js"; import { instanceChart, perUserFollowingChart, } from "@/services/chart/index.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; -import { publishMainStream, publishUserEvent } from "@/services/stream.js"; -import Logger from "../logger.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; const logger = new Logger("following/delete"); diff --git a/packages/backend/src/services/following/reject.ts b/packages/backend/src/services/following/reject.ts index 16e46b157..3f461268d 100644 --- a/packages/backend/src/services/following/reject.ts +++ b/packages/backend/src/services/following/reject.ts @@ -1,12 +1,12 @@ -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; -import type { ILocalUser, IRemoteUser } from "@/models/entities/user.js"; -import { FollowRequests, Followings, Users } from "@/models/index.js"; -import { deliver, webhookDeliver } from "@/queue/index.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; import renderReject from "@/remote/activitypub/renderer/reject.js"; +import { deliver, webhookDeliver } from "@/queue/index.js"; import { publishMainStream, publishUserEvent } from "@/services/stream.js"; +import type { ILocalUser, IRemoteUser } from "@/models/entities/user.js"; +import { Users, FollowRequests, Followings } from "@/models/index.js"; import { decrementFollowing } from "./delete.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; type Local = | ILocalUser diff --git a/packages/backend/src/services/following/requests/accept-all.ts b/packages/backend/src/services/following/requests/accept-all.ts index 1808bff2b..269243379 100644 --- a/packages/backend/src/services/following/requests/accept-all.ts +++ b/packages/backend/src/services/following/requests/accept-all.ts @@ -1,6 +1,6 @@ +import accept from "./accept.js"; import type { User } from "@/models/entities/user.js"; import { FollowRequests, Users } from "@/models/index.js"; -import accept from "./accept.js"; /** * Approve all follow requests for the specified user diff --git a/packages/backend/src/services/following/requests/accept.ts b/packages/backend/src/services/following/requests/accept.ts index 2a7c03ba1..1bc10f608 100644 --- a/packages/backend/src/services/following/requests/accept.ts +++ b/packages/backend/src/services/following/requests/accept.ts @@ -1,12 +1,12 @@ -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import type { CacheableUser, User } from "@/models/entities/user.js"; -import { FollowRequests, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import renderAccept from "@/remote/activitypub/renderer/accept.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import renderAccept from "@/remote/activitypub/renderer/accept.js"; +import { deliver } from "@/queue/index.js"; import { publishMainStream } from "@/services/stream.js"; import { insertFollowingDoc } from "../create.js"; +import type { User, CacheableUser } from "@/models/entities/user.js"; +import { FollowRequests, Users } from "@/models/index.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; export default async function ( followee: { diff --git a/packages/backend/src/services/following/requests/cancel.ts b/packages/backend/src/services/following/requests/cancel.ts index 1b9758c5b..45b8ee063 100644 --- a/packages/backend/src/services/following/requests/cancel.ts +++ b/packages/backend/src/services/following/requests/cancel.ts @@ -1,11 +1,11 @@ +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { deliver } from "@/queue/index.js"; +import { publishMainStream } from "@/services/stream.js"; import { IdentifiableError } from "@/misc/identifiable-error.js"; import type { User } from "@/models/entities/user.js"; -import { FollowRequests, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderUndo from "@/remote/activitypub/renderer/undo.js"; -import { publishMainStream } from "@/services/stream.js"; +import { Users, FollowRequests } from "@/models/index.js"; export default async function ( followee: { diff --git a/packages/backend/src/services/following/requests/create.ts b/packages/backend/src/services/following/requests/create.ts index a3ed22f83..12dfddf30 100644 --- a/packages/backend/src/services/following/requests/create.ts +++ b/packages/backend/src/services/following/requests/create.ts @@ -1,12 +1,12 @@ -import config from "@/config/index.js"; -import { genId } from "@/misc/gen-id.js"; +import { publishMainStream } from "@/services/stream.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderFollow from "@/remote/activitypub/renderer/follow.js"; +import { deliver } from "@/queue/index.js"; import type { User } from "@/models/entities/user.js"; import { Blockings, FollowRequests, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import renderFollow from "@/remote/activitypub/renderer/follow.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { genId } from "@/misc/gen-id.js"; import { createNotification } from "@/services/create-notification.js"; -import { publishMainStream } from "@/services/stream.js"; +import config from "@/config/index.js"; export default async function ( follower: { diff --git a/packages/backend/src/services/i/pin.ts b/packages/backend/src/services/i/pin.ts index 3926f7230..6102df2fa 100644 --- a/packages/backend/src/services/i/pin.ts +++ b/packages/backend/src/services/i/pin.ts @@ -1,14 +1,14 @@ import config from "@/config/index.js"; -import { genId } from "@/misc/gen-id.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import type { Note } from "@/models/entities/note.js"; -import type { UserNotePining } from "@/models/entities/user-note-pining.js"; -import type { User } from "@/models/entities/user.js"; -import { Notes, UserNotePinings, Users } from "@/models/index.js"; -import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; import renderAdd from "@/remote/activitypub/renderer/add.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderRemove from "@/remote/activitypub/renderer/remove.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { User } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import { Notes, UserNotePinings, Users } from "@/models/index.js"; +import type { UserNotePining } from "@/models/entities/user-note-pining.js"; +import { genId } from "@/misc/gen-id.js"; +import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; import { deliverToRelays } from "@/services/relay.js"; /** diff --git a/packages/backend/src/services/i/update.ts b/packages/backend/src/services/i/update.ts index ec22907bf..21b03d982 100644 --- a/packages/backend/src/services/i/update.ts +++ b/packages/backend/src/services/i/update.ts @@ -1,9 +1,9 @@ -import type { User } from "@/models/entities/user.js"; -import { Users } from "@/models/index.js"; -import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import { renderPerson } from "@/remote/activitypub/renderer/person.js"; import renderUpdate from "@/remote/activitypub/renderer/update.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { Users } from "@/models/index.js"; +import type { User } from "@/models/entities/user.js"; +import { renderPerson } from "@/remote/activitypub/renderer/person.js"; +import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; import { deliverToRelays } from "@/services/relay.js"; export async function publishToFollowers(userId: User["id"]) { diff --git a/packages/backend/src/services/insert-moderation-log.ts b/packages/backend/src/services/insert-moderation-log.ts index 9e45ece68..8e2c5b78a 100644 --- a/packages/backend/src/services/insert-moderation-log.ts +++ b/packages/backend/src/services/insert-moderation-log.ts @@ -1,6 +1,6 @@ +import { ModerationLogs } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { User } from "@/models/entities/user.js"; -import { ModerationLogs } from "@/models/index.js"; export async function insertModerationLog( moderator: { id: User["id"] }, diff --git a/packages/backend/src/services/instance-actor.ts b/packages/backend/src/services/instance-actor.ts index 6f21107eb..a8b34ea57 100644 --- a/packages/backend/src/services/instance-actor.ts +++ b/packages/backend/src/services/instance-actor.ts @@ -1,8 +1,8 @@ -import { Cache } from "@/misc/cache.js"; +import { createSystemUser } from "./create-system-user.js"; import type { ILocalUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; +import { Cache } from "@/misc/cache.js"; import { IsNull } from "typeorm"; -import { createSystemUser } from "./create-system-user.js"; const ACTOR_USERNAME = "instance.actor" as const; diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index 54a0440d4..df4c2e356 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -1,9 +1,9 @@ import cluster from "node:cluster"; -import config from "@/config/index.js"; -import { envOption } from "@/env.js"; import chalk from "chalk"; import { default as convertColor } from "color-convert"; import { format as dateFormat } from "date-fns"; +import { envOption } from "@/env.js"; +import config from "@/config/index.js"; import * as SyslogPro from "syslog-pro"; diff --git a/packages/backend/src/services/messages/create.ts b/packages/backend/src/services/messages/create.ts index ed5e01494..506f29996 100644 --- a/packages/backend/src/services/messages/create.ts +++ b/packages/backend/src/services/messages/create.ts @@ -1,27 +1,27 @@ -import { genId } from "@/misc/gen-id.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; -import type { Note } from "@/models/entities/note.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; import type { CacheableUser, User } from "@/models/entities/user.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; import { MessagingMessages, - Mutings, UserGroupJoinings, + Mutings, Users, } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; +import { genId } from "@/misc/gen-id.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; +import { + publishMessagingStream, + publishMessagingIndexStream, + publishMainStream, + publishGroupMessagingStream, +} from "@/services/stream.js"; +import { pushNotification } from "@/services/push-notification.js"; +import { Not } from "typeorm"; +import type { Note } from "@/models/entities/note.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; import renderCreate from "@/remote/activitypub/renderer/create.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; -import { pushNotification } from "@/services/push-notification.js"; -import { - publishGroupMessagingStream, - publishMainStream, - publishMessagingIndexStream, - publishMessagingStream, -} from "@/services/stream.js"; -import { Not } from "typeorm"; +import { deliver } from "@/queue/index.js"; export async function createMessage( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/messages/delete.ts b/packages/backend/src/services/messages/delete.ts index adc365223..77caba80c 100644 --- a/packages/backend/src/services/messages/delete.ts +++ b/packages/backend/src/services/messages/delete.ts @@ -1,14 +1,14 @@ import config from "@/config/index.js"; -import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { MessagingMessages, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import renderDelete from "@/remote/activitypub/renderer/delete.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderTombstone from "@/remote/activitypub/renderer/tombstone.js"; +import type { MessagingMessage } from "@/models/entities/messaging-message.js"; import { publishGroupMessagingStream, publishMessagingStream, } from "@/services/stream.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import renderTombstone from "@/remote/activitypub/renderer/tombstone.js"; +import { deliver } from "@/queue/index.js"; export async function deleteMessage(message: MessagingMessage) { await MessagingMessages.delete(message.id); diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index ed6ab932c..bff0968f9 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -1,74 +1,74 @@ -import config from "@/config/index.js"; +import * as mfm from "mfm-js"; import es from "@/db/elasticsearch.js"; -import meilisearch from "@/db/meilisearch.js"; -import { db } from "@/db/postgre.js"; -import { redisClient } from "@/db/redis.js"; import sonic from "@/db/sonic.js"; -import { getAntennas } from "@/misc/antenna-cache.js"; -import { Cache } from "@/misc/cache.js"; -import { checkHitAntenna } from "@/misc/check-hit-antenna.js"; -import { getWordHardMute } from "@/misc/check-word-mute.js"; -import { countSameRenotes } from "@/misc/count-same-renotes.js"; -import detectLanguage from "@/misc/detect-language.js"; -import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { extractMentions } from "@/misc/extract-mentions.js"; -import { genId } from "@/misc/gen-id.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import { langmap } from "@/misc/langmap.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; -import { getActiveWebhooks } from "@/misc/webhook-cache.js"; -import type { App } from "@/models/entities/app.js"; -import type { Channel } from "@/models/entities/channel.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; -import { Note } from "@/models/entities/note.js"; -import type { IPoll } from "@/models/entities/poll.js"; -import { Poll } from "@/models/entities/poll.js"; -import type { UserProfile } from "@/models/entities/user-profile.js"; -import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; -import { - ChannelFollowings, - Channels, - Instances, - MutedNotes, - Mutings, - NoteThreadMutings, - NoteWatchings, - Notes, - UserProfiles, - Users, -} from "@/models/index.js"; -import { concat } from "@/prelude/array.js"; -import { webhookDeliver } from "@/queue/index.js"; -import { endedPollNotificationQueue } from "@/queue/queues.js"; -import DeliverManager from "@/remote/activitypub/deliver-manager.js"; -import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; -import renderCreate from "@/remote/activitypub/renderer/create.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderNote from "@/remote/activitypub/renderer/note.js"; -import { resolveUser } from "@/remote/resolve-user.js"; -import { addNoteToAntenna } from "@/services/add-note-to-antenna.js"; -import { - activeUsersChart, - instanceChart, - notesChart, - perUserNotesChart, -} from "@/services/chart/index.js"; -import { createNotification } from "@/services/create-notification.js"; -import { insertNoteUnread } from "@/services/note/unread.js"; -import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import { publishMainStream, - publishNoteStream, publishNotesStream, + publishNoteStream, } from "@/services/stream.js"; +import DeliverManager from "@/remote/activitypub/deliver-manager.js"; +import renderNote from "@/remote/activitypub/renderer/note.js"; +import renderCreate from "@/remote/activitypub/renderer/create.js"; +import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { resolveUser } from "@/remote/resolve-user.js"; +import config from "@/config/index.js"; import { updateHashtags } from "@/services/update-hashtag.js"; -import * as mfm from "mfm-js"; -import { Mutex } from "redis-semaphore"; -import { In, Not } from "typeorm"; +import { concat } from "@/prelude/array.js"; +import { insertNoteUnread } from "@/services/note/unread.js"; +import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; +import { extractMentions } from "@/misc/extract-mentions.js"; +import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; +import { extractHashtags } from "@/misc/extract-hashtags.js"; +import type { IMentionedRemoteUsers } from "@/models/entities/note.js"; +import { Note } from "@/models/entities/note.js"; +import { + Mutings, + Users, + NoteWatchings, + Notes, + Instances, + UserProfiles, + MutedNotes, + Channels, + ChannelFollowings, + NoteThreadMutings, +} from "@/models/index.js"; +import type { DriveFile } from "@/models/entities/drive-file.js"; +import type { App } from "@/models/entities/app.js"; +import { Not, In } from "typeorm"; +import type { User, ILocalUser, IRemoteUser } from "@/models/entities/user.js"; +import { genId } from "@/misc/gen-id.js"; +import { + notesChart, + perUserNotesChart, + activeUsersChart, + instanceChart, +} from "@/services/chart/index.js"; +import type { IPoll } from "@/models/entities/poll.js"; +import { Poll } from "@/models/entities/poll.js"; +import { createNotification } from "@/services/create-notification.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import { checkHitAntenna } from "@/misc/check-hit-antenna.js"; +import { getWordHardMute } from "@/misc/check-word-mute.js"; +import { addNoteToAntenna } from "@/services/add-note-to-antenna.js"; +import { countSameRenotes } from "@/misc/count-same-renotes.js"; import { deliverToRelays, getCachedRelays } from "../relay.js"; +import type { Channel } from "@/models/entities/channel.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { getAntennas } from "@/misc/antenna-cache.js"; +import { endedPollNotificationQueue } from "@/queue/queues.js"; +import { webhookDeliver } from "@/queue/index.js"; +import { Cache } from "@/misc/cache.js"; +import type { UserProfile } from "@/models/entities/user-profile.js"; +import { db } from "@/db/postgre.js"; +import { getActiveWebhooks } from "@/misc/webhook-cache.js"; +import { shouldSilenceInstance } from "@/misc/should-block-instance.js"; +import meilisearch from "@/db/meilisearch.js"; +import { redisClient } from "@/db/redis.js"; +import { Mutex } from "redis-semaphore"; +import { langmap } from "@/misc/langmap.js"; +import detectLanguage from "@/misc/detect-language.js"; const mutedWordsCache = new Cache< { userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[] diff --git a/packages/backend/src/services/note/delete.ts b/packages/backend/src/services/note/delete.ts index 0ec818a29..8a7582580 100644 --- a/packages/backend/src/services/note/delete.ts +++ b/packages/backend/src/services/note/delete.ts @@ -1,27 +1,27 @@ +import { Brackets, In } from "typeorm"; +import { publishNoteStream } from "@/services/stream.js"; +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import renderTombstone from "@/remote/activitypub/renderer/tombstone.js"; import config from "@/config/index.js"; -import meilisearch from "@/db/meilisearch.js"; -import { countSameRenotes } from "@/misc/count-same-renotes.js"; -import type { IMentionedRemoteUsers, Note } from "@/models/entities/note.js"; -import type { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js"; -import { Instances, Notes, Users } from "@/models/index.js"; +import type { User, ILocalUser, IRemoteUser } from "@/models/entities/user.js"; +import type { Note, IMentionedRemoteUsers } from "@/models/entities/note.js"; +import { Notes, Users, Instances } from "@/models/index.js"; +import { + notesChart, + perUserNotesChart, + instanceChart, +} from "@/services/chart/index.js"; import { deliverToFollowers, deliverToUser, } from "@/remote/activitypub/deliver-manager.js"; -import renderAnnounce from "@/remote/activitypub/renderer/announce.js"; -import renderDelete from "@/remote/activitypub/renderer/delete.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderTombstone from "@/remote/activitypub/renderer/tombstone.js"; -import renderUndo from "@/remote/activitypub/renderer/undo.js"; -import { - instanceChart, - notesChart, - perUserNotesChart, -} from "@/services/chart/index.js"; +import { countSameRenotes } from "@/misc/count-same-renotes.js"; import { registerOrFetchInstanceDoc } from "@/services/register-or-fetch-instance-doc.js"; import { deliverToRelays } from "@/services/relay.js"; -import { publishNoteStream } from "@/services/stream.js"; -import { Brackets, In } from "typeorm"; +import meilisearch from "@/db/meilisearch.js"; /** * 投稿を削除します。 diff --git a/packages/backend/src/services/note/polls/update.ts b/packages/backend/src/services/note/polls/update.ts index 073980226..270b4d9bf 100644 --- a/packages/backend/src/services/note/polls/update.ts +++ b/packages/backend/src/services/note/polls/update.ts @@ -1,9 +1,9 @@ -import type { Note } from "@/models/entities/note.js"; -import { Notes, Users } from "@/models/index.js"; -import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; +import renderUpdate from "@/remote/activitypub/renderer/update.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderNote from "@/remote/activitypub/renderer/note.js"; -import renderUpdate from "@/remote/activitypub/renderer/update.js"; +import { Users, Notes } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; +import { deliverToFollowers } from "@/remote/activitypub/deliver-manager.js"; import { deliverToRelays } from "@/services/relay.js"; export async function deliverQuestionUpdate(noteId: Note["id"]) { diff --git a/packages/backend/src/services/note/polls/vote.ts b/packages/backend/src/services/note/polls/vote.ts index ebffed0d9..6ade89972 100644 --- a/packages/backend/src/services/note/polls/vote.ts +++ b/packages/backend/src/services/note/polls/vote.ts @@ -1,10 +1,10 @@ -import { genId } from "@/misc/gen-id.js"; -import type { Note } from "@/models/entities/note.js"; -import type { CacheableUser } from "@/models/entities/user.js"; -import { Blockings, NoteWatchings, PollVotes, Polls } from "@/models/index.js"; -import { createNotification } from "@/services/create-notification.js"; import { publishNoteStream } from "@/services/stream.js"; +import type { CacheableUser } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import { PollVotes, NoteWatchings, Polls, Blockings } from "@/models/index.js"; import { Not } from "typeorm"; +import { genId } from "@/misc/gen-id.js"; +import { createNotification } from "@/services/create-notification.js"; export default async function ( user: CacheableUser, diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index ed265be8a..123356515 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -1,26 +1,26 @@ -import { genId } from "@/misc/gen-id.js"; -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; -import { decodeReaction, toDbReaction } from "@/misc/reaction-lib.js"; -import type { NoteReaction } from "@/models/entities/note-reaction.js"; -import type { Note } from "@/models/entities/note.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; -import { - Blockings, - Emojis, - NoteReactions, - NoteWatchings, - Notes, - Users, -} from "@/models/index.js"; +import { publishNoteStream } from "@/services/stream.js"; +import { renderLike } from "@/remote/activitypub/renderer/like.js"; import DeliverManager from "@/remote/activitypub/deliver-manager.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import { renderLike } from "@/remote/activitypub/renderer/like.js"; -import { perUserReactionsChart } from "@/services/chart/index.js"; -import { createNotification } from "@/services/create-notification.js"; -import { publishNoteStream } from "@/services/stream.js"; +import { toDbReaction, decodeReaction } from "@/misc/reaction-lib.js"; +import type { User, IRemoteUser } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import { + NoteReactions, + Users, + NoteWatchings, + Notes, + Emojis, + Blockings, +} from "@/models/index.js"; import { IsNull, Not } from "typeorm"; +import { perUserReactionsChart } from "@/services/chart/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { createNotification } from "@/services/create-notification.js"; import deleteReaction from "./delete.js"; +import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js"; +import type { NoteReaction } from "@/models/entities/note-reaction.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; export default async ( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/note/reaction/delete.ts b/packages/backend/src/services/note/reaction/delete.ts index 159d86f4a..15c6d1cf6 100644 --- a/packages/backend/src/services/note/reaction/delete.ts +++ b/packages/backend/src/services/note/reaction/delete.ts @@ -1,13 +1,13 @@ -import { IdentifiableError } from "@/misc/identifiable-error.js"; -import { decodeReaction } from "@/misc/reaction-lib.js"; -import type { Note } from "@/models/entities/note.js"; -import type { IRemoteUser, User } from "@/models/entities/user.js"; -import { NoteReactions, Notes, Users } from "@/models/index.js"; -import DeliverManager from "@/remote/activitypub/deliver-manager.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { publishNoteStream } from "@/services/stream.js"; import { renderLike } from "@/remote/activitypub/renderer/like.js"; import renderUndo from "@/remote/activitypub/renderer/undo.js"; -import { publishNoteStream } from "@/services/stream.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import DeliverManager from "@/remote/activitypub/deliver-manager.js"; +import { IdentifiableError } from "@/misc/identifiable-error.js"; +import type { User, IRemoteUser } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import { NoteReactions, Users, Notes } from "@/models/index.js"; +import { decodeReaction } from "@/misc/reaction-lib.js"; export default async ( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/note/read.ts b/packages/backend/src/services/note/read.ts index b127e8836..07d277d84 100644 --- a/packages/backend/src/services/note/read.ts +++ b/packages/backend/src/services/note/read.ts @@ -1,16 +1,16 @@ -import type { Packed } from "@/misc/schema.js"; -import type { Channel } from "@/models/entities/channel.js"; +import { publishMainStream } from "@/services/stream.js"; import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { - ChannelFollowings, - Followings, NoteUnreads, Users, + Followings, + ChannelFollowings, } from "@/models/index.js"; +import { Not, IsNull, In } from "typeorm"; +import type { Channel } from "@/models/entities/channel.js"; import { readNotificationByQuery } from "@/server/api/common/read-notification.js"; -import { publishMainStream } from "@/services/stream.js"; -import { In, IsNull, Not } from "typeorm"; +import type { Packed } from "@/misc/schema.js"; /** * Mark notes as read diff --git a/packages/backend/src/services/note/unread.ts b/packages/backend/src/services/note/unread.ts index 6825ee7c9..cb87abe0e 100644 --- a/packages/backend/src/services/note/unread.ts +++ b/packages/backend/src/services/note/unread.ts @@ -1,8 +1,8 @@ -import { genId } from "@/misc/gen-id.js"; import type { Note } from "@/models/entities/note.js"; +import { publishMainStream } from "@/services/stream.js"; import type { User } from "@/models/entities/user.js"; import { Mutings, NoteThreadMutings, NoteUnreads } from "@/models/index.js"; -import { publishMainStream } from "@/services/stream.js"; +import { genId } from "@/misc/gen-id.js"; export async function insertNoteUnread( userId: User["id"], diff --git a/packages/backend/src/services/note/unwatch.ts b/packages/backend/src/services/note/unwatch.ts index 0b2e42281..b4da5e86d 100644 --- a/packages/backend/src/services/note/unwatch.ts +++ b/packages/backend/src/services/note/unwatch.ts @@ -1,6 +1,6 @@ -import type { Note } from "@/models/entities/note.js"; import type { User } from "@/models/entities/user.js"; import { NoteWatchings } from "@/models/index.js"; +import type { Note } from "@/models/entities/note.js"; export default async (me: User["id"], note: Note) => { await NoteWatchings.delete({ diff --git a/packages/backend/src/services/note/watch.ts b/packages/backend/src/services/note/watch.ts index c69efe68a..2a99dd694 100644 --- a/packages/backend/src/services/note/watch.ts +++ b/packages/backend/src/services/note/watch.ts @@ -1,8 +1,8 @@ +import type { User } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import { NoteWatchings } from "@/models/index.js"; import { genId } from "@/misc/gen-id.js"; import type { NoteWatching } from "@/models/entities/note-watching.js"; -import type { Note } from "@/models/entities/note.js"; -import type { User } from "@/models/entities/user.js"; -import { NoteWatchings } from "@/models/index.js"; export default async (me: User["id"], note: Note) => { // 自分の投稿はwatchできない diff --git a/packages/backend/src/services/push-notification.ts b/packages/backend/src/services/push-notification.ts index 1e0486ff3..a207fae39 100644 --- a/packages/backend/src/services/push-notification.ts +++ b/packages/backend/src/services/push-notification.ts @@ -1,9 +1,9 @@ -import config from "@/config/index.js"; -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { getNoteSummary } from "@/misc/get-note-summary.js"; -import type { Packed } from "@/misc/schema.js"; -import { SwSubscriptions } from "@/models/index.js"; import push from "web-push"; +import config from "@/config/index.js"; +import { SwSubscriptions } from "@/models/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import type { Packed } from "@/misc/schema.js"; +import { getNoteSummary } from "@/misc/get-note-summary.js"; // Defined also packages/sw/types.ts#L14-L21 type pushNotificationsTypes = { diff --git a/packages/backend/src/services/register-or-fetch-instance-doc.ts b/packages/backend/src/services/register-or-fetch-instance-doc.ts index c56e609e5..c0ead0819 100644 --- a/packages/backend/src/services/register-or-fetch-instance-doc.ts +++ b/packages/backend/src/services/register-or-fetch-instance-doc.ts @@ -1,8 +1,8 @@ -import { Cache } from "@/misc/cache.js"; -import { toPuny } from "@/misc/convert-host.js"; -import { genId } from "@/misc/gen-id.js"; import type { Instance } from "@/models/entities/instance.js"; import { Instances } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { toPuny } from "@/misc/convert-host.js"; +import { Cache } from "@/misc/cache.js"; const cache = new Cache("registerOrFetchInstanceDoc", 60 * 60); diff --git a/packages/backend/src/services/relay.ts b/packages/backend/src/services/relay.ts index 20d938086..fdc42616e 100644 --- a/packages/backend/src/services/relay.ts +++ b/packages/backend/src/services/relay.ts @@ -1,17 +1,17 @@ -import { Cache } from "@/misc/cache.js"; -import { genId } from "@/misc/gen-id.js"; -import type { Relay } from "@/models/entities/relay.js"; -import type { ILocalUser, User } from "@/models/entities/user.js"; -import { Relays, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; +import { IsNull } from "typeorm"; import { renderFollowRelay } from "@/remote/activitypub/renderer/follow-relay.js"; import { - attachLdSignature, renderActivity, + attachLdSignature, } from "@/remote/activitypub/renderer/index.js"; import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { deliver } from "@/queue/index.js"; +import type { ILocalUser, User } from "@/models/entities/user.js"; +import { Users, Relays } from "@/models/index.js"; +import { genId } from "@/misc/gen-id.js"; +import { Cache } from "@/misc/cache.js"; +import type { Relay } from "@/models/entities/relay.js"; import { createSystemUser } from "@/services/create-system-user.js"; -import { IsNull } from "typeorm"; const ACTOR_USERNAME = "relay.actor" as const; diff --git a/packages/backend/src/services/send-email.ts b/packages/backend/src/services/send-email.ts index 7874af136..ccc6b365d 100644 --- a/packages/backend/src/services/send-email.ts +++ b/packages/backend/src/services/send-email.ts @@ -1,7 +1,7 @@ -import config from "@/config/index.js"; +import * as nodemailer from "nodemailer"; import { fetchMeta } from "@/misc/fetch-meta.js"; import Logger from "@/services/logger.js"; -import * as nodemailer from "nodemailer"; +import config from "@/config/index.js"; export const logger = new Logger("email"); diff --git a/packages/backend/src/services/stream.ts b/packages/backend/src/services/stream.ts index 518f35359..f59674ad6 100644 --- a/packages/backend/src/services/stream.ts +++ b/packages/backend/src/services/stream.ts @@ -1,12 +1,13 @@ -import config from "@/config/index.js"; import { redisClient } from "@/db/redis.js"; +import type { User } from "@/models/entities/user.js"; +import type { Note } from "@/models/entities/note.js"; +import type { UserList } from "@/models/entities/user-list.js"; +import type { UserGroup } from "@/models/entities/user-group.js"; +import config from "@/config/index.js"; import type { Antenna } from "@/models/entities/antenna.js"; import type { Channel } from "@/models/entities/channel.js"; -import type { Note } from "@/models/entities/note.js"; -import type { UserGroup } from "@/models/entities/user-group.js"; -import type { UserList } from "@/models/entities/user-list.js"; -import type { User } from "@/models/entities/user.js"; import type { + StreamChannels, AdminStreamTypes, AntennaStreamTypes, BroadcastTypes, @@ -18,7 +19,6 @@ import type { MessagingIndexStreamTypes, MessagingStreamTypes, NoteStreamTypes, - StreamChannels, UserListStreamTypes, UserStreamTypes, } from "@/server/api/stream/types.js"; diff --git a/packages/backend/src/services/suspend-user.ts b/packages/backend/src/services/suspend-user.ts index 919f6d0ab..f72b8ffcb 100644 --- a/packages/backend/src/services/suspend-user.ts +++ b/packages/backend/src/services/suspend-user.ts @@ -1,11 +1,11 @@ -import config from "@/config/index.js"; -import type { User } from "@/models/entities/user.js"; -import { Followings, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; import renderDelete from "@/remote/activitypub/renderer/delete.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { deliver } from "@/queue/index.js"; +import config from "@/config/index.js"; +import type { User } from "@/models/entities/user.js"; +import { Users, Followings } from "@/models/index.js"; +import { Not, IsNull } from "typeorm"; import { publishInternalEvent } from "@/services/stream.js"; -import { IsNull, Not } from "typeorm"; export async function doPostSuspend(user: { id: User["id"]; diff --git a/packages/backend/src/services/unsuspend-user.ts b/packages/backend/src/services/unsuspend-user.ts index 944ef18be..69447a4a2 100644 --- a/packages/backend/src/services/unsuspend-user.ts +++ b/packages/backend/src/services/unsuspend-user.ts @@ -1,12 +1,12 @@ +import renderDelete from "@/remote/activitypub/renderer/delete.js"; +import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { renderActivity } from "@/remote/activitypub/renderer/index.js"; +import { deliver } from "@/queue/index.js"; import config from "@/config/index.js"; import type { User } from "@/models/entities/user.js"; -import { Followings, Users } from "@/models/index.js"; -import { deliver } from "@/queue/index.js"; -import renderDelete from "@/remote/activitypub/renderer/delete.js"; -import { renderActivity } from "@/remote/activitypub/renderer/index.js"; -import renderUndo from "@/remote/activitypub/renderer/undo.js"; +import { Users, Followings } from "@/models/index.js"; +import { Not, IsNull } from "typeorm"; import { publishInternalEvent } from "@/services/stream.js"; -import { IsNull, Not } from "typeorm"; export async function doPostUnsuspend(user: User) { publishInternalEvent("userChangeSuspendedState", { diff --git a/packages/backend/src/services/update-hashtag.ts b/packages/backend/src/services/update-hashtag.ts index db08bd148..0c65b08f0 100644 --- a/packages/backend/src/services/update-hashtag.ts +++ b/packages/backend/src/services/update-hashtag.ts @@ -1,9 +1,9 @@ -import { genId } from "@/misc/gen-id.js"; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; -import type { Hashtag } from "@/models/entities/hashtag.js"; import type { User } from "@/models/entities/user.js"; import { Hashtags, Users } from "@/models/index.js"; import { hashtagChart } from "@/services/chart/index.js"; +import { genId } from "@/misc/gen-id.js"; +import type { Hashtag } from "@/models/entities/hashtag.js"; +import { normalizeForSearch } from "@/misc/normalize-for-search.js"; export async function updateHashtags( user: { id: User["id"]; host: User["host"] }, diff --git a/packages/backend/src/services/user-cache.ts b/packages/backend/src/services/user-cache.ts index 699d5edde..ed700185d 100644 --- a/packages/backend/src/services/user-cache.ts +++ b/packages/backend/src/services/user-cache.ts @@ -1,11 +1,11 @@ -import { redisClient, subscriber } from "@/db/redis.js"; -import { Cache } from "@/misc/cache.js"; import type { CacheableLocalUser, CacheableUser, ILocalUser, } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; +import { Cache } from "@/misc/cache.js"; +import { redisClient, subscriber } from "@/db/redis.js"; export const userByIdCache = new Cache("userById", 60 * 30); export const localUserByNativeTokenCache = new Cache( diff --git a/packages/backend/src/services/user-list/push.ts b/packages/backend/src/services/user-list/push.ts index 77181bf7b..db01b0a90 100644 --- a/packages/backend/src/services/user-list/push.ts +++ b/packages/backend/src/services/user-list/push.ts @@ -1,11 +1,11 @@ -import { fetchProxyAccount } from "@/misc/fetch-proxy-account.js"; -import { genId } from "@/misc/gen-id.js"; -import type { UserListJoining } from "@/models/entities/user-list-joining.js"; -import type { UserList } from "@/models/entities/user-list.js"; -import type { User } from "@/models/entities/user.js"; -import { UserListJoinings, Users } from "@/models/index.js"; -import createFollowing from "@/services/following/create.js"; import { publishUserListStream } from "@/services/stream.js"; +import type { User } from "@/models/entities/user.js"; +import type { UserList } from "@/models/entities/user-list.js"; +import { UserListJoinings, Users } from "@/models/index.js"; +import type { UserListJoining } from "@/models/entities/user-list-joining.js"; +import { genId } from "@/misc/gen-id.js"; +import { fetchProxyAccount } from "@/misc/fetch-proxy-account.js"; +import createFollowing from "@/services/following/create.js"; export async function pushUserToUserList(target: User, list: UserList) { await UserListJoinings.insert({ diff --git a/packages/backend/src/services/validate-email-for-account.ts b/packages/backend/src/services/validate-email-for-account.ts index 419203f53..2bb5e93e7 100644 --- a/packages/backend/src/services/validate-email-for-account.ts +++ b/packages/backend/src/services/validate-email-for-account.ts @@ -1,6 +1,6 @@ -import { fetchMeta } from "@/misc/fetch-meta.js"; -import { UserProfiles } from "@/models/index.js"; import { validate as validateEmail } from "deep-email-validator"; +import { UserProfiles } from "@/models/index.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; export async function validateEmailForAccount(emailAddress: string): Promise<{ available: boolean;