From b9cb6d1c10729869cbb57ce50c8174ad7474db75 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 19 Aug 2021 18:33:41 +0900 Subject: [PATCH] refactor: refactoring imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい --- index.js | 10 ++ package.json | 4 +- src/argv.ts | 25 ++-- src/boot/index.ts | 8 +- src/boot/master.ts | 16 +-- src/boot/worker.ts | 2 +- src/config/index.ts | 2 +- src/config/load.ts | 12 +- src/daemons/janitor.ts | 2 +- src/daemons/queue-stats.ts | 2 +- src/db/elasticsearch.ts | 2 +- src/db/logger.ts | 2 +- src/db/postgre.ts | 134 +++++++++--------- src/db/redis.ts | 2 +- src/index.ts | 2 +- src/mfm/to-html.ts | 8 +- src/misc/antenna-cache.ts | 6 +- src/misc/app-lock.ts | 5 +- src/misc/captcha.ts | 4 +- src/misc/check-hit-antenna.ts | 14 +- src/misc/check-word-mute.ts | 4 +- src/misc/convert-host.ts | 2 +- src/misc/count-same-renotes.ts | 2 +- src/misc/detect-url-mime.ts | 6 +- src/misc/download-text-file.ts | 6 +- src/misc/download-url.ts | 6 +- src/misc/extract-custom-emojis-from-mfm.ts | 2 +- src/misc/extract-hashtags.ts | 2 +- src/misc/fetch-meta.ts | 2 +- src/misc/fetch-proxy-account.ts | 6 +- src/misc/fetch.ts | 2 +- src/misc/gen-avatar.ts | 2 +- src/misc/gen-id.ts | 10 +- src/misc/get-user-name.ts | 2 +- src/misc/is-quote.ts | 2 +- src/misc/keypair-store.ts | 8 +- src/misc/license.ts | 8 +- src/misc/populate-emojis.ts | 16 +-- src/misc/reaction-lib.ts | 8 +- src/misc/show-machine-info.ts | 2 +- src/models/entities/abuse-user-report.ts | 4 +- src/models/entities/access-token.ts | 6 +- src/models/entities/ad.ts | 2 +- src/models/entities/announcement-read.ts | 6 +- src/models/entities/announcement.ts | 2 +- src/models/entities/antenna-note.ts | 6 +- src/models/entities/antenna.ts | 8 +- src/models/entities/app.ts | 4 +- src/models/entities/attestation-challenge.ts | 4 +- src/models/entities/auth-session.ts | 6 +- src/models/entities/blocking.ts | 4 +- src/models/entities/channel-following.ts | 6 +- src/models/entities/channel-note-pining.ts | 6 +- src/models/entities/channel.ts | 6 +- src/models/entities/clip-note.ts | 6 +- src/models/entities/clip.ts | 4 +- src/models/entities/drive-file.ts | 6 +- src/models/entities/drive-folder.ts | 4 +- src/models/entities/emoji.ts | 2 +- src/models/entities/follow-request.ts | 4 +- src/models/entities/following.ts | 4 +- src/models/entities/gallery-like.ts | 6 +- src/models/entities/gallery-post.ts | 6 +- src/models/entities/games/reversi/game.ts | 4 +- src/models/entities/games/reversi/matching.ts | 4 +- src/models/entities/hashtag.ts | 4 +- src/models/entities/instance.ts | 2 +- src/models/entities/log.ts | 2 +- src/models/entities/messaging-message.ts | 8 +- src/models/entities/meta.ts | 6 +- src/models/entities/moderation-log.ts | 4 +- src/models/entities/muted-note.ts | 8 +- src/models/entities/muting.ts | 4 +- src/models/entities/note-favorite.ts | 6 +- src/models/entities/note-reaction.ts | 6 +- src/models/entities/note-unread.ts | 8 +- src/models/entities/note-watching.ts | 6 +- src/models/entities/note.ts | 10 +- src/models/entities/notification.ts | 14 +- src/models/entities/page-like.ts | 6 +- src/models/entities/page.ts | 6 +- src/models/entities/password-reset-request.ts | 4 +- src/models/entities/poll-vote.ts | 6 +- src/models/entities/poll.ts | 8 +- src/models/entities/promo-note.ts | 6 +- src/models/entities/promo-read.ts | 6 +- src/models/entities/registration-tickets.ts | 2 +- src/models/entities/registry-item.ts | 4 +- src/models/entities/relay.ts | 2 +- src/models/entities/signin.ts | 4 +- src/models/entities/sw-subscription.ts | 4 +- src/models/entities/user-group-invitation.ts | 6 +- src/models/entities/user-group-joining.ts | 6 +- src/models/entities/user-group.ts | 4 +- src/models/entities/user-keypair.ts | 4 +- src/models/entities/user-list-joining.ts | 6 +- src/models/entities/user-list.ts | 4 +- src/models/entities/user-note-pining.ts | 6 +- src/models/entities/user-profile.ts | 8 +- src/models/entities/user-publickey.ts | 4 +- src/models/entities/user-security-key.ts | 4 +- src/models/entities/user.ts | 4 +- src/models/index.ts | 126 ++++++++-------- src/models/repositories/abuse-user-report.ts | 6 +- src/models/repositories/antenna.ts | 6 +- src/models/repositories/app.ts | 6 +- src/models/repositories/auth-session.ts | 8 +- src/models/repositories/blocking.ts | 10 +- src/models/repositories/channel.ts | 8 +- src/models/repositories/clip.ts | 8 +- src/models/repositories/drive-file.ts | 20 +-- src/models/repositories/drive-folder.ts | 8 +- src/models/repositories/emoji.ts | 2 +- .../repositories/federation-instance.ts | 2 +- src/models/repositories/follow-request.ts | 6 +- src/models/repositories/following.ts | 10 +- src/models/repositories/gallery-like.ts | 4 +- src/models/repositories/gallery-post.ts | 10 +- src/models/repositories/games/reversi/game.ts | 6 +- .../repositories/games/reversi/matching.ts | 8 +- src/models/repositories/hashtag.ts | 4 +- src/models/repositories/messaging-message.ts | 8 +- src/models/repositories/moderation-logs.ts | 6 +- src/models/repositories/muting.ts | 10 +- src/models/repositories/note-favorite.ts | 6 +- src/models/repositories/note-reaction.ts | 10 +- src/models/repositories/note.ts | 18 +-- src/models/repositories/notification.ts | 16 +-- src/models/repositories/page-like.ts | 6 +- src/models/repositories/page.ts | 12 +- src/models/repositories/relay.ts | 2 +- src/models/repositories/signin.ts | 2 +- .../repositories/user-group-invitation.ts | 4 +- src/models/repositories/user-group.ts | 6 +- src/models/repositories/user-list.ts | 6 +- src/models/repositories/user.ts | 16 +-- src/prelude/array.ts | 2 +- src/queue/index.ts | 24 ++-- src/queue/initialize.ts | 2 +- src/queue/logger.ts | 2 +- src/queue/processors/db/delete-drive-files.ts | 8 +- src/queue/processors/db/export-blocking.ts | 12 +- src/queue/processors/db/export-following.ts | 12 +- src/queue/processors/db/export-mute.ts | 12 +- src/queue/processors/db/export-notes.ts | 14 +- src/queue/processors/db/export-user-lists.ts | 12 +- src/queue/processors/db/import-following.ts | 16 +-- src/queue/processors/db/import-user-lists.ts | 18 +-- src/queue/processors/db/index.ts | 18 +-- src/queue/processors/deliver.ts | 22 +-- src/queue/processors/inbox.ts | 26 ++-- .../object-storage/clean-remote-files.ts | 6 +- .../processors/object-storage/delete-file.ts | 4 +- src/queue/processors/object-storage/index.ts | 6 +- src/queue/queues.ts | 6 +- src/queue/types.ts | 6 +- src/remote/activitypub/audience.ts | 10 +- src/remote/activitypub/db-resolver.ts | 16 +-- src/remote/activitypub/deliver-manager.ts | 6 +- .../activitypub/kernel/accept/follow.ts | 10 +- src/remote/activitypub/kernel/accept/index.ts | 10 +- src/remote/activitypub/kernel/add/index.ts | 8 +- .../activitypub/kernel/announce/index.ts | 10 +- .../activitypub/kernel/announce/note.ts | 20 +-- src/remote/activitypub/kernel/block/index.ts | 8 +- src/remote/activitypub/kernel/create/index.ts | 12 +- src/remote/activitypub/kernel/create/note.ts | 12 +- src/remote/activitypub/kernel/delete/index.ts | 8 +- src/remote/activitypub/kernel/delete/note.ts | 12 +- src/remote/activitypub/kernel/flag/index.ts | 10 +- src/remote/activitypub/kernel/follow.ts | 8 +- src/remote/activitypub/kernel/index.ts | 38 ++--- src/remote/activitypub/kernel/like.ts | 8 +- src/remote/activitypub/kernel/read.ts | 10 +- .../activitypub/kernel/reject/follow.ts | 10 +- src/remote/activitypub/kernel/reject/index.ts | 10 +- src/remote/activitypub/kernel/remove/index.ts | 8 +- .../activitypub/kernel/undo/announce.ts | 8 +- src/remote/activitypub/kernel/undo/block.ts | 8 +- src/remote/activitypub/kernel/undo/follow.ts | 12 +- src/remote/activitypub/kernel/undo/index.ts | 16 +-- src/remote/activitypub/kernel/undo/like.ts | 8 +- src/remote/activitypub/kernel/update/index.ts | 12 +- src/remote/activitypub/logger.ts | 2 +- src/remote/activitypub/misc/get-note-html.ts | 4 +- src/remote/activitypub/misc/html-to-mfm.ts | 6 +- src/remote/activitypub/misc/ld-signature.ts | 4 +- src/remote/activitypub/models/image.ts | 14 +- src/remote/activitypub/models/mention.ts | 10 +- src/remote/activitypub/models/note.ts | 52 +++---- src/remote/activitypub/models/person.ts | 50 +++---- src/remote/activitypub/models/question.ts | 12 +- src/remote/activitypub/models/tag.ts | 4 +- src/remote/activitypub/perform.ts | 6 +- src/remote/activitypub/renderer/accept.ts | 4 +- src/remote/activitypub/renderer/add.ts | 4 +- src/remote/activitypub/renderer/announce.ts | 4 +- src/remote/activitypub/renderer/block.ts | 4 +- src/remote/activitypub/renderer/create.ts | 4 +- src/remote/activitypub/renderer/delete.ts | 4 +- src/remote/activitypub/renderer/document.ts | 4 +- src/remote/activitypub/renderer/emoji.ts | 4 +- .../activitypub/renderer/follow-relay.ts | 6 +- .../activitypub/renderer/follow-user.ts | 6 +- src/remote/activitypub/renderer/follow.ts | 6 +- src/remote/activitypub/renderer/hashtag.ts | 2 +- src/remote/activitypub/renderer/image.ts | 4 +- src/remote/activitypub/renderer/index.ts | 10 +- src/remote/activitypub/renderer/key.ts | 6 +- src/remote/activitypub/renderer/like.ts | 10 +- src/remote/activitypub/renderer/mention.ts | 6 +- src/remote/activitypub/renderer/note.ts | 22 +-- src/remote/activitypub/renderer/person.ts | 22 +-- src/remote/activitypub/renderer/question.ts | 8 +- src/remote/activitypub/renderer/read.ts | 6 +- src/remote/activitypub/renderer/reject.ts | 4 +- src/remote/activitypub/renderer/remove.ts | 4 +- src/remote/activitypub/renderer/undo.ts | 4 +- src/remote/activitypub/renderer/update.ts | 4 +- src/remote/activitypub/renderer/vote.ts | 10 +- src/remote/activitypub/request.ts | 8 +- src/remote/activitypub/resolver.ts | 12 +- src/remote/logger.ts | 2 +- src/remote/resolve-user.ts | 14 +- src/remote/webfinger.ts | 4 +- src/server/activitypub.ts | 30 ++-- src/server/activitypub/featured.ts | 12 +- src/server/activitypub/followers.ts | 18 +-- src/server/activitypub/following.ts | 20 +-- src/server/activitypub/outbox.ts | 28 ++-- src/server/api/2fa.ts | 2 +- src/server/api/api-handler.ts | 8 +- src/server/api/authenticate.ts | 8 +- src/server/api/call.ts | 12 +- src/server/api/common/generate-block-query.ts | 4 +- .../api/common/generate-channel-query.ts | 4 +- .../api/common/generate-muted-note-query.ts | 4 +- .../api/common/generate-muted-user-query.ts | 4 +- .../api/common/generate-native-user-token.ts | 2 +- .../api/common/generate-replies-query.ts | 2 +- .../api/common/generate-visibility-query.ts | 4 +- src/server/api/common/getters.ts | 8 +- src/server/api/common/inject-featured.ts | 10 +- src/server/api/common/inject-promo.ts | 6 +- .../api/common/read-messaging-message.ts | 26 ++-- src/server/api/common/read-notification.ts | 8 +- src/server/api/common/signin.ts | 10 +- src/server/api/common/signup.ts | 18 +-- src/server/api/define.ts | 10 +- src/server/api/endpoints.ts | 10 +- .../api/endpoints/admin/abuse-user-reports.ts | 8 +- .../api/endpoints/admin/accounts/create.ts | 6 +- src/server/api/endpoints/admin/ad/create.ts | 6 +- src/server/api/endpoints/admin/ad/delete.ts | 8 +- src/server/api/endpoints/admin/ad/list.ts | 8 +- src/server/api/endpoints/admin/ad/update.ts | 8 +- .../endpoints/admin/announcements/create.ts | 6 +- .../endpoints/admin/announcements/delete.ts | 8 +- .../api/endpoints/admin/announcements/list.ts | 8 +- .../endpoints/admin/announcements/update.ts | 8 +- .../admin/delete-all-files-of-a-user.ts | 8 +- src/server/api/endpoints/admin/delete-logs.ts | 4 +- .../admin/drive/clean-remote-files.ts | 4 +- .../api/endpoints/admin/drive/cleanup.ts | 6 +- src/server/api/endpoints/admin/drive/files.ts | 8 +- .../api/endpoints/admin/drive/show-file.ts | 8 +- src/server/api/endpoints/admin/emoji/add.ts | 14 +- src/server/api/endpoints/admin/emoji/copy.ts | 16 +-- .../api/endpoints/admin/emoji/list-remote.ts | 10 +- src/server/api/endpoints/admin/emoji/list.ts | 10 +- .../api/endpoints/admin/emoji/remove.ts | 10 +- .../api/endpoints/admin/emoji/update.ts | 8 +- .../admin/federation/delete-all-files.ts | 6 +- .../refresh-remote-instance-metadata.ts | 8 +- .../admin/federation/remove-all-following.ts | 6 +- .../admin/federation/update-instance.ts | 6 +- .../api/endpoints/admin/get-index-stats.ts | 2 +- .../api/endpoints/admin/get-table-stats.ts | 2 +- src/server/api/endpoints/admin/invite.ts | 6 +- src/server/api/endpoints/admin/logs.ts | 4 +- .../api/endpoints/admin/moderators/add.ts | 6 +- .../api/endpoints/admin/moderators/remove.ts | 6 +- .../api/endpoints/admin/promo/create.ts | 10 +- src/server/api/endpoints/admin/queue/clear.ts | 6 +- .../endpoints/admin/queue/deliver-delayed.ts | 4 +- .../endpoints/admin/queue/inbox-delayed.ts | 4 +- src/server/api/endpoints/admin/queue/jobs.ts | 4 +- src/server/api/endpoints/admin/queue/stats.ts | 4 +- src/server/api/endpoints/admin/relays/add.ts | 6 +- src/server/api/endpoints/admin/relays/list.ts | 4 +- .../api/endpoints/admin/relays/remove.ts | 4 +- .../api/endpoints/admin/reset-password.ts | 6 +- .../admin/resolve-abuse-user-report.ts | 6 +- .../api/endpoints/admin/resync-chart.ts | 6 +- src/server/api/endpoints/admin/send-email.ts | 4 +- src/server/api/endpoints/admin/server-info.ts | 4 +- .../endpoints/admin/show-moderation-logs.ts | 8 +- src/server/api/endpoints/admin/show-user.ts | 6 +- src/server/api/endpoints/admin/show-users.ts | 4 +- .../api/endpoints/admin/silence-user.ts | 8 +- .../api/endpoints/admin/suspend-user.ts | 16 +-- .../api/endpoints/admin/unsilence-user.ts | 8 +- .../api/endpoints/admin/unsuspend-user.ts | 10 +- src/server/api/endpoints/admin/update-meta.ts | 10 +- src/server/api/endpoints/admin/vacuum.ts | 4 +- src/server/api/endpoints/announcements.ts | 8 +- src/server/api/endpoints/antennas/create.ts | 12 +- src/server/api/endpoints/antennas/delete.ts | 10 +- src/server/api/endpoints/antennas/list.ts | 4 +- src/server/api/endpoints/antennas/notes.ts | 16 +-- src/server/api/endpoints/antennas/show.ts | 8 +- src/server/api/endpoints/antennas/update.ts | 10 +- src/server/api/endpoints/ap/get.ts | 6 +- src/server/api/endpoints/ap/show.ts | 24 ++-- src/server/api/endpoints/app/create.ts | 10 +- src/server/api/endpoints/app/show.ts | 8 +- src/server/api/endpoints/auth/accept.ts | 10 +- .../api/endpoints/auth/session/generate.ts | 10 +- src/server/api/endpoints/auth/session/show.ts | 6 +- .../api/endpoints/auth/session/userkey.ts | 6 +- src/server/api/endpoints/blocking/create.ts | 12 +- src/server/api/endpoints/blocking/delete.ts | 12 +- src/server/api/endpoints/blocking/list.ts | 8 +- src/server/api/endpoints/channels/create.ts | 12 +- src/server/api/endpoints/channels/featured.ts | 4 +- src/server/api/endpoints/channels/follow.ts | 12 +- src/server/api/endpoints/channels/followed.ts | 8 +- src/server/api/endpoints/channels/owned.ts | 8 +- src/server/api/endpoints/channels/show.ts | 8 +- src/server/api/endpoints/channels/timeline.ts | 12 +- src/server/api/endpoints/channels/unfollow.ts | 10 +- src/server/api/endpoints/channels/update.ts | 8 +- .../api/endpoints/charts/active-users.ts | 6 +- src/server/api/endpoints/charts/drive.ts | 6 +- src/server/api/endpoints/charts/federation.ts | 6 +- src/server/api/endpoints/charts/hashtag.ts | 6 +- src/server/api/endpoints/charts/instance.ts | 6 +- src/server/api/endpoints/charts/network.ts | 6 +- src/server/api/endpoints/charts/notes.ts | 6 +- src/server/api/endpoints/charts/user/drive.ts | 8 +- .../api/endpoints/charts/user/following.ts | 8 +- src/server/api/endpoints/charts/user/notes.ts | 8 +- .../api/endpoints/charts/user/reactions.ts | 8 +- src/server/api/endpoints/charts/users.ts | 6 +- src/server/api/endpoints/clips/add-note.ts | 12 +- src/server/api/endpoints/clips/create.ts | 6 +- src/server/api/endpoints/clips/delete.ts | 8 +- src/server/api/endpoints/clips/list.ts | 4 +- src/server/api/endpoints/clips/notes.ts | 16 +-- src/server/api/endpoints/clips/show.ts | 8 +- src/server/api/endpoints/clips/update.ts | 8 +- src/server/api/endpoints/drive.ts | 6 +- src/server/api/endpoints/drive/files.ts | 8 +- .../endpoints/drive/files/attached-notes.ts | 8 +- .../endpoints/drive/files/check-existence.ts | 4 +- .../api/endpoints/drive/files/create.ts | 12 +- .../api/endpoints/drive/files/delete.ts | 12 +- .../api/endpoints/drive/files/find-by-hash.ts | 4 +- src/server/api/endpoints/drive/files/find.ts | 6 +- src/server/api/endpoints/drive/files/show.ts | 10 +- .../api/endpoints/drive/files/update.ts | 10 +- .../endpoints/drive/files/upload-from-url.ts | 10 +- src/server/api/endpoints/drive/folders.ts | 8 +- .../api/endpoints/drive/folders/create.ts | 12 +- .../api/endpoints/drive/folders/delete.ts | 10 +- .../api/endpoints/drive/folders/find.ts | 6 +- .../api/endpoints/drive/folders/show.ts | 8 +- .../api/endpoints/drive/folders/update.ts | 10 +- src/server/api/endpoints/drive/stream.ts | 8 +- src/server/api/endpoints/endpoint.ts | 4 +- src/server/api/endpoints/endpoints.ts | 4 +- src/server/api/endpoints/federation/dns.ts | 6 +- .../api/endpoints/federation/followers.ts | 8 +- .../api/endpoints/federation/following.ts | 8 +- .../api/endpoints/federation/instances.ts | 8 +- .../api/endpoints/federation/show-instance.ts | 6 +- .../federation/update-remote-user.ts | 8 +- src/server/api/endpoints/federation/users.ts | 8 +- src/server/api/endpoints/following/create.ts | 12 +- src/server/api/endpoints/following/delete.ts | 12 +- .../endpoints/following/requests/accept.ts | 10 +- .../endpoints/following/requests/cancel.ts | 12 +- .../api/endpoints/following/requests/list.ts | 4 +- .../endpoints/following/requests/reject.ts | 10 +- src/server/api/endpoints/gallery/featured.ts | 4 +- src/server/api/endpoints/gallery/popular.ts | 4 +- src/server/api/endpoints/gallery/posts.ts | 8 +- .../api/endpoints/gallery/posts/create.ts | 14 +- .../api/endpoints/gallery/posts/delete.ts | 8 +- .../api/endpoints/gallery/posts/like.ts | 10 +- .../api/endpoints/gallery/posts/show.ts | 8 +- .../api/endpoints/gallery/posts/unlike.ts | 8 +- .../api/endpoints/gallery/posts/update.ts | 12 +- .../api/endpoints/games/reversi/games.ts | 8 +- .../api/endpoints/games/reversi/games/show.ts | 10 +- .../games/reversi/games/surrender.ts | 10 +- .../endpoints/games/reversi/invitations.ts | 4 +- .../api/endpoints/games/reversi/match.ts | 20 +-- .../endpoints/games/reversi/match/cancel.ts | 4 +- .../api/endpoints/get-online-users-count.ts | 6 +- src/server/api/endpoints/hashtags/list.ts | 4 +- src/server/api/endpoints/hashtags/search.ts | 4 +- src/server/api/endpoints/hashtags/show.ts | 8 +- src/server/api/endpoints/hashtags/trend.ts | 12 +- src/server/api/endpoints/hashtags/users.ts | 6 +- src/server/api/endpoints/i.ts | 4 +- src/server/api/endpoints/i/2fa/done.ts | 4 +- src/server/api/endpoints/i/2fa/key-done.ts | 10 +- .../api/endpoints/i/2fa/password-less.ts | 4 +- .../api/endpoints/i/2fa/register-key.ts | 8 +- src/server/api/endpoints/i/2fa/register.ts | 6 +- src/server/api/endpoints/i/2fa/remove-key.ts | 6 +- src/server/api/endpoints/i/2fa/unregister.ts | 4 +- src/server/api/endpoints/i/apps.ts | 4 +- src/server/api/endpoints/i/authorized-apps.ts | 4 +- src/server/api/endpoints/i/change-password.ts | 4 +- src/server/api/endpoints/i/delete-account.ts | 8 +- src/server/api/endpoints/i/export-blocking.ts | 6 +- .../api/endpoints/i/export-following.ts | 6 +- src/server/api/endpoints/i/export-mute.ts | 6 +- src/server/api/endpoints/i/export-notes.ts | 6 +- .../api/endpoints/i/export-user-lists.ts | 6 +- src/server/api/endpoints/i/favorites.ts | 8 +- src/server/api/endpoints/i/gallery/likes.ts | 8 +- src/server/api/endpoints/i/gallery/posts.ts | 8 +- .../endpoints/i/get-word-muted-notes-count.ts | 4 +- .../api/endpoints/i/import-following.ts | 12 +- .../api/endpoints/i/import-user-lists.ts | 12 +- src/server/api/endpoints/i/notifications.ts | 14 +- src/server/api/endpoints/i/page-likes.ts | 8 +- src/server/api/endpoints/i/pages.ts | 8 +- src/server/api/endpoints/i/pin.ts | 10 +- .../i/read-all-messaging-messages.ts | 6 +- .../api/endpoints/i/read-all-unread-notes.ts | 6 +- .../api/endpoints/i/read-announcement.ts | 12 +- .../api/endpoints/i/regenerate-token.ts | 8 +- .../api/endpoints/i/registry/get-all.ts | 4 +- .../api/endpoints/i/registry/get-detail.ts | 6 +- src/server/api/endpoints/i/registry/get.ts | 6 +- .../endpoints/i/registry/keys-with-type.ts | 4 +- src/server/api/endpoints/i/registry/keys.ts | 4 +- src/server/api/endpoints/i/registry/remove.ts | 6 +- src/server/api/endpoints/i/registry/scopes.ts | 4 +- src/server/api/endpoints/i/registry/set.ts | 8 +- src/server/api/endpoints/i/revoke-token.ts | 8 +- src/server/api/endpoints/i/signin-history.ts | 8 +- src/server/api/endpoints/i/unpin.ts | 10 +- src/server/api/endpoints/i/update-email.ts | 12 +- src/server/api/endpoints/i/update.ts | 28 ++-- .../api/endpoints/i/user-group-invites.ts | 8 +- src/server/api/endpoints/messaging/history.ts | 6 +- .../api/endpoints/messaging/messages.ts | 14 +- .../endpoints/messaging/messages/create.ts | 16 +-- .../endpoints/messaging/messages/delete.ts | 10 +- .../api/endpoints/messaging/messages/read.ts | 10 +- src/server/api/endpoints/meta.ts | 10 +- src/server/api/endpoints/miauth/gen-token.ts | 8 +- src/server/api/endpoints/mute/create.ts | 16 +-- src/server/api/endpoints/mute/delete.ts | 12 +- src/server/api/endpoints/mute/list.ts | 8 +- src/server/api/endpoints/my/apps.ts | 4 +- src/server/api/endpoints/notes.ts | 8 +- src/server/api/endpoints/notes/children.ts | 14 +- src/server/api/endpoints/notes/clips.ts | 10 +- .../api/endpoints/notes/conversation.ts | 12 +- src/server/api/endpoints/notes/create.ts | 24 ++-- src/server/api/endpoints/notes/delete.ts | 12 +- .../api/endpoints/notes/favorites/create.ts | 12 +- .../api/endpoints/notes/favorites/delete.ts | 10 +- src/server/api/endpoints/notes/featured.ts | 8 +- .../api/endpoints/notes/global-timeline.ts | 22 +-- .../api/endpoints/notes/hybrid-timeline.ts | 26 ++-- .../api/endpoints/notes/local-timeline.ts | 26 ++-- src/server/api/endpoints/notes/mentions.ts | 16 +-- .../endpoints/notes/polls/recommendation.ts | 4 +- src/server/api/endpoints/notes/polls/vote.ts | 26 ++-- src/server/api/endpoints/notes/reactions.ts | 12 +- .../api/endpoints/notes/reactions/create.ts | 10 +- .../api/endpoints/notes/reactions/delete.ts | 10 +- src/server/api/endpoints/notes/renotes.ts | 18 +-- src/server/api/endpoints/notes/replies.ts | 14 +- .../api/endpoints/notes/search-by-tag.ts | 18 +-- src/server/api/endpoints/notes/search.ts | 18 +-- src/server/api/endpoints/notes/show.ts | 10 +- src/server/api/endpoints/notes/state.ts | 6 +- src/server/api/endpoints/notes/timeline.ts | 22 +-- src/server/api/endpoints/notes/translate.ts | 14 +- src/server/api/endpoints/notes/unrenote.ts | 12 +- .../api/endpoints/notes/user-list-timeline.ts | 14 +- .../api/endpoints/notes/watching/create.ts | 10 +- .../api/endpoints/notes/watching/delete.ts | 10 +- .../api/endpoints/notifications/create.ts | 4 +- .../notifications/mark-all-as-read.ts | 6 +- .../api/endpoints/notifications/read.ts | 12 +- src/server/api/endpoints/page-push.ts | 10 +- src/server/api/endpoints/pages/create.ts | 12 +- src/server/api/endpoints/pages/delete.ts | 8 +- src/server/api/endpoints/pages/featured.ts | 4 +- src/server/api/endpoints/pages/like.ts | 10 +- src/server/api/endpoints/pages/show.ts | 10 +- src/server/api/endpoints/pages/unlike.ts | 8 +- src/server/api/endpoints/pages/update.ts | 8 +- src/server/api/endpoints/ping.ts | 2 +- src/server/api/endpoints/pinned-users.ts | 10 +- src/server/api/endpoints/promo/read.ts | 12 +- .../api/endpoints/request-reset-password.ts | 14 +- src/server/api/endpoints/reset-db.ts | 6 +- src/server/api/endpoints/reset-password.ts | 8 +- src/server/api/endpoints/room/show.ts | 10 +- src/server/api/endpoints/room/update.ts | 6 +- src/server/api/endpoints/server-info.ts | 2 +- src/server/api/endpoints/stats.ts | 6 +- src/server/api/endpoints/sw/register.ts | 8 +- .../api/endpoints/username/available.ts | 4 +- src/server/api/endpoints/users.ts | 8 +- src/server/api/endpoints/users/clips.ts | 8 +- src/server/api/endpoints/users/followers.ts | 12 +- src/server/api/endpoints/users/following.ts | 12 +- .../api/endpoints/users/gallery/posts.ts | 8 +- .../users/get-frequently-replied-users.ts | 12 +- .../api/endpoints/users/groups/create.ts | 10 +- .../api/endpoints/users/groups/delete.ts | 8 +- .../users/groups/invitations/accept.ts | 12 +- .../users/groups/invitations/reject.ts | 8 +- .../api/endpoints/users/groups/invite.ts | 16 +-- .../api/endpoints/users/groups/joined.ts | 4 +- .../api/endpoints/users/groups/owned.ts | 4 +- src/server/api/endpoints/users/groups/pull.ts | 10 +- src/server/api/endpoints/users/groups/show.ts | 8 +- .../api/endpoints/users/groups/transfer.ts | 10 +- .../api/endpoints/users/groups/update.ts | 8 +- .../api/endpoints/users/lists/create.ts | 8 +- .../api/endpoints/users/lists/delete.ts | 8 +- src/server/api/endpoints/users/lists/list.ts | 4 +- src/server/api/endpoints/users/lists/pull.ts | 12 +- src/server/api/endpoints/users/lists/push.ts | 12 +- src/server/api/endpoints/users/lists/show.ts | 8 +- .../api/endpoints/users/lists/update.ts | 8 +- src/server/api/endpoints/users/notes.ts | 18 +-- src/server/api/endpoints/users/pages.ts | 8 +- .../api/endpoints/users/recommendation.ts | 8 +- src/server/api/endpoints/users/relation.ts | 6 +- .../api/endpoints/users/report-abuse.ts | 14 +- .../users/search-by-username-and-host.ts | 4 +- src/server/api/endpoints/users/search.ts | 6 +- src/server/api/endpoints/users/show.ts | 14 +- src/server/api/endpoints/users/stats.ts | 8 +- src/server/api/index.ts | 16 +-- src/server/api/limiter.ts | 10 +- src/server/api/logger.ts | 2 +- src/server/api/openapi/description.ts | 6 +- src/server/api/openapi/gen-spec.ts | 10 +- src/server/api/openapi/schemas.ts | 46 +++--- src/server/api/private/signin.ts | 12 +- src/server/api/private/signup.ts | 8 +- src/server/api/service/discord.ts | 16 +-- src/server/api/service/github.ts | 16 +-- src/server/api/service/twitter.ts | 14 +- src/server/api/stream/channels/admin.ts | 2 +- src/server/api/stream/channels/antenna.ts | 8 +- src/server/api/stream/channels/channel.ts | 12 +- src/server/api/stream/channels/drive.ts | 2 +- .../api/stream/channels/games/reversi-game.ts | 14 +- .../api/stream/channels/games/reversi.ts | 6 +- .../api/stream/channels/global-timeline.ts | 14 +- src/server/api/stream/channels/hashtag.ts | 12 +- .../api/stream/channels/home-timeline.ts | 12 +- .../api/stream/channels/hybrid-timeline.ts | 16 +-- src/server/api/stream/channels/index.ts | 34 ++--- .../api/stream/channels/local-timeline.ts | 16 +-- src/server/api/stream/channels/main.ts | 4 +- .../api/stream/channels/messaging-index.ts | 2 +- src/server/api/stream/channels/messaging.ts | 8 +- src/server/api/stream/channels/queue-stats.ts | 2 +- .../api/stream/channels/server-stats.ts | 2 +- src/server/api/stream/channels/user-list.ts | 12 +- src/server/api/stream/index.ts | 28 ++-- src/server/api/streaming.ts | 8 +- src/server/file/index.ts | 10 +- src/server/file/send-drive-file.ts | 26 ++-- src/server/index.ts | 26 ++-- src/server/nodeinfo.ts | 10 +- src/server/proxy/index.ts | 2 +- src/server/proxy/proxy-media.ts | 10 +- src/server/web/feed.ts | 6 +- src/server/web/index.ts | 42 +++--- src/server/web/manifest.ts | 2 +- src/server/web/url-preview.ts | 10 +- src/server/well-known.ts | 12 +- src/services/add-note-to-antenna.ts | 14 +- src/services/blocking/create.ts | 22 +-- src/services/blocking/delete.ts | 14 +- .../chart/charts/classes/active-users.ts | 10 +- src/services/chart/charts/classes/drive.ts | 10 +- .../chart/charts/classes/federation.ts | 8 +- src/services/chart/charts/classes/hashtag.ts | 10 +- src/services/chart/charts/classes/instance.ts | 14 +- src/services/chart/charts/classes/network.ts | 6 +- src/services/chart/charts/classes/notes.ts | 10 +- .../chart/charts/classes/per-user-drive.ts | 10 +- .../charts/classes/per-user-following.ts | 10 +- .../chart/charts/classes/per-user-notes.ts | 12 +- .../charts/classes/per-user-reactions.ts | 12 +- .../chart/charts/classes/test-grouped.ts | 6 +- .../chart/charts/classes/test-unique.ts | 6 +- src/services/chart/charts/classes/test.ts | 6 +- src/services/chart/charts/classes/users.ts | 10 +- src/services/chart/core.ts | 8 +- src/services/chart/entities.ts | 10 +- src/services/chart/index.ts | 26 ++-- src/services/create-notification.ts | 14 +- src/services/create-system-user.ts | 14 +- src/services/drive/add-file.ts | 32 ++--- src/services/drive/delete-file.ts | 28 ++-- .../drive/generate-video-thumbnail.ts | 2 +- src/services/drive/internal-storage.ts | 10 +- src/services/drive/logger.ts | 2 +- src/services/drive/s3.ts | 4 +- src/services/drive/upload-from-url.ts | 16 +-- src/services/fetch-instance-metadata.ts | 10 +- src/services/following/create.ts | 32 ++--- src/services/following/delete.ts | 20 +-- src/services/following/requests/accept-all.ts | 6 +- src/services/following/requests/accept.ts | 18 +-- src/services/following/requests/cancel.ts | 16 +-- src/services/following/requests/create.ts | 16 +-- src/services/following/requests/reject.ts | 16 +-- src/services/i/pin.ts | 24 ++-- src/services/i/update.ts | 14 +- src/services/insert-moderation-log.ts | 6 +- src/services/instance-actor.ts | 8 +- src/services/logger.ts | 10 +- src/services/messages/create.ts | 26 ++-- src/services/messages/delete.ts | 16 +-- src/services/note/create.ts | 68 ++++----- src/services/note/delete.ts | 30 ++-- src/services/note/polls/update.ts | 14 +- src/services/note/polls/vote.ts | 12 +- src/services/note/reaction/create.ts | 30 ++-- src/services/note/reaction/delete.ts | 20 +-- src/services/note/read.ts | 18 +-- src/services/note/unread.ts | 10 +- src/services/note/unwatch.ts | 6 +- src/services/note/watch.ts | 10 +- src/services/push-notification.ts | 10 +- .../register-or-fetch-instance-doc.ts | 12 +- src/services/relay.ts | 16 +-- src/services/send-email-notification.ts | 12 +- src/services/send-email.ts | 6 +- src/services/stream.ts | 18 +-- src/services/suspend-user.ts | 12 +- src/services/unsuspend-user.ts | 14 +- src/services/update-hashtag.ts | 12 +- src/services/user-list/push.ts | 16 +-- src/tools/accept-migration.ts | 2 +- src/tools/add-emoji.ts | 4 +- src/tools/demote-admin.ts | 4 +- src/tools/mark-admin.ts | 4 +- src/tools/refresh-question.ts | 2 +- src/tools/resync-remote-user.ts | 6 +- src/tools/show-signin-history.ts | 2 +- src/tsconfig.json | 1 + test/tsconfig.json | 1 + 663 files changed, 3194 insertions(+), 3134 deletions(-) diff --git a/index.js b/index.js index 9b91b0a03..aa103e667 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,13 @@ +/* +import * as fs from 'fs'; + +if (fs.existsSync('./built')) { + import('./built/index.js').then(built => built()); +} else { + console.log('Built code is not found. Probably an error occurred during a build or you just forgot to build.'); +} +*/ + const fs = require('fs'); if (fs.existsSync('./built')) { diff --git a/package.json b/package.json index 1f7d570f5..a871012a6 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "main": "./index.js", "private": true, "scripts": { - "start": "node ./index.js", - "start:test": "cross-env NODE_ENV=test node ./index.js", + "start": "node --experimental-json-modules ./index.js", + "start:test": "cross-env NODE_ENV=test node --experimental-json-modules ./index.js", "init": "npm run migrate", "ormconfig": "node ./built/ormconfig.js", "migrate": "ts-node ./node_modules/typeorm/cli.js migration:run", diff --git a/src/argv.ts b/src/argv.ts index 8e00bcf47..5d1aeb70a 100644 --- a/src/argv.ts +++ b/src/argv.ts @@ -1,20 +1,19 @@ import { Command } from 'commander'; -import config from '@/config'; +import config from '@/config/index.js'; const program = new Command(); -program - .version(config.version) - .option('--no-daemons', 'Disable daemon processes (for debbuging)') - .option('--disable-clustering', 'Disable clustering') - .option('--only-server', 'Run server only (without job queue processing)') - .option('--only-queue', 'Pocessing job queue only (without server)') - .option('--quiet', 'Suppress all logs') - .option('--verbose', 'Enable all logs') - .option('--with-log-time', 'Include timestamp for each logs') - .option('--slow', 'Delay all requests (for debbuging)') - .option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.') - .parse(process.argv); +program.version(config.version); +program.option('--no-daemons', 'Disable daemon processes (for debbuging)'); +program.option('--disable-clustering', 'Disable clustering'); +program.option('--only-server', 'Run server only (without job queue processing)'); +program.option('--only-queue', 'Pocessing job queue only (without server)'); +program.option('--quiet', 'Suppress all logs'); +program.option('--verbose', 'Enable all logs'); +program.option('--with-log-time', 'Include timestamp for each logs'); +program.option('--slow', 'Delay all requests (for debbuging)'); +program.option('--color', 'This option is a dummy for some external program\'s (e.g. forever) issue.'); +program.parse(process.argv); if (process.env.MK_ONLY_QUEUE) program.onlyQueue = true; if (process.env.NODE_ENV === 'test') program.disableClustering = true; diff --git a/src/boot/index.ts b/src/boot/index.ts index 602f6b0e4..091793e53 100644 --- a/src/boot/index.ts +++ b/src/boot/index.ts @@ -2,13 +2,13 @@ import * as cluster from 'cluster'; import * as chalk from 'chalk'; import Xev from 'xev'; -import Logger from '../services/logger'; -import { program } from '../argv'; +import Logger from '@/services/logger.js'; +import { program } from '../argv.js'; // for typeorm import 'reflect-metadata'; -import { masterMain } from './master'; -import { workerMain } from './worker'; +import { masterMain } from './master.js'; +import { workerMain } from './worker.js'; const logger = new Logger('core', 'cyan'); const clusterLogger = logger.createSubLogger('cluster', 'orange', false); diff --git a/src/boot/master.ts b/src/boot/master.ts index 473e215ba..93ef9a458 100644 --- a/src/boot/master.ts +++ b/src/boot/master.ts @@ -5,14 +5,14 @@ import * as portscanner from 'portscanner'; import * as isRoot from 'is-root'; import { getConnection } from 'typeorm'; -import Logger from '../services/logger'; -import loadConfig from '@/config/load'; -import { Config } from '@/config/types'; -import { lessThan } from '../prelude/array'; -import { program } from '../argv'; -import { showMachineInfo } from '@/misc/show-machine-info'; -import { initDb } from '../db/postgre'; -const meta = require('../meta.json'); +import Logger from '@/services/logger.js'; +import loadConfig from '@/config/load.js'; +import { Config } from '@/config/types.js'; +import { lessThan } from '../prelude/array.js'; +import { program } from '../argv.js'; +import { showMachineInfo } from '@/misc/show-machine-info.js'; +import { initDb } from '../db/postgre.js'; +import * as meta from '../meta.json'; const logger = new Logger('core', 'cyan'); const bootLogger = logger.createSubLogger('boot', 'magenta', false); diff --git a/src/boot/worker.ts b/src/boot/worker.ts index 362fa3f26..881e6c723 100644 --- a/src/boot/worker.ts +++ b/src/boot/worker.ts @@ -1,5 +1,5 @@ import * as cluster from 'cluster'; -import { initDb } from '../db/postgre'; +import { initDb } from '../db/postgre.js'; /** * Init worker process diff --git a/src/config/index.ts b/src/config/index.ts index 7bfdca461..3e53b0003 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,3 +1,3 @@ -import load from './load'; +import load from './load.js'; export default load(); diff --git a/src/config/load.ts b/src/config/load.ts index 0929e8041..920efad4d 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -3,14 +3,20 @@ */ import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import * as yaml from 'js-yaml'; -import { Source, Mixin } from './types'; -const meta = require('../meta.json'); +import { Source, Mixin } from './types.js'; +import * as meta from '../meta.json'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); /** * Path of configuration directory */ -const dir = `${__dirname}/../../.config`; +const dir = `${_dirname}/../../.config`; /** * Path of configuration file diff --git a/src/daemons/janitor.ts b/src/daemons/janitor.ts index c07908642..2bffbc55d 100644 --- a/src/daemons/janitor.ts +++ b/src/daemons/janitor.ts @@ -1,7 +1,7 @@ // TODO: 消したい const interval = 30 * 60 * 1000; -import { AttestationChallenges } from '../models'; +import { AttestationChallenges } from '@/models/index.js'; import { LessThan } from 'typeorm'; /** diff --git a/src/daemons/queue-stats.ts b/src/daemons/queue-stats.ts index 77f09b18d..945bb1bd0 100644 --- a/src/daemons/queue-stats.ts +++ b/src/daemons/queue-stats.ts @@ -1,5 +1,5 @@ import Xev from 'xev'; -import { deliverQueue, inboxQueue } from '../queue/queues'; +import { deliverQueue, inboxQueue } from '../queue/queues.js'; const ev = new Xev(); diff --git a/src/db/elasticsearch.ts b/src/db/elasticsearch.ts index 58455b510..b21685069 100644 --- a/src/db/elasticsearch.ts +++ b/src/db/elasticsearch.ts @@ -1,5 +1,5 @@ import * as elasticsearch from '@elastic/elasticsearch'; -import config from '@/config'; +import config from '@/config/index.js'; const index = { settings: { diff --git a/src/db/logger.ts b/src/db/logger.ts index 1f702c18e..22f4c6b1b 100644 --- a/src/db/logger.ts +++ b/src/db/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export const dbLogger = new Logger('db'); diff --git a/src/db/postgre.ts b/src/db/postgre.ts index bc691319c..881f1e4da 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -3,75 +3,75 @@ const types = require('pg').types; types.setTypeParser(20, Number); import { createConnection, Logger, getConnection } from 'typeorm'; -import config from '@/config'; -import { entities as charts } from '../services/chart/entities'; -import { dbLogger } from './logger'; +import config from '@/config/index.js'; +import { entities as charts } from '@/services/chart/entities.js'; +import { dbLogger } from './logger.js'; import * as highlight from 'cli-highlight'; -import { Log } from '../models/entities/log'; -import { User } from '../models/entities/user'; -import { DriveFile } from '../models/entities/drive-file'; -import { DriveFolder } from '../models/entities/drive-folder'; -import { AccessToken } from '../models/entities/access-token'; -import { App } from '../models/entities/app'; -import { PollVote } from '../models/entities/poll-vote'; -import { Note } from '../models/entities/note'; -import { NoteReaction } from '../models/entities/note-reaction'; -import { NoteWatching } from '../models/entities/note-watching'; -import { NoteUnread } from '../models/entities/note-unread'; -import { Notification } from '../models/entities/notification'; -import { Meta } from '../models/entities/meta'; -import { Following } from '../models/entities/following'; -import { Instance } from '../models/entities/instance'; -import { Muting } from '../models/entities/muting'; -import { SwSubscription } from '../models/entities/sw-subscription'; -import { Blocking } from '../models/entities/blocking'; -import { UserList } from '../models/entities/user-list'; -import { UserListJoining } from '../models/entities/user-list-joining'; -import { UserGroup } from '../models/entities/user-group'; -import { UserGroupJoining } from '../models/entities/user-group-joining'; -import { UserGroupInvitation } from '../models/entities/user-group-invitation'; -import { Hashtag } from '../models/entities/hashtag'; -import { NoteFavorite } from '../models/entities/note-favorite'; -import { AbuseUserReport } from '../models/entities/abuse-user-report'; -import { RegistrationTicket } from '../models/entities/registration-tickets'; -import { MessagingMessage } from '../models/entities/messaging-message'; -import { Signin } from '../models/entities/signin'; -import { AuthSession } from '../models/entities/auth-session'; -import { FollowRequest } from '../models/entities/follow-request'; -import { Emoji } from '../models/entities/emoji'; -import { ReversiGame } from '../models/entities/games/reversi/game'; -import { ReversiMatching } from '../models/entities/games/reversi/matching'; -import { UserNotePining } from '../models/entities/user-note-pining'; -import { Poll } from '../models/entities/poll'; -import { UserKeypair } from '../models/entities/user-keypair'; -import { UserPublickey } from '../models/entities/user-publickey'; -import { UserProfile } from '../models/entities/user-profile'; -import { UserSecurityKey } from '../models/entities/user-security-key'; -import { AttestationChallenge } from '../models/entities/attestation-challenge'; -import { Page } from '../models/entities/page'; -import { PageLike } from '../models/entities/page-like'; -import { GalleryPost } from '../models/entities/gallery-post'; -import { GalleryLike } from '../models/entities/gallery-like'; -import { ModerationLog } from '../models/entities/moderation-log'; -import { UsedUsername } from '../models/entities/used-username'; -import { Announcement } from '../models/entities/announcement'; -import { AnnouncementRead } from '../models/entities/announcement-read'; -import { Clip } from '../models/entities/clip'; -import { ClipNote } from '../models/entities/clip-note'; -import { Antenna } from '../models/entities/antenna'; -import { AntennaNote } from '../models/entities/antenna-note'; -import { PromoNote } from '../models/entities/promo-note'; -import { PromoRead } from '../models/entities/promo-read'; -import { program } from '../argv'; -import { Relay } from '../models/entities/relay'; -import { MutedNote } from '../models/entities/muted-note'; -import { Channel } from '../models/entities/channel'; -import { ChannelFollowing } from '../models/entities/channel-following'; -import { ChannelNotePining } from '../models/entities/channel-note-pining'; -import { RegistryItem } from '../models/entities/registry-item'; -import { Ad } from '../models/entities/ad'; -import { PasswordResetRequest } from '@/models/entities/password-reset-request'; +import { Log } from '@/models/entities/log.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 { 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 { NoteUnread } from '@/models/entities/note-unread.js'; +import { Notification } from '@/models/entities/notification.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 { 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 { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { ReversiMatching } from '@/models/entities/games/reversi/matching.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 { AntennaNote } from '@/models/entities/antenna-note.js'; +import { PromoNote } from '@/models/entities/promo-note.js'; +import { PromoRead } from '@/models/entities/promo-read.js'; +import { program } from '../argv.js'; +import { Relay } from '@/models/entities/relay.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'; const sqlLogger = dbLogger.createSubLogger('sql', 'white', false); diff --git a/src/db/redis.ts b/src/db/redis.ts index a10422846..97500e02b 100644 --- a/src/db/redis.ts +++ b/src/db/redis.ts @@ -1,5 +1,5 @@ import * as redis from 'redis'; -import config from '@/config'; +import config from '@/config/index.js'; export function createConnection() { return redis.createClient( diff --git a/src/index.ts b/src/index.ts index c4a1088c2..7c131b261 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ Error.stackTraceLimit = Infinity; require('events').EventEmitter.defaultMaxListeners = 128; -import boot from './boot'; +import boot from './boot/index.js'; export default function() { return boot(); diff --git a/src/mfm/to-html.ts b/src/mfm/to-html.ts index aa39443c6..6ce7d35ef 100644 --- a/src/mfm/to-html.ts +++ b/src/mfm/to-html.ts @@ -1,9 +1,9 @@ import { JSDOM } from 'jsdom'; import * as mfm from 'mfm-js'; -import config from '@/config'; -import { intersperse } from '../prelude/array'; -import { IMentionedRemoteUsers } from '../models/entities/note'; -import { wellKnownServices } from '../well-known-services'; +import config from '@/config/index.js'; +import { intersperse } from '../prelude/array.js'; +import { IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { wellKnownServices } from '../well-known-services.js'; export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) { if (nodes == null) { diff --git a/src/misc/antenna-cache.ts b/src/misc/antenna-cache.ts index 6be1c18db..dcf96c161 100644 --- a/src/misc/antenna-cache.ts +++ b/src/misc/antenna-cache.ts @@ -1,6 +1,6 @@ -import { Antennas } from '../models'; -import { Antenna } from '../models/entities/antenna'; -import { subsdcriber } from '../db/redis'; +import { Antennas } from '@/models/index.js'; +import { Antenna } from '@/models/entities/antenna.js'; +import { subsdcriber } from '../db/redis.js'; let antennasFetched = false; let antennas: Antenna[] = []; diff --git a/src/misc/app-lock.ts b/src/misc/app-lock.ts index 9ae2cba47..52ac68071 100644 --- a/src/misc/app-lock.ts +++ b/src/misc/app-lock.ts @@ -1,5 +1,6 @@ -import { redisClient } from '../db/redis'; +import { redisClient } from '../db/redis.js'; import { promisify } from 'util'; +import * as redisLock from 'redis-lock'; /** * Retry delay (ms) for lock acquisition @@ -8,7 +9,7 @@ const retryDelay = 100; const lock: (key: string, timeout?: number) => Promise<() => void> = redisClient - ? promisify(require('redis-lock')(redisClient, retryDelay)) + ? promisify(redisLock(redisClient, retryDelay)) : async () => () => { }; /** diff --git a/src/misc/captcha.ts b/src/misc/captcha.ts index 727c86af0..4623565c3 100644 --- a/src/misc/captcha.ts +++ b/src/misc/captcha.ts @@ -1,7 +1,7 @@ import fetch from 'node-fetch'; import { URLSearchParams } from 'url'; -import { getAgentByUrl } from './fetch'; -import config from '@/config'; +import { getAgentByUrl } from './fetch.js'; +import config from '@/config/index.js'; export async function verifyRecaptcha(secret: string, response: string) { const result = await getCaptchaResponse('https://www.recaptcha.net/recaptcha/api/siteverify', secret, response).catch(e => { diff --git a/src/misc/check-hit-antenna.ts b/src/misc/check-hit-antenna.ts index 3dfcb54c4..fdba66b64 100644 --- a/src/misc/check-hit-antenna.ts +++ b/src/misc/check-hit-antenna.ts @@ -1,10 +1,10 @@ -import { Antenna } from '../models/entities/antenna'; -import { Note } from '../models/entities/note'; -import { User } from '../models/entities/user'; -import { UserListJoinings, UserGroupJoinings } from '../models'; -import { getFullApAccount } from './convert-host'; -import { PackedNote } from '../models/repositories/note'; -import { parseAcct } from '@/misc/acct'; +import { Antenna } from '@/models/entities/antenna.js'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { UserListJoinings, UserGroupJoinings } from '@/models/index.js'; +import { getFullApAccount } from './convert-host.js'; +import { PackedNote } from '../models/repositories/note.js'; +import { parseAcct } from '@/misc/acct.js'; /** * noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい diff --git a/src/misc/check-word-mute.ts b/src/misc/check-word-mute.ts index 5af267d75..f12e552eb 100644 --- a/src/misc/check-word-mute.ts +++ b/src/misc/check-word-mute.ts @@ -1,6 +1,6 @@ const RE2 = require('re2'); -import { Note } from '../models/entities/note'; -import { User } from '../models/entities/user'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; type NoteLike = { userId: Note['userId']; diff --git a/src/misc/convert-host.ts b/src/misc/convert-host.ts index 7b0b0acf1..2e705cb6b 100644 --- a/src/misc/convert-host.ts +++ b/src/misc/convert-host.ts @@ -1,5 +1,5 @@ import { URL } from 'url'; -import config from '@/config'; +import config from '@/config/index.js'; import { toASCII } from 'punycode/'; export function getFullApAccount(username: string, host: string | null) { diff --git a/src/misc/count-same-renotes.ts b/src/misc/count-same-renotes.ts index bc1072080..b7f8ce90c 100644 --- a/src/misc/count-same-renotes.ts +++ b/src/misc/count-same-renotes.ts @@ -1,4 +1,4 @@ -import { Notes } from '../models'; +import { Notes } from '@/models/index.js'; export async function countSameRenotes(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise { // 指定したユーザーの指定したノートのリノートがいくつあるか数える diff --git a/src/misc/detect-url-mime.ts b/src/misc/detect-url-mime.ts index 274c29173..cd143cf2f 100644 --- a/src/misc/detect-url-mime.ts +++ b/src/misc/detect-url-mime.ts @@ -1,6 +1,6 @@ -import { createTemp } from './create-temp'; -import { downloadUrl } from './download-url'; -import { detectType } from './get-file-info'; +import { createTemp } from './create-temp.js'; +import { downloadUrl } from './download-url.js'; +import { detectType } from './get-file-info.js'; export async function detectUrlMime(url: string) { const [path, cleanup] = await createTemp(); diff --git a/src/misc/download-text-file.ts b/src/misc/download-text-file.ts index d6fd17fc1..745604c19 100644 --- a/src/misc/download-text-file.ts +++ b/src/misc/download-text-file.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as util from 'util'; -import Logger from '../services/logger'; -import { createTemp } from './create-temp'; -import { downloadUrl } from './download-url'; +import Logger from '@/services/logger.js'; +import { createTemp } from './create-temp.js'; +import { downloadUrl } from './download-url.js'; const logger = new Logger('download-text-file'); diff --git a/src/misc/download-url.ts b/src/misc/download-url.ts index dafeff6fc..f01f34e6d 100644 --- a/src/misc/download-url.ts +++ b/src/misc/download-url.ts @@ -3,11 +3,11 @@ import * as stream from 'stream'; import * as util from 'util'; import { URL } from 'url'; import fetch from 'node-fetch'; -import { getAgentByUrl } from './fetch'; +import { getAgentByUrl } from './fetch.js'; import { AbortController } from 'abort-controller'; -import config from '@/config'; +import config from '@/config/index.js'; import * as chalk from 'chalk'; -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; const pipeline = util.promisify(stream.pipeline); diff --git a/src/misc/extract-custom-emojis-from-mfm.ts b/src/misc/extract-custom-emojis-from-mfm.ts index b29ce281b..a0319d8dd 100644 --- a/src/misc/extract-custom-emojis-from-mfm.ts +++ b/src/misc/extract-custom-emojis-from-mfm.ts @@ -1,5 +1,5 @@ import * as mfm from 'mfm-js'; -import { unique } from '@/prelude/array'; +import { unique } from '@/prelude/array.js'; export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { const emojiNodes = mfm.extract(nodes, (node) => { diff --git a/src/misc/extract-hashtags.ts b/src/misc/extract-hashtags.ts index b0a74df21..0b0418eef 100644 --- a/src/misc/extract-hashtags.ts +++ b/src/misc/extract-hashtags.ts @@ -1,5 +1,5 @@ import * as mfm from 'mfm-js'; -import { unique } from '@/prelude/array'; +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/src/misc/fetch-meta.ts b/src/misc/fetch-meta.ts index e7a945dc9..3d7e69f2d 100644 --- a/src/misc/fetch-meta.ts +++ b/src/misc/fetch-meta.ts @@ -1,4 +1,4 @@ -import { Meta } from '../models/entities/meta'; +import { Meta } from '@/models/entities/meta.js'; import { getConnection } from 'typeorm'; let cache: Meta; diff --git a/src/misc/fetch-proxy-account.ts b/src/misc/fetch-proxy-account.ts index 537edf289..ed8a4c794 100644 --- a/src/misc/fetch-proxy-account.ts +++ b/src/misc/fetch-proxy-account.ts @@ -1,6 +1,6 @@ -import { fetchMeta } from './fetch-meta'; -import { ILocalUser } from '../models/entities/user'; -import { Users } from '../models'; +import { fetchMeta } from './fetch-meta.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; export async function fetchProxyAccount(): Promise { const meta = await fetchMeta(); diff --git a/src/misc/fetch.ts b/src/misc/fetch.ts index f7756f925..11e8a6920 100644 --- a/src/misc/fetch.ts +++ b/src/misc/fetch.ts @@ -3,7 +3,7 @@ import * as https from 'https'; import CacheableLookup from 'cacheable-lookup'; import fetch, { HeadersInit } from 'node-fetch'; import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'; -import config from '@/config'; +import config from '@/config/index.js'; import { URL } from 'url'; export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: HeadersInit) { diff --git a/src/misc/gen-avatar.ts b/src/misc/gen-avatar.ts index 7ff28b2e8..f03ca9f96 100644 --- a/src/misc/gen-avatar.ts +++ b/src/misc/gen-avatar.ts @@ -2,7 +2,7 @@ * Random avatar generator */ -const p = require('pureimage'); +import * as p from 'pureimage'; import * as gen from 'random-seed'; import { WriteStream } from 'fs'; diff --git a/src/misc/gen-id.ts b/src/misc/gen-id.ts index 8e7e0b611..fcf476857 100644 --- a/src/misc/gen-id.ts +++ b/src/misc/gen-id.ts @@ -1,9 +1,9 @@ import { ulid } from 'ulid'; -import { genAid } from './id/aid'; -import { genMeid } from './id/meid'; -import { genMeidg } from './id/meidg'; -import { genObjectId } from './id/object-id'; -import config from '@/config'; +import { genAid } from './id/aid.js'; +import { genMeid } from './id/meid.js'; +import { genMeidg } from './id/meidg.js'; +import { genObjectId } from './id/object-id.js'; +import config from '@/config/index.js'; const metohd = config.id.toLowerCase(); diff --git a/src/misc/get-user-name.ts b/src/misc/get-user-name.ts index b6b45118b..805dbba52 100644 --- a/src/misc/get-user-name.ts +++ b/src/misc/get-user-name.ts @@ -1,4 +1,4 @@ -import { User } from '../models/entities/user'; +import { User } from '@/models/entities/user.js'; export default function(user: User): string { return user.name || user.username; diff --git a/src/misc/is-quote.ts b/src/misc/is-quote.ts index 0a2a72f4a..779f548b0 100644 --- a/src/misc/is-quote.ts +++ b/src/misc/is-quote.ts @@ -1,4 +1,4 @@ -import { Note } from '../models/entities/note'; +import { Note } from '@/models/entities/note.js'; export default function(note: Note): boolean { return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0)); diff --git a/src/misc/keypair-store.ts b/src/misc/keypair-store.ts index c78fdd755..3d505c0ab 100644 --- a/src/misc/keypair-store.ts +++ b/src/misc/keypair-store.ts @@ -1,7 +1,7 @@ -import { UserKeypairs } from '../models'; -import { User } from '../models/entities/user'; -import { UserKeypair } from '../models/entities/user-keypair'; -import { Cache } from './cache'; +import { UserKeypairs } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; +import { Cache } from './cache.js'; const cache = new Cache(Infinity); diff --git a/src/misc/license.ts b/src/misc/license.ts index d36af665c..8b12923ca 100644 --- a/src/misc/license.ts +++ b/src/misc/license.ts @@ -1,6 +1,12 @@ import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; -const license = fs.readFileSync(__dirname + '/../../LICENSE', 'utf-8'); +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); + +const license = fs.readFileSync(_dirname + '/../../LICENSE', 'utf-8'); const licenseHtml = license .replace(/\r\n/g, '\n') diff --git a/src/misc/populate-emojis.ts b/src/misc/populate-emojis.ts index 42aaaf070..e1ec87a95 100644 --- a/src/misc/populate-emojis.ts +++ b/src/misc/populate-emojis.ts @@ -1,12 +1,12 @@ import { In } from 'typeorm'; -import { Emojis } from '../models'; -import { Emoji } from '../models/entities/emoji'; -import { Note } from '../models/entities/note'; -import { Cache } from './cache'; -import { isSelfHost, toPunyNullable } from './convert-host'; -import { decodeReaction } from './reaction-lib'; -import config from '@/config'; -import { query } from '@/prelude/url'; +import { Emojis } from '@/models/index.js'; +import { Emoji } from '@/models/entities/emoji.js'; +import { Note } from '@/models/entities/note.js'; +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'; const cache = new Cache(1000 * 60 * 60 * 12); diff --git a/src/misc/reaction-lib.ts b/src/misc/reaction-lib.ts index b393154d9..beff1b32b 100644 --- a/src/misc/reaction-lib.ts +++ b/src/misc/reaction-lib.ts @@ -1,7 +1,7 @@ -import { emojiRegex } from './emoji-regex'; -import { fetchMeta } from './fetch-meta'; -import { Emojis } from '../models'; -import { toPunyNullable } from './convert-host'; +import { emojiRegex } from './emoji-regex.js'; +import { fetchMeta } from './fetch-meta.js'; +import { Emojis } from '@/models/index.js'; +import { toPunyNullable } from './convert-host.js'; const legacies: Record = { 'like': '👍', diff --git a/src/misc/show-machine-info.ts b/src/misc/show-machine-info.ts index 2aae019be..5ce466af2 100644 --- a/src/misc/show-machine-info.ts +++ b/src/misc/show-machine-info.ts @@ -1,6 +1,6 @@ import * as os from 'os'; import * as sysUtils from 'systeminformation'; -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export async function showMachineInfo(parentLogger: Logger) { const logger = parentLogger.createSubLogger('machine'); diff --git a/src/models/entities/abuse-user-report.ts b/src/models/entities/abuse-user-report.ts index c0cff139f..cb1392122 100644 --- a/src/models/entities/abuse-user-report.ts +++ b/src/models/entities/abuse-user-report.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class AbuseUserReport { diff --git a/src/models/entities/access-token.ts b/src/models/entities/access-token.ts index 5f41b3c1f..c2d034af8 100644 --- a/src/models/entities/access-token.ts +++ b/src/models/entities/access-token.ts @@ -1,7 +1,7 @@ import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user'; -import { App } from './app'; -import { id } from '../id'; +import { User } from './user.js'; +import { App } from './app.js'; +import { id } from '../id.js'; @Entity() export class AccessToken { diff --git a/src/models/entities/ad.ts b/src/models/entities/ad.ts index b2fc04c4f..1b0cfa06d 100644 --- a/src/models/entities/ad.ts +++ b/src/models/entities/ad.ts @@ -1,5 +1,5 @@ import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Ad { diff --git a/src/models/entities/announcement-read.ts b/src/models/entities/announcement-read.ts index 892beb826..56ee2e690 100644 --- a/src/models/entities/announcement-read.ts +++ b/src/models/entities/announcement-read.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Announcement } from './announcement'; -import { id } from '../id'; +import { User } from './user.js'; +import { Announcement } from './announcement.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'announcementId'], { unique: true }) diff --git a/src/models/entities/announcement.ts b/src/models/entities/announcement.ts index 06d379c22..1569ca89c 100644 --- a/src/models/entities/announcement.ts +++ b/src/models/entities/announcement.ts @@ -1,5 +1,5 @@ import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Announcement { diff --git a/src/models/entities/antenna-note.ts b/src/models/entities/antenna-note.ts index 9b911524e..ecf297391 100644 --- a/src/models/entities/antenna-note.ts +++ b/src/models/entities/antenna-note.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { Note } from './note'; -import { Antenna } from './antenna'; -import { id } from '../id'; +import { Note } from './note.js'; +import { Antenna } from './antenna.js'; +import { id } from '../id.js'; @Entity() @Index(['noteId', 'antennaId'], { unique: true }) diff --git a/src/models/entities/antenna.ts b/src/models/entities/antenna.ts index bcfe09a82..5dc814e1d 100644 --- a/src/models/entities/antenna.ts +++ b/src/models/entities/antenna.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { UserList } from './user-list'; -import { UserGroupJoining } from './user-group-joining'; +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/src/models/entities/app.ts b/src/models/entities/app.ts index ea8754631..c3a6a0a10 100644 --- a/src/models/entities/app.ts +++ b/src/models/entities/app.ts @@ -1,6 +1,6 @@ import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class App { diff --git a/src/models/entities/attestation-challenge.ts b/src/models/entities/attestation-challenge.ts index 942747c02..26a212e0c 100644 --- a/src/models/entities/attestation-challenge.ts +++ b/src/models/entities/attestation-challenge.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class AttestationChallenge { diff --git a/src/models/entities/auth-session.ts b/src/models/entities/auth-session.ts index 4eec27e3f..f0480abcc 100644 --- a/src/models/entities/auth-session.ts +++ b/src/models/entities/auth-session.ts @@ -1,7 +1,7 @@ import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user'; -import { App } from './app'; -import { id } from '../id'; +import { User } from './user.js'; +import { App } from './app.js'; +import { id } from '../id.js'; @Entity() export class AuthSession { diff --git a/src/models/entities/blocking.ts b/src/models/entities/blocking.ts index 48487cb08..2fff80cfc 100644 --- a/src/models/entities/blocking.ts +++ b/src/models/entities/blocking.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['blockerId', 'blockeeId'], { unique: true }) diff --git a/src/models/entities/channel-following.ts b/src/models/entities/channel-following.ts index fca801e5a..6e5c9cba0 100644 --- a/src/models/entities/channel-following.ts +++ b/src/models/entities/channel-following.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Channel } from './channel'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Channel } from './channel.js'; @Entity() @Index(['followerId', 'followeeId'], { unique: true }) diff --git a/src/models/entities/channel-note-pining.ts b/src/models/entities/channel-note-pining.ts index 26a7eb501..751af4a18 100644 --- a/src/models/entities/channel-note-pining.ts +++ b/src/models/entities/channel-note-pining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { Channel } from './channel'; -import { id } from '../id'; +import { Note } from './note.js'; +import { Channel } from './channel.js'; +import { id } from '../id.js'; @Entity() @Index(['channelId', 'noteId'], { unique: true }) diff --git a/src/models/entities/channel.ts b/src/models/entities/channel.ts index f2d713612..adf937c0b 100644 --- a/src/models/entities/channel.ts +++ b/src/models/entities/channel.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { DriveFile } from './drive-file'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { DriveFile } from './drive-file.js'; @Entity() export class Channel { diff --git a/src/models/entities/clip-note.ts b/src/models/entities/clip-note.ts index 7d96b2ef7..41d92b0c7 100644 --- a/src/models/entities/clip-note.ts +++ b/src/models/entities/clip-note.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { Note } from './note'; -import { Clip } from './clip'; -import { id } from '../id'; +import { Note } from './note.js'; +import { Clip } from './clip.js'; +import { id } from '../id.js'; @Entity() @Index(['noteId', 'clipId'], { unique: true }) diff --git a/src/models/entities/clip.ts b/src/models/entities/clip.ts index 66b5b8847..1cdf4c52e 100644 --- a/src/models/entities/clip.ts +++ b/src/models/entities/clip.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class Clip { diff --git a/src/models/entities/drive-file.ts b/src/models/entities/drive-file.ts index 698dfac22..41d68a133 100644 --- a/src/models/entities/drive-file.ts +++ b/src/models/entities/drive-file.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { DriveFolder } from './drive-folder'; -import { id } from '../id'; +import { User } from './user.js'; +import { DriveFolder } from './drive-folder.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'folderId', 'id']) diff --git a/src/models/entities/drive-folder.ts b/src/models/entities/drive-folder.ts index a80d07585..f137dd5c6 100644 --- a/src/models/entities/drive-folder.ts +++ b/src/models/entities/drive-folder.ts @@ -1,6 +1,6 @@ import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class DriveFolder { diff --git a/src/models/entities/emoji.ts b/src/models/entities/emoji.ts index d6080ae09..3da4c6b41 100644 --- a/src/models/entities/emoji.ts +++ b/src/models/entities/emoji.ts @@ -1,5 +1,5 @@ import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() @Index(['name', 'host'], { unique: true }) diff --git a/src/models/entities/follow-request.ts b/src/models/entities/follow-request.ts index 22ec26396..e661c9933 100644 --- a/src/models/entities/follow-request.ts +++ b/src/models/entities/follow-request.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['followerId', 'followeeId'], { unique: true }) diff --git a/src/models/entities/following.ts b/src/models/entities/following.ts index ee3286a1a..5f9b548da 100644 --- a/src/models/entities/following.ts +++ b/src/models/entities/following.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['followerId', 'followeeId'], { unique: true }) diff --git a/src/models/entities/gallery-like.ts b/src/models/entities/gallery-like.ts index 7d084a227..f1610b8aa 100644 --- a/src/models/entities/gallery-like.ts +++ b/src/models/entities/gallery-like.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { GalleryPost } from './gallery-post'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { GalleryPost } from './gallery-post.js'; @Entity() @Index(['userId', 'postId'], { unique: true }) diff --git a/src/models/entities/gallery-post.ts b/src/models/entities/gallery-post.ts index f59cd671f..cc4ed640a 100644 --- a/src/models/entities/gallery-post.ts +++ b/src/models/entities/gallery-post.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { DriveFile } from './drive-file'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { DriveFile } from './drive-file.js'; @Entity() export class GalleryPost { diff --git a/src/models/entities/games/reversi/game.ts b/src/models/entities/games/reversi/game.ts index 9deacaf5c..b63c72e9f 100644 --- a/src/models/entities/games/reversi/game.ts +++ b/src/models/entities/games/reversi/game.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from '../../user'; -import { id } from '../../../id'; +import { User } from '../../user.js'; +import { id } from '../../../id.js'; @Entity() export class ReversiGame { diff --git a/src/models/entities/games/reversi/matching.ts b/src/models/entities/games/reversi/matching.ts index 477a29316..690a080b2 100644 --- a/src/models/entities/games/reversi/matching.ts +++ b/src/models/entities/games/reversi/matching.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from '../../user'; -import { id } from '../../../id'; +import { User } from '../../user.js'; +import { id } from '../../../id.js'; @Entity() export class ReversiMatching { diff --git a/src/models/entities/hashtag.ts b/src/models/entities/hashtag.ts index 842cdaa56..b99ac80b5 100644 --- a/src/models/entities/hashtag.ts +++ b/src/models/entities/hashtag.ts @@ -1,6 +1,6 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class Hashtag { diff --git a/src/models/entities/instance.ts b/src/models/entities/instance.ts index 7c8719e06..f4637096f 100644 --- a/src/models/entities/instance.ts +++ b/src/models/entities/instance.ts @@ -1,5 +1,5 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Instance { diff --git a/src/models/entities/log.ts b/src/models/entities/log.ts index 182a9fbed..17c5cba7d 100644 --- a/src/models/entities/log.ts +++ b/src/models/entities/log.ts @@ -1,5 +1,5 @@ import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Log { diff --git a/src/models/entities/messaging-message.ts b/src/models/entities/messaging-message.ts index ac0764674..04a1637f4 100644 --- a/src/models/entities/messaging-message.ts +++ b/src/models/entities/messaging-message.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { DriveFile } from './drive-file'; -import { id } from '../id'; -import { UserGroup } from './user-group'; +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/src/models/entities/meta.ts b/src/models/entities/meta.ts index 2a0632c87..a03891622 100644 --- a/src/models/entities/meta.ts +++ b/src/models/entities/meta.ts @@ -1,7 +1,7 @@ import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Clip } from './clip'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Clip } from './clip.js'; @Entity() export class Meta { diff --git a/src/models/entities/moderation-log.ts b/src/models/entities/moderation-log.ts index 33d3d683a..d96b63f52 100644 --- a/src/models/entities/moderation-log.ts +++ b/src/models/entities/moderation-log.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class ModerationLog { diff --git a/src/models/entities/muted-note.ts b/src/models/entities/muted-note.ts index 521876688..07763b2db 100644 --- a/src/models/entities/muted-note.ts +++ b/src/models/entities/muted-note.ts @@ -1,8 +1,8 @@ import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; -import { mutedNoteReasons } from '../../types'; +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/src/models/entities/muting.ts b/src/models/entities/muting.ts index 0084213bc..9c9134949 100644 --- a/src/models/entities/muting.ts +++ b/src/models/entities/muting.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['muterId', 'muteeId'], { unique: true }) diff --git a/src/models/entities/note-favorite.ts b/src/models/entities/note-favorite.ts index 0713c3ae5..54792d225 100644 --- a/src/models/entities/note-favorite.ts +++ b/src/models/entities/note-favorite.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note-reaction.ts b/src/models/entities/note-reaction.ts index 674dc3639..5bca5c3d3 100644 --- a/src/models/entities/note-reaction.ts +++ b/src/models/entities/note-reaction.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note-unread.ts b/src/models/entities/note-unread.ts index 57dda4faf..5a88c7f7d 100644 --- a/src/models/entities/note-unread.ts +++ b/src/models/entities/note-unread.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; -import { Channel } from './channel'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; +import { Channel } from './channel.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note-watching.ts b/src/models/entities/note-watching.ts index 741a1c0c8..458fac3a4 100644 --- a/src/models/entities/note-watching.ts +++ b/src/models/entities/note-watching.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; +import { User } from './user.js'; +import { Note } from './note.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts index 9a8553263..74d69de13 100644 --- a/src/models/entities/note.ts +++ b/src/models/entities/note.ts @@ -1,9 +1,9 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { DriveFile } from './drive-file'; -import { id } from '../id'; -import { noteVisibilities } from '../../types'; -import { Channel } from './channel'; +import { User } from './user.js'; +import { 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/src/models/entities/notification.ts b/src/models/entities/notification.ts index 988fdb341..1114910a8 100644 --- a/src/models/entities/notification.ts +++ b/src/models/entities/notification.ts @@ -1,11 +1,11 @@ import { Entity, Index, JoinColumn, ManyToOne, Column, PrimaryColumn } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Note } from './note'; -import { FollowRequest } from './follow-request'; -import { UserGroupInvitation } from './user-group-invitation'; -import { AccessToken } from './access-token'; -import { notificationTypes } from '../../types'; +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/src/models/entities/page-like.ts b/src/models/entities/page-like.ts index ca84ece8f..49f3f0ef5 100644 --- a/src/models/entities/page-like.ts +++ b/src/models/entities/page-like.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { Page } from './page'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { Page } from './page.js'; @Entity() @Index(['userId', 'pageId'], { unique: true }) diff --git a/src/models/entities/page.ts b/src/models/entities/page.ts index ed0411a3d..7bc35aa69 100644 --- a/src/models/entities/page.ts +++ b/src/models/entities/page.ts @@ -1,7 +1,7 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; -import { DriveFile } from './drive-file'; +import { User } from './user.js'; +import { id } from '../id.js'; +import { DriveFile } from './drive-file.js'; @Entity() @Index(['userId', 'name'], { unique: true }) diff --git a/src/models/entities/password-reset-request.ts b/src/models/entities/password-reset-request.ts index 6d41d38a9..95ba14db1 100644 --- a/src/models/entities/password-reset-request.ts +++ b/src/models/entities/password-reset-request.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id'; -import { User } from './user'; +import { id } from '../id.js'; +import { User } from './user.js'; @Entity() export class PasswordResetRequest { diff --git a/src/models/entities/poll-vote.ts b/src/models/entities/poll-vote.ts index 709376f90..f8b5ad7d8 100644 --- a/src/models/entities/poll-vote.ts +++ b/src/models/entities/poll-vote.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { Note } from './note'; -import { id } from '../id'; +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/src/models/entities/poll.ts b/src/models/entities/poll.ts index e3bbb1c3f..a201b1198 100644 --- a/src/models/entities/poll.ts +++ b/src/models/entities/poll.ts @@ -1,8 +1,8 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { id } from '../id'; -import { Note } from './note'; -import { User } from './user'; -import { noteVisibilities } from '../../types'; +import { id } from '../id.js'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { noteVisibilities } from '../../types.js'; @Entity() export class Poll { diff --git a/src/models/entities/promo-note.ts b/src/models/entities/promo-note.ts index 474f1cb23..d21b2adac 100644 --- a/src/models/entities/promo-note.ts +++ b/src/models/entities/promo-note.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class PromoNote { diff --git a/src/models/entities/promo-read.ts b/src/models/entities/promo-read.ts index 2e0977b6b..d949061b9 100644 --- a/src/models/entities/promo-read.ts +++ b/src/models/entities/promo-read.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/registration-tickets.ts b/src/models/entities/registration-tickets.ts index d962f78a7..139e40f85 100644 --- a/src/models/entities/registration-tickets.ts +++ b/src/models/entities/registration-tickets.ts @@ -1,5 +1,5 @@ import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class RegistrationTicket { diff --git a/src/models/entities/registry-item.ts b/src/models/entities/registry-item.ts index 54d2ef208..f1904e612 100644 --- a/src/models/entities/registry-item.ts +++ b/src/models/entities/registry-item.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; // TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい @Entity() diff --git a/src/models/entities/relay.ts b/src/models/entities/relay.ts index 4c82ccb12..94d192957 100644 --- a/src/models/entities/relay.ts +++ b/src/models/entities/relay.ts @@ -1,5 +1,5 @@ import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id'; +import { id } from '../id.js'; @Entity() export class Relay { diff --git a/src/models/entities/signin.ts b/src/models/entities/signin.ts index 7e047084b..1db5c48ca 100644 --- a/src/models/entities/signin.ts +++ b/src/models/entities/signin.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class Signin { diff --git a/src/models/entities/sw-subscription.ts b/src/models/entities/sw-subscription.ts index 7c3f6f0a6..254dd70b4 100644 --- a/src/models/entities/sw-subscription.ts +++ b/src/models/entities/sw-subscription.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class SwSubscription { diff --git a/src/models/entities/user-group-invitation.ts b/src/models/entities/user-group-invitation.ts index 6fe8f2013..9e71c78e1 100644 --- a/src/models/entities/user-group-invitation.ts +++ b/src/models/entities/user-group-invitation.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { UserGroup } from './user-group'; -import { id } from '../id'; +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/src/models/entities/user-group-joining.ts b/src/models/entities/user-group-joining.ts index e09c3230f..fbed44c79 100644 --- a/src/models/entities/user-group-joining.ts +++ b/src/models/entities/user-group-joining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { UserGroup } from './user-group'; -import { id } from '../id'; +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/src/models/entities/user-group.ts b/src/models/entities/user-group.ts index f4bac0322..ae4cd5485 100644 --- a/src/models/entities/user-group.ts +++ b/src/models/entities/user-group.ts @@ -1,6 +1,6 @@ import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserGroup { diff --git a/src/models/entities/user-keypair.ts b/src/models/entities/user-keypair.ts index 603321d75..026f823f7 100644 --- a/src/models/entities/user-keypair.ts +++ b/src/models/entities/user-keypair.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserKeypair { diff --git a/src/models/entities/user-list-joining.ts b/src/models/entities/user-list-joining.ts index bb7dc40b9..91cff3cd5 100644 --- a/src/models/entities/user-list-joining.ts +++ b/src/models/entities/user-list-joining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { UserList } from './user-list'; -import { id } from '../id'; +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/src/models/entities/user-list.ts b/src/models/entities/user-list.ts index 35a83ef8c..51031e3c1 100644 --- a/src/models/entities/user-list.ts +++ b/src/models/entities/user-list.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserList { diff --git a/src/models/entities/user-note-pining.ts b/src/models/entities/user-note-pining.ts index 04a6f8f64..0495c4b2f 100644 --- a/src/models/entities/user-note-pining.ts +++ b/src/models/entities/user-note-pining.ts @@ -1,7 +1,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { Note } from './note'; -import { User } from './user'; -import { id } from '../id'; +import { Note } from './note.js'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() @Index(['userId', 'noteId'], { unique: true }) diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 3a9043fac..fd0552279 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -1,8 +1,8 @@ import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; -import { id } from '../id'; -import { User } from './user'; -import { Page } from './page'; -import { notificationTypes } from '../../types'; +import { id } from '../id.js'; +import { User } from './user.js'; +import { Page } from './page.js'; +import { notificationTypes } from '../../types.js'; // TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも // ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン diff --git a/src/models/entities/user-publickey.ts b/src/models/entities/user-publickey.ts index 21edc3e9e..adfff74f8 100644 --- a/src/models/entities/user-publickey.ts +++ b/src/models/entities/user-publickey.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserPublickey { diff --git a/src/models/entities/user-security-key.ts b/src/models/entities/user-security-key.ts index d54c728e5..ec8ac81c4 100644 --- a/src/models/entities/user-security-key.ts +++ b/src/models/entities/user-security-key.ts @@ -1,6 +1,6 @@ import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; -import { User } from './user'; -import { id } from '../id'; +import { User } from './user.js'; +import { id } from '../id.js'; @Entity() export class UserSecurityKey { diff --git a/src/models/entities/user.ts b/src/models/entities/user.ts index 060ec06b9..36c506820 100644 --- a/src/models/entities/user.ts +++ b/src/models/entities/user.ts @@ -1,6 +1,6 @@ import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; -import { DriveFile } from './drive-file'; -import { id } from '../id'; +import { DriveFile } from './drive-file.js'; +import { id } from '../id.js'; @Entity() @Index(['usernameLower', 'host'], { unique: true }) diff --git a/src/models/index.ts b/src/models/index.ts index 9f8bd104e..51ee88bb7 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -1,67 +1,67 @@ import { getRepository, getCustomRepository } from 'typeorm'; -import { Announcement } from './entities/announcement'; -import { AnnouncementRead } from './entities/announcement-read'; -import { Instance } from './entities/instance'; -import { Poll } from './entities/poll'; -import { PollVote } from './entities/poll-vote'; -import { Meta } from './entities/meta'; -import { SwSubscription } from './entities/sw-subscription'; -import { NoteWatching } from './entities/note-watching'; -import { NoteUnread } from './entities/note-unread'; -import { RegistrationTicket } from './entities/registration-tickets'; -import { UserRepository } from './repositories/user'; -import { NoteRepository } from './repositories/note'; -import { DriveFileRepository } from './repositories/drive-file'; -import { DriveFolderRepository } from './repositories/drive-folder'; -import { Log } from './entities/log'; -import { AccessToken } from './entities/access-token'; -import { UserNotePining } from './entities/user-note-pining'; -import { SigninRepository } from './repositories/signin'; -import { MessagingMessageRepository } from './repositories/messaging-message'; -import { ReversiGameRepository } from './repositories/games/reversi/game'; -import { UserListRepository } from './repositories/user-list'; -import { UserListJoining } from './entities/user-list-joining'; -import { UserGroupRepository } from './repositories/user-group'; -import { UserGroupJoining } from './entities/user-group-joining'; -import { UserGroupInvitationRepository } from './repositories/user-group-invitation'; -import { FollowRequestRepository } from './repositories/follow-request'; -import { MutingRepository } from './repositories/muting'; -import { BlockingRepository } from './repositories/blocking'; -import { NoteReactionRepository } from './repositories/note-reaction'; -import { NotificationRepository } from './repositories/notification'; -import { NoteFavoriteRepository } from './repositories/note-favorite'; -import { ReversiMatchingRepository } from './repositories/games/reversi/matching'; -import { UserPublickey } from './entities/user-publickey'; -import { UserKeypair } from './entities/user-keypair'; -import { AppRepository } from './repositories/app'; -import { FollowingRepository } from './repositories/following'; -import { AbuseUserReportRepository } from './repositories/abuse-user-report'; -import { AuthSessionRepository } from './repositories/auth-session'; -import { UserProfile } from './entities/user-profile'; -import { AttestationChallenge } from './entities/attestation-challenge'; -import { UserSecurityKey } from './entities/user-security-key'; -import { HashtagRepository } from './repositories/hashtag'; -import { PageRepository } from './repositories/page'; -import { PageLikeRepository } from './repositories/page-like'; -import { GalleryPostRepository } from './repositories/gallery-post'; -import { GalleryLikeRepository } from './repositories/gallery-like'; -import { ModerationLogRepository } from './repositories/moderation-logs'; -import { UsedUsername } from './entities/used-username'; -import { ClipRepository } from './repositories/clip'; -import { ClipNote } from './entities/clip-note'; -import { AntennaRepository } from './repositories/antenna'; -import { AntennaNote } from './entities/antenna-note'; -import { PromoNote } from './entities/promo-note'; -import { PromoRead } from './entities/promo-read'; -import { EmojiRepository } from './repositories/emoji'; -import { RelayRepository } from './repositories/relay'; -import { ChannelRepository } from './repositories/channel'; -import { MutedNote } from './entities/muted-note'; -import { ChannelFollowing } from './entities/channel-following'; -import { ChannelNotePining } from './entities/channel-note-pining'; -import { RegistryItem } from './entities/registry-item'; -import { Ad } from './entities/ad'; -import { PasswordResetRequest } from './entities/password-reset-request'; +import { Announcement } from './entities/announcement.js'; +import { AnnouncementRead } from './entities/announcement-read.js'; +import { Instance } from './entities/instance.js'; +import { Poll } from './entities/poll.js'; +import { PollVote } from './entities/poll-vote.js'; +import { Meta } from './entities/meta.js'; +import { SwSubscription } from './entities/sw-subscription.js'; +import { NoteWatching } from './entities/note-watching.js'; +import { NoteUnread } from './entities/note-unread.js'; +import { RegistrationTicket } from './entities/registration-tickets.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 { Log } from './entities/log.js'; +import { AccessToken } from './entities/access-token.js'; +import { UserNotePining } from './entities/user-note-pining.js'; +import { SigninRepository } from './repositories/signin.js'; +import { MessagingMessageRepository } from './repositories/messaging-message.js'; +import { ReversiGameRepository } from './repositories/games/reversi/game.js'; +import { UserListRepository } from './repositories/user-list.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 { 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 { ReversiMatchingRepository } from './repositories/games/reversi/matching.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 { AntennaNote } from './entities/antenna-note.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'; export const Announcements = getRepository(Announcement); export const AnnouncementReads = getRepository(AnnouncementRead); diff --git a/src/models/repositories/abuse-user-report.ts b/src/models/repositories/abuse-user-report.ts index cb33d2506..16a121576 100644 --- a/src/models/repositories/abuse-user-report.ts +++ b/src/models/repositories/abuse-user-report.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { AbuseUserReport } from '../entities/abuse-user-report'; -import { awaitAll } from '../../prelude/await-all'; +import { Users } from '../index.js'; +import { AbuseUserReport } from '../entities/abuse-user-report.js'; +import { awaitAll } from '../../prelude/await-all.js'; @EntityRepository(AbuseUserReport) export class AbuseUserReportRepository extends Repository { diff --git a/src/models/repositories/antenna.ts b/src/models/repositories/antenna.ts index 787e5c8e2..5117bcb03 100644 --- a/src/models/repositories/antenna.ts +++ b/src/models/repositories/antenna.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Antenna } from '../entities/antenna'; -import { SchemaType } from '@/misc/schema'; -import { AntennaNotes, UserGroupJoinings } from '..'; +import { Antenna } from '../entities/antenna.js'; +import { SchemaType } from '@/misc/schema.js'; +import { AntennaNotes, UserGroupJoinings } from '../index.js'; export type PackedAntenna = SchemaType; diff --git a/src/models/repositories/app.ts b/src/models/repositories/app.ts index c919a9bdb..3c96909dd 100644 --- a/src/models/repositories/app.ts +++ b/src/models/repositories/app.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { App } from '../entities/app'; -import { AccessTokens } from '..'; -import { SchemaType } from '@/misc/schema'; +import { App } from '../entities/app.js'; +import { AccessTokens } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedApp = SchemaType; diff --git a/src/models/repositories/auth-session.ts b/src/models/repositories/auth-session.ts index f513357e1..0eac1348c 100644 --- a/src/models/repositories/auth-session.ts +++ b/src/models/repositories/auth-session.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Apps } from '..'; -import { AuthSession } from '../entities/auth-session'; -import { awaitAll } from '../../prelude/await-all'; -import { User } from '../entities/user'; +import { Apps } from '../index.js'; +import { AuthSession } from '../entities/auth-session.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { User } from '../entities/user.js'; @EntityRepository(AuthSession) export class AuthSessionRepository extends Repository { diff --git a/src/models/repositories/blocking.ts b/src/models/repositories/blocking.ts index 9a4f3f6c6..41b9ed5ab 100644 --- a/src/models/repositories/blocking.ts +++ b/src/models/repositories/blocking.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { Blocking } from '../entities/blocking'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { Users } from '../index.js'; +import { Blocking } from '../entities/blocking.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; export type PackedBlocking = SchemaType; diff --git a/src/models/repositories/channel.ts b/src/models/repositories/channel.ts index 007b11001..c889fc164 100644 --- a/src/models/repositories/channel.ts +++ b/src/models/repositories/channel.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Channel } from '../entities/channel'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles, ChannelFollowings, NoteUnreads } from '..'; -import { User } from '../entities/user'; +import { Channel } from '../entities/channel.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles, ChannelFollowings, NoteUnreads } from '../index.js'; +import { User } from '../entities/user.js'; export type PackedChannel = SchemaType; diff --git a/src/models/repositories/clip.ts b/src/models/repositories/clip.ts index 293807b12..3fae8a7ae 100644 --- a/src/models/repositories/clip.ts +++ b/src/models/repositories/clip.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Clip } from '../entities/clip'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '..'; -import { awaitAll } from '../../prelude/await-all'; +import { Clip } from '../entities/clip.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '../index.js'; +import { awaitAll } from '../../prelude/await-all.js'; export type PackedClip = SchemaType; diff --git a/src/models/repositories/drive-file.ts b/src/models/repositories/drive-file.ts index 675faca8e..3edd9dd66 100644 --- a/src/models/repositories/drive-file.ts +++ b/src/models/repositories/drive-file.ts @@ -1,14 +1,14 @@ import { EntityRepository, Repository } from 'typeorm'; -import { DriveFile } from '../entities/drive-file'; -import { Users, DriveFolders } from '..'; -import { User } from '../entities/user'; -import { toPuny } from '@/misc/convert-host'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import config from '@/config'; -import { query, appendQuery } from '../../prelude/url'; -import { Meta } from '../entities/meta'; -import { fetchMeta } from '@/misc/fetch-meta'; +import { DriveFile } from '../entities/drive-file.js'; +import { Users, DriveFolders } from '../index.js'; +import { User } from '../entities/user.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import config from '@/config/index.js'; +import { query, appendQuery } from '../../prelude/url.js'; +import { Meta } from '../entities/meta.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export type PackedDriveFile = SchemaType; diff --git a/src/models/repositories/drive-folder.ts b/src/models/repositories/drive-folder.ts index d1922c96f..e78c50149 100644 --- a/src/models/repositories/drive-folder.ts +++ b/src/models/repositories/drive-folder.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { DriveFolders, DriveFiles } from '..'; -import { DriveFolder } from '../entities/drive-folder'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; +import { DriveFolders, DriveFiles } from '../index.js'; +import { DriveFolder } from '../entities/drive-folder.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedDriveFolder = SchemaType; diff --git a/src/models/repositories/emoji.ts b/src/models/repositories/emoji.ts index 3490a6ac8..ecef68325 100644 --- a/src/models/repositories/emoji.ts +++ b/src/models/repositories/emoji.ts @@ -1,5 +1,5 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Emoji } from '../entities/emoji'; +import { Emoji } from '../entities/emoji.js'; @EntityRepository(Emoji) export class EmojiRepository extends Repository { diff --git a/src/models/repositories/federation-instance.ts b/src/models/repositories/federation-instance.ts index 15e8023ee..ad14cfc96 100644 --- a/src/models/repositories/federation-instance.ts +++ b/src/models/repositories/federation-instance.ts @@ -1,4 +1,4 @@ -import config from '@/config'; +import config from '@/config/index.js'; export const packedFederationInstanceSchema = { type: 'object' as const, diff --git a/src/models/repositories/follow-request.ts b/src/models/repositories/follow-request.ts index 31e5fb2d9..6fe86972e 100644 --- a/src/models/repositories/follow-request.ts +++ b/src/models/repositories/follow-request.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { FollowRequest } from '../entities/follow-request'; -import { Users } from '..'; -import { User } from '../entities/user'; +import { FollowRequest } from '../entities/follow-request.js'; +import { Users } from '../index.js'; +import { User } from '../entities/user.js'; @EntityRepository(FollowRequest) export class FollowRequestRepository extends Repository { diff --git a/src/models/repositories/following.ts b/src/models/repositories/following.ts index 3aed83f32..0cc3626c2 100644 --- a/src/models/repositories/following.ts +++ b/src/models/repositories/following.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { Following } from '../entities/following'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { Users } from '../index.js'; +import { Following } from '../entities/following.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; type LocalFollowerFollowing = Following & { followerHost: null; diff --git a/src/models/repositories/gallery-like.ts b/src/models/repositories/gallery-like.ts index e01c17cff..550405d65 100644 --- a/src/models/repositories/gallery-like.ts +++ b/src/models/repositories/gallery-like.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; -import { GalleryLike } from '../entities/gallery-like'; -import { GalleryPosts } from '..'; +import { GalleryLike } from '../entities/gallery-like.js'; +import { GalleryPosts } from '../index.js'; @EntityRepository(GalleryLike) export class GalleryLikeRepository extends Repository { diff --git a/src/models/repositories/gallery-post.ts b/src/models/repositories/gallery-post.ts index f1d6fe632..b2c989481 100644 --- a/src/models/repositories/gallery-post.ts +++ b/src/models/repositories/gallery-post.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { GalleryPost } from '../entities/gallery-post'; -import { SchemaType } from '../../misc/schema'; -import { Users, DriveFiles, GalleryLikes } from '..'; -import { awaitAll } from '../../prelude/await-all'; -import { User } from '../entities/user'; +import { GalleryPost } from '../entities/gallery-post.js'; +import { SchemaType } from '../../misc/schema.js'; +import { Users, DriveFiles, GalleryLikes } from '../index.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { User } from '../entities/user.js'; export type PackedGalleryPost = SchemaType; diff --git a/src/models/repositories/games/reversi/game.ts b/src/models/repositories/games/reversi/game.ts index 344cf7b20..0a1d67f96 100644 --- a/src/models/repositories/games/reversi/game.ts +++ b/src/models/repositories/games/reversi/game.ts @@ -1,7 +1,7 @@ -import { User } from '@/models/entities/user'; +import { User } from '@/models/entities/user.js'; import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '../../..'; -import { ReversiGame } from '../../../entities/games/reversi/game'; +import { Users } from '../../../index.js'; +import { ReversiGame } from '../../../entities/games/reversi/game.js'; @EntityRepository(ReversiGame) export class ReversiGameRepository extends Repository { diff --git a/src/models/repositories/games/reversi/matching.ts b/src/models/repositories/games/reversi/matching.ts index 013021eb9..942194410 100644 --- a/src/models/repositories/games/reversi/matching.ts +++ b/src/models/repositories/games/reversi/matching.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { ReversiMatching } from '../../../entities/games/reversi/matching'; -import { Users } from '../../..'; -import { awaitAll } from '../../../../prelude/await-all'; -import { User } from '@/models/entities/user'; +import { ReversiMatching } from '../../../entities/games/reversi/matching.js'; +import { Users } from '../../../index.js'; +import { awaitAll } from '../../../../prelude/await-all.js'; +import { User } from '@/models/entities/user.js'; @EntityRepository(ReversiMatching) export class ReversiMatchingRepository extends Repository { diff --git a/src/models/repositories/hashtag.ts b/src/models/repositories/hashtag.ts index 3fee2f771..f16e2dcd8 100644 --- a/src/models/repositories/hashtag.ts +++ b/src/models/repositories/hashtag.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Hashtag } from '../entities/hashtag'; -import { SchemaType } from '@/misc/schema'; +import { Hashtag } from '../entities/hashtag.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedHashtag = SchemaType; diff --git a/src/models/repositories/messaging-message.ts b/src/models/repositories/messaging-message.ts index c77b14ca7..1413105c5 100644 --- a/src/models/repositories/messaging-message.ts +++ b/src/models/repositories/messaging-message.ts @@ -1,8 +1,8 @@ import { EntityRepository, Repository } from 'typeorm'; -import { MessagingMessage } from '../entities/messaging-message'; -import { Users, DriveFiles, UserGroups } from '..'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { MessagingMessage } from '../entities/messaging-message.js'; +import { Users, DriveFiles, UserGroups } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; export type PackedMessagingMessage = SchemaType; diff --git a/src/models/repositories/moderation-logs.ts b/src/models/repositories/moderation-logs.ts index 3d4c07570..ea074a453 100644 --- a/src/models/repositories/moderation-logs.ts +++ b/src/models/repositories/moderation-logs.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { ModerationLog } from '../entities/moderation-log'; -import { awaitAll } from '../../prelude/await-all'; +import { Users } from '../index.js'; +import { ModerationLog } from '../entities/moderation-log.js'; +import { awaitAll } from '../../prelude/await-all.js'; @EntityRepository(ModerationLog) export class ModerationLogRepository extends Repository { diff --git a/src/models/repositories/muting.ts b/src/models/repositories/muting.ts index 32e681bf0..78dfa2921 100644 --- a/src/models/repositories/muting.ts +++ b/src/models/repositories/muting.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Users } from '..'; -import { Muting } from '../entities/muting'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { User } from '../entities/user'; +import { Users } from '../index.js'; +import { Muting } from '../entities/muting.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { User } from '../entities/user.js'; export type PackedMuting = SchemaType; diff --git a/src/models/repositories/note-favorite.ts b/src/models/repositories/note-favorite.ts index e58b258fc..a192bbbc0 100644 --- a/src/models/repositories/note-favorite.ts +++ b/src/models/repositories/note-favorite.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { NoteFavorite } from '../entities/note-favorite'; -import { Notes } from '..'; -import { User } from '../entities/user'; +import { NoteFavorite } from '../entities/note-favorite.js'; +import { Notes } from '../index.js'; +import { User } from '../entities/user.js'; @EntityRepository(NoteFavorite) export class NoteFavoriteRepository extends Repository { diff --git a/src/models/repositories/note-reaction.ts b/src/models/repositories/note-reaction.ts index 5de9e1be6..6c72008d2 100644 --- a/src/models/repositories/note-reaction.ts +++ b/src/models/repositories/note-reaction.ts @@ -1,9 +1,9 @@ import { EntityRepository, Repository } from 'typeorm'; -import { NoteReaction } from '../entities/note-reaction'; -import { Users } from '..'; -import { SchemaType } from '@/misc/schema'; -import { convertLegacyReaction } from '@/misc/reaction-lib'; -import { User } from '../entities/user'; +import { NoteReaction } from '../entities/note-reaction.js'; +import { Users } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { convertLegacyReaction } from '@/misc/reaction-lib.js'; +import { User } from '../entities/user.js'; export type PackedNoteReaction = SchemaType; diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts index df0ca8c6a..60a5e1ab3 100644 --- a/src/models/repositories/note.ts +++ b/src/models/repositories/note.ts @@ -1,14 +1,14 @@ import { EntityRepository, Repository, In } from 'typeorm'; import * as mfm from 'mfm-js'; -import { Note } from '../entities/note'; -import { User } from '../entities/user'; -import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '..'; -import { SchemaType } from '@/misc/schema'; -import { nyaize } from '@/misc/nyaize'; -import { awaitAll } from '../../prelude/await-all'; -import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '@/misc/reaction-lib'; -import { NoteReaction } from '../entities/note-reaction'; -import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/populate-emojis'; +import { Note } from '../entities/note.js'; +import { User } from '../entities/user.js'; +import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { nyaize } from '@/misc/nyaize.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '@/misc/reaction-lib.js'; +import { NoteReaction } from '../entities/note-reaction.js'; +import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/populate-emojis.js'; export type PackedNote = SchemaType; diff --git a/src/models/repositories/notification.ts b/src/models/repositories/notification.ts index 94a2c3c91..8199534e3 100644 --- a/src/models/repositories/notification.ts +++ b/src/models/repositories/notification.ts @@ -1,12 +1,12 @@ import { EntityRepository, In, Repository } from 'typeorm'; -import { Users, Notes, UserGroupInvitations, AccessTokens, NoteReactions } from '..'; -import { Notification } from '../entities/notification'; -import { awaitAll } from '../../prelude/await-all'; -import { SchemaType } from '@/misc/schema'; -import { Note } from '../entities/note'; -import { NoteReaction } from '../entities/note-reaction'; -import { User } from '../entities/user'; -import { aggregateNoteEmojis, prefetchEmojis } from '@/misc/populate-emojis'; +import { Users, Notes, UserGroupInvitations, AccessTokens, NoteReactions } from '../index.js'; +import { Notification } from '../entities/notification.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Note } from '../entities/note.js'; +import { NoteReaction } from '../entities/note-reaction.js'; +import { User } from '../entities/user.js'; +import { aggregateNoteEmojis, prefetchEmojis } from '@/misc/populate-emojis.js'; export type PackedNotification = SchemaType; diff --git a/src/models/repositories/page-like.ts b/src/models/repositories/page-like.ts index cfef950f3..81147a9ee 100644 --- a/src/models/repositories/page-like.ts +++ b/src/models/repositories/page-like.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { PageLike } from '../entities/page-like'; -import { Pages } from '..'; -import { User } from '../entities/user'; +import { PageLike } from '../entities/page-like.js'; +import { Pages } from '../index.js'; +import { User } from '../entities/user.js'; @EntityRepository(PageLike) export class PageLikeRepository extends Repository { diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts index a162a5032..45f8c8178 100644 --- a/src/models/repositories/page.ts +++ b/src/models/repositories/page.ts @@ -1,10 +1,10 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Page } from '../entities/page'; -import { SchemaType } from '@/misc/schema'; -import { Users, DriveFiles, PageLikes } from '..'; -import { awaitAll } from '../../prelude/await-all'; -import { DriveFile } from '../entities/drive-file'; -import { User } from '../entities/user'; +import { Page } from '../entities/page.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users, DriveFiles, PageLikes } from '../index.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { DriveFile } from '../entities/drive-file.js'; +import { User } from '../entities/user.js'; export type PackedPage = SchemaType; diff --git a/src/models/repositories/relay.ts b/src/models/repositories/relay.ts index 601bb5eb3..c1b04a8ea 100644 --- a/src/models/repositories/relay.ts +++ b/src/models/repositories/relay.ts @@ -1,5 +1,5 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Relay } from '../entities/relay'; +import { Relay } from '../entities/relay.js'; @EntityRepository(Relay) export class RelayRepository extends Repository { diff --git a/src/models/repositories/signin.ts b/src/models/repositories/signin.ts index f5b90c0e9..8490ac6a5 100644 --- a/src/models/repositories/signin.ts +++ b/src/models/repositories/signin.ts @@ -1,5 +1,5 @@ import { EntityRepository, Repository } from 'typeorm'; -import { Signin } from '../entities/signin'; +import { Signin } from '../entities/signin.js'; @EntityRepository(Signin) export class SigninRepository extends Repository { diff --git a/src/models/repositories/user-group-invitation.ts b/src/models/repositories/user-group-invitation.ts index 2aa890361..6552f23d9 100644 --- a/src/models/repositories/user-group-invitation.ts +++ b/src/models/repositories/user-group-invitation.ts @@ -1,6 +1,6 @@ import { EntityRepository, Repository } from 'typeorm'; -import { UserGroupInvitation } from '../entities/user-group-invitation'; -import { UserGroups } from '..'; +import { UserGroupInvitation } from '../entities/user-group-invitation.js'; +import { UserGroups } from '../index.js'; @EntityRepository(UserGroupInvitation) export class UserGroupInvitationRepository extends Repository { diff --git a/src/models/repositories/user-group.ts b/src/models/repositories/user-group.ts index c7d73ebe2..6a2cd2caa 100644 --- a/src/models/repositories/user-group.ts +++ b/src/models/repositories/user-group.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { UserGroup } from '../entities/user-group'; -import { UserGroupJoinings } from '..'; -import { SchemaType } from '@/misc/schema'; +import { UserGroup } from '../entities/user-group.js'; +import { UserGroupJoinings } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedUserGroup = SchemaType; diff --git a/src/models/repositories/user-list.ts b/src/models/repositories/user-list.ts index 7710bebfc..6027e346a 100644 --- a/src/models/repositories/user-list.ts +++ b/src/models/repositories/user-list.ts @@ -1,7 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; -import { UserList } from '../entities/user-list'; -import { UserListJoinings } from '..'; -import { SchemaType } from '@/misc/schema'; +import { UserList } from '../entities/user-list.js'; +import { UserListJoinings } from '../index.js'; +import { SchemaType } from '@/misc/schema.js'; export type PackedUserList = SchemaType; diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 1a191fe86..494ab3c97 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; import { EntityRepository, Repository, In, Not } from 'typeorm'; -import { User, ILocalUser, IRemoteUser } from '../entities/user'; -import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances } from '..'; -import config from '@/config'; -import { SchemaType } from '@/misc/schema'; -import { awaitAll } from '../../prelude/await-all'; -import { populateEmojis } from '@/misc/populate-emojis'; -import { getAntennas } from '@/misc/antenna-cache'; -import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const'; +import { User, ILocalUser, IRemoteUser } from '../entities/user.js'; +import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances } from '../index.js'; +import config from '@/config/index.js'; +import { SchemaType } from '@/misc/schema.js'; +import { awaitAll } from '../../prelude/await-all.js'; +import { populateEmojis } from '@/misc/populate-emojis.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; +import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js'; export type PackedUser = SchemaType; diff --git a/src/prelude/array.ts b/src/prelude/array.ts index d63f0475d..3846c31af 100644 --- a/src/prelude/array.ts +++ b/src/prelude/array.ts @@ -1,4 +1,4 @@ -import { EndoRelation, Predicate } from './relation'; +import { EndoRelation, Predicate } from './relation.js'; /** * Count the number of elements that satisfy the predicate diff --git a/src/queue/index.ts b/src/queue/index.ts index c7b7f0392..7b6824f80 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -1,18 +1,18 @@ import * as httpSignature from 'http-signature'; -import config from '@/config'; -import { program } from '../argv'; +import config from '@/config/index.js'; +import { program } from '../argv.js'; -import processDeliver from './processors/deliver'; -import processInbox from './processors/inbox'; -import processDb from './processors/db'; -import procesObjectStorage from './processors/object-storage'; -import { queueLogger } from './logger'; -import { DriveFile } from '../models/entities/drive-file'; -import { getJobInfo } from './get-job-info'; -import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues'; -import { ThinUser } from './types'; -import { IActivity } from '@/remote/activitypub/type'; +import processDeliver from './processors/deliver.js'; +import processInbox from './processors/inbox.js'; +import processDb from './processors/db/index.js'; +import procesObjectStorage from './processors/object-storage/index.js'; +import { queueLogger } from './logger.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { getJobInfo } from './get-job-info.js'; +import { dbQueue, deliverQueue, inboxQueue, objectStorageQueue } from './queues.js'; +import { ThinUser } from './types.js'; +import { IActivity } from '@/remote/activitypub/type.js'; function renderError(e: Error): any { return { diff --git a/src/queue/initialize.ts b/src/queue/initialize.ts index 4c0e5f9d8..bed368967 100644 --- a/src/queue/initialize.ts +++ b/src/queue/initialize.ts @@ -1,5 +1,5 @@ import * as Bull from 'bull'; -import config from '@/config'; +import config from '@/config/index.js'; export function initialize(name: string, limitPerSec = -1) { return new Bull(name, { diff --git a/src/queue/logger.ts b/src/queue/logger.ts index d6d077468..2843a3c26 100644 --- a/src/queue/logger.ts +++ b/src/queue/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export const queueLogger = new Logger('queue', 'orange'); diff --git a/src/queue/processors/db/delete-drive-files.ts b/src/queue/processors/db/delete-drive-files.ts index 874623204..1d3876ac1 100644 --- a/src/queue/processors/db/delete-drive-files.ts +++ b/src/queue/processors/db/delete-drive-files.ts @@ -1,10 +1,10 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import { deleteFileSync } from '../../../services/drive/delete-file'; -import { Users, DriveFiles } from '../../../models'; +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 { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('delete-drive-files'); diff --git a/src/queue/processors/db/export-blocking.ts b/src/queue/processors/db/export-blocking.ts index 001b50a22..41344826e 100644 --- a/src/queue/processors/db/export-blocking.ts +++ b/src/queue/processors/db/export-blocking.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Blockings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, Blockings } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-blocking'); diff --git a/src/queue/processors/db/export-following.ts b/src/queue/processors/db/export-following.ts index c1ccb7af4..c299479af 100644 --- a/src/queue/processors/db/export-following.ts +++ b/src/queue/processors/db/export-following.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Followings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, Followings } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-following'); diff --git a/src/queue/processors/db/export-mute.ts b/src/queue/processors/db/export-mute.ts index 55d45cc29..8a16ab0b1 100644 --- a/src/queue/processors/db/export-mute.ts +++ b/src/queue/processors/db/export-mute.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, Mutings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, Mutings } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-mute'); diff --git a/src/queue/processors/db/export-notes.ts b/src/queue/processors/db/export-notes.ts index 2d09c0d20..9a2f71b9c 100644 --- a/src/queue/processors/db/export-notes.ts +++ b/src/queue/processors/db/export-notes.ts @@ -2,14 +2,14 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { Users, Notes, Polls } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { Users, Notes, Polls } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import { Note } from '../../../models/entities/note'; -import { Poll } from '../../../models/entities/poll'; -import { DbUserJobData } from '@/queue/types'; +import { Note } from '@/models/entities/note.js'; +import { Poll } from '@/models/entities/poll.js'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-notes'); diff --git a/src/queue/processors/db/export-user-lists.ts b/src/queue/processors/db/export-user-lists.ts index 3f793e064..6b54638f0 100644 --- a/src/queue/processors/db/export-user-lists.ts +++ b/src/queue/processors/db/export-user-lists.ts @@ -2,13 +2,13 @@ import * as Bull from 'bull'; import * as tmp from 'tmp'; import * as fs from 'fs'; -import { queueLogger } from '../../logger'; -import addFile from '../../../services/drive/add-file'; -import dateFormat = require('dateformat'); -import { getFullApAccount } from '@/misc/convert-host'; -import { Users, UserLists, UserListJoinings } from '../../../models'; +import { queueLogger } from '../../logger.js'; +import addFile from '@/services/drive/add-file.js'; +import dateFormat from 'dateformat'; +import { getFullApAccount } from '@/misc/convert-host.js'; +import { Users, UserLists, UserListJoinings } from '@/models/index.js'; import { In } from 'typeorm'; -import { DbUserJobData } from '@/queue/types'; +import { DbUserJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('export-user-lists'); diff --git a/src/queue/processors/db/import-following.ts b/src/queue/processors/db/import-following.ts index 1156b5caf..bc8166c72 100644 --- a/src/queue/processors/db/import-following.ts +++ b/src/queue/processors/db/import-following.ts @@ -1,13 +1,13 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import follow from '../../../services/following/create'; -import { parseAcct } from '@/misc/acct'; -import { resolveUser } from '../../../remote/resolve-user'; -import { downloadTextFile } from '@/misc/download-text-file'; -import { isSelfHost, toPuny } from '@/misc/convert-host'; -import { Users, DriveFiles } from '../../../models'; -import { DbUserImportJobData } from '@/queue/types'; +import { queueLogger } from '../../logger.js'; +import follow from '@/services/following/create.js'; +import { parseAcct } 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 } from '@/models/index.js'; +import { DbUserImportJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('import-following'); diff --git a/src/queue/processors/db/import-user-lists.ts b/src/queue/processors/db/import-user-lists.ts index d04ead869..6748e748e 100644 --- a/src/queue/processors/db/import-user-lists.ts +++ b/src/queue/processors/db/import-user-lists.ts @@ -1,14 +1,14 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import { parseAcct } from '@/misc/acct'; -import { resolveUser } from '../../../remote/resolve-user'; -import { pushUserToUserList } from '../../../services/user-list/push'; -import { downloadTextFile } from '@/misc/download-text-file'; -import { isSelfHost, toPuny } from '@/misc/convert-host'; -import { DriveFiles, Users, UserLists, UserListJoinings } from '../../../models'; -import { genId } from '@/misc/gen-id'; -import { DbUserImportJobData } from '@/queue/types'; +import { queueLogger } from '../../logger.js'; +import { parseAcct } from '@/misc/acct.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 { DbUserImportJobData } from '@/queue/types.js'; const logger = queueLogger.createSubLogger('import-user-lists'); diff --git a/src/queue/processors/db/index.ts b/src/queue/processors/db/index.ts index b56b7bfa2..0936daf7a 100644 --- a/src/queue/processors/db/index.ts +++ b/src/queue/processors/db/index.ts @@ -1,13 +1,13 @@ import * as Bull from 'bull'; -import { DbJobData } from '@/queue/types'; -import { deleteDriveFiles } from './delete-drive-files'; -import { exportNotes } from './export-notes'; -import { exportFollowing } from './export-following'; -import { exportMute } from './export-mute'; -import { exportBlocking } from './export-blocking'; -import { exportUserLists } from './export-user-lists'; -import { importFollowing } from './import-following'; -import { importUserLists } from './import-user-lists'; +import { DbJobData } from '@/queue/types.js'; +import { deleteDriveFiles } from './delete-drive-files.js'; +import { exportNotes } from './export-notes.js'; +import { exportFollowing } from './export-following.js'; +import { exportMute } from './export-mute.js'; +import { exportBlocking } from './export-blocking.js'; +import { exportUserLists } from './export-user-lists.js'; +import { importFollowing } from './import-following.js'; +import { importUserLists } from './import-user-lists.js'; const jobs = { deleteDriveFiles, diff --git a/src/queue/processors/deliver.ts b/src/queue/processors/deliver.ts index f9c53fc8f..aeb7fc5f9 100644 --- a/src/queue/processors/deliver.ts +++ b/src/queue/processors/deliver.ts @@ -1,16 +1,16 @@ import { URL } from 'url'; import * as Bull from 'bull'; -import request from '../../remote/activitypub/request'; -import { registerOrFetchInstanceDoc } from '../../services/register-or-fetch-instance-doc'; -import Logger from '../../services/logger'; -import { Instances } from '../../models'; -import { instanceChart } from '../../services/chart'; -import { fetchInstanceMetadata } from '../../services/fetch-instance-metadata'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { toPuny } from '@/misc/convert-host'; -import { Cache } from '@/misc/cache'; -import { Instance } from '../../models/entities/instance'; -import { DeliverJobData } from '../types'; +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 { instanceChart } from '@/services/chart/index.js'; +import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { Cache } from '@/misc/cache.js'; +import { Instance } from '@/models/entities/instance.js'; +import { DeliverJobData } from '../types.js'; const logger = new Logger('deliver'); diff --git a/src/queue/processors/inbox.ts b/src/queue/processors/inbox.ts index 5922c4c56..b13828096 100644 --- a/src/queue/processors/inbox.ts +++ b/src/queue/processors/inbox.ts @@ -1,19 +1,19 @@ import { URL } from 'url'; import * as Bull from 'bull'; import * as httpSignature from 'http-signature'; -import perform from '../../remote/activitypub/perform'; -import Logger from '../../services/logger'; -import { registerOrFetchInstanceDoc } from '../../services/register-or-fetch-instance-doc'; -import { Instances } from '../../models'; -import { instanceChart } from '../../services/chart'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { toPuny, extractDbHost } from '@/misc/convert-host'; -import { getApId } from '../../remote/activitypub/type'; -import { fetchInstanceMetadata } from '../../services/fetch-instance-metadata'; -import { InboxJobData } from '../types'; -import DbResolver from '../../remote/activitypub/db-resolver'; -import { resolvePerson } from '../../remote/activitypub/models/person'; -import { LdSignature } from '../../remote/activitypub/misc/ld-signature'; +import perform from '@/remote/activitypub/perform.js'; +import Logger from '@/services/logger.js'; +import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc.js'; +import { Instances } from '@/models/index.js'; +import { 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 { 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'; const logger = new Logger('inbox'); diff --git a/src/queue/processors/object-storage/clean-remote-files.ts b/src/queue/processors/object-storage/clean-remote-files.ts index a922755f4..96cb912c1 100644 --- a/src/queue/processors/object-storage/clean-remote-files.ts +++ b/src/queue/processors/object-storage/clean-remote-files.ts @@ -1,8 +1,8 @@ import * as Bull from 'bull'; -import { queueLogger } from '../../logger'; -import { deleteFileSync } from '../../../services/drive/delete-file'; -import { DriveFiles } from '../../../models'; +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/src/queue/processors/object-storage/delete-file.ts b/src/queue/processors/object-storage/delete-file.ts index 31050998a..08f297781 100644 --- a/src/queue/processors/object-storage/delete-file.ts +++ b/src/queue/processors/object-storage/delete-file.ts @@ -1,6 +1,6 @@ -import { ObjectStorageFileJobData } from '@/queue/types'; +import { ObjectStorageFileJobData } from '@/queue/types.js'; import * as Bull from 'bull'; -import { deleteObjectStorageFile } from '../../../services/drive/delete-file'; +import { deleteObjectStorageFile } from '@/services/drive/delete-file.js'; export default async (job: Bull.Job) => { const key: string = job.data.key; diff --git a/src/queue/processors/object-storage/index.ts b/src/queue/processors/object-storage/index.ts index 0d9570e17..b00d49371 100644 --- a/src/queue/processors/object-storage/index.ts +++ b/src/queue/processors/object-storage/index.ts @@ -1,7 +1,7 @@ import * as Bull from 'bull'; -import { ObjectStorageJobData } from '@/queue/types'; -import deleteFile from './delete-file'; -import cleanRemoteFiles from './clean-remote-files'; +import { ObjectStorageJobData } from '@/queue/types.js'; +import deleteFile from './delete-file.js'; +import cleanRemoteFiles from './clean-remote-files.js'; const jobs = { deleteFile, diff --git a/src/queue/queues.ts b/src/queue/queues.ts index 5e2754b83..a3084ae4f 100644 --- a/src/queue/queues.ts +++ b/src/queue/queues.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { initialize as initializeQueue } from './initialize'; -import { DeliverJobData, InboxJobData, DbJobData, ObjectStorageJobData } from './types'; +import config from '@/config/index.js'; +import { initialize as initializeQueue } from './initialize.js'; +import { DeliverJobData, InboxJobData, DbJobData, ObjectStorageJobData } from './types.js'; export const deliverQueue = initializeQueue('deliver', config.deliverJobPerSec || 128); export const inboxQueue = initializeQueue('inbox', config.inboxJobPerSec || 16); diff --git a/src/queue/types.ts b/src/queue/types.ts index a782fc6b9..79067ca05 100644 --- a/src/queue/types.ts +++ b/src/queue/types.ts @@ -1,6 +1,6 @@ -import { DriveFile } from '@/models/entities/drive-file'; -import { User } from '@/models/entities/user'; -import { IActivity } from '@/remote/activitypub/type'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { User } from '@/models/entities/user.js'; +import { IActivity } from '@/remote/activitypub/type.js'; import * as httpSignature from 'http-signature'; export type DeliverJobData = { diff --git a/src/remote/activitypub/audience.ts b/src/remote/activitypub/audience.ts index 85a70f828..1ced62e50 100644 --- a/src/remote/activitypub/audience.ts +++ b/src/remote/activitypub/audience.ts @@ -1,9 +1,9 @@ -import { ApObject, getApIds } from './type'; -import Resolver from './resolver'; -import { resolvePerson } from './models/person'; -import { unique, concat } from '../../prelude/array'; +import { ApObject, getApIds } from './type.js'; +import Resolver from './resolver.js'; +import { resolvePerson } from './models/person.js'; +import { unique, concat } from '../../prelude/array.js'; import * as promiseLimit from 'promise-limit'; -import { User, IRemoteUser } from '../../models/entities/user'; +import { User, IRemoteUser } from '@/models/entities/user.js'; type Visibility = 'public' | 'home' | 'followers' | 'specified'; diff --git a/src/remote/activitypub/db-resolver.ts b/src/remote/activitypub/db-resolver.ts index 9fc6f0c3b..b73ac1e52 100644 --- a/src/remote/activitypub/db-resolver.ts +++ b/src/remote/activitypub/db-resolver.ts @@ -1,11 +1,11 @@ -import config from '@/config'; -import { Note } from '../../models/entities/note'; -import { User, IRemoteUser } from '../../models/entities/user'; -import { UserPublickey } from '../../models/entities/user-publickey'; -import { MessagingMessage } from '../../models/entities/messaging-message'; -import { Notes, Users, UserPublickeys, MessagingMessages } from '../../models'; -import { IObject, getApId } from './type'; -import { resolvePerson } from './models/person'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { UserPublickey } from '@/models/entities/user-publickey.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { Notes, Users, UserPublickeys, MessagingMessages } from '@/models/index.js'; +import { IObject, getApId } from './type.js'; +import { resolvePerson } from './models/person.js'; import escapeRegexp = require('escape-regexp'); export default class DbResolver { diff --git a/src/remote/activitypub/deliver-manager.ts b/src/remote/activitypub/deliver-manager.ts index f112b02b4..b4b2df6ee 100644 --- a/src/remote/activitypub/deliver-manager.ts +++ b/src/remote/activitypub/deliver-manager.ts @@ -1,6 +1,6 @@ -import { Users, Followings } from '../../models'; -import { ILocalUser, IRemoteUser, User } from '../../models/entities/user'; -import { deliver } from '../../queue'; +import { Users, Followings } from '@/models/index.js'; +import { ILocalUser, IRemoteUser, User } from '@/models/entities/user.js'; +import { deliver } from '@/queue/index.js'; //#region types interface IRecipe { diff --git a/src/remote/activitypub/kernel/accept/follow.ts b/src/remote/activitypub/kernel/accept/follow.ts index 71c1bed9d..393516add 100644 --- a/src/remote/activitypub/kernel/accept/follow.ts +++ b/src/remote/activitypub/kernel/accept/follow.ts @@ -1,8 +1,8 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import accept from '../../../../services/following/requests/accept'; -import { IFollow } from '../../type'; -import DbResolver from '../../db-resolver'; -import { relayAccepted } from '../../../../services/relay'; +import { IRemoteUser } from '@/models/entities/user.js'; +import accept from '@/services/following/requests/accept.js'; +import { IFollow } from '../../type.js'; +import DbResolver from '../../db-resolver.js'; +import { relayAccepted } from '@/services/relay.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { // ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある diff --git a/src/remote/activitypub/kernel/accept/index.ts b/src/remote/activitypub/kernel/accept/index.ts index 79cdbb2ef..354bd4f6e 100644 --- a/src/remote/activitypub/kernel/accept/index.ts +++ b/src/remote/activitypub/kernel/accept/index.ts @@ -1,8 +1,8 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import acceptFollow from './follow'; -import { IAccept, isFollow, getApType } from '../../type'; -import { apLogger } from '../../logger'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import acceptFollow from './follow.js'; +import { IAccept, isFollow, getApType } from '../../type.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/add/index.ts b/src/remote/activitypub/kernel/add/index.ts index a5b268741..9a2fac1e7 100644 --- a/src/remote/activitypub/kernel/add/index.ts +++ b/src/remote/activitypub/kernel/add/index.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { IAdd } from '../../type'; -import { resolveNote } from '../../models/note'; -import { addPinned } from '../../../../services/i/pin'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IAdd } from '../../type.js'; +import { resolveNote } from '../../models/note.js'; +import { addPinned } from '@/services/i/pin.js'; export default async (actor: IRemoteUser, activity: IAdd): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/src/remote/activitypub/kernel/announce/index.ts b/src/remote/activitypub/kernel/announce/index.ts index 28ad2fbcc..7e2e73bdd 100644 --- a/src/remote/activitypub/kernel/announce/index.ts +++ b/src/remote/activitypub/kernel/announce/index.ts @@ -1,8 +1,8 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import announceNote from './note'; -import { IAnnounce, getApId } from '../../type'; -import { apLogger } from '../../logger'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import announceNote from './note.js'; +import { IAnnounce, getApId } from '../../type.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/announce/note.ts b/src/remote/activitypub/kernel/announce/note.ts index d5176897b..9a6402e3b 100644 --- a/src/remote/activitypub/kernel/announce/note.ts +++ b/src/remote/activitypub/kernel/announce/note.ts @@ -1,13 +1,13 @@ -import Resolver from '../../resolver'; -import post from '../../../../services/note/create'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { IAnnounce, getApId } from '../../type'; -import { fetchNote, resolveNote } from '../../models/note'; -import { apLogger } from '../../logger'; -import { extractDbHost } from '@/misc/convert-host'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { getApLock } from '@/misc/app-lock'; -import { parseAudience } from '../../audience'; +import Resolver from '../../resolver.js'; +import post from '@/services/note/create.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IAnnounce, getApId } from '../../type.js'; +import { fetchNote, resolveNote } from '../../models/note.js'; +import { apLogger } from '../../logger.js'; +import { extractDbHost } from '@/misc/convert-host.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { getApLock } from '@/misc/app-lock.js'; +import { parseAudience } from '../../audience.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/block/index.ts b/src/remote/activitypub/kernel/block/index.ts index 6c794e125..9e4f1b316 100644 --- a/src/remote/activitypub/kernel/block/index.ts +++ b/src/remote/activitypub/kernel/block/index.ts @@ -1,7 +1,7 @@ -import { IBlock } from '../../type'; -import block from '../../../../services/blocking/create'; -import { IRemoteUser } from '../../../../models/entities/user'; -import DbResolver from '../../db-resolver'; +import { IBlock } from '../../type.js'; +import block from '@/services/blocking/create.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import DbResolver from '../../db-resolver.js'; export default async (actor: IRemoteUser, activity: IBlock): Promise => { // ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず diff --git a/src/remote/activitypub/kernel/create/index.ts b/src/remote/activitypub/kernel/create/index.ts index f1a3ebff4..4aa10d85d 100644 --- a/src/remote/activitypub/kernel/create/index.ts +++ b/src/remote/activitypub/kernel/create/index.ts @@ -1,9 +1,9 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import createNote from './note'; -import { ICreate, getApId, isPost, getApType } from '../../type'; -import { apLogger } from '../../logger'; -import { toArray, concat, unique } from '../../../../prelude/array'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import createNote from './note.js'; +import { ICreate, 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/src/remote/activitypub/kernel/create/note.ts b/src/remote/activitypub/kernel/create/note.ts index 69499d303..b0a7be5ea 100644 --- a/src/remote/activitypub/kernel/create/note.ts +++ b/src/remote/activitypub/kernel/create/note.ts @@ -1,9 +1,9 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { createNote, fetchNote } from '../../models/note'; -import { getApId, IObject, ICreate } from '../../type'; -import { getApLock } from '@/misc/app-lock'; -import { extractDbHost } from '@/misc/convert-host'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { createNote, fetchNote } from '../../models/note.js'; +import { getApId, IObject, ICreate } from '../../type.js'; +import { getApLock } from '@/misc/app-lock.js'; +import { extractDbHost } from '@/misc/convert-host.js'; /** * 投稿作成アクティビティを捌きます diff --git a/src/remote/activitypub/kernel/delete/index.ts b/src/remote/activitypub/kernel/delete/index.ts index 4fb3d4057..130b0aeec 100644 --- a/src/remote/activitypub/kernel/delete/index.ts +++ b/src/remote/activitypub/kernel/delete/index.ts @@ -1,7 +1,7 @@ -import deleteNote from './note'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type'; -import { toSingle } from '../../../../prelude/array'; +import deleteNote from './note.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type.js'; +import { toSingle } from '../../../../prelude/array.js'; /** * 削除アクティビティを捌きます diff --git a/src/remote/activitypub/kernel/delete/note.ts b/src/remote/activitypub/kernel/delete/note.ts index 1a7844f68..ad5e1a2ed 100644 --- a/src/remote/activitypub/kernel/delete/note.ts +++ b/src/remote/activitypub/kernel/delete/note.ts @@ -1,9 +1,9 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import deleteNode from '../../../../services/note/delete'; -import { apLogger } from '../../logger'; -import DbResolver from '../../db-resolver'; -import { getApLock } from '@/misc/app-lock'; -import { deleteMessage } from '../../../../services/messages/delete'; +import { IRemoteUser } from '@/models/entities/user.js'; +import deleteNode from '@/services/note/delete.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/src/remote/activitypub/kernel/flag/index.ts b/src/remote/activitypub/kernel/flag/index.ts index 5f5357a3e..62f3ac5ed 100644 --- a/src/remote/activitypub/kernel/flag/index.ts +++ b/src/remote/activitypub/kernel/flag/index.ts @@ -1,9 +1,9 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import config from '@/config'; -import { IFlag, getApIds } from '../../type'; -import { AbuseUserReports, Users } from '../../../../models'; +import { IRemoteUser } from '@/models/entities/user.js'; +import config from '@/config/index.js'; +import { IFlag, getApIds } from '../../type.js'; +import { AbuseUserReports, Users } from '@/models/index.js'; import { In } from 'typeorm'; -import { genId } from '@/misc/gen-id'; +import { genId } from '@/misc/gen-id.js'; export default async (actor: IRemoteUser, activity: IFlag): Promise => { // objectは `(User|Note) | (User|Note)[]` だけど、全パターンDBスキーマと対応させられないので diff --git a/src/remote/activitypub/kernel/follow.ts b/src/remote/activitypub/kernel/follow.ts index 3e2063302..49c1a7ee0 100644 --- a/src/remote/activitypub/kernel/follow.ts +++ b/src/remote/activitypub/kernel/follow.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../models/entities/user'; -import follow from '../../../services/following/create'; -import { IFollow } from '../type'; -import DbResolver from '../db-resolver'; +import { IRemoteUser } from '@/models/entities/user.js'; +import follow from '@/services/following/create.js'; +import { IFollow } from '../type.js'; +import DbResolver from '../db-resolver.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { const dbResolver = new DbResolver(); diff --git a/src/remote/activitypub/kernel/index.ts b/src/remote/activitypub/kernel/index.ts index ff75f8029..fa0df9753 100644 --- a/src/remote/activitypub/kernel/index.ts +++ b/src/remote/activitypub/kernel/index.ts @@ -1,22 +1,22 @@ -import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type'; -import { IRemoteUser } from '../../../models/entities/user'; -import create from './create'; -import performDeleteActivity from './delete'; -import performUpdateActivity from './update'; -import { performReadActivity } from './read'; -import follow from './follow'; -import undo from './undo'; -import like from './like'; -import announce from './announce'; -import accept from './accept'; -import reject from './reject'; -import add from './add'; -import remove from './remove'; -import block from './block'; -import flag from './flag'; -import { apLogger } from '../logger'; -import Resolver from '../resolver'; -import { toArray } from '../../../prelude/array'; +import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import create from './create/index.js'; +import performDeleteActivity from './delete/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 { apLogger } from '../logger.js'; +import Resolver from '../resolver.js'; +import { toArray } from '../../../prelude/array.js'; export async function performActivity(actor: IRemoteUser, activity: IObject) { if (isCollectionOrOrderedCollection(activity)) { diff --git a/src/remote/activitypub/kernel/like.ts b/src/remote/activitypub/kernel/like.ts index 6ba03e4a4..715cc379b 100644 --- a/src/remote/activitypub/kernel/like.ts +++ b/src/remote/activitypub/kernel/like.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../models/entities/user'; -import { ILike, getApId } from '../type'; -import create from '../../../services/note/reaction/create'; -import { fetchNote, extractEmojis } from '../models/note'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { ILike, getApId } from '../type.js'; +import create from '@/services/note/reaction/create.js'; +import { fetchNote, extractEmojis } from '../models/note.js'; export default async (actor: IRemoteUser, activity: ILike) => { const targetUri = getApId(activity.object); diff --git a/src/remote/activitypub/kernel/read.ts b/src/remote/activitypub/kernel/read.ts index edbc8e68e..93cc36ec4 100644 --- a/src/remote/activitypub/kernel/read.ts +++ b/src/remote/activitypub/kernel/read.ts @@ -1,8 +1,8 @@ -import { IRemoteUser } from '../../../models/entities/user'; -import { IRead, getApId } from '../type'; -import { isSelfHost, extractDbHost } from '@/misc/convert-host'; -import { MessagingMessages } from '../../../models'; -import { readUserMessagingMessage } from '../../../server/api/common/read-messaging-message'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IRead, 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: IRemoteUser, activity: IRead): Promise => { const id = await getApId(activity.object); diff --git a/src/remote/activitypub/kernel/reject/follow.ts b/src/remote/activitypub/kernel/reject/follow.ts index d97ced46b..7099864e7 100644 --- a/src/remote/activitypub/kernel/reject/follow.ts +++ b/src/remote/activitypub/kernel/reject/follow.ts @@ -1,8 +1,8 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import reject from '../../../../services/following/requests/reject'; -import { IFollow } from '../../type'; -import DbResolver from '../../db-resolver'; -import { relayRejected } from '../../../../services/relay'; +import { IRemoteUser } from '@/models/entities/user.js'; +import reject from '@/services/following/requests/reject.js'; +import { IFollow } from '../../type.js'; +import DbResolver from '../../db-resolver.js'; +import { relayRejected } from '@/services/relay.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { // ※ activityはこっちから投げたフォローリクエストなので、activity.actorは存在するローカルユーザーである必要がある diff --git a/src/remote/activitypub/kernel/reject/index.ts b/src/remote/activitypub/kernel/reject/index.ts index d7a80fce7..ed86a4aa2 100644 --- a/src/remote/activitypub/kernel/reject/index.ts +++ b/src/remote/activitypub/kernel/reject/index.ts @@ -1,8 +1,8 @@ -import Resolver from '../../resolver'; -import { IRemoteUser } from '../../../../models/entities/user'; -import rejectFollow from './follow'; -import { IReject, isFollow, getApType } from '../../type'; -import { apLogger } from '../../logger'; +import Resolver from '../../resolver.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import rejectFollow from './follow.js'; +import { IReject, isFollow, getApType } from '../../type.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/remove/index.ts b/src/remote/activitypub/kernel/remove/index.ts index 32b8d6647..7d7b3386c 100644 --- a/src/remote/activitypub/kernel/remove/index.ts +++ b/src/remote/activitypub/kernel/remove/index.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { IRemove } from '../../type'; -import { resolveNote } from '../../models/note'; -import { removePinned } from '../../../../services/i/pin'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IRemove } from '../../type.js'; +import { resolveNote } from '../../models/note.js'; +import { removePinned } from '@/services/i/pin.js'; export default async (actor: IRemoteUser, activity: IRemove): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/src/remote/activitypub/kernel/undo/announce.ts b/src/remote/activitypub/kernel/undo/announce.ts index e08fea188..d0c8c7cb6 100644 --- a/src/remote/activitypub/kernel/undo/announce.ts +++ b/src/remote/activitypub/kernel/undo/announce.ts @@ -1,7 +1,7 @@ -import { Notes } from '../../../../models'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { IAnnounce, getApId } from '../../type'; -import deleteNote from '../../../../services/note/delete'; +import { Notes } from '@/models/index.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IAnnounce, getApId } from '../../type.js'; +import deleteNote from '@/services/note/delete.js'; export const undoAnnounce = async (actor: IRemoteUser, activity: IAnnounce): Promise => { const uri = getApId(activity); diff --git a/src/remote/activitypub/kernel/undo/block.ts b/src/remote/activitypub/kernel/undo/block.ts index 73000fc3f..844b067e2 100644 --- a/src/remote/activitypub/kernel/undo/block.ts +++ b/src/remote/activitypub/kernel/undo/block.ts @@ -1,7 +1,7 @@ -import { IBlock } from '../../type'; -import unblock from '../../../../services/blocking/delete'; -import { IRemoteUser } from '../../../../models/entities/user'; -import DbResolver from '../../db-resolver'; +import { IBlock } from '../../type.js'; +import unblock from '@/services/blocking/delete.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import DbResolver from '../../db-resolver.js'; export default async (actor: IRemoteUser, activity: IBlock): Promise => { const dbResolver = new DbResolver(); diff --git a/src/remote/activitypub/kernel/undo/follow.ts b/src/remote/activitypub/kernel/undo/follow.ts index 73a164030..cbf9b2e80 100644 --- a/src/remote/activitypub/kernel/undo/follow.ts +++ b/src/remote/activitypub/kernel/undo/follow.ts @@ -1,9 +1,9 @@ -import unfollow from '../../../../services/following/delete'; -import cancelRequest from '../../../../services/following/requests/cancel'; -import { IFollow } from '../../type'; -import { IRemoteUser } from '../../../../models/entities/user'; -import { FollowRequests, Followings } from '../../../../models'; -import DbResolver from '../../db-resolver'; +import unfollow from '@/services/following/delete.js'; +import cancelRequest from '@/services/following/requests/cancel.js'; +import { IFollow } from '../../type.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { FollowRequests, Followings } from '@/models/index.js'; +import DbResolver from '../../db-resolver.js'; export default async (actor: IRemoteUser, activity: IFollow): Promise => { const dbResolver = new DbResolver(); diff --git a/src/remote/activitypub/kernel/undo/index.ts b/src/remote/activitypub/kernel/undo/index.ts index 0bab3c966..a03a785c0 100644 --- a/src/remote/activitypub/kernel/undo/index.ts +++ b/src/remote/activitypub/kernel/undo/index.ts @@ -1,11 +1,11 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType } from '../../type'; -import unfollow from './follow'; -import unblock from './block'; -import undoLike from './like'; -import { undoAnnounce } from './announce'; -import Resolver from '../../resolver'; -import { apLogger } from '../../logger'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType } from '../../type.js'; +import unfollow from './follow.js'; +import unblock from './block.js'; +import undoLike from './like.js'; +import { undoAnnounce } from './announce.js'; +import Resolver from '../../resolver.js'; +import { apLogger } from '../../logger.js'; const logger = apLogger; diff --git a/src/remote/activitypub/kernel/undo/like.ts b/src/remote/activitypub/kernel/undo/like.ts index bd6930c66..283e556b3 100644 --- a/src/remote/activitypub/kernel/undo/like.ts +++ b/src/remote/activitypub/kernel/undo/like.ts @@ -1,7 +1,7 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { ILike, getApId } from '../../type'; -import deleteReaction from '../../../../services/note/reaction/delete'; -import { fetchNote } from '../../models/note'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { ILike, 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/src/remote/activitypub/kernel/update/index.ts b/src/remote/activitypub/kernel/update/index.ts index 6dd3e5f29..7888c698e 100644 --- a/src/remote/activitypub/kernel/update/index.ts +++ b/src/remote/activitypub/kernel/update/index.ts @@ -1,9 +1,9 @@ -import { IRemoteUser } from '../../../../models/entities/user'; -import { getApType, IUpdate, isActor } from '../../type'; -import { apLogger } from '../../logger'; -import { updateQuestion } from '../../models/question'; -import Resolver from '../../resolver'; -import { updatePerson } from '../../models/person'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { getApType, IUpdate, isActor } from '../../type.js'; +import { apLogger } from '../../logger.js'; +import { updateQuestion } from '../../models/question.js'; +import Resolver from '../../resolver.js'; +import { updatePerson } from '../../models/person.js'; /** * Updateアクティビティを捌きます diff --git a/src/remote/activitypub/logger.ts b/src/remote/activitypub/logger.ts index e13add01d..cab51b3bf 100644 --- a/src/remote/activitypub/logger.ts +++ b/src/remote/activitypub/logger.ts @@ -1,3 +1,3 @@ -import { remoteLogger } from '../logger'; +import { remoteLogger } from '../logger.js'; export const apLogger = remoteLogger.createSubLogger('ap', 'magenta'); diff --git a/src/remote/activitypub/misc/get-note-html.ts b/src/remote/activitypub/misc/get-note-html.ts index 683860d9c..3800b4060 100644 --- a/src/remote/activitypub/misc/get-note-html.ts +++ b/src/remote/activitypub/misc/get-note-html.ts @@ -1,6 +1,6 @@ import * as mfm from 'mfm-js'; -import { Note } from '../../../models/entities/note'; -import { toHtml } from '../../../mfm/to-html'; +import { Note } from '@/models/entities/note.js'; +import { toHtml } from '../../../mfm/to-html.js'; export default function(note: Note) { let html = note.text ? toHtml(mfm.parse(note.text), JSON.parse(note.mentionedRemoteUsers)) : null; diff --git a/src/remote/activitypub/misc/html-to-mfm.ts b/src/remote/activitypub/misc/html-to-mfm.ts index 5cca04df2..bb1ba7925 100644 --- a/src/remote/activitypub/misc/html-to-mfm.ts +++ b/src/remote/activitypub/misc/html-to-mfm.ts @@ -1,6 +1,6 @@ -import { IObject } from '../type'; -import { extractApHashtagObjects } from '../models/tag'; -import { fromHtml } from '../../../mfm/from-html'; +import { 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).map(x => x.name).filter((x): x is string => x != null); diff --git a/src/remote/activitypub/misc/ld-signature.ts b/src/remote/activitypub/misc/ld-signature.ts index dec07ea81..c73cef81e 100644 --- a/src/remote/activitypub/misc/ld-signature.ts +++ b/src/remote/activitypub/misc/ld-signature.ts @@ -1,8 +1,8 @@ import * as crypto from 'crypto'; import * as jsonld from 'jsonld'; -import { CONTEXTS } from './contexts'; +import { CONTEXTS } from './contexts.js'; import fetch from 'node-fetch'; -import { httpAgent, httpsAgent } from '@/misc/fetch'; +import { httpAgent, httpsAgent } from '@/misc/fetch.js'; // RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017 diff --git a/src/remote/activitypub/models/image.ts b/src/remote/activitypub/models/image.ts index 7bec1d603..ea2584407 100644 --- a/src/remote/activitypub/models/image.ts +++ b/src/remote/activitypub/models/image.ts @@ -1,10 +1,10 @@ -import uploadFromUrl from '../../../services/drive/upload-from-url'; -import { IRemoteUser } from '../../../models/entities/user'; -import Resolver from '../resolver'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { apLogger } from '../logger'; -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles } from '../../../models'; +import uploadFromUrl from '@/services/drive/upload-from-url.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import Resolver from '../resolver.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { apLogger } from '../logger.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; const logger = apLogger; diff --git a/src/remote/activitypub/models/mention.ts b/src/remote/activitypub/models/mention.ts index 5d10328ef..e84429815 100644 --- a/src/remote/activitypub/models/mention.ts +++ b/src/remote/activitypub/models/mention.ts @@ -1,9 +1,9 @@ -import { toArray, unique } from '../../../prelude/array'; -import { IObject, isMention, IApMention } from '../type'; -import { resolvePerson } from './person'; +import { toArray, unique } from '../../../prelude/array.js'; +import { IObject, isMention, IApMention } from '../type.js'; +import { resolvePerson } from './person.js'; import * as promiseLimit from 'promise-limit'; -import Resolver from '../resolver'; -import { User } from '../../../models/entities/user'; +import Resolver from '../resolver.js'; +import { User } from '@/models/entities/user.js'; export async function extractApMentions(tags: IObject | IObject[] | null | undefined) { const hrefs = unique(extractApMentionObjects(tags).map(x => x.href as string)); diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index 6621ae349..2a4f51bb3 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -1,31 +1,31 @@ import * as promiseLimit from 'promise-limit'; -import config from '@/config'; -import Resolver from '../resolver'; -import post from '../../../services/note/create'; -import { resolvePerson, updatePerson } from './person'; -import { resolveImage } from './image'; -import { IRemoteUser } from '../../../models/entities/user'; -import { htmlToMfm } from '../misc/html-to-mfm'; -import { extractApHashtags } from './tag'; -import { unique, toArray, toSingle } from '../../../prelude/array'; -import { extractPollFromQuestion } from './question'; -import vote from '../../../services/note/polls/vote'; -import { apLogger } from '../logger'; -import { DriveFile } from '../../../models/entities/drive-file'; -import { deliverQuestionUpdate } from '../../../services/note/polls/update'; -import { extractDbHost, toPuny } from '@/misc/convert-host'; -import { Emojis, Polls, MessagingMessages } from '../../../models'; -import { Note } from '../../../models/entities/note'; -import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type'; -import { Emoji } from '../../../models/entities/emoji'; -import { genId } from '@/misc/gen-id'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { getApLock } from '@/misc/app-lock'; -import { createMessage } from '../../../services/messages/create'; -import { parseAudience } from '../audience'; -import { extractApMentions } from './mention'; -import DbResolver from '../db-resolver'; +import config from '@/config/index.js'; +import Resolver from '../resolver.js'; +import post from '@/services/note/create.js'; +import { resolvePerson, updatePerson } from './person.js'; +import { resolveImage } from './image.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { htmlToMfm } from '../misc/html-to-mfm.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 { deliverQuestionUpdate } from '@/services/note/polls/update.js'; +import { extractDbHost, toPuny } from '@/misc/convert-host.js'; +import { Emojis, Polls, MessagingMessages } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type.js'; +import { Emoji } from '@/models/entities/emoji.js'; +import { genId } from '@/misc/gen-id.js'; +import { fetchMeta } from '@/misc/fetch-meta.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 DbResolver from '../db-resolver.js'; const logger = apLogger; diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 1b2d0bbdc..2b7d707ac 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -2,32 +2,32 @@ import { URL } from 'url'; import * as promiseLimit from 'promise-limit'; import $, { Context } from 'cafy'; -import config from '@/config'; -import Resolver from '../resolver'; -import { resolveImage } from './image'; -import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, IApPropertyValue, getApType, isActor } from '../type'; -import { fromHtml } from '../../../mfm/from-html'; -import { htmlToMfm } from '../misc/html-to-mfm'; -import { resolveNote, extractEmojis } from './note'; -import { registerOrFetchInstanceDoc } from '../../../services/register-or-fetch-instance-doc'; -import { extractApHashtags } from './tag'; -import { apLogger } from '../logger'; -import { Note } from '../../../models/entities/note'; -import { updateUsertags } from '../../../services/update-hashtag'; -import { Users, Instances, DriveFiles, Followings, UserProfiles, UserPublickeys } from '../../../models'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { Emoji } from '../../../models/entities/emoji'; -import { UserNotePining } from '../../../models/entities/user-note-pining'; -import { genId } from '@/misc/gen-id'; -import { instanceChart, usersChart } from '../../../services/chart'; -import { UserPublickey } from '../../../models/entities/user-publickey'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; -import { toPuny } from '@/misc/convert-host'; -import { UserProfile } from '../../../models/entities/user-profile'; +import config from '@/config/index.js'; +import Resolver from '../resolver.js'; +import { resolveImage } from './image.js'; +import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, IApPropertyValue, getApType, isActor } from '../type.js'; +import { fromHtml } from '../../../mfm/from-html.js'; +import { htmlToMfm } from '../misc/html-to-mfm.js'; +import { resolveNote, extractEmojis } from './note.js'; +import { registerOrFetchInstanceDoc } from '@/services/register-or-fetch-instance-doc.js'; +import { extractApHashtags } from './tag.js'; +import { apLogger } from '../logger.js'; +import { Note } from '@/models/entities/note.js'; +import { updateUsertags } from '@/services/update-hashtag.js'; +import { Users, Instances, DriveFiles, Followings, UserProfiles, UserPublickeys } from '@/models/index.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { 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 { getConnection } from 'typeorm'; -import { toArray } from '../../../prelude/array'; -import { fetchInstanceMetadata } from '../../../services/fetch-instance-metadata'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import { toArray } from '../../../prelude/array.js'; +import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; const logger = apLogger; diff --git a/src/remote/activitypub/models/question.ts b/src/remote/activitypub/models/question.ts index 966b15af1..f954a38e8 100644 --- a/src/remote/activitypub/models/question.ts +++ b/src/remote/activitypub/models/question.ts @@ -1,9 +1,9 @@ -import config from '@/config'; -import Resolver from '../resolver'; -import { IObject, IQuestion, isQuestion, } from '../type'; -import { apLogger } from '../logger'; -import { Notes, Polls } from '../../../models'; -import { IPoll } from '../../../models/entities/poll'; +import config from '@/config/index.js'; +import Resolver from '../resolver.js'; +import { IObject, IQuestion, isQuestion, } from '../type.js'; +import { apLogger } from '../logger.js'; +import { Notes, Polls } from '@/models/index.js'; +import { IPoll } from '@/models/entities/poll.js'; export async function extractPollFromQuestion(source: string | IObject, resolver?: Resolver): Promise { if (resolver == null) resolver = new Resolver(); diff --git a/src/remote/activitypub/models/tag.ts b/src/remote/activitypub/models/tag.ts index d25cb463f..cb8c75336 100644 --- a/src/remote/activitypub/models/tag.ts +++ b/src/remote/activitypub/models/tag.ts @@ -1,5 +1,5 @@ -import { toArray } from '../../../prelude/array'; -import { IObject, isHashtag, IApHashtag } from '../type'; +import { toArray } from '../../../prelude/array.js'; +import { IObject, isHashtag, IApHashtag } from '../type.js'; export function extractApHashtags(tags: IObject | IObject[] | null | undefined) { if (tags == null) return []; diff --git a/src/remote/activitypub/perform.ts b/src/remote/activitypub/perform.ts index 12e72fdea..3e1881558 100644 --- a/src/remote/activitypub/perform.ts +++ b/src/remote/activitypub/perform.ts @@ -1,6 +1,6 @@ -import { IObject } from './type'; -import { IRemoteUser } from '../../models/entities/user'; -import { performActivity } from './kernel'; +import { IObject } from './type.js'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { performActivity } from './kernel/index.js'; export default async (actor: IRemoteUser, activity: IObject): Promise => { await performActivity(actor, activity); diff --git a/src/remote/activitypub/renderer/accept.ts b/src/remote/activitypub/renderer/accept.ts index 8725a30e7..f1037e95f 100644 --- a/src/remote/activitypub/renderer/accept.ts +++ b/src/remote/activitypub/renderer/accept.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Accept', diff --git a/src/remote/activitypub/renderer/add.ts b/src/remote/activitypub/renderer/add.ts index 18f9ccacf..fce541bcd 100644 --- a/src/remote/activitypub/renderer/add.ts +++ b/src/remote/activitypub/renderer/add.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; export default (user: ILocalUser, target: any, object: any) => ({ type: 'Add', diff --git a/src/remote/activitypub/renderer/announce.ts b/src/remote/activitypub/renderer/announce.ts index f577dbbc8..dfbe4714c 100644 --- a/src/remote/activitypub/renderer/announce.ts +++ b/src/remote/activitypub/renderer/announce.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { Note } from '../../../models/entities/note'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; export default (object: any, note: Note) => { const attributedTo = `${config.url}/users/${note.userId}`; diff --git a/src/remote/activitypub/renderer/block.ts b/src/remote/activitypub/renderer/block.ts index 26b7dd580..4e9102e6f 100644 --- a/src/remote/activitypub/renderer/block.ts +++ b/src/remote/activitypub/renderer/block.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { ILocalUser, IRemoteUser } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { ILocalUser, IRemoteUser } from '@/models/entities/user.js'; export default (blocker: ILocalUser, blockee: IRemoteUser) => ({ type: 'Block', diff --git a/src/remote/activitypub/renderer/create.ts b/src/remote/activitypub/renderer/create.ts index ff0840b9e..103ce4bfd 100644 --- a/src/remote/activitypub/renderer/create.ts +++ b/src/remote/activitypub/renderer/create.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { Note } from '../../../models/entities/note'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; export default (object: any, note: Note) => { const activity = { diff --git a/src/remote/activitypub/renderer/delete.ts b/src/remote/activitypub/renderer/delete.ts index 710f0482a..159a486e0 100644 --- a/src/remote/activitypub/renderer/delete.ts +++ b/src/remote/activitypub/renderer/delete.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id']; host: null }) => ({ type: 'Delete', diff --git a/src/remote/activitypub/renderer/document.ts b/src/remote/activitypub/renderer/document.ts index f6e9dca45..c973de4c4 100644 --- a/src/remote/activitypub/renderer/document.ts +++ b/src/remote/activitypub/renderer/document.ts @@ -1,5 +1,5 @@ -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles } from '../../../models'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; export default (file: DriveFile) => ({ type: 'Document', diff --git a/src/remote/activitypub/renderer/emoji.ts b/src/remote/activitypub/renderer/emoji.ts index b62259c32..a58c0c1ad 100644 --- a/src/remote/activitypub/renderer/emoji.ts +++ b/src/remote/activitypub/renderer/emoji.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { Emoji } from '../../../models/entities/emoji'; +import config from '@/config/index.js'; +import { Emoji } from '@/models/entities/emoji.js'; export default (emoji: Emoji) => ({ id: `${config.url}/emojis/${emoji.name}`, diff --git a/src/remote/activitypub/renderer/follow-relay.ts b/src/remote/activitypub/renderer/follow-relay.ts index d53bd0582..4340b7053 100644 --- a/src/remote/activitypub/renderer/follow-relay.ts +++ b/src/remote/activitypub/renderer/follow-relay.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { Relay } from '../../../models/entities/relay'; -import { ILocalUser } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { Relay } from '@/models/entities/relay.js'; +import { ILocalUser } from '@/models/entities/user.js'; export function renderFollowRelay(relay: Relay, relayActor: ILocalUser) { const follow = { diff --git a/src/remote/activitypub/renderer/follow-user.ts b/src/remote/activitypub/renderer/follow-user.ts index 744361a24..ad1d63b93 100644 --- a/src/remote/activitypub/renderer/follow-user.ts +++ b/src/remote/activitypub/renderer/follow-user.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { Users } from '../../../models'; -import { User } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; /** * Convert (local|remote)(Follower|Followee)ID to URL diff --git a/src/remote/activitypub/renderer/follow.ts b/src/remote/activitypub/renderer/follow.ts index 252b0b283..9f80bf829 100644 --- a/src/remote/activitypub/renderer/follow.ts +++ b/src/remote/activitypub/renderer/follow.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { User } from '../../../models/entities/user'; -import { Users } from '../../../models'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; export default (follower: { id: User['id']; host: User['host']; uri: User['host'] }, followee: { id: User['id']; host: User['host']; uri: User['host'] }, requestId?: string) => { const follow = { diff --git a/src/remote/activitypub/renderer/hashtag.ts b/src/remote/activitypub/renderer/hashtag.ts index a739a4b0b..faa0efe92 100644 --- a/src/remote/activitypub/renderer/hashtag.ts +++ b/src/remote/activitypub/renderer/hashtag.ts @@ -1,4 +1,4 @@ -import config from '@/config'; +import config from '@/config/index.js'; export default (tag: string) => ({ type: 'Hashtag', diff --git a/src/remote/activitypub/renderer/image.ts b/src/remote/activitypub/renderer/image.ts index cbd4fbbe6..6440248a4 100644 --- a/src/remote/activitypub/renderer/image.ts +++ b/src/remote/activitypub/renderer/image.ts @@ -1,5 +1,5 @@ -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles } from '../../../models'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; export default (file: DriveFile) => ({ type: 'Image', diff --git a/src/remote/activitypub/renderer/index.ts b/src/remote/activitypub/renderer/index.ts index 84500e949..5ab5b1cdb 100644 --- a/src/remote/activitypub/renderer/index.ts +++ b/src/remote/activitypub/renderer/index.ts @@ -1,9 +1,9 @@ -import config from '@/config'; +import config from '@/config/index.js'; import { v4 as uuid } from 'uuid'; -import { IActivity } from '../type'; -import { LdSignature } from '../misc/ld-signature'; -import { getUserKeypair } from '@/misc/keypair-store'; -import { User } from '@/models/entities/user'; +import { IActivity } from '../type.js'; +import { LdSignature } from '../misc/ld-signature.js'; +import { getUserKeypair } from '@/misc/keypair-store.js'; +import { User } from '@/models/entities/user.js'; export const renderActivity = (x: any): IActivity | null => { if (x == null) return null; diff --git a/src/remote/activitypub/renderer/key.ts b/src/remote/activitypub/renderer/key.ts index 547059dd3..4db1d8326 100644 --- a/src/remote/activitypub/renderer/key.ts +++ b/src/remote/activitypub/renderer/key.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; -import { UserKeypair } from '../../../models/entities/user-keypair'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; import { createPublicKey } from 'crypto'; export default (user: ILocalUser, key: UserKeypair, postfix?: string) => ({ diff --git a/src/remote/activitypub/renderer/like.ts b/src/remote/activitypub/renderer/like.ts index 596783684..6ec0bfb03 100644 --- a/src/remote/activitypub/renderer/like.ts +++ b/src/remote/activitypub/renderer/like.ts @@ -1,8 +1,8 @@ -import config from '@/config'; -import { NoteReaction } from '../../../models/entities/note-reaction'; -import { Note } from '../../../models/entities/note'; -import { Emojis } from '../../../models'; -import renderEmoji from './emoji'; +import config from '@/config/index.js'; +import { NoteReaction } from '@/models/entities/note-reaction.js'; +import { Note } from '@/models/entities/note.js'; +import { Emojis } from '@/models/index.js'; +import renderEmoji from './emoji.js'; export const renderLike = async (noteReaction: NoteReaction, note: Note) => { const reaction = noteReaction.reaction; diff --git a/src/remote/activitypub/renderer/mention.ts b/src/remote/activitypub/renderer/mention.ts index 14c4c40d4..c7e62e884 100644 --- a/src/remote/activitypub/renderer/mention.ts +++ b/src/remote/activitypub/renderer/mention.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { Users } from '../../../models'; +import config from '@/config/index.js'; +import { User, ILocalUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; export default (mention: User) => ({ type: 'Mention', diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index 54dee0789..0f4513fca 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -1,15 +1,15 @@ -import renderDocument from './document'; -import renderHashtag from './hashtag'; -import renderMention from './mention'; -import renderEmoji from './emoji'; -import config from '@/config'; -import toHtml from '../misc/get-note-html'; -import { Note, IMentionedRemoteUsers } from '../../../models/entities/note'; -import { DriveFile } from '../../../models/entities/drive-file'; -import { DriveFiles, Notes, Users, Emojis, Polls } from '../../../models'; +import renderDocument from './document.js'; +import renderHashtag from './hashtag.js'; +import renderMention from './mention.js'; +import renderEmoji from './emoji.js'; +import config from '@/config/index.js'; +import toHtml from '../misc/get-note-html.js'; +import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles, Notes, Users, Emojis, Polls } from '@/models/index.js'; import { In } from 'typeorm'; -import { Emoji } from '../../../models/entities/emoji'; -import { Poll } from '../../../models/entities/poll'; +import { Emoji } from '@/models/entities/emoji.js'; +import { Poll } from '@/models/entities/poll.js'; export default async function renderNote(note: Note, dive = true, isTalk = false): Promise { const getPromisedFiles = async (ids: string[]) => { diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts index 91b91bff9..edcb68ef6 100644 --- a/src/remote/activitypub/renderer/person.ts +++ b/src/remote/activitypub/renderer/person.ts @@ -1,16 +1,16 @@ import { URL } from 'url'; import * as mfm from 'mfm-js'; -import renderImage from './image'; -import renderKey from './key'; -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; -import { toHtml } from '../../../mfm/to-html'; -import { getEmojis } from './note'; -import renderEmoji from './emoji'; -import { IIdentifier } from '../models/identifier'; -import renderHashtag from './hashtag'; -import { DriveFiles, UserProfiles } from '../../../models'; -import { getUserKeypair } from '@/misc/keypair-store'; +import renderImage from './image.js'; +import renderKey from './key.js'; +import config from '@/config/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { toHtml } from '../../../mfm/to-html.js'; +import { getEmojis } from './note.js'; +import renderEmoji from './emoji.js'; +import { IIdentifier } from '../models/identifier.js'; +import renderHashtag from './hashtag.js'; +import { DriveFiles, UserProfiles } from '@/models/index.js'; +import { getUserKeypair } from '@/misc/keypair-store.js'; export async function renderPerson(user: ILocalUser) { const id = `${config.url}/users/${user.id}`; diff --git a/src/remote/activitypub/renderer/question.ts b/src/remote/activitypub/renderer/question.ts index 99670f80a..388398a7d 100644 --- a/src/remote/activitypub/renderer/question.ts +++ b/src/remote/activitypub/renderer/question.ts @@ -1,7 +1,7 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { Poll } from '../../../models/entities/poll'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { Poll } from '@/models/entities/poll.js'; export default async function renderQuestion(user: { id: User['id'] }, note: Note, poll: Poll) { const question = { diff --git a/src/remote/activitypub/renderer/read.ts b/src/remote/activitypub/renderer/read.ts index 1287f4ccb..39a852fcb 100644 --- a/src/remote/activitypub/renderer/read.ts +++ b/src/remote/activitypub/renderer/read.ts @@ -1,6 +1,6 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; -import { MessagingMessage } from '../../../models/entities/messaging-message'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; export const renderReadActivity = (user: { id: User['id'] }, message: MessagingMessage) => ({ type: 'Read', diff --git a/src/remote/activitypub/renderer/reject.ts b/src/remote/activitypub/renderer/reject.ts index e1eb5b004..474b67d68 100644 --- a/src/remote/activitypub/renderer/reject.ts +++ b/src/remote/activitypub/renderer/reject.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id'] }) => ({ type: 'Reject', diff --git a/src/remote/activitypub/renderer/remove.ts b/src/remote/activitypub/renderer/remove.ts index ff1fab8e5..1f6bc1940 100644 --- a/src/remote/activitypub/renderer/remove.ts +++ b/src/remote/activitypub/renderer/remove.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (user: { id: User['id'] }, target: any, object: any) => ({ type: 'Remove', diff --git a/src/remote/activitypub/renderer/undo.ts b/src/remote/activitypub/renderer/undo.ts index 627a6533a..968d59fae 100644 --- a/src/remote/activitypub/renderer/undo.ts +++ b/src/remote/activitypub/renderer/undo.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { ILocalUser, User } from '../../../models/entities/user'; +import config from '@/config/index.js'; +import { ILocalUser, User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id'] }) => { if (object == null) return null; diff --git a/src/remote/activitypub/renderer/update.ts b/src/remote/activitypub/renderer/update.ts index 4295fc64f..c696a9c34 100644 --- a/src/remote/activitypub/renderer/update.ts +++ b/src/remote/activitypub/renderer/update.ts @@ -1,5 +1,5 @@ -import config from '@/config'; -import { User } from '@/models/entities/user'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; export default (object: any, user: { id: User['id'] }) => { const activity = { diff --git a/src/remote/activitypub/renderer/vote.ts b/src/remote/activitypub/renderer/vote.ts index 529fdaafc..201845a18 100644 --- a/src/remote/activitypub/renderer/vote.ts +++ b/src/remote/activitypub/renderer/vote.ts @@ -1,8 +1,8 @@ -import config from '@/config'; -import { Note } from '../../../models/entities/note'; -import { IRemoteUser, User } from '../../../models/entities/user'; -import { PollVote } from '../../../models/entities/poll-vote'; -import { Poll } from '../../../models/entities/poll'; +import config from '@/config/index.js'; +import { Note } from '@/models/entities/note.js'; +import { IRemoteUser, User } from '@/models/entities/user.js'; +import { PollVote } from '@/models/entities/poll-vote.js'; +import { Poll } from '@/models/entities/poll.js'; export default async function renderVote(user: { id: User['id'] }, vote: PollVote, note: Note, poll: Poll, pollOwner: IRemoteUser): Promise { return { diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts index e4dca3232..2711c8587 100644 --- a/src/remote/activitypub/request.ts +++ b/src/remote/activitypub/request.ts @@ -3,13 +3,13 @@ import * as https from 'https'; import { sign } from 'http-signature'; import * as crypto from 'crypto'; -import config from '@/config'; -import { User } from '@/models/entities/user'; -import { getAgentByUrl } from '@/misc/fetch'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { getAgentByUrl } from '@/misc/fetch.js'; import { URL } from 'url'; import got from 'got'; import * as Got from 'got'; -import { getUserKeypair } from '@/misc/keypair-store'; +import { getUserKeypair } from '@/misc/keypair-store.js'; export default async (user: { id: User['id'] }, url: string, object: any) => { const timeout = 10 * 1000; diff --git a/src/remote/activitypub/resolver.ts b/src/remote/activitypub/resolver.ts index 066bde088..835105831 100644 --- a/src/remote/activitypub/resolver.ts +++ b/src/remote/activitypub/resolver.ts @@ -1,9 +1,9 @@ -import config from '@/config'; -import { getJson } from '@/misc/fetch'; -import { ILocalUser } from '../../models/entities/user'; -import { getInstanceActor } from '../../services/instance-actor'; -import { signedGet } from './request'; -import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type'; +import config from '@/config/index.js'; +import { getJson } from '@/misc/fetch.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { getInstanceActor } from '@/services/instance-actor.js'; +import { signedGet } from './request.js'; +import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type.js'; export default class Resolver { private history: Set; diff --git a/src/remote/logger.ts b/src/remote/logger.ts index d7464e7fd..4921f53bd 100644 --- a/src/remote/logger.ts +++ b/src/remote/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../services/logger'; +import Logger from '@/services/logger.js'; export const remoteLogger = new Logger('remote', 'cyan'); diff --git a/src/remote/resolve-user.ts b/src/remote/resolve-user.ts index 1bcecee3c..186920439 100644 --- a/src/remote/resolve-user.ts +++ b/src/remote/resolve-user.ts @@ -1,12 +1,12 @@ import { URL } from 'url'; -import webFinger from './webfinger'; -import config from '@/config'; -import { createPerson, updatePerson } from './activitypub/models/person'; -import { remoteLogger } from './logger'; +import webFinger from './webfinger.js'; +import config from '@/config/index.js'; +import { createPerson, updatePerson } from './activitypub/models/person.js'; +import { remoteLogger } from './logger.js'; import * as chalk from 'chalk'; -import { User, IRemoteUser } from '../models/entities/user'; -import { Users } from '../models'; -import { toPuny } from '@/misc/convert-host'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; const logger = remoteLogger.createSubLogger('resolve-user'); diff --git a/src/remote/webfinger.ts b/src/remote/webfinger.ts index 744ab3639..e885e9d7c 100644 --- a/src/remote/webfinger.ts +++ b/src/remote/webfinger.ts @@ -1,6 +1,6 @@ import { URL } from 'url'; -import { getJson } from '@/misc/fetch'; -import { query as urlQuery } from '../prelude/url'; +import { getJson } from '@/misc/fetch.js'; +import { query as urlQuery } from '../prelude/url.js'; type ILink = { href: string; diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index 0ddc4683f..834293a5a 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -2,22 +2,22 @@ import * as Router from '@koa/router'; import * as json from 'koa-json-body'; import * as httpSignature from 'http-signature'; -import { renderActivity } from '../remote/activitypub/renderer'; -import renderNote from '../remote/activitypub/renderer/note'; -import renderKey from '../remote/activitypub/renderer/key'; -import { renderPerson } from '../remote/activitypub/renderer/person'; -import renderEmoji from '../remote/activitypub/renderer/emoji'; -import Outbox, { packActivity } from './activitypub/outbox'; -import Followers from './activitypub/followers'; -import Following from './activitypub/following'; -import Featured from './activitypub/featured'; -import { inbox as processInbox } from '../queue'; -import { isSelfHost } from '@/misc/convert-host'; -import { Notes, Users, Emojis, NoteReactions } from '../models'; -import { ILocalUser, User } from '../models/entities/user'; +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 Outbox, { packActivity } from './activitypub/outbox.js'; +import Followers from './activitypub/followers.js'; +import Following from './activitypub/following.js'; +import Featured from './activitypub/featured.js'; +import { inbox as processInbox } from '@/queue/index.js'; +import { isSelfHost } from '@/misc/convert-host.js'; +import { Notes, Users, Emojis, NoteReactions } from '@/models/index.js'; +import { ILocalUser, User } from '@/models/entities/user.js'; import { In } from 'typeorm'; -import { renderLike } from '../remote/activitypub/renderer/like'; -import { getUserKeypair } from '@/misc/keypair-store'; +import { renderLike } from '@/remote/activitypub/renderer/like.js'; +import { getUserKeypair } from '@/misc/keypair-store.js'; // Init router const router = new Router(); diff --git a/src/server/activitypub/featured.ts b/src/server/activitypub/featured.ts index 02d4a30a5..69de20113 100644 --- a/src/server/activitypub/featured.ts +++ b/src/server/activitypub/featured.ts @@ -1,10 +1,10 @@ import * as Router from '@koa/router'; -import config from '@/config'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import { setResponseType } from '../activitypub'; -import renderNote from '../../remote/activitypub/renderer/note'; -import { Users, Notes, UserNotePinings } from '../../models'; +import config from '@/config/index.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection.js'; +import { setResponseType } from '../activitypub.js'; +import renderNote from '@/remote/activitypub/renderer/note.js'; +import { Users, Notes, UserNotePinings } from '@/models/index.js'; export default async (ctx: Router.RouterContext) => { const userId = ctx.params.user; diff --git a/src/server/activitypub/followers.ts b/src/server/activitypub/followers.ts index a4f2e666d..13a3ae91a 100644 --- a/src/server/activitypub/followers.ts +++ b/src/server/activitypub/followers.ts @@ -1,14 +1,14 @@ import * as Router from '@koa/router'; -import config from '@/config'; +import config from '@/config/index.js'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import * as url from '../../prelude/url'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import renderOrderedCollectionPage from '../../remote/activitypub/renderer/ordered-collection-page'; -import renderFollowUser from '../../remote/activitypub/renderer/follow-user'; -import { setResponseType } from '../activitypub'; -import { Users, Followings } from '../../models'; +import { ID } from '@/misc/cafy-id.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 { setResponseType } from '../activitypub.js'; +import { Users, Followings } from '@/models/index.js'; import { LessThan } from 'typeorm'; export default async (ctx: Router.RouterContext) => { diff --git a/src/server/activitypub/following.ts b/src/server/activitypub/following.ts index f5e5c6236..1f7938bec 100644 --- a/src/server/activitypub/following.ts +++ b/src/server/activitypub/following.ts @@ -1,16 +1,16 @@ import * as Router from '@koa/router'; -import config from '@/config'; +import config from '@/config/index.js'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import * as url from '../../prelude/url'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import renderOrderedCollectionPage from '../../remote/activitypub/renderer/ordered-collection-page'; -import renderFollowUser from '../../remote/activitypub/renderer/follow-user'; -import { setResponseType } from '../activitypub'; -import { Users, Followings } from '../../models'; +import { ID } from '@/misc/cafy-id.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 { setResponseType } from '../activitypub.js'; +import { Users, Followings } from '@/models/index.js'; import { LessThan, FindConditions } from 'typeorm'; -import { Following } from '../../models/entities/following'; +import { Following } from '@/models/entities/following.js'; export default async (ctx: Router.RouterContext) => { const userId = ctx.params.user; diff --git a/src/server/activitypub/outbox.ts b/src/server/activitypub/outbox.ts index 338e17737..eed489e59 100644 --- a/src/server/activitypub/outbox.ts +++ b/src/server/activitypub/outbox.ts @@ -1,20 +1,20 @@ import * as Router from '@koa/router'; -import config from '@/config'; +import config from '@/config/index.js'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection'; -import renderOrderedCollectionPage from '../../remote/activitypub/renderer/ordered-collection-page'; -import { setResponseType } from '../activitypub'; -import renderNote from '../../remote/activitypub/renderer/note'; -import renderCreate from '../../remote/activitypub/renderer/create'; -import renderAnnounce from '../../remote/activitypub/renderer/announce'; -import { countIf } from '../../prelude/array'; -import * as url from '../../prelude/url'; -import { Users, Notes } from '../../models'; -import { makePaginationQuery } from '../api/common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.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 { setResponseType } from '../activitypub.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 { makePaginationQuery } from '../api/common/make-pagination-query.js'; import { Brackets } from 'typeorm'; -import { Note } from '../../models/entities/note'; +import { Note } from '@/models/entities/note.js'; export default async (ctx: Router.RouterContext) => { const userId = ctx.params.user; diff --git a/src/server/api/2fa.ts b/src/server/api/2fa.ts index 77f0f8cd0..ee92caf55 100644 --- a/src/server/api/2fa.ts +++ b/src/server/api/2fa.ts @@ -1,5 +1,5 @@ import * as crypto from 'crypto'; -import config from '@/config'; +import config from '@/config/index.js'; import * as jsrsasign from 'jsrsasign'; const ECC_PRELUDE = Buffer.from([0x04]); diff --git a/src/server/api/api-handler.ts b/src/server/api/api-handler.ts index cbace8917..e2660d7b6 100644 --- a/src/server/api/api-handler.ts +++ b/src/server/api/api-handler.ts @@ -1,9 +1,9 @@ import * as Koa from 'koa'; -import { IEndpoint } from './endpoints'; -import authenticate, { AuthenticationError } from './authenticate'; -import call from './call'; -import { ApiError } from './error'; +import { IEndpoint } from './endpoints.js'; +import authenticate, { AuthenticationError } from './authenticate.js'; +import call from './call.js'; +import { ApiError } from './error.js'; export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { const body = ctx.request.body; diff --git a/src/server/api/authenticate.ts b/src/server/api/authenticate.ts index 6148ad33c..cd5b01cd5 100644 --- a/src/server/api/authenticate.ts +++ b/src/server/api/authenticate.ts @@ -1,7 +1,7 @@ -import isNativeToken from './common/is-native-token'; -import { User } from '../../models/entities/user'; -import { Users, AccessTokens, Apps } from '../../models'; -import { AccessToken } from '../../models/entities/access-token'; +import isNativeToken from './common/is-native-token.js'; +import { User } from '@/models/entities/user.js'; +import { Users, AccessTokens, Apps } from '@/models/index.js'; +import { AccessToken } from '@/models/entities/access-token.js'; export class AuthenticationError extends Error { constructor(message: string) { diff --git a/src/server/api/call.ts b/src/server/api/call.ts index d50b6a122..899a5a6c7 100644 --- a/src/server/api/call.ts +++ b/src/server/api/call.ts @@ -1,10 +1,10 @@ import { performance } from 'perf_hooks'; -import limiter from './limiter'; -import { User } from '../../models/entities/user'; -import endpoints from './endpoints'; -import { ApiError } from './error'; -import { apiLogger } from './logger'; -import { AccessToken } from '../../models/entities/access-token'; +import limiter from './limiter.js'; +import { User } from '@/models/entities/user.js'; +import endpoints from './endpoints.js'; +import { ApiError } from './error.js'; +import { apiLogger } from './logger.js'; +import { AccessToken } from '@/models/entities/access-token.js'; const accessDenied = { message: 'Access denied.', diff --git a/src/server/api/common/generate-block-query.ts b/src/server/api/common/generate-block-query.ts index 016da57aa..60db1e731 100644 --- a/src/server/api/common/generate-block-query.ts +++ b/src/server/api/common/generate-block-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { Blockings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { Blockings } from '@/models/index.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; // ここでいうBlockedは被Blockedの意 diff --git a/src/server/api/common/generate-channel-query.ts b/src/server/api/common/generate-channel-query.ts index 74a6d68c4..333bb73b8 100644 --- a/src/server/api/common/generate-channel-query.ts +++ b/src/server/api/common/generate-channel-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { ChannelFollowings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { ChannelFollowings } from '@/models/index.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; export function generateChannelQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { diff --git a/src/server/api/common/generate-muted-note-query.ts b/src/server/api/common/generate-muted-note-query.ts index c7f9f7c5a..f544e334d 100644 --- a/src/server/api/common/generate-muted-note-query.ts +++ b/src/server/api/common/generate-muted-note-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { MutedNotes } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { MutedNotes } from '@/models/index.js'; import { SelectQueryBuilder } from 'typeorm'; export function generateMutedNoteQuery(q: SelectQueryBuilder, me: { id: User['id'] }) { diff --git a/src/server/api/common/generate-muted-user-query.ts b/src/server/api/common/generate-muted-user-query.ts index f5e072ba9..79cb3ff89 100644 --- a/src/server/api/common/generate-muted-user-query.ts +++ b/src/server/api/common/generate-muted-user-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { Mutings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { Mutings } from '@/models/index.js'; import { SelectQueryBuilder, Brackets } from 'typeorm'; export function generateMutedUserQuery(q: SelectQueryBuilder, me: { id: User['id'] }, exclude?: User) { diff --git a/src/server/api/common/generate-native-user-token.ts b/src/server/api/common/generate-native-user-token.ts index 1f791c57c..5d8a4c537 100644 --- a/src/server/api/common/generate-native-user-token.ts +++ b/src/server/api/common/generate-native-user-token.ts @@ -1,3 +1,3 @@ -import { secureRndstr } from '@/misc/secure-rndstr'; +import { secureRndstr } from '@/misc/secure-rndstr.js'; export default () => secureRndstr(16, true); diff --git a/src/server/api/common/generate-replies-query.ts b/src/server/api/common/generate-replies-query.ts index 29b1e17c2..e59a3334e 100644 --- a/src/server/api/common/generate-replies-query.ts +++ b/src/server/api/common/generate-replies-query.ts @@ -1,4 +1,4 @@ -import { User } from '../../../models/entities/user'; +import { User } from '@/models/entities/user.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; export function generateRepliesQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { diff --git a/src/server/api/common/generate-visibility-query.ts b/src/server/api/common/generate-visibility-query.ts index 00a50f821..715982934 100644 --- a/src/server/api/common/generate-visibility-query.ts +++ b/src/server/api/common/generate-visibility-query.ts @@ -1,5 +1,5 @@ -import { User } from '../../../models/entities/user'; -import { Followings } from '../../../models'; +import { User } from '@/models/entities/user.js'; +import { Followings } from '@/models/index.js'; import { Brackets, SelectQueryBuilder } from 'typeorm'; export function generateVisibilityQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { diff --git a/src/server/api/common/getters.ts b/src/server/api/common/getters.ts index 73fbadfee..c5a47876d 100644 --- a/src/server/api/common/getters.ts +++ b/src/server/api/common/getters.ts @@ -1,7 +1,7 @@ -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { Notes, Users } from '../../../models'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes, Users } from '@/models/index.js'; /** * Get note for API processing diff --git a/src/server/api/common/inject-featured.ts b/src/server/api/common/inject-featured.ts index 3659b7f2b..b7dd8028b 100644 --- a/src/server/api/common/inject-featured.ts +++ b/src/server/api/common/inject-featured.ts @@ -1,9 +1,9 @@ import rndstr from 'rndstr'; -import { Note } from '../../../models/entities/note'; -import { User } from '../../../models/entities/user'; -import { Notes, UserProfiles, NoteReactions } from '../../../models'; -import { generateMutedUserQuery } from './generate-muted-user-query'; -import { generateBlockedUserQuery } from './generate-block-query'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.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/src/server/api/common/inject-promo.ts b/src/server/api/common/inject-promo.ts index 2c16ca4cf..971770f32 100644 --- a/src/server/api/common/inject-promo.ts +++ b/src/server/api/common/inject-promo.ts @@ -1,7 +1,7 @@ import rndstr from 'rndstr'; -import { Note } from '../../../models/entities/note'; -import { User } from '../../../models/entities/user'; -import { PromoReads, PromoNotes, Notes, Users } from '../../../models'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +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/src/server/api/common/read-messaging-message.ts b/src/server/api/common/read-messaging-message.ts index 6c9fcf973..638aff3d5 100644 --- a/src/server/api/common/read-messaging-message.ts +++ b/src/server/api/common/read-messaging-message.ts @@ -1,17 +1,17 @@ -import { publishMainStream, publishGroupMessagingStream } from '../../../services/stream'; -import { publishMessagingStream } from '../../../services/stream'; -import { publishMessagingIndexStream } from '../../../services/stream'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { MessagingMessage } from '../../../models/entities/messaging-message'; -import { MessagingMessages, UserGroupJoinings, Users } from '../../../models'; +import { publishMainStream, publishGroupMessagingStream } from '@/services/stream.js'; +import { publishMessagingStream } from '@/services/stream.js'; +import { publishMessagingIndexStream } from '@/services/stream.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { 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'; -import { UserGroup } from '../../../models/entities/user-group'; -import { toArray } from '../../../prelude/array'; -import { renderReadActivity } from '../../../remote/activitypub/renderer/read'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import { deliver } from '../../../queue'; -import orderedCollection from '../../../remote/activitypub/renderer/ordered-collection'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { 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/src/server/api/common/read-notification.ts b/src/server/api/common/read-notification.ts index effa61e8b..ce958c479 100644 --- a/src/server/api/common/read-notification.ts +++ b/src/server/api/common/read-notification.ts @@ -1,7 +1,7 @@ -import { publishMainStream } from '../../../services/stream'; -import { User } from '../../../models/entities/user'; -import { Notification } from '../../../models/entities/notification'; -import { Notifications, Users } from '../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { Notification } from '@/models/entities/notification.js'; +import { Notifications, Users } from '@/models/index.js'; import { In } from 'typeorm'; export async function readNotification( diff --git a/src/server/api/common/signin.ts b/src/server/api/common/signin.ts index af09a7034..adc5aafe8 100644 --- a/src/server/api/common/signin.ts +++ b/src/server/api/common/signin.ts @@ -1,10 +1,10 @@ import * as Koa from 'koa'; -import config from '@/config'; -import { ILocalUser } from '../../../models/entities/user'; -import { Signins } from '../../../models'; -import { genId } from '@/misc/gen-id'; -import { publishMainStream } from '../../../services/stream'; +import config from '@/config/index.js'; +import { 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) { if (redirect) { diff --git a/src/server/api/common/signup.ts b/src/server/api/common/signup.ts index b8d197317..c5605e2b8 100644 --- a/src/server/api/common/signup.ts +++ b/src/server/api/common/signup.ts @@ -1,15 +1,15 @@ import * as bcrypt from 'bcryptjs'; import { generateKeyPair } from 'crypto'; -import generateUserToken from './generate-native-user-token'; -import { User } from '../../../models/entities/user'; -import { Users, UsedUsernames } from '../../../models'; -import { UserProfile } from '../../../models/entities/user-profile'; +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 { getConnection } from 'typeorm'; -import { genId } from '@/misc/gen-id'; -import { toPunyNullable } from '@/misc/convert-host'; -import { UserKeypair } from '../../../models/entities/user-keypair'; -import { usersChart } from '../../../services/chart'; -import { UsedUsername } from '../../../models/entities/used-username'; +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'; export async function signup(username: User['username'], password: UserProfile['password'], host: string | null = null) { // Validate username diff --git a/src/server/api/define.ts b/src/server/api/define.ts index cba69cfdc..18e8f6201 100644 --- a/src/server/api/define.ts +++ b/src/server/api/define.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; -import { ILocalUser } from '../../models/entities/user'; -import { IEndpointMeta } from './endpoints'; -import { ApiError } from './error'; -import { SchemaType } from '@/misc/schema'; -import { AccessToken } from '../../models/entities/access-token'; +import { ILocalUser } from '@/models/entities/user.js'; +import { IEndpointMeta } from './endpoints.js'; +import { ApiError } from './error.js'; +import { SchemaType } from '@/misc/schema.js'; +import { AccessToken } from '@/models/entities/access-token.js'; type NonOptional = T extends undefined ? never : T; diff --git a/src/server/api/endpoints.ts b/src/server/api/endpoints.ts index 24b58b873..4c0baf224 100644 --- a/src/server/api/endpoints.ts +++ b/src/server/api/endpoints.ts @@ -1,7 +1,13 @@ +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import { Context } from 'cafy'; import * as path from 'path'; import * as glob from 'glob'; -import { Schema } from '@/misc/schema'; +import { Schema } from '@/misc/schema.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export type Param = { validator: Context; @@ -102,7 +108,7 @@ export interface IEndpoint { } const files = glob.sync('**/*.js', { - cwd: path.resolve(__dirname + '/endpoints/') + cwd: path.resolve(_dirname + '/endpoints/') }); const endpoints: IEndpoint[] = files.map(f => { diff --git a/src/server/api/endpoints/admin/abuse-user-reports.ts b/src/server/api/endpoints/admin/abuse-user-reports.ts index 02291a3ed..5bc5618ab 100644 --- a/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { AbuseUserReports } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { AbuseUserReports } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/accounts/create.ts b/src/server/api/endpoints/admin/accounts/create.ts index bceb210a8..f9a6c10b8 100644 --- a/src/server/api/endpoints/admin/accounts/create.ts +++ b/src/server/api/endpoints/admin/accounts/create.ts @@ -1,6 +1,6 @@ -import define from '../../../define'; -import { Users } from '../../../../../models'; -import { signup } from '../../../common/signup'; +import define from '../../../define.js'; +import { Users } from '@/models/index.js'; +import { signup } from '../../../common/signup.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/create.ts b/src/server/api/endpoints/admin/ad/create.ts index 337114a3f..55cc03718 100644 --- a/src/server/api/endpoints/admin/ad/create.ts +++ b/src/server/api/endpoints/admin/ad/create.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Ads } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Ads } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/delete.ts b/src/server/api/endpoints/admin/ad/delete.ts index 6a5f92193..9f11f968e 100644 --- a/src/server/api/endpoints/admin/ad/delete.ts +++ b/src/server/api/endpoints/admin/ad/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Ads } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Ads } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/list.ts b/src/server/api/endpoints/admin/ad/list.ts index a323f2a9e..a2d843ec1 100644 --- a/src/server/api/endpoints/admin/ad/list.ts +++ b/src/server/api/endpoints/admin/ad/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Ads } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Ads } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/ad/update.ts b/src/server/api/endpoints/admin/ad/update.ts index 71e6054a8..2d7a32585 100644 --- a/src/server/api/endpoints/admin/ad/update.ts +++ b/src/server/api/endpoints/admin/ad/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Ads } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Ads } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/create.ts b/src/server/api/endpoints/admin/announcements/create.ts index 794c35023..ab1b9a3c2 100644 --- a/src/server/api/endpoints/admin/announcements/create.ts +++ b/src/server/api/endpoints/admin/announcements/create.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Announcements } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Announcements } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/delete.ts b/src/server/api/endpoints/admin/announcements/delete.ts index 6c28054da..52d7cb26c 100644 --- a/src/server/api/endpoints/admin/announcements/delete.ts +++ b/src/server/api/endpoints/admin/announcements/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Announcements } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Announcements } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/list.ts b/src/server/api/endpoints/admin/announcements/list.ts index a14f0c0bd..ff62b7806 100644 --- a/src/server/api/endpoints/admin/announcements/list.ts +++ b/src/server/api/endpoints/admin/announcements/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Announcements, AnnouncementReads } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Announcements, AnnouncementReads } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/announcements/update.ts b/src/server/api/endpoints/admin/announcements/update.ts index 6e9a43d34..e45a185ad 100644 --- a/src/server/api/endpoints/admin/announcements/update.ts +++ b/src/server/api/endpoints/admin/announcements/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Announcements } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Announcements } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts b/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts index 3d49689cd..9001e01a1 100644 --- a/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts +++ b/src/server/api/endpoints/admin/delete-all-files-of-a-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { deleteFile } from '../../../../services/drive/delete-file'; -import { DriveFiles } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/delete-logs.ts b/src/server/api/endpoints/admin/delete-logs.ts index 410588bc0..be3f58d73 100644 --- a/src/server/api/endpoints/admin/delete-logs.ts +++ b/src/server/api/endpoints/admin/delete-logs.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Logs } from '../../../../models'; +import define from '../../define.js'; +import { Logs } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/clean-remote-files.ts b/src/server/api/endpoints/admin/drive/clean-remote-files.ts index 5a5adb8a8..f945f0f04 100644 --- a/src/server/api/endpoints/admin/drive/clean-remote-files.ts +++ b/src/server/api/endpoints/admin/drive/clean-remote-files.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { createCleanRemoteFilesJob } from '../../../../../queue'; +import define from '../../../define.js'; +import { createCleanRemoteFilesJob } from '@/queue/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/cleanup.ts b/src/server/api/endpoints/admin/drive/cleanup.ts index b76236a7f..d5ad221a6 100644 --- a/src/server/api/endpoints/admin/drive/cleanup.ts +++ b/src/server/api/endpoints/admin/drive/cleanup.ts @@ -1,7 +1,7 @@ import { IsNull } from 'typeorm'; -import define from '../../../define'; -import { deleteFile } from '../../../../../services/drive/delete-file'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/files.ts b/src/server/api/endpoints/admin/drive/files.ts index efeef83ca..65980bfea 100644 --- a/src/server/api/endpoints/admin/drive/files.ts +++ b/src/server/api/endpoints/admin/drive/files.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/drive/show-file.ts b/src/server/api/endpoints/admin/drive/show-file.ts index 3489e5c81..9dfa0cacf 100644 --- a/src/server/api/endpoints/admin/drive/show-file.ts +++ b/src/server/api/endpoints/admin/drive/show-file.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/add.ts b/src/server/api/endpoints/admin/emoji/add.ts index 0d4550bf3..b797fb30a 100644 --- a/src/server/api/endpoints/admin/emoji/add.ts +++ b/src/server/api/endpoints/admin/emoji/add.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis, DriveFiles } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Emojis, DriveFiles } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; import { getConnection } from 'typeorm'; -import { insertModerationLog } from '../../../../../services/insert-moderation-log'; -import { ApiError } from '../../../error'; -import { ID } from '@/misc/cafy-id'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { ApiError } from '../../../error.js'; +import { ID } from '@/misc/cafy-id.js'; import rndstr from 'rndstr'; -import { publishBroadcastStream } from '../../../../../services/stream'; +import { publishBroadcastStream } from '@/services/stream.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/copy.ts b/src/server/api/endpoints/admin/emoji/copy.ts index 72c2b014a..4c5f7bf36 100644 --- a/src/server/api/endpoints/admin/emoji/copy.ts +++ b/src/server/api/endpoints/admin/emoji/copy.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../../define.js'; +import { Emojis } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; import { getConnection } from 'typeorm'; -import { ApiError } from '../../../error'; -import { DriveFile } from '../../../../../models/entities/drive-file'; -import { ID } from '@/misc/cafy-id'; -import uploadFromUrl from '../../../../../services/drive/upload-from-url'; -import { publishBroadcastStream } from '@/services/stream'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { ID } from '@/misc/cafy-id.js'; +import uploadFromUrl from '@/services/drive/upload-from-url.js'; +import { publishBroadcastStream } from '@/services/stream.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/list-remote.ts b/src/server/api/endpoints/admin/emoji/list-remote.ts index 570db064e..cc284123b 100644 --- a/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis } from '../../../../../models'; -import { toPuny } from '@/misc/convert-host'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; +import define from '../../../define.js'; +import { Emojis } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/list.ts b/src/server/api/endpoints/admin/emoji/list.ts index b864fed4b..da72ac13e 100644 --- a/src/server/api/endpoints/admin/emoji/list.ts +++ b/src/server/api/endpoints/admin/emoji/list.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Emojis } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; -import { ID } from '@/misc/cafy-id'; -import { Emoji } from '../../../../../models/entities/emoji'; +import define from '../../../define.js'; +import { Emojis } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Emoji } from '@/models/entities/emoji.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/remove.ts b/src/server/api/endpoints/admin/emoji/remove.ts index 22bbc76e7..d81c0b9bb 100644 --- a/src/server/api/endpoints/admin/emoji/remove.ts +++ b/src/server/api/endpoints/admin/emoji/remove.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Emojis } from '../../../../../models'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Emojis } from '@/models/index.js'; import { getConnection } from 'typeorm'; -import { insertModerationLog } from '../../../../../services/insert-moderation-log'; -import { ApiError } from '../../../error'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/emoji/update.ts b/src/server/api/endpoints/admin/emoji/update.ts index 70589d5cf..912c96c7d 100644 --- a/src/server/api/endpoints/admin/emoji/update.ts +++ b/src/server/api/endpoints/admin/emoji/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { Emojis } from '../../../../../models'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Emojis } from '@/models/index.js'; import { getConnection } from 'typeorm'; -import { ApiError } from '../../../error'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/delete-all-files.ts b/src/server/api/endpoints/admin/federation/delete-all-files.ts index eef53cd92..f32c6b977 100644 --- a/src/server/api/endpoints/admin/federation/delete-all-files.ts +++ b/src/server/api/endpoints/admin/federation/delete-all-files.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { deleteFile } from '../../../../../services/drive/delete-file'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index 65b3b6e26..125be42e8 100644 --- a/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Instances } from '../../../../../models'; -import { toPuny } from '@/misc/convert-host'; -import { fetchInstanceMetadata } from '../../../../../services/fetch-instance-metadata'; +import define from '../../../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 = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/remove-all-following.ts b/src/server/api/endpoints/admin/federation/remove-all-following.ts index e59319355..6b3d621c8 100644 --- a/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import deleteFollowing from '../../../../../services/following/delete'; -import { Followings, Users } from '../../../../../models'; +import define from '../../../define.js'; +import deleteFollowing from '@/services/following/delete.js'; +import { Followings, Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/federation/update-instance.ts b/src/server/api/endpoints/admin/federation/update-instance.ts index 2d559e43e..b5f13027a 100644 --- a/src/server/api/endpoints/admin/federation/update-instance.ts +++ b/src/server/api/endpoints/admin/federation/update-instance.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Instances } from '../../../../../models'; -import { toPuny } from '@/misc/convert-host'; +import define from '../../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/get-index-stats.ts b/src/server/api/endpoints/admin/get-index-stats.ts index f2b06d0ef..e7e8d0b21 100644 --- a/src/server/api/endpoints/admin/get-index-stats.ts +++ b/src/server/api/endpoints/admin/get-index-stats.ts @@ -1,4 +1,4 @@ -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/admin/get-table-stats.ts b/src/server/api/endpoints/admin/get-table-stats.ts index bce813232..c7f2a614b 100644 --- a/src/server/api/endpoints/admin/get-table-stats.ts +++ b/src/server/api/endpoints/admin/get-table-stats.ts @@ -1,4 +1,4 @@ -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/admin/invite.ts b/src/server/api/endpoints/admin/invite.ts index 141f27d95..0a63b69ee 100644 --- a/src/server/api/endpoints/admin/invite.ts +++ b/src/server/api/endpoints/admin/invite.ts @@ -1,7 +1,7 @@ import rndstr from 'rndstr'; -import define from '../../define'; -import { RegistrationTickets } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import define from '../../define.js'; +import { RegistrationTickets } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/logs.ts b/src/server/api/endpoints/admin/logs.ts index 1ec732039..e0d97b4ab 100644 --- a/src/server/api/endpoints/admin/logs.ts +++ b/src/server/api/endpoints/admin/logs.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Logs } from '../../../../models'; +import define from '../../define.js'; +import { Logs } from '@/models/index.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/admin/moderators/add.ts b/src/server/api/endpoints/admin/moderators/add.ts index 2b4e8a801..bff9b6335 100644 --- a/src/server/api/endpoints/admin/moderators/add.ts +++ b/src/server/api/endpoints/admin/moderators/add.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/moderators/remove.ts b/src/server/api/endpoints/admin/moderators/remove.ts index fd6e29df5..cacb788b4 100644 --- a/src/server/api/endpoints/admin/moderators/remove.ts +++ b/src/server/api/endpoints/admin/moderators/remove.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/promo/create.ts b/src/server/api/endpoints/admin/promo/create.ts index 8468ab654..faba458fe 100644 --- a/src/server/api/endpoints/admin/promo/create.ts +++ b/src/server/api/endpoints/admin/promo/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { PromoNotes } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { PromoNotes } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/clear.ts b/src/server/api/endpoints/admin/queue/clear.ts index 0375f55f0..4bab2f20c 100644 --- a/src/server/api/endpoints/admin/queue/clear.ts +++ b/src/server/api/endpoints/admin/queue/clear.ts @@ -1,6 +1,6 @@ -import define from '../../../define'; -import { destroy } from '../../../../../queue'; -import { insertModerationLog } from '../../../../../services/insert-moderation-log'; +import define from '../../../define.js'; +import { destroy } from '@/queue/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/deliver-delayed.ts b/src/server/api/endpoints/admin/queue/deliver-delayed.ts index cd7b64098..ed3422810 100644 --- a/src/server/api/endpoints/admin/queue/deliver-delayed.ts +++ b/src/server/api/endpoints/admin/queue/deliver-delayed.ts @@ -1,6 +1,6 @@ -import { deliverQueue } from '@/queue/queues'; +import { deliverQueue } from '@/queue/queues.js'; import { URL } from 'url'; -import define from '../../../define'; +import define from '../../../define.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/inbox-delayed.ts b/src/server/api/endpoints/admin/queue/inbox-delayed.ts index 119976c68..8870722f2 100644 --- a/src/server/api/endpoints/admin/queue/inbox-delayed.ts +++ b/src/server/api/endpoints/admin/queue/inbox-delayed.ts @@ -1,6 +1,6 @@ import { URL } from 'url'; -import define from '../../../define'; -import { inboxQueue } from '../../../../../queue'; +import define from '../../../define.js'; +import { inboxQueue } from '@/queue/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/jobs.ts b/src/server/api/endpoints/admin/queue/jobs.ts index c426e5f39..164379f72 100644 --- a/src/server/api/endpoints/admin/queue/jobs.ts +++ b/src/server/api/endpoints/admin/queue/jobs.ts @@ -1,6 +1,6 @@ -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues.js'; import $ from 'cafy'; -import define from '../../../define'; +import define from '../../../define.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/queue/stats.ts b/src/server/api/endpoints/admin/queue/stats.ts index 38f18459d..60a3416c3 100644 --- a/src/server/api/endpoints/admin/queue/stats.ts +++ b/src/server/api/endpoints/admin/queue/stats.ts @@ -1,5 +1,5 @@ -import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues'; -import define from '../../../define'; +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues.js'; +import define from '../../../define.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/relays/add.ts b/src/server/api/endpoints/admin/relays/add.ts index 54d292ad5..e3b9a8afc 100644 --- a/src/server/api/endpoints/admin/relays/add.ts +++ b/src/server/api/endpoints/admin/relays/add.ts @@ -1,8 +1,8 @@ import { URL } from 'url'; import $ from 'cafy'; -import define from '../../../define'; -import { addRelay } from '../../../../../services/relay'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { addRelay } from '@/services/relay.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/relays/list.ts b/src/server/api/endpoints/admin/relays/list.ts index 9f2474f10..1707b8cd3 100644 --- a/src/server/api/endpoints/admin/relays/list.ts +++ b/src/server/api/endpoints/admin/relays/list.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { listRelay } from '../../../../../services/relay'; +import define from '../../../define.js'; +import { listRelay } from '@/services/relay.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/relays/remove.ts b/src/server/api/endpoints/admin/relays/remove.ts index 220efab40..406257fdf 100644 --- a/src/server/api/endpoints/admin/relays/remove.ts +++ b/src/server/api/endpoints/admin/relays/remove.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { removeRelay } from '../../../../../services/relay'; +import define from '../../../define.js'; +import { removeRelay } from '@/services/relay.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/reset-password.ts b/src/server/api/endpoints/admin/reset-password.ts index 6ff49d83d..0bc32e07a 100644 --- a/src/server/api/endpoints/admin/reset-password.ts +++ b/src/server/api/endpoints/admin/reset-password.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; import * as bcrypt from 'bcryptjs'; import rndstr from 'rndstr'; -import { Users, UserProfiles } from '../../../../models'; +import { Users, UserProfiles } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/resolve-abuse-user-report.ts b/src/server/api/endpoints/admin/resolve-abuse-user-report.ts index 38a5e8137..4c7ef3792 100644 --- a/src/server/api/endpoints/admin/resolve-abuse-user-report.ts +++ b/src/server/api/endpoints/admin/resolve-abuse-user-report.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { AbuseUserReports } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { AbuseUserReports } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/resync-chart.ts b/src/server/api/endpoints/admin/resync-chart.ts index 84e19d37e..613cdbdfa 100644 --- a/src/server/api/endpoints/admin/resync-chart.ts +++ b/src/server/api/endpoints/admin/resync-chart.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { driveChart, notesChart, usersChart, instanceChart } from '../../../../services/chart'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import define from '../../define.js'; +import { driveChart, notesChart, usersChart, instanceChart } from '@/services/chart/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/send-email.ts b/src/server/api/endpoints/admin/send-email.ts index c0e77e162..353add59b 100644 --- a/src/server/api/endpoints/admin/send-email.ts +++ b/src/server/api/endpoints/admin/send-email.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { sendEmail } from '../../../../services/send-email'; +import define from '../../define.js'; +import { sendEmail } from '@/services/send-email.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/server-info.ts b/src/server/api/endpoints/admin/server-info.ts index bb2d35e39..daac6395e 100644 --- a/src/server/api/endpoints/admin/server-info.ts +++ b/src/server/api/endpoints/admin/server-info.ts @@ -1,8 +1,8 @@ import * as os from 'os'; import * as si from 'systeminformation'; import { getConnection } from 'typeorm'; -import define from '../../define'; -import { redisClient } from '../../../../db/redis'; +import define from '../../define.js'; +import { redisClient } from '../../../../db/redis.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/admin/show-moderation-logs.ts b/src/server/api/endpoints/admin/show-moderation-logs.ts index cfceab946..833c49ee6 100644 --- a/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ModerationLogs } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ModerationLogs } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/show-user.ts b/src/server/api/endpoints/admin/show-user.ts index b1132ac20..e4935fe90 100644 --- a/src/server/api/endpoints/admin/show-user.ts +++ b/src/server/api/endpoints/admin/show-user.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/show-users.ts b/src/server/api/endpoints/admin/show-users.ts index 7ea0e0e86..0ac2112f4 100644 --- a/src/server/api/endpoints/admin/show-users.ts +++ b/src/server/api/endpoints/admin/show-users.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users } from '../../../../models'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/silence-user.ts b/src/server/api/endpoints/admin/silence-user.ts index 73f9d03b7..0a2b080aa 100644 --- a/src/server/api/endpoints/admin/silence-user.ts +++ b/src/server/api/endpoints/admin/silence-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/suspend-user.ts b/src/server/api/endpoints/admin/suspend-user.ts index 912d6a516..8026b9ec8 100644 --- a/src/server/api/endpoints/admin/suspend-user.ts +++ b/src/server/api/endpoints/admin/suspend-user.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import deleteFollowing from '../../../../services/following/delete'; -import { Users, Followings, Notifications } from '../../../../models'; -import { User } from '../../../../models/entities/user'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; -import { doPostSuspend } from '../../../../services/suspend-user'; -import { publishUserEvent } from '@/services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import deleteFollowing from '@/services/following/delete.js'; +import { Users, Followings, Notifications } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { doPostSuspend } from '@/services/suspend-user.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/unsilence-user.ts b/src/server/api/endpoints/admin/unsilence-user.ts index 6083d87af..1e581df49 100644 --- a/src/server/api/endpoints/admin/unsilence-user.ts +++ b/src/server/api/endpoints/admin/unsilence-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/unsuspend-user.ts b/src/server/api/endpoints/admin/unsuspend-user.ts index 6d015b51a..e83937743 100644 --- a/src/server/api/endpoints/admin/unsuspend-user.ts +++ b/src/server/api/endpoints/admin/unsuspend-user.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; -import { doPostUnsuspend } from '../../../../services/unsuspend-user'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { doPostUnsuspend } from '@/services/unsuspend-user.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index 573f22822..2d34b5a21 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; -import { Meta } from '../../../../models/entities/meta'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; -import { ID } from '@/misc/cafy-id'; +import { Meta } from '@/models/entities/meta.js'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; +import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/admin/vacuum.ts b/src/server/api/endpoints/admin/vacuum.ts index e041e6543..9ff9711a0 100644 --- a/src/server/api/endpoints/admin/vacuum.ts +++ b/src/server/api/endpoints/admin/vacuum.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; +import define from '../../define.js'; import { getConnection } from 'typeorm'; -import { insertModerationLog } from '../../../../services/insert-moderation-log'; +import { insertModerationLog } from '@/services/insert-moderation-log.js'; export const meta = { tags: ['admin'], diff --git a/src/server/api/endpoints/announcements.ts b/src/server/api/endpoints/announcements.ts index 124682909..83a8b3a71 100644 --- a/src/server/api/endpoints/announcements.ts +++ b/src/server/api/endpoints/announcements.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../define'; -import { Announcements, AnnouncementReads } from '../../../models'; -import { makePaginationQuery } from '../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../define.js'; +import { Announcements, AnnouncementReads } from '@/models/index.js'; +import { makePaginationQuery } from '../common/make-pagination-query.js'; export const meta = { tags: ['meta'], diff --git a/src/server/api/endpoints/antennas/create.ts b/src/server/api/endpoints/antennas/create.ts index bff3c09f1..2310ee6d5 100644 --- a/src/server/api/endpoints/antennas/create.ts +++ b/src/server/api/endpoints/antennas/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../define'; -import { genId } from '@/misc/gen-id'; -import { Antennas, UserLists, UserGroupJoinings } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { ApiError } from '../../error'; -import { publishInternalEvent } from '../../../../services/stream'; +import define from '../../define.js'; +import { genId } from '@/misc/gen-id.js'; +import { Antennas, UserLists, UserGroupJoinings } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { ApiError } from '../../error.js'; +import { publishInternalEvent } from '@/services/stream.js'; export const meta = { tags: ['antennas'], diff --git a/src/server/api/endpoints/antennas/delete.ts b/src/server/api/endpoints/antennas/delete.ts index 10a212897..59a29a951 100644 --- a/src/server/api/endpoints/antennas/delete.ts +++ b/src/server/api/endpoints/antennas/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Antennas } from '../../../../models'; -import { publishInternalEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Antennas } from '@/models/index.js'; +import { publishInternalEvent } from '@/services/stream.js'; export const meta = { tags: ['antennas'], diff --git a/src/server/api/endpoints/antennas/list.ts b/src/server/api/endpoints/antennas/list.ts index 6ae3c0cbb..eceec945a 100644 --- a/src/server/api/endpoints/antennas/list.ts +++ b/src/server/api/endpoints/antennas/list.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Antennas } from '../../../../models'; +import define from '../../define.js'; +import { Antennas } from '@/models/index.js'; export const meta = { tags: ['antennas', 'account'], diff --git a/src/server/api/endpoints/antennas/notes.ts b/src/server/api/endpoints/antennas/notes.ts index aadb4261e..11f69f354 100644 --- a/src/server/api/endpoints/antennas/notes.ts +++ b/src/server/api/endpoints/antennas/notes.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Antennas, Notes, AntennaNotes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { ApiError } from '../../error'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Antennas, Notes, AntennaNotes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { ApiError } from '../../error.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['antennas', 'account', 'notes'], diff --git a/src/server/api/endpoints/antennas/show.ts b/src/server/api/endpoints/antennas/show.ts index 36045e47a..0d9a716bf 100644 --- a/src/server/api/endpoints/antennas/show.ts +++ b/src/server/api/endpoints/antennas/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Antennas } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Antennas } from '@/models/index.js'; export const meta = { tags: ['antennas', 'account'], diff --git a/src/server/api/endpoints/antennas/update.ts b/src/server/api/endpoints/antennas/update.ts index 9194c1479..37f3b0164 100644 --- a/src/server/api/endpoints/antennas/update.ts +++ b/src/server/api/endpoints/antennas/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Antennas, UserLists, UserGroupJoinings } from '../../../../models'; -import { publishInternalEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Antennas, UserLists, UserGroupJoinings } from '@/models/index.js'; +import { publishInternalEvent } from '@/services/stream.js'; export const meta = { tags: ['antennas'], diff --git a/src/server/api/endpoints/ap/get.ts b/src/server/api/endpoints/ap/get.ts index f2b4c2408..33734b7cb 100644 --- a/src/server/api/endpoints/ap/get.ts +++ b/src/server/api/endpoints/ap/get.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import Resolver from '../../../../remote/activitypub/resolver'; -import { ApiError } from '../../error'; +import define from '../../define.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/ap/show.ts b/src/server/api/endpoints/ap/show.ts index 7f61055bf..0472d28a6 100644 --- a/src/server/api/endpoints/ap/show.ts +++ b/src/server/api/endpoints/ap/show.ts @@ -1,16 +1,16 @@ import $ from 'cafy'; -import define from '../../define'; -import config from '@/config'; -import { createPerson } from '../../../../remote/activitypub/models/person'; -import { createNote } from '../../../../remote/activitypub/models/note'; -import Resolver from '../../../../remote/activitypub/resolver'; -import { ApiError } from '../../error'; -import { extractDbHost } from '@/misc/convert-host'; -import { Users, Notes } from '../../../../models'; -import { Note } from '../../../../models/entities/note'; -import { User } from '../../../../models/entities/user'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { isActor, isPost, getApId } from '../../../../remote/activitypub/type'; +import define from '../../define.js'; +import config from '@/config/index.js'; +import { createPerson } from '@/remote/activitypub/models/person.js'; +import { createNote } from '@/remote/activitypub/models/note.js'; +import Resolver from '@/remote/activitypub/resolver.js'; +import { ApiError } from '../../error.js'; +import { extractDbHost } from '@/misc/convert-host.js'; +import { Users, Notes } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { isActor, isPost, getApId } from '@/remote/activitypub/type.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/app/create.ts b/src/server/api/endpoints/app/create.ts index 500567bf2..f013fa91c 100644 --- a/src/server/api/endpoints/app/create.ts +++ b/src/server/api/endpoints/app/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../define'; -import { Apps } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { unique } from '../../../../prelude/array'; -import { secureRndstr } from '@/misc/secure-rndstr'; +import define from '../../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/src/server/api/endpoints/app/show.ts b/src/server/api/endpoints/app/show.ts index 65f8c7798..919d65b12 100644 --- a/src/server/api/endpoints/app/show.ts +++ b/src/server/api/endpoints/app/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Apps } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Apps } from '@/models/index.js'; export const meta = { tags: ['app'], diff --git a/src/server/api/endpoints/auth/accept.ts b/src/server/api/endpoints/auth/accept.ts index ee0d0421c..e4fcb6dc4 100644 --- a/src/server/api/endpoints/auth/accept.ts +++ b/src/server/api/endpoints/auth/accept.ts @@ -1,10 +1,10 @@ import * as crypto from 'crypto'; import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { AuthSessions, AccessTokens, Apps } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { secureRndstr } from '@/misc/secure-rndstr'; +import define from '../../define.js'; +import { ApiError } from '../../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/src/server/api/endpoints/auth/session/generate.ts b/src/server/api/endpoints/auth/session/generate.ts index 42f9e25c7..4ea5967b0 100644 --- a/src/server/api/endpoints/auth/session/generate.ts +++ b/src/server/api/endpoints/auth/session/generate.ts @@ -1,10 +1,10 @@ import { v4 as uuid } from 'uuid'; import $ from 'cafy'; -import config from '@/config'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { Apps, AuthSessions } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import config from '@/config/index.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { Apps, AuthSessions } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/auth/session/show.ts b/src/server/api/endpoints/auth/session/show.ts index fd20884c0..420facb8f 100644 --- a/src/server/api/endpoints/auth/session/show.ts +++ b/src/server/api/endpoints/auth/session/show.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { AuthSessions } from '../../../../../models'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { AuthSessions } from '@/models/index.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/auth/session/userkey.ts b/src/server/api/endpoints/auth/session/userkey.ts index 7059aacbe..240ff57f1 100644 --- a/src/server/api/endpoints/auth/session/userkey.ts +++ b/src/server/api/endpoints/auth/session/userkey.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { Apps, AuthSessions, AccessTokens, Users } from '../../../../../models'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { Apps, AuthSessions, AccessTokens, Users } from '@/models/index.js'; export const meta = { tags: ['auth'], diff --git a/src/server/api/endpoints/blocking/create.ts b/src/server/api/endpoints/blocking/create.ts index dd976a7bf..c82b6eb92 100644 --- a/src/server/api/endpoints/blocking/create.ts +++ b/src/server/api/endpoints/blocking/create.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import create from '../../../../services/blocking/create'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Blockings, NoteWatchings, Users } from '../../../../models'; +import create from '@/services/blocking/create.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Blockings, NoteWatchings, Users } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/blocking/delete.ts b/src/server/api/endpoints/blocking/delete.ts index c69c8b14a..9d075f272 100644 --- a/src/server/api/endpoints/blocking/delete.ts +++ b/src/server/api/endpoints/blocking/delete.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import deleteBlocking from '../../../../services/blocking/delete'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Blockings, Users } from '../../../../models'; +import deleteBlocking from '@/services/blocking/delete.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Blockings, Users } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/blocking/list.ts b/src/server/api/endpoints/blocking/list.ts index db849338a..a616d0b7c 100644 --- a/src/server/api/endpoints/blocking/list.ts +++ b/src/server/api/endpoints/blocking/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Blockings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Blockings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/channels/create.ts b/src/server/api/endpoints/channels/create.ts index c6dc68faf..48348cf35 100644 --- a/src/server/api/endpoints/channels/create.ts +++ b/src/server/api/endpoints/channels/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, DriveFiles } from '../../../../models'; -import { Channel } from '../../../../models/entities/channel'; -import { genId } from '@/misc/gen-id'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, DriveFiles } from '@/models/index.js'; +import { Channel } from '@/models/entities/channel.js'; +import { genId } from '@/misc/gen-id.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/featured.ts b/src/server/api/endpoints/channels/featured.ts index abb0a19e2..7cfc33e63 100644 --- a/src/server/api/endpoints/channels/featured.ts +++ b/src/server/api/endpoints/channels/featured.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Channels } from '../../../../models'; +import define from '../../define.js'; +import { Channels } from '@/models/index.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/follow.ts b/src/server/api/endpoints/channels/follow.ts index b264f7451..37fb8ff1b 100644 --- a/src/server/api/endpoints/channels/follow.ts +++ b/src/server/api/endpoints/channels/follow.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, ChannelFollowings } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../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 = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/followed.ts b/src/server/api/endpoints/channels/followed.ts index 7f0cfe494..7fc83c933 100644 --- a/src/server/api/endpoints/channels/followed.ts +++ b/src/server/api/endpoints/channels/followed.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Channels, ChannelFollowings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Channels, ChannelFollowings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['channels', 'account'], diff --git a/src/server/api/endpoints/channels/owned.ts b/src/server/api/endpoints/channels/owned.ts index 4f538f651..2f08e5261 100644 --- a/src/server/api/endpoints/channels/owned.ts +++ b/src/server/api/endpoints/channels/owned.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Channels } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Channels } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['channels', 'account'], diff --git a/src/server/api/endpoints/channels/show.ts b/src/server/api/endpoints/channels/show.ts index d5f182da1..f2c351f55 100644 --- a/src/server/api/endpoints/channels/show.ts +++ b/src/server/api/endpoints/channels/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels } from '@/models/index.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/timeline.ts b/src/server/api/endpoints/channels/timeline.ts index 9e5ecdeeb..3032e7ee6 100644 --- a/src/server/api/endpoints/channels/timeline.ts +++ b/src/server/api/endpoints/channels/timeline.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Notes, Channels } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Notes, Channels } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; export const meta = { tags: ['notes', 'channels'], diff --git a/src/server/api/endpoints/channels/unfollow.ts b/src/server/api/endpoints/channels/unfollow.ts index 116af5033..1c2ab307a 100644 --- a/src/server/api/endpoints/channels/unfollow.ts +++ b/src/server/api/endpoints/channels/unfollow.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, ChannelFollowings } from '../../../../models'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, ChannelFollowings } from '@/models/index.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/channels/update.ts b/src/server/api/endpoints/channels/update.ts index 1495297ee..255c66430 100644 --- a/src/server/api/endpoints/channels/update.ts +++ b/src/server/api/endpoints/channels/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Channels, DriveFiles } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Channels, DriveFiles } from '@/models/index.js'; export const meta = { tags: ['channels'], diff --git a/src/server/api/endpoints/charts/active-users.ts b/src/server/api/endpoints/charts/active-users.ts index fb177e5c9..dc080d3bc 100644 --- a/src/server/api/endpoints/charts/active-users.ts +++ b/src/server/api/endpoints/charts/active-users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { activeUsersChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { activeUsersChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users'], diff --git a/src/server/api/endpoints/charts/drive.ts b/src/server/api/endpoints/charts/drive.ts index ba6556c59..5bad71a9f 100644 --- a/src/server/api/endpoints/charts/drive.ts +++ b/src/server/api/endpoints/charts/drive.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { driveChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { driveChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'drive'], diff --git a/src/server/api/endpoints/charts/federation.ts b/src/server/api/endpoints/charts/federation.ts index 46eb87ac0..83ec29002 100644 --- a/src/server/api/endpoints/charts/federation.ts +++ b/src/server/api/endpoints/charts/federation.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { federationChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { federationChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts'], diff --git a/src/server/api/endpoints/charts/hashtag.ts b/src/server/api/endpoints/charts/hashtag.ts index 5c2875ddd..12d3c2ba4 100644 --- a/src/server/api/endpoints/charts/hashtag.ts +++ b/src/server/api/endpoints/charts/hashtag.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { hashtagChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { hashtagChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'hashtags'], diff --git a/src/server/api/endpoints/charts/instance.ts b/src/server/api/endpoints/charts/instance.ts index 9375992d2..ed3f8bbe9 100644 --- a/src/server/api/endpoints/charts/instance.ts +++ b/src/server/api/endpoints/charts/instance.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { instanceChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { instanceChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts'], diff --git a/src/server/api/endpoints/charts/network.ts b/src/server/api/endpoints/charts/network.ts index d1fd40423..a4700f045 100644 --- a/src/server/api/endpoints/charts/network.ts +++ b/src/server/api/endpoints/charts/network.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { networkChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { networkChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts'], diff --git a/src/server/api/endpoints/charts/notes.ts b/src/server/api/endpoints/charts/notes.ts index 7141fe3b0..7c92a1188 100644 --- a/src/server/api/endpoints/charts/notes.ts +++ b/src/server/api/endpoints/charts/notes.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { notesChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { notesChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'notes'], diff --git a/src/server/api/endpoints/charts/user/drive.ts b/src/server/api/endpoints/charts/user/drive.ts index bacb022c8..8649ac69c 100644 --- a/src/server/api/endpoints/charts/user/drive.ts +++ b/src/server/api/endpoints/charts/user/drive.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserDriveChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserDriveChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'drive', 'users'], diff --git a/src/server/api/endpoints/charts/user/following.ts b/src/server/api/endpoints/charts/user/following.ts index ce41c231b..8905be2d9 100644 --- a/src/server/api/endpoints/charts/user/following.ts +++ b/src/server/api/endpoints/charts/user/following.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserFollowingChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserFollowingChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users', 'following'], diff --git a/src/server/api/endpoints/charts/user/notes.ts b/src/server/api/endpoints/charts/user/notes.ts index 470b7274b..9c6152fa9 100644 --- a/src/server/api/endpoints/charts/user/notes.ts +++ b/src/server/api/endpoints/charts/user/notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserNotesChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserNotesChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users', 'notes'], diff --git a/src/server/api/endpoints/charts/user/reactions.ts b/src/server/api/endpoints/charts/user/reactions.ts index 4ebe4623c..28629a025 100644 --- a/src/server/api/endpoints/charts/user/reactions.ts +++ b/src/server/api/endpoints/charts/user/reactions.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ID } from '@/misc/cafy-id'; -import { convertLog } from '../../../../../services/chart/core'; -import { perUserReactionsChart } from '../../../../../services/chart'; +import define from '../../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { convertLog } from '@/services/chart/core.js'; +import { perUserReactionsChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users', 'reactions'], diff --git a/src/server/api/endpoints/charts/users.ts b/src/server/api/endpoints/charts/users.ts index 4246a18e5..8d312e1a1 100644 --- a/src/server/api/endpoints/charts/users.ts +++ b/src/server/api/endpoints/charts/users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { convertLog } from '../../../../services/chart/core'; -import { usersChart } from '../../../../services/chart'; +import define from '../../define.js'; +import { convertLog } from '@/services/chart/core.js'; +import { usersChart } from '@/services/chart/index.js'; export const meta = { tags: ['charts', 'users'], diff --git a/src/server/api/endpoints/clips/add-note.ts b/src/server/api/endpoints/clips/add-note.ts index 3d72def4f..909d05bc8 100644 --- a/src/server/api/endpoints/clips/add-note.ts +++ b/src/server/api/endpoints/clips/add-note.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ClipNotes, Clips } from '../../../../models'; -import { ApiError } from '../../error'; -import { genId } from '@/misc/gen-id'; -import { getNote } from '../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ClipNotes, Clips } from '@/models/index.js'; +import { ApiError } from '../../error.js'; +import { genId } from '@/misc/gen-id.js'; +import { getNote } from '../../common/getters.js'; export const meta = { tags: ['account', 'notes', 'clips'], diff --git a/src/server/api/endpoints/clips/create.ts b/src/server/api/endpoints/clips/create.ts index fb2a77fe5..06286ed8e 100644 --- a/src/server/api/endpoints/clips/create.ts +++ b/src/server/api/endpoints/clips/create.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { genId } from '@/misc/gen-id'; -import { Clips } from '../../../../models'; +import define from '../../define.js'; +import { genId } from '@/misc/gen-id.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips'], diff --git a/src/server/api/endpoints/clips/delete.ts b/src/server/api/endpoints/clips/delete.ts index 20b2addb7..93e69dae3 100644 --- a/src/server/api/endpoints/clips/delete.ts +++ b/src/server/api/endpoints/clips/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Clips } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips'], diff --git a/src/server/api/endpoints/clips/list.ts b/src/server/api/endpoints/clips/list.ts index 6b90b114d..1eeac8b45 100644 --- a/src/server/api/endpoints/clips/list.ts +++ b/src/server/api/endpoints/clips/list.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Clips } from '../../../../models'; +import define from '../../define.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips', 'account'], diff --git a/src/server/api/endpoints/clips/notes.ts b/src/server/api/endpoints/clips/notes.ts index 4bece5a2c..41fa2b2bc 100644 --- a/src/server/api/endpoints/clips/notes.ts +++ b/src/server/api/endpoints/clips/notes.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ClipNotes, Clips, Notes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { ApiError } from '../../error'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ClipNotes, Clips, Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { ApiError } from '../../error.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['account', 'notes', 'clips'], diff --git a/src/server/api/endpoints/clips/show.ts b/src/server/api/endpoints/clips/show.ts index 43d271912..ab368e6a0 100644 --- a/src/server/api/endpoints/clips/show.ts +++ b/src/server/api/endpoints/clips/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Clips } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips', 'account'], diff --git a/src/server/api/endpoints/clips/update.ts b/src/server/api/endpoints/clips/update.ts index a368174e7..07a9d585c 100644 --- a/src/server/api/endpoints/clips/update.ts +++ b/src/server/api/endpoints/clips/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Clips } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Clips } from '@/models/index.js'; export const meta = { tags: ['clips'], diff --git a/src/server/api/endpoints/drive.ts b/src/server/api/endpoints/drive.ts index 2feb72ae1..6a99cd124 100644 --- a/src/server/api/endpoints/drive.ts +++ b/src/server/api/endpoints/drive.ts @@ -1,6 +1,6 @@ -import define from '../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { DriveFiles } from '../../../models'; +import define from '../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive', 'account'], diff --git a/src/server/api/endpoints/drive/files.ts b/src/server/api/endpoints/drive/files.ts index 1e821b008..60cf3eb94 100644 --- a/src/server/api/endpoints/drive/files.ts +++ b/src/server/api/endpoints/drive/files.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { DriveFiles } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/attached-notes.ts b/src/server/api/endpoints/drive/files/attached-notes.ts index dafbf30fb..5aafe0ea1 100644 --- a/src/server/api/endpoints/drive/files/attached-notes.ts +++ b/src/server/api/endpoints/drive/files/attached-notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles, Notes } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles, Notes } from '@/models/index.js'; export const meta = { tags: ['drive', 'notes'], diff --git a/src/server/api/endpoints/drive/files/check-existence.ts b/src/server/api/endpoints/drive/files/check-existence.ts index b20be4407..a53a4f7f9 100644 --- a/src/server/api/endpoints/drive/files/check-existence.ts +++ b/src/server/api/endpoints/drive/files/check-existence.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/create.ts b/src/server/api/endpoints/drive/files/create.ts index a8f6b9201..1f7b71243 100644 --- a/src/server/api/endpoints/drive/files/create.ts +++ b/src/server/api/endpoints/drive/files/create.ts @@ -1,11 +1,11 @@ import * as ms from 'ms'; import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import create from '../../../../../services/drive/add-file'; -import define from '../../../define'; -import { apiLogger } from '../../../logger'; -import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import create from '@/services/drive/add-file.js'; +import define from '../../../define.js'; +import { apiLogger } from '../../../logger.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/delete.ts b/src/server/api/endpoints/drive/files/delete.ts index 520078948..ae1381ee1 100644 --- a/src/server/api/endpoints/drive/files/delete.ts +++ b/src/server/api/endpoints/drive/files/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { deleteFile } from '../../../../../services/drive/delete-file'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { deleteFile } from '@/services/drive/delete-file.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/find-by-hash.ts b/src/server/api/endpoints/drive/files/find-by-hash.ts index ef0077392..492a7ee59 100644 --- a/src/server/api/endpoints/drive/files/find-by-hash.ts +++ b/src/server/api/endpoints/drive/files/find-by-hash.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/find.ts b/src/server/api/endpoints/drive/files/find.ts index b7f257145..724424500 100644 --- a/src/server/api/endpoints/drive/files/find.ts +++ b/src/server/api/endpoints/drive/files/find.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/drive/files/show.ts b/src/server/api/endpoints/drive/files/show.ts index 33e88fa81..7a2ea1b76 100644 --- a/src/server/api/endpoints/drive/files/show.ts +++ b/src/server/api/endpoints/drive/files/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFile } from '../../../../../models/entities/drive-file'; -import { DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/update.ts b/src/server/api/endpoints/drive/files/update.ts index 29b4ba7a4..d75da0011 100644 --- a/src/server/api/endpoints/drive/files/update.ts +++ b/src/server/api/endpoints/drive/files/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFiles, DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFiles, DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/files/upload-from-url.ts b/src/server/api/endpoints/drive/files/upload-from-url.ts index 8dfc86e66..5f0c461dc 100644 --- a/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import uploadFromUrl from '../../../../../services/drive/upload-from-url'; -import define from '../../../define'; -import { DriveFiles } from '../../../../../models'; -import { publishMainStream } from '../../../../../services/stream'; +import uploadFromUrl from '@/services/drive/upload-from-url.js'; +import define from '../../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { publishMainStream } from '@/services/stream.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders.ts b/src/server/api/endpoints/drive/folders.ts index c446d546c..5e0561d57 100644 --- a/src/server/api/endpoints/drive/folders.ts +++ b/src/server/api/endpoints/drive/folders.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { DriveFolders } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { DriveFolders } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/create.ts b/src/server/api/endpoints/drive/folders/create.ts index e39f8f2ce..5167ac0d1 100644 --- a/src/server/api/endpoints/drive/folders/create.ts +++ b/src/server/api/endpoints/drive/folders/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFolders } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/delete.ts b/src/server/api/endpoints/drive/folders/delete.ts index 253563a3e..3f2ef8f2c 100644 --- a/src/server/api/endpoints/drive/folders/delete.ts +++ b/src/server/api/endpoints/drive/folders/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { publishDriveStream } from '../../../../../services/stream'; -import { ApiError } from '../../../error'; -import { DriveFolders, DriveFiles } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { publishDriveStream } from '@/services/stream.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders, DriveFiles } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/find.ts b/src/server/api/endpoints/drive/folders/find.ts index c8e7639e6..7299dcecc 100644 --- a/src/server/api/endpoints/drive/folders/find.ts +++ b/src/server/api/endpoints/drive/folders/find.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/show.ts b/src/server/api/endpoints/drive/folders/show.ts index fe1326da7..7d46e853b 100644 --- a/src/server/api/endpoints/drive/folders/show.ts +++ b/src/server/api/endpoints/drive/folders/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/folders/update.ts b/src/server/api/endpoints/drive/folders/update.ts index 9dfe33517..6598b6a8a 100644 --- a/src/server/api/endpoints/drive/folders/update.ts +++ b/src/server/api/endpoints/drive/folders/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishDriveStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { DriveFolders } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishDriveStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { DriveFolders } from '@/models/index.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/drive/stream.ts b/src/server/api/endpoints/drive/stream.ts index ca88acf5f..da70b7b36 100644 --- a/src/server/api/endpoints/drive/stream.ts +++ b/src/server/api/endpoints/drive/stream.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { DriveFiles } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { DriveFiles } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['drive'], diff --git a/src/server/api/endpoints/endpoint.ts b/src/server/api/endpoints/endpoint.ts index 1a04d8bee..c8fb0f5f3 100644 --- a/src/server/api/endpoints/endpoint.ts +++ b/src/server/api/endpoints/endpoint.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../define'; -import endpoints from '../endpoints'; +import define from '../define.js'; +import endpoints from '../endpoints.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/endpoints.ts b/src/server/api/endpoints/endpoints.ts index f7b9757d8..cd7bf45c4 100644 --- a/src/server/api/endpoints/endpoints.ts +++ b/src/server/api/endpoints/endpoints.ts @@ -1,5 +1,5 @@ -import define from '../define'; -import endpoints from '../endpoints'; +import define from '../define.js'; +import endpoints from '../endpoints.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/federation/dns.ts b/src/server/api/endpoints/federation/dns.ts index a188f46ac..4605cd557 100644 --- a/src/server/api/endpoints/federation/dns.ts +++ b/src/server/api/endpoints/federation/dns.ts @@ -1,8 +1,8 @@ import { promises as dns } from 'dns'; import $ from 'cafy'; -import define from '../../define'; -import { Instances } from '../../../../models'; -import { toPuny } from '@/misc/convert-host'; +import define from '../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; const resolver = new dns.Resolver(); resolver.setServers(['1.1.1.1']); diff --git a/src/server/api/endpoints/federation/followers.ts b/src/server/api/endpoints/federation/followers.ts index 727eada68..1c74f4503 100644 --- a/src/server/api/endpoints/federation/followers.ts +++ b/src/server/api/endpoints/federation/followers.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/following.ts b/src/server/api/endpoints/federation/following.ts index c6bc71a98..b30f67af3 100644 --- a/src/server/api/endpoints/federation/following.ts +++ b/src/server/api/endpoints/federation/following.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/instances.ts b/src/server/api/endpoints/federation/instances.ts index 29515f0eb..f16c04f5d 100644 --- a/src/server/api/endpoints/federation/instances.ts +++ b/src/server/api/endpoints/federation/instances.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import config from '@/config'; -import define from '../../define'; -import { Instances } from '../../../../models'; -import { fetchMeta } from '@/misc/fetch-meta'; +import config from '@/config/index.js'; +import define from '../../define.js'; +import { Instances } from '@/models/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/show-instance.ts b/src/server/api/endpoints/federation/show-instance.ts index 549d7340f..d613a940a 100644 --- a/src/server/api/endpoints/federation/show-instance.ts +++ b/src/server/api/endpoints/federation/show-instance.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { Instances } from '../../../../models'; -import { toPuny } from '@/misc/convert-host'; +import define from '../../define.js'; +import { Instances } from '@/models/index.js'; +import { toPuny } from '@/misc/convert-host.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/update-remote-user.ts b/src/server/api/endpoints/federation/update-remote-user.ts index c4a6db0dd..b8a383410 100644 --- a/src/server/api/endpoints/federation/update-remote-user.ts +++ b/src/server/api/endpoints/federation/update-remote-user.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getRemoteUser } from '../../common/getters'; -import { updatePerson } from '../../../../remote/activitypub/models/person'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getRemoteUser } from '../../common/getters.js'; +import { updatePerson } from '@/remote/activitypub/models/person.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/federation/users.ts b/src/server/api/endpoints/federation/users.ts index 77d9e2e07..9c7390b68 100644 --- a/src/server/api/endpoints/federation/users.ts +++ b/src/server/api/endpoints/federation/users.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['federation'], diff --git a/src/server/api/endpoints/following/create.ts b/src/server/api/endpoints/following/create.ts index e4f9a86d9..91b49b481 100644 --- a/src/server/api/endpoints/following/create.ts +++ b/src/server/api/endpoints/following/create.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import create from '../../../../services/following/create'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Followings, Users } from '../../../../models'; +import create from '@/services/following/create.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Followings, Users } from '@/models/index.js'; export const meta = { tags: ['following', 'users'], diff --git a/src/server/api/endpoints/following/delete.ts b/src/server/api/endpoints/following/delete.ts index e164cb25c..7b2d006f4 100644 --- a/src/server/api/endpoints/following/delete.ts +++ b/src/server/api/endpoints/following/delete.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; +import { ID } from '@/misc/cafy-id.js'; import * as ms from 'ms'; -import deleteFollowing from '../../../../services/following/delete'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Followings, Users } from '../../../../models'; +import deleteFollowing from '@/services/following/delete.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Followings, Users } from '@/models/index.js'; export const meta = { tags: ['following', 'users'], diff --git a/src/server/api/endpoints/following/requests/accept.ts b/src/server/api/endpoints/following/requests/accept.ts index aa7085c53..bf3c315c3 100644 --- a/src/server/api/endpoints/following/requests/accept.ts +++ b/src/server/api/endpoints/following/requests/accept.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import acceptFollowRequest from '../../../../../services/following/requests/accept'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import acceptFollowRequest from '@/services/following/requests/accept.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/following/requests/cancel.ts b/src/server/api/endpoints/following/requests/cancel.ts index 09056f262..37e4c7309 100644 --- a/src/server/api/endpoints/following/requests/cancel.ts +++ b/src/server/api/endpoints/following/requests/cancel.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import cancelFollowRequest from '../../../../../services/following/requests/cancel'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import cancelFollowRequest from '@/services/following/requests/cancel.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/following/requests/list.ts b/src/server/api/endpoints/following/requests/list.ts index bf3bfc68f..1d6880d35 100644 --- a/src/server/api/endpoints/following/requests/list.ts +++ b/src/server/api/endpoints/following/requests/list.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { FollowRequests } from '../../../../../models'; +import define from '../../../define.js'; +import { FollowRequests } from '@/models/index.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/following/requests/reject.ts b/src/server/api/endpoints/following/requests/reject.ts index 1685a8613..5e4147354 100644 --- a/src/server/api/endpoints/following/requests/reject.ts +++ b/src/server/api/endpoints/following/requests/reject.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import rejectFollowRequest from '../../../../../services/following/requests/reject'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import rejectFollowRequest from '@/services/following/requests/reject.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; export const meta = { tags: ['following', 'account'], diff --git a/src/server/api/endpoints/gallery/featured.ts b/src/server/api/endpoints/gallery/featured.ts index d09000cc7..6e8118850 100644 --- a/src/server/api/endpoints/gallery/featured.ts +++ b/src/server/api/endpoints/gallery/featured.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { GalleryPosts } from '../../../../models'; +import define from '../../define.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/popular.ts b/src/server/api/endpoints/gallery/popular.ts index e240b14d2..6c3db479c 100644 --- a/src/server/api/endpoints/gallery/popular.ts +++ b/src/server/api/endpoints/gallery/popular.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { GalleryPosts } from '../../../../models'; +import define from '../../define.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts.ts b/src/server/api/endpoints/gallery/posts.ts index 656765d80..625070ca2 100644 --- a/src/server/api/endpoints/gallery/posts.ts +++ b/src/server/api/endpoints/gallery/posts.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { GalleryPosts } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/create.ts b/src/server/api/endpoints/gallery/posts/create.ts index ed24a45f8..e1c734517 100644 --- a/src/server/api/endpoints/gallery/posts/create.ts +++ b/src/server/api/endpoints/gallery/posts/create.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../../define'; -import { ID } from '../../../../../misc/cafy-id'; -import { DriveFiles, GalleryPosts } from '../../../../../models'; -import { genId } from '../../../../../misc/gen-id'; -import { GalleryPost } from '../../../../../models/entities/gallery-post'; -import { ApiError } from '../../../error'; -import { DriveFile } from '@/models/entities/drive-file'; +import define from '../../../define.js'; +import { ID } from '../../../../../misc/cafy-id.js'; +import { DriveFiles, GalleryPosts } from '@/models/index.js'; +import { genId } from '../../../../../misc/gen-id.js'; +import { GalleryPost } from '@/models/entities/gallery-post.js'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/delete.ts b/src/server/api/endpoints/gallery/posts/delete.ts index 8b54828b2..65819206c 100644 --- a/src/server/api/endpoints/gallery/posts/delete.ts +++ b/src/server/api/endpoints/gallery/posts/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts } from '../../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/like.ts b/src/server/api/endpoints/gallery/posts/like.ts index 3bf37c13e..80ec1b874 100644 --- a/src/server/api/endpoints/gallery/posts/like.ts +++ b/src/server/api/endpoints/gallery/posts/like.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts, GalleryLikes } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts, GalleryLikes } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/show.ts b/src/server/api/endpoints/gallery/posts/show.ts index 17628544b..777fb76e3 100644 --- a/src/server/api/endpoints/gallery/posts/show.ts +++ b/src/server/api/endpoints/gallery/posts/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts } from '@/models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/unlike.ts b/src/server/api/endpoints/gallery/posts/unlike.ts index 155949ae3..1ddafcec9 100644 --- a/src/server/api/endpoints/gallery/posts/unlike.ts +++ b/src/server/api/endpoints/gallery/posts/unlike.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { GalleryPosts, GalleryLikes } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { GalleryPosts, GalleryLikes } from '@/models/index.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/gallery/posts/update.ts b/src/server/api/endpoints/gallery/posts/update.ts index d9176ea40..5906f29e8 100644 --- a/src/server/api/endpoints/gallery/posts/update.ts +++ b/src/server/api/endpoints/gallery/posts/update.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../../define'; -import { ID } from '../../../../../misc/cafy-id'; -import { DriveFiles, GalleryPosts } from '../../../../../models'; -import { GalleryPost } from '../../../../../models/entities/gallery-post'; -import { ApiError } from '../../../error'; -import { DriveFile } from '@/models/entities/drive-file'; +import define from '../../../define.js'; +import { ID } from '../../../../../misc/cafy-id.js'; +import { DriveFiles, GalleryPosts } from '@/models/index.js'; +import { GalleryPost } from '@/models/entities/gallery-post.js'; +import { ApiError } from '../../../error.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; export const meta = { tags: ['gallery'], diff --git a/src/server/api/endpoints/games/reversi/games.ts b/src/server/api/endpoints/games/reversi/games.ts index 6ac150ef2..d62a039e1 100644 --- a/src/server/api/endpoints/games/reversi/games.ts +++ b/src/server/api/endpoints/games/reversi/games.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ReversiGames } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ReversiGames } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/games/reversi/games/show.ts b/src/server/api/endpoints/games/reversi/games/show.ts index a6fbdbaf6..02da583f4 100644 --- a/src/server/api/endpoints/games/reversi/games/show.ts +++ b/src/server/api/endpoints/games/reversi/games/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import Reversi from '../../../../../../games/reversi/core'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { ReversiGames } from '../../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import Reversi from '../../../../../../games/reversi/core.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { ReversiGames } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/games/surrender.ts b/src/server/api/endpoints/games/reversi/games/surrender.ts index 41896b4ab..371d2475f 100644 --- a/src/server/api/endpoints/games/reversi/games/surrender.ts +++ b/src/server/api/endpoints/games/reversi/games/surrender.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishReversiGameStream } from '../../../../../../services/stream'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { ReversiGames } from '../../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishReversiGameStream } from '@/services/stream.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { ReversiGames } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/invitations.ts b/src/server/api/endpoints/games/reversi/invitations.ts index 6a73bdf0c..5745ba566 100644 --- a/src/server/api/endpoints/games/reversi/invitations.ts +++ b/src/server/api/endpoints/games/reversi/invitations.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { ReversiMatchings } from '../../../../../models'; +import define from '../../../define.js'; +import { ReversiMatchings } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/match.ts b/src/server/api/endpoints/games/reversi/match.ts index 55ff9225d..e02d11f4e 100644 --- a/src/server/api/endpoints/games/reversi/match.ts +++ b/src/server/api/endpoints/games/reversi/match.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream, publishReversiStream } from '../../../../../services/stream'; -import { eighteight } from '../../../../../games/reversi/maps'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { genId } from '@/misc/gen-id'; -import { ReversiMatchings, ReversiGames } from '../../../../../models'; -import { ReversiGame } from '../../../../../models/entities/games/reversi/game'; -import { ReversiMatching } from '../../../../../models/entities/games/reversi/matching'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream, publishReversiStream } from '@/services/stream.js'; +import { eighteight } from '../../../../../games/reversi/maps.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { genId } from '@/misc/gen-id.js'; +import { ReversiMatchings, ReversiGames } from '@/models/index.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { ReversiMatching } from '@/models/entities/games/reversi/matching.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/games/reversi/match/cancel.ts b/src/server/api/endpoints/games/reversi/match/cancel.ts index 0abd4b5c8..2e5c08657 100644 --- a/src/server/api/endpoints/games/reversi/match/cancel.ts +++ b/src/server/api/endpoints/games/reversi/match/cancel.ts @@ -1,5 +1,5 @@ -import define from '../../../../define'; -import { ReversiMatchings } from '../../../../../../models'; +import define from '../../../../define.js'; +import { ReversiMatchings } from '@/models/index.js'; export const meta = { tags: ['games'], diff --git a/src/server/api/endpoints/get-online-users-count.ts b/src/server/api/endpoints/get-online-users-count.ts index a13363055..00b838ddc 100644 --- a/src/server/api/endpoints/get-online-users-count.ts +++ b/src/server/api/endpoints/get-online-users-count.ts @@ -1,7 +1,7 @@ -import { USER_ONLINE_THRESHOLD } from '@/const'; -import { Users } from '@/models'; +import { USER_ONLINE_THRESHOLD } from '@/const.js'; +import { Users } from '@/models/index.js'; import { MoreThan } from 'typeorm'; -import define from '../define'; +import define from '../define.js'; export const meta = { tags: ['meta'], diff --git a/src/server/api/endpoints/hashtags/list.ts b/src/server/api/endpoints/hashtags/list.ts index 6e37f909e..0453b0acf 100644 --- a/src/server/api/endpoints/hashtags/list.ts +++ b/src/server/api/endpoints/hashtags/list.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Hashtags } from '../../../../models'; +import define from '../../define.js'; +import { Hashtags } from '@/models/index.js'; export const meta = { tags: ['hashtags'], diff --git a/src/server/api/endpoints/hashtags/search.ts b/src/server/api/endpoints/hashtags/search.ts index 372ccd508..025023f54 100644 --- a/src/server/api/endpoints/hashtags/search.ts +++ b/src/server/api/endpoints/hashtags/search.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Hashtags } from '../../../../models'; +import define from '../../define.js'; +import { Hashtags } from '@/models/index.js'; export const meta = { tags: ['hashtags'], diff --git a/src/server/api/endpoints/hashtags/show.ts b/src/server/api/endpoints/hashtags/show.ts index 9e388ce14..50f330fef 100644 --- a/src/server/api/endpoints/hashtags/show.ts +++ b/src/server/api/endpoints/hashtags/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Hashtags } from '../../../../models'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Hashtags } from '@/models/index.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export const meta = { tags: ['hashtags'], diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index 5341c3e58..21ac69057 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -1,10 +1,10 @@ import { Brackets } from 'typeorm'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { Note } from '../../../../models/entities/note'; -import { safeForSql } from '@/misc/safe-for-sql'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { 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/src/server/api/endpoints/hashtags/users.ts b/src/server/api/endpoints/hashtags/users.ts index cecbc80cd..2ddf066e9 100644 --- a/src/server/api/endpoints/hashtags/users.ts +++ b/src/server/api/endpoints/hashtags/users.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users } from '../../../../models'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/i.ts b/src/server/api/endpoints/i.ts index c6b89124b..12b97e991 100644 --- a/src/server/api/endpoints/i.ts +++ b/src/server/api/endpoints/i.ts @@ -1,5 +1,5 @@ -import define from '../define'; -import { Users } from '../../../models'; +import define from '../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/2fa/done.ts b/src/server/api/endpoints/i/2fa/done.ts index 9a74d7675..1c1f0557d 100644 --- a/src/server/api/endpoints/i/2fa/done.ts +++ b/src/server/api/endpoints/i/2fa/done.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import * as speakeasy from 'speakeasy'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/key-done.ts b/src/server/api/endpoints/i/2fa/key-done.ts index 923a8b386..ea9976bd5 100644 --- a/src/server/api/endpoints/i/2fa/key-done.ts +++ b/src/server/api/endpoints/i/2fa/key-done.ts @@ -2,16 +2,16 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import { promisify } from 'util'; import * as cbor from 'cbor'; -import define from '../../../define'; +import define from '../../../define.js'; import { UserProfiles, UserSecurityKeys, AttestationChallenges, Users -} from '../../../../../models'; -import config from '@/config'; -import { procedures, hash } from '../../../2fa'; -import { publishMainStream } from '../../../../../services/stream'; +} from '@/models/index.js'; +import config from '@/config/index.js'; +import { procedures, hash } from '../../../2fa.js'; +import { publishMainStream } from '@/services/stream.js'; const cborDecodeFirst = promisify(cbor.decodeFirst) as any; diff --git a/src/server/api/endpoints/i/2fa/password-less.ts b/src/server/api/endpoints/i/2fa/password-less.ts index ee0a065e4..b62ba25b9 100644 --- a/src/server/api/endpoints/i/2fa/password-less.ts +++ b/src/server/api/endpoints/i/2fa/password-less.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/register-key.ts b/src/server/api/endpoints/i/2fa/register-key.ts index 75f578fc5..12e0afd93 100644 --- a/src/server/api/endpoints/i/2fa/register-key.ts +++ b/src/server/api/endpoints/i/2fa/register-key.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../../define'; -import { UserProfiles, AttestationChallenges } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles, AttestationChallenges } from '@/models/index.js'; import { promisify } from 'util'; import * as crypto from 'crypto'; -import { genId } from '@/misc/gen-id'; -import { hash } from '../../../2fa'; +import { genId } from '@/misc/gen-id.js'; +import { hash } from '../../../2fa.js'; const randomBytes = promisify(crypto.randomBytes); diff --git a/src/server/api/endpoints/i/2fa/register.ts b/src/server/api/endpoints/i/2fa/register.ts index d40997d6e..7a3a6ec4c 100644 --- a/src/server/api/endpoints/i/2fa/register.ts +++ b/src/server/api/endpoints/i/2fa/register.ts @@ -2,9 +2,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; import * as QRCode from 'qrcode'; -import config from '@/config'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import config from '@/config/index.js'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/remove-key.ts b/src/server/api/endpoints/i/2fa/remove-key.ts index 135f0eb28..2c74a8a85 100644 --- a/src/server/api/endpoints/i/2fa/remove-key.ts +++ b/src/server/api/endpoints/i/2fa/remove-key.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../../define'; -import { UserProfiles, UserSecurityKeys, Users } from '../../../../../models'; -import { publishMainStream } from '../../../../../services/stream'; +import define from '../../../define.js'; +import { UserProfiles, UserSecurityKeys, Users } from '@/models/index.js'; +import { publishMainStream } from '@/services/stream.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/2fa/unregister.ts b/src/server/api/endpoints/i/2fa/unregister.ts index e809f40c7..47f6c0f87 100644 --- a/src/server/api/endpoints/i/2fa/unregister.ts +++ b/src/server/api/endpoints/i/2fa/unregister.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../../define'; -import { UserProfiles } from '../../../../../models'; +import define from '../../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/apps.ts b/src/server/api/endpoints/i/apps.ts index 69958f1ca..3cb7038a5 100644 --- a/src/server/api/endpoints/i/apps.ts +++ b/src/server/api/endpoints/i/apps.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens } from '../../../../models'; +import define from '../../define.js'; +import { AccessTokens } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/authorized-apps.ts b/src/server/api/endpoints/i/authorized-apps.ts index 050d079d9..63cb87cf0 100644 --- a/src/server/api/endpoints/i/authorized-apps.ts +++ b/src/server/api/endpoints/i/authorized-apps.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens, Apps } from '../../../../models'; +import define from '../../define.js'; +import { AccessTokens, Apps } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/change-password.ts b/src/server/api/endpoints/i/change-password.ts index 0a8b86e66..545df032c 100644 --- a/src/server/api/endpoints/i/change-password.ts +++ b/src/server/api/endpoints/i/change-password.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../define'; -import { UserProfiles } from '../../../../models'; +import define from '../../define.js'; +import { UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/delete-account.ts b/src/server/api/endpoints/i/delete-account.ts index f5f0f32a4..02c03e5ba 100644 --- a/src/server/api/endpoints/i/delete-account.ts +++ b/src/server/api/endpoints/i/delete-account.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import define from '../../define'; -import { Users, UserProfiles } from '../../../../models'; -import { doPostSuspend } from '../../../../services/suspend-user'; -import { publishUserEvent } from '@/services/stream'; +import define from '../../define.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { doPostSuspend } from '@/services/suspend-user.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/export-blocking.ts b/src/server/api/endpoints/i/export-blocking.ts index 87cf7655b..219fbb1ef 100644 --- a/src/server/api/endpoints/i/export-blocking.ts +++ b/src/server/api/endpoints/i/export-blocking.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportBlockingJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportBlockingJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-following.ts b/src/server/api/endpoints/i/export-following.ts index 9afc96a24..2d6a8c2e3 100644 --- a/src/server/api/endpoints/i/export-following.ts +++ b/src/server/api/endpoints/i/export-following.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportFollowingJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportFollowingJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-mute.ts b/src/server/api/endpoints/i/export-mute.ts index 7bb24f8f8..a96ca1d5b 100644 --- a/src/server/api/endpoints/i/export-mute.ts +++ b/src/server/api/endpoints/i/export-mute.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportMuteJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportMuteJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-notes.ts b/src/server/api/endpoints/i/export-notes.ts index 368a34051..ff8e02a01 100644 --- a/src/server/api/endpoints/i/export-notes.ts +++ b/src/server/api/endpoints/i/export-notes.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportNotesJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportNotesJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/export-user-lists.ts b/src/server/api/endpoints/i/export-user-lists.ts index e1de59f32..4554e512d 100644 --- a/src/server/api/endpoints/i/export-user-lists.ts +++ b/src/server/api/endpoints/i/export-user-lists.ts @@ -1,6 +1,6 @@ -import define from '../../define'; -import { createExportUserListsJob } from '../../../../queue'; -import ms = require('ms'); +import define from '../../define.js'; +import { createExportUserListsJob } from '@/queue/index.js'; +import * as ms from 'ms'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/favorites.ts b/src/server/api/endpoints/i/favorites.ts index eb97e8bab..99ce45e9b 100644 --- a/src/server/api/endpoints/i/favorites.ts +++ b/src/server/api/endpoints/i/favorites.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { NoteFavorites } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { NoteFavorites } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'notes', 'favorites'], diff --git a/src/server/api/endpoints/i/gallery/likes.ts b/src/server/api/endpoints/i/gallery/likes.ts index e569261fa..0ddcdad5b 100644 --- a/src/server/api/endpoints/i/gallery/likes.ts +++ b/src/server/api/endpoints/i/gallery/likes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { GalleryLikes } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { GalleryLikes } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'gallery'], diff --git a/src/server/api/endpoints/i/gallery/posts.ts b/src/server/api/endpoints/i/gallery/posts.ts index d7c2e96c1..74518c792 100644 --- a/src/server/api/endpoints/i/gallery/posts.ts +++ b/src/server/api/endpoints/i/gallery/posts.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { GalleryPosts } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { GalleryPosts } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'gallery'], diff --git a/src/server/api/endpoints/i/get-word-muted-notes-count.ts b/src/server/api/endpoints/i/get-word-muted-notes-count.ts index a69ebc286..a18a5c779 100644 --- a/src/server/api/endpoints/i/get-word-muted-notes-count.ts +++ b/src/server/api/endpoints/i/get-word-muted-notes-count.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { MutedNotes } from '../../../../models'; +import define from '../../define.js'; +import { MutedNotes } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/import-following.ts b/src/server/api/endpoints/i/import-following.ts index 034955107..bb4558cc5 100644 --- a/src/server/api/endpoints/i/import-following.ts +++ b/src/server/api/endpoints/i/import-following.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { createImportFollowingJob } from '../../../../queue'; -import ms = require('ms'); -import { ApiError } from '../../error'; -import { DriveFiles } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { createImportFollowingJob } from '@/queue/index.js'; +import * as ms from 'ms'; +import { ApiError } from '../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/import-user-lists.ts b/src/server/api/endpoints/i/import-user-lists.ts index f40eb2745..99465b1fe 100644 --- a/src/server/api/endpoints/i/import-user-lists.ts +++ b/src/server/api/endpoints/i/import-user-lists.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { createImportUserListsJob } from '../../../../queue'; -import ms = require('ms'); -import { ApiError } from '../../error'; -import { DriveFiles } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { createImportUserListsJob } from '@/queue/index.js'; +import * as ms from 'ms'; +import { ApiError } from '../../error.js'; +import { DriveFiles } from '@/models/index.js'; export const meta = { secure: true, diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts index a16766c92..fb7fcea57 100644 --- a/src/server/api/endpoints/i/notifications.ts +++ b/src/server/api/endpoints/i/notifications.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { readNotification } from '../../common/read-notification'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notifications, Followings, Mutings, Users } from '../../../../models'; -import { notificationTypes } from '../../../../types'; -import read from '@/services/note/read'; +import { ID } from '@/misc/cafy-id.js'; +import { readNotification } from '../../common/read-notification.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notifications, Followings, Mutings, Users } from '@/models/index.js'; +import { notificationTypes } from '../../../../types.js'; +import read from '@/services/note/read.js'; export const meta = { tags: ['account', 'notifications'], diff --git a/src/server/api/endpoints/i/page-likes.ts b/src/server/api/endpoints/i/page-likes.ts index bb4149969..231b029b2 100644 --- a/src/server/api/endpoints/i/page-likes.ts +++ b/src/server/api/endpoints/i/page-likes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { PageLikes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { PageLikes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'pages'], diff --git a/src/server/api/endpoints/i/pages.ts b/src/server/api/endpoints/i/pages.ts index 981686adb..154721219 100644 --- a/src/server/api/endpoints/i/pages.ts +++ b/src/server/api/endpoints/i/pages.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Pages } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Pages } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'pages'], diff --git a/src/server/api/endpoints/i/pin.ts b/src/server/api/endpoints/i/pin.ts index e1e065899..689e1ae64 100644 --- a/src/server/api/endpoints/i/pin.ts +++ b/src/server/api/endpoints/i/pin.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { addPinned } from '../../../../services/i/pin'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { addPinned } from '@/services/i/pin.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['account', 'notes'], diff --git a/src/server/api/endpoints/i/read-all-messaging-messages.ts b/src/server/api/endpoints/i/read-all-messaging-messages.ts index dd26a10a7..fe0e6e558 100644 --- a/src/server/api/endpoints/i/read-all-messaging-messages.ts +++ b/src/server/api/endpoints/i/read-all-messaging-messages.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { MessagingMessages, UserGroupJoinings } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { MessagingMessages, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['account', 'messaging'], diff --git a/src/server/api/endpoints/i/read-all-unread-notes.ts b/src/server/api/endpoints/i/read-all-unread-notes.ts index 64469a2ad..635c483b7 100644 --- a/src/server/api/endpoints/i/read-all-unread-notes.ts +++ b/src/server/api/endpoints/i/read-all-unread-notes.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { NoteUnreads } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { NoteUnreads } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/read-announcement.ts b/src/server/api/endpoints/i/read-announcement.ts index 0f58b823f..6a1050c05 100644 --- a/src/server/api/endpoints/i/read-announcement.ts +++ b/src/server/api/endpoints/i/read-announcement.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { genId } from '@/misc/gen-id'; -import { AnnouncementReads, Announcements, Users } from '../../../../models'; -import { publishMainStream } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../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 = { tags: ['account'], diff --git a/src/server/api/endpoints/i/regenerate-token.ts b/src/server/api/endpoints/i/regenerate-token.ts index 3665ed053..af22d5377 100644 --- a/src/server/api/endpoints/i/regenerate-token.ts +++ b/src/server/api/endpoints/i/regenerate-token.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import { publishMainStream, publishUserEvent } from '../../../../services/stream'; -import generateUserToken from '../../common/generate-native-user-token'; -import define from '../../define'; -import { Users, UserProfiles } from '../../../../models'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import generateUserToken from '../../common/generate-native-user-token.js'; +import define from '../../define.js'; +import { Users, UserProfiles } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/get-all.ts b/src/server/api/endpoints/i/registry/get-all.ts index ce8653f22..6d5a4ec31 100644 --- a/src/server/api/endpoints/i/registry/get-all.ts +++ b/src/server/api/endpoints/i/registry/get-all.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/get-detail.ts b/src/server/api/endpoints/i/registry/get-detail.ts index 441833d3d..81a81b021 100644 --- a/src/server/api/endpoints/i/registry/get-detail.ts +++ b/src/server/api/endpoints/i/registry/get-detail.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/get.ts b/src/server/api/endpoints/i/registry/get.ts index 275e660cb..8bdec7986 100644 --- a/src/server/api/endpoints/i/registry/get.ts +++ b/src/server/api/endpoints/i/registry/get.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/keys-with-type.ts b/src/server/api/endpoints/i/registry/keys-with-type.ts index 06d77acbe..1aeba71fe 100644 --- a/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/keys.ts b/src/server/api/endpoints/i/registry/keys.ts index e4dd5044b..1c3836d7a 100644 --- a/src/server/api/endpoints/i/registry/keys.ts +++ b/src/server/api/endpoints/i/registry/keys.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/remove.ts b/src/server/api/endpoints/i/registry/remove.ts index 4f04d653b..64cf5fbb7 100644 --- a/src/server/api/endpoints/i/registry/remove.ts +++ b/src/server/api/endpoints/i/registry/remove.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { ApiError } from '../../../error'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { ApiError } from '../../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/scopes.ts b/src/server/api/endpoints/i/registry/scopes.ts index baf3ebdec..094dfbef8 100644 --- a/src/server/api/endpoints/i/registry/scopes.ts +++ b/src/server/api/endpoints/i/registry/scopes.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/registry/set.ts b/src/server/api/endpoints/i/registry/set.ts index 40f636801..099ccd27b 100644 --- a/src/server/api/endpoints/i/registry/set.ts +++ b/src/server/api/endpoints/i/registry/set.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { RegistryItems } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { RegistryItems } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/revoke-token.ts b/src/server/api/endpoints/i/revoke-token.ts index d22d9ca69..3f3a2fa93 100644 --- a/src/server/api/endpoints/i/revoke-token.ts +++ b/src/server/api/endpoints/i/revoke-token.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { publishUserEvent } from '@/services/stream'; +import define from '../../define.js'; +import { AccessTokens } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/signin-history.ts b/src/server/api/endpoints/i/signin-history.ts index 039520614..215c7b1fc 100644 --- a/src/server/api/endpoints/i/signin-history.ts +++ b/src/server/api/endpoints/i/signin-history.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Signins } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Signins } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/unpin.ts b/src/server/api/endpoints/i/unpin.ts index fe19b2090..f8c451aa2 100644 --- a/src/server/api/endpoints/i/unpin.ts +++ b/src/server/api/endpoints/i/unpin.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { removePinned } from '../../../../services/i/pin'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { removePinned } from '@/services/i/pin.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['account', 'notes'], diff --git a/src/server/api/endpoints/i/update-email.ts b/src/server/api/endpoints/i/update-email.ts index cd0e989e5..142a7aa75 100644 --- a/src/server/api/endpoints/i/update-email.ts +++ b/src/server/api/endpoints/i/update-email.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; import rndstr from 'rndstr'; -import config from '@/config'; +import config from '@/config/index.js'; import * as ms from 'ms'; import * as bcrypt from 'bcryptjs'; -import { Users, UserProfiles } from '../../../../models'; -import { sendEmail } from '../../../../services/send-email'; -import { ApiError } from '../../error'; +import { Users, UserProfiles } from '@/models/index.js'; +import { sendEmail } from '@/services/send-email.js'; +import { ApiError } from '../../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 96955354a..e8881f94d 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -1,20 +1,20 @@ import $ from 'cafy'; import * as mfm from 'mfm-js'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream, publishUserEvent } from '../../../../services/stream'; -import acceptAllFollowRequests from '../../../../services/following/requests/accept-all'; -import { publishToFollowers } from '../../../../services/i/update'; -import define from '../../define'; -import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm'; -import { extractHashtags } from '@/misc/extract-hashtags'; +import { ID } from '@/misc/cafy-id.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 define from '../../define.js'; +import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; +import { extractHashtags } from '@/misc/extract-hashtags.js'; import * as langmap from 'langmap'; -import { updateUsertags } from '../../../../services/update-hashtag'; -import { ApiError } from '../../error'; -import { Users, DriveFiles, UserProfiles, Pages } from '../../../../models'; -import { User } from '../../../../models/entities/user'; -import { UserProfile } from '../../../../models/entities/user-profile'; -import { notificationTypes } from '../../../../types'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import { updateUsertags } from '@/services/update-hashtag.js'; +import { ApiError } from '../../error.js'; +import { Users, DriveFiles, UserProfiles, Pages } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; +import { notificationTypes } from '../../../../types.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/i/user-group-invites.ts b/src/server/api/endpoints/i/user-group-invites.ts index 623274df9..57148bac5 100644 --- a/src/server/api/endpoints/i/user-group-invites.ts +++ b/src/server/api/endpoints/i/user-group-invites.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { UserGroupInvitations } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { UserGroupInvitations } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['account', 'groups'], diff --git a/src/server/api/endpoints/messaging/history.ts b/src/server/api/endpoints/messaging/history.ts index 5f4f02455..6f098a094 100644 --- a/src/server/api/endpoints/messaging/history.ts +++ b/src/server/api/endpoints/messaging/history.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { MessagingMessage } from '../../../../models/entities/messaging-message'; -import { MessagingMessages, Mutings, UserGroupJoinings } from '../../../../models'; +import define from '../../define.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { MessagingMessages, Mutings, UserGroupJoinings } from '@/models/index.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/messaging/messages.ts b/src/server/api/endpoints/messaging/messages.ts index 087f5a7d6..3541001ae 100644 --- a/src/server/api/endpoints/messaging/messages.ts +++ b/src/server/api/endpoints/messaging/messages.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { MessagingMessages, UserGroups, UserGroupJoinings, Users } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { MessagingMessages, UserGroups, UserGroupJoinings, Users } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; import { Brackets } from 'typeorm'; -import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message'; +import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/messaging/messages/create.ts b/src/server/api/endpoints/messaging/messages/create.ts index a00513a24..c6902dc1b 100644 --- a/src/server/api/endpoints/messaging/messages/create.ts +++ b/src/server/api/endpoints/messaging/messages/create.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { MessagingMessages, DriveFiles, UserGroups, UserGroupJoinings, Blockings } from '../../../../../models'; -import { User } from '../../../../../models/entities/user'; -import { UserGroup } from '../../../../../models/entities/user-group'; -import { createMessage } from '../../../../../services/messages/create'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { MessagingMessages, DriveFiles, UserGroups, UserGroupJoinings, Blockings } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { createMessage } from '@/services/messages/create.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/messaging/messages/delete.ts b/src/server/api/endpoints/messaging/messages/delete.ts index 5e5aa5fd1..54559560c 100644 --- a/src/server/api/endpoints/messaging/messages/delete.ts +++ b/src/server/api/endpoints/messaging/messages/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; import * as ms from 'ms'; -import { ApiError } from '../../../error'; -import { MessagingMessages } from '../../../../../models'; -import { deleteMessage } from '../../../../../services/messages/delete'; +import { ApiError } from '../../../error.js'; +import { MessagingMessages } from '@/models/index.js'; +import { deleteMessage } from '@/services/messages/delete.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/messaging/messages/read.ts b/src/server/api/endpoints/messaging/messages/read.ts index b17927da3..ac822b6a3 100644 --- a/src/server/api/endpoints/messaging/messages/read.ts +++ b/src/server/api/endpoints/messaging/messages/read.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { MessagingMessages } from '../../../../../models'; -import { readUserMessagingMessage, readGroupMessagingMessage } from '../../../common/read-messaging-message'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { MessagingMessages } from '@/models/index.js'; +import { readUserMessagingMessage, readGroupMessagingMessage } from '../../../common/read-messaging-message.js'; export const meta = { tags: ['messaging'], diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 561d473d6..579e963af 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import config from '@/config'; -import define from '../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Ads, Emojis, Users } from '../../../models'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; +import config from '@/config/index.js'; +import define from '../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Ads, Emojis, Users } from '@/models/index.js'; +import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js'; import { MoreThan } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/miauth/gen-token.ts b/src/server/api/endpoints/miauth/gen-token.ts index 68ef00eb2..b026d995a 100644 --- a/src/server/api/endpoints/miauth/gen-token.ts +++ b/src/server/api/endpoints/miauth/gen-token.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { AccessTokens } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { secureRndstr } from '@/misc/secure-rndstr'; +import define from '../../define.js'; +import { AccessTokens } 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/src/server/api/endpoints/mute/create.ts b/src/server/api/endpoints/mute/create.ts index 7f018a359..5fdb21a44 100644 --- a/src/server/api/endpoints/mute/create.ts +++ b/src/server/api/endpoints/mute/create.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { genId } from '@/misc/gen-id'; -import { Mutings, NoteWatchings } from '../../../../models'; -import { Muting } from '../../../../models/entities/muting'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { genId } from '@/misc/gen-id.js'; +import { Mutings, NoteWatchings } from '@/models/index.js'; +import { Muting } from '@/models/entities/muting.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/mute/delete.ts b/src/server/api/endpoints/mute/delete.ts index bfb6a95e3..041e5df20 100644 --- a/src/server/api/endpoints/mute/delete.ts +++ b/src/server/api/endpoints/mute/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { Mutings } from '../../../../models'; -import { publishUserEvent } from '../../../../services/stream'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { Mutings } from '@/models/index.js'; +import { publishUserEvent } from '@/services/stream.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/mute/list.ts b/src/server/api/endpoints/mute/list.ts index 45952ec72..0024506eb 100644 --- a/src/server/api/endpoints/mute/list.ts +++ b/src/server/api/endpoints/mute/list.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Mutings } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Mutings } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/my/apps.ts b/src/server/api/endpoints/my/apps.ts index 908e24e1b..268408698 100644 --- a/src/server/api/endpoints/my/apps.ts +++ b/src/server/api/endpoints/my/apps.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Apps } from '../../../../models'; +import define from '../../define.js'; +import { Apps } from '@/models/index.js'; export const meta = { tags: ['account', 'app'], diff --git a/src/server/api/endpoints/notes.ts b/src/server/api/endpoints/notes.ts index fdb8bad24..6a9766d28 100644 --- a/src/server/api/endpoints/notes.ts +++ b/src/server/api/endpoints/notes.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../define'; -import { makePaginationQuery } from '../common/make-pagination-query'; -import { Notes } from '../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../define.js'; +import { makePaginationQuery } from '../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/children.ts b/src/server/api/endpoints/notes/children.ts index f4d295881..de17c32f5 100644 --- a/src/server/api/endpoints/notes/children.ts +++ b/src/server/api/endpoints/notes/children.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; import { Brackets } from 'typeorm'; -import { Notes } from '../../../../models'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { Notes } from '@/models/index.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/clips.ts b/src/server/api/endpoints/notes/clips.ts index d116370b4..c3360d6f2 100644 --- a/src/server/api/endpoints/notes/clips.ts +++ b/src/server/api/endpoints/notes/clips.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ClipNotes, Clips } from '../../../../models'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ClipNotes, Clips } from '@/models/index.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; import { In } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/notes/conversation.ts b/src/server/api/endpoints/notes/conversation.ts index 0fd10df07..adf4ca2e1 100644 --- a/src/server/api/endpoints/notes/conversation.ts +++ b/src/server/api/endpoints/notes/conversation.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getNote } from '../../common/getters'; -import { Note } from '../../../../models/entities/note'; -import { Notes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getNote } from '../../common/getters.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index 9c055683f..8c2db5213 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; import * as ms from 'ms'; import { length } from 'stringz'; -import create from '../../../../services/note/create'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; -import { User } from '../../../../models/entities/user'; -import { Users, DriveFiles, Notes, Channels, Blockings } from '../../../../models'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { Note } from '../../../../models/entities/note'; -import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits'; -import { noteVisibilities } from '../../../../types'; -import { Channel } from '../../../../models/entities/channel'; +import create from '@/services/note/create.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { ID } from '@/misc/cafy-id.js'; +import { User } from '@/models/entities/user.js'; +import { Users, DriveFiles, Notes, Channels, Blockings } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { Note } from '@/models/entities/note.js'; +import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js'; +import { noteVisibilities } from '../../../../types.js'; +import { Channel } from '@/models/entities/channel.js'; let maxNoteTextLength = 500; diff --git a/src/server/api/endpoints/notes/delete.ts b/src/server/api/endpoints/notes/delete.ts index 6a0652312..e66718001 100644 --- a/src/server/api/endpoints/notes/delete.ts +++ b/src/server/api/endpoints/notes/delete.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import deleteNote from '../../../../services/note/delete'; -import define from '../../define'; +import { ID } from '@/misc/cafy-id.js'; +import deleteNote from '@/services/note/delete.js'; +import define from '../../define.js'; import * as ms from 'ms'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { Users } from '../../../../models'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/favorites/create.ts b/src/server/api/endpoints/notes/favorites/create.ts index b77b5d48f..f406d6238 100644 --- a/src/server/api/endpoints/notes/favorites/create.ts +++ b/src/server/api/endpoints/notes/favorites/create.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { NoteFavorites } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { NoteFavorites } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['notes', 'favorites'], diff --git a/src/server/api/endpoints/notes/favorites/delete.ts b/src/server/api/endpoints/notes/favorites/delete.ts index 4a1fc71a0..624cf1894 100644 --- a/src/server/api/endpoints/notes/favorites/delete.ts +++ b/src/server/api/endpoints/notes/favorites/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { NoteFavorites } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { NoteFavorites } from '@/models/index.js'; export const meta = { tags: ['notes', 'favorites'], diff --git a/src/server/api/endpoints/notes/featured.ts b/src/server/api/endpoints/notes/featured.ts index 44c0fb23a..aa8a8c09a 100644 --- a/src/server/api/endpoints/notes/featured.ts +++ b/src/server/api/endpoints/notes/featured.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { Notes } from '../../../../models'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import define from '../../define.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { Notes } from '@/models/index.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/global-timeline.ts b/src/server/api/endpoints/notes/global-timeline.ts index 96bfde5aa..ae2408ef4 100644 --- a/src/server/api/endpoints/notes/global-timeline.ts +++ b/src/server/api/endpoints/notes/global-timeline.ts @@ -1,15 +1,15 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { activeUsersChart } from '../../../../services/chart'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts index 91a36fd0c..4bebeab99 100644 --- a/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Followings, Notes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Followings, Notes } from '@/models/index.js'; import { Brackets } from 'typeorm'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { activeUsersChart } from '../../../../services/chart'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateChannelQuery } from '../../common/generate-channel-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateChannelQuery } from '../../common/generate-channel-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts index 4f481b599..95e748fae 100644 --- a/src/server/api/endpoints/notes/local-timeline.ts +++ b/src/server/api/endpoints/notes/local-timeline.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { ApiError } from '../../error'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { ApiError } from '../../error.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; import { Brackets } from 'typeorm'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateChannelQuery } from '../../common/generate-channel-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateChannelQuery } from '../../common/generate-channel-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts index 6a2358228..f3b8eecad 100644 --- a/src/server/api/endpoints/notes/mentions.ts +++ b/src/server/api/endpoints/notes/mentions.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import read from '../../../../services/note/read'; -import { Notes, Followings } from '../../../../models'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import read from '@/services/note/read.js'; +import { Notes, Followings } from '@/models/index.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; import { Brackets } from 'typeorm'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/polls/recommendation.ts b/src/server/api/endpoints/notes/polls/recommendation.ts index af8a52739..194c2ae27 100644 --- a/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/src/server/api/endpoints/notes/polls/recommendation.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../../define'; -import { Polls, Mutings, Notes, PollVotes } from '../../../../../models'; +import define from '../../../define.js'; +import { Polls, Mutings, Notes, PollVotes } from '@/models/index.js'; import { Brackets, In } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/notes/polls/vote.ts b/src/server/api/endpoints/notes/polls/vote.ts index 6f2892960..0fde90b59 100644 --- a/src/server/api/endpoints/notes/polls/vote.ts +++ b/src/server/api/endpoints/notes/polls/vote.ts @@ -1,18 +1,18 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishNoteStream } from '../../../../../services/stream'; -import { createNotification } from '../../../../../services/create-notification'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getNote } from '../../../common/getters'; -import { deliver } from '../../../../../queue'; -import { renderActivity } from '../../../../../remote/activitypub/renderer'; -import renderVote from '../../../../../remote/activitypub/renderer/vote'; -import { deliverQuestionUpdate } from '../../../../../services/note/polls/update'; -import { PollVotes, NoteWatchings, Users, Polls, Blockings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishNoteStream } from '@/services/stream.js'; +import { createNotification } from '@/services/create-notification.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getNote } from '../../../common/getters.js'; +import { deliver } from '@/queue/index.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import renderVote from '@/remote/activitypub/renderer/vote.js'; +import { deliverQuestionUpdate } from '@/services/note/polls/update.js'; +import { PollVotes, NoteWatchings, Users, Polls, Blockings } from '@/models/index.js'; import { Not } from 'typeorm'; -import { IRemoteUser } from '../../../../../models/entities/user'; -import { genId } from '@/misc/gen-id'; +import { IRemoteUser } from '@/models/entities/user.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/reactions.ts b/src/server/api/endpoints/notes/reactions.ts index df780bfa0..a67851d3b 100644 --- a/src/server/api/endpoints/notes/reactions.ts +++ b/src/server/api/endpoints/notes/reactions.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { NoteReactions } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { NoteReactions } from '@/models/index.js'; import { DeepPartial } from 'typeorm'; -import { NoteReaction } from '../../../../models/entities/note-reaction'; +import { NoteReaction } from '@/models/entities/note-reaction.js'; export const meta = { tags: ['notes', 'reactions'], diff --git a/src/server/api/endpoints/notes/reactions/create.ts b/src/server/api/endpoints/notes/reactions/create.ts index 3243332c5..41109746f 100644 --- a/src/server/api/endpoints/notes/reactions/create.ts +++ b/src/server/api/endpoints/notes/reactions/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import createReaction from '../../../../../services/note/reaction/create'; -import define from '../../../define'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import { ID } from '@/misc/cafy-id.js'; +import createReaction from '@/services/note/reaction/create.js'; +import define from '../../../define.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['reactions', 'notes'], diff --git a/src/server/api/endpoints/notes/reactions/delete.ts b/src/server/api/endpoints/notes/reactions/delete.ts index b18cb533d..b9eaf6978 100644 --- a/src/server/api/endpoints/notes/reactions/delete.ts +++ b/src/server/api/endpoints/notes/reactions/delete.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; import * as ms from 'ms'; -import deleteReaction from '../../../../../services/note/reaction/delete'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import deleteReaction from '@/services/note/reaction/delete.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['reactions', 'notes'], diff --git a/src/server/api/endpoints/notes/renotes.ts b/src/server/api/endpoints/notes/renotes.ts index 5e3b3ccbc..b08173f24 100644 --- a/src/server/api/endpoints/notes/renotes.ts +++ b/src/server/api/endpoints/notes/renotes.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes } from '../../../../models'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/replies.ts b/src/server/api/endpoints/notes/replies.ts index 7960078c8..5a96c16fd 100644 --- a/src/server/api/endpoints/notes/replies.ts +++ b/src/server/api/endpoints/notes/replies.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Notes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/search-by-tag.ts b/src/server/api/endpoints/notes/search-by-tag.ts index 39d99baba..2c0ad7463 100644 --- a/src/server/api/endpoints/notes/search-by-tag.ts +++ b/src/server/api/endpoints/notes/search-by-tag.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; import { Brackets } from 'typeorm'; -import { safeForSql } from '@/misc/safe-for-sql'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { safeForSql } from '@/misc/safe-for-sql.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes', 'hashtags'], diff --git a/src/server/api/endpoints/notes/search.ts b/src/server/api/endpoints/notes/search.ts index 0e0eaa06a..45442c254 100644 --- a/src/server/api/endpoints/notes/search.ts +++ b/src/server/api/endpoints/notes/search.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import es from '../../../../db/elasticsearch'; -import define from '../../define'; -import { Notes } from '../../../../models'; +import es from '../../../../db/elasticsearch.js'; +import define from '../../define.js'; +import { Notes } from '@/models/index.js'; import { In } from 'typeorm'; -import { ID } from '@/misc/cafy-id'; -import config from '@/config'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { ID } from '@/misc/cafy-id.js'; +import config from '@/config/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/show.ts b/src/server/api/endpoints/notes/show.ts index fc8e30788..8387279b1 100644 --- a/src/server/api/endpoints/notes/show.ts +++ b/src/server/api/endpoints/notes/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { Notes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { Notes } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/state.ts b/src/server/api/endpoints/notes/state.ts index 8af09f07d..bd2e85ea9 100644 --- a/src/server/api/endpoints/notes/state.ts +++ b/src/server/api/endpoints/notes/state.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { NoteFavorites, NoteWatchings } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { NoteFavorites, NoteWatchings } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index 5f0340091..e1fd2d5fc 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -1,16 +1,16 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { Notes, Followings } from '../../../../models'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { Notes, Followings } from '@/models/index.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; import { Brackets } from 'typeorm'; -import { generateRepliesQuery } from '../../common/generate-replies-query'; -import { generateMutedNoteQuery } from '../../common/generate-muted-note-query'; -import { generateChannelQuery } from '../../common/generate-channel-query'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateRepliesQuery } from '../../common/generate-replies-query.js'; +import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js'; +import { generateChannelQuery } from '../../common/generate-channel-query.js'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/translate.ts b/src/server/api/endpoints/notes/translate.ts index 67c02432c..66354a2ea 100644 --- a/src/server/api/endpoints/notes/translate.ts +++ b/src/server/api/endpoints/notes/translate.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; import fetch from 'node-fetch'; -import config from '@/config'; -import { getAgentByUrl } from '@/misc/fetch'; +import config from '@/config/index.js'; +import { getAgentByUrl } from '@/misc/fetch.js'; import { URLSearchParams } from 'url'; -import { fetchMeta } from '@/misc/fetch-meta'; +import { fetchMeta } from '@/misc/fetch-meta.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/unrenote.ts b/src/server/api/endpoints/notes/unrenote.ts index 5e016f293..eec7a2151 100644 --- a/src/server/api/endpoints/notes/unrenote.ts +++ b/src/server/api/endpoints/notes/unrenote.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import deleteNote from '../../../../services/note/delete'; -import define from '../../define'; +import { ID } from '@/misc/cafy-id.js'; +import deleteNote from '@/services/note/delete.js'; +import define from '../../define.js'; import * as ms from 'ms'; -import { getNote } from '../../common/getters'; -import { ApiError } from '../../error'; -import { Notes, Users } from '../../../../models'; +import { getNote } from '../../common/getters.js'; +import { ApiError } from '../../error.js'; +import { Notes, Users } from '@/models/index.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/user-list-timeline.ts b/src/server/api/endpoints/notes/user-list-timeline.ts index e160fff25..15abaa6c2 100644 --- a/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/src/server/api/endpoints/notes/user-list-timeline.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { UserLists, UserListJoinings, Notes } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { activeUsersChart } from '../../../../services/chart'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { UserLists, UserListJoinings, Notes } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { activeUsersChart } from '@/services/chart/index.js'; import { Brackets } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/notes/watching/create.ts b/src/server/api/endpoints/notes/watching/create.ts index 74d31fe1a..1c2c1652a 100644 --- a/src/server/api/endpoints/notes/watching/create.ts +++ b/src/server/api/endpoints/notes/watching/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import watch from '../../../../../services/note/watch'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import watch from '@/services/note/watch.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notes/watching/delete.ts b/src/server/api/endpoints/notes/watching/delete.ts index a91d72be0..b418d3af2 100644 --- a/src/server/api/endpoints/notes/watching/delete.ts +++ b/src/server/api/endpoints/notes/watching/delete.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import unwatch from '../../../../../services/note/unwatch'; -import { getNote } from '../../../common/getters'; -import { ApiError } from '../../../error'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import unwatch from '@/services/note/unwatch.js'; +import { getNote } from '../../../common/getters.js'; +import { ApiError } from '../../../error.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/notifications/create.ts b/src/server/api/endpoints/notifications/create.ts index 6267699e9..5231d9011 100644 --- a/src/server/api/endpoints/notifications/create.ts +++ b/src/server/api/endpoints/notifications/create.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { createNotification } from '../../../../services/create-notification'; +import define from '../../define.js'; +import { createNotification } from '@/services/create-notification.js'; export const meta = { tags: ['notifications'], diff --git a/src/server/api/endpoints/notifications/mark-all-as-read.ts b/src/server/api/endpoints/notifications/mark-all-as-read.ts index cce54587c..d0dc7be31 100644 --- a/src/server/api/endpoints/notifications/mark-all-as-read.ts +++ b/src/server/api/endpoints/notifications/mark-all-as-read.ts @@ -1,6 +1,6 @@ -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { Notifications } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { Notifications } from '@/models/index.js'; export const meta = { tags: ['notifications', 'account'], diff --git a/src/server/api/endpoints/notifications/read.ts b/src/server/api/endpoints/notifications/read.ts index fe8e5ba44..94140db82 100644 --- a/src/server/api/endpoints/notifications/read.ts +++ b/src/server/api/endpoints/notifications/read.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { Notifications } from '../../../../models'; -import { readNotification } from '../../common/read-notification'; -import { ApiError } from '../../error'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { Notifications } from '@/models/index.js'; +import { readNotification } from '../../common/read-notification.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['notifications', 'account'], diff --git a/src/server/api/endpoints/page-push.ts b/src/server/api/endpoints/page-push.ts index 9ec9f9184..1d4830339 100644 --- a/src/server/api/endpoints/page-push.ts +++ b/src/server/api/endpoints/page-push.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../define'; -import { ID } from '@/misc/cafy-id'; -import { publishMainStream } from '../../../services/stream'; -import { Users, Pages } from '../../../models'; -import { ApiError } from '../error'; +import define from '../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { publishMainStream } from '@/services/stream.js'; +import { Users, Pages } from '@/models/index.js'; +import { ApiError } from '../error.js'; export const meta = { requireCredential: true as const, diff --git a/src/server/api/endpoints/pages/create.ts b/src/server/api/endpoints/pages/create.ts index 07e0969bd..4f8a09b02 100644 --- a/src/server/api/endpoints/pages/create.ts +++ b/src/server/api/endpoints/pages/create.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../define'; -import { ID } from '@/misc/cafy-id'; -import { Pages, DriveFiles } from '../../../../models'; -import { genId } from '@/misc/gen-id'; -import { Page } from '../../../../models/entities/page'; -import { ApiError } from '../../error'; +import define from '../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Pages, DriveFiles } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { Page } from '@/models/entities/page.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/delete.ts b/src/server/api/endpoints/pages/delete.ts index 12a3360e4..8777c65e4 100644 --- a/src/server/api/endpoints/pages/delete.ts +++ b/src/server/api/endpoints/pages/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/featured.ts b/src/server/api/endpoints/pages/featured.ts index 19802d044..68adac930 100644 --- a/src/server/api/endpoints/pages/featured.ts +++ b/src/server/api/endpoints/pages/featured.ts @@ -1,5 +1,5 @@ -import define from '../../define'; -import { Pages } from '../../../../models'; +import define from '../../define.js'; +import { Pages } from '@/models/index.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/like.ts b/src/server/api/endpoints/pages/like.ts index bed8e975e..ac0f577eb 100644 --- a/src/server/api/endpoints/pages/like.ts +++ b/src/server/api/endpoints/pages/like.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, PageLikes } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, PageLikes } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/show.ts b/src/server/api/endpoints/pages/show.ts index d4d04bccf..21084d3b9 100644 --- a/src/server/api/endpoints/pages/show.ts +++ b/src/server/api/endpoints/pages/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, Users } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { Page } from '../../../../models/entities/page'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, Users } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Page } from '@/models/entities/page.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/unlike.ts b/src/server/api/endpoints/pages/unlike.ts index a5e22a2c7..dddecccf6 100644 --- a/src/server/api/endpoints/pages/unlike.ts +++ b/src/server/api/endpoints/pages/unlike.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, PageLikes } from '../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, PageLikes } from '@/models/index.js'; export const meta = { tags: ['pages'], diff --git a/src/server/api/endpoints/pages/update.ts b/src/server/api/endpoints/pages/update.ts index 6d1ae4c6f..d1df9b08a 100644 --- a/src/server/api/endpoints/pages/update.ts +++ b/src/server/api/endpoints/pages/update.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as ms from 'ms'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Pages, DriveFiles } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Pages, DriveFiles } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; import { Not } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/ping.ts b/src/server/api/endpoints/ping.ts index 0b1bb6e16..1d342dac3 100644 --- a/src/server/api/endpoints/ping.ts +++ b/src/server/api/endpoints/ping.ts @@ -1,4 +1,4 @@ -import define from '../define'; +import define from '../define.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/pinned-users.ts b/src/server/api/endpoints/pinned-users.ts index bcef072fe..0ea5e9b39 100644 --- a/src/server/api/endpoints/pinned-users.ts +++ b/src/server/api/endpoints/pinned-users.ts @@ -1,8 +1,8 @@ -import define from '../define'; -import { Users } from '../../../models'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { parseAcct } from '@/misc/acct'; -import { User } from '../../../models/entities/user'; +import define from '../define.js'; +import { Users } from '@/models/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { parseAcct } from '@/misc/acct.js'; +import { User } from '@/models/entities/user.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/promo/read.ts b/src/server/api/endpoints/promo/read.ts index 32b543295..92a676898 100644 --- a/src/server/api/endpoints/promo/read.ts +++ b/src/server/api/endpoints/promo/read.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getNote } from '../../common/getters'; -import { PromoReads } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getNote } from '../../common/getters.js'; +import { PromoReads } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['notes'], diff --git a/src/server/api/endpoints/request-reset-password.ts b/src/server/api/endpoints/request-reset-password.ts index c880df752..754a5a1c8 100644 --- a/src/server/api/endpoints/request-reset-password.ts +++ b/src/server/api/endpoints/request-reset-password.ts @@ -1,13 +1,13 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../services/stream'; -import define from '../define'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../define.js'; import rndstr from 'rndstr'; -import config from '@/config'; +import config from '@/config/index.js'; import * as ms from 'ms'; -import { Users, UserProfiles, PasswordResetRequests } from '../../../models'; -import { sendEmail } from '../../../services/send-email'; -import { ApiError } from '../error'; -import { genId } from '@/misc/gen-id'; +import { Users, UserProfiles, PasswordResetRequests } from '@/models/index.js'; +import { sendEmail } from '@/services/send-email.js'; +import { ApiError } from '../error.js'; +import { genId } from '@/misc/gen-id.js'; import { IsNull } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/reset-db.ts b/src/server/api/endpoints/reset-db.ts index f43086930..c6ad8303f 100644 --- a/src/server/api/endpoints/reset-db.ts +++ b/src/server/api/endpoints/reset-db.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../define'; -import { ApiError } from '../error'; -import { resetDb } from '@/db/postgre'; +import define from '../define.js'; +import { ApiError } from '../error.js'; +import { resetDb } from '@/db/postgre.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/reset-password.ts b/src/server/api/endpoints/reset-password.ts index 5f79bdbd0..f32e499e0 100644 --- a/src/server/api/endpoints/reset-password.ts +++ b/src/server/api/endpoints/reset-password.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; import * as bcrypt from 'bcryptjs'; -import { publishMainStream } from '../../../services/stream'; -import define from '../define'; -import { Users, UserProfiles, PasswordResetRequests } from '../../../models'; -import { ApiError } from '../error'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../define.js'; +import { Users, UserProfiles, PasswordResetRequests } from '@/models/index.js'; +import { ApiError } from '../error.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/room/show.ts b/src/server/api/endpoints/room/show.ts index 85cd57aef..dcedde5db 100644 --- a/src/server/api/endpoints/room/show.ts +++ b/src/server/api/endpoints/room/show.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users, UserProfiles } from '../../../../models'; -import { ID } from '@/misc/cafy-id'; -import { toPunyNullable } from '@/misc/convert-host'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ID } from '@/misc/cafy-id.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; export const meta = { tags: ['room'], diff --git a/src/server/api/endpoints/room/update.ts b/src/server/api/endpoints/room/update.ts index af8b80be9..2ee44e157 100644 --- a/src/server/api/endpoints/room/update.ts +++ b/src/server/api/endpoints/room/update.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import { publishMainStream } from '../../../../services/stream'; -import define from '../../define'; -import { Users, UserProfiles } from '../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import define from '../../define.js'; +import { Users, UserProfiles } from '@/models/index.js'; export const meta = { tags: ['room'], diff --git a/src/server/api/endpoints/server-info.ts b/src/server/api/endpoints/server-info.ts index 4e636d331..23a7aabba 100644 --- a/src/server/api/endpoints/server-info.ts +++ b/src/server/api/endpoints/server-info.ts @@ -1,6 +1,6 @@ import * as os from 'os'; import * as si from 'systeminformation'; -import define from '../define'; +import define from '../define.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts index f9c17f86e..84b56c0ba 100644 --- a/src/server/api/endpoints/stats.ts +++ b/src/server/api/endpoints/stats.ts @@ -1,6 +1,6 @@ -import define from '../define'; -import { NoteReactions, Notes, Users } from '../../../models'; -import { federationChart, driveChart } from '../../../services/chart'; +import define from '../define.js'; +import { NoteReactions, Notes, Users } from '@/models/index.js'; +import { federationChart, driveChart } from '@/services/chart/index.js'; export const meta = { requireCredential: false as const, diff --git a/src/server/api/endpoints/sw/register.ts b/src/server/api/endpoints/sw/register.ts index 43d4118df..c008e6ec7 100644 --- a/src/server/api/endpoints/sw/register.ts +++ b/src/server/api/endpoints/sw/register.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { genId } from '@/misc/gen-id'; -import { SwSubscriptions } from '../../../../models'; +import define from '../../define.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { genId } from '@/misc/gen-id.js'; +import { SwSubscriptions } from '@/models/index.js'; export const meta = { tags: ['account'], diff --git a/src/server/api/endpoints/username/available.ts b/src/server/api/endpoints/username/available.ts index cd434b582..38442fdc9 100644 --- a/src/server/api/endpoints/username/available.ts +++ b/src/server/api/endpoints/username/available.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users, UsedUsernames } from '../../../../models'; +import define from '../../define.js'; +import { Users, UsedUsernames } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users.ts b/src/server/api/endpoints/users.ts index 3c30f459d..462055b28 100644 --- a/src/server/api/endpoints/users.ts +++ b/src/server/api/endpoints/users.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../define'; -import { Users } from '../../../models'; -import { generateMutedUserQueryForUsers } from '../common/generate-muted-user-query'; -import { generateBlockedUserQuery } from '../common/generate-block-query'; +import define from '../define.js'; +import { Users } from '@/models/index.js'; +import { generateMutedUserQueryForUsers } from '../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery } from '../common/generate-block-query.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/clips.ts b/src/server/api/endpoints/users/clips.ts index 12aa96403..8e53843bb 100644 --- a/src/server/api/endpoints/users/clips.ts +++ b/src/server/api/endpoints/users/clips.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Clips } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Clips } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['users', 'clips'], diff --git a/src/server/api/endpoints/users/followers.ts b/src/server/api/endpoints/users/followers.ts index c9fe36e4e..896c3ca1c 100644 --- a/src/server/api/endpoints/users/followers.ts +++ b/src/server/api/endpoints/users/followers.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users, Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { toPunyNullable } from '@/misc/convert-host'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users, Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/following.ts b/src/server/api/endpoints/users/following.ts index c3dd90ff7..ab60cc02f 100644 --- a/src/server/api/endpoints/users/following.ts +++ b/src/server/api/endpoints/users/following.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { Users, Followings } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { toPunyNullable } from '@/misc/convert-host'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { Users, Followings } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { toPunyNullable } from '@/misc/convert-host.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/gallery/posts.ts b/src/server/api/endpoints/users/gallery/posts.ts index 1da6bced5..7c5a7d1cf 100644 --- a/src/server/api/endpoints/users/gallery/posts.ts +++ b/src/server/api/endpoints/users/gallery/posts.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { GalleryPosts } from '../../../../../models'; -import { makePaginationQuery } from '../../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { GalleryPosts } from '@/models/index.js'; +import { makePaginationQuery } from '../../../common/make-pagination-query.js'; export const meta = { tags: ['users', 'gallery'], diff --git a/src/server/api/endpoints/users/get-frequently-replied-users.ts b/src/server/api/endpoints/users/get-frequently-replied-users.ts index bdfb7772a..4207aa004 100644 --- a/src/server/api/endpoints/users/get-frequently-replied-users.ts +++ b/src/server/api/endpoints/users/get-frequently-replied-users.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { maximum } from '../../../../prelude/array'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { maximum } from '../../../../prelude/array.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; import { Not, In, IsNull } from 'typeorm'; -import { Notes, Users } from '../../../../models'; +import { Notes, Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/groups/create.ts b/src/server/api/endpoints/users/groups/create.ts index 2cd0653ba..7c3d5d258 100644 --- a/src/server/api/endpoints/users/groups/create.ts +++ b/src/server/api/endpoints/users/groups/create.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import define from '../../../define'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserGroup } from '../../../../../models/entities/user-group'; -import { UserGroupJoining } from '../../../../../models/entities/user-group-joining'; +import define from '../../../define.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { UserGroupJoining } from '@/models/entities/user-group-joining.js'; export const meta = { tags: ['groups'], diff --git a/src/server/api/endpoints/users/groups/delete.ts b/src/server/api/endpoints/users/groups/delete.ts index 4c4a8c15b..71d6c615a 100644 --- a/src/server/api/endpoints/users/groups/delete.ts +++ b/src/server/api/endpoints/users/groups/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserGroups } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserGroups } from '@/models/index.js'; export const meta = { tags: ['groups'], diff --git a/src/server/api/endpoints/users/groups/invitations/accept.ts b/src/server/api/endpoints/users/groups/invitations/accept.ts index 943d15866..6eab46337 100644 --- a/src/server/api/endpoints/users/groups/invitations/accept.ts +++ b/src/server/api/endpoints/users/groups/invitations/accept.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { UserGroupJoinings, UserGroupInvitations } from '../../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserGroupJoining } from '../../../../../../models/entities/user-group-joining'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { UserGroupJoinings, UserGroupInvitations } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserGroupJoining } from '@/models/entities/user-group-joining.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/invitations/reject.ts b/src/server/api/endpoints/users/groups/invitations/reject.ts index 4bc902ae5..ff0ff58f3 100644 --- a/src/server/api/endpoints/users/groups/invitations/reject.ts +++ b/src/server/api/endpoints/users/groups/invitations/reject.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../../define'; -import { ApiError } from '../../../../error'; -import { UserGroupInvitations } from '../../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../../define.js'; +import { ApiError } from '../../../../error.js'; +import { UserGroupInvitations } from '@/models/index.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/invite.ts b/src/server/api/endpoints/users/groups/invite.ts index 688b18f69..2a4af7266 100644 --- a/src/server/api/endpoints/users/groups/invite.ts +++ b/src/server/api/endpoints/users/groups/invite.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserGroups, UserGroupJoinings, UserGroupInvitations } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserGroupInvitation } from '../../../../../models/entities/user-group-invitation'; -import { createNotification } from '../../../../../services/create-notification'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserGroups, UserGroupJoinings, UserGroupInvitations } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js'; +import { createNotification } from '@/services/create-notification.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/joined.ts b/src/server/api/endpoints/users/groups/joined.ts index b25341c85..4066c6ddc 100644 --- a/src/server/api/endpoints/users/groups/joined.ts +++ b/src/server/api/endpoints/users/groups/joined.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import define from '../../../define.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; import { Not, In } from 'typeorm'; export const meta = { diff --git a/src/server/api/endpoints/users/groups/owned.ts b/src/server/api/endpoints/users/groups/owned.ts index e0b003c9e..0111ff09d 100644 --- a/src/server/api/endpoints/users/groups/owned.ts +++ b/src/server/api/endpoints/users/groups/owned.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { UserGroups } from '../../../../../models'; +import define from '../../../define.js'; +import { UserGroups } from '@/models/index.js'; export const meta = { tags: ['groups', 'account'], diff --git a/src/server/api/endpoints/users/groups/pull.ts b/src/server/api/endpoints/users/groups/pull.ts index d93a16bd9..4e080074b 100644 --- a/src/server/api/endpoints/users/groups/pull.ts +++ b/src/server/api/endpoints/users/groups/pull.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/show.ts b/src/server/api/endpoints/users/groups/show.ts index 1b71933c2..666c159c6 100644 --- a/src/server/api/endpoints/users/groups/show.ts +++ b/src/server/api/endpoints/users/groups/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['groups', 'account'], diff --git a/src/server/api/endpoints/users/groups/transfer.ts b/src/server/api/endpoints/users/groups/transfer.ts index d6376993c..a216e8002 100644 --- a/src/server/api/endpoints/users/groups/transfer.ts +++ b/src/server/api/endpoints/users/groups/transfer.ts @@ -1,9 +1,9 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserGroups, UserGroupJoinings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserGroups, UserGroupJoinings } from '@/models/index.js'; export const meta = { tags: ['groups', 'users'], diff --git a/src/server/api/endpoints/users/groups/update.ts b/src/server/api/endpoints/users/groups/update.ts index a403152b4..c6c1b1481 100644 --- a/src/server/api/endpoints/users/groups/update.ts +++ b/src/server/api/endpoints/users/groups/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserGroups } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserGroups } from '@/models/index.js'; export const meta = { tags: ['groups'], diff --git a/src/server/api/endpoints/users/lists/create.ts b/src/server/api/endpoints/users/lists/create.ts index c52413008..89af90ea5 100644 --- a/src/server/api/endpoints/users/lists/create.ts +++ b/src/server/api/endpoints/users/lists/create.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../../define'; -import { UserLists } from '../../../../../models'; -import { genId } from '@/misc/gen-id'; -import { UserList } from '../../../../../models/entities/user-list'; +import define from '../../../define.js'; +import { UserLists } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { UserList } from '@/models/entities/user-list.js'; export const meta = { tags: ['lists'], diff --git a/src/server/api/endpoints/users/lists/delete.ts b/src/server/api/endpoints/users/lists/delete.ts index ecae5641c..d33222242 100644 --- a/src/server/api/endpoints/users/lists/delete.ts +++ b/src/server/api/endpoints/users/lists/delete.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserLists } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists'], diff --git a/src/server/api/endpoints/users/lists/list.ts b/src/server/api/endpoints/users/lists/list.ts index 154820871..f18640898 100644 --- a/src/server/api/endpoints/users/lists/list.ts +++ b/src/server/api/endpoints/users/lists/list.ts @@ -1,5 +1,5 @@ -import define from '../../../define'; -import { UserLists } from '../../../../../models'; +import define from '../../../define.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists', 'account'], diff --git a/src/server/api/endpoints/users/lists/pull.ts b/src/server/api/endpoints/users/lists/pull.ts index f8b5df0fc..db15d67d9 100644 --- a/src/server/api/endpoints/users/lists/pull.ts +++ b/src/server/api/endpoints/users/lists/pull.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import { publishUserListStream } from '../../../../../services/stream'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { UserLists, UserListJoinings, Users } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import { publishUserListStream } from '@/services/stream.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { UserLists, UserListJoinings, Users } from '@/models/index.js'; export const meta = { tags: ['lists', 'users'], diff --git a/src/server/api/endpoints/users/lists/push.ts b/src/server/api/endpoints/users/lists/push.ts index 7bb6fc7f7..266e813b1 100644 --- a/src/server/api/endpoints/users/lists/push.ts +++ b/src/server/api/endpoints/users/lists/push.ts @@ -1,10 +1,10 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { getUser } from '../../../common/getters'; -import { pushUserToUserList } from '../../../../../services/user-list/push'; -import { UserLists, UserListJoinings, Blockings } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { getUser } from '../../../common/getters.js'; +import { pushUserToUserList } from '@/services/user-list/push.js'; +import { UserLists, UserListJoinings, Blockings } from '@/models/index.js'; export const meta = { tags: ['lists', 'users'], diff --git a/src/server/api/endpoints/users/lists/show.ts b/src/server/api/endpoints/users/lists/show.ts index ff9ed001f..c3a49b747 100644 --- a/src/server/api/endpoints/users/lists/show.ts +++ b/src/server/api/endpoints/users/lists/show.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserLists } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists', 'account'], diff --git a/src/server/api/endpoints/users/lists/update.ts b/src/server/api/endpoints/users/lists/update.ts index eaa420a5b..c883ed420 100644 --- a/src/server/api/endpoints/users/lists/update.ts +++ b/src/server/api/endpoints/users/lists/update.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../../define'; -import { ApiError } from '../../../error'; -import { UserLists } from '../../../../../models'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../../define.js'; +import { ApiError } from '../../../error.js'; +import { UserLists } from '@/models/index.js'; export const meta = { tags: ['lists'], diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts index 836c3c97b..ae6d75e64 100644 --- a/src/server/api/endpoints/users/notes.ts +++ b/src/server/api/endpoints/users/notes.ts @@ -1,14 +1,14 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { makePaginationQuery } from '../../common/make-pagination-query'; -import { generateVisibilityQuery } from '../../common/generate-visibility-query'; -import { Notes } from '../../../../models'; -import { generateMutedUserQuery } from '../../common/generate-muted-user-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; +import { generateVisibilityQuery } from '../../common/generate-visibility-query.js'; +import { Notes } from '@/models/index.js'; +import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js'; import { Brackets } from 'typeorm'; -import { generateBlockedUserQuery } from '../../common/generate-block-query'; +import { generateBlockedUserQuery } from '../../common/generate-block-query.js'; export const meta = { tags: ['users', 'notes'], diff --git a/src/server/api/endpoints/users/pages.ts b/src/server/api/endpoints/users/pages.ts index b9f37f321..b27b21bac 100644 --- a/src/server/api/endpoints/users/pages.ts +++ b/src/server/api/endpoints/users/pages.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { Pages } from '../../../../models'; -import { makePaginationQuery } from '../../common/make-pagination-query'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { Pages } from '@/models/index.js'; +import { makePaginationQuery } from '../../common/make-pagination-query.js'; export const meta = { tags: ['users', 'pages'], diff --git a/src/server/api/endpoints/users/recommendation.ts b/src/server/api/endpoints/users/recommendation.ts index fba4f4f68..0c86c1336 100644 --- a/src/server/api/endpoints/users/recommendation.ts +++ b/src/server/api/endpoints/users/recommendation.ts @@ -1,9 +1,9 @@ import * as ms from 'ms'; import $ from 'cafy'; -import define from '../../define'; -import { Users, Followings } from '../../../../models'; -import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query'; -import { generateBlockedUserQuery, generateBlockQueryForUsers } from '../../common/generate-block-query'; +import define from '../../define.js'; +import { Users, Followings } from '@/models/index.js'; +import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query.js'; +import { generateBlockedUserQuery, generateBlockQueryForUsers } from '../../common/generate-block-query.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/relation.ts b/src/server/api/endpoints/users/relation.ts index 18ec5d44b..5998f2dbc 100644 --- a/src/server/api/endpoints/users/relation.ts +++ b/src/server/api/endpoints/users/relation.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { ID } from '@/misc/cafy-id'; -import { Users } from '../../../../models'; +import define from '../../define.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/report-abuse.ts b/src/server/api/endpoints/users/report-abuse.ts index 776d68370..37de2d533 100644 --- a/src/server/api/endpoints/users/report-abuse.ts +++ b/src/server/api/endpoints/users/report-abuse.ts @@ -1,11 +1,11 @@ import $ from 'cafy'; -import { ID } from '@/misc/cafy-id'; -import define from '../../define'; -import { publishAdminStream } from '../../../../services/stream'; -import { ApiError } from '../../error'; -import { getUser } from '../../common/getters'; -import { AbuseUserReports, Users } from '../../../../models'; -import { genId } from '@/misc/gen-id'; +import { ID } from '@/misc/cafy-id.js'; +import define from '../../define.js'; +import { publishAdminStream } from '@/services/stream.js'; +import { ApiError } from '../../error.js'; +import { getUser } from '../../common/getters.js'; +import { AbuseUserReports, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/search-by-username-and-host.ts b/src/server/api/endpoints/users/search-by-username-and-host.ts index 13c5a18db..690c346e2 100644 --- a/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; -import define from '../../define'; -import { Users } from '../../../../models'; +import define from '../../define.js'; +import { Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index c183194c4..46e179b6d 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; -import define from '../../define'; -import { UserProfiles, Users } from '../../../../models'; -import { User } from '../../../../models/entities/user'; +import define from '../../define.js'; +import { UserProfiles, Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/show.ts b/src/server/api/endpoints/users/show.ts index fde2b5a14..bd0d65f76 100644 --- a/src/server/api/endpoints/users/show.ts +++ b/src/server/api/endpoints/users/show.ts @@ -1,12 +1,12 @@ import $ from 'cafy'; -import { resolveUser } from '../../../../remote/resolve-user'; -import define from '../../define'; -import { apiLogger } from '../../logger'; -import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; -import { Users } from '../../../../models'; +import { resolveUser } from '@/remote/resolve-user.js'; +import define from '../../define.js'; +import { apiLogger } from '../../logger.js'; +import { ApiError } from '../../error.js'; +import { ID } from '@/misc/cafy-id.js'; +import { Users } from '@/models/index.js'; import { In } from 'typeorm'; -import { User } from '@/models/entities/user'; +import { User } from '@/models/entities/user.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/endpoints/users/stats.ts b/src/server/api/endpoints/users/stats.ts index 6763c1774..7cf08f71c 100644 --- a/src/server/api/endpoints/users/stats.ts +++ b/src/server/api/endpoints/users/stats.ts @@ -1,8 +1,8 @@ import $ from 'cafy'; -import define from '../../define'; -import { ApiError } from '../../error'; -import { ID } from '@/misc/cafy-id'; -import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, ReversiGames, Users } from '../../../../models'; +import define from '../../define.js'; +import { ApiError } from '../../error.js'; +import { ID } from '@/misc/cafy-id.js'; +import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, ReversiGames, Users } from '@/models/index.js'; export const meta = { tags: ['users'], diff --git a/src/server/api/index.ts b/src/server/api/index.ts index aec4a9737..b967f70b3 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -8,14 +8,14 @@ import * as multer from '@koa/multer'; import * as bodyParser from 'koa-bodyparser'; import * as cors from '@koa/cors'; -import endpoints from './endpoints'; -import handler from './api-handler'; -import signup from './private/signup'; -import signin from './private/signin'; -import discord from './service/discord'; -import github from './service/github'; -import twitter from './service/twitter'; -import { Instances, AccessTokens, Users } from '../../models'; +import endpoints from './endpoints.js'; +import handler from './api-handler.js'; +import signup from './private/signup.js'; +import signin from './private/signin.js'; +import discord from './service/discord.js'; +import github from './service/github.js'; +import twitter from './service/twitter.js'; +import { Instances, AccessTokens, Users } from '@/models/index.js'; // Init app const app = new Koa(); diff --git a/src/server/api/limiter.ts b/src/server/api/limiter.ts index 540ca2499..f624bd116 100644 --- a/src/server/api/limiter.ts +++ b/src/server/api/limiter.ts @@ -1,9 +1,9 @@ import * as Limiter from 'ratelimiter'; -import { redisClient } from '../../db/redis'; -import { IEndpoint } from './endpoints'; -import { getAcct } from '@/misc/acct'; -import { User } from '../../models/entities/user'; -import Logger from '../../services/logger'; +import { redisClient } from '../../db/redis.js'; +import { IEndpoint } from './endpoints.js'; +import { getAcct } from '@/misc/acct.js'; +import { User } from '@/models/entities/user.js'; +import Logger from '@/services/logger.js'; const logger = new Logger('limiter'); diff --git a/src/server/api/logger.ts b/src/server/api/logger.ts index dde4b0d5f..ec22d6c3e 100644 --- a/src/server/api/logger.ts +++ b/src/server/api/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../../services/logger'; +import Logger from '@/services/logger.js'; export const apiLogger = new Logger('api'); diff --git a/src/server/api/openapi/description.ts b/src/server/api/openapi/description.ts index 6306920b7..b9e544b04 100644 --- a/src/server/api/openapi/description.ts +++ b/src/server/api/openapi/description.ts @@ -1,6 +1,6 @@ -import endpoints from '../endpoints'; -import * as locale from '../../../../locales/'; -import { kinds as kindsList } from '@/misc/api-permissions'; +import endpoints from '../endpoints.js'; +import * as locale from '../../../../locales/index.js'; +import { kinds as kindsList } from '@/misc/api-permissions.js'; export interface IKindInfo { endpoints: string[]; diff --git a/src/server/api/openapi/gen-spec.ts b/src/server/api/openapi/gen-spec.ts index adac3bda2..de87288b4 100644 --- a/src/server/api/openapi/gen-spec.ts +++ b/src/server/api/openapi/gen-spec.ts @@ -1,9 +1,9 @@ -import endpoints from '../endpoints'; +import endpoints from '../endpoints.js'; import { Context } from 'cafy'; -import config from '@/config'; -import { errors as basicErrors } from './errors'; -import { schemas, convertSchemaToOpenApiSchema } from './schemas'; -import { getDescription } from './description'; +import config from '@/config/index.js'; +import { errors as basicErrors } from './errors.js'; +import { schemas, convertSchemaToOpenApiSchema } from './schemas.js'; +import { getDescription } from './description.js'; export function genOpenapiSpec(lang = 'ja-JP') { const spec = { diff --git a/src/server/api/openapi/schemas.ts b/src/server/api/openapi/schemas.ts index ee2773fe4..e8bbfe527 100644 --- a/src/server/api/openapi/schemas.ts +++ b/src/server/api/openapi/schemas.ts @@ -1,26 +1,26 @@ -import { packedUserSchema } from '../../../models/repositories/user'; -import { Schema } from '@/misc/schema'; -import { packedNoteSchema } from '../../../models/repositories/note'; -import { packedUserListSchema } from '../../../models/repositories/user-list'; -import { packedAppSchema } from '../../../models/repositories/app'; -import { packedMessagingMessageSchema } from '../../../models/repositories/messaging-message'; -import { packedNotificationSchema } from '../../../models/repositories/notification'; -import { packedDriveFileSchema } from '../../../models/repositories/drive-file'; -import { packedDriveFolderSchema } from '../../../models/repositories/drive-folder'; -import { packedFollowingSchema } from '../../../models/repositories/following'; -import { packedMutingSchema } from '../../../models/repositories/muting'; -import { packedBlockingSchema } from '../../../models/repositories/blocking'; -import { packedNoteReactionSchema } from '../../../models/repositories/note-reaction'; -import { packedHashtagSchema } from '../../../models/repositories/hashtag'; -import { packedPageSchema } from '../../../models/repositories/page'; -import { packedUserGroupSchema } from '../../../models/repositories/user-group'; -import { packedNoteFavoriteSchema } from '../../../models/repositories/note-favorite'; -import { packedChannelSchema } from '../../../models/repositories/channel'; -import { packedAntennaSchema } from '../../../models/repositories/antenna'; -import { packedClipSchema } from '../../../models/repositories/clip'; -import { packedFederationInstanceSchema } from '../../../models/repositories/federation-instance'; -import { packedQueueCountSchema } from '../../../models/repositories/queue'; -import { packedGalleryPostSchema } from '@/models/repositories/gallery-post'; +import { packedUserSchema } from '@/models/repositories/user.js'; +import { Schema } from '@/misc/schema.js'; +import { packedNoteSchema } from '@/models/repositories/note.js'; +import { packedUserListSchema } from '@/models/repositories/user-list.js'; +import { packedAppSchema } from '@/models/repositories/app.js'; +import { packedMessagingMessageSchema } from '@/models/repositories/messaging-message.js'; +import { packedNotificationSchema } from '@/models/repositories/notification.js'; +import { packedDriveFileSchema } from '@/models/repositories/drive-file.js'; +import { packedDriveFolderSchema } from '@/models/repositories/drive-folder.js'; +import { packedFollowingSchema } from '@/models/repositories/following.js'; +import { packedMutingSchema } from '@/models/repositories/muting.js'; +import { packedBlockingSchema } from '@/models/repositories/blocking.js'; +import { packedNoteReactionSchema } from '@/models/repositories/note-reaction.js'; +import { packedHashtagSchema } from '@/models/repositories/hashtag.js'; +import { packedPageSchema } from '@/models/repositories/page.js'; +import { packedUserGroupSchema } from '@/models/repositories/user-group.js'; +import { packedNoteFavoriteSchema } from '@/models/repositories/note-favorite.js'; +import { packedChannelSchema } from '@/models/repositories/channel.js'; +import { packedAntennaSchema } from '@/models/repositories/antenna.js'; +import { packedClipSchema } from '@/models/repositories/clip.js'; +import { packedFederationInstanceSchema } from '@/models/repositories/federation-instance.js'; +import { packedQueueCountSchema } from '@/models/repositories/queue.js'; +import { packedGalleryPostSchema } from '@/models/repositories/gallery-post.js'; export function convertSchemaToOpenApiSchema(schema: Schema) { const res: any = schema; diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts index c01c1f265..1eda14191 100644 --- a/src/server/api/private/signin.ts +++ b/src/server/api/private/signin.ts @@ -1,12 +1,12 @@ import * as Koa from 'koa'; import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; -import signin from '../common/signin'; -import config from '@/config'; -import { Users, Signins, UserProfiles, UserSecurityKeys, AttestationChallenges } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; -import { genId } from '@/misc/gen-id'; -import { verifyLogin, hash } from '../2fa'; +import signin from '../common/signin.js'; +import config from '@/config/index.js'; +import { Users, Signins, UserProfiles, UserSecurityKeys, AttestationChallenges } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { genId } from '@/misc/gen-id.js'; +import { verifyLogin, hash } from '../2fa.js'; import { randomBytes } from 'crypto'; export default async (ctx: Koa.Context) => { diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts index f0cf75797..e554b49a6 100644 --- a/src/server/api/private/signup.ts +++ b/src/server/api/private/signup.ts @@ -1,8 +1,8 @@ import * as Koa from 'koa'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { verifyHcaptcha, verifyRecaptcha } from '@/misc/captcha'; -import { Users, RegistrationTickets } from '../../../models'; -import { signup } from '../common/signup'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { verifyHcaptcha, verifyRecaptcha } from '@/misc/captcha.js'; +import { Users, RegistrationTickets } from '@/models/index.js'; +import { signup } from '../common/signup.js'; export default async (ctx: Koa.Context) => { const body = ctx.request.body; diff --git a/src/server/api/service/discord.ts b/src/server/api/service/discord.ts index a684e71fc..986a4d184 100644 --- a/src/server/api/service/discord.ts +++ b/src/server/api/service/discord.ts @@ -1,15 +1,15 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; -import { getJson } from '@/misc/fetch'; +import { getJson } from '@/misc/fetch.js'; import { OAuth2 } from 'oauth'; -import config from '@/config'; -import { publishMainStream } from '../../../services/stream'; -import { redisClient } from '../../../db/redis'; +import config from '@/config/index.js'; +import { publishMainStream } from '@/services/stream.js'; +import { redisClient } from '../../../db/redis.js'; import { v4 as uuid } from 'uuid'; -import signin from '../common/signin'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users, UserProfiles } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; +import signin from '../common/signin.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; function getUserToken(ctx: Koa.Context) { return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts index 12435b7e8..841b8e5d1 100644 --- a/src/server/api/service/github.ts +++ b/src/server/api/service/github.ts @@ -1,15 +1,15 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; -import { getJson } from '@/misc/fetch'; +import { getJson } from '@/misc/fetch.js'; import { OAuth2 } from 'oauth'; -import config from '@/config'; -import { publishMainStream } from '../../../services/stream'; -import { redisClient } from '../../../db/redis'; +import config from '@/config/index.js'; +import { publishMainStream } from '@/services/stream.js'; +import { redisClient } from '../../../db/redis.js'; import { v4 as uuid } from 'uuid'; -import signin from '../common/signin'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users, UserProfiles } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; +import signin from '../common/signin.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; function getUserToken(ctx: Koa.Context) { return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; diff --git a/src/server/api/service/twitter.ts b/src/server/api/service/twitter.ts index 8520a5656..5b08e0533 100644 --- a/src/server/api/service/twitter.ts +++ b/src/server/api/service/twitter.ts @@ -2,13 +2,13 @@ import * as Koa from 'koa'; import * as Router from '@koa/router'; import { v4 as uuid } from 'uuid'; import autwh from 'autwh'; -import { redisClient } from '../../../db/redis'; -import { publishMainStream } from '../../../services/stream'; -import config from '@/config'; -import signin from '../common/signin'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users, UserProfiles } from '../../../models'; -import { ILocalUser } from '../../../models/entities/user'; +import { redisClient } from '../../../db/redis.js'; +import { publishMainStream } from '@/services/stream.js'; +import config from '@/config/index.js'; +import signin from '../common/signin.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users, UserProfiles } from '@/models/index.js'; +import { ILocalUser } from '@/models/entities/user.js'; function getUserToken(ctx: Koa.Context) { return ((ctx.headers['cookie'] || '').match(/igi=(\w+)/) || [null, null])[1]; diff --git a/src/server/api/stream/channels/admin.ts b/src/server/api/stream/channels/admin.ts index 1ff932d1d..e68490d05 100644 --- a/src/server/api/stream/channels/admin.ts +++ b/src/server/api/stream/channels/admin.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; +import Channel from '../channel.js'; export default class extends Channel { public readonly chName = 'admin'; diff --git a/src/server/api/stream/channels/antenna.ts b/src/server/api/stream/channels/antenna.ts index db4fab841..6c672ffd6 100644 --- a/src/server/api/stream/channels/antenna.ts +++ b/src/server/api/stream/channels/antenna.ts @@ -1,8 +1,8 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'antenna'; diff --git a/src/server/api/stream/channels/channel.ts b/src/server/api/stream/channels/channel.ts index 7910f0f2f..8665c8253 100644 --- a/src/server/api/stream/channels/channel.ts +++ b/src/server/api/stream/channels/channel.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes, Users } from '../../../../models'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; -import { PackedNote } from '../../../../models/repositories/note'; -import { User } from '../../../../models/entities/user'; +import Channel from '../channel.js'; +import { Notes, Users } from '@/models/index.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { User } from '@/models/entities/user.js'; export default class extends Channel { public readonly chName = 'channel'; diff --git a/src/server/api/stream/channels/drive.ts b/src/server/api/stream/channels/drive.ts index 4112dd9b0..66f264794 100644 --- a/src/server/api/stream/channels/drive.ts +++ b/src/server/api/stream/channels/drive.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; +import Channel from '../channel.js'; export default class extends Channel { public readonly chName = 'drive'; diff --git a/src/server/api/stream/channels/games/reversi-game.ts b/src/server/api/stream/channels/games/reversi-game.ts index e1c2116ac..a13d79d3c 100644 --- a/src/server/api/stream/channels/games/reversi-game.ts +++ b/src/server/api/stream/channels/games/reversi-game.ts @@ -1,12 +1,12 @@ import autobind from 'autobind-decorator'; import * as CRC32 from 'crc-32'; -import { publishReversiGameStream } from '../../../../../services/stream'; -import Reversi from '../../../../../games/reversi/core'; -import * as maps from '../../../../../games/reversi/maps'; -import Channel from '../../channel'; -import { ReversiGame } from '../../../../../models/entities/games/reversi/game'; -import { ReversiGames, Users } from '../../../../../models'; -import { User } from '../../../../../models/entities/user'; +import { publishReversiGameStream } from '@/services/stream.js'; +import Reversi from '../../../../../games/reversi/core.js'; +import * as maps from '../../../../../games/reversi/maps.js'; +import Channel from '../../channel.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { ReversiGames, Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; export default class extends Channel { public readonly chName = 'gamesReversiGame'; diff --git a/src/server/api/stream/channels/games/reversi.ts b/src/server/api/stream/channels/games/reversi.ts index e0e41d9ac..f8fa7b94e 100644 --- a/src/server/api/stream/channels/games/reversi.ts +++ b/src/server/api/stream/channels/games/reversi.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import { publishMainStream } from '../../../../../services/stream'; -import Channel from '../../channel'; -import { ReversiMatchings } from '../../../../../models'; +import { publishMainStream } from '@/services/stream.js'; +import Channel from '../../channel.js'; +import { ReversiMatchings } from '@/models/index.js'; export default class extends Channel { public readonly chName = 'gamesReversi'; diff --git a/src/server/api/stream/channels/global-timeline.ts b/src/server/api/stream/channels/global-timeline.ts index 02792bffa..1e1e8b5c9 100644 --- a/src/server/api/stream/channels/global-timeline.ts +++ b/src/server/api/stream/channels/global-timeline.ts @@ -1,11 +1,11 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'globalTimeline'; diff --git a/src/server/api/stream/channels/hashtag.ts b/src/server/api/stream/channels/hashtag.ts index 4cabd4db6..8a5b7a267 100644 --- a/src/server/api/stream/channels/hashtag.ts +++ b/src/server/api/stream/channels/hashtag.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'hashtag'; diff --git a/src/server/api/stream/channels/home-timeline.ts b/src/server/api/stream/channels/home-timeline.ts index 7659b5ffa..e19cd077c 100644 --- a/src/server/api/stream/channels/home-timeline.ts +++ b/src/server/api/stream/channels/home-timeline.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'homeTimeline'; diff --git a/src/server/api/stream/channels/hybrid-timeline.ts b/src/server/api/stream/channels/hybrid-timeline.ts index 664435f67..4d48075af 100644 --- a/src/server/api/stream/channels/hybrid-timeline.ts +++ b/src/server/api/stream/channels/hybrid-timeline.ts @@ -1,12 +1,12 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { PackedUser } from '../../../../models/repositories/user'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { PackedUser } from '@/models/repositories/user.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'hybridTimeline'; diff --git a/src/server/api/stream/channels/index.ts b/src/server/api/stream/channels/index.ts index 184157304..39f4d235f 100644 --- a/src/server/api/stream/channels/index.ts +++ b/src/server/api/stream/channels/index.ts @@ -1,20 +1,20 @@ -import main from './main'; -import homeTimeline from './home-timeline'; -import localTimeline from './local-timeline'; -import hybridTimeline from './hybrid-timeline'; -import globalTimeline from './global-timeline'; -import serverStats from './server-stats'; -import queueStats from './queue-stats'; -import userList from './user-list'; -import antenna from './antenna'; -import messaging from './messaging'; -import messagingIndex from './messaging-index'; -import drive from './drive'; -import hashtag from './hashtag'; -import channel from './channel'; -import admin from './admin'; -import gamesReversi from './games/reversi'; -import gamesReversiGame from './games/reversi-game'; +import main from './main.js'; +import homeTimeline from './home-timeline.js'; +import localTimeline from './local-timeline.js'; +import hybridTimeline from './hybrid-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'; +import gamesReversi from './games/reversi.js'; +import gamesReversiGame from './games/reversi-game.js'; export default { main, diff --git a/src/server/api/stream/channels/local-timeline.ts b/src/server/api/stream/channels/local-timeline.ts index 528059dab..c01ca5347 100644 --- a/src/server/api/stream/channels/local-timeline.ts +++ b/src/server/api/stream/channels/local-timeline.ts @@ -1,12 +1,12 @@ import autobind from 'autobind-decorator'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import Channel from '../channel'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Notes } from '../../../../models'; -import { PackedNote } from '../../../../models/repositories/note'; -import { PackedUser } from '../../../../models/repositories/user'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import Channel from '../channel.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Notes } from '@/models/index.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { PackedUser } from '@/models/repositories/user.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'localTimeline'; diff --git a/src/server/api/stream/channels/main.ts b/src/server/api/stream/channels/main.ts index 780bc0b89..103c61a0f 100644 --- a/src/server/api/stream/channels/main.ts +++ b/src/server/api/stream/channels/main.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes } from '../../../../models'; +import Channel from '../channel.js'; +import { Notes } from '@/models/index.js'; export default class extends Channel { public readonly chName = 'main'; diff --git a/src/server/api/stream/channels/messaging-index.ts b/src/server/api/stream/channels/messaging-index.ts index 0c495398a..24f8aad40 100644 --- a/src/server/api/stream/channels/messaging-index.ts +++ b/src/server/api/stream/channels/messaging-index.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; +import Channel from '../channel.js'; export default class extends Channel { public readonly chName = 'messagingIndex'; diff --git a/src/server/api/stream/channels/messaging.ts b/src/server/api/stream/channels/messaging.ts index 58427e277..c16507a5f 100644 --- a/src/server/api/stream/channels/messaging.ts +++ b/src/server/api/stream/channels/messaging.ts @@ -1,8 +1,8 @@ import autobind from 'autobind-decorator'; -import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message'; -import Channel from '../channel'; -import { UserGroupJoinings, Users, MessagingMessages } from '../../../../models'; -import { User, ILocalUser, IRemoteUser } from '../../../../models/entities/user'; +import { readUserMessagingMessage, readGroupMessagingMessage, deliverReadActivity } from '../../common/read-messaging-message.js'; +import Channel from '../channel.js'; +import { UserGroupJoinings, Users, MessagingMessages } from '@/models/index.js'; +import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js'; export default class extends Channel { public readonly chName = 'messaging'; diff --git a/src/server/api/stream/channels/queue-stats.ts b/src/server/api/stream/channels/queue-stats.ts index 0bda0cfcb..f05e619b9 100644 --- a/src/server/api/stream/channels/queue-stats.ts +++ b/src/server/api/stream/channels/queue-stats.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; import Xev from 'xev'; -import Channel from '../channel'; +import Channel from '../channel.js'; const ev = new Xev(); diff --git a/src/server/api/stream/channels/server-stats.ts b/src/server/api/stream/channels/server-stats.ts index d245a7f70..76eb5b0f2 100644 --- a/src/server/api/stream/channels/server-stats.ts +++ b/src/server/api/stream/channels/server-stats.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; import Xev from 'xev'; -import Channel from '../channel'; +import Channel from '../channel.js'; const ev = new Xev(); diff --git a/src/server/api/stream/channels/user-list.ts b/src/server/api/stream/channels/user-list.ts index 1f42fbe49..ca8e46d50 100644 --- a/src/server/api/stream/channels/user-list.ts +++ b/src/server/api/stream/channels/user-list.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Channel from '../channel'; -import { Notes, UserListJoinings, UserLists } from '../../../../models'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { User } from '../../../../models/entities/user'; -import { PackedNote } from '../../../../models/repositories/note'; -import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; +import Channel from '../channel.js'; +import { Notes, UserListJoinings, UserLists } from '@/models/index.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { User } from '@/models/entities/user.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js'; export default class extends Channel { public readonly chName = 'userList'; diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 96d4194a7..1947be0a7 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -1,20 +1,20 @@ import autobind from 'autobind-decorator'; import * as websocket from 'websocket'; -import { readNotification } from '../common/read-notification'; -import call from '../call'; -import readNote from '../../../services/note/read'; -import Channel from './channel'; -import channels from './channels'; +import { readNotification } from '../common/read-notification.js'; +import call from '../call.js'; +import readNote from '@/services/note/read.js'; +import Channel from './channel.js'; +import channels from './channels/index.js'; import { EventEmitter } from 'events'; -import { User } from '../../../models/entities/user'; -import { Channel as ChannelModel } from '../../../models/entities/channel'; -import { Users, Followings, Mutings, UserProfiles, ChannelFollowings, Blockings } from '../../../models'; -import { ApiError } from '../error'; -import { AccessToken } from '../../../models/entities/access-token'; -import { UserProfile } from '../../../models/entities/user-profile'; -import { publishChannelStream, publishGroupMessagingStream, publishMessagingStream } from '../../../services/stream'; -import { UserGroup } from '../../../models/entities/user-group'; -import { PackedNote } from '../../../models/repositories/note'; +import { User } from '@/models/entities/user.js'; +import { Channel as ChannelModel } from '@/models/entities/channel.js'; +import { Users, Followings, Mutings, UserProfiles, ChannelFollowings, Blockings } from '@/models/index.js'; +import { ApiError } from '../error.js'; +import { AccessToken } from '@/models/entities/access-token.js'; +import { UserProfile } from '@/models/entities/user-profile.js'; +import { publishChannelStream, publishGroupMessagingStream, publishMessagingStream } from '@/services/stream.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { PackedNote } from '@/models/repositories/note.js'; /** * Main stream connection diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index b431bc5ad..115692bed 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -1,12 +1,12 @@ import * as http from 'http'; import * as websocket from 'websocket'; -import MainStreamConnection from './stream'; +import MainStreamConnection from './stream/index.js'; import { ParsedUrlQuery } from 'querystring'; -import authenticate from './authenticate'; +import authenticate from './authenticate.js'; import { EventEmitter } from 'events'; -import { subsdcriber as redisClient } from '../../db/redis'; -import { Users } from '@/models'; +import { subsdcriber as redisClient } from '../../db/redis.js'; +import { Users } from '@/models/index.js'; module.exports = (server: http.Server) => { // Init websocket server diff --git a/src/server/file/index.ts b/src/server/file/index.ts index 0410efb99..c58c3cbf2 100644 --- a/src/server/file/index.ts +++ b/src/server/file/index.ts @@ -3,10 +3,16 @@ */ import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import * as Koa from 'koa'; import * as cors from '@koa/cors'; import * as Router from '@koa/router'; -import sendDriveFile from './send-drive-file'; +import sendDriveFile from './send-drive-file.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); // Init app const app = new Koa(); @@ -16,7 +22,7 @@ app.use(cors()); const router = new Router(); router.get('/app-default.jpg', ctx => { - const file = fs.createReadStream(`${__dirname}/assets/dummy.png`); + const file = fs.createReadStream(`${_dirname}/assets/dummy.png`); ctx.body = file; ctx.set('Content-Type', 'image/jpeg'); ctx.set('Cache-Control', 'max-age=31536000, immutable'); diff --git a/src/server/file/send-drive-file.ts b/src/server/file/send-drive-file.ts index 9745b1201..f4f4bdb3c 100644 --- a/src/server/file/send-drive-file.ts +++ b/src/server/file/send-drive-file.ts @@ -1,18 +1,24 @@ +import * as fs from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import * as Koa from 'koa'; import * as send from 'koa-send'; import * as rename from 'rename'; import * as tmp from 'tmp'; -import * as fs from 'fs'; -import { serverLogger } from '..'; -import { contentDisposition } from '@/misc/content-disposition'; -import { DriveFiles } from '../../models'; -import { InternalStorage } from '../../services/drive/internal-storage'; -import { downloadUrl } from '@/misc/download-url'; -import { detectType } from '@/misc/get-file-info'; -import { convertToJpeg, convertToPngOrJpeg } from '../../services/drive/image-processor'; -import { GenerateVideoThumbnail } from '../../services/drive/generate-video-thumbnail'; +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 { downloadUrl } from '@/misc/download-url.js'; +import { detectType } from '@/misc/get-file-info.js'; +import { convertToJpeg, convertToPngOrJpeg } from '@/services/drive/image-processor.js'; +import { GenerateVideoThumbnail } from '@/services/drive/generate-video-thumbnail.js'; -const assets = `${__dirname}/../../server/file/assets/`; +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); + +const assets = `${_dirname}/../../server/file/assets/`; const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void => { serverLogger.error(e); diff --git a/src/server/index.ts b/src/server/index.ts index 3b43aa767..bf83b7dd4 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -13,19 +13,19 @@ import * as koaLogger from 'koa-logger'; import * as requestStats from 'request-stats'; import * as slow from 'koa-slow'; -import activityPub from './activitypub'; -import nodeinfo from './nodeinfo'; -import wellKnown from './well-known'; -import config from '@/config'; -import apiServer from './api'; -import { sum } from '../prelude/array'; -import Logger from '../services/logger'; -import { program } from '../argv'; -import { UserProfiles, Users } from '../models'; -import { networkChart } from '../services/chart'; -import { genAvatar } from '@/misc/gen-avatar'; -import { createTemp } from '@/misc/create-temp'; -import { publishMainStream } from '../services/stream'; +import activityPub from './activitypub.js'; +import nodeinfo from './nodeinfo.js'; +import wellKnown from './well-known.js'; +import config from '@/config/index.js'; +import apiServer from './api/index.js'; +import { sum } from '../prelude/array.js'; +import Logger from '@/services/logger.js'; +import { program } from '../argv.js'; +import { UserProfiles, Users } from '@/models/index.js'; +import { networkChart } from '@/services/chart/index.js'; +import { genAvatar } from '@/misc/gen-avatar.js'; +import { createTemp } from '@/misc/create-temp.js'; +import { publishMainStream } from '@/services/stream.js'; export const serverLogger = new Logger('server', 'gray', false); diff --git a/src/server/nodeinfo.ts b/src/server/nodeinfo.ts index 7a1d5b629..3600bd2ac 100644 --- a/src/server/nodeinfo.ts +++ b/src/server/nodeinfo.ts @@ -1,9 +1,9 @@ import * as Router from '@koa/router'; -import config from '@/config'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { Users } from '../models'; -// import User from '../models/user'; -// import Note from '../models/note'; +import config from '@/config/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { Users } from '@/models/index.js'; +// import User from '../models/user.js'; +// import Note from '../models/note.js'; const router = new Router(); diff --git a/src/server/proxy/index.ts b/src/server/proxy/index.ts index 9ef198d31..210c2fcf1 100644 --- a/src/server/proxy/index.ts +++ b/src/server/proxy/index.ts @@ -5,7 +5,7 @@ import * as Koa from 'koa'; import * as cors from '@koa/cors'; import * as Router from '@koa/router'; -import { proxyMedia } from './proxy-media'; +import { proxyMedia } from './proxy-media.js'; // Init app const app = new Koa(); diff --git a/src/server/proxy/proxy-media.ts b/src/server/proxy/proxy-media.ts index f91df5562..3200266be 100644 --- a/src/server/proxy/proxy-media.ts +++ b/src/server/proxy/proxy-media.ts @@ -1,10 +1,10 @@ import * as fs from 'fs'; import * as Koa from 'koa'; -import { serverLogger } from '..'; -import { IImage, convertToPng, convertToJpeg } from '../../services/drive/image-processor'; -import { createTemp } from '@/misc/create-temp'; -import { downloadUrl } from '@/misc/download-url'; -import { detectType } from '@/misc/get-file-info'; +import { serverLogger } from '../index.js'; +import { IImage, convertToPng, convertToJpeg } 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'; export async function proxyMedia(ctx: Koa.Context) { const url = 'url' in ctx.query ? ctx.query.url : 'https://' + ctx.params.url; diff --git a/src/server/web/feed.ts b/src/server/web/feed.ts index d4792c63a..57b1401e3 100644 --- a/src/server/web/feed.ts +++ b/src/server/web/feed.ts @@ -1,7 +1,7 @@ import { Feed } from 'feed'; -import config from '@/config'; -import { User } from '../../models/entities/user'; -import { Notes, DriveFiles, UserProfiles } from '../../models'; +import config from '@/config/index.js'; +import { User } from '@/models/entities/user.js'; +import { Notes, DriveFiles, UserProfiles } from '@/models/index.js'; import { In } from 'typeorm'; export default async function(user: User) { diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 44ab2a997..68cfc5d0f 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -4,7 +4,9 @@ import * as os from 'os'; import * as fs from 'fs'; -import ms = require('ms'); +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import * as ms from 'ms'; import * as Koa from 'koa'; import * as Router from '@koa/router'; import * as send from 'koa-send'; @@ -13,37 +15,41 @@ import * as views from 'koa-views'; import * as glob from 'glob'; import * as MarkdownIt from 'markdown-it'; -import packFeed from './feed'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { genOpenapiSpec } from '../api/openapi/gen-spec'; -import config from '@/config'; -import { Users, Notes, Emojis, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '../../models'; -import { parseAcct } from '@/misc/acct'; -import { getNoteSummary } from '@/misc/get-note-summary'; +import packFeed from './feed.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { genOpenapiSpec } from '../api/openapi/gen-spec.js'; +import config from '@/config/index.js'; +import { Users, Notes, Emojis, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '@/models/index.js'; +import { parseAcct } from '@/misc/acct.js'; +import { getNoteSummary } from '@/misc/get-note-summary.js'; import { getConnection } from 'typeorm'; -import { redisClient } from '../../db/redis'; -import locales = require('../../../locales'); +import { redisClient } from '../../db/redis.js'; +import locales from '../../../locales/index.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); const markdown = MarkdownIt({ html: true }); -const changelog = fs.readFileSync(`${__dirname}/../../../CHANGELOG.md`, { encoding: 'utf8' }); +const changelog = fs.readFileSync(`${_dirname}/../../../CHANGELOG.md`, { encoding: 'utf8' }); function genDoc(path: string): string { let md = fs.readFileSync(path, { encoding: 'utf8' }); md = md.replace('', changelog); return md; } -const staticAssets = `${__dirname}/../../../assets/`; -const docAssets = `${__dirname}/../../../src/docs/`; -const assets = `${__dirname}/../../assets/`; +const staticAssets = `${_dirname}/../../../assets/`; +const docAssets = `${_dirname}/../../../src/docs/`; +const assets = `${_dirname}/../../assets/`; // Init app const app = new Koa(); // Init renderer -app.use(views(__dirname + '/views', { +app.use(views(_dirname + '/views', { extension: 'pug', options: { version: config.version, @@ -52,7 +58,7 @@ app.use(views(__dirname + '/views', { })); // Serve favicon -app.use(favicon(`${__dirname}/../../../assets/favicon.ico`)); +app.use(favicon(`${_dirname}/../../../assets/favicon.ico`)); // Common request handler app.use(async (ctx, next) => { @@ -75,7 +81,7 @@ router.get('/static-assets/(.*)', async ctx => { router.get('/doc-assets/(.*)', async ctx => { if (ctx.path.includes('..')) return; - const path = `${__dirname}/../../../src/docs/${ctx.path.replace('/doc-assets/', '')}`; + const path = `${_dirname}/../../../src/docs/${ctx.path.replace('/doc-assets/', '')}`; const doc = genDoc(path); ctx.set('Content-Type', 'text/plain; charset=utf-8'); ctx.body = doc; @@ -134,7 +140,7 @@ router.get('/docs.json', async ctx => { ctx.body = []; return; } - const dirPath = `${__dirname}/../../../src/docs/${lang}`.replace(/\\/g, '/'); + const dirPath = `${_dirname}/../../../src/docs/${lang}`.replace(/\\/g, '/'); const paths = glob.sync(`${dirPath}/**/*.md`); const docs: { path: string; title: string; summary: string; }[] = []; for (const path of paths) { diff --git a/src/server/web/manifest.ts b/src/server/web/manifest.ts index 918fe27c0..a35b2a569 100644 --- a/src/server/web/manifest.ts +++ b/src/server/web/manifest.ts @@ -1,6 +1,6 @@ import * as Koa from 'koa'; import * as manifest from './manifest.json'; -import { fetchMeta } from '@/misc/fetch-meta'; +import { fetchMeta } from '@/misc/fetch-meta.js'; module.exports = async (ctx: Koa.Context) => { const json = JSON.parse(JSON.stringify(manifest)); diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts index 1ba8e0034..af9e2c77f 100644 --- a/src/server/web/url-preview.ts +++ b/src/server/web/url-preview.ts @@ -1,10 +1,10 @@ import * as Koa from 'koa'; import summaly from 'summaly'; -import { fetchMeta } from '@/misc/fetch-meta'; -import Logger from '../../services/logger'; -import config from '@/config'; -import { query } from '../../prelude/url'; -import { getJson } from '@/misc/fetch'; +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/src/server/well-known.ts b/src/server/well-known.ts index 5771db91d..d5fd44069 100644 --- a/src/server/well-known.ts +++ b/src/server/well-known.ts @@ -1,11 +1,11 @@ import * as Router from '@koa/router'; -import config from '@/config'; -import { parseAcct, Acct } from '@/misc/acct'; -import { links } from './nodeinfo'; -import { escapeAttribute, escapeValue } from '../prelude/xml'; -import { Users } from '../models'; -import { User } from '../models/entities/user'; +import config from '@/config/index.js'; +import { parseAcct, Acct } from '@/misc/acct.js'; +import { links } from './nodeinfo.js'; +import { escapeAttribute, escapeValue } from '../prelude/xml.js'; +import { Users } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; // Init router const router = new Router(); diff --git a/src/services/add-note-to-antenna.ts b/src/services/add-note-to-antenna.ts index 56d014915..f285b7a60 100644 --- a/src/services/add-note-to-antenna.ts +++ b/src/services/add-note-to-antenna.ts @@ -1,10 +1,10 @@ -import { Antenna } from '../models/entities/antenna'; -import { Note } from '../models/entities/note'; -import { AntennaNotes, Mutings, Notes } from '../models'; -import { genId } from '@/misc/gen-id'; -import { isMutedUserRelated } from '@/misc/is-muted-user-related'; -import { publishAntennaStream, publishMainStream } from './stream'; -import { User } from '../models/entities/user'; +import { Antenna } from '@/models/entities/antenna.js'; +import { Note } from '@/models/entities/note.js'; +import { AntennaNotes, Mutings, Notes } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { isMutedUserRelated } from '@/misc/is-muted-user-related.js'; +import { publishAntennaStream, publishMainStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }) { // 通知しない設定になっているか、自分自身の投稿なら既読にする diff --git a/src/services/blocking/create.ts b/src/services/blocking/create.ts index d92856689..415223f08 100644 --- a/src/services/blocking/create.ts +++ b/src/services/blocking/create.ts @@ -1,14 +1,14 @@ -import { publishMainStream, publishUserEvent } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderFollow from '../../remote/activitypub/renderer/follow'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import renderBlock from '../../remote/activitypub/renderer/block'; -import { deliver } from '../../queue'; -import renderReject from '../../remote/activitypub/renderer/reject'; -import { User } from '../../models/entities/user'; -import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '../../models'; -import { perUserFollowingChart } from '../chart'; -import { genId } from '@/misc/gen-id'; +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 { User } from '@/models/entities/user.js'; +import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '@/models/index.js'; +import { perUserFollowingChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; export default async function(blocker: User, blockee: User) { await Promise.all([ diff --git a/src/services/blocking/delete.ts b/src/services/blocking/delete.ts index 2c05cb7f3..240c0b15d 100644 --- a/src/services/blocking/delete.ts +++ b/src/services/blocking/delete.ts @@ -1,10 +1,10 @@ -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderBlock from '../../remote/activitypub/renderer/block'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import { deliver } from '../../queue'; -import Logger from '../logger'; -import { User } from '../../models/entities/user'; -import { Blockings, Users } from '../../models'; +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 '../logger.js'; +import { User } from '@/models/entities/user.js'; +import { Blockings, Users } from '@/models/index.js'; const logger = new Logger('blocking/delete'); diff --git a/src/services/chart/charts/classes/active-users.ts b/src/services/chart/charts/classes/active-users.ts index e732b25d2..959eb0f8e 100644 --- a/src/services/chart/charts/classes/active-users.ts +++ b/src/services/chart/charts/classes/active-users.ts @@ -1,9 +1,9 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; -import { name, schema } from '../schemas/active-users'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; +import { name, schema } from '../schemas/active-users.js'; type ActiveUsersLog = SchemaType; diff --git a/src/services/chart/charts/classes/drive.ts b/src/services/chart/charts/classes/drive.ts index 18537918f..9bd64074e 100644 --- a/src/services/chart/charts/classes/drive.ts +++ b/src/services/chart/charts/classes/drive.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { name, schema } from '../schemas/drive'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { name, schema } from '../schemas/drive.js'; type DriveLog = SchemaType; diff --git a/src/services/chart/charts/classes/federation.ts b/src/services/chart/charts/classes/federation.ts index e593a53cf..39feed7b1 100644 --- a/src/services/chart/charts/classes/federation.ts +++ b/src/services/chart/charts/classes/federation.ts @@ -1,8 +1,8 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Instances } from '../../../../models'; -import { name, schema } from '../schemas/federation'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Instances } from '@/models/index.js'; +import { name, schema } from '../schemas/federation.js'; type FederationLog = SchemaType; diff --git a/src/services/chart/charts/classes/hashtag.ts b/src/services/chart/charts/classes/hashtag.ts index 98d5421c9..13f459849 100644 --- a/src/services/chart/charts/classes/hashtag.ts +++ b/src/services/chart/charts/classes/hashtag.ts @@ -1,9 +1,9 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; -import { name, schema } from '../schemas/hashtag'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; +import { name, schema } from '../schemas/hashtag.js'; type HashtagLog = SchemaType; diff --git a/src/services/chart/charts/classes/instance.ts b/src/services/chart/charts/classes/instance.ts index f93da58d6..429d4067b 100644 --- a/src/services/chart/charts/classes/instance.ts +++ b/src/services/chart/charts/classes/instance.ts @@ -1,11 +1,11 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles, Followings, Users, Notes } from '../../../../models'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { name, schema } from '../schemas/instance'; -import { Note } from '../../../../models/entities/note'; -import { toPuny } from '@/misc/convert-host'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles, Followings, Users, Notes } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { name, schema } from '../schemas/instance.js'; +import { Note } from '@/models/entities/note.js'; +import { toPuny } from '@/misc/convert-host.js'; type InstanceLog = SchemaType; diff --git a/src/services/chart/charts/classes/network.ts b/src/services/chart/charts/classes/network.ts index 2ce75e0b3..1e39115b0 100644 --- a/src/services/chart/charts/classes/network.ts +++ b/src/services/chart/charts/classes/network.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/network'; +import Chart, { DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/network.js'; type NetworkLog = SchemaType; diff --git a/src/services/chart/charts/classes/notes.ts b/src/services/chart/charts/classes/notes.ts index a6eb653b7..7cc3c7de8 100644 --- a/src/services/chart/charts/classes/notes.ts +++ b/src/services/chart/charts/classes/notes.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Notes } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Notes } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { Note } from '../../../../models/entities/note'; -import { name, schema } from '../schemas/notes'; +import { Note } from '@/models/entities/note.js'; +import { name, schema } from '../schemas/notes.js'; type NotesLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-drive.ts b/src/services/chart/charts/classes/per-user-drive.ts index 182e5927e..04b29c0ab 100644 --- a/src/services/chart/charts/classes/per-user-drive.ts +++ b/src/services/chart/charts/classes/per-user-drive.ts @@ -1,9 +1,9 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { DriveFiles } from '../../../../models'; -import { DriveFile } from '../../../../models/entities/drive-file'; -import { name, schema } from '../schemas/per-user-drive'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { DriveFiles } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { name, schema } from '../schemas/per-user-drive.js'; type PerUserDriveLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-following.ts b/src/services/chart/charts/classes/per-user-following.ts index 5972d3759..43ca9d3b6 100644 --- a/src/services/chart/charts/classes/per-user-following.ts +++ b/src/services/chart/charts/classes/per-user-following.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Followings, Users } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Followings, Users } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { User } from '../../../../models/entities/user'; -import { name, schema } from '../schemas/per-user-following'; +import { User } from '@/models/entities/user.js'; +import { name, schema } from '../schemas/per-user-following.js'; type PerUserFollowingLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-notes.ts b/src/services/chart/charts/classes/per-user-notes.ts index 7f93965ad..3da16f813 100644 --- a/src/services/chart/charts/classes/per-user-notes.ts +++ b/src/services/chart/charts/classes/per-user-notes.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { SchemaType } from '@/misc/schema'; -import { Notes } from '../../../../models'; -import { Note } from '../../../../models/entities/note'; -import { name, schema } from '../schemas/per-user-notes'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Notes } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { name, schema } from '../schemas/per-user-notes.js'; type PerUserNotesLog = SchemaType; diff --git a/src/services/chart/charts/classes/per-user-reactions.ts b/src/services/chart/charts/classes/per-user-reactions.ts index 69ed81cd4..d4665c067 100644 --- a/src/services/chart/charts/classes/per-user-reactions.ts +++ b/src/services/chart/charts/classes/per-user-reactions.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { DeepPartial } from '../../core'; -import { User } from '../../../../models/entities/user'; -import { Note } from '../../../../models/entities/note'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; -import { name, schema } from '../schemas/per-user-reactions'; +import Chart, { DeepPartial } from '../../core.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; +import { name, schema } from '../schemas/per-user-reactions.js'; type PerUserReactionsLog = SchemaType; diff --git a/src/services/chart/charts/classes/test-grouped.ts b/src/services/chart/charts/classes/test-grouped.ts index 84e6d5e33..a667aaff1 100644 --- a/src/services/chart/charts/classes/test-grouped.ts +++ b/src/services/chart/charts/classes/test-grouped.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/test-grouped'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/test-grouped.js'; type TestGroupedLog = SchemaType; diff --git a/src/services/chart/charts/classes/test-unique.ts b/src/services/chart/charts/classes/test-unique.ts index 559fda13c..c0ca5f625 100644 --- a/src/services/chart/charts/classes/test-unique.ts +++ b/src/services/chart/charts/classes/test-unique.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/test-unique'; +import Chart, { DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/test-unique.js'; type TestUniqueLog = SchemaType; diff --git a/src/services/chart/charts/classes/test.ts b/src/services/chart/charts/classes/test.ts index a91d5e189..829867f5e 100644 --- a/src/services/chart/charts/classes/test.ts +++ b/src/services/chart/charts/classes/test.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { name, schema } from '../schemas/test'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { name, schema } from '../schemas/test.js'; type TestLog = SchemaType; diff --git a/src/services/chart/charts/classes/users.ts b/src/services/chart/charts/classes/users.ts index 8f208de6d..be279cb8c 100644 --- a/src/services/chart/charts/classes/users.ts +++ b/src/services/chart/charts/classes/users.ts @@ -1,10 +1,10 @@ import autobind from 'autobind-decorator'; -import Chart, { Obj, DeepPartial } from '../../core'; -import { SchemaType } from '@/misc/schema'; -import { Users } from '../../../../models'; +import Chart, { Obj, DeepPartial } from '../../core.js'; +import { SchemaType } from '@/misc/schema.js'; +import { Users } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; -import { User } from '../../../../models/entities/user'; -import { name, schema } from '../schemas/users'; +import { User } from '@/models/entities/user.js'; +import { name, schema } from '../schemas/users.js'; type UsersLog = SchemaType; diff --git a/src/services/chart/core.ts b/src/services/chart/core.ts index 3c0526d2e..109d75933 100644 --- a/src/services/chart/core.ts +++ b/src/services/chart/core.ts @@ -6,11 +6,11 @@ import * as nestedProperty from 'nested-property'; import autobind from 'autobind-decorator'; -import Logger from '../logger'; -import { Schema } from '@/misc/schema'; +import Logger from '../logger.js'; +import { Schema } from '@/misc/schema.js'; import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm'; -import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time'; -import { getChartInsertLock } from '@/misc/app-lock'; +import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time.js'; +import { getChartInsertLock } from '@/misc/app-lock.js'; const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test'); diff --git a/src/services/chart/entities.ts b/src/services/chart/entities.ts index e3d5e6f8c..357a4a5b5 100644 --- a/src/services/chart/entities.ts +++ b/src/services/chart/entities.ts @@ -1,7 +1,13 @@ -import Chart from './core'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import Chart from './core.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export const entities = Object.values(require('require-all')({ - dirname: __dirname + '/charts/schemas', + dirname: _dirname + '/charts/schemas', filter: /^.+\.[jt]s$/, resolve: (x: any) => { return Chart.schemaToEntity(x.name, x.schema); diff --git a/src/services/chart/index.ts b/src/services/chart/index.ts index 61eb431ea..b070ed863 100644 --- a/src/services/chart/index.ts +++ b/src/services/chart/index.ts @@ -1,16 +1,16 @@ -import FederationChart from './charts/classes/federation'; -import NotesChart from './charts/classes/notes'; -import UsersChart from './charts/classes/users'; -import NetworkChart from './charts/classes/network'; -import ActiveUsersChart from './charts/classes/active-users'; -import InstanceChart from './charts/classes/instance'; -import PerUserNotesChart from './charts/classes/per-user-notes'; -import DriveChart from './charts/classes/drive'; -import PerUserReactionsChart from './charts/classes/per-user-reactions'; -import HashtagChart from './charts/classes/hashtag'; -import PerUserFollowingChart from './charts/classes/per-user-following'; -import PerUserDriveChart from './charts/classes/per-user-drive'; -import { beforeShutdown } from '@/misc/before-shutdown'; +import FederationChart from './charts/classes/federation.js'; +import NotesChart from './charts/classes/notes.js'; +import UsersChart from './charts/classes/users.js'; +import NetworkChart from './charts/classes/network.js'; +import ActiveUsersChart from './charts/classes/active-users.js'; +import InstanceChart from './charts/classes/instance.js'; +import PerUserNotesChart from './charts/classes/per-user-notes.js'; +import DriveChart from './charts/classes/drive.js'; +import PerUserReactionsChart from './charts/classes/per-user-reactions.js'; +import HashtagChart from './charts/classes/hashtag.js'; +import PerUserFollowingChart from './charts/classes/per-user-following.js'; +import PerUserDriveChart from './charts/classes/per-user-drive.js'; +import { beforeShutdown } from '@/misc/before-shutdown.js'; export const federationChart = new FederationChart(); export const notesChart = new NotesChart(); diff --git a/src/services/create-notification.ts b/src/services/create-notification.ts index 7d2726971..d0ee0e048 100644 --- a/src/services/create-notification.ts +++ b/src/services/create-notification.ts @@ -1,10 +1,10 @@ -import { publishMainStream } from './stream'; -import pushSw from './push-notification'; -import { Notifications, Mutings, UserProfiles, Users } from '../models'; -import { genId } from '@/misc/gen-id'; -import { User } from '../models/entities/user'; -import { Notification } from '../models/entities/notification'; -import { sendEmailNotification } from './send-email-notification'; +import { publishMainStream } from '@/services/stream.js'; +import pushSw from './push-notification.js'; +import { Notifications, Mutings, UserProfiles, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { User } from '@/models/entities/user.js'; +import { Notification } from '@/models/entities/notification.js'; +import { sendEmailNotification } from './send-email-notification.js'; export async function createNotification( notifieeId: User['id'], diff --git a/src/services/create-system-user.ts b/src/services/create-system-user.ts index 052ceb6c9..de03dd489 100644 --- a/src/services/create-system-user.ts +++ b/src/services/create-system-user.ts @@ -1,13 +1,13 @@ import * as bcrypt from 'bcryptjs'; import { v4 as uuid } from 'uuid'; -import generateNativeUserToken from '../server/api/common/generate-native-user-token'; -import { genRsaKeyPair } from '@/misc/gen-key-pair'; -import { User } from '../models/entities/user'; -import { UserProfile } from '../models/entities/user-profile'; +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 { getConnection } from 'typeorm'; -import { genId } from '@/misc/gen-id'; -import { UserKeypair } from '../models/entities/user-keypair'; -import { UsedUsername } from '../models/entities/used-username'; +import { genId } from '@/misc/gen-id.js'; +import { UserKeypair } from '@/models/entities/user-keypair.js'; +import { UsedUsername } from '@/models/entities/used-username.js'; export async function createSystemUser(username: string) { const password = uuid(); diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index 2356a23cb..e1092d068 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -2,23 +2,23 @@ import * as fs from 'fs'; import { v4 as uuid } from 'uuid'; -import { publishMainStream, publishDriveStream } from '../stream'; -import { deleteFile } from './delete-file'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { GenerateVideoThumbnail } from './generate-video-thumbnail'; -import { driveLogger } from './logger'; -import { IImage, convertSharpToJpeg, convertSharpToWebp, convertSharpToPng, convertSharpToPngOrJpeg } from './image-processor'; -import { contentDisposition } from '@/misc/content-disposition'; -import { getFileInfo } from '@/misc/get-file-info'; -import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '../../models'; -import { InternalStorage } from './internal-storage'; -import { DriveFile } from '../../models/entities/drive-file'; -import { IRemoteUser, User } from '../../models/entities/user'; -import { driveChart, perUserDriveChart, instanceChart } from '../chart'; -import { genId } from '@/misc/gen-id'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; +import { publishMainStream, publishDriveStream } from '@/services/stream.js'; +import { deleteFile } from './delete-file.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { GenerateVideoThumbnail } from './generate-video-thumbnail.js'; +import { driveLogger } from './logger.js'; +import { IImage, convertSharpToJpeg, convertSharpToWebp, convertSharpToPng, convertSharpToPngOrJpeg } from './image-processor.js'; +import { contentDisposition } from '@/misc/content-disposition.js'; +import { getFileInfo } from '@/misc/get-file-info.js'; +import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '@/models/index.js'; +import { InternalStorage } from './internal-storage.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { 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 * as S3 from 'aws-sdk/clients/s3'; -import { getS3 } from './s3'; +import { getS3 } from './s3.js'; import * as sharp from 'sharp'; const logger = driveLogger.createSubLogger('register', 'yellow'); diff --git a/src/services/drive/delete-file.ts b/src/services/drive/delete-file.ts index 2dd244532..9deb1768b 100644 --- a/src/services/drive/delete-file.ts +++ b/src/services/drive/delete-file.ts @@ -1,19 +1,19 @@ -import { DriveFile } from '../../models/entities/drive-file'; -import { InternalStorage } from './internal-storage'; -import { DriveFiles, Instances, Notes, Users } from '../../models'; -import { driveChart, perUserDriveChart, instanceChart } from '../chart'; -import { createDeleteObjectStorageFileJob } from '../../queue'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { getS3 } from './s3'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { InternalStorage } from './internal-storage.js'; +import { DriveFiles, Instances, Notes, Users } from '@/models/index.js'; +import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index.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'; -import { Note } from '../../models/entities/note'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderDelete from '../../remote/activitypub/renderer/delete'; -import renderTombstone from '../../remote/activitypub/renderer/tombstone'; -import config from '@/config'; -import { deliverToFollowers } from '../../remote/activitypub/deliver-manager'; +import { Note } from '@/models/entities/note.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 config from '@/config/index.js'; +import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js'; import { Brackets } from 'typeorm'; -import { deliverToRelays } from '../relay'; +import { deliverToRelays } from '../relay.js'; export async function deleteFile(file: DriveFile, isExpired = false) { if (file.storedInternal) { diff --git a/src/services/drive/generate-video-thumbnail.ts b/src/services/drive/generate-video-thumbnail.ts index f0adc7c33..e5cb243d4 100644 --- a/src/services/drive/generate-video-thumbnail.ts +++ b/src/services/drive/generate-video-thumbnail.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as tmp from 'tmp'; -import { IImage, convertToJpeg } from './image-processor'; +import { IImage, convertToJpeg } from './image-processor.js'; import * as FFmpeg from 'fluent-ffmpeg'; export async function GenerateVideoThumbnail(path: string): Promise { diff --git a/src/services/drive/internal-storage.ts b/src/services/drive/internal-storage.ts index 5ec563584..e857f942c 100644 --- a/src/services/drive/internal-storage.ts +++ b/src/services/drive/internal-storage.ts @@ -1,9 +1,15 @@ import * as fs from 'fs'; import * as Path from 'path'; -import config from '@/config'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import config from '@/config/index.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export class InternalStorage { - private static readonly path = Path.resolve(__dirname, '../../../files'); + private static readonly path = Path.resolve(_dirname, '../../../files'); public static resolvePath = (key: string) => Path.resolve(InternalStorage.path, key); diff --git a/src/services/drive/logger.ts b/src/services/drive/logger.ts index 655d074d6..917a8317e 100644 --- a/src/services/drive/logger.ts +++ b/src/services/drive/logger.ts @@ -1,3 +1,3 @@ -import Logger from '../logger'; +import Logger from '../logger.js'; export const driveLogger = new Logger('drive', 'blue'); diff --git a/src/services/drive/s3.ts b/src/services/drive/s3.ts index e75937861..89fad70dc 100644 --- a/src/services/drive/s3.ts +++ b/src/services/drive/s3.ts @@ -1,7 +1,7 @@ import { URL } from 'url'; import * as S3 from 'aws-sdk/clients/s3'; -import { Meta } from '../../models/entities/meta'; -import { getAgentByUrl } from '@/misc/fetch'; +import { Meta } from '@/models/entities/meta.js'; +import { getAgentByUrl } from '@/misc/fetch.js'; export function getS3(meta: Meta) { const u = meta.objectStorageEndpoint != null diff --git a/src/services/drive/upload-from-url.ts b/src/services/drive/upload-from-url.ts index 2f660d903..21b294142 100644 --- a/src/services/drive/upload-from-url.ts +++ b/src/services/drive/upload-from-url.ts @@ -1,12 +1,12 @@ import { URL } from 'url'; -import create from './add-file'; -import { User } from '../../models/entities/user'; -import { driveLogger } from './logger'; -import { createTemp } from '@/misc/create-temp'; -import { downloadUrl } from '@/misc/download-url'; -import { DriveFolder } from '../../models/entities/drive-folder'; -import { DriveFile } from '../../models/entities/drive-file'; -import { DriveFiles } from '../../models'; +import create from './add-file.js'; +import { User } from '@/models/entities/user.js'; +import { driveLogger } from './logger.js'; +import { createTemp } from '@/misc/create-temp.js'; +import { downloadUrl } from '@/misc/download-url.js'; +import { DriveFolder } from '@/models/entities/drive-folder.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { DriveFiles } from '@/models/index.js'; const logger = driveLogger.createSubLogger('downloader'); diff --git a/src/services/fetch-instance-metadata.ts b/src/services/fetch-instance-metadata.ts index e016e73a6..d21064868 100644 --- a/src/services/fetch-instance-metadata.ts +++ b/src/services/fetch-instance-metadata.ts @@ -1,10 +1,10 @@ import { DOMWindow, JSDOM } from 'jsdom'; import fetch from 'node-fetch'; -import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch'; -import { Instance } from '../models/entities/instance'; -import { Instances } from '../models'; -import { getFetchInstanceMetadataLock } from '@/misc/app-lock'; -import Logger from './logger'; +import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch.js'; +import { Instance } from '@/models/entities/instance.js'; +import { Instances } from '@/models/index.js'; +import { getFetchInstanceMetadataLock } from '@/misc/app-lock.js'; +import Logger from './logger.js'; import { URL } from 'url'; const logger = new Logger('metadata', 'cyan'); diff --git a/src/services/following/create.ts b/src/services/following/create.ts index de12285fc..194b95dea 100644 --- a/src/services/following/create.ts +++ b/src/services/following/create.ts @@ -1,19 +1,19 @@ -import { publishMainStream, publishUserEvent } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderFollow from '../../remote/activitypub/renderer/follow'; -import renderAccept from '../../remote/activitypub/renderer/accept'; -import renderReject from '../../remote/activitypub/renderer/reject'; -import { deliver } from '../../queue'; -import createFollowRequest from './requests/create'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import Logger from '../logger'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User } from '../../models/entities/user'; -import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '../../models'; -import { instanceChart, perUserFollowingChart } from '../chart'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../create-notification'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; +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 '../register-or-fetch-instance-doc.js'; +import Logger from '../logger.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { User } from '@/models/entities/user.js'; +import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '@/models/index.js'; +import { instanceChart, perUserFollowingChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../create-notification.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; const logger = new Logger('following/create'); diff --git a/src/services/following/delete.ts b/src/services/following/delete.ts index d0df0de6a..3ea226744 100644 --- a/src/services/following/delete.ts +++ b/src/services/following/delete.ts @@ -1,13 +1,13 @@ -import { publishMainStream, publishUserEvent } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderFollow from '../../remote/activitypub/renderer/follow'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import { deliver } from '../../queue'; -import Logger from '../logger'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import { User } from '../../models/entities/user'; -import { Followings, Users, Instances } from '../../models'; -import { instanceChart, perUserFollowingChart } from '../chart'; +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 { deliver } from '@/queue/index.js'; +import Logger from '../logger.js'; +import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js'; +import { User } from '@/models/entities/user.js'; +import { Followings, Users, Instances } from '@/models/index.js'; +import { instanceChart, perUserFollowingChart } from '@/services/chart/index.js'; const logger = new Logger('following/delete'); diff --git a/src/services/following/requests/accept-all.ts b/src/services/following/requests/accept-all.ts index 5fc70fcf1..8025a134f 100644 --- a/src/services/following/requests/accept-all.ts +++ b/src/services/following/requests/accept-all.ts @@ -1,6 +1,6 @@ -import accept from './accept'; -import { User } from '../../../models/entities/user'; -import { FollowRequests, Users } from '../../../models'; +import accept from './accept.js'; +import { User } from '@/models/entities/user.js'; +import { FollowRequests, Users } from '@/models/index.js'; /** * 指定したユーザー宛てのフォローリクエストをすべて承認 diff --git a/src/services/following/requests/accept.ts b/src/services/following/requests/accept.ts index 4277a1a1e..ff4d0ff99 100644 --- a/src/services/following/requests/accept.ts +++ b/src/services/following/requests/accept.ts @@ -1,12 +1,12 @@ -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import renderAccept from '../../../remote/activitypub/renderer/accept'; -import { deliver } from '../../../queue'; -import { publishMainStream } from '../../stream'; -import { insertFollowingDoc } from '../create'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { FollowRequests, Users } from '../../../models'; -import { IdentifiableError } from '@/misc/identifiable-error'; +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 { User, ILocalUser } from '@/models/entities/user.js'; +import { FollowRequests, Users } from '@/models/index.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: User) { const request = await FollowRequests.findOne({ diff --git a/src/services/following/requests/cancel.ts b/src/services/following/requests/cancel.ts index 53c20088c..3f60fefd1 100644 --- a/src/services/following/requests/cancel.ts +++ b/src/services/following/requests/cancel.ts @@ -1,11 +1,11 @@ -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import renderUndo from '../../../remote/activitypub/renderer/undo'; -import { deliver } from '../../../queue'; -import { publishMainStream } from '../../stream'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { Users, FollowRequests } from '../../../models'; +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 { User, ILocalUser } from '@/models/entities/user.js'; +import { Users, FollowRequests } from '@/models/index.js'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox'] }, follower: { id: User['id']; host: User['host']; uri: User['host'] }) { if (Users.isRemoteUser(followee)) { diff --git a/src/services/following/requests/create.ts b/src/services/following/requests/create.ts index 584591b00..8f26a6611 100644 --- a/src/services/following/requests/create.ts +++ b/src/services/following/requests/create.ts @@ -1,11 +1,11 @@ -import { publishMainStream } from '../../stream'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import { deliver } from '../../../queue'; -import { User } from '../../../models/entities/user'; -import { Blockings, FollowRequests, Users } from '../../../models'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../../create-notification'; +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 { User } from '@/models/entities/user.js'; +import { Blockings, FollowRequests, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../../create-notification.js'; export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, requestId?: string) { if (follower.id === followee.id) return; diff --git a/src/services/following/requests/reject.ts b/src/services/following/requests/reject.ts index 45effc580..e180f1dc4 100644 --- a/src/services/following/requests/reject.ts +++ b/src/services/following/requests/reject.ts @@ -1,11 +1,11 @@ -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderFollow from '../../../remote/activitypub/renderer/follow'; -import renderReject from '../../../remote/activitypub/renderer/reject'; -import { deliver } from '../../../queue'; -import { publishMainStream, publishUserEvent } from '../../stream'; -import { User, ILocalUser } from '../../../models/entities/user'; -import { Users, FollowRequests, Followings } from '../../../models'; -import { decrementFollowing } from '../delete'; +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 } from '@/queue/index.js'; +import { publishMainStream, publishUserEvent } from '@/services/stream.js'; +import { User, ILocalUser } from '@/models/entities/user.js'; +import { Users, FollowRequests, Followings } from '@/models/index.js'; +import { decrementFollowing } from '../delete.js'; export default async function(followee: { id: User['id']; host: User['host']; uri: User['host'] }, follower: User) { if (Users.isRemoteUser(follower) && Users.isLocalUser(followee)) { diff --git a/src/services/i/pin.ts b/src/services/i/pin.ts index e3a73b5b9..da95b6070 100644 --- a/src/services/i/pin.ts +++ b/src/services/i/pin.ts @@ -1,15 +1,15 @@ -import config from '@/config'; -import renderAdd from '../../remote/activitypub/renderer/add'; -import renderRemove from '../../remote/activitypub/renderer/remove'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User } from '../../models/entities/user'; -import { Note } from '../../models/entities/note'; -import { Notes, UserNotePinings, Users } from '../../models'; -import { UserNotePining } from '../../models/entities/user-note-pining'; -import { genId } from '@/misc/gen-id'; -import { deliverToFollowers } from '../../remote/activitypub/deliver-manager'; -import { deliverToRelays } from '../relay'; +import config from '@/config/index.js'; +import renderAdd from '@/remote/activitypub/renderer/add.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 { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes, UserNotePinings, Users } from '@/models/index.js'; +import { 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 '../relay.js'; /** * 指定した投稿をピン留めします diff --git a/src/services/i/update.ts b/src/services/i/update.ts index 8d40b08a8..1fbaf40df 100644 --- a/src/services/i/update.ts +++ b/src/services/i/update.ts @@ -1,10 +1,10 @@ -import renderUpdate from '../../remote/activitypub/renderer/update'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { Users } from '../../models'; -import { User } from '../../models/entities/user'; -import { renderPerson } from '../../remote/activitypub/renderer/person'; -import { deliverToFollowers } from '../../remote/activitypub/deliver-manager'; -import { deliverToRelays } from '../relay'; +import renderUpdate from '@/remote/activitypub/renderer/update.js'; +import { renderActivity } from '@/remote/activitypub/renderer/index.js'; +import { Users } from '@/models/index.js'; +import { 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 '../relay.js'; export async function publishToFollowers(userId: User['id']) { const user = await Users.findOne(userId); diff --git a/src/services/insert-moderation-log.ts b/src/services/insert-moderation-log.ts index 8ba64fa34..1d8fe9a9d 100644 --- a/src/services/insert-moderation-log.ts +++ b/src/services/insert-moderation-log.ts @@ -1,6 +1,6 @@ -import { ModerationLogs } from '../models'; -import { genId } from '@/misc/gen-id'; -import { User } from '@/models/entities/user'; +import { ModerationLogs } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { User } from '@/models/entities/user.js'; export async function insertModerationLog(moderator: { id: User['id'] }, type: string, info?: Record) { await ModerationLogs.insert({ diff --git a/src/services/instance-actor.ts b/src/services/instance-actor.ts index 9b9c74606..6a592363e 100644 --- a/src/services/instance-actor.ts +++ b/src/services/instance-actor.ts @@ -1,7 +1,7 @@ -import { createSystemUser } from './create-system-user'; -import { ILocalUser } from '../models/entities/user'; -import { Users } from '../models'; -import { Cache } from '@/misc/cache'; +import { createSystemUser } from './create-system-user.js'; +import { ILocalUser } from '@/models/entities/user.js'; +import { Users } from '@/models/index.js'; +import { Cache } from '@/misc/cache.js'; const ACTOR_USERNAME = 'instance.actor' as const; diff --git a/src/services/logger.ts b/src/services/logger.ts index de62b3aca..ac74c13af 100644 --- a/src/services/logger.ts +++ b/src/services/logger.ts @@ -2,13 +2,13 @@ import * as cluster from 'cluster'; import * as os from 'os'; import * as chalk from 'chalk'; import * as dateformat from 'dateformat'; -import { program } from '../argv'; +import { program } from '../argv.js'; import { getRepository } from 'typeorm'; -import { Log } from '../models/entities/log'; -import { genId } from '@/misc/gen-id'; -import config from '@/config'; +import { Log } from '@/models/entities/log.js'; +import { genId } from '@/misc/gen-id.js'; +import config from '@/config/index.js'; -const SyslogPro = require('syslog-pro'); +import SyslogPro from 'syslog-pro'; type Domain = { name: string; diff --git a/src/services/messages/create.ts b/src/services/messages/create.ts index f84729cde..c6430f07b 100644 --- a/src/services/messages/create.ts +++ b/src/services/messages/create.ts @@ -1,17 +1,17 @@ -import { User } from '../../models/entities/user'; -import { UserGroup } from '../../models/entities/user-group'; -import { DriveFile } from '../../models/entities/drive-file'; -import { MessagingMessages, UserGroupJoinings, Mutings, Users } from '../../models'; -import { genId } from '@/misc/gen-id'; -import { MessagingMessage } from '../../models/entities/messaging-message'; -import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '../stream'; -import pushNotification from '../push-notification'; +import { User } from '@/models/entities/user.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { MessagingMessages, UserGroupJoinings, Mutings, Users } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { MessagingMessage } from '@/models/entities/messaging-message.js'; +import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '@/services/stream.js'; +import pushNotification from '../push-notification.js'; import { Not } from 'typeorm'; -import { Note } from '../../models/entities/note'; -import renderNote from '../../remote/activitypub/renderer/note'; -import renderCreate from '../../remote/activitypub/renderer/create'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { deliver } from '../../queue'; +import { 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 { deliver } from '@/queue/index.js'; export async function createMessage(user: { id: User['id']; host: User['host']; }, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | undefined, file: DriveFile | null, uri?: string) { const message = { diff --git a/src/services/messages/delete.ts b/src/services/messages/delete.ts index 522815e55..82eb6cb21 100644 --- a/src/services/messages/delete.ts +++ b/src/services/messages/delete.ts @@ -1,11 +1,11 @@ -import config from '@/config'; -import { MessagingMessages, Users } from '../../models'; -import { MessagingMessage } from '../../models/entities/messaging-message'; -import { publishGroupMessagingStream, publishMessagingStream } from '../stream'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderDelete from '../../remote/activitypub/renderer/delete'; -import renderTombstone from '../../remote/activitypub/renderer/tombstone'; -import { deliver } from '../../queue'; +import config from '@/config/index.js'; +import { MessagingMessages, Users } from '@/models/index.js'; +import { 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/src/services/note/create.ts b/src/services/note/create.ts index 13d612cf8..d89663c78 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -1,39 +1,39 @@ import * as mfm from 'mfm-js'; -import es from '../../db/elasticsearch'; -import { publishMainStream, publishNotesStream } from '../stream'; -import DeliverManager from '../../remote/activitypub/deliver-manager'; -import renderNote from '../../remote/activitypub/renderer/note'; -import renderCreate from '../../remote/activitypub/renderer/create'; -import renderAnnounce from '../../remote/activitypub/renderer/announce'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import { resolveUser } from '../../remote/resolve-user'; -import config from '@/config'; -import { updateHashtags } from '../update-hashtag'; -import { concat } from '../../prelude/array'; -import insertNoteUnread from './unread'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import { extractMentions } from '@/misc/extract-mentions'; -import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm'; -import { extractHashtags } from '@/misc/extract-hashtags'; -import { Note, IMentionedRemoteUsers } from '../../models/entities/note'; -import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings } from '../../models'; -import { DriveFile } from '../../models/entities/drive-file'; -import { App } from '../../models/entities/app'; +import es from '../../db/elasticsearch.js'; +import { publishMainStream, publishNotesStream } 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 '../update-hashtag.js'; +import { concat } from '../../prelude/array.js'; +import insertNoteUnread from './unread.js'; +import { registerOrFetchInstanceDoc } from '../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 { Note, IMentionedRemoteUsers } from '@/models/entities/note.js'; +import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings } from '@/models/index.js'; +import { DriveFile } from '@/models/entities/drive-file.js'; +import { App } from '@/models/entities/app.js'; import { Not, getConnection, In } from 'typeorm'; -import { User, ILocalUser, IRemoteUser } from '../../models/entities/user'; -import { genId } from '@/misc/gen-id'; -import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '../chart'; -import { Poll, IPoll } from '../../models/entities/poll'; -import { createNotification } from '../create-notification'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; -import { checkHitAntenna } from '@/misc/check-hit-antenna'; -import { checkWordMute } from '@/misc/check-word-mute'; -import { addNoteToAntenna } from '../add-note-to-antenna'; -import { countSameRenotes } from '@/misc/count-same-renotes'; -import { deliverToRelays } from '../relay'; -import { Channel } from '../../models/entities/channel'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; -import { getAntennas } from '@/misc/antenna-cache'; +import { 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 { Poll, IPoll } from '@/models/entities/poll.js'; +import { createNotification } from '../create-notification.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; +import { checkHitAntenna } from '@/misc/check-hit-antenna.js'; +import { checkWordMute } from '@/misc/check-word-mute.js'; +import { addNoteToAntenna } from '../add-note-to-antenna.js'; +import { countSameRenotes } from '@/misc/count-same-renotes.js'; +import { deliverToRelays } from '../relay.js'; +import { Channel } from '@/models/entities/channel.js'; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; diff --git a/src/services/note/delete.ts b/src/services/note/delete.ts index a7ac86e10..353cd8803 100644 --- a/src/services/note/delete.ts +++ b/src/services/note/delete.ts @@ -1,18 +1,18 @@ -import { publishNoteStream } from '../stream'; -import renderDelete from '../../remote/activitypub/renderer/delete'; -import renderAnnounce from '../../remote/activitypub/renderer/announce'; -import renderUndo from '../../remote/activitypub/renderer/undo'; -import { renderActivity } from '../../remote/activitypub/renderer'; -import renderTombstone from '../../remote/activitypub/renderer/tombstone'; -import config from '@/config'; -import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc'; -import { User, ILocalUser, IRemoteUser } from '../../models/entities/user'; -import { Note, IMentionedRemoteUsers } from '../../models/entities/note'; -import { Notes, Users, Instances } from '../../models'; -import { notesChart, perUserNotesChart, instanceChart } from '../chart'; -import { deliverToFollowers, deliverToUser } from '../../remote/activitypub/deliver-manager'; -import { countSameRenotes } from '@/misc/count-same-renotes'; -import { deliverToRelays } from '../relay'; +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 { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js'; +import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js'; +import { 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 { countSameRenotes } from '@/misc/count-same-renotes.js'; +import { deliverToRelays } from '../relay.js'; import { Brackets, In } from 'typeorm'; /** diff --git a/src/services/note/polls/update.ts b/src/services/note/polls/update.ts index a33efab66..88baf16b6 100644 --- a/src/services/note/polls/update.ts +++ b/src/services/note/polls/update.ts @@ -1,10 +1,10 @@ -import renderUpdate from '../../../remote/activitypub/renderer/update'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import renderNote from '../../../remote/activitypub/renderer/note'; -import { Users, Notes } from '../../../models'; -import { Note } from '../../../models/entities/note'; -import { deliverToFollowers } from '../../../remote/activitypub/deliver-manager'; -import { deliverToRelays } from '../../relay'; +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 { Users, Notes } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js'; +import { deliverToRelays } from '../../relay.js'; export async function deliverQuestionUpdate(noteId: Note['id']) { const note = await Notes.findOne(noteId); diff --git a/src/services/note/polls/vote.ts b/src/services/note/polls/vote.ts index d3cf9f211..36e06cb6a 100644 --- a/src/services/note/polls/vote.ts +++ b/src/services/note/polls/vote.ts @@ -1,10 +1,10 @@ -import { publishNoteStream } from '../../stream'; -import { User } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { PollVotes, NoteWatchings, Polls, Blockings } from '../../../models'; +import { publishNoteStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { 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'; -import { createNotification } from '../../create-notification'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../../create-notification.js'; export default async function(user: User, note: Note, choice: number) { const poll = await Polls.findOne(note.id); diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index b8a8d172f..f2dd273c4 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -1,19 +1,19 @@ -import { publishNoteStream } from '../../stream'; -import { renderLike } from '../../../remote/activitypub/renderer/like'; -import DeliverManager from '../../../remote/activitypub/deliver-manager'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import { toDbReaction, decodeReaction } from '@/misc/reaction-lib'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '../../../models'; +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 { toDbReaction, decodeReaction } from '@/misc/reaction-lib.js'; +import { User, IRemoteUser } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '@/models/index.js'; import { Not } from 'typeorm'; -import { perUserReactionsChart } from '../../chart'; -import { genId } from '@/misc/gen-id'; -import { createNotification } from '../../create-notification'; -import deleteReaction from './delete'; -import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error'; -import { NoteReaction } from '../../../models/entities/note-reaction'; -import { IdentifiableError } from '@/misc/identifiable-error'; +import { perUserReactionsChart } from '@/services/chart/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { createNotification } from '../../create-notification.js'; +import deleteReaction from './delete.js'; +import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; +import { NoteReaction } from '@/models/entities/note-reaction.js'; +import { IdentifiableError } from '@/misc/identifiable-error.js'; export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => { // Check blocking diff --git a/src/services/note/reaction/delete.ts b/src/services/note/reaction/delete.ts index 712031fa8..86e7b640e 100644 --- a/src/services/note/reaction/delete.ts +++ b/src/services/note/reaction/delete.ts @@ -1,13 +1,13 @@ -import { publishNoteStream } from '../../stream'; -import { renderLike } from '../../../remote/activitypub/renderer/like'; -import renderUndo from '../../../remote/activitypub/renderer/undo'; -import { renderActivity } from '../../../remote/activitypub/renderer'; -import DeliverManager from '../../../remote/activitypub/deliver-manager'; -import { IdentifiableError } from '@/misc/identifiable-error'; -import { User, IRemoteUser } from '../../../models/entities/user'; -import { Note } from '../../../models/entities/note'; -import { NoteReactions, Users, Notes } from '../../../models'; -import { decodeReaction } from '@/misc/reaction-lib'; +import { publishNoteStream } from '@/services/stream.js'; +import { renderLike } from '@/remote/activitypub/renderer/like.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.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 { User, IRemoteUser } from '@/models/entities/user.js'; +import { 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']; }, note: Note) => { // if already unreacted diff --git a/src/services/note/read.ts b/src/services/note/read.ts index a661c0a9d..ac450af78 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -1,13 +1,13 @@ -import { publishMainStream } from '../stream'; -import { Note } from '../../models/entities/note'; -import { User } from '../../models/entities/user'; -import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '../../models'; +import { publishMainStream } from '@/services/stream.js'; +import { Note } from '@/models/entities/note.js'; +import { User } from '@/models/entities/user.js'; +import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '@/models/index.js'; import { Not, IsNull, In } from 'typeorm'; -import { Channel } from '../../models/entities/channel'; -import { checkHitAntenna } from '@/misc/check-hit-antenna'; -import { getAntennas } from '@/misc/antenna-cache'; -import { PackedNote } from '../../models/repositories/note'; -import { readNotificationByQuery } from '@/server/api/common/read-notification'; +import { Channel } from '@/models/entities/channel.js'; +import { checkHitAntenna } from '@/misc/check-hit-antenna.js'; +import { getAntennas } from '@/misc/antenna-cache.js'; +import { PackedNote } from '@/models/repositories/note.js'; +import { readNotificationByQuery } from '@/server/api/common/read-notification.js'; /** * Mark notes as read diff --git a/src/services/note/unread.ts b/src/services/note/unread.ts index 5cfba0f34..b68ff7974 100644 --- a/src/services/note/unread.ts +++ b/src/services/note/unread.ts @@ -1,8 +1,8 @@ -import { Note } from '../../models/entities/note'; -import { publishMainStream } from '../stream'; -import { User } from '../../models/entities/user'; -import { Mutings, NoteUnreads } from '../../models'; -import { genId } from '@/misc/gen-id'; +import { Note } from '@/models/entities/note.js'; +import { publishMainStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { Mutings, NoteUnreads } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; export default async function(userId: User['id'], note: Note, params: { // NOTE: isSpecifiedがtrueならisMentionedは必ずfalse diff --git a/src/services/note/unwatch.ts b/src/services/note/unwatch.ts index 047ac343b..32da2cf14 100644 --- a/src/services/note/unwatch.ts +++ b/src/services/note/unwatch.ts @@ -1,6 +1,6 @@ -import { User } from '../../models/entities/user'; -import { NoteWatchings } from '../../models'; -import { Note } from '../../models/entities/note'; +import { User } from '@/models/entities/user.js'; +import { NoteWatchings } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; export default async (me: User['id'], note: Note) => { await NoteWatchings.delete({ diff --git a/src/services/note/watch.ts b/src/services/note/watch.ts index e333f0428..12d97c845 100644 --- a/src/services/note/watch.ts +++ b/src/services/note/watch.ts @@ -1,8 +1,8 @@ -import { User } from '../../models/entities/user'; -import { Note } from '../../models/entities/note'; -import { NoteWatchings } from '../../models'; -import { genId } from '@/misc/gen-id'; -import { NoteWatching } from '../../models/entities/note-watching'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { NoteWatchings } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; +import { NoteWatching } from '@/models/entities/note-watching.js'; export default async (me: User['id'], note: Note) => { // 自分の投稿はwatchできない diff --git a/src/services/push-notification.ts b/src/services/push-notification.ts index 6c0b77c31..bedfa0533 100644 --- a/src/services/push-notification.ts +++ b/src/services/push-notification.ts @@ -1,9 +1,9 @@ import * as push from 'web-push'; -import config from '@/config'; -import { SwSubscriptions } from '../models'; -import { fetchMeta } from '@/misc/fetch-meta'; -import { PackedNotification } from '../models/repositories/notification'; -import { PackedMessagingMessage } from '../models/repositories/messaging-message'; +import config from '@/config/index.js'; +import { SwSubscriptions } from '@/models/index.js'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import { PackedNotification } from '../models/repositories/notification.js'; +import { PackedMessagingMessage } from '../models/repositories/messaging-message.js'; type notificationType = 'notification' | 'unreadMessagingMessage'; type notificationBody = PackedNotification | PackedMessagingMessage; diff --git a/src/services/register-or-fetch-instance-doc.ts b/src/services/register-or-fetch-instance-doc.ts index 2edf85fd9..0bbc9ab27 100644 --- a/src/services/register-or-fetch-instance-doc.ts +++ b/src/services/register-or-fetch-instance-doc.ts @@ -1,9 +1,9 @@ -import { Instance } from '../models/entities/instance'; -import { Instances } from '../models'; -import { federationChart } from './chart'; -import { genId } from '@/misc/gen-id'; -import { toPuny } from '@/misc/convert-host'; -import { Cache } from '@/misc/cache'; +import { Instance } from '@/models/entities/instance.js'; +import { Instances } from '@/models/index.js'; +import { federationChart } from '@/services/chart/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(1000 * 60 * 60); diff --git a/src/services/relay.ts b/src/services/relay.ts index a2cc711bd..8e0fa12fb 100644 --- a/src/services/relay.ts +++ b/src/services/relay.ts @@ -1,11 +1,11 @@ -import { createSystemUser } from './create-system-user'; -import { renderFollowRelay } from '../remote/activitypub/renderer/follow-relay'; -import { renderActivity, attachLdSignature } from '../remote/activitypub/renderer'; -import renderUndo from '../remote/activitypub/renderer/undo'; -import { deliver } from '../queue'; -import { ILocalUser, User } from '../models/entities/user'; -import { Users, Relays } from '../models'; -import { genId } from '@/misc/gen-id'; +import { createSystemUser } from './create-system-user.js'; +import { renderFollowRelay } from '@/remote/activitypub/renderer/follow-relay.js'; +import { renderActivity, attachLdSignature } from '@/remote/activitypub/renderer/index.js'; +import renderUndo from '@/remote/activitypub/renderer/undo.js'; +import { deliver } from '@/queue/index.js'; +import { ILocalUser, User } from '@/models/entities/user.js'; +import { Users, Relays } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; const ACTOR_USERNAME = 'relay.actor' as const; diff --git a/src/services/send-email-notification.ts b/src/services/send-email-notification.ts index ad1742951..18f5b7607 100644 --- a/src/services/send-email-notification.ts +++ b/src/services/send-email-notification.ts @@ -1,9 +1,9 @@ -import { UserProfiles } from '../models'; -import { User } from '../models/entities/user'; -import { sendEmail } from './send-email'; -import * as locales from '../../locales/'; -import { I18n } from '@/misc/i18n'; -import { getAcct } from '@/misc/acct'; +import { UserProfiles } from '@/models/index.js'; +import { User } from '@/models/entities/user.js'; +import { sendEmail } from './send-email.js'; +import * as locales from '../../locales/index.js'; +import { I18n } from '@/misc/i18n.js'; +import { getAcct } from '@/misc/acct.js'; // TODO: locale ファイルをクライアント用とサーバー用で分けたい diff --git a/src/services/send-email.ts b/src/services/send-email.ts index 4784ba551..135fb3d32 100644 --- a/src/services/send-email.ts +++ b/src/services/send-email.ts @@ -1,7 +1,7 @@ import * as nodemailer from 'nodemailer'; -import { fetchMeta } from '@/misc/fetch-meta'; -import Logger from './logger'; -import config from '@/config'; +import { fetchMeta } from '@/misc/fetch-meta.js'; +import Logger from './logger.js'; +import config from '@/config/index.js'; export const logger = new Logger('email'); diff --git a/src/services/stream.ts b/src/services/stream.ts index 6258dc5a7..e33494453 100644 --- a/src/services/stream.ts +++ b/src/services/stream.ts @@ -1,12 +1,12 @@ -import { redisClient } from '../db/redis'; -import { User } from '../models/entities/user'; -import { Note } from '../models/entities/note'; -import { UserList } from '../models/entities/user-list'; -import { ReversiGame } from '../models/entities/games/reversi/game'; -import { UserGroup } from '../models/entities/user-group'; -import config from '@/config'; -import { Antenna } from '../models/entities/antenna'; -import { Channel } from '../models/entities/channel'; +import { redisClient } from '../db/redis.js'; +import { User } from '@/models/entities/user.js'; +import { Note } from '@/models/entities/note.js'; +import { UserList } from '@/models/entities/user-list.js'; +import { ReversiGame } from '@/models/entities/games/reversi/game.js'; +import { UserGroup } from '@/models/entities/user-group.js'; +import config from '@/config/index.js'; +import { Antenna } from '@/models/entities/antenna.js'; +import { Channel } from '@/models/entities/channel.js'; class Publisher { private publish = (channel: string, type: string | null, value?: any): void => { diff --git a/src/services/suspend-user.ts b/src/services/suspend-user.ts index c868c0130..5ec639b1b 100644 --- a/src/services/suspend-user.ts +++ b/src/services/suspend-user.ts @@ -1,9 +1,9 @@ -import renderDelete from '../remote/activitypub/renderer/delete'; -import { renderActivity } from '../remote/activitypub/renderer'; -import { deliver } from '../queue'; -import config from '@/config'; -import { User } from '../models/entities/user'; -import { Users, Followings } from '../models'; +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 { User } from '@/models/entities/user.js'; +import { Users, Followings } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; export async function doPostSuspend(user: { id: User['id']; host: User['host'] }) { diff --git a/src/services/unsuspend-user.ts b/src/services/unsuspend-user.ts index 5bc4bba42..3728e0539 100644 --- a/src/services/unsuspend-user.ts +++ b/src/services/unsuspend-user.ts @@ -1,10 +1,10 @@ -import renderDelete from '../remote/activitypub/renderer/delete'; -import renderUndo from '../remote/activitypub/renderer/undo'; -import { renderActivity } from '../remote/activitypub/renderer'; -import { deliver } from '../queue'; -import config from '@/config'; -import { User } from '../models/entities/user'; -import { Users, Followings } from '../models'; +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 { User } from '@/models/entities/user.js'; +import { Users, Followings } from '@/models/index.js'; import { Not, IsNull } from 'typeorm'; export async function doPostUnsuspend(user: User) { diff --git a/src/services/update-hashtag.ts b/src/services/update-hashtag.ts index 6b7208f00..b6fb38bc5 100644 --- a/src/services/update-hashtag.ts +++ b/src/services/update-hashtag.ts @@ -1,9 +1,9 @@ -import { User } from '../models/entities/user'; -import { Hashtags, Users } from '../models'; -import { hashtagChart } from './chart'; -import { genId } from '@/misc/gen-id'; -import { Hashtag } from '../models/entities/hashtag'; -import { normalizeForSearch } from '@/misc/normalize-for-search'; +import { 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 { 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']; }, tags: string[]) { for (const tag of tags) { diff --git a/src/services/user-list/push.ts b/src/services/user-list/push.ts index 3dd9a8576..01e9243c1 100644 --- a/src/services/user-list/push.ts +++ b/src/services/user-list/push.ts @@ -1,11 +1,11 @@ -import { publishUserListStream } from '../stream'; -import { User } from '../../models/entities/user'; -import { UserList } from '../../models/entities/user-list'; -import { UserListJoinings, Users } from '../../models'; -import { UserListJoining } from '../../models/entities/user-list-joining'; -import { genId } from '@/misc/gen-id'; -import { fetchProxyAccount } from '@/misc/fetch-proxy-account'; -import createFollowing from '../following/create'; +import { publishUserListStream } from '@/services/stream.js'; +import { User } from '@/models/entities/user.js'; +import { UserList } from '@/models/entities/user-list.js'; +import { UserListJoinings, Users } from '@/models/index.js'; +import { 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 '../following/create.js'; export async function pushUserToUserList(target: User, list: UserList) { await UserListJoinings.insert({ diff --git a/src/tools/accept-migration.ts b/src/tools/accept-migration.ts index 062286939..adbfcdadf 100644 --- a/src/tools/accept-migration.ts +++ b/src/tools/accept-migration.ts @@ -1,7 +1,7 @@ // ex) node built/tools/accept-migration Yo 1000000000001 import { createConnection } from 'typeorm'; -import config from '@/config'; +import config from '@/config/index.js'; createConnection({ type: 'postgres', diff --git a/src/tools/add-emoji.ts b/src/tools/add-emoji.ts index ca25d1348..054286c64 100644 --- a/src/tools/add-emoji.ts +++ b/src/tools/add-emoji.ts @@ -1,5 +1,5 @@ -import { Emojis } from '../models'; -import { genId } from '@/misc/gen-id'; +import { Emojis } from '@/models/index.js'; +import { genId } from '@/misc/gen-id.js'; async function main(name: string, url: string, alias?: string): Promise { const aliases = alias != null ? [ alias ] : []; diff --git a/src/tools/demote-admin.ts b/src/tools/demote-admin.ts index 5e3e64bff..37bd5007a 100644 --- a/src/tools/demote-admin.ts +++ b/src/tools/demote-admin.ts @@ -1,6 +1,6 @@ -import { initDb } from '../db/postgre'; +import { initDb } from '../db/postgre.js'; import { getRepository } from 'typeorm'; -import { User } from '../models/entities/user'; +import { User } from '@/models/entities/user.js'; async function main(username: string) { if (!username) throw `username required`; diff --git a/src/tools/mark-admin.ts b/src/tools/mark-admin.ts index 5844bb464..4c583926e 100644 --- a/src/tools/mark-admin.ts +++ b/src/tools/mark-admin.ts @@ -1,6 +1,6 @@ -import { initDb } from '../db/postgre'; +import { initDb } from '../db/postgre.js'; import { getRepository } from 'typeorm'; -import { User } from '../models/entities/user'; +import { User } from '@/models/entities/user.js'; async function main(username: string) { if (!username) throw `username required`; diff --git a/src/tools/refresh-question.ts b/src/tools/refresh-question.ts index 83d71ff30..3e850ba83 100644 --- a/src/tools/refresh-question.ts +++ b/src/tools/refresh-question.ts @@ -1,4 +1,4 @@ -import { updateQuestion } from '../remote/activitypub/models/question'; +import { updateQuestion } from '@/remote/activitypub/models/question.js'; async function main(uri: string): Promise { return await updateQuestion(uri); diff --git a/src/tools/resync-remote-user.ts b/src/tools/resync-remote-user.ts index ad2e231eb..3c02fb94c 100644 --- a/src/tools/resync-remote-user.ts +++ b/src/tools/resync-remote-user.ts @@ -1,9 +1,9 @@ -import { initDb } from '@/db/postgre'; -import { parseAcct } from '@/misc/acct'; +import { initDb } from '@/db/postgre.js'; +import { parseAcct } from '@/misc/acct.js'; async function main(acct: string): Promise { await initDb(); - const { resolveUser } = await import('../remote/resolve-user'); + const { resolveUser } = await import('@/remote/resolve-user'); const { username, host } = parseAcct(acct); await resolveUser(username, host, {}, true); diff --git a/src/tools/show-signin-history.ts b/src/tools/show-signin-history.ts index fd7cd39e3..6fdff3902 100644 --- a/src/tools/show-signin-history.ts +++ b/src/tools/show-signin-history.ts @@ -1,4 +1,4 @@ -import { Users, Signins } from '../models'; +import { Users, Signins } from '@/models/index.js'; // node built/tools/show-signin-history username // => {Success} {Date} {IPAddrsss} diff --git a/src/tsconfig.json b/src/tsconfig.json index 9389008ee..4a03a1743 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -12,6 +12,7 @@ "target": "es2017", "module": "commonjs", "moduleResolution": "node", + "allowSyntheticDefaultImports": true, "removeComments": false, "noLib": false, "strict": true, diff --git a/test/tsconfig.json b/test/tsconfig.json index 31a537805..9f9e724ea 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -12,6 +12,7 @@ "target": "es2017", "module": "commonjs", "moduleResolution": "node", + "allowSyntheticDefaultImports": true, "removeComments": false, "noLib": false, "strict": true,