diff --git a/.github/workflows/get-api-diff.yml b/.github/workflows/get-api-diff.yml new file mode 100644 index 0000000000..9bab4f6583 --- /dev/null +++ b/.github/workflows/get-api-diff.yml @@ -0,0 +1,225 @@ +name: Report API Diff + +on: + pull_request: + branches: + - master + - develop + +jobs: + get-base: + runs-on: ubuntu-latest + permissions: + contents: read + + strategy: + matrix: + node-version: [20.5.1] + + services: + db: + image: postgres:13 + ports: + - 5432:5432 + env: + POSTGRES_DB: misskey + POSTGRES_HOST_AUTH_METHOD: trust + POSTGRES_USER: example-misskey-user + POSTGRESS_PASS: example-misskey-pass + redis: + image: redis:7 + ports: + - 6379:6379 + + steps: + - uses: actions/checkout@v4.1.1 + with: + repository: ${{ github.event.pull_request.base.repo.full_name }} + ref: ${{ github.base_ref }} + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3.8.1 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .config/example.yml .config/default.yml + - name: Build + run: pnpm build + - name : Migrate + run: pnpm migrate + - name: Launch misskey + run: | + screen -S misskey -dm pnpm run dev + sleep 30s + - name: Wait for Misskey to be ready + run: | + MAX_RETRIES=12 + RETRY_DELAY=5 + count=0 + until $(curl --output /dev/null --silent --head --fail http://localhost:3000) || [[ $count -eq $MAX_RETRIES ]]; do + printf '.' + sleep $RETRY_DELAY + count=$((count + 1)) + done + + if [[ $count -eq $MAX_RETRIES ]]; then + echo "Failed to connect to Misskey after $MAX_RETRIES attempts." + exit 1 + fi + - id: fetch + name: Get api.json from Misskey + run: | + RESULT=$(curl --retry 5 --retry-delay 5 --retry-max-time 60 http://localhost:3000/api.json) + echo $RESULT > api-base.json + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: api-artifact + path: api-base.json + - name: Kill Misskey Job + run: screen -S misskey -X quit + + get-head: + runs-on: ubuntu-latest + permissions: + contents: read + + strategy: + matrix: + node-version: [20.5.1] + + services: + db: + image: postgres:13 + ports: + - 5432:5432 + env: + POSTGRES_DB: misskey + POSTGRES_HOST_AUTH_METHOD: trust + POSTGRES_USER: example-misskey-user + POSTGRESS_PASS: example-misskey-pass + redis: + image: redis:7 + ports: + - 6379:6379 + + steps: + - uses: actions/checkout@v4.1.1 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3.8.1 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .config/example.yml .config/default.yml + - name: Build + run: pnpm build + - name : Migrate + run: pnpm migrate + - name: Launch misskey + run: | + screen -S misskey -dm pnpm run dev + sleep 30s + - name: Wait for Misskey to be ready + run: | + MAX_RETRIES=12 + RETRY_DELAY=5 + count=0 + until $(curl --output /dev/null --silent --head --fail http://localhost:3000) || [[ $count -eq $MAX_RETRIES ]]; do + printf '.' + sleep $RETRY_DELAY + count=$((count + 1)) + done + + if [[ $count -eq $MAX_RETRIES ]]; then + echo "Failed to connect to Misskey after $MAX_RETRIES attempts." + exit 1 + fi + - id: fetch + name: Get api.json from Misskey + run: | + RESULT=$(curl --retry 5 --retry-delay 5 --retry-max-time 60 http://localhost:3000/api.json) + echo $RESULT > api-head.json + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: api-artifact + path: api-head.json + - name: Kill Misskey Job + run: screen -S misskey -X quit + + compare-diff: + runs-on: ubuntu-latest + if: success() + needs: [get-base, get-head] + permissions: + pull-requests: write + + steps: + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: api-artifact + path: ./artifacts + - name: Output base + run: cat ./artifacts/api-base.json + - name: Output head + run: cat ./artifacts/api-head.json + - name: Arrange json files + run: | + jq '.' ./artifacts/api-base.json > ./api-base.json + jq '.' ./artifacts/api-head.json > ./api-head.json + - name: Get diff of 2 files + run: diff -u --label=base --label=head ./api-base.json ./api-head.json | cat > api.json.diff + - name: Get full diff + run: diff --label=base --label=head --new-line-format='+%L' --old-line-format='-%L' --unchanged-line-format=' %L' ./api-base.json ./api-head.json | cat > api-full.json.diff + - name: Echo full diff + run: cat ./api-full.json.diff + - name: Upload full diff to Artifact + uses: actions/upload-artifact@v3 + with: + name: api-artifact + path: api-full.json.diff + - id: out-diff + name: Build diff Comment + run: | + cat <<- EOF > ./output.md + このPRによるapi.jsonの差分 +
+ 差分はこちら + + \`\`\`diff + $(cat ./api.json.diff) + \`\`\` +
+ + [Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) + EOF + - name: Write diff comment + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: show_diff + filePath: ./output.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a4ad0244f5..ae566fd1d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,19 @@ ## 2023.x.x (unreleased) +### General +- + +## Client +- Feat: プラグイン・テーマを外部サイトから直接インストールできるようになりました + - 外部サイトでの実装が必要です。詳細は Misskey Hub をご覧ください + https://misskey-hub.net/docs/advanced/publish-on-your-website.html + +### Server +- + +## 2023.10.2 + ### General - Feat: アンテナでローカルの投稿のみ収集できるようになりました - Feat: サーバーサイレンス機能が追加されました @@ -23,9 +36,11 @@ - Enhance: フォロー/フォロー解除したときに過去分のHTLにも含まれる投稿が反映されるように - Enhance: ローカリゼーションの更新 - Enhance: 依存関係の更新 +- Enhance: すでにフォローしたすべての人の返信をTLに追加できるように ### Client - Enhance: TLの返信表示オプションを記憶するように +- Enhance: 投稿されてから時間が経過しているノートであることを視覚的に分かりやすく ### Server - Enhance: タイムライン取得時のパフォーマンスを向上 diff --git a/locales/hr-HR.yml b/locales/hr-HR.yml index ed97d539c0..9cfebdd01a 100644 --- a/locales/hr-HR.yml +++ b/locales/hr-HR.yml @@ -1 +1,5 @@ --- +_lang_: "japanski" +ok: "OK" +gotIt: "Razumijem" +cancel: "otkazati" diff --git a/locales/ht-HT.yml b/locales/ht-HT.yml index ed97d539c0..e3595c79b6 100644 --- a/locales/ht-HT.yml +++ b/locales/ht-HT.yml @@ -1 +1,18 @@ --- +_lang_: "Japonè" +password: "modpas" +ok: "OK" +gotIt: "Konprann" +cancel: "anile" +noThankYou: "Sispann" +instance: "sèvè" +profile: "pwofil" +save: "kenbe" +delete: "efase" +instances: "sèvè" +remove: "efase" +smtpPass: "modpas" +_2fa: + renewTOTPCancel: "Sispann" +_widgets: + profile: "pwofil" diff --git a/locales/index.d.ts b/locales/index.d.ts index 12f61f1aac..1ac625ffe5 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1142,6 +1142,10 @@ export interface Locale { "fileAttachedOnly": string; "showRepliesToOthersInTimeline": string; "hideRepliesToOthersInTimeline": string; + "showRepliesToOthersInTimelineAll": string; + "hideRepliesToOthersInTimelineAll": string; + "confirmShowRepliesAll": string; + "confirmHideRepliesAll": string; "externalServices": string; "impressum": string; "impressumUrl": string; @@ -1149,6 +1153,7 @@ export interface Locale { "privacyPolicy": string; "privacyPolicyUrl": string; "tosAndPrivacyPolicy": string; + "avatarDecorations": string; "_announcement": { "forExistingUsers": string; "forExistingUsersDescription": string; @@ -2303,6 +2308,9 @@ export interface Locale { "createAd": string; "deleteAd": string; "updateAd": string; + "createAvatarDecoration": string; + "updateAvatarDecoration": string; + "deleteAvatarDecoration": string; }; "_fileViewer": { "title": string; @@ -2313,6 +2321,61 @@ export interface Locale { "attachedNotes": string; "thisPageCanBeSeenFromTheAuthor": string; }; + "_externalResourceInstaller": { + "title": string; + "checkVendorBeforeInstall": string; + "_plugin": { + "title": string; + "metaTitle": string; + }; + "_theme": { + "title": string; + "metaTitle": string; + }; + "_meta": { + "base": string; + }; + "_vendorInfo": { + "title": string; + "endpoint": string; + "hashVerify": string; + }; + "_errors": { + "_invalidParams": { + "title": string; + "description": string; + }; + "_resourceTypeNotSupported": { + "title": string; + "description": string; + }; + "_failedToFetch": { + "title": string; + "fetchErrorDescription": string; + "parseErrorDescription": string; + }; + "_hashUnmatched": { + "title": string; + "description": string; + }; + "_pluginParseFailed": { + "title": string; + "description": string; + }; + "_pluginInstallFailed": { + "title": string; + "description": string; + }; + "_themeParseFailed": { + "title": string; + "description": string; + }; + "_themeInstallFailed": { + "title": string; + "description": string; + }; + }; + }; } declare const locales: { [lang: string]: Locale; diff --git a/locales/it-IT.yml b/locales/it-IT.yml index fb78c108ac..87a7a32a92 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -1136,7 +1136,7 @@ externalServices: "Servizi esterni" impressum: "Dichiarazione di proprietà" impressumUrl: "URL della dichiarazione di proprietà" impressumDescription: "La dichiarazione di proprietà, è obbligatoria in alcuni paesi come la Germania (Impressum)." -privacyPolicy: "Informativa ai sensi degli artt. 13 e 14 del Regolamento UE 2016/679 per la protezione dei dati personali (GDPR)" +privacyPolicy: "Informativa privacy ai sensi del Regolamento UE 2016/679 (GDPR)" privacyPolicyUrl: "URL della informativa privacy" tosAndPrivacyPolicy: "Condizioni d'uso e informativa privacy" _announcement: diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 77485e0de1..c33a800aa8 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1139,6 +1139,10 @@ mutualFollow: "相互フォロー" fileAttachedOnly: "ファイル付きのみ" showRepliesToOthersInTimeline: "TLに他の人への返信を含める" hideRepliesToOthersInTimeline: "TLに他の人への返信を含めない" +showRepliesToOthersInTimelineAll: "TLに現在フォロー中の人全員の返信を含めるようにする" +hideRepliesToOthersInTimelineAll: "TLに現在フォロー中の人全員の返信を含めないようにする" +confirmShowRepliesAll: "この操作は元の戻せません。本当にTLに現在フォロー中の人全員の返信を含めるようにしますか" +confirmHideRepliesAll: "この操作は元の戻せません。本当にTLに現在フォロー中の人全員の返信を含めないようにしますか" externalServices: "外部サービス" impressum: "運営者情報" impressumUrl: "運営者情報URL" @@ -1146,6 +1150,7 @@ impressumDescription: "ドイツなどの一部の国と地域では表示が義 privacyPolicy: "プライバシーポリシー" privacyPolicyUrl: "プライバシーポリシーURL" tosAndPrivacyPolicy: "利用規約・プライバシーポリシー" +avatarDecorations: "アイコンデコレーション" _announcement: forExistingUsers: "既存ユーザーのみ" @@ -2216,6 +2221,9 @@ _moderationLogTypes: createAd: "広告を作成" deleteAd: "広告を削除" updateAd: "広告を更新" + createAvatarDecoration: "アイコンデコレーションを作成" + updateAvatarDecoration: "アイコンデコレーションを更新" + deleteAvatarDecoration: "アイコンデコレーションを削除" _fileViewer: title: "ファイルの詳細" @@ -2225,3 +2233,45 @@ _fileViewer: uploadedAt: "追加日" attachedNotes: "添付されているノート" thisPageCanBeSeenFromTheAuthor: "このページは、このファイルをアップロードしたユーザーしか閲覧できません。" + +_externalResourceInstaller: + title: "外部サイトからインストール" + checkVendorBeforeInstall: "配布元が信頼できるかを確認した上でインストールしてください。" + _plugin: + title: "このプラグインをインストールしますか?" + metaTitle: "プラグイン情報" + _theme: + title: "このテーマをインストールしますか?" + metaTitle: "テーマ情報" + _meta: + base: "基本のカラースキーム" + _vendorInfo: + title: "配布元情報" + endpoint: "参照したエンドポイント" + hashVerify: "ファイル整合性の確認" + _errors: + _invalidParams: + title: "パラメータが不足しています" + description: "外部サイトからデータを取得するために必要な情報が不足しています。URLをお確かめください。" + _resourceTypeNotSupported: + title: "この外部リソースには対応していません" + description: "この外部サイトから取得したリソースの種別には対応していません。サイト管理者にお問い合わせください。" + _failedToFetch: + title: "データの取得に失敗しました" + fetchErrorDescription: "外部サイトとの通信に失敗しました。もう一度試しても改善しない場合、サイト管理者にお問い合わせください。" + parseErrorDescription: "外部サイトから取得したデータが読み取れませんでした。サイト管理者にお問い合わせください。" + _hashUnmatched: + title: "正しいデータが取得できませんでした" + description: "提供されたデータの整合性の確認に失敗しました。セキュリティ上、インストールは続行できません。サイト管理者にお問い合わせください。" + _pluginParseFailed: + title: "AiScript エラー" + description: "データは取得できたものの、AiScriptの解析時にエラーがあったため読み込めませんでした。プラグインの作者にお問い合わせください。エラーの詳細はJavascriptコンソールをご確認ください。" + _pluginInstallFailed: + title: "プラグインのインストールに失敗しました" + description: "プラグインのインストール中に問題が発生しました。もう一度お試しください。エラーの詳細はJavascriptコンソールをご覧ください。" + _themeParseFailed: + title: "テーマ解析エラー" + description: "データは取得できたものの、テーマファイルの解析時にエラーがあったため読み込めませんでした。テーマの作者にお問い合わせください。エラーの詳細はJavascriptコンソールをご確認ください。" + _themeInstallFailed: + title: "テーマのインストールに失敗しました" + description: "テーマのインストール中に問題が発生しました。もう一度お試しください。エラーの詳細はJavascriptコンソールをご覧ください。" diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml index 860b47f3e7..925286dfbc 100644 --- a/locales/ja-KS.yml +++ b/locales/ja-KS.yml @@ -45,6 +45,7 @@ pin: "ピン留めしとく" unpin: "やっぱピン留めせん" copyContent: "内容をコピー" copyLink: "リンクをコピー" +copyLinkRenote: "リノートのリンクをコピーするで?" delete: "ほかす" deleteAndEdit: "ほかして直す" deleteAndEditConfirm: "このノートをほかしてもっかい直す?このノートへのツッコミ、Renote、返信も全部消えるんやけどそれでもええん?" @@ -194,6 +195,7 @@ perHour: "1時間ごと" perDay: "1日ごと" stopActivityDelivery: "アクティビティの配送をやめる" blockThisInstance: "このサーバーをブロックすんで" +silenceThisInstance: "サーバーサイレンスすんで?" operations: "操作" software: "ソフトウェア" version: "バージョン" @@ -213,6 +215,8 @@ clearCachedFiles: "キャッシュをほかす" clearCachedFilesConfirm: "キャッシュされとるリモートファイルをみんなほかしてええか?" blockedInstances: "ブロックしたサーバー" blockedInstancesDescription: "ブロックしたいサーバーのホストを改行で区切って設定してな。ブロックされてもうたサーバーとはもう金輪際やり取りできひんくなるで。ついでにそのサブドメインもブロックするで。" +silencedInstances: "サーバーサイレンスされてんねん" +silencedInstancesDescription: "サイレンスしたいサーバーのホストを改行で区切って設定すんで。サイレンスされたサーバーに所属するアカウントはすべて「サイレンス」として扱われ、フォローがすべてリクエストになり、フォロワーでないローカルアカウントにはメンションできなくなんねん。ブロックしたインスタンスには影響せーへんで。" muteAndBlock: "ミュートとブロック" mutedUsers: "ミュートしたユーザー" blockedUsers: "ブロックしたユーザー" @@ -410,12 +414,14 @@ aboutMisskey: "Misskeyってなんや?" administrator: "管理者" token: "トークン" 2fa: "二要素認証" +setupOf2fa: "二要素認証のセットアップ" totp: "認証アプリ" totpDescription: "認証アプリ使うてワンタイムパスワードを入れる" moderator: "モデレーター" moderation: "モデレーション" moderationNote: "モデレーションノート" addModerationNote: "モデレーションノートを追加するで" +moderationLogs: "モデログ" nUsersMentioned: "{n}人が投稿" securityKeyAndPasskey: "セキュリティキー・パスキー" securityKey: "セキュリティキー" @@ -528,6 +534,7 @@ serverLogs: "サーバーログ" deleteAll: "全部ほかす" showFixedPostForm: "タイムラインの上の方で投稿できるようにやってくれへん?" showFixedPostFormInChannel: "タイムラインの上の方で投稿できるようにするわ(チャンネル)" +withRepliesByDefaultForNewlyFollowed: "フォローする時、デフォルトで返信をタイムラインに含むようにしよか" newNoteRecived: "新しいノートがあるで" sounds: "サウンド" sound: "サウンド" @@ -655,6 +662,7 @@ behavior: "動作" sample: "サンプル" abuseReports: "通報" reportAbuse: "通報" +reportAbuseRenote: "リノート苦情だすで?" reportAbuseOf: "{name}を通報する" fillAbuseReportDescription: "細かい通報理由を書いてなー。対象ノートがある時はそのURLも書いといてなー。" abuseReported: "無事内容が送信されたみたいやで。おおきに〜。" @@ -707,6 +715,7 @@ lockedAccountInfo: "フォローを承認制にしとっても、ノートの公 alwaysMarkSensitive: "デフォルトでメディアを閲覧注意にするで" loadRawImages: "添付画像のサムネイルをオリジナル画質にするで" disableShowingAnimatedImages: "アニメーション画像を再生せんとくで" +highlightSensitiveMedia: "メディアがセンシティブなことをめっっちゃわかりやすく表紙" verificationEmailSent: "無事確認のメールを送れたで。メールに書いてあるリンクにアクセスして、設定を完了してなー。" notSet: "未設定" emailVerified: "メールアドレスは確認されたで" @@ -1021,6 +1030,7 @@ retryAllQueuesConfirmText: "一時的にサーバー重なるかもしれへん enableChartsForRemoteUser: "リモートユーザーのチャートを作る" enableChartsForFederatedInstances: "リモートサーバーのチャートを作る" showClipButtonInNoteFooter: "ノートのアクションにクリップを追加" +reactionsDisplaySize: "リアクションの表示のでかさ" noteIdOrUrl: "ノートIDかURL" video: "動画" videos: "動画" @@ -1107,8 +1117,28 @@ replies: "返事" renotes: "Renote" loadReplies: "返信を見るで" loadConversation: "会話を見るで" +pinnedList: "ピン留めしはったリスト" +keepScreenOn: "デバイスの画面を常にオンにすんで" verifiedLink: "このリンク先の所有者であることが確認されたで。" +notifyNotes: "投稿を通知" +unnotifyNotes: "投稿の通知を解除すんで" +authentication: "認証" authenticationRequiredToContinue: "続けるには認証をやってや。" +dateAndTime: "日時" +showRenotes: "リノートを表示" +edited: "編集し終わってる" +notificationRecieveConfig: "通知を受け取るかの設定" +mutualFollow: "お互いフォローしてんで" +fileAttachedOnly: "ファイル付きのみ" +showRepliesToOthersInTimeline: "タイムラインに他の人への返信とかも含めんで" +hideRepliesToOthersInTimeline: "タイムラインに他の人への返信とかは見ーへんで" +externalServices: "他のサイトのサービス" +impressum: "運営者の情報" +impressumUrl: "運営者の情報URL" +impressumDescription: "ドイツなどのほんま1部の国と地域ではな、表示が義務付けられててん。(Impressum)" +privacyPolicy: "プライバシーポリシー" +privacyPolicyUrl: "プライバシーポリシーURL" +tosAndPrivacyPolicy: "利用規約・プライバシーポリシー" _announcement: forExistingUsers: "もうおるユーザーのみ" forExistingUsersDescription: "有効にすると、このお知らせ作成時点でおるユーザーにのみお知らせが表示されます。無効にすると、このお知らせ作成後にアカウントを作成したユーザーにもお知らせが表示されます。" @@ -1141,6 +1171,8 @@ _serverSettings: appIconUsageExample: "PWAや、スマートフォンのホーム画面にブックマークとして追加された時など" appIconStyleRecommendation: "円形もしくは角丸にクロップされる場合があるさかいに、塗り潰された余白のある背景があるものが推奨されるで。" appIconResolutionMustBe: "解像度は必ず{resolution}である必要があるで。" + manifestJsonOverride: "manifest.jsonのオーバーライド" + shortName: "略称" shortNameDescription: "サーバーの名前が長い時に、代わりに表示することのできるあだ名。" _accountMigration: moveFrom: "別のアカウントからこのアカウントに引っ越す" @@ -1396,6 +1428,9 @@ _achievements: title: "Brain Diver" description: "Brain Diverへのリンクを投稿したった" flavor: "Misskey-Misskey La-Tu-Ma" + _smashTestNotificationButton: + title: "テスト過剰" + description: "通知テストをごく短時間のうちに連続して行ったねん" _role: new: "ロールの作成" edit: "ロールの編集" @@ -1453,6 +1488,7 @@ _role: descriptionOfRateLimitFactor: "ちっちゃいほど制限が緩なって、大きいほど制限されるで。" canHideAds: "広告を表示させへん" canSearchNotes: "ノート検索を使わすかどうか" + canUseTranslator: "翻訳機能の利用" _condition: isLocal: "ローカルユーザー" isRemote: "リモートユーザー" @@ -1501,6 +1537,10 @@ _ad: reduceFrequencyOfThisAd: "この広告の表示頻度を下げるで" hide: "表示せん" timezoneinfo: "曜日はサーバーのタイムゾーンを元に指定されるで。" + adsSettings: "広告配信設定" + notesPerOneAd: "リアタイ更新中に広告を出す間隔(ノートの個数な)" + setZeroToDisable: "0でリアタイ更新時の広告配信を無効にすんで" + adsTooClose: "広告を出す間隔がめっちゃ短いから、ユーザー体験が著しく損なわれる可能性があんで。" _forgotPassword: enterEmail: "アカウントに登録したメールアドレスをここに入力してや。そのアドレス宛に、パスワードリセット用のリンクが送られるから待っててな~。" ifNoEmail: "メールアドレスを登録してへんのやったら、管理者まで教えてな~。" @@ -1700,6 +1740,7 @@ _2fa: step1: "ほんなら、{a}や{b}とかの認証アプリを使っとるデバイスにインストールしてな。" step2: "次に、ここにあるQRコードをアプリでスキャンしてな~。" step2Click: "QRコードをクリックすると、今使とる端末に入っとる認証アプリとかキーリングに登録できるで。" + step2Uri: "デスクトップアプリを使う時は次のURIを入れるで" step3Title: "確認コードを入れてーや" step3: "アプリに表示されているトークンを入力して終わりや。" setupCompleted: "設定が完了したで。" @@ -1718,6 +1759,7 @@ _2fa: renewTOTPOk: "もっかい設定する" renewTOTPCancel: "やめとく" checkBackupCodesBeforeCloseThisWizard: "このウィザードを閉じる前に、したのバックアップコードを確認しいや。" + backupCodes: "バックアップコード" backupCodesDescription: "認証アプリが使用できんなった場合、以下のバックアップコードを使ってアカウントにアクセスできるで。これらのコードは必ず安全な場所に置いときや。各コードは一回だけ使用できるで。" backupCodeUsedWarning: "バックアップコードが使用されたで。認証アプリが使えなくなってるん場合、なるべく早く認証アプリを再設定しや。" backupCodesExhaustedWarning: "バックアップコードが全て使用されたで。認証アプリを利用できん場合、これ以上アカウントにアクセスできなくなるで。認証アプリを再登録しや。" @@ -1773,6 +1815,7 @@ _antennaSources: homeTimeline: "フォローしとるユーザーのノート" users: "選らんだ一人か複数のユーザーのノート" userList: "選んだリストのユーザーのノート" + userBlacklist: "選んだ1人か複数のユーザーのノート" _weekday: sunday: "日曜日" monday: "月曜日" @@ -1872,6 +1915,7 @@ _profile: metadataContent: "内容" changeAvatar: "アバター画像を変更するで" changeBanner: "バナー画像を変更するで" + verifiedLinkDescription: "内容をURLに設定すると、リンク先のwebサイトに自分のプロフのリンクが含まれてる場合に所有者確認済みアイコンを表示させることができるで。" _exportOrImport: allNotes: "全てのノート" favoritedNotes: "お気に入りにしたノート" @@ -1881,6 +1925,7 @@ _exportOrImport: userLists: "リスト" excludeMutingUsers: "ミュートしてるユーザーは入れんとくわ" excludeInactiveUsers: "使われてなさそうなアカウントは入れんとくわ" + withReplies: "インポートした人による返信をTLに含むようにすんで。" _charts: federation: "連合" apRequest: "リクエスト" @@ -1990,14 +2035,17 @@ _notification: youReceivedFollowRequest: "フォロー許可してほしいみたいやな" yourFollowRequestAccepted: "フォローさせてもろたで" pollEnded: "アンケートの結果が出たみたいや" + newNote: "さらの投稿" unreadAntennaNote: "アンテナ {name}" emptyPushNotificationMessage: "プッシュ通知の更新をしといたで" achievementEarned: "実績を獲得しとるで" + testNotification: "通知テスト" checkNotificationBehavior: "通知の表示を確かめるで" sendTestNotification: "テスト通知を送信するで" notificationWillBeDisplayedLikeThis: "通知はこのように表示されるで" _types: all: "すべて" + note: "あんたらの新規投稿" follow: "フォロー" mention: "メンション" reply: "リプライ" @@ -2032,6 +2080,7 @@ _deck: widgetsIntroduction: "カラムのメニューから、「ウィジェットの編集」を選んでウィジェットを追加してなー" useSimpleUiForNonRootPages: "非ルートページは簡易UIで表示" usedAsMinWidthWhenFlexible: "「幅を自動調整」が有効の場合、これが幅の最小値となるで" + flexible: "幅を自動調整" _columns: main: "メイン" widgets: "ウィジェット" @@ -2067,6 +2116,41 @@ _webhookSettings: reaction: "ツッコミがあるとき~!" mention: "メンションがあるとき~!" _moderationLogTypes: + createRole: "ロールを追加すんで" + deleteRole: "ロールほかす" + updateRole: "ロールの更新すんで" + assignRole: "ロールへアサイン" + unassignRole: "ロールのアサインほかす" suspend: "凍結" + unsuspend: "凍結解除" + addCustomEmoji: "自由な絵文字追加されたで" + updateCustomEmoji: "自由な絵文字更新されたで" + deleteCustomEmoji: "自由な絵文字消されたで" + updateServerSettings: "サーバー設定更新すんねん" + updateUserNote: "モデレーションノート更新" + deleteDriveFile: "ファイルをほかす" + deleteNote: "ノートを削除" + createGlobalAnnouncement: "みんなへの通告を作成したで" + createUserAnnouncement: "あんたらへの通告を作成したで" + updateGlobalAnnouncement: "みんなへの通告更新したったで" + updateUserAnnouncement: "あんたらへの通告更新したったで" + deleteGlobalAnnouncement: "みんなへの通告消したったで" + deleteUserAnnouncement: "あんたらへのお知らせを削除" resetPassword: "パスワードをリセット" + suspendRemoteInstance: "リモートサーバーを止めんで" + unsuspendRemoteInstance: "リモートサーバーを再開すんで" + markSensitiveDriveFile: "ファイルをセンシティブ付与" + unmarkSensitiveDriveFile: "ファイルをセンシティブ解除" + resolveAbuseReport: "苦情を解決" createInvitation: "招待コードを作成" + createAd: "広告を作んで" + deleteAd: "広告ほかす" + updateAd: "広告を更新" +_fileViewer: + title: "ファイルの詳しい情報" + type: "ファイルの種類" + size: "ファイルのでかさ" + url: "URL" + uploadedAt: "追加した日" + attachedNotes: "ファイルがついてきてるノート" + thisPageCanBeSeenFromTheAuthor: "このページはこのファイルをアップした人しか見れへんねん。" diff --git a/locales/ug-CN.yml b/locales/ug-CN.yml index 65ef841259..e48f64511c 100644 --- a/locales/ug-CN.yml +++ b/locales/ug-CN.yml @@ -1,4 +1,19 @@ --- _lang_: "ياپونچە" +headlineMisskey: "خاتىرە ئارقىلىق ئۇلانغان تور" +monthAndDay: "{day}-{month}" search: "ئىزدەش" +ok: "ماقۇل" +noThankYou: "ئۇنى توختىتىڭ" +profile: "profile" +login: "كىرىش" +loggingIn: "كىرىش" +pin: "pinned" +delete: "ئۆچۈرۈش" +pinned: "pinned" +remove: "ئۆچۈرۈش" searchByGoogle: "ئىزدەش" +_2fa: + renewTOTPCancel: "ئۇنى توختىتىڭ" +_widgets: + profile: "profile" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index dfc4ccb688..e605deb11d 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -195,6 +195,7 @@ perHour: "每小时" perDay: "每天" stopActivityDelivery: "停止发送活动" blockThisInstance: "阻止此服务器向本服务器推流" +silenceThisInstance: "使服务器静音" operations: "操作" software: "软件" version: "版本" @@ -214,6 +215,8 @@ clearCachedFiles: "清除缓存" clearCachedFilesConfirm: "确定要清除缓存文件?" blockedInstances: "被封锁的服务器" blockedInstancesDescription: "设定要封锁的服务器,以换行来进行分割。被封锁的服务器将无法与本服务器进行交换通讯。子域名也同样会被封锁。" +silencedInstances: "沉默的服务器" +silencedInstancesDescription: "设置要静音的服务器的主机,以换行符分隔。属于静默服务器的所有帐户都将被视为“静默”,所有关注都将成为请求,并且您将无法提及非关注者的本地帐户。被阻止的实例不受影响。" muteAndBlock: "屏蔽/拉黑" mutedUsers: "已屏蔽用户" blockedUsers: "已拉黑的用户" @@ -2127,3 +2130,6 @@ _moderationLogTypes: createAd: "创建了广告" deleteAd: "删除了广告" updateAd: "更新了广告" +_fileViewer: + url: "URL" + uploadedAt: "添加日期" diff --git a/package.json b/package.json index 973e261650..3329041e5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2023.10.2-beta.2", + "version": "2023.11.0-beta.1", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/migration/1697847397844-avatar-decoration.js b/packages/backend/migration/1697847397844-avatar-decoration.js new file mode 100644 index 0000000000..1f22139746 --- /dev/null +++ b/packages/backend/migration/1697847397844-avatar-decoration.js @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class AvatarDecoration1697847397844 { + name = 'AvatarDecoration1697847397844' + + async up(queryRunner) { + await queryRunner.query(`CREATE TABLE "avatar_decoration" ("id" character varying(32) NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE, "url" character varying(1024) NOT NULL, "name" character varying(256) NOT NULL, "description" character varying(2048) NOT NULL, "roleIdsThatCanBeUsedThisDecoration" character varying(128) array NOT NULL DEFAULT '{}', CONSTRAINT "PK_b6de9296f6097078e1dc53f7603" PRIMARY KEY ("id"))`); + await queryRunner.query(`ALTER TABLE "user" ADD "avatarDecorations" character varying(512) array NOT NULL DEFAULT '{}'`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarDecorations"`); + await queryRunner.query(`DROP TABLE "avatar_decoration"`); + } +} diff --git a/packages/backend/package.json b/packages/backend/package.json index 2518b0dd7f..a4a2dfd7f2 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -186,7 +186,7 @@ "@types/js-yaml": "4.0.8", "@types/jsdom": "21.1.4", "@types/jsonld": "1.5.11", - "@types/jsrsasign": "10.5.10", + "@types/jsrsasign": "10.5.11", "@types/mime-types": "2.1.3", "@types/ms": "0.7.33", "@types/node": "20.8.7", diff --git a/packages/backend/src/core/AvatarDecorationService.ts b/packages/backend/src/core/AvatarDecorationService.ts new file mode 100644 index 0000000000..e97946f9dc --- /dev/null +++ b/packages/backend/src/core/AvatarDecorationService.ts @@ -0,0 +1,129 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; +import * as Redis from 'ioredis'; +import type { AvatarDecorationsRepository, MiAvatarDecoration, MiUser } from '@/models/_.js'; +import { IdService } from '@/core/IdService.js'; +import { GlobalEventService } from '@/core/GlobalEventService.js'; +import { DI } from '@/di-symbols.js'; +import { bindThis } from '@/decorators.js'; +import { MemorySingleCache } from '@/misc/cache.js'; +import type { GlobalEvents } from '@/core/GlobalEventService.js'; +import { ModerationLogService } from '@/core/ModerationLogService.js'; + +@Injectable() +export class AvatarDecorationService implements OnApplicationShutdown { + public cache: MemorySingleCache; + + constructor( + @Inject(DI.redisForSub) + private redisForSub: Redis.Redis, + + @Inject(DI.avatarDecorationsRepository) + private avatarDecorationsRepository: AvatarDecorationsRepository, + + private idService: IdService, + private moderationLogService: ModerationLogService, + private globalEventService: GlobalEventService, + ) { + this.cache = new MemorySingleCache(1000 * 60 * 30); + + this.redisForSub.on('message', this.onMessage); + } + + @bindThis + private async onMessage(_: string, data: string): Promise { + const obj = JSON.parse(data); + + if (obj.channel === 'internal') { + const { type, body } = obj.message as GlobalEvents['internal']['payload']; + switch (type) { + case 'avatarDecorationCreated': + case 'avatarDecorationUpdated': + case 'avatarDecorationDeleted': { + this.cache.delete(); + break; + } + default: + break; + } + } + } + + @bindThis + public async create(options: Partial, moderator?: MiUser): Promise { + const created = await this.avatarDecorationsRepository.insert({ + id: this.idService.gen(), + ...options, + }).then(x => this.avatarDecorationsRepository.findOneByOrFail(x.identifiers[0])); + + this.globalEventService.publishInternalEvent('avatarDecorationCreated', created); + + if (moderator) { + this.moderationLogService.log(moderator, 'createAvatarDecoration', { + avatarDecorationId: created.id, + avatarDecoration: created, + }); + } + + return created; + } + + @bindThis + public async update(id: MiAvatarDecoration['id'], params: Partial, moderator?: MiUser): Promise { + const avatarDecoration = await this.avatarDecorationsRepository.findOneByOrFail({ id }); + + const date = new Date(); + await this.avatarDecorationsRepository.update(avatarDecoration.id, { + updatedAt: date, + ...params, + }); + + const updated = await this.avatarDecorationsRepository.findOneByOrFail({ id: avatarDecoration.id }); + this.globalEventService.publishInternalEvent('avatarDecorationUpdated', updated); + + if (moderator) { + this.moderationLogService.log(moderator, 'updateAvatarDecoration', { + avatarDecorationId: avatarDecoration.id, + before: avatarDecoration, + after: updated, + }); + } + } + + @bindThis + public async delete(id: MiAvatarDecoration['id'], moderator?: MiUser): Promise { + const avatarDecoration = await this.avatarDecorationsRepository.findOneByOrFail({ id }); + + await this.avatarDecorationsRepository.delete({ id: avatarDecoration.id }); + this.globalEventService.publishInternalEvent('avatarDecorationDeleted', avatarDecoration); + + if (moderator) { + this.moderationLogService.log(moderator, 'deleteAvatarDecoration', { + avatarDecorationId: avatarDecoration.id, + avatarDecoration: avatarDecoration, + }); + } + } + + @bindThis + public async getAll(noCache = false): Promise { + if (noCache) { + this.cache.delete(); + } + return this.cache.fetch(() => this.avatarDecorationsRepository.find()); + } + + @bindThis + public dispose(): void { + this.redisForSub.off('message', this.onMessage); + } + + @bindThis + public onApplicationShutdown(signal?: string | undefined): void { + this.dispose(); + } +} diff --git a/packages/backend/src/core/CoreModule.ts b/packages/backend/src/core/CoreModule.ts index 44894ffa25..295197acd2 100644 --- a/packages/backend/src/core/CoreModule.ts +++ b/packages/backend/src/core/CoreModule.ts @@ -11,6 +11,7 @@ import { AnnouncementService } from './AnnouncementService.js'; import { AntennaService } from './AntennaService.js'; import { AppLockService } from './AppLockService.js'; import { AchievementService } from './AchievementService.js'; +import { AvatarDecorationService } from './AvatarDecorationService.js'; import { CaptchaService } from './CaptchaService.js'; import { CreateSystemUserService } from './CreateSystemUserService.js'; import { CustomEmojiService } from './CustomEmojiService.js'; @@ -141,6 +142,7 @@ const $AnnouncementService: Provider = { provide: 'AnnouncementService', useExis const $AntennaService: Provider = { provide: 'AntennaService', useExisting: AntennaService }; const $AppLockService: Provider = { provide: 'AppLockService', useExisting: AppLockService }; const $AchievementService: Provider = { provide: 'AchievementService', useExisting: AchievementService }; +const $AvatarDecorationService: Provider = { provide: 'AvatarDecorationService', useExisting: AvatarDecorationService }; const $CaptchaService: Provider = { provide: 'CaptchaService', useExisting: CaptchaService }; const $CreateSystemUserService: Provider = { provide: 'CreateSystemUserService', useExisting: CreateSystemUserService }; const $CustomEmojiService: Provider = { provide: 'CustomEmojiService', useExisting: CustomEmojiService }; @@ -275,6 +277,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting AntennaService, AppLockService, AchievementService, + AvatarDecorationService, CaptchaService, CreateSystemUserService, CustomEmojiService, @@ -402,6 +405,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting $AntennaService, $AppLockService, $AchievementService, + $AvatarDecorationService, $CaptchaService, $CreateSystemUserService, $CustomEmojiService, @@ -530,6 +534,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting AntennaService, AppLockService, AchievementService, + AvatarDecorationService, CaptchaService, CreateSystemUserService, CustomEmojiService, @@ -656,6 +661,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting $AntennaService, $AppLockService, $AchievementService, + $AvatarDecorationService, $CaptchaService, $CreateSystemUserService, $CustomEmojiService, diff --git a/packages/backend/src/core/GlobalEventService.ts b/packages/backend/src/core/GlobalEventService.ts index b74fbbe584..bfbdecf688 100644 --- a/packages/backend/src/core/GlobalEventService.ts +++ b/packages/backend/src/core/GlobalEventService.ts @@ -18,7 +18,7 @@ import type { MiSignin } from '@/models/Signin.js'; import type { MiPage } from '@/models/Page.js'; import type { MiWebhook } from '@/models/Webhook.js'; import type { MiMeta } from '@/models/Meta.js'; -import { MiRole, MiRoleAssignment } from '@/models/_.js'; +import { MiAvatarDecoration, MiRole, MiRoleAssignment } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; @@ -188,6 +188,9 @@ export interface InternalEventTypes { antennaCreated: MiAntenna; antennaDeleted: MiAntenna; antennaUpdated: MiAntenna; + avatarDecorationCreated: MiAvatarDecoration; + avatarDecorationDeleted: MiAvatarDecoration; + avatarDecorationUpdated: MiAvatarDecoration; metaUpdated: MiMeta; followChannel: { userId: MiUser['id']; channelId: MiChannel['id']; }; unfollowChannel: { userId: MiUser['id']; channelId: MiChannel['id']; }; diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index f5cfe03122..364a300d23 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -55,7 +55,6 @@ import { MetaService } from '@/core/MetaService.js'; import { SearchService } from '@/core/SearchService.js'; import { FeaturedService } from '@/core/FeaturedService.js'; import { FunoutTimelineService } from '@/core/FunoutTimelineService.js'; -import { nyaize } from '@/misc/nyaize.js'; import { UtilityService } from '@/core/UtilityService.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index b164ec68b3..c4d52c7656 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -229,6 +229,12 @@ export class RoleService implements OnApplicationShutdown { } } + @bindThis + public async getRoles() { + const roles = await this.rolesCache.fetch(() => this.rolesRepository.findBy({})); + return roles; + } + @bindThis public async getUserAssigns(userId: MiUser['id']) { const now = Date.now(); diff --git a/packages/backend/src/core/entities/InstanceEntityService.ts b/packages/backend/src/core/entities/InstanceEntityService.ts index 9afe87eab7..8bba150ece 100644 --- a/packages/backend/src/core/entities/InstanceEntityService.ts +++ b/packages/backend/src/core/entities/InstanceEntityService.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import type { Packed } from '@/misc/json-schema.js'; import type { MiInstance } from '@/models/Instance.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index c100b92ee7..6fde1c3830 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -73,7 +73,7 @@ export class NoteEntityService implements OnModuleInit { @bindThis private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null) { - // TODO: isVisibleForMe を使うようにしても良さそう(型違うけど) + // TODO: isVisibleForMe を使うようにしても良さそう(型違うけど) let hide = false; // visibility が specified かつ自分が指定されていなかったら非表示 @@ -83,7 +83,7 @@ export class NoteEntityService implements OnModuleInit { } else if (meId === packedNote.userId) { hide = false; } else { - // 指定されているかどうか + // 指定されているかどうか const specified = packedNote.visibleUserIds!.some((id: any) => meId === id); if (specified) { @@ -360,12 +360,14 @@ export class NoteEntityService implements OnModuleInit { reply: note.replyId ? this.pack(note.reply ?? note.replyId, me, { detail: false, + skipHide: opts.skipHide, withReactionAndUserPairCache: opts.withReactionAndUserPairCache, _hint_: options?._hint_, }) : undefined, renote: note.renoteId ? this.pack(note.renote ?? note.renoteId, me, { detail: true, + skipHide: opts.skipHide, withReactionAndUserPairCache: opts.withReactionAndUserPairCache, _hint_: options?._hint_, }) : undefined, diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 4a3ca00849..66facce4c2 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -21,9 +21,10 @@ import { RoleService } from '@/core/RoleService.js'; import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { IdService } from '@/core/IdService.js'; +import type { AnnouncementService } from '@/core/AnnouncementService.js'; +import type { CustomEmojiService } from '@/core/CustomEmojiService.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; import type { OnModuleInit } from '@nestjs/common'; -import type { AnnouncementService } from '../AnnouncementService.js'; -import type { CustomEmojiService } from '../CustomEmojiService.js'; import type { NoteEntityService } from './NoteEntityService.js'; import type { DriveFileEntityService } from './DriveFileEntityService.js'; import type { PageEntityService } from './PageEntityService.js'; @@ -62,6 +63,7 @@ export class UserEntityService implements OnModuleInit { private roleService: RoleService; private federatedInstanceService: FederatedInstanceService; private idService: IdService; + private avatarDecorationService: AvatarDecorationService; constructor( private moduleRef: ModuleRef, @@ -126,6 +128,7 @@ export class UserEntityService implements OnModuleInit { this.roleService = this.moduleRef.get('RoleService'); this.federatedInstanceService = this.moduleRef.get('FederatedInstanceService'); this.idService = this.moduleRef.get('IdService'); + this.avatarDecorationService = this.moduleRef.get('AvatarDecorationService'); } //#region Validators @@ -322,9 +325,11 @@ export class UserEntityService implements OnModuleInit { const isModerator = isMe && opts.detail ? this.roleService.isModerator(user) : null; const isAdmin = isMe && opts.detail ? this.roleService.isAdministrator(user) : null; - const unreadAnnouncements = isMe && opts.detail ? await this.announcementService.getUnreadAnnouncements(user) : null; - - const falsy = opts.detail ? false : undefined; + const unreadAnnouncements = isMe && opts.detail ? + (await this.announcementService.getUnreadAnnouncements(user)).map((announcement) => ({ + createdAt: this.idService.parse(announcement.id).date.toISOString(), + ...announcement, + })) : null; const packed = { id: user.id, @@ -333,6 +338,10 @@ export class UserEntityService implements OnModuleInit { host: user.host, avatarUrl: user.avatarUrl ?? this.getIdenticonUrl(user), avatarBlurhash: user.avatarBlurhash, + avatarDecorations: user.avatarDecorations.length > 0 ? this.avatarDecorationService.getAll().then(decorations => decorations.filter(decoration => user.avatarDecorations.includes(decoration.id)).map(decoration => ({ + id: decoration.id, + url: decoration.url, + }))) : [], isBot: user.isBot, isCat: user.isCat, instance: user.host ? this.federatedInstanceService.federatedInstanceCache.fetch(user.host).then(instance => instance ? { diff --git a/packages/backend/src/di-symbols.ts b/packages/backend/src/di-symbols.ts index a374370edc..7da4e75ae7 100644 --- a/packages/backend/src/di-symbols.ts +++ b/packages/backend/src/di-symbols.ts @@ -18,6 +18,7 @@ export const DI = { announcementsRepository: Symbol('announcementsRepository'), announcementReadsRepository: Symbol('announcementReadsRepository'), appsRepository: Symbol('appsRepository'), + avatarDecorationsRepository: Symbol('avatarDecorationsRepository'), noteFavoritesRepository: Symbol('noteFavoritesRepository'), noteThreadMutingsRepository: Symbol('noteThreadMutingsRepository'), noteReactionsRepository: Symbol('noteReactionsRepository'), diff --git a/packages/backend/src/misc/nyaize.ts b/packages/backend/src/misc/nyaize.ts deleted file mode 100644 index 0ac77e1006..0000000000 --- a/packages/backend/src/misc/nyaize.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export function nyaize(text: string): string { - return text - // ja-JP - .replaceAll('な', 'にゃ').replaceAll('ナ', 'ニャ').replaceAll('ナ', 'ニャ') - // en-US - .replace(/(?<=n)a/gi, x => x === 'A' ? 'YA' : 'ya') - .replace(/(?<=morn)ing/gi, x => x === 'ING' ? 'YAN' : 'yan') - .replace(/(?<=every)one/gi, x => x === 'ONE' ? 'NYAN' : 'nyan') - // ko-KR - .replace(/[나-낳]/g, match => String.fromCharCode( - match.charCodeAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0), - )) - .replace(/(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm, '다냥') - .replace(/(야(?=\?))|(야$)|(야(?= ))/gm, '냥'); -} diff --git a/packages/backend/src/models/AvatarDecoration.ts b/packages/backend/src/models/AvatarDecoration.ts new file mode 100644 index 0000000000..08ebbdeac1 --- /dev/null +++ b/packages/backend/src/models/AvatarDecoration.ts @@ -0,0 +1,39 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from './util/id.js'; + +@Entity('avatar_decoration') +export class MiAvatarDecoration { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + nullable: true, + }) + public updatedAt: Date | null; + + @Column('varchar', { + length: 1024, + }) + public url: string; + + @Column('varchar', { + length: 256, + }) + public name: string; + + @Column('varchar', { + length: 2048, + }) + public description: string; + + // TODO: 定期ジョブで存在しなくなったロールIDを除去するようにする + @Column('varchar', { + array: true, length: 128, default: '{}', + }) + public roleIdsThatCanBeUsedThisDecoration: string[]; +} diff --git a/packages/backend/src/models/RepositoryModule.ts b/packages/backend/src/models/RepositoryModule.ts index 30f11cbc4e..b8202c0f81 100644 --- a/packages/backend/src/models/RepositoryModule.ts +++ b/packages/backend/src/models/RepositoryModule.ts @@ -5,7 +5,7 @@ import { Module } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; -import { MiAbuseUserReport, MiAccessToken, MiAd, MiAnnouncement, MiAnnouncementRead, MiAntenna, MiApp, MiAuthSession, MiBlocking, MiChannel, MiChannelFavorite, MiChannelFollowing, MiClip, MiClipFavorite, MiClipNote, MiDriveFile, MiDriveFolder, MiEmoji, MiEmojiDraft, MiFlash, MiFlashLike, MiFollowRequest, MiFollowing, MiGalleryLike, MiGalleryPost, MiHashtag, MiInstance, MiMeta, MiModerationLog, MiMuting, MiNote, MiNoteFavorite, MiNoteReaction, MiNoteThreadMuting, MiNoteUnread, MiPage, MiPageLike, MiPasswordResetRequest, MiPoll, MiPollVote, MiPromoNote, MiPromoRead, MiRegistrationTicket, MiRegistryItem, MiRelay, MiRenoteMuting, MiRetentionAggregation, MiRole, MiRoleAssignment, MiSignin, MiSwSubscription, MiUsedUsername, MiUser, MiUserIp, MiUserKeypair, MiUserList, MiUserListFavorite, MiUserListMembership, MiUserMemo, MiUserNotePining, MiUserPending, MiUserProfile, MiUserPublickey, MiUserSecurityKey, MiWebhook } from './_.js'; +import { MiAbuseUserReport, MiAccessToken, MiAd, MiAnnouncement, MiAnnouncementRead, MiAntenna, MiApp, MiAuthSession, MiAvatarDecoration, MiBlocking, MiChannel, MiChannelFavorite, MiChannelFollowing, MiClip, MiClipFavorite, MiClipNote, MiDriveFile, MiDriveFolder, MiEmoji, MiEmojiDraft, MiFlash, MiFlashLike, MiFollowRequest, MiFollowing, MiGalleryLike, MiGalleryPost, MiHashtag, MiInstance, MiMeta, MiModerationLog, MiMuting, MiNote, MiNoteFavorite, MiNoteReaction, MiNoteThreadMuting, MiNoteUnread, MiPage, MiPageLike, MiPasswordResetRequest, MiPoll, MiPollVote, MiPromoNote, MiPromoRead, MiRegistrationTicket, MiRegistryItem, MiRelay, MiRenoteMuting, MiRetentionAggregation, MiRole, MiRoleAssignment, MiSignin, MiSwSubscription, MiUsedUsername, MiUser, MiUserIp, MiUserKeypair, MiUserList, MiUserListFavorite, MiUserListMembership, MiUserMemo, MiUserNotePining, MiUserPending, MiUserProfile, MiUserPublickey, MiUserSecurityKey, MiWebhook } from './_.js'; import type { DataSource } from 'typeorm'; import type { Provider } from '@nestjs/common'; @@ -39,6 +39,12 @@ const $appsRepository: Provider = { inject: [DI.db], }; +const $avatarDecorationsRepository: Provider = { + provide: DI.avatarDecorationsRepository, + useFactory: (db: DataSource) => db.getRepository(MiAvatarDecoration), + inject: [DI.db], +}; + const $noteFavoritesRepository: Provider = { provide: DI.noteFavoritesRepository, useFactory: (db: DataSource) => db.getRepository(MiNoteFavorite), @@ -408,6 +414,7 @@ const $userMemosRepository: Provider = { $announcementsRepository, $announcementReadsRepository, $appsRepository, + $avatarDecorationsRepository, $noteFavoritesRepository, $noteThreadMutingsRepository, $noteReactionsRepository, @@ -475,6 +482,7 @@ const $userMemosRepository: Provider = { $announcementsRepository, $announcementReadsRepository, $appsRepository, + $avatarDecorationsRepository, $noteFavoritesRepository, $noteThreadMutingsRepository, $noteReactionsRepository, diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts index 796d7c8356..c98426a7b6 100644 --- a/packages/backend/src/models/User.ts +++ b/packages/backend/src/models/User.ts @@ -138,6 +138,11 @@ export class MiUser { }) public bannerBlurhash: string | null; + @Column('varchar', { + length: 512, array: true, default: '{}', + }) + public avatarDecorations: string[]; + @Index() @Column('varchar', { length: 128, array: true, default: '{}', diff --git a/packages/backend/src/models/_.ts b/packages/backend/src/models/_.ts index 98392c0af4..f72c7e1065 100644 --- a/packages/backend/src/models/_.ts +++ b/packages/backend/src/models/_.ts @@ -10,6 +10,7 @@ import { MiAnnouncement } from '@/models/Announcement.js'; import { MiAnnouncementRead } from '@/models/AnnouncementRead.js'; import { MiAntenna } from '@/models/Antenna.js'; import { MiApp } from '@/models/App.js'; +import { MiAvatarDecoration } from '@/models/AvatarDecoration.js'; import { MiAuthSession } from '@/models/AuthSession.js'; import { MiBlocking } from '@/models/Blocking.js'; import { MiChannelFollowing } from '@/models/ChannelFollowing.js'; @@ -78,6 +79,7 @@ export { MiAnnouncementRead, MiAntenna, MiApp, + MiAvatarDecoration, MiAuthSession, MiBlocking, MiChannelFollowing, @@ -145,6 +147,7 @@ export type AnnouncementsRepository = Repository; export type AnnouncementReadsRepository = Repository; export type AntennasRepository = Repository; export type AppsRepository = Repository; +export type AvatarDecorationsRepository = Repository; export type AuthSessionsRepository = Repository; export type BlockingsRepository = Repository; export type ChannelFollowingsRepository = Repository; diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 57d2d976ff..bf283fbeb2 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -37,6 +37,26 @@ export const packedUserLiteSchema = { type: 'string', nullable: true, optional: false, }, + avatarDecorations: { + type: 'array', + nullable: false, optional: false, + items: { + type: 'object', + nullable: false, optional: false, + properties: { + id: { + type: 'string', + nullable: false, optional: false, + format: 'id', + }, + url: { + type: 'string', + format: 'url', + nullable: false, optional: false, + }, + }, + }, + }, isAdmin: { type: 'boolean', nullable: false, optional: true, diff --git a/packages/backend/src/postgres.ts b/packages/backend/src/postgres.ts index 16c3387ad2..d62ad62ba6 100644 --- a/packages/backend/src/postgres.ts +++ b/packages/backend/src/postgres.ts @@ -18,6 +18,7 @@ import { MiAnnouncement } from '@/models/Announcement.js'; import { MiAnnouncementRead } from '@/models/AnnouncementRead.js'; import { MiAntenna } from '@/models/Antenna.js'; import { MiApp } from '@/models/App.js'; +import { MiAvatarDecoration } from '@/models/AvatarDecoration.js'; import { MiAuthSession } from '@/models/AuthSession.js'; import { MiBlocking } from '@/models/Blocking.js'; import { MiChannelFollowing } from '@/models/ChannelFollowing.js'; @@ -130,6 +131,7 @@ export const entities = [ MiMeta, MiInstance, MiApp, + MiAvatarDecoration, MiAuthSession, MiAccessToken, MiUser, diff --git a/packages/backend/src/server/api/EndpointsModule.ts b/packages/backend/src/server/api/EndpointsModule.ts index f52791fe62..92e6da4ba5 100644 --- a/packages/backend/src/server/api/EndpointsModule.ts +++ b/packages/backend/src/server/api/EndpointsModule.ts @@ -18,6 +18,10 @@ import * as ep___admin_announcements_create from './endpoints/admin/announcement import * as ep___admin_announcements_delete from './endpoints/admin/announcements/delete.js'; import * as ep___admin_announcements_list from './endpoints/admin/announcements/list.js'; import * as ep___admin_announcements_update from './endpoints/admin/announcements/update.js'; +import * as ep___admin_avatarDecorations_create from './endpoints/admin/avatar-decorations/create.js'; +import * as ep___admin_avatarDecorations_delete from './endpoints/admin/avatar-decorations/delete.js'; +import * as ep___admin_avatarDecorations_list from './endpoints/admin/avatar-decorations/list.js'; +import * as ep___admin_avatarDecorations_update from './endpoints/admin/avatar-decorations/update.js'; import * as ep___admin_deleteAllFilesOfAUser from './endpoints/admin/delete-all-files-of-a-user.js'; import * as ep___admin_drive_cleanRemoteFiles from './endpoints/admin/drive/clean-remote-files.js'; import * as ep___admin_drive_cleanup from './endpoints/admin/drive/cleanup.js'; @@ -163,6 +167,7 @@ import * as ep___federation_stats from './endpoints/federation/stats.js'; import * as ep___following_create from './endpoints/following/create.js'; import * as ep___following_delete from './endpoints/following/delete.js'; import * as ep___following_update from './endpoints/following/update.js'; +import * as ep___following_update_all from './endpoints/following/update-all.js'; import * as ep___following_invalidate from './endpoints/following/invalidate.js'; import * as ep___following_requests_accept from './endpoints/following/requests/accept.js'; import * as ep___following_requests_cancel from './endpoints/following/requests/cancel.js'; @@ -178,6 +183,7 @@ import * as ep___gallery_posts_show from './endpoints/gallery/posts/show.js'; import * as ep___gallery_posts_unlike from './endpoints/gallery/posts/unlike.js'; import * as ep___gallery_posts_update from './endpoints/gallery/posts/update.js'; import * as ep___getOnlineUsersCount from './endpoints/get-online-users-count.js'; +import * as ep___getAvatarDecorations from './endpoints/get-avatar-decorations.js'; import * as ep___hashtags_list from './endpoints/hashtags/list.js'; import * as ep___hashtags_search from './endpoints/hashtags/search.js'; import * as ep___hashtags_show from './endpoints/hashtags/show.js'; @@ -354,6 +360,7 @@ import * as ep___users_show from './endpoints/users/show.js'; import * as ep___users_achievements from './endpoints/users/achievements.js'; import * as ep___users_updateMemo from './endpoints/users/update-memo.js'; import * as ep___fetchRss from './endpoints/fetch-rss.js'; +import * as ep___fetchExternalResources from './endpoints/fetch-external-resources.js'; import * as ep___retention from './endpoints/retention.js'; import { GetterService } from './GetterService.js'; import { ApiLoggerService } from './ApiLoggerService.js'; @@ -371,6 +378,10 @@ const $admin_announcements_create: Provider = { provide: 'ep:admin/announcements const $admin_announcements_delete: Provider = { provide: 'ep:admin/announcements/delete', useClass: ep___admin_announcements_delete.default }; const $admin_announcements_list: Provider = { provide: 'ep:admin/announcements/list', useClass: ep___admin_announcements_list.default }; const $admin_announcements_update: Provider = { provide: 'ep:admin/announcements/update', useClass: ep___admin_announcements_update.default }; +const $admin_avatarDecorations_create: Provider = { provide: 'ep:admin/avatar-decorations/create', useClass: ep___admin_avatarDecorations_create.default }; +const $admin_avatarDecorations_delete: Provider = { provide: 'ep:admin/avatar-decorations/delete', useClass: ep___admin_avatarDecorations_delete.default }; +const $admin_avatarDecorations_list: Provider = { provide: 'ep:admin/avatar-decorations/list', useClass: ep___admin_avatarDecorations_list.default }; +const $admin_avatarDecorations_update: Provider = { provide: 'ep:admin/avatar-decorations/update', useClass: ep___admin_avatarDecorations_update.default }; const $admin_deleteAllFilesOfAUser: Provider = { provide: 'ep:admin/delete-all-files-of-a-user', useClass: ep___admin_deleteAllFilesOfAUser.default }; const $admin_drive_cleanRemoteFiles: Provider = { provide: 'ep:admin/drive/clean-remote-files', useClass: ep___admin_drive_cleanRemoteFiles.default }; const $admin_drive_cleanup: Provider = { provide: 'ep:admin/drive/cleanup', useClass: ep___admin_drive_cleanup.default }; @@ -516,6 +527,7 @@ const $federation_stats: Provider = { provide: 'ep:federation/stats', useClass: const $following_create: Provider = { provide: 'ep:following/create', useClass: ep___following_create.default }; const $following_delete: Provider = { provide: 'ep:following/delete', useClass: ep___following_delete.default }; const $following_update: Provider = { provide: 'ep:following/update', useClass: ep___following_update.default }; +const $following_update_all: Provider = { provide: 'ep:following/update-all', useClass: ep___following_update_all.default }; const $following_invalidate: Provider = { provide: 'ep:following/invalidate', useClass: ep___following_invalidate.default }; const $following_requests_accept: Provider = { provide: 'ep:following/requests/accept', useClass: ep___following_requests_accept.default }; const $following_requests_cancel: Provider = { provide: 'ep:following/requests/cancel', useClass: ep___following_requests_cancel.default }; @@ -531,6 +543,7 @@ const $gallery_posts_show: Provider = { provide: 'ep:gallery/posts/show', useCla const $gallery_posts_unlike: Provider = { provide: 'ep:gallery/posts/unlike', useClass: ep___gallery_posts_unlike.default }; const $gallery_posts_update: Provider = { provide: 'ep:gallery/posts/update', useClass: ep___gallery_posts_update.default }; const $getOnlineUsersCount: Provider = { provide: 'ep:get-online-users-count', useClass: ep___getOnlineUsersCount.default }; +const $getAvatarDecorations: Provider = { provide: 'ep:get-avatar-decorations', useClass: ep___getAvatarDecorations.default }; const $hashtags_list: Provider = { provide: 'ep:hashtags/list', useClass: ep___hashtags_list.default }; const $hashtags_search: Provider = { provide: 'ep:hashtags/search', useClass: ep___hashtags_search.default }; const $hashtags_show: Provider = { provide: 'ep:hashtags/show', useClass: ep___hashtags_show.default }; @@ -707,6 +720,7 @@ const $users_show: Provider = { provide: 'ep:users/show', useClass: ep___users_s const $users_achievements: Provider = { provide: 'ep:users/achievements', useClass: ep___users_achievements.default }; const $users_updateMemo: Provider = { provide: 'ep:users/update-memo', useClass: ep___users_updateMemo.default }; const $fetchRss: Provider = { provide: 'ep:fetch-rss', useClass: ep___fetchRss.default }; +const $fetchExternalResources: Provider = { provide: 'ep:fetch-external-resources', useClass: ep___fetchExternalResources.default }; const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention.default }; @Module({ @@ -728,6 +742,10 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $admin_announcements_delete, $admin_announcements_list, $admin_announcements_update, + $admin_avatarDecorations_create, + $admin_avatarDecorations_delete, + $admin_avatarDecorations_list, + $admin_avatarDecorations_update, $admin_deleteAllFilesOfAUser, $admin_drive_cleanRemoteFiles, $admin_drive_cleanup, @@ -873,6 +891,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $following_create, $following_delete, $following_update, + $following_update_all, $following_invalidate, $following_requests_accept, $following_requests_cancel, @@ -888,6 +907,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $gallery_posts_unlike, $gallery_posts_update, $getOnlineUsersCount, + $getAvatarDecorations, $hashtags_list, $hashtags_search, $hashtags_show, @@ -1064,6 +1084,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $users_achievements, $users_updateMemo, $fetchRss, + $fetchExternalResources, $retention, ], exports: [ @@ -1079,6 +1100,10 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $admin_announcements_delete, $admin_announcements_list, $admin_announcements_update, + $admin_avatarDecorations_create, + $admin_avatarDecorations_delete, + $admin_avatarDecorations_list, + $admin_avatarDecorations_update, $admin_deleteAllFilesOfAUser, $admin_drive_cleanRemoteFiles, $admin_drive_cleanup, @@ -1224,6 +1249,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $following_create, $following_delete, $following_update, + $following_update_all, $following_invalidate, $following_requests_accept, $following_requests_cancel, @@ -1239,6 +1265,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $gallery_posts_unlike, $gallery_posts_update, $getOnlineUsersCount, + $getAvatarDecorations, $hashtags_list, $hashtags_search, $hashtags_show, @@ -1412,6 +1439,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention $users_achievements, $users_updateMemo, $fetchRss, + $fetchExternalResources, $retention, ], }) diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 748a73b17e..26b91b1f41 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -18,6 +18,10 @@ import * as ep___admin_announcements_create from './endpoints/admin/announcement import * as ep___admin_announcements_delete from './endpoints/admin/announcements/delete.js'; import * as ep___admin_announcements_list from './endpoints/admin/announcements/list.js'; import * as ep___admin_announcements_update from './endpoints/admin/announcements/update.js'; +import * as ep___admin_avatarDecorations_create from './endpoints/admin/avatar-decorations/create.js'; +import * as ep___admin_avatarDecorations_delete from './endpoints/admin/avatar-decorations/delete.js'; +import * as ep___admin_avatarDecorations_list from './endpoints/admin/avatar-decorations/list.js'; +import * as ep___admin_avatarDecorations_update from './endpoints/admin/avatar-decorations/update.js'; import * as ep___admin_deleteAllFilesOfAUser from './endpoints/admin/delete-all-files-of-a-user.js'; import * as ep___admin_drive_cleanRemoteFiles from './endpoints/admin/drive/clean-remote-files.js'; import * as ep___admin_drive_cleanup from './endpoints/admin/drive/cleanup.js'; @@ -163,6 +167,7 @@ import * as ep___federation_stats from './endpoints/federation/stats.js'; import * as ep___following_create from './endpoints/following/create.js'; import * as ep___following_delete from './endpoints/following/delete.js'; import * as ep___following_update from './endpoints/following/update.js'; +import * as ep___following_update_all from './endpoints/following/update-all.js'; import * as ep___following_invalidate from './endpoints/following/invalidate.js'; import * as ep___following_requests_accept from './endpoints/following/requests/accept.js'; import * as ep___following_requests_cancel from './endpoints/following/requests/cancel.js'; @@ -178,6 +183,7 @@ import * as ep___gallery_posts_show from './endpoints/gallery/posts/show.js'; import * as ep___gallery_posts_unlike from './endpoints/gallery/posts/unlike.js'; import * as ep___gallery_posts_update from './endpoints/gallery/posts/update.js'; import * as ep___getOnlineUsersCount from './endpoints/get-online-users-count.js'; +import * as ep___getAvatarDecorations from './endpoints/get-avatar-decorations.js'; import * as ep___hashtags_list from './endpoints/hashtags/list.js'; import * as ep___hashtags_search from './endpoints/hashtags/search.js'; import * as ep___hashtags_show from './endpoints/hashtags/show.js'; @@ -354,6 +360,7 @@ import * as ep___users_show from './endpoints/users/show.js'; import * as ep___users_achievements from './endpoints/users/achievements.js'; import * as ep___users_updateMemo from './endpoints/users/update-memo.js'; import * as ep___fetchRss from './endpoints/fetch-rss.js'; +import * as ep___fetchExternalResources from './endpoints/fetch-external-resources.js'; import * as ep___retention from './endpoints/retention.js'; const eps = [ @@ -369,6 +376,10 @@ const eps = [ ['admin/announcements/delete', ep___admin_announcements_delete], ['admin/announcements/list', ep___admin_announcements_list], ['admin/announcements/update', ep___admin_announcements_update], + ['admin/avatar-decorations/create', ep___admin_avatarDecorations_create], + ['admin/avatar-decorations/delete', ep___admin_avatarDecorations_delete], + ['admin/avatar-decorations/list', ep___admin_avatarDecorations_list], + ['admin/avatar-decorations/update', ep___admin_avatarDecorations_update], ['admin/delete-all-files-of-a-user', ep___admin_deleteAllFilesOfAUser], ['admin/drive/clean-remote-files', ep___admin_drive_cleanRemoteFiles], ['admin/drive/cleanup', ep___admin_drive_cleanup], @@ -514,6 +525,7 @@ const eps = [ ['following/create', ep___following_create], ['following/delete', ep___following_delete], ['following/update', ep___following_update], + ['following/update-all', ep___following_update_all], ['following/invalidate', ep___following_invalidate], ['following/requests/accept', ep___following_requests_accept], ['following/requests/cancel', ep___following_requests_cancel], @@ -529,6 +541,7 @@ const eps = [ ['gallery/posts/unlike', ep___gallery_posts_unlike], ['gallery/posts/update', ep___gallery_posts_update], ['get-online-users-count', ep___getOnlineUsersCount], + ['get-avatar-decorations', ep___getAvatarDecorations], ['hashtags/list', ep___hashtags_list], ['hashtags/search', ep___hashtags_search], ['hashtags/show', ep___hashtags_show], @@ -705,6 +718,7 @@ const eps = [ ['users/achievements', ep___users_achievements], ['users/update-memo', ep___users_updateMemo], ['fetch-rss', ep___fetchRss], + ['fetch-external-resources', ep___fetchExternalResources], ['retention', ep___retention], ]; diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts new file mode 100644 index 0000000000..c1869b141a --- /dev/null +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts @@ -0,0 +1,44 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; + +export const meta = { + tags: ['admin'], + + requireCredential: true, + requireModerator: true, +} as const; + +export const paramDef = { + type: 'object', + properties: { + name: { type: 'string', minLength: 1 }, + description: { type: 'string' }, + url: { type: 'string', minLength: 1 }, + roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: { + type: 'string', + } }, + }, + required: ['name', 'description', 'url'], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private avatarDecorationService: AvatarDecorationService, + ) { + super(meta, paramDef, async (ps, me) => { + await this.avatarDecorationService.create({ + name: ps.name, + description: ps.description, + url: ps.url, + roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration, + }, me); + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts new file mode 100644 index 0000000000..5aba24b426 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/delete.ts @@ -0,0 +1,39 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Inject, Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { DI } from '@/di-symbols.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; +import { ApiError } from '../../../error.js'; + +export const meta = { + tags: ['admin'], + + requireCredential: true, + requireModerator: true, + + errors: { + }, +} as const; + +export const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + }, + required: ['id'], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private avatarDecorationService: AvatarDecorationService, + ) { + super(meta, paramDef, async (ps, me) => { + await this.avatarDecorationService.delete(ps.id, me); + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts new file mode 100644 index 0000000000..9a32a59081 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts @@ -0,0 +1,101 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Inject, Injectable } from '@nestjs/common'; +import type { AnnouncementsRepository, AnnouncementReadsRepository } from '@/models/_.js'; +import type { MiAnnouncement } from '@/models/Announcement.js'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { QueryService } from '@/core/QueryService.js'; +import { DI } from '@/di-symbols.js'; +import { IdService } from '@/core/IdService.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; + +export const meta = { + tags: ['admin'], + + requireCredential: true, + requireModerator: true, + + res: { + type: 'array', + optional: false, nullable: false, + items: { + type: 'object', + optional: false, nullable: false, + properties: { + id: { + type: 'string', + optional: false, nullable: false, + format: 'id', + example: 'xxxxxxxxxx', + }, + createdAt: { + type: 'string', + optional: false, nullable: false, + format: 'date-time', + }, + updatedAt: { + type: 'string', + optional: false, nullable: true, + format: 'date-time', + }, + name: { + type: 'string', + optional: false, nullable: false, + }, + description: { + type: 'string', + optional: false, nullable: false, + }, + url: { + type: 'string', + optional: false, nullable: false, + }, + roleIdsThatCanBeUsedThisDecoration: { + type: 'array', + optional: false, nullable: false, + items: { + type: 'string', + optional: false, nullable: false, + format: 'id', + }, + }, + }, + }, + }, +} as const; + +export const paramDef = { + type: 'object', + properties: { + limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + sinceId: { type: 'string', format: 'misskey:id' }, + untilId: { type: 'string', format: 'misskey:id' }, + userId: { type: 'string', format: 'misskey:id', nullable: true }, + }, + required: [], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private avatarDecorationService: AvatarDecorationService, + private idService: IdService, + ) { + super(meta, paramDef, async (ps, me) => { + const avatarDecorations = await this.avatarDecorationService.getAll(true); + + return avatarDecorations.map(avatarDecoration => ({ + id: avatarDecoration.id, + createdAt: this.idService.parse(avatarDecoration.id).date.toISOString(), + updatedAt: avatarDecoration.updatedAt?.toISOString() ?? null, + name: avatarDecoration.name, + description: avatarDecoration.description, + url: avatarDecoration.url, + roleIdsThatCanBeUsedThisDecoration: avatarDecoration.roleIdsThatCanBeUsedThisDecoration, + })); + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts new file mode 100644 index 0000000000..564014a3df --- /dev/null +++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts @@ -0,0 +1,50 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Inject, Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { DI } from '@/di-symbols.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; +import { ApiError } from '../../../error.js'; + +export const meta = { + tags: ['admin'], + + requireCredential: true, + requireModerator: true, + + errors: { + }, +} as const; + +export const paramDef = { + type: 'object', + properties: { + id: { type: 'string', format: 'misskey:id' }, + name: { type: 'string', minLength: 1 }, + description: { type: 'string' }, + url: { type: 'string', minLength: 1 }, + roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: { + type: 'string', + } }, + }, + required: ['id'], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private avatarDecorationService: AvatarDecorationService, + ) { + super(meta, paramDef, async (ps, me) => { + await this.avatarDecorationService.update(ps.id, { + name: ps.name, + description: ps.description, + url: ps.url, + roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration, + }, me); + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/fetch-external-resources.ts b/packages/backend/src/server/api/endpoints/fetch-external-resources.ts new file mode 100644 index 0000000000..d7b46cc666 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/fetch-external-resources.ts @@ -0,0 +1,72 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { createHash } from 'crypto'; +import ms from 'ms'; +import { Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { HttpRequestService } from '@/core/HttpRequestService.js'; +import { ApiError } from '../error.js'; + +export const meta = { + tags: ['meta'], + + requireCredential: true, + + limit: { + duration: ms('1hour'), + max: 50, + }, + + errors: { + invalidSchema: { + message: 'External resource returned invalid schema.', + code: 'EXT_RESOURCE_RETURNED_INVALID_SCHEMA', + id: 'bb774091-7a15-4a70-9dc5-6ac8cf125856', + }, + hashUnmached: { + message: 'Hash did not match.', + code: 'EXT_RESOURCE_HASH_DIDNT_MATCH', + id: '693ba8ba-b486-40df-a174-72f8279b56a4', + }, + }, +} as const; + +export const paramDef = { + type: 'object', + properties: { + url: { type: 'string' }, + hash: { type: 'string' }, + }, + required: ['url', 'hash'], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private httpRequestService: HttpRequestService, + ) { + super(meta, paramDef, async (ps) => { + const res = await this.httpRequestService.getJson<{ + type: string; + data: string; + }>(ps.url); + + if (!res.data || !res.type) { + throw new ApiError(meta.errors.invalidSchema); + } + + const resHash = createHash('sha512').update(res.data.replace(/\r\n/g, '\n')).digest('hex'); + if (resHash !== ps.hash) { + throw new ApiError(meta.errors.hashUnmached); + } + + return { + type: res.type, + data: res.data, + }; + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/following/update-all.ts b/packages/backend/src/server/api/endpoints/following/update-all.ts new file mode 100644 index 0000000000..28734cfdbd --- /dev/null +++ b/packages/backend/src/server/api/endpoints/following/update-all.ts @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import ms from 'ms'; +import { Inject, Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import type { FollowingsRepository } from '@/models/_.js'; +import { UserEntityService } from '@/core/entities/UserEntityService.js'; +import { UserFollowingService } from '@/core/UserFollowingService.js'; +import { DI } from '@/di-symbols.js'; +import { GetterService } from '@/server/api/GetterService.js'; +import { ApiError } from '../../error.js'; + +export const meta = { + tags: ['following', 'users'], + + limit: { + duration: ms('1hour'), + max: 10, + }, + + requireCredential: true, + + kind: 'write:following', +} as const; + +export const paramDef = { + type: 'object', + properties: { + notify: { type: 'string', enum: ['normal', 'none'] }, + withReplies: { type: 'boolean' }, + }, +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + @Inject(DI.followingsRepository) + private followingsRepository: FollowingsRepository, + ) { + super(meta, paramDef, async (ps, me) => { + await this.followingsRepository.update({ + followerId: me.id, + }, { + notify: ps.notify != null ? (ps.notify === 'none' ? null : ps.notify) : undefined, + withReplies: ps.withReplies != null ? ps.withReplies : undefined, + }); + + return; + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts b/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts new file mode 100644 index 0000000000..ec602a0dc5 --- /dev/null +++ b/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts @@ -0,0 +1,79 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { IsNull } from 'typeorm'; +import { Inject, Injectable } from '@nestjs/common'; +import { Endpoint } from '@/server/api/endpoint-base.js'; +import { DI } from '@/di-symbols.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; + +export const meta = { + tags: ['users'], + + requireCredential: false, + + res: { + type: 'array', + optional: false, nullable: false, + items: { + type: 'object', + optional: false, nullable: false, + properties: { + id: { + type: 'string', + optional: false, nullable: false, + format: 'id', + example: 'xxxxxxxxxx', + }, + name: { + type: 'string', + optional: false, nullable: false, + }, + description: { + type: 'string', + optional: false, nullable: false, + }, + url: { + type: 'string', + optional: false, nullable: false, + }, + roleIdsThatCanBeUsedThisDecoration: { + type: 'array', + optional: false, nullable: false, + items: { + type: 'string', + optional: false, nullable: false, + format: 'id', + }, + }, + }, + }, + }, +} as const; + +export const paramDef = { + type: 'object', + properties: {}, + required: [], +} as const; + +@Injectable() +export default class extends Endpoint { // eslint-disable-line import/no-default-export + constructor( + private avatarDecorationService: AvatarDecorationService, + ) { + super(meta, paramDef, async (ps, me) => { + const decorations = await this.avatarDecorationService.getAll(true); + + return decorations.map(decoration => ({ + id: decoration.id, + name: decoration.name, + description: decoration.description, + url: decoration.url, + roleIdsThatCanBeUsedThisDecoration: decoration.roleIdsThatCanBeUsedThisDecoration, + })); + }); + } +} diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 431bb4c60a..79ead57a66 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -32,6 +32,7 @@ import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.j import { HttpRequestService } from '@/core/HttpRequestService.js'; import type { Config } from '@/config.js'; import { safeForSql } from '@/misc/safe-for-sql.js'; +import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; import { ApiLoggerService } from '../../ApiLoggerService.js'; import { ApiError } from '../../error.js'; @@ -131,6 +132,9 @@ export const paramDef = { birthday: { ...birthdaySchema, nullable: true }, lang: { type: 'string', enum: [null, ...Object.keys(langmap)] as string[], nullable: true }, avatarId: { type: 'string', format: 'misskey:id', nullable: true }, + avatarDecorations: { type: 'array', maxItems: 1, items: { + type: 'string', + } }, bannerId: { type: 'string', format: 'misskey:id', nullable: true }, fields: { type: 'array', @@ -207,6 +211,7 @@ export default class extends Endpoint { // eslint- private roleService: RoleService, private cacheService: CacheService, private httpRequestService: HttpRequestService, + private avatarDecorationService: AvatarDecorationService, ) { super(meta, paramDef, async (ps, _user, token) => { const user = await this.usersRepository.findOneByOrFail({ id: _user.id }) as MiLocalUser; @@ -296,6 +301,17 @@ export default class extends Endpoint { // eslint- updates.bannerBlurhash = null; } + if (ps.avatarDecorations) { + const decorations = await this.avatarDecorationService.getAll(true); + const myRoles = await this.roleService.getUserRoles(user.id); + const allRoles = await this.roleService.getRoles(); + const decorationIds = decorations + .filter(d => d.roleIdsThatCanBeUsedThisDecoration.filter(roleId => allRoles.some(r => r.id === roleId)).length === 0 || myRoles.some(r => d.roleIdsThatCanBeUsedThisDecoration.includes(r.id))) + .map(d => d.id); + + updates.avatarDecorations = ps.avatarDecorations.filter(id => decorationIds.includes(id)); + } + if (ps.pinnedPageId) { const page = await this.pagesRepository.findOneBy({ id: ps.pinnedPageId }); @@ -421,9 +437,13 @@ export default class extends Endpoint { // eslint- const myLink = `${this.config.url}/@${user.username}`; - const includesMyLink = Array.from(doc.getElementsByTagName('a')).some(a => a.href === myLink); + const aEls = Array.from(doc.getElementsByTagName('a')); + const linkEls = Array.from(doc.getElementsByTagName('link')); - if (includesMyLink) { + const includesMyLink = aEls.some(a => a.href === myLink); + const includesRelMeLinks = [...aEls, ...linkEls].some(link => link.rel === 'me' && link.href === myLink); + + if (includesMyLink || includesRelMeLinks) { await this.userProfilesRepository.createQueryBuilder('profile').update() .where('userId = :userId', { userId: user.id }) .set({ diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 2b31e6169c..96e1e94f7c 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -3,12 +3,9 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Brackets } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; -import * as Redis from 'ioredis'; -import type { NotesRepository, UserListsRepository, UserListMembershipsRepository, MiNote } from '@/models/_.js'; +import type { NotesRepository, UserListsRepository } from '@/models/_.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; -import { QueryService } from '@/core/QueryService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import ActiveUsersChart from '@/core/chart/charts/active-users.js'; import { DI } from '@/di-symbols.js'; @@ -67,9 +64,6 @@ export const paramDef = { @Injectable() export default class extends Endpoint { // eslint-disable-line import/no-default-export constructor( - @Inject(DI.redisForTimelines) - private redisForTimelines: Redis.Redis, - @Inject(DI.notesRepository) private notesRepository: NotesRepository, diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 2b235b9822..46071e82fa 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -39,20 +39,22 @@ class HomeTimelineChannel extends Channel { @bindThis private async onNote(note: Packed<'Note'>) { + const isMe = this.user!.id === note.userId; + if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return; if (note.channelId) { if (!this.followingChannels.has(note.channelId)) return; } else { // その投稿のユーザーをフォローしていなかったら弾く - if ((this.user!.id !== note.userId) && !Object.hasOwn(this.following, note.userId)) return; + if (!isMe && !Object.hasOwn(this.following, note.userId)) return; } // Ignore notes from instances the user has muted if (isInstanceMuted(note, new Set(this.userProfile!.mutedInstances))) return; if (note.visibility === 'followers') { - if (!Object.hasOwn(this.following, note.userId)) return; + if (!isMe && !Object.hasOwn(this.following, note.userId)) return; } else if (note.visibility === 'specified') { if (!note.visibleUserIds!.includes(this.user!.id)) return; } @@ -61,7 +63,7 @@ class HomeTimelineChannel extends Channel { if (note.reply && !this.following[note.userId]?.withReplies) { const reply = note.reply; // 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合 - if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return; } if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return; diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 4e90912084..2722ebcd50 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -49,6 +49,8 @@ class HybridTimelineChannel extends Channel { @bindThis private async onNote(note: Packed<'Note'>) { + const isMe = this.user!.id === note.userId; + if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return; // チャンネルの投稿ではなく、自分自身の投稿 または @@ -56,14 +58,14 @@ class HybridTimelineChannel extends Channel { // チャンネルの投稿ではなく、全体公開のローカルの投稿 または // フォローしているチャンネルの投稿 の場合だけ if (!( - (note.channelId == null && this.user!.id === note.userId) || + (note.channelId == null && isMe) || (note.channelId == null && Object.hasOwn(this.following, note.userId)) || (note.channelId == null && (note.user.host == null && note.visibility === 'public')) || (note.channelId != null && this.followingChannels.has(note.channelId)) )) return; if (note.visibility === 'followers') { - if (!Object.hasOwn(this.following, note.userId)) return; + if (!isMe && !Object.hasOwn(this.following, note.userId)) return; } else if (note.visibility === 'specified') { if (!note.visibleUserIds!.includes(this.user!.id)) return; } @@ -75,7 +77,7 @@ class HybridTimelineChannel extends Channel { if (note.reply && !this.following[note.userId]?.withReplies && !this.withReplies) { const reply = note.reply; // 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合 - if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return; } if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return; diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index 6d83d4cb5b..68927987d6 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -78,12 +78,14 @@ class UserListChannel extends Channel { @bindThis private async onNote(note: Packed<'Note'>) { + const isMe = this.user!.id === note.userId; + if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return; if (!Object.hasOwn(this.membershipsMap, note.userId)) return; if (note.visibility === 'followers') { - if (!Object.hasOwn(this.following, note.userId)) return; + if (!isMe && !Object.hasOwn(this.following, note.userId)) return; } else if (note.visibility === 'specified') { if (!note.visibleUserIds!.includes(this.user!.id)) return; } @@ -92,7 +94,7 @@ class UserListChannel extends Channel { if (note.reply && !this.membershipsMap[note.userId]?.withReplies) { const reply = note.reply; // 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合 - if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return; + if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return; } // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts index f7ebabca2d..117e9884a9 100644 --- a/packages/backend/src/types.ts +++ b/packages/backend/src/types.ts @@ -61,6 +61,9 @@ export const moderationLogTypes = [ 'createAd', 'updateAd', 'deleteAd', + 'createAvatarDecoration', + 'updateAvatarDecoration', + 'deleteAvatarDecoration', ] as const; export type ModerationLogPayloads = { @@ -226,6 +229,19 @@ export type ModerationLogPayloads = { adId: string; ad: any; }; + createAvatarDecoration: { + avatarDecorationId: string; + avatarDecoration: any; + }; + updateAvatarDecoration: { + avatarDecorationId: string; + before: any; + after: any; + }; + deleteAvatarDecoration: { + avatarDecorationId: string; + avatarDecoration: any; + }; }; export type Serialized = { diff --git a/packages/backend/test/e2e/streaming.ts b/packages/backend/test/e2e/streaming.ts index 5a83bbb7da..f0b51d4356 100644 --- a/packages/backend/test/e2e/streaming.ts +++ b/packages/backend/test/e2e/streaming.ts @@ -115,6 +115,16 @@ describe('Streaming', () => { assert.strictEqual(fired, true); }); + test('自分の visibility: followers な投稿が流れる', async () => { + const fired = await waitFire( + ayano, 'homeTimeline', // ayano:Home + () => api('notes/create', { text: 'foo', visibility: 'followers' }, ayano), // ayano posts + msg => msg.type === 'note' && msg.body.text === 'foo', + ); + + assert.strictEqual(fired, true); + }); + test('フォローしているユーザーの投稿が流れる', async () => { const fired = await waitFire( ayano, 'homeTimeline', // ayano:home @@ -125,6 +135,30 @@ describe('Streaming', () => { assert.strictEqual(fired, true); }); + test('フォローしているユーザーの visibility: followers な投稿が流れる', async () => { + const fired = await waitFire( + ayano, 'homeTimeline', // ayano:home + () => api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko), // kyoko posts + msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko + ); + + assert.strictEqual(fired, true); + }); + + /* なんか失敗する + test('フォローしているユーザーの visibility: followers な投稿への返信が流れる', async () => { + const note = await api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko); + + const fired = await waitFire( + ayano, 'homeTimeline', // ayano:home + () => api('notes/create', { text: 'bar', visibility: 'followers', replyId: note.body.id }, kyoko), // kyoko posts + msg => msg.type === 'note' && msg.body.userId === kyoko.id && msg.body.reply.text === 'foo', + ); + + assert.strictEqual(fired, true); + }); + */ + test('フォローしていないユーザーの投稿は流れない', async () => { const fired = await waitFire( kyoko, 'homeTimeline', // kyoko:home @@ -241,6 +275,16 @@ describe('Streaming', () => { assert.strictEqual(fired, true); }); + test('自分の visibility: followers な投稿が流れる', async () => { + const fired = await waitFire( + ayano, 'hybridTimeline', + () => api('notes/create', { text: 'foo', visibility: 'followers' }, ayano), // ayano posts + msg => msg.type === 'note' && msg.body.text === 'foo', + ); + + assert.strictEqual(fired, true); + }); + test('フォローしていないローカルユーザーの投稿が流れる', async () => { const fired = await waitFire( ayano, 'hybridTimeline', // ayano:Hybrid @@ -293,6 +337,16 @@ describe('Streaming', () => { assert.strictEqual(fired, true); }); + test('フォローしているユーザーの visibility: followers な投稿が流れる', async () => { + const fired = await waitFire( + ayano, 'hybridTimeline', // ayano:Hybrid + () => api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko), + msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko + ); + + assert.strictEqual(fired, true); + }); + test('フォローしていないローカルユーザーのホーム投稿は流れない', async () => { const fired = await waitFire( ayano, 'hybridTimeline', // ayano:Hybrid diff --git a/packages/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 53db1ac28a..520d9b14e4 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -68,6 +68,7 @@ describe('ユーザー', () => { host: user.host, avatarUrl: user.avatarUrl, avatarBlurhash: user.avatarBlurhash, + avatarDecorations: user.avatarDecorations, isBot: user.isBot, isCat: user.isCat, instance: user.instance, @@ -349,6 +350,7 @@ describe('ユーザー', () => { assert.strictEqual(response.host, null); assert.match(response.avatarUrl, /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/); assert.strictEqual(response.avatarBlurhash, null); + assert.deepStrictEqual(response.avatarDecorations, []); assert.strictEqual(response.isBot, false); assert.strictEqual(response.isCat, false); assert.strictEqual(response.instance, undefined); diff --git a/packages/frontend/.storybook/fakes.ts b/packages/frontend/.storybook/fakes.ts index 811c243926..c2e6ee52f3 100644 --- a/packages/frontend/.storybook/fakes.ts +++ b/packages/frontend/.storybook/fakes.ts @@ -74,6 +74,7 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi onlineStatus: 'unknown', avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true', avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay', + avatarDecorations: [], emojis: [], bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog', bannerColor: '#000000', diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 05498c6aee..97f1f0b593 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -26,7 +26,7 @@ "@tabler/icons-webfont": "2.37.0", "@vitejs/plugin-vue": "4.4.0", "@vue-macros/reactivity-transform": "0.3.23", - "@vue/compiler-sfc": "3.3.4", + "@vue/compiler-sfc": "3.3.5", "astring": "1.8.6", "autosize": "6.0.1", "broadcast-channel": "5.5.0", @@ -73,29 +73,29 @@ "v-code-diff": "1.7.1", "vanilla-tilt": "1.8.1", "vite": "4.5.0", - "vue": "3.3.4", + "vue": "3.3.5", "vue-prism-editor": "2.0.0-alpha.2", "vuedraggable": "next" }, "devDependencies": { - "@storybook/addon-actions": "7.5.0", - "@storybook/addon-essentials": "7.5.0", - "@storybook/addon-interactions": "7.5.0", - "@storybook/addon-links": "7.5.0", - "@storybook/addon-storysource": "7.5.0", - "@storybook/addons": "7.5.0", - "@storybook/blocks": "7.5.0", - "@storybook/core-events": "7.5.0", + "@storybook/addon-actions": "7.5.1", + "@storybook/addon-essentials": "7.5.1", + "@storybook/addon-interactions": "7.5.1", + "@storybook/addon-links": "7.5.1", + "@storybook/addon-storysource": "7.5.1", + "@storybook/addons": "7.5.1", + "@storybook/blocks": "7.5.1", + "@storybook/core-events": "7.5.1", "@storybook/jest": "0.2.3", - "@storybook/manager-api": "7.5.0", - "@storybook/preview-api": "7.5.0", - "@storybook/react": "7.5.0", - "@storybook/react-vite": "7.5.0", + "@storybook/manager-api": "7.5.1", + "@storybook/preview-api": "7.5.1", + "@storybook/react": "7.5.1", + "@storybook/react-vite": "7.5.1", "@storybook/testing-library": "0.2.2", - "@storybook/theming": "7.5.0", - "@storybook/types": "7.5.0", - "@storybook/vue3": "7.5.0", - "@storybook/vue3-vite": "7.5.0", + "@storybook/theming": "7.5.1", + "@storybook/types": "7.5.1", + "@storybook/vue3": "7.5.1", + "@storybook/vue3-vite": "7.5.1", "@testing-library/vue": "7.0.0", "@types/escape-regexp": "0.0.2", "@types/estree": "1.0.3", @@ -112,7 +112,7 @@ "@typescript-eslint/eslint-plugin": "6.8.0", "@typescript-eslint/parser": "6.8.0", "@vitest/coverage-v8": "0.34.6", - "@vue/runtime-core": "3.3.4", + "@vue/runtime-core": "3.3.5", "acorn": "8.10.0", "cross-env": "7.0.3", "cypress": "13.3.2", @@ -129,7 +129,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "start-server-and-test": "2.0.1", - "storybook": "7.5.0", + "storybook": "7.5.1", "storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme", "summaly": "github:misskey-dev/summaly", "vite-plugin-turbosnap": "1.0.3", diff --git a/packages/frontend/src/components/MkMention.vue b/packages/frontend/src/components/MkMention.vue index ffc9ca3f4d..80426157e6 100644 --- a/packages/frontend/src/components/MkMention.vue +++ b/packages/frontend/src/components/MkMention.vue @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only