Merge branch 'develop' into feat-12997
This commit is contained in:
commit
4b3e2b01e4
|
@ -5,24 +5,23 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
|
- improve-misskey-js-autogen-check
|
||||||
paths:
|
paths:
|
||||||
- packages/backend/**
|
- packages/backend/**
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-misskey-js-autogen:
|
# pull_request_target safety: permissions: read-all, and there are no secrets used in this job
|
||||||
|
generate-misskey-js:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
contents: read
|
||||||
|
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
|
||||||
env:
|
|
||||||
api_json_name: "api-head.json"
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4.1.1
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||||
|
|
||||||
- name: setup pnpm
|
- name: setup pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
|
@ -39,79 +38,81 @@ jobs:
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: pnpm i --frozen-lockfile
|
run: pnpm i --frozen-lockfile
|
||||||
|
|
||||||
- name: wait get-api-diff
|
# generate api.json
|
||||||
uses: lewagon/wait-on-check-action@v1.3.3
|
- name: Copy Config
|
||||||
|
run: cp .config/example.yml .config/default.yml
|
||||||
|
- name: Build
|
||||||
|
run: pnpm build
|
||||||
|
- name: Generate API JSON
|
||||||
|
run: pnpm --filter backend generate-api-json
|
||||||
|
|
||||||
|
# build misskey js
|
||||||
|
- name: Build misskey-js
|
||||||
|
run: |-
|
||||||
|
cp packages/backend/built/api.json packages/misskey-js/generator/api.json
|
||||||
|
pnpm run --filter misskey-js-type-generator generate
|
||||||
|
|
||||||
|
# packages/misskey-js/generator/built/autogen
|
||||||
|
- name: Upload Generated
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
name: generated-misskey-js
|
||||||
check-regexp: get-from-misskey .+
|
path: packages/misskey-js/generator/built/autogen
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
wait-interval: 30
|
|
||||||
|
|
||||||
- name: Download artifact
|
# pull_request_target safety: permissions: read-all, and there are no secrets used in this job
|
||||||
uses: actions/github-script@v7.0.1
|
get-actual-misskey-js:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
script: |
|
submodules: true
|
||||||
const fs = require('fs');
|
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||||
|
|
||||||
const workflows = await github.rest.actions.listWorkflowRunsForRepo({
|
- name: Upload From Merged
|
||||||
owner: context.repo.owner,
|
uses: actions/upload-artifact@v4
|
||||||
repo: context.repo.repo,
|
with:
|
||||||
head_sha: `${{ github.event.pull_request.head.sha }}`
|
name: actual-misskey-js
|
||||||
}).then(x => x.data.workflow_runs);
|
path: packages/misskey-js/src/autogen
|
||||||
|
|
||||||
console.log(workflows.map(x => ({name: x.name, title: x.display_title})));
|
# pull_request_target safety: nothing is cloned from repository
|
||||||
|
comment-misskey-js-autogen:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [generate-misskey-js, get-actual-misskey-js]
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: download generated-misskey-js
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: generated-misskey-js
|
||||||
|
path: misskey-js-generated
|
||||||
|
|
||||||
const run_id = workflows.find(x => x.name.includes("Get api.json from Misskey")).id;
|
- name: download actual-misskey-js
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: actual-misskey-js
|
||||||
|
path: misskey-js-actual
|
||||||
|
|
||||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
- name: check misskey-js changes
|
||||||
owner: context.repo.owner,
|
id: check-changes
|
||||||
repo: context.repo.repo,
|
run: |
|
||||||
run_id: run_id,
|
diff -r -u --label=generated --label=on-tree ./misskey-js-generated ./misskey-js-actual > misskey-js.diff || true
|
||||||
});
|
|
||||||
|
|
||||||
let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
|
if [ -s misskey-js.diff ]; then
|
||||||
return artifact.name.startsWith("api-artifact-") || artifact.name == "api-artifact"
|
echo "changes=true" >> $GITHUB_OUTPUT
|
||||||
});
|
else
|
||||||
|
echo "changes=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
await Promise.all(matchArtifacts.map(async (artifact) => {
|
- name: Print full diff
|
||||||
let download = await github.rest.actions.downloadArtifact({
|
run: cat ./misskey-js.diff
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
artifact_id: artifact.id,
|
|
||||||
archive_format: 'zip',
|
|
||||||
});
|
|
||||||
await fs.promises.writeFile(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data));
|
|
||||||
}));
|
|
||||||
|
|
||||||
- name: unzip artifacts
|
|
||||||
run: |-
|
|
||||||
find . -mindepth 1 -maxdepth 1 -type f -name '*.zip' -exec unzip {} -d . ';'
|
|
||||||
ls -la
|
|
||||||
|
|
||||||
- name: get head checksum
|
|
||||||
run: |-
|
|
||||||
checksum=$(realpath head_checksum)
|
|
||||||
|
|
||||||
cd packages/misskey-js/src
|
|
||||||
find autogen -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum
|
|
||||||
cd ../../..
|
|
||||||
|
|
||||||
- name: build autogen
|
|
||||||
run: |-
|
|
||||||
checksum=$(realpath ${api_json_name}_checksum)
|
|
||||||
mv $api_json_name packages/misskey-js/generator/api.json
|
|
||||||
|
|
||||||
cd packages/misskey-js/generator
|
|
||||||
pnpm run generate
|
|
||||||
cd built
|
|
||||||
find autogen -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum
|
|
||||||
cd ../../../..
|
|
||||||
|
|
||||||
- name: check update for type definitions
|
|
||||||
run: diff head_checksum ${api_json_name}_checksum
|
|
||||||
|
|
||||||
- name: send message
|
- name: send message
|
||||||
if: failure()
|
if: steps.check-changes.outputs.changes == 'true'
|
||||||
uses: thollander/actions-comment-pull-request@v2
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
with:
|
with:
|
||||||
comment_tag: check-misskey-js-autogen
|
comment_tag: check-misskey-js-autogen
|
||||||
|
@ -125,7 +126,7 @@ jobs:
|
||||||
```
|
```
|
||||||
|
|
||||||
- name: send message
|
- name: send message
|
||||||
if: success()
|
if: steps.check-changes.outputs.changes == 'false'
|
||||||
uses: thollander/actions-comment-pull-request@v2
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
with:
|
with:
|
||||||
comment_tag: check-misskey-js-autogen
|
comment_tag: check-misskey-js-autogen
|
||||||
|
|
|
@ -50,12 +50,9 @@ jobs:
|
||||||
|
|
||||||
- name: Get PR ref
|
- name: Get PR ref
|
||||||
id: get-ref
|
id: get-ref
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
PR_NUMBER=$(jq --raw-output .issue.number $GITHUB_EVENT_PATH)
|
PR_REF="refs/pull/${{ github.event.issue.number }}/head"
|
||||||
PR_REF=$(gh pr view $PR_NUMBER --json headRefName -q '.headRefName')
|
echo "pr-ref=$PR_REF" >> $GITHUB_OUTPUT
|
||||||
echo "pr-ref=$PR_REF" > $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Extract wait time
|
- name: Extract wait time
|
||||||
id: get-wait-time
|
id: get-wait-time
|
||||||
|
|
|
@ -87,12 +87,13 @@ jobs:
|
||||||
if [ "$CHROMATIC_PARAMETER" = " --skip" ]; then
|
if [ "$CHROMATIC_PARAMETER" = " --skip" ]; then
|
||||||
echo "skip=true" >> $GITHUB_OUTPUT
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
BRANCH="${{ github.event.pull_request.head.user.login }}:${{ github.event.pull_request.head.ref }}"
|
BRANCH="${{ github.event.pull_request.head.user.login }}:$HEAD_REF"
|
||||||
if [ "$BRANCH" = "misskey-dev:${{ github.event.pull_request.head.ref }}" ]; then
|
if [ "$BRANCH" = "misskey-dev:$HEAD_REF" ]; then
|
||||||
BRANCH="${{ github.event.pull_request.head.ref }}"
|
BRANCH="$HEAD_REF"
|
||||||
fi
|
fi
|
||||||
pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name $BRANCH $(echo "$CHROMATIC_PARAMETER")
|
pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name $BRANCH $(echo "$CHROMATIC_PARAMETER")
|
||||||
env:
|
env:
|
||||||
|
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
||||||
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
||||||
- name: Notify that Chromatic detects changes
|
- name: Notify that Chromatic detects changes
|
||||||
uses: actions/github-script@v7.0.1
|
uses: actions/github-script@v7.0.1
|
||||||
|
|
23
CHANGELOG.md
23
CHANGELOG.md
|
@ -7,9 +7,18 @@
|
||||||
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
|
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
|
||||||
- Enhance: アンテナでBotによるノートを除外できるように
|
- Enhance: アンテナでBotによるノートを除外できるように
|
||||||
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/545)
|
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/545)
|
||||||
|
- Enhance: クリップのノート数を表示するように
|
||||||
|
- Enhance: コンディショナルロールの条件として以下を新たに追加 (#13667)
|
||||||
|
- 猫ユーザーか
|
||||||
|
- botユーザーか
|
||||||
|
- サスペンド済みユーザーか
|
||||||
|
- 鍵アカウントユーザーか
|
||||||
|
- 「アカウントを見つけやすくする」が有効なユーザーか
|
||||||
- Fix: Play作成時に設定した公開範囲が機能していない問題を修正
|
- Fix: Play作成時に設定した公開範囲が機能していない問題を修正
|
||||||
|
- Fix: 正規化されていない状態のhashtagが連合されてきたhtmlに含まれているとhashtagが正しくhashtagに復元されない問題を修正
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
|
- Feat: アップロードするファイルの名前をランダム文字列にできるように
|
||||||
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
|
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
|
||||||
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
|
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
|
||||||
- Enhance: リアクション・いいねの総数を表示するように
|
- Enhance: リアクション・いいねの総数を表示するように
|
||||||
|
@ -23,6 +32,9 @@
|
||||||
- Enhance: 映像・音声の再生メニューに「再生速度」「ループ再生」「ピクチャインピクチャ」を追加
|
- Enhance: 映像・音声の再生メニューに「再生速度」「ループ再生」「ピクチャインピクチャ」を追加
|
||||||
- Enhance: 映像・音声の再生にキーボードショートカットが使えるように
|
- Enhance: 映像・音声の再生にキーボードショートカットが使えるように
|
||||||
- Enhance: ノートについているリアクションの「もっと!」から、リアクションの一覧を表示できるように
|
- Enhance: ノートについているリアクションの「もっと!」から、リアクションの一覧を表示できるように
|
||||||
|
- Enhance: リプライにて引用がある場合テキストが空でもノートできるように
|
||||||
|
- 引用したいノートのURLをコピーしリプライ投稿画面にペーストして添付することで達成できます
|
||||||
|
- Enhance: フォローするかどうかの確認ダイアログを出せるように
|
||||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||||
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
||||||
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
||||||
|
@ -33,6 +45,10 @@
|
||||||
- Fix: コードブロックのシンタックスハイライトで使用される定義ファイルをCDNから取得するように #13177
|
- Fix: コードブロックのシンタックスハイライトで使用される定義ファイルをCDNから取得するように #13177
|
||||||
- CDNから取得せずMisskey本体にバンドルする場合は`pacakges/frontend/vite.config.ts`を修正してください。
|
- CDNから取得せずMisskey本体にバンドルする場合は`pacakges/frontend/vite.config.ts`を修正してください。
|
||||||
- Fix: タイムゾーンによっては、「今日誕生日のフォロー中ユーザー」ウィジェットが正しく動作しない問題を修正
|
- Fix: タイムゾーンによっては、「今日誕生日のフォロー中ユーザー」ウィジェットが正しく動作しない問題を修正
|
||||||
|
- Fix: CWのみの引用リノートが詳細ページで純粋なリノートとして誤って扱われてしまう問題を修正
|
||||||
|
- Fix: ノート詳細ページにおいてCW付き引用リノートのCWボタンのラベルに「引用」が含まれていない問題を修正
|
||||||
|
- Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正
|
||||||
|
- Fix: ダイレクト投稿の宛先が保存されない問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
||||||
|
@ -42,6 +58,13 @@
|
||||||
- Fix: エンドポイント`notes/translate`のエラーを改善
|
- Fix: エンドポイント`notes/translate`のエラーを改善
|
||||||
- Fix: CleanRemoteFilesProcessorService report progress from 100% (#13632)
|
- Fix: CleanRemoteFilesProcessorService report progress from 100% (#13632)
|
||||||
- Fix: 一部の音声ファイルが映像ファイルとして扱われる問題を修正
|
- Fix: 一部の音声ファイルが映像ファイルとして扱われる問題を修正
|
||||||
|
- Fix: リプライのみの引用リノートと、CWのみの引用リノートが純粋なリノートとして誤って扱われてしまう問題を修正
|
||||||
|
- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように
|
||||||
|
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
|
||||||
|
- Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正
|
||||||
|
- Fix: 一部のタイムラインのストリーミングでインスタンスミュートが効かない問題を修正
|
||||||
|
- Fix: グローバルタイムラインで返信が表示されないことがある問題を修正
|
||||||
|
- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
|
||||||
|
|
||||||
## 2024.3.1
|
## 2024.3.1
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,13 @@ Cypress.Commands.add('visitHome', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add('resetState', () => {
|
Cypress.Commands.add('resetState', () => {
|
||||||
|
// iframe.contentWindow.indexedDB.deleteDatabase() がchromeのバグで使用できないため、indexedDBを無効化している。
|
||||||
|
// see https://github.com/misskey-dev/misskey/issues/13605#issuecomment-2053652123
|
||||||
|
/*
|
||||||
cy.window().then(win => {
|
cy.window().then(win => {
|
||||||
win.indexedDB.deleteDatabase('keyval-store');
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
cy.request('POST', '/api/reset-db', {}).as('reset');
|
cy.request('POST', '/api/reset-db', {}).as('reset');
|
||||||
cy.get('@reset').its('status').should('equal', 204);
|
cy.get('@reset').its('status').should('equal', 204);
|
||||||
cy.reload(true);
|
cy.reload(true);
|
||||||
|
|
|
@ -4936,6 +4936,22 @@ export interface Locale extends ILocale {
|
||||||
* 動画・音声の再生にブラウザのUIを使用する
|
* 動画・音声の再生にブラウザのUIを使用する
|
||||||
*/
|
*/
|
||||||
"useNativeUIForVideoAudioPlayer": string;
|
"useNativeUIForVideoAudioPlayer": string;
|
||||||
|
/**
|
||||||
|
* オリジナルのファイル名を保持
|
||||||
|
*/
|
||||||
|
"keepOriginalFilename": string;
|
||||||
|
/**
|
||||||
|
* この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。
|
||||||
|
*/
|
||||||
|
"keepOriginalFilenameDescription": string;
|
||||||
|
/**
|
||||||
|
* 説明文はありません
|
||||||
|
*/
|
||||||
|
"noDescription": string;
|
||||||
|
/**
|
||||||
|
* フォローの際常に確認する
|
||||||
|
*/
|
||||||
|
"alwaysConfirmFollow": string;
|
||||||
/**
|
/**
|
||||||
* チュートリアルをスキップできないようにする
|
* チュートリアルをスキップできないようにする
|
||||||
*/
|
*/
|
||||||
|
@ -6622,6 +6638,26 @@ export interface Locale extends ILocale {
|
||||||
* リモートユーザー
|
* リモートユーザー
|
||||||
*/
|
*/
|
||||||
"isRemote": string;
|
"isRemote": string;
|
||||||
|
/**
|
||||||
|
* 猫ユーザー
|
||||||
|
*/
|
||||||
|
"isCat": string;
|
||||||
|
/**
|
||||||
|
* botユーザー
|
||||||
|
*/
|
||||||
|
"isBot": string;
|
||||||
|
/**
|
||||||
|
* サスペンド済みユーザー
|
||||||
|
*/
|
||||||
|
"isSuspended": string;
|
||||||
|
/**
|
||||||
|
* 鍵アカウントユーザー
|
||||||
|
*/
|
||||||
|
"isLocked": string;
|
||||||
|
/**
|
||||||
|
* 「アカウントを見つけやすくする」が有効なユーザー
|
||||||
|
*/
|
||||||
|
"isExplorable": string;
|
||||||
/**
|
/**
|
||||||
* アカウント作成から~以内
|
* アカウント作成から~以内
|
||||||
*/
|
*/
|
||||||
|
@ -7691,6 +7727,10 @@ export interface Locale extends ILocale {
|
||||||
* バックアップコードが全て使用されました。認証アプリを利用できない場合、これ以上アカウントにアクセスできなくなります。認証アプリを再登録してください。
|
* バックアップコードが全て使用されました。認証アプリを利用できない場合、これ以上アカウントにアクセスできなくなります。認証アプリを再登録してください。
|
||||||
*/
|
*/
|
||||||
"backupCodesExhaustedWarning": string;
|
"backupCodesExhaustedWarning": string;
|
||||||
|
/**
|
||||||
|
* 詳細なガイドはこちら
|
||||||
|
*/
|
||||||
|
"moreDetailedGuideHere": string;
|
||||||
};
|
};
|
||||||
"_permissions": {
|
"_permissions": {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1230,6 +1230,10 @@ useTotp: "ワンタイムパスワードを使う"
|
||||||
useBackupCode: "バックアップコードを使う"
|
useBackupCode: "バックアップコードを使う"
|
||||||
launchApp: "アプリを起動"
|
launchApp: "アプリを起動"
|
||||||
useNativeUIForVideoAudioPlayer: "動画・音声の再生にブラウザのUIを使用する"
|
useNativeUIForVideoAudioPlayer: "動画・音声の再生にブラウザのUIを使用する"
|
||||||
|
keepOriginalFilename: "オリジナルのファイル名を保持"
|
||||||
|
keepOriginalFilenameDescription: "この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。"
|
||||||
|
noDescription: "説明文はありません"
|
||||||
|
alwaysConfirmFollow: "フォローの際常に確認する"
|
||||||
prohibitSkippingInitialTutorial: "チュートリアルをスキップできないようにする"
|
prohibitSkippingInitialTutorial: "チュートリアルをスキップできないようにする"
|
||||||
prohibitSkippingInitialTutorialDescription: "新規登録したユーザーに表示されるチュートリアルをスキップできないようにします。チュートリアルを完了しなかったりチュートリアルページを回避したりした場合でも、強制的にリダイレクトされます。"
|
prohibitSkippingInitialTutorialDescription: "新規登録したユーザーに表示されるチュートリアルをスキップできないようにします。チュートリアルを完了しなかったりチュートリアルページを回避したりした場合でも、強制的にリダイレクトされます。"
|
||||||
|
|
||||||
|
@ -1711,6 +1715,11 @@ _role:
|
||||||
roleAssignedTo: "マニュアルロールにアサイン済み"
|
roleAssignedTo: "マニュアルロールにアサイン済み"
|
||||||
isLocal: "ローカルユーザー"
|
isLocal: "ローカルユーザー"
|
||||||
isRemote: "リモートユーザー"
|
isRemote: "リモートユーザー"
|
||||||
|
isCat: "猫ユーザー"
|
||||||
|
isBot: "botユーザー"
|
||||||
|
isSuspended: "サスペンド済みユーザー"
|
||||||
|
isLocked: "鍵アカウントユーザー"
|
||||||
|
isExplorable: "「アカウントを見つけやすくする」が有効なユーザー"
|
||||||
createdLessThan: "アカウント作成から~以内"
|
createdLessThan: "アカウント作成から~以内"
|
||||||
createdMoreThan: "アカウント作成から~経過"
|
createdMoreThan: "アカウント作成から~経過"
|
||||||
followersLessThanOrEq: "フォロワー数が~以下"
|
followersLessThanOrEq: "フォロワー数が~以下"
|
||||||
|
@ -2021,6 +2030,7 @@ _2fa:
|
||||||
backupCodesDescription: "認証アプリが使用できなくなった場合、以下のバックアップコードを使ってアカウントにアクセスできます。これらのコードは必ず安全な場所に保管してください。各コードは一回だけ使用できます。"
|
backupCodesDescription: "認証アプリが使用できなくなった場合、以下のバックアップコードを使ってアカウントにアクセスできます。これらのコードは必ず安全な場所に保管してください。各コードは一回だけ使用できます。"
|
||||||
backupCodeUsedWarning: "バックアップコードが使用されました。認証アプリが使えなくなっている場合、なるべく早く認証アプリを再設定してください。"
|
backupCodeUsedWarning: "バックアップコードが使用されました。認証アプリが使えなくなっている場合、なるべく早く認証アプリを再設定してください。"
|
||||||
backupCodesExhaustedWarning: "バックアップコードが全て使用されました。認証アプリを利用できない場合、これ以上アカウントにアクセスできなくなります。認証アプリを再登録してください。"
|
backupCodesExhaustedWarning: "バックアップコードが全て使用されました。認証アプリを利用できない場合、これ以上アカウントにアクセスできなくなります。認証アプリを再登録してください。"
|
||||||
|
moreDetailedGuideHere: "詳細なガイドはこちら"
|
||||||
|
|
||||||
_permissions:
|
_permissions:
|
||||||
"read:account": "アカウントの情報を見る"
|
"read:account": "アカウントの情報を見る"
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<redoc spec-url="/api.json" expand-responses="200" expand-single-schema-field="true"></redoc>
|
<redoc spec-url="/api.json" expand-responses="200" expand-single-schema-field="true"></redoc>
|
||||||
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
|
<script src="https://cdn.redoc.ly/redoc/v2.1.3/bundles/redoc.standalone.js" integrity="sha256-u4DgqzYXoArvNF/Ymw3puKexfOC6lYfw0sfmeliBJ1I=" crossorigin="anonymous"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
"start:test": "cross-env NODE_ENV=test node ./built/boot/entry.js",
|
"start:test": "cross-env NODE_ENV=test node ./built/boot/entry.js",
|
||||||
"migrate": "pnpm typeorm migration:run -d ormconfig.js",
|
"migrate": "pnpm typeorm migration:run -d ormconfig.js",
|
||||||
"revert": "pnpm typeorm migration:revert -d ormconfig.js",
|
"revert": "pnpm typeorm migration:revert -d ormconfig.js",
|
||||||
"check:connect": "node ./check_connect.js",
|
"check:connect": "node ./scripts/check_connect.js",
|
||||||
"build": "swc src -d built -D",
|
"build": "swc src -d built -D",
|
||||||
"build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc",
|
"build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc",
|
||||||
"watch:swc": "swc src -d built -D -w",
|
"watch:swc": "swc src -d built -D -w",
|
||||||
"build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
|
"build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
|
||||||
"watch": "node watch.mjs",
|
"watch": "node ./scripts/watch.mjs",
|
||||||
"restart": "pnpm build && pnpm start",
|
"restart": "pnpm build && pnpm start",
|
||||||
"dev": "nodemon -w src -e ts,js,mjs,cjs,json --exec \"cross-env NODE_ENV=development pnpm run restart\"",
|
"dev": "node ./scripts/dev.mjs",
|
||||||
"typecheck": "tsc --noEmit && tsc -p test --noEmit",
|
"typecheck": "tsc --noEmit && tsc -p test --noEmit",
|
||||||
"eslint": "eslint --quiet \"src/**/*.ts\"",
|
"eslint": "eslint --quiet \"src/**/*.ts\"",
|
||||||
"lint": "pnpm typecheck && pnpm eslint",
|
"lint": "pnpm typecheck && pnpm eslint",
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
"test:e2e": "pnpm build && pnpm build:test && pnpm jest:e2e",
|
"test:e2e": "pnpm build && pnpm build:test && pnpm jest:e2e",
|
||||||
"test-and-coverage": "pnpm jest-and-coverage",
|
"test-and-coverage": "pnpm jest-and-coverage",
|
||||||
"test-and-coverage:e2e": "pnpm build && pnpm build:test && pnpm jest-and-coverage:e2e",
|
"test-and-coverage:e2e": "pnpm build && pnpm build:test && pnpm jest-and-coverage:e2e",
|
||||||
"generate-api-json": "pnpm build && node ./generate_api_json.js"
|
"generate-api-json": "pnpm build && node ./scripts/generate_api_json.js"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@swc/core-android-arm64": "1.3.11",
|
"@swc/core-android-arm64": "1.3.11",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Redis from 'ioredis';
|
import Redis from 'ioredis';
|
||||||
import { loadConfig } from './built/config.js';
|
import { loadConfig } from '../built/config.js';
|
||||||
|
|
||||||
const config = loadConfig();
|
const config = loadConfig();
|
||||||
const redis = new Redis(config.redis);
|
const redis = new Redis(config.redis);
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { execa, execaNode } from 'execa';
|
||||||
|
|
||||||
|
/** @type {import('execa').ExecaChildProcess | undefined} */
|
||||||
|
let backendProcess;
|
||||||
|
|
||||||
|
async function execBuildAssets() {
|
||||||
|
await execa('pnpm', ['run', 'build-assets'], {
|
||||||
|
cwd: '../../',
|
||||||
|
stdout: process.stdout,
|
||||||
|
stderr: process.stderr,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function execStart() {
|
||||||
|
// pnpm run start を呼び出したいが、windowsだとプロセスグループ単位でのkillが出来ずゾンビプロセス化するので
|
||||||
|
// 上記と同等の動きをするコマンドで子・孫プロセスを作らないようにしたい
|
||||||
|
backendProcess = execaNode('./built/boot/entry.js', [], {
|
||||||
|
stdout: process.stdout,
|
||||||
|
stderr: process.stderr,
|
||||||
|
env: {
|
||||||
|
'NODE_ENV': 'development',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function killProc() {
|
||||||
|
if (backendProcess) {
|
||||||
|
backendProcess.kill();
|
||||||
|
await new Promise(resolve => backendProcess.on('exit', resolve));
|
||||||
|
backendProcess = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
execaNode(
|
||||||
|
'./node_modules/nodemon/bin/nodemon.js',
|
||||||
|
[
|
||||||
|
'-w', 'src',
|
||||||
|
'-e', 'ts,js,mjs,cjs,json',
|
||||||
|
'--exec', 'pnpm', 'run', 'build',
|
||||||
|
],
|
||||||
|
{
|
||||||
|
stdio: [process.stdin, process.stdout, process.stderr, 'ipc'],
|
||||||
|
})
|
||||||
|
.on('message', async (message) => {
|
||||||
|
if (message.type === 'exit') {
|
||||||
|
// かならずbuild->build-assetsの順番で呼び出したいので、
|
||||||
|
// 少々トリッキーだがnodemonからのexitイベントを利用してbuild-assets->startを行う。
|
||||||
|
// pnpm restartをbuildが終わる前にbuild-assetsが動いてしまうので、バラバラに呼び出す必要がある
|
||||||
|
|
||||||
|
await killProc();
|
||||||
|
await execBuildAssets();
|
||||||
|
execStart();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})();
|
|
@ -3,8 +3,8 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { loadConfig } from './built/config.js'
|
import { loadConfig } from '../built/config.js'
|
||||||
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
|
import { genOpenapiSpec } from '../built/server/api/openapi/gen-spec.js'
|
||||||
import { writeFileSync } from "node:fs";
|
import { writeFileSync } from "node:fs";
|
||||||
|
|
||||||
const config = loadConfig();
|
const config = loadConfig();
|
|
@ -305,7 +305,7 @@ export class AccountMoveService {
|
||||||
let resultUser: MiLocalUser | MiRemoteUser | null = null;
|
let resultUser: MiLocalUser | MiRemoteUser | null = null;
|
||||||
|
|
||||||
if (this.userEntityService.isRemoteUser(dst)) {
|
if (this.userEntityService.isRemoteUser(dst)) {
|
||||||
if ((new Date()).getTime() - (dst.lastFetchedAt?.getTime() ?? 0) > 10 * 1000) {
|
if (Date.now() - (dst.lastFetchedAt?.getTime() ?? 0) > 10 * 1000) {
|
||||||
await this.apPersonService.updatePerson(dst.uri);
|
await this.apPersonService.updatePerson(dst.uri);
|
||||||
}
|
}
|
||||||
dst = await this.apPersonService.fetchPerson(dst.uri) ?? dst;
|
dst = await this.apPersonService.fetchPerson(dst.uri) ?? dst;
|
||||||
|
@ -321,7 +321,7 @@ export class AccountMoveService {
|
||||||
if (!src) continue; // oldAccountを探してもこのサーバーに存在しない場合はフォロー関係もないということなのでスルー
|
if (!src) continue; // oldAccountを探してもこのサーバーに存在しない場合はフォロー関係もないということなのでスルー
|
||||||
|
|
||||||
if (this.userEntityService.isRemoteUser(dst)) {
|
if (this.userEntityService.isRemoteUser(dst)) {
|
||||||
if ((new Date()).getTime() - (src.lastFetchedAt?.getTime() ?? 0) > 10 * 1000) {
|
if (Date.now() - (src.lastFetchedAt?.getTime() ?? 0) > 10 * 1000) {
|
||||||
await this.apPersonService.updatePerson(srcUri);
|
await this.apPersonService.updatePerson(srcUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type { NotesRepository } from '@/models/_.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { FanoutTimelineName, FanoutTimelineService } from '@/core/FanoutTimelineService.js';
|
import { FanoutTimelineName, FanoutTimelineService } from '@/core/FanoutTimelineService.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
import { isQuote, isRenote } from '@/misc/is-renote.js';
|
||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
import { isReply } from '@/misc/is-reply.js';
|
import { isReply } from '@/misc/is-reply.js';
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||||
|
@ -95,7 +95,7 @@ export class FanoutTimelineEndpointService {
|
||||||
|
|
||||||
if (ps.excludePureRenotes) {
|
if (ps.excludePureRenotes) {
|
||||||
const parentFilter = filter;
|
const parentFilter = filter;
|
||||||
filter = (note) => !isPureRenote(note) && parentFilter(note);
|
filter = (note) => (!isRenote(note) || isQuote(note)) && parentFilter(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.me) {
|
if (ps.me) {
|
||||||
|
@ -116,7 +116,7 @@ export class FanoutTimelineEndpointService {
|
||||||
filter = (note) => {
|
filter = (note) => {
|
||||||
if (isUserRelated(note, userIdsWhoBlockingMe, ps.ignoreAuthorFromBlock)) return false;
|
if (isUserRelated(note, userIdsWhoBlockingMe, ps.ignoreAuthorFromBlock)) return false;
|
||||||
if (isUserRelated(note, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
|
if (isUserRelated(note, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
|
||||||
if (isPureRenote(note) && isUserRelated(note, userIdsWhoMeMutingRenotes, ps.ignoreAuthorFromMute)) return false;
|
if (!ps.ignoreAuthorFromMute && isRenote(note) && !isQuote(note) && userIdsWhoMeMutingRenotes.has(note.userId)) return false;
|
||||||
if (isInstanceMuted(note, userMutedInstances)) return false;
|
if (isInstanceMuted(note, userMutedInstances)) return false;
|
||||||
|
|
||||||
return parentFilter(note);
|
return parentFilter(note);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { Window } from 'happy-dom';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import { intersperse } from '@/misc/prelude/array.js';
|
import { intersperse } from '@/misc/prelude/array.js';
|
||||||
|
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js';
|
import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js';
|
||||||
|
@ -33,6 +34,8 @@ export class MfmService {
|
||||||
// some AP servers like Pixelfed use br tags as well as newlines
|
// some AP servers like Pixelfed use br tags as well as newlines
|
||||||
html = html.replace(/<br\s?\/?>\r?\n/gi, '\n');
|
html = html.replace(/<br\s?\/?>\r?\n/gi, '\n');
|
||||||
|
|
||||||
|
const normalizedHashtagNames = hashtagNames == null ? undefined : new Set<string>(hashtagNames.map(x => normalizeForSearch(x)));
|
||||||
|
|
||||||
const dom = parse5.parseFragment(html);
|
const dom = parse5.parseFragment(html);
|
||||||
|
|
||||||
let text = '';
|
let text = '';
|
||||||
|
@ -85,7 +88,7 @@ export class MfmService {
|
||||||
const href = node.attrs.find(x => x.name === 'href');
|
const href = node.attrs.find(x => x.name === 'href');
|
||||||
|
|
||||||
// ハッシュタグ
|
// ハッシュタグ
|
||||||
if (hashtagNames && href && hashtagNames.map(x => x.toLowerCase()).includes(txt.toLowerCase())) {
|
if (normalizedHashtagNames && href && normalizedHashtagNames.has(normalizeForSearch(txt))) {
|
||||||
text += txt;
|
text += txt;
|
||||||
// メンション
|
// メンション
|
||||||
} else if (txt.startsWith('@') && !(rel && rel.value.startsWith('me '))) {
|
} else if (txt.startsWith('@') && !(rel && rel.value.startsWith('me '))) {
|
||||||
|
|
|
@ -306,7 +306,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check blocking
|
// Check blocking
|
||||||
if (data.renote && !this.isQuote(data)) {
|
if (this.isRenote(data) && !this.isQuote(data)) {
|
||||||
if (data.renote.userHost === null) {
|
if (data.renote.userHost === null) {
|
||||||
if (data.renote.userId !== user.id) {
|
if (data.renote.userId !== user.id) {
|
||||||
const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id);
|
const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id);
|
||||||
|
@ -641,7 +641,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it is renote
|
// If it is renote
|
||||||
if (data.renote) {
|
if (this.isRenote(data)) {
|
||||||
const type = this.isQuote(data) ? 'quote' : 'renote';
|
const type = this.isQuote(data) ? 'quote' : 'renote';
|
||||||
|
|
||||||
// Notify
|
// Notify
|
||||||
|
@ -725,9 +725,20 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private isQuote(note: Option): note is Option & { renote: MiNote } {
|
private isRenote(note: Option): note is Option & { renote: MiNote } {
|
||||||
// sync with misc/is-quote.ts
|
return note.renote != null;
|
||||||
return !!note.renote && (!!note.text || !!note.cw || (!!note.files && !!note.files.length) || !!note.poll);
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
private isQuote(note: Option & { renote: MiNote }): note is Option & { renote: MiNote } & (
|
||||||
|
{ text: string } | { cw: string } | { reply: MiNote } | { poll: IPoll } | { files: MiDriveFile[] }
|
||||||
|
) {
|
||||||
|
// NOTE: SYNC WITH misc/is-quote.ts
|
||||||
|
return note.text != null ||
|
||||||
|
note.reply != null ||
|
||||||
|
note.cw != null ||
|
||||||
|
note.poll != null ||
|
||||||
|
(note.files != null && note.files.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -795,7 +806,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
private async renderNoteOrRenoteActivity(data: Option, note: MiNote) {
|
private async renderNoteOrRenoteActivity(data: Option, note: MiNote) {
|
||||||
if (data.localOnly) return null;
|
if (data.localOnly) return null;
|
||||||
|
|
||||||
const content = data.renote && !this.isQuote(data)
|
const content = this.isRenote(data) && !this.isQuote(data)
|
||||||
? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.url}/notes/${data.renote.id}`, note)
|
? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.url}/notes/${data.renote.id}`, note)
|
||||||
: this.apRendererService.renderCreate(await this.apRendererService.renderNote(note, false), note);
|
: this.apRendererService.renderCreate(await this.apRendererService.renderNote(note, false), note);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { SearchService } from '@/core/SearchService.js';
|
import { SearchService } from '@/core/SearchService.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
import { isQuote, isRenote } from '@/misc/is-renote.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NoteDeleteService {
|
export class NoteDeleteService {
|
||||||
|
@ -79,7 +79,7 @@ export class NoteDeleteService {
|
||||||
let renote: MiNote | null = null;
|
let renote: MiNote | null = null;
|
||||||
|
|
||||||
// if deleted note is renote
|
// if deleted note is renote
|
||||||
if (isPureRenote(note)) {
|
if (isRenote(note) && !isQuote(note)) {
|
||||||
renote = await this.notesRepository.findOneBy({
|
renote = await this.notesRepository.findOneBy({
|
||||||
id: note.renoteId,
|
id: note.renoteId,
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,7 +101,7 @@ export class PushNotificationService implements OnApplicationShutdown {
|
||||||
type,
|
type,
|
||||||
body: (type === 'notification' || type === 'unreadAntennaNote') ? truncateBody(type, body) : body,
|
body: (type === 'notification' || type === 'unreadAntennaNote') ? truncateBody(type, body) : body,
|
||||||
userId,
|
userId,
|
||||||
dateTime: (new Date()).getTime(),
|
dateTime: Date.now(),
|
||||||
}), {
|
}), {
|
||||||
proxy: this.config.proxy,
|
proxy: this.config.proxy,
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
|
|
|
@ -205,45 +205,79 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||||
private evalCond(user: MiUser, roles: MiRole[], value: RoleCondFormulaValue): boolean {
|
private evalCond(user: MiUser, roles: MiRole[], value: RoleCondFormulaValue): boolean {
|
||||||
try {
|
try {
|
||||||
switch (value.type) {
|
switch (value.type) {
|
||||||
|
// ~かつ~
|
||||||
case 'and': {
|
case 'and': {
|
||||||
return value.values.every(v => this.evalCond(user, roles, v));
|
return value.values.every(v => this.evalCond(user, roles, v));
|
||||||
}
|
}
|
||||||
|
// ~または~
|
||||||
case 'or': {
|
case 'or': {
|
||||||
return value.values.some(v => this.evalCond(user, roles, v));
|
return value.values.some(v => this.evalCond(user, roles, v));
|
||||||
}
|
}
|
||||||
|
// ~ではない
|
||||||
case 'not': {
|
case 'not': {
|
||||||
return !this.evalCond(user, roles, value.value);
|
return !this.evalCond(user, roles, value.value);
|
||||||
}
|
}
|
||||||
|
// マニュアルロールがアサインされている
|
||||||
case 'roleAssignedTo': {
|
case 'roleAssignedTo': {
|
||||||
return roles.some(r => r.id === value.roleId);
|
return roles.some(r => r.id === value.roleId);
|
||||||
}
|
}
|
||||||
|
// ローカルユーザのみ
|
||||||
case 'isLocal': {
|
case 'isLocal': {
|
||||||
return this.userEntityService.isLocalUser(user);
|
return this.userEntityService.isLocalUser(user);
|
||||||
}
|
}
|
||||||
|
// リモートユーザのみ
|
||||||
case 'isRemote': {
|
case 'isRemote': {
|
||||||
return this.userEntityService.isRemoteUser(user);
|
return this.userEntityService.isRemoteUser(user);
|
||||||
}
|
}
|
||||||
|
// サスペンド済みユーザである
|
||||||
|
case 'isSuspended': {
|
||||||
|
return user.isSuspended;
|
||||||
|
}
|
||||||
|
// 鍵アカウントユーザである
|
||||||
|
case 'isLocked': {
|
||||||
|
return user.isLocked;
|
||||||
|
}
|
||||||
|
// botユーザである
|
||||||
|
case 'isBot': {
|
||||||
|
return user.isBot;
|
||||||
|
}
|
||||||
|
// 猫である
|
||||||
|
case 'isCat': {
|
||||||
|
return user.isCat;
|
||||||
|
}
|
||||||
|
// 「ユーザを見つけやすくする」が有効なアカウント
|
||||||
|
case 'isExplorable': {
|
||||||
|
return user.isExplorable;
|
||||||
|
}
|
||||||
|
// ユーザが作成されてから指定期間経過した
|
||||||
case 'createdLessThan': {
|
case 'createdLessThan': {
|
||||||
return this.idService.parse(user.id).date.getTime() > (Date.now() - (value.sec * 1000));
|
return this.idService.parse(user.id).date.getTime() > (Date.now() - (value.sec * 1000));
|
||||||
}
|
}
|
||||||
|
// ユーザが作成されてから指定期間経っていない
|
||||||
case 'createdMoreThan': {
|
case 'createdMoreThan': {
|
||||||
return this.idService.parse(user.id).date.getTime() < (Date.now() - (value.sec * 1000));
|
return this.idService.parse(user.id).date.getTime() < (Date.now() - (value.sec * 1000));
|
||||||
}
|
}
|
||||||
|
// フォロワー数が指定値以下
|
||||||
case 'followersLessThanOrEq': {
|
case 'followersLessThanOrEq': {
|
||||||
return user.followersCount <= value.value;
|
return user.followersCount <= value.value;
|
||||||
}
|
}
|
||||||
|
// フォロワー数が指定値以上
|
||||||
case 'followersMoreThanOrEq': {
|
case 'followersMoreThanOrEq': {
|
||||||
return user.followersCount >= value.value;
|
return user.followersCount >= value.value;
|
||||||
}
|
}
|
||||||
|
// フォロー数が指定値以下
|
||||||
case 'followingLessThanOrEq': {
|
case 'followingLessThanOrEq': {
|
||||||
return user.followingCount <= value.value;
|
return user.followingCount <= value.value;
|
||||||
}
|
}
|
||||||
|
// フォロー数が指定値以上
|
||||||
case 'followingMoreThanOrEq': {
|
case 'followingMoreThanOrEq': {
|
||||||
return user.followingCount >= value.value;
|
return user.followingCount >= value.value;
|
||||||
}
|
}
|
||||||
|
// ノート数が指定値以下
|
||||||
case 'notesLessThanOrEq': {
|
case 'notesLessThanOrEq': {
|
||||||
return user.notesCount <= value.value;
|
return user.notesCount <= value.value;
|
||||||
}
|
}
|
||||||
|
// ノート数が指定値以上
|
||||||
case 'notesMoreThanOrEq': {
|
case 'notesMoreThanOrEq': {
|
||||||
return user.notesCount >= value.value;
|
return user.notesCount >= value.value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { ClipFavoritesRepository, ClipsRepository, MiUser } from '@/models/_.js';
|
import type { ClipNotesRepository, ClipFavoritesRepository, ClipsRepository, MiUser } from '@/models/_.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import type { } from '@/models/Blocking.js';
|
import type { } from '@/models/Blocking.js';
|
||||||
|
@ -20,6 +20,9 @@ export class ClipEntityService {
|
||||||
@Inject(DI.clipsRepository)
|
@Inject(DI.clipsRepository)
|
||||||
private clipsRepository: ClipsRepository,
|
private clipsRepository: ClipsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.clipNotesRepository)
|
||||||
|
private clipNotesRepository: ClipNotesRepository,
|
||||||
|
|
||||||
@Inject(DI.clipFavoritesRepository)
|
@Inject(DI.clipFavoritesRepository)
|
||||||
private clipFavoritesRepository: ClipFavoritesRepository,
|
private clipFavoritesRepository: ClipFavoritesRepository,
|
||||||
|
|
||||||
|
@ -47,6 +50,7 @@ export class ClipEntityService {
|
||||||
isPublic: clip.isPublic,
|
isPublic: clip.isPublic,
|
||||||
favoritedCount: await this.clipFavoritesRepository.countBy({ clipId: clip.id }),
|
favoritedCount: await this.clipFavoritesRepository.countBy({ clipId: clip.id }),
|
||||||
isFavorited: meId ? await this.clipFavoritesRepository.exists({ where: { clipId: clip.id, userId: meId } }) : undefined,
|
isFavorited: meId ? await this.clipFavoritesRepository.exists({ where: { clipId: clip.id, userId: meId } }) : undefined,
|
||||||
|
notesCount: meId ? await this.clipNotesRepository.countBy({ clipId: clip.id }) : undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type { MiNote } from '@/models/Note.js';
|
|
||||||
|
|
||||||
export function isPureRenote(note: MiNote): note is MiNote & { renoteId: NonNullable<MiNote['renoteId']> } {
|
|
||||||
if (!note.renoteId) return false;
|
|
||||||
|
|
||||||
if (note.text) return false; // it's quoted with text
|
|
||||||
if (note.fileIds.length !== 0) return false; // it's quoted with files
|
|
||||||
if (note.hasPoll) return false; // it's quoted with poll
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type { MiNote } from '@/models/Note.js';
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default function(note: MiNote): boolean {
|
|
||||||
// sync with NoteCreateService.isQuote
|
|
||||||
return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0));
|
|
||||||
}
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { MiNote } from '@/models/Note.js';
|
||||||
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
|
|
||||||
|
type Renote =
|
||||||
|
MiNote & {
|
||||||
|
renoteId: NonNullable<MiNote['renoteId']>
|
||||||
|
};
|
||||||
|
|
||||||
|
type Quote =
|
||||||
|
Renote & ({
|
||||||
|
text: NonNullable<MiNote['text']>
|
||||||
|
} | {
|
||||||
|
cw: NonNullable<MiNote['cw']>
|
||||||
|
} | {
|
||||||
|
replyId: NonNullable<MiNote['replyId']>
|
||||||
|
reply: NonNullable<MiNote['reply']>
|
||||||
|
} | {
|
||||||
|
hasPoll: true
|
||||||
|
});
|
||||||
|
|
||||||
|
export function isRenote(note: MiNote): note is Renote {
|
||||||
|
return note.renoteId != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isQuote(note: Renote): note is Quote {
|
||||||
|
// NOTE: SYNC WITH NoteCreateService.isQuote
|
||||||
|
return note.text != null ||
|
||||||
|
note.cw != null ||
|
||||||
|
note.replyId != null ||
|
||||||
|
note.hasPoll ||
|
||||||
|
note.fileIds.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
type PackedRenote =
|
||||||
|
Packed<'Note'> & {
|
||||||
|
renoteId: NonNullable<Packed<'Note'>['renoteId']>
|
||||||
|
};
|
||||||
|
|
||||||
|
type PackedQuote =
|
||||||
|
PackedRenote & ({
|
||||||
|
text: NonNullable<Packed<'Note'>['text']>
|
||||||
|
} | {
|
||||||
|
cw: NonNullable<Packed<'Note'>['cw']>
|
||||||
|
} | {
|
||||||
|
replyId: NonNullable<Packed<'Note'>['replyId']>
|
||||||
|
} | {
|
||||||
|
poll: NonNullable<Packed<'Note'>['poll']>
|
||||||
|
} | {
|
||||||
|
fileIds: NonNullable<Packed<'Note'>['fileIds']>
|
||||||
|
});
|
||||||
|
|
||||||
|
export function isRenotePacked(note: Packed<'Note'>): note is PackedRenote {
|
||||||
|
return note.renoteId != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isQuotePacked(note: PackedRenote): note is PackedQuote {
|
||||||
|
return note.text != null ||
|
||||||
|
note.cw != null ||
|
||||||
|
note.replyId != null ||
|
||||||
|
note.poll != null ||
|
||||||
|
(note.fileIds != null && note.fileIds.length > 0);
|
||||||
|
}
|
|
@ -48,6 +48,7 @@ import {
|
||||||
packedRoleCondFormulaValueCreatedSchema,
|
packedRoleCondFormulaValueCreatedSchema,
|
||||||
packedRoleCondFormulaFollowersOrFollowingOrNotesSchema,
|
packedRoleCondFormulaFollowersOrFollowingOrNotesSchema,
|
||||||
packedRoleCondFormulaValueSchema,
|
packedRoleCondFormulaValueSchema,
|
||||||
|
packedRoleCondFormulaValueUserSettingBooleanSchema,
|
||||||
} from '@/models/json-schema/role.js';
|
} from '@/models/json-schema/role.js';
|
||||||
import { packedAdSchema } from '@/models/json-schema/ad.js';
|
import { packedAdSchema } from '@/models/json-schema/ad.js';
|
||||||
import { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js';
|
import { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js';
|
||||||
|
@ -97,6 +98,7 @@ export const refs = {
|
||||||
RoleCondFormulaLogics: packedRoleCondFormulaLogicsSchema,
|
RoleCondFormulaLogics: packedRoleCondFormulaLogicsSchema,
|
||||||
RoleCondFormulaValueNot: packedRoleCondFormulaValueNot,
|
RoleCondFormulaValueNot: packedRoleCondFormulaValueNot,
|
||||||
RoleCondFormulaValueIsLocalOrRemote: packedRoleCondFormulaValueIsLocalOrRemoteSchema,
|
RoleCondFormulaValueIsLocalOrRemote: packedRoleCondFormulaValueIsLocalOrRemoteSchema,
|
||||||
|
RoleCondFormulaValueUserSettingBooleanSchema: packedRoleCondFormulaValueUserSettingBooleanSchema,
|
||||||
RoleCondFormulaValueAssignedRole: packedRoleCondFormulaValueAssignedRoleSchema,
|
RoleCondFormulaValueAssignedRole: packedRoleCondFormulaValueAssignedRoleSchema,
|
||||||
RoleCondFormulaValueCreated: packedRoleCondFormulaValueCreatedSchema,
|
RoleCondFormulaValueCreated: packedRoleCondFormulaValueCreatedSchema,
|
||||||
RoleCondFormulaFollowersOrFollowingOrNotes: packedRoleCondFormulaFollowersOrFollowingOrNotesSchema,
|
RoleCondFormulaFollowersOrFollowingOrNotes: packedRoleCondFormulaFollowersOrFollowingOrNotesSchema,
|
||||||
|
|
|
@ -6,69 +6,149 @@
|
||||||
import { Entity, Column, PrimaryColumn } from 'typeorm';
|
import { Entity, Column, PrimaryColumn } from 'typeorm';
|
||||||
import { id } from './util/id.js';
|
import { id } from './util/id.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ~かつ~
|
||||||
|
* 複数の条件を同時に満たす場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueAnd = {
|
type CondFormulaValueAnd = {
|
||||||
type: 'and';
|
type: 'and';
|
||||||
values: RoleCondFormulaValue[];
|
values: RoleCondFormulaValue[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ~または~
|
||||||
|
* 複数の条件のうち、いずれかを満たす場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueOr = {
|
type CondFormulaValueOr = {
|
||||||
type: 'or';
|
type: 'or';
|
||||||
values: RoleCondFormulaValue[];
|
values: RoleCondFormulaValue[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ~ではない
|
||||||
|
* 条件を満たさない場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueNot = {
|
type CondFormulaValueNot = {
|
||||||
type: 'not';
|
type: 'not';
|
||||||
value: RoleCondFormulaValue;
|
value: RoleCondFormulaValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ローカルユーザーのみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueIsLocal = {
|
type CondFormulaValueIsLocal = {
|
||||||
type: 'isLocal';
|
type: 'isLocal';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* リモートユーザーのみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueIsRemote = {
|
type CondFormulaValueIsRemote = {
|
||||||
type: 'isRemote';
|
type: 'isRemote';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 既に指定のマニュアルロールにアサインされている場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueRoleAssignedTo = {
|
type CondFormulaValueRoleAssignedTo = {
|
||||||
type: 'roleAssignedTo';
|
type: 'roleAssignedTo';
|
||||||
roleId: string;
|
roleId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* サスペンド済みアカウントの場合のみ成立とする
|
||||||
|
*/
|
||||||
|
type CondFormulaValueIsSuspended = {
|
||||||
|
type: 'isSuspended';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鍵アカウントの場合のみ成立とする
|
||||||
|
*/
|
||||||
|
type CondFormulaValueIsLocked = {
|
||||||
|
type: 'isLocked';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* botアカウントの場合のみ成立とする
|
||||||
|
*/
|
||||||
|
type CondFormulaValueIsBot = {
|
||||||
|
type: 'isBot';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 猫アカウントの場合のみ成立とする
|
||||||
|
*/
|
||||||
|
type CondFormulaValueIsCat = {
|
||||||
|
type: 'isCat';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 「ユーザを見つけやすくする」が有効なアカウントの場合のみ成立とする
|
||||||
|
*/
|
||||||
|
type CondFormulaValueIsExplorable = {
|
||||||
|
type: 'isExplorable';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ユーザが作成されてから指定期間経過した場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueCreatedLessThan = {
|
type CondFormulaValueCreatedLessThan = {
|
||||||
type: 'createdLessThan';
|
type: 'createdLessThan';
|
||||||
sec: number;
|
sec: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ユーザが作成されてから指定期間経っていない場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueCreatedMoreThan = {
|
type CondFormulaValueCreatedMoreThan = {
|
||||||
type: 'createdMoreThan';
|
type: 'createdMoreThan';
|
||||||
sec: number;
|
sec: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* フォロワー数が指定値以下の場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueFollowersLessThanOrEq = {
|
type CondFormulaValueFollowersLessThanOrEq = {
|
||||||
type: 'followersLessThanOrEq';
|
type: 'followersLessThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* フォロワー数が指定値以上の場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueFollowersMoreThanOrEq = {
|
type CondFormulaValueFollowersMoreThanOrEq = {
|
||||||
type: 'followersMoreThanOrEq';
|
type: 'followersMoreThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* フォロー数が指定値以下の場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueFollowingLessThanOrEq = {
|
type CondFormulaValueFollowingLessThanOrEq = {
|
||||||
type: 'followingLessThanOrEq';
|
type: 'followingLessThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* フォロー数が指定値以上の場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueFollowingMoreThanOrEq = {
|
type CondFormulaValueFollowingMoreThanOrEq = {
|
||||||
type: 'followingMoreThanOrEq';
|
type: 'followingMoreThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投稿数が指定値以下の場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueNotesLessThanOrEq = {
|
type CondFormulaValueNotesLessThanOrEq = {
|
||||||
type: 'notesLessThanOrEq';
|
type: 'notesLessThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投稿数が指定値以上の場合のみ成立とする
|
||||||
|
*/
|
||||||
type CondFormulaValueNotesMoreThanOrEq = {
|
type CondFormulaValueNotesMoreThanOrEq = {
|
||||||
type: 'notesMoreThanOrEq';
|
type: 'notesMoreThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
|
@ -80,6 +160,11 @@ export type RoleCondFormulaValue = { id: string } & (
|
||||||
CondFormulaValueNot |
|
CondFormulaValueNot |
|
||||||
CondFormulaValueIsLocal |
|
CondFormulaValueIsLocal |
|
||||||
CondFormulaValueIsRemote |
|
CondFormulaValueIsRemote |
|
||||||
|
CondFormulaValueIsSuspended |
|
||||||
|
CondFormulaValueIsLocked |
|
||||||
|
CondFormulaValueIsBot |
|
||||||
|
CondFormulaValueIsCat |
|
||||||
|
CondFormulaValueIsExplorable |
|
||||||
CondFormulaValueRoleAssignedTo |
|
CondFormulaValueRoleAssignedTo |
|
||||||
CondFormulaValueCreatedLessThan |
|
CondFormulaValueCreatedLessThan |
|
||||||
CondFormulaValueCreatedMoreThan |
|
CondFormulaValueCreatedMoreThan |
|
||||||
|
|
|
@ -52,5 +52,9 @@ export const packedClipSchema = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
optional: true, nullable: false,
|
optional: true, nullable: false,
|
||||||
},
|
},
|
||||||
|
notesCount: {
|
||||||
|
type: 'integer',
|
||||||
|
optional: true, nullable: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
@ -57,6 +57,20 @@ export const packedRoleCondFormulaValueIsLocalOrRemoteSchema = {
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const packedRoleCondFormulaValueUserSettingBooleanSchema = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string', optional: false,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: 'string',
|
||||||
|
nullable: false, optional: false,
|
||||||
|
enum: ['isSuspended', 'isLocked', 'isBot', 'isCat', 'isExplorable'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const packedRoleCondFormulaValueAssignedRoleSchema = {
|
export const packedRoleCondFormulaValueAssignedRoleSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
|
@ -135,6 +149,9 @@ export const packedRoleCondFormulaValueSchema = {
|
||||||
{
|
{
|
||||||
ref: 'RoleCondFormulaValueIsLocalOrRemote',
|
ref: 'RoleCondFormulaValueIsLocalOrRemote',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ref: 'RoleCondFormulaValueUserSettingBooleanSchema',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ref: 'RoleCondFormulaValueAssignedRole',
|
ref: 'RoleCondFormulaValueAssignedRole',
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { IActivity } from '@/core/activitypub/type.js';
|
import { IActivity } from '@/core/activitypub/type.js';
|
||||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
import { isQuote, isRenote } from '@/misc/is-renote.js';
|
||||||
import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions, FastifyBodyParser } from 'fastify';
|
import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions, FastifyBodyParser } from 'fastify';
|
||||||
import type { FindOptionsWhere } from 'typeorm';
|
import type { FindOptionsWhere } from 'typeorm';
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ export class ActivityPubServerService {
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
private async packActivity(note: MiNote): Promise<any> {
|
private async packActivity(note: MiNote): Promise<any> {
|
||||||
if (isPureRenote(note)) {
|
if (isRenote(note) && !isQuote(note)) {
|
||||||
const renote = await this.notesRepository.findOneByOrFail({ id: note.renoteId });
|
const renote = await this.notesRepository.findOneByOrFail({ id: note.renoteId });
|
||||||
return this.apRendererService.renderAnnounce(renote.uri ? renote.uri : `${this.config.url}/notes/${renote.id}`, note);
|
return this.apRendererService.renderAnnounce(renote.uri ? renote.uri : `${this.config.url}/notes/${renote.id}`, note);
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,7 @@ export class FileServerService {
|
||||||
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
|
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
|
||||||
reply.header('Accept-Ranges', 'bytes');
|
reply.header('Accept-Ranges', 'bytes');
|
||||||
reply.header('Content-Length', chunksize);
|
reply.header('Content-Length', chunksize);
|
||||||
|
reply.code(206);
|
||||||
} else {
|
} else {
|
||||||
image = {
|
image = {
|
||||||
data: fs.createReadStream(file.path),
|
data: fs.createReadStream(file.path),
|
||||||
|
@ -213,6 +214,8 @@ export class FileServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream');
|
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream');
|
||||||
|
reply.header('Content-Length', file.file.size);
|
||||||
|
reply.header('Cache-Control', 'max-age=31536000, immutable');
|
||||||
reply.header('Content-Disposition',
|
reply.header('Content-Disposition',
|
||||||
contentDisposition(
|
contentDisposition(
|
||||||
'inline',
|
'inline',
|
||||||
|
@ -255,6 +258,7 @@ export class FileServerService {
|
||||||
return fs.createReadStream(file.path);
|
return fs.createReadStream(file.path);
|
||||||
} else {
|
} else {
|
||||||
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream');
|
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream');
|
||||||
|
reply.header('Content-Length', file.file.size);
|
||||||
reply.header('Cache-Control', 'max-age=31536000, immutable');
|
reply.header('Cache-Control', 'max-age=31536000, immutable');
|
||||||
reply.header('Content-Disposition', contentDisposition('inline', file.filename));
|
reply.header('Content-Disposition', contentDisposition('inline', file.filename));
|
||||||
|
|
||||||
|
@ -263,7 +267,6 @@ export class FileServerService {
|
||||||
const parts = range.replace(/bytes=/, '').split('-');
|
const parts = range.replace(/bytes=/, '').split('-');
|
||||||
const start = parseInt(parts[0], 10);
|
const start = parseInt(parts[0], 10);
|
||||||
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
|
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
|
||||||
console.log(end);
|
|
||||||
if (end > file.file.size) {
|
if (end > file.file.size) {
|
||||||
end = file.file.size - 1;
|
end = file.file.size - 1;
|
||||||
}
|
}
|
||||||
|
@ -433,6 +436,7 @@ export class FileServerService {
|
||||||
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
|
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
|
||||||
reply.header('Accept-Ranges', 'bytes');
|
reply.header('Accept-Ranges', 'bytes');
|
||||||
reply.header('Content-Length', chunksize);
|
reply.header('Content-Length', chunksize);
|
||||||
|
reply.code(206);
|
||||||
} else {
|
} else {
|
||||||
image = {
|
image = {
|
||||||
data: fs.createReadStream(file.path),
|
data: fs.createReadStream(file.path),
|
||||||
|
@ -529,6 +533,7 @@ export class FileServerService {
|
||||||
if (!file.storedInternal) {
|
if (!file.storedInternal) {
|
||||||
if (!(file.isLink && file.uri)) return '204';
|
if (!(file.isLink && file.uri)) return '204';
|
||||||
const result = await this.downloadAndDetectTypeFromUrl(file.uri);
|
const result = await this.downloadAndDetectTypeFromUrl(file.uri);
|
||||||
|
file.size = (await fs.promises.stat(result.path)).size; // DB file.sizeは正確とは限らないので
|
||||||
return {
|
return {
|
||||||
...result,
|
...result,
|
||||||
url: file.uri,
|
url: file.uri,
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
||||||
me,
|
me,
|
||||||
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > (new Date()).getTime(),
|
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > Date.now(),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
||||||
me,
|
me,
|
||||||
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > (new Date()).getTime(),
|
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > Date.now(),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
||||||
me,
|
me,
|
||||||
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > (new Date()).getTime(),
|
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > Date.now(),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
||||||
me,
|
me,
|
||||||
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > (new Date()).getTime(),
|
(old, src) => !!src.movedAt && src.movedAt.getTime() + 1000 * 60 * 60 * 2 > Date.now(),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
if (checkMoving ? file.size > 32 * 1024 * 1024 : file.size > 64 * 1024) throw new ApiError(meta.errors.tooBigFile);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { DI } from '@/di-symbols.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js';
|
import { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js';
|
||||||
import { UserAuthService } from '@/core/UserAuthService.js';
|
import { UserAuthService } from '@/core/UserAuthService.js';
|
||||||
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -39,6 +40,12 @@ export const meta = {
|
||||||
code: 'UNAVAILABLE',
|
code: 'UNAVAILABLE',
|
||||||
id: 'a2defefb-f220-8849-0af6-17f816099323',
|
id: 'a2defefb-f220-8849-0af6-17f816099323',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emailRequired: {
|
||||||
|
message: 'Email address is required.',
|
||||||
|
code: 'EMAIL_REQUIRED',
|
||||||
|
id: '324c7a88-59f2-492f-903f-89134f93e47e',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
|
@ -66,6 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
@Inject(DI.userProfilesRepository)
|
@Inject(DI.userProfilesRepository)
|
||||||
private userProfilesRepository: UserProfilesRepository,
|
private userProfilesRepository: UserProfilesRepository,
|
||||||
|
|
||||||
|
private metaService: MetaService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private emailService: EmailService,
|
private emailService: EmailService,
|
||||||
private userAuthService: UserAuthService,
|
private userAuthService: UserAuthService,
|
||||||
|
@ -97,6 +105,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (!res.available) {
|
if (!res.available) {
|
||||||
throw new ApiError(meta.errors.unavailable);
|
throw new ApiError(meta.errors.unavailable);
|
||||||
}
|
}
|
||||||
|
} else if ((await this.metaService.fetch()).emailRequiredForSignup) {
|
||||||
|
throw new ApiError(meta.errors.emailRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.userProfilesRepository.update(me.id, {
|
await this.userProfilesRepository.update(me.id, {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
import { isQuote, isRenote } from '@/misc/is-renote.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
|
@ -275,7 +275,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
if (renote == null) {
|
if (renote == null) {
|
||||||
throw new ApiError(meta.errors.noSuchRenoteTarget);
|
throw new ApiError(meta.errors.noSuchRenoteTarget);
|
||||||
} else if (isPureRenote(renote)) {
|
} else if (isRenote(renote) && !isQuote(renote)) {
|
||||||
throw new ApiError(meta.errors.cannotReRenote);
|
throw new ApiError(meta.errors.cannotReRenote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
if (reply == null) {
|
if (reply == null) {
|
||||||
throw new ApiError(meta.errors.noSuchReplyTarget);
|
throw new ApiError(meta.errors.noSuchReplyTarget);
|
||||||
} else if (isPureRenote(reply)) {
|
} else if (isRenote(reply) && !isQuote(reply)) {
|
||||||
throw new ApiError(meta.errors.cannotReplyToPureRenote);
|
throw new ApiError(meta.errors.cannotReplyToPureRenote);
|
||||||
} else if (!await this.noteEntityService.isVisibleForMe(reply, me.id)) {
|
} else if (!await this.noteEntityService.isVisibleForMe(reply, me.id)) {
|
||||||
throw new ApiError(meta.errors.cannotReplyToInvisibleNote);
|
throw new ApiError(meta.errors.cannotReplyToInvisibleNote);
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||||
|
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import type Connection from './Connection.js';
|
import type Connection from './Connection.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,6 +58,24 @@ export default abstract class Channel {
|
||||||
return this.connection.subscriber;
|
return this.connection.subscriber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ミュートとブロックされてるを処理する
|
||||||
|
*/
|
||||||
|
protected isNoteMutedOrBlocked(note: Packed<'Note'>): boolean {
|
||||||
|
// 流れてきたNoteがインスタンスミュートしたインスタンスが関わる
|
||||||
|
if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? []))) return true;
|
||||||
|
|
||||||
|
// 流れてきたNoteがミュートしているユーザーが関わる
|
||||||
|
if (isUserRelated(note, this.userIdsWhoMeMuting)) return true;
|
||||||
|
// 流れてきたNoteがブロックされているユーザーが関わる
|
||||||
|
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return true;
|
||||||
|
|
||||||
|
// 流れてきたNoteがリノートをミュートしてるユーザが行ったもの
|
||||||
|
if (isRenotePacked(note) && !isQuotePacked(note) && this.userIdsWhoMeMutingRenotes.has(note.user.id)) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(id: string, connection: Connection) {
|
constructor(id: string, connection: Connection) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||||
|
@ -40,12 +39,7 @@ class AntennaChannel extends Channel {
|
||||||
if (data.type === 'note') {
|
if (data.type === 'note') {
|
||||||
const note = await this.noteEntityService.pack(data.body.id, this.user, { detail: true });
|
const note = await this.noteEntityService.pack(data.body.id, this.user, { detail: true });
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class ChannelChannel extends Channel {
|
class ChannelChannel extends Channel {
|
||||||
|
@ -38,14 +38,9 @@ class ChannelChannel extends Channel {
|
||||||
private async onNote(note: Packed<'Note'>) {
|
private async onNote(note: Packed<'Note'>) {
|
||||||
if (note.channelId !== this.channelId) return;
|
if (note.channelId !== this.channelId) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||||
note.renote.myReaction = myRenoteReaction;
|
note.renote.myReaction = myRenoteReaction;
|
||||||
|
|
|
@ -4,14 +4,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class GlobalTimelineChannel extends Channel {
|
class GlobalTimelineChannel extends Channel {
|
||||||
|
@ -52,26 +50,11 @@ class GlobalTimelineChannel extends Channel {
|
||||||
if (note.visibility !== 'public') return;
|
if (note.visibility !== 'public') return;
|
||||||
if (note.channelId != null) return;
|
if (note.channelId != null) return;
|
||||||
|
|
||||||
// 関係ない返信は除外
|
if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
|
||||||
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 (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
|
|
||||||
// Ignore notes from instances the user has muted
|
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||||
if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? []))) return;
|
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||||
note.renote.myReaction = myRenoteReaction;
|
note.renote.myReaction = myRenoteReaction;
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class HashtagChannel extends Channel {
|
class HashtagChannel extends Channel {
|
||||||
|
@ -43,14 +43,9 @@ class HashtagChannel extends Channel {
|
||||||
const matched = this.q.some(tags => tags.every(tag => noteTags.includes(normalizeForSearch(tag))));
|
const matched = this.q.some(tags => tags.every(tag => noteTags.includes(normalizeForSearch(tag))));
|
||||||
if (!matched) return;
|
if (!matched) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||||
note.renote.myReaction = myRenoteReaction;
|
note.renote.myReaction = myRenoteReaction;
|
||||||
|
|
|
@ -4,12 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class HomeTimelineChannel extends Channel {
|
class HomeTimelineChannel extends Channel {
|
||||||
|
@ -51,9 +49,6 @@ class HomeTimelineChannel extends Channel {
|
||||||
if (!isMe && !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<string>(this.userProfile!.mutedInstances))) return;
|
|
||||||
|
|
||||||
if (note.visibility === 'followers') {
|
if (note.visibility === 'followers') {
|
||||||
if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
|
if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
|
||||||
} else if (note.visibility === 'specified') {
|
} else if (note.visibility === 'specified') {
|
||||||
|
@ -72,7 +67,7 @@ class HomeTimelineChannel extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 純粋なリノート(引用リノートでないリノート)の場合
|
// 純粋なリノート(引用リノートでないリノート)の場合
|
||||||
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && note.poll == null) {
|
if (isRenotePacked(note) && !isQuotePacked(note) && note.renote) {
|
||||||
if (!this.withRenotes) return;
|
if (!this.withRenotes) return;
|
||||||
if (note.renote.reply) {
|
if (note.renote.reply) {
|
||||||
const reply = note.renote.reply;
|
const reply = note.renote.reply;
|
||||||
|
@ -81,14 +76,9 @@ class HomeTimelineChannel extends Channel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||||
note.renote.myReaction = myRenoteReaction;
|
note.renote.myReaction = myRenoteReaction;
|
||||||
|
|
|
@ -4,14 +4,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class HybridTimelineChannel extends Channel {
|
class HybridTimelineChannel extends Channel {
|
||||||
|
@ -71,8 +69,7 @@ class HybridTimelineChannel extends Channel {
|
||||||
if (!isMe && !note.visibleUserIds!.includes(this.user!.id)) return;
|
if (!isMe && !note.visibleUserIds!.includes(this.user!.id)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore notes from instances the user has muted
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
|
|
||||||
|
|
||||||
if (note.reply) {
|
if (note.reply) {
|
||||||
const reply = note.reply;
|
const reply = note.reply;
|
||||||
|
@ -85,14 +82,7 @@ class HybridTimelineChannel extends Channel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
|
if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
|
|
|
@ -4,13 +4,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class LocalTimelineChannel extends Channel {
|
class LocalTimelineChannel extends Channel {
|
||||||
|
@ -61,16 +60,11 @@ class LocalTimelineChannel extends Channel {
|
||||||
if (reply.userId !== this.user.id && note.userId !== this.user.id && reply.userId !== note.userId) return;
|
if (reply.userId !== this.user.id && note.userId !== this.user.id && reply.userId !== note.userId) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
|
if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||||
note.renote.myReaction = myRenoteReaction;
|
note.renote.myReaction = myRenoteReaction;
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
@ -46,12 +44,7 @@ class RoleTimelineChannel extends Channel {
|
||||||
}
|
}
|
||||||
if (note.visibility !== 'public') return;
|
if (note.visibility !== 'public') return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
|
||||||
|
|
||||||
this.send('note', note);
|
this.send('note', note);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { MiUserListMembership, UserListMembershipsRepository, UserListsRepository } from '@/models/_.js';
|
import type { MiUserListMembership, UserListMembershipsRepository, UserListsRepository } from '@/models/_.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class UserListChannel extends Channel {
|
class UserListChannel extends Channel {
|
||||||
|
@ -106,25 +105,17 @@ class UserListChannel extends Channel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
|
if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
|
||||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
|
||||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
|
||||||
|
|
||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
|
||||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||||
note.renote.myReaction = myRenoteReaction;
|
note.renote.myReaction = myRenoteReaction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているインスタンスに関わるものだったら無視する
|
|
||||||
if (isInstanceMuted(note, this.userMutedInstances)) return;
|
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
|
||||||
this.send('note', note);
|
this.send('note', note);
|
||||||
|
|
|
@ -63,6 +63,22 @@ describe('Renote Mute', () => {
|
||||||
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), true);
|
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #12956
|
||||||
|
test('タイムラインにリノートミュートしているユーザーの通常ノートのリノートが含まれる', async () => {
|
||||||
|
const carolNote = await post(carol, { text: 'hi' });
|
||||||
|
const bobRenote = await post(bob, { renoteId: carolNote.id });
|
||||||
|
|
||||||
|
// redisに追加されるのを待つ
|
||||||
|
await sleep(100);
|
||||||
|
|
||||||
|
const res = await api('notes/local-timeline', {}, alice);
|
||||||
|
|
||||||
|
assert.strictEqual(res.status, 200);
|
||||||
|
assert.strictEqual(Array.isArray(res.body), true);
|
||||||
|
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), true);
|
||||||
|
assert.strictEqual(res.body.some((note: any) => note.id === bobRenote.id), true);
|
||||||
|
});
|
||||||
|
|
||||||
test('ストリームにリノートミュートしているユーザーのリノートが流れない', async () => {
|
test('ストリームにリノートミュートしているユーザーのリノートが流れない', async () => {
|
||||||
const bobNote = await post(bob, { text: 'hi' });
|
const bobNote = await post(bob, { text: 'hi' });
|
||||||
|
|
||||||
|
@ -86,4 +102,17 @@ describe('Renote Mute', () => {
|
||||||
|
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #12956
|
||||||
|
test('ストリームにリノートミュートしているユーザーの通常ノートのリノートが流れてくる', async () => {
|
||||||
|
const carolbNote = await post(carol, { text: 'hi' });
|
||||||
|
|
||||||
|
const fired = await waitFire(
|
||||||
|
alice, 'localTimeline',
|
||||||
|
() => api('notes/create', { renoteId: carolbNote.id }, bob),
|
||||||
|
msg => msg.type === 'note' && msg.body.userId === bob.id,
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.strictEqual(fired, true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -63,7 +63,7 @@ describe('Streaming', () => {
|
||||||
takumiNote = await post(takumi, { text: 'piyo' });
|
takumiNote = await post(takumi, { text: 'piyo' });
|
||||||
|
|
||||||
// Follow: ayano => kyoko
|
// Follow: ayano => kyoko
|
||||||
await api('following/create', { userId: kyoko.id }, ayano);
|
await api('following/create', { userId: kyoko.id, withReplies: false }, ayano);
|
||||||
|
|
||||||
// Follow: ayano => akari
|
// Follow: ayano => akari
|
||||||
await follow(ayano, akari);
|
await follow(ayano, akari);
|
||||||
|
@ -509,6 +509,16 @@ describe('Streaming', () => {
|
||||||
|
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('withReplies = falseでフォローしてる人によるリプライが流れてくる', async () => {
|
||||||
|
const fired = await waitFire(
|
||||||
|
ayano, 'globalTimeline', // ayano:Global
|
||||||
|
() => api('notes/create', { text: 'foo', replyId: kanakoNote.id }, kyoko), // kyoko posts
|
||||||
|
msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.strictEqual(fired, true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UserList Timeline', () => {
|
describe('UserList Timeline', () => {
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Test } from '@nestjs/testing';
|
||||||
|
|
||||||
|
import { CoreModule } from '@/core/CoreModule.js';
|
||||||
|
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||||
|
import { GlobalModule } from '@/GlobalModule.js';
|
||||||
|
import { MiNote } from '@/models/Note.js';
|
||||||
|
import { IPoll } from '@/models/Poll.js';
|
||||||
|
import { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
|
|
||||||
|
describe('NoteCreateService', () => {
|
||||||
|
let noteCreateService: NoteCreateService;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
const app = await Test.createTestingModule({
|
||||||
|
imports: [GlobalModule, CoreModule],
|
||||||
|
}).compile();
|
||||||
|
noteCreateService = app.get<NoteCreateService>(NoteCreateService);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('is-renote', () => {
|
||||||
|
const base: MiNote = {
|
||||||
|
id: 'some-note-id',
|
||||||
|
replyId: null,
|
||||||
|
reply: null,
|
||||||
|
renoteId: null,
|
||||||
|
renote: null,
|
||||||
|
threadId: null,
|
||||||
|
text: null,
|
||||||
|
name: null,
|
||||||
|
cw: null,
|
||||||
|
userId: 'some-user-id',
|
||||||
|
user: null,
|
||||||
|
localOnly: false,
|
||||||
|
reactionAcceptance: null,
|
||||||
|
renoteCount: 0,
|
||||||
|
repliesCount: 0,
|
||||||
|
clippedCount: 0,
|
||||||
|
reactions: {},
|
||||||
|
visibility: 'public',
|
||||||
|
uri: null,
|
||||||
|
url: null,
|
||||||
|
fileIds: [],
|
||||||
|
attachedFileTypes: [],
|
||||||
|
visibleUserIds: [],
|
||||||
|
mentions: [],
|
||||||
|
mentionedRemoteUsers: '',
|
||||||
|
reactionAndUserPairCache: [],
|
||||||
|
emojis: [],
|
||||||
|
tags: [],
|
||||||
|
hasPoll: false,
|
||||||
|
channelId: null,
|
||||||
|
channel: null,
|
||||||
|
userHost: null,
|
||||||
|
replyUserId: null,
|
||||||
|
replyUserHost: null,
|
||||||
|
renoteUserId: null,
|
||||||
|
renoteUserHost: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const poll: IPoll = {
|
||||||
|
choices: ['kinoko', 'takenoko'],
|
||||||
|
multiple: false,
|
||||||
|
expiresAt: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const file: MiDriveFile = {
|
||||||
|
id: 'some-file-id',
|
||||||
|
userId: null,
|
||||||
|
user: null,
|
||||||
|
userHost: null,
|
||||||
|
md5: '',
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
size: 0,
|
||||||
|
comment: null,
|
||||||
|
blurhash: null,
|
||||||
|
properties: {},
|
||||||
|
storedInternal: false,
|
||||||
|
url: '',
|
||||||
|
thumbnailUrl: null,
|
||||||
|
webpublicUrl: null,
|
||||||
|
webpublicType: null,
|
||||||
|
accessKey: null,
|
||||||
|
thumbnailAccessKey: null,
|
||||||
|
webpublicAccessKey: null,
|
||||||
|
uri: null,
|
||||||
|
src: null,
|
||||||
|
folderId: null,
|
||||||
|
folder: null,
|
||||||
|
isSensitive: false,
|
||||||
|
maybeSensitive: false,
|
||||||
|
maybePorn: false,
|
||||||
|
isLink: false,
|
||||||
|
requestHeaders: null,
|
||||||
|
requestIp: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
test('note without renote should not be Renote', () => {
|
||||||
|
const note = { renote: null };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renote should be Renote and not be Quote', () => {
|
||||||
|
const note = { renote: base };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(true);
|
||||||
|
expect(noteCreateService['isQuote'](note)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renote and text should be Quote', () => {
|
||||||
|
const note = { renote: base, text: 'some-text' };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(true);
|
||||||
|
expect(noteCreateService['isQuote'](note)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renote and cw should be Quote', () => {
|
||||||
|
const note = { renote: base, cw: 'some-cw' };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(true);
|
||||||
|
expect(noteCreateService['isQuote'](note)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renote and reply should be Quote', () => {
|
||||||
|
const note = { renote: base, reply: { ...base, id: 'another-note-id' } };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(true);
|
||||||
|
expect(noteCreateService['isQuote'](note)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renote and poll should be Quote', () => {
|
||||||
|
const note = { renote: base, poll };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(true);
|
||||||
|
expect(noteCreateService['isQuote'](note)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renote and non-empty files should be Quote', () => {
|
||||||
|
const note = { renote: base, files: [file] };
|
||||||
|
expect(noteCreateService['isRenote'](note)).toBe(true);
|
||||||
|
expect(noteCreateService['isQuote'](note)).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -3,6 +3,8 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
|
|
||||||
process.env.NODE_ENV = 'test';
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
import { jest } from '@jest/globals';
|
import { jest } from '@jest/globals';
|
||||||
|
@ -20,6 +22,7 @@ import { IdService } from '@/core/IdService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||||
import { NotificationService } from '@/core/NotificationService.js';
|
import { NotificationService } from '@/core/NotificationService.js';
|
||||||
|
import { RoleCondFormulaValue } from '@/models/Role.js';
|
||||||
import { sleep } from '../utils.js';
|
import { sleep } from '../utils.js';
|
||||||
import type { TestingModule } from '@nestjs/testing';
|
import type { TestingModule } from '@nestjs/testing';
|
||||||
import type { MockFunctionMetadata } from 'jest-mock';
|
import type { MockFunctionMetadata } from 'jest-mock';
|
||||||
|
@ -52,12 +55,26 @@ describe('RoleService', () => {
|
||||||
id: genAidx(Date.now()),
|
id: genAidx(Date.now()),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
lastUsedAt: new Date(),
|
lastUsedAt: new Date(),
|
||||||
|
name: '',
|
||||||
description: '',
|
description: '',
|
||||||
...data,
|
...data,
|
||||||
})
|
})
|
||||||
.then(x => rolesRepository.findOneByOrFail(x.identifiers[0]));
|
.then(x => rolesRepository.findOneByOrFail(x.identifiers[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createConditionalRole(condFormula: RoleCondFormulaValue, data: Partial<MiRole> = {}) {
|
||||||
|
return createRole({
|
||||||
|
name: `[conditional] ${condFormula.type}`,
|
||||||
|
target: 'conditional',
|
||||||
|
condFormula: condFormula,
|
||||||
|
...data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function aidx() {
|
||||||
|
return genAidx(Date.now());
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
clock = lolex.install({
|
clock = lolex.install({
|
||||||
now: new Date(),
|
now: new Date(),
|
||||||
|
@ -73,6 +90,7 @@ describe('RoleService', () => {
|
||||||
CacheService,
|
CacheService,
|
||||||
IdService,
|
IdService,
|
||||||
GlobalEventService,
|
GlobalEventService,
|
||||||
|
UserEntityService,
|
||||||
{
|
{
|
||||||
provide: NotificationService,
|
provide: NotificationService,
|
||||||
useFactory: () => ({
|
useFactory: () => ({
|
||||||
|
@ -209,79 +227,6 @@ describe('RoleService', () => {
|
||||||
expect(result.driveCapacityMb).toBe(100);
|
expect(result.driveCapacityMb).toBe(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('conditional role', async () => {
|
|
||||||
const user1 = await createUser({
|
|
||||||
id: genAidx(Date.now() - (1000 * 60 * 60 * 24 * 365)),
|
|
||||||
});
|
|
||||||
const user2 = await createUser({
|
|
||||||
id: genAidx(Date.now() - (1000 * 60 * 60 * 24 * 365)),
|
|
||||||
followersCount: 10,
|
|
||||||
});
|
|
||||||
await createRole({
|
|
||||||
name: 'a',
|
|
||||||
policies: {
|
|
||||||
canManageCustomEmojis: {
|
|
||||||
useDefault: false,
|
|
||||||
priority: 0,
|
|
||||||
value: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
target: 'conditional',
|
|
||||||
condFormula: {
|
|
||||||
id: '232a4221-9816-49a6-a967-ae0fac52ec5e',
|
|
||||||
type: 'and',
|
|
||||||
values: [{
|
|
||||||
id: '2a37ef43-2d93-4c4d-87f6-f2fdb7d9b530',
|
|
||||||
type: 'followersMoreThanOrEq',
|
|
||||||
value: 10,
|
|
||||||
}, {
|
|
||||||
id: '1bd67839-b126-4f92-bad0-4e285dab453b',
|
|
||||||
type: 'createdMoreThan',
|
|
||||||
sec: 60 * 60 * 24 * 7,
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
metaService.fetch.mockResolvedValue({
|
|
||||||
policies: {
|
|
||||||
canManageCustomEmojis: false,
|
|
||||||
},
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
const user1Policies = await roleService.getUserPolicies(user1.id);
|
|
||||||
const user2Policies = await roleService.getUserPolicies(user2.id);
|
|
||||||
expect(user1Policies.canManageCustomEmojis).toBe(false);
|
|
||||||
expect(user2Policies.canManageCustomEmojis).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('コンディショナルロール: マニュアルロールにアサイン済み', async () => {
|
|
||||||
const [user1, user2, role1] = await Promise.all([
|
|
||||||
createUser(),
|
|
||||||
createUser(),
|
|
||||||
createRole({
|
|
||||||
name: 'manual role',
|
|
||||||
}),
|
|
||||||
]);
|
|
||||||
const role2 = await createRole({
|
|
||||||
name: 'conditional role',
|
|
||||||
target: 'conditional',
|
|
||||||
condFormula: {
|
|
||||||
// idはバックエンドのロジックに必要ない?
|
|
||||||
id: 'bdc612bd-9d54-4675-ae83-0499c82ea670',
|
|
||||||
type: 'roleAssignedTo',
|
|
||||||
roleId: role1.id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
await roleService.assign(user2.id, role1.id);
|
|
||||||
|
|
||||||
const [u1role, u2role] = await Promise.all([
|
|
||||||
roleService.getUserRoles(user1.id),
|
|
||||||
roleService.getUserRoles(user2.id),
|
|
||||||
]);
|
|
||||||
expect(u1role.some(r => r.id === role2.id)).toBe(false);
|
|
||||||
expect(u2role.some(r => r.id === role2.id)).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('expired role', async () => {
|
test('expired role', async () => {
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
const role = await createRole({
|
const role = await createRole({
|
||||||
|
@ -320,6 +265,427 @@ describe('RoleService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('conditional role', () => {
|
||||||
|
test('~かつ~', async () => {
|
||||||
|
const [user1, user2, user3, user4] = await Promise.all([
|
||||||
|
createUser({ isBot: true, isCat: false, isSuspended: false }),
|
||||||
|
createUser({ isBot: false, isCat: true, isSuspended: false }),
|
||||||
|
createUser({ isBot: true, isCat: true, isSuspended: false }),
|
||||||
|
createUser({ isBot: false, isCat: false, isSuspended: true }),
|
||||||
|
]);
|
||||||
|
const role1 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isBot',
|
||||||
|
});
|
||||||
|
const role2 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isCat',
|
||||||
|
});
|
||||||
|
const role3 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isSuspended',
|
||||||
|
});
|
||||||
|
const role4 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'and',
|
||||||
|
values: [role1.condFormula, role2.condFormula],
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
const actual4 = await roleService.getUserRoles(user4.id);
|
||||||
|
expect(actual1.some(r => r.id === role4.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role4.id)).toBe(false);
|
||||||
|
expect(actual3.some(r => r.id === role4.id)).toBe(true);
|
||||||
|
expect(actual4.some(r => r.id === role4.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('~または~', async () => {
|
||||||
|
const [user1, user2, user3, user4] = await Promise.all([
|
||||||
|
createUser({ isBot: true, isCat: false, isSuspended: false }),
|
||||||
|
createUser({ isBot: false, isCat: true, isSuspended: false }),
|
||||||
|
createUser({ isBot: true, isCat: true, isSuspended: false }),
|
||||||
|
createUser({ isBot: false, isCat: false, isSuspended: true }),
|
||||||
|
]);
|
||||||
|
const role1 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isBot',
|
||||||
|
});
|
||||||
|
const role2 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isCat',
|
||||||
|
});
|
||||||
|
const role3 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isSuspended',
|
||||||
|
});
|
||||||
|
const role4 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'or',
|
||||||
|
values: [role1.condFormula, role2.condFormula],
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
const actual4 = await roleService.getUserRoles(user4.id);
|
||||||
|
expect(actual1.some(r => r.id === role4.id)).toBe(true);
|
||||||
|
expect(actual2.some(r => r.id === role4.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role4.id)).toBe(true);
|
||||||
|
expect(actual4.some(r => r.id === role4.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('~ではない', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ isBot: true, isCat: false, isSuspended: false }),
|
||||||
|
createUser({ isBot: false, isCat: true, isSuspended: false }),
|
||||||
|
createUser({ isBot: true, isCat: true, isSuspended: false }),
|
||||||
|
]);
|
||||||
|
const role1 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isBot',
|
||||||
|
});
|
||||||
|
const role2 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isCat',
|
||||||
|
});
|
||||||
|
const role4 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'not',
|
||||||
|
value: role1.condFormula,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role4.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role4.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role4.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('マニュアルロールにアサイン済み', async () => {
|
||||||
|
const [user1, user2, role1] = await Promise.all([
|
||||||
|
createUser(),
|
||||||
|
createUser(),
|
||||||
|
createRole({
|
||||||
|
name: 'manual role',
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
const role2 = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'roleAssignedTo',
|
||||||
|
roleId: role1.id,
|
||||||
|
});
|
||||||
|
await roleService.assign(user2.id, role1.id);
|
||||||
|
|
||||||
|
const [u1role, u2role] = await Promise.all([
|
||||||
|
roleService.getUserRoles(user1.id),
|
||||||
|
roleService.getUserRoles(user2.id),
|
||||||
|
]);
|
||||||
|
expect(u1role.some(r => r.id === role2.id)).toBe(false);
|
||||||
|
expect(u2role.some(r => r.id === role2.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ローカルユーザのみ', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ host: null }),
|
||||||
|
createUser({ host: 'example.com' }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isLocal',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('リモートユーザのみ', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ host: null }),
|
||||||
|
createUser({ host: 'example.com' }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isRemote',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('サスペンド済みユーザである', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ isSuspended: false }),
|
||||||
|
createUser({ isSuspended: true }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isSuspended',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('鍵アカウントユーザである', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ isLocked: false }),
|
||||||
|
createUser({ isLocked: true }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isLocked',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('botユーザである', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ isBot: false }),
|
||||||
|
createUser({ isBot: true }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isBot',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('猫である', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ isCat: false }),
|
||||||
|
createUser({ isCat: true }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isCat',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('「ユーザを見つけやすくする」が有効なアカウント', async () => {
|
||||||
|
const [user1, user2] = await Promise.all([
|
||||||
|
createUser({ isExplorable: false }),
|
||||||
|
createUser({ isExplorable: true }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'isExplorable',
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ユーザが作成されてから指定期間経過した', async () => {
|
||||||
|
const base = new Date();
|
||||||
|
base.setMinutes(base.getMinutes() - 5);
|
||||||
|
|
||||||
|
const d1 = new Date(base);
|
||||||
|
const d2 = new Date(base);
|
||||||
|
const d3 = new Date(base);
|
||||||
|
d1.setSeconds(d1.getSeconds() - 1);
|
||||||
|
d3.setSeconds(d3.getSeconds() + 1);
|
||||||
|
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
// 4:59
|
||||||
|
createUser({ id: genAidx(d1.getTime()) }),
|
||||||
|
// 5:00
|
||||||
|
createUser({ id: genAidx(d2.getTime()) }),
|
||||||
|
// 5:01
|
||||||
|
createUser({ id: genAidx(d3.getTime()) }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'createdLessThan',
|
||||||
|
// 5 minutes
|
||||||
|
sec: 300,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ユーザが作成されてから指定期間経っていない', async () => {
|
||||||
|
const base = new Date();
|
||||||
|
base.setMinutes(base.getMinutes() - 5);
|
||||||
|
|
||||||
|
const d1 = new Date(base);
|
||||||
|
const d2 = new Date(base);
|
||||||
|
const d3 = new Date(base);
|
||||||
|
d1.setSeconds(d1.getSeconds() - 1);
|
||||||
|
d3.setSeconds(d3.getSeconds() + 1);
|
||||||
|
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
// 4:59
|
||||||
|
createUser({ id: genAidx(d1.getTime()) }),
|
||||||
|
// 5:00
|
||||||
|
createUser({ id: genAidx(d2.getTime()) }),
|
||||||
|
// 5:01
|
||||||
|
createUser({ id: genAidx(d3.getTime()) }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'createdMoreThan',
|
||||||
|
// 5 minutes
|
||||||
|
sec: 300,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('フォロワー数が指定値以下', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ followersCount: 99 }),
|
||||||
|
createUser({ followersCount: 100 }),
|
||||||
|
createUser({ followersCount: 101 }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'followersLessThanOrEq',
|
||||||
|
value: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('フォロワー数が指定値以下', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ followersCount: 99 }),
|
||||||
|
createUser({ followersCount: 100 }),
|
||||||
|
createUser({ followersCount: 101 }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'followersMoreThanOrEq',
|
||||||
|
value: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('フォロー数が指定値以下', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ followingCount: 99 }),
|
||||||
|
createUser({ followingCount: 100 }),
|
||||||
|
createUser({ followingCount: 101 }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'followingLessThanOrEq',
|
||||||
|
value: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('フォロー数が指定値以上', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ followingCount: 99 }),
|
||||||
|
createUser({ followingCount: 100 }),
|
||||||
|
createUser({ followingCount: 101 }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'followingMoreThanOrEq',
|
||||||
|
value: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ノート数が指定値以下', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ notesCount: 9 }),
|
||||||
|
createUser({ notesCount: 10 }),
|
||||||
|
createUser({ notesCount: 11 }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'notesLessThanOrEq',
|
||||||
|
value: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ノート数が指定値以上', async () => {
|
||||||
|
const [user1, user2, user3] = await Promise.all([
|
||||||
|
createUser({ notesCount: 9 }),
|
||||||
|
createUser({ notesCount: 10 }),
|
||||||
|
createUser({ notesCount: 11 }),
|
||||||
|
]);
|
||||||
|
const role = await createConditionalRole({
|
||||||
|
id: aidx(),
|
||||||
|
type: 'notesMoreThanOrEq',
|
||||||
|
value: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual1 = await roleService.getUserRoles(user1.id);
|
||||||
|
const actual2 = await roleService.getUserRoles(user2.id);
|
||||||
|
const actual3 = await roleService.getUserRoles(user3.id);
|
||||||
|
expect(actual1.some(r => r.id === role.id)).toBe(false);
|
||||||
|
expect(actual2.some(r => r.id === role.id)).toBe(true);
|
||||||
|
expect(actual3.some(r => r.id === role.id)).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('assign', () => {
|
describe('assign', () => {
|
||||||
test('公開ロールの場合は通知される', async () => {
|
test('公開ロールの場合は通知される', async () => {
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { isQuote, isRenote } from '@/misc/is-renote.js';
|
||||||
|
import { MiNote } from '@/models/Note.js';
|
||||||
|
|
||||||
|
const base: MiNote = {
|
||||||
|
id: 'some-note-id',
|
||||||
|
replyId: null,
|
||||||
|
reply: null,
|
||||||
|
renoteId: null,
|
||||||
|
renote: null,
|
||||||
|
threadId: null,
|
||||||
|
text: null,
|
||||||
|
name: null,
|
||||||
|
cw: null,
|
||||||
|
userId: 'some-user-id',
|
||||||
|
user: null,
|
||||||
|
localOnly: false,
|
||||||
|
reactionAcceptance: null,
|
||||||
|
renoteCount: 0,
|
||||||
|
repliesCount: 0,
|
||||||
|
clippedCount: 0,
|
||||||
|
reactions: {},
|
||||||
|
visibility: 'public',
|
||||||
|
uri: null,
|
||||||
|
url: null,
|
||||||
|
fileIds: [],
|
||||||
|
attachedFileTypes: [],
|
||||||
|
visibleUserIds: [],
|
||||||
|
mentions: [],
|
||||||
|
mentionedRemoteUsers: '',
|
||||||
|
reactionAndUserPairCache: [],
|
||||||
|
emojis: [],
|
||||||
|
tags: [],
|
||||||
|
hasPoll: false,
|
||||||
|
channelId: null,
|
||||||
|
channel: null,
|
||||||
|
userHost: null,
|
||||||
|
replyUserId: null,
|
||||||
|
replyUserHost: null,
|
||||||
|
renoteUserId: null,
|
||||||
|
renoteUserHost: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('misc:is-renote', () => {
|
||||||
|
test('note without renoteId should not be Renote', () => {
|
||||||
|
expect(isRenote(base)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renoteId should be Renote and not be Quote', () => {
|
||||||
|
const note: MiNote = { ...base, renoteId: 'some-renote-id' };
|
||||||
|
expect(isRenote(note)).toBe(true);
|
||||||
|
expect(isQuote(note as any)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renoteId and text should be Quote', () => {
|
||||||
|
const note: MiNote = { ...base, renoteId: 'some-renote-id', text: 'some-text' };
|
||||||
|
expect(isRenote(note)).toBe(true);
|
||||||
|
expect(isQuote(note as any)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renoteId and cw should be Quote', () => {
|
||||||
|
const note: MiNote = { ...base, renoteId: 'some-renote-id', cw: 'some-cw' };
|
||||||
|
expect(isRenote(note)).toBe(true);
|
||||||
|
expect(isQuote(note as any)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renoteId and replyId should be Quote', () => {
|
||||||
|
const note: MiNote = { ...base, renoteId: 'some-renote-id', replyId: 'some-reply-id' };
|
||||||
|
expect(isRenote(note)).toBe(true);
|
||||||
|
expect(isQuote(note as any)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renoteId and poll should be Quote', () => {
|
||||||
|
const note: MiNote = { ...base, renoteId: 'some-renote-id', hasPoll: true };
|
||||||
|
expect(isRenote(note)).toBe(true);
|
||||||
|
expect(isQuote(note as any)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('note with renoteId and non-empty fileIds should be Quote', () => {
|
||||||
|
const note: MiNote = { ...base, renoteId: 'some-renote-id', fileIds: ['some-file-id'] };
|
||||||
|
expect(isRenote(note)).toBe(true);
|
||||||
|
expect(isQuote(note as any)).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
|
@ -29,7 +29,7 @@
|
||||||
"@twemoji/parser": "15.0.0",
|
"@twemoji/parser": "15.0.0",
|
||||||
"@vitejs/plugin-vue": "5.0.4",
|
"@vitejs/plugin-vue": "5.0.4",
|
||||||
"@vue/compiler-sfc": "3.4.21",
|
"@vue/compiler-sfc": "3.4.21",
|
||||||
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.2",
|
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.4",
|
||||||
"astring": "1.8.6",
|
"astring": "1.8.6",
|
||||||
"broadcast-channel": "7.0.0",
|
"broadcast-channel": "7.0.0",
|
||||||
"buraha": "0.0.1",
|
"buraha": "0.0.1",
|
||||||
|
|
|
@ -4,37 +4,59 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="$style.root" class="_panel">
|
<MkA :to="`/clips/${clip.id}`" :class="$style.link">
|
||||||
|
<div :class="$style.root" class="_panel _gaps_s">
|
||||||
<b>{{ clip.name }}</b>
|
<b>{{ clip.name }}</b>
|
||||||
<div v-if="clip.description" :class="$style.description">{{ clip.description }}</div>
|
<div :class="$style.description">
|
||||||
|
<div v-if="clip.description"><Mfm :text="clip.description" :plain="true" :nowrap="true"/></div>
|
||||||
<div v-if="clip.lastClippedAt">{{ i18n.ts.updatedAt }}: <MkTime :time="clip.lastClippedAt" mode="detail"/></div>
|
<div v-if="clip.lastClippedAt">{{ i18n.ts.updatedAt }}: <MkTime :time="clip.lastClippedAt" mode="detail"/></div>
|
||||||
<div :class="$style.user">
|
<div v-if="clip.notesCount != null">{{ i18n.ts.notesCount }}: {{ number(clip.notesCount) }} / {{ $i?.policies.noteEachClipsLimit }} ({{ i18n.tsx.remainingN({ n: remaining }) }})</div>
|
||||||
|
</div>
|
||||||
|
<div :class="$style.divider"></div>
|
||||||
|
<div>
|
||||||
<MkAvatar :user="clip.user" :class="$style.userAvatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
|
<MkAvatar :user="clip.user" :class="$style.userAvatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { computed } from 'vue';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
import { $i } from '@/account.js';
|
||||||
|
import number from '@/filters/number.js';
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
clip: any;
|
clip: Misskey.entities.Clip;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const remaining = computed(() => {
|
||||||
|
return ($i?.policies && props.clip.notesCount != null) ? ($i.policies.noteEachClipsLimit - props.clip.notesCount) : i18n.ts.unknown;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
.root {
|
.link {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.root {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.divider {
|
||||||
padding: 8px 0;
|
height: 1px;
|
||||||
|
background: var(--divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
.user {
|
.description {
|
||||||
padding-top: 16px;
|
font-size: 90%;
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.userAvatar {
|
.userAvatar {
|
||||||
|
|
|
@ -47,12 +47,12 @@ onMounted(() => {
|
||||||
const width = rootEl.value!.offsetWidth;
|
const width = rootEl.value!.offsetWidth;
|
||||||
const height = rootEl.value!.offsetHeight;
|
const height = rootEl.value!.offsetHeight;
|
||||||
|
|
||||||
if (left + width - window.pageXOffset >= (window.innerWidth - SCROLLBAR_THICKNESS)) {
|
if (left + width - window.scrollX >= (window.innerWidth - SCROLLBAR_THICKNESS)) {
|
||||||
left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.pageXOffset;
|
left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.scrollX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top + height - window.pageYOffset >= (window.innerHeight - SCROLLBAR_THICKNESS)) {
|
if (top + height - window.scrollY >= (window.innerHeight - SCROLLBAR_THICKNESS)) {
|
||||||
top = (window.innerHeight - SCROLLBAR_THICKNESS) - height + window.pageYOffset;
|
top = (window.innerHeight - SCROLLBAR_THICKNESS) - height + window.scrollY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top < 0) {
|
if (top < 0) {
|
||||||
|
|
|
@ -161,7 +161,7 @@ function onKeydown(evt: KeyboardEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInputKeydown(evt: KeyboardEvent) {
|
function onInputKeydown(evt: KeyboardEvent) {
|
||||||
if (evt.key === 'Enter') {
|
if (evt.key === 'Enter' && okButtonDisabledReason.value === null) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
ok();
|
ok();
|
||||||
|
|
|
@ -93,6 +93,18 @@ async function onClick() {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
if (defaultStore.state.alwaysConfirmFollow) {
|
||||||
|
const { canceled } = await os.confirm({
|
||||||
|
type: 'question',
|
||||||
|
text: i18n.tsx.followConfirm({ name: props.user.name || props.user.username }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (canceled) {
|
||||||
|
wait.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasPendingFollowRequestFromYou.value) {
|
if (hasPendingFollowRequestFromYou.value) {
|
||||||
await misskeyApi('following/requests/cancel', {
|
await misskeyApi('following/requests/cancel', {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
|
|
|
@ -175,8 +175,8 @@ const align = () => {
|
||||||
let left;
|
let left;
|
||||||
let top;
|
let top;
|
||||||
|
|
||||||
const x = srcRect.left + (fixed.value ? 0 : window.pageXOffset);
|
const x = srcRect.left + (fixed.value ? 0 : window.scrollX);
|
||||||
const y = srcRect.top + (fixed.value ? 0 : window.pageYOffset);
|
const y = srcRect.top + (fixed.value ? 0 : window.scrollY);
|
||||||
|
|
||||||
if (props.anchor.x === 'center') {
|
if (props.anchor.x === 'center') {
|
||||||
left = x + (props.src.offsetWidth / 2) - (width / 2);
|
left = x + (props.src.offsetWidth / 2) - (width / 2);
|
||||||
|
@ -220,24 +220,24 @@ const align = () => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 画面から横にはみ出る場合
|
// 画面から横にはみ出る場合
|
||||||
if (left + width - window.pageXOffset > (window.innerWidth - SCROLLBAR_THICKNESS)) {
|
if (left + width - window.scrollX > (window.innerWidth - SCROLLBAR_THICKNESS)) {
|
||||||
left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.pageXOffset - 1;
|
left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.scrollX - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const underSpace = ((window.innerHeight - SCROLLBAR_THICKNESS) - MARGIN) - (top - window.pageYOffset);
|
const underSpace = ((window.innerHeight - SCROLLBAR_THICKNESS) - MARGIN) - (top - window.scrollY);
|
||||||
const upperSpace = (srcRect.top - MARGIN);
|
const upperSpace = (srcRect.top - MARGIN);
|
||||||
|
|
||||||
// 画面から縦にはみ出る場合
|
// 画面から縦にはみ出る場合
|
||||||
if (top + height - window.pageYOffset > ((window.innerHeight - SCROLLBAR_THICKNESS) - MARGIN)) {
|
if (top + height - window.scrollY > ((window.innerHeight - SCROLLBAR_THICKNESS) - MARGIN)) {
|
||||||
if (props.noOverlap && props.anchor.x === 'center') {
|
if (props.noOverlap && props.anchor.x === 'center') {
|
||||||
if (underSpace >= (upperSpace / 3)) {
|
if (underSpace >= (upperSpace / 3)) {
|
||||||
maxHeight.value = underSpace;
|
maxHeight.value = underSpace;
|
||||||
} else {
|
} else {
|
||||||
maxHeight.value = upperSpace;
|
maxHeight.value = upperSpace;
|
||||||
top = window.pageYOffset + ((upperSpace + MARGIN) - height);
|
top = window.scrollY + ((upperSpace + MARGIN) - height);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
top = ((window.innerHeight - SCROLLBAR_THICKNESS) - MARGIN) - height + window.pageYOffset - 1;
|
top = ((window.innerHeight - SCROLLBAR_THICKNESS) - MARGIN) - height + window.scrollY - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
maxHeight.value = underSpace;
|
maxHeight.value = underSpace;
|
||||||
|
@ -255,15 +255,15 @@ const align = () => {
|
||||||
let transformOriginX = 'center';
|
let transformOriginX = 'center';
|
||||||
let transformOriginY = 'center';
|
let transformOriginY = 'center';
|
||||||
|
|
||||||
if (top >= srcRect.top + props.src.offsetHeight + (fixed.value ? 0 : window.pageYOffset)) {
|
if (top >= srcRect.top + props.src.offsetHeight + (fixed.value ? 0 : window.scrollY)) {
|
||||||
transformOriginY = 'top';
|
transformOriginY = 'top';
|
||||||
} else if ((top + height) <= srcRect.top + (fixed.value ? 0 : window.pageYOffset)) {
|
} else if ((top + height) <= srcRect.top + (fixed.value ? 0 : window.scrollY)) {
|
||||||
transformOriginY = 'bottom';
|
transformOriginY = 'bottom';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left >= srcRect.left + props.src.offsetWidth + (fixed.value ? 0 : window.pageXOffset)) {
|
if (left >= srcRect.left + props.src.offsetWidth + (fixed.value ? 0 : window.scrollX)) {
|
||||||
transformOriginX = 'left';
|
transformOriginX = 'left';
|
||||||
} else if ((left + width) <= srcRect.left + (fixed.value ? 0 : window.pageXOffset)) {
|
} else if ((left + width) <= srcRect.left + (fixed.value ? 0 : window.scrollX)) {
|
||||||
transformOriginX = 'right';
|
transformOriginX = 'right';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,6 +242,7 @@ if (noteViewInterruptors.length > 0) {
|
||||||
|
|
||||||
const isRenote = (
|
const isRenote = (
|
||||||
note.value.renote != null &&
|
note.value.renote != null &&
|
||||||
|
note.value.reply == null &&
|
||||||
note.value.text == null &&
|
note.value.text == null &&
|
||||||
note.value.cw == null &&
|
note.value.cw == null &&
|
||||||
note.value.fileIds && note.value.fileIds.length === 0 &&
|
note.value.fileIds && note.value.fileIds.length === 0 &&
|
||||||
|
|
|
@ -68,7 +68,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div :class="$style.noteContent">
|
<div :class="$style.noteContent">
|
||||||
<p v-if="appearNote.cw != null" :class="$style.cw">
|
<p v-if="appearNote.cw != null" :class="$style.cw">
|
||||||
<Mfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="'respect'"/>
|
<Mfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="'respect'"/>
|
||||||
<MkCwButton v-model="showContent" :text="appearNote.text" :files="appearNote.files" :poll="appearNote.poll"/>
|
<MkCwButton v-model="showContent" :text="appearNote.text" :renote="appearNote.renote" :files="appearNote.files" :poll="appearNote.poll"/>
|
||||||
</p>
|
</p>
|
||||||
<div v-show="appearNote.cw == null || showContent">
|
<div v-show="appearNote.cw == null || showContent">
|
||||||
<span v-if="appearNote.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
|
<span v-if="appearNote.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
|
||||||
|
@ -266,7 +266,9 @@ if (noteViewInterruptors.length > 0) {
|
||||||
|
|
||||||
const isRenote = (
|
const isRenote = (
|
||||||
note.value.renote != null &&
|
note.value.renote != null &&
|
||||||
|
note.value.reply == null &&
|
||||||
note.value.text == null &&
|
note.value.text == null &&
|
||||||
|
note.value.cw == null &&
|
||||||
note.value.fileIds && note.value.fileIds.length === 0 &&
|
note.value.fileIds && note.value.fileIds.length === 0 &&
|
||||||
note.value.poll == null
|
note.value.poll == null
|
||||||
);
|
);
|
||||||
|
|
|
@ -253,7 +253,13 @@ const maxTextLength = computed((): number => {
|
||||||
|
|
||||||
const canPost = computed((): boolean => {
|
const canPost = computed((): boolean => {
|
||||||
return !props.mock && !posting.value && !posted.value &&
|
return !props.mock && !posting.value && !posted.value &&
|
||||||
(1 <= textLength.value || 1 <= files.value.length || !!poll.value || !!props.renote) &&
|
(
|
||||||
|
1 <= textLength.value ||
|
||||||
|
1 <= files.value.length ||
|
||||||
|
poll.value != null ||
|
||||||
|
props.renote != null ||
|
||||||
|
(props.reply != null && quoteId.value != null)
|
||||||
|
) &&
|
||||||
(textLength.value <= maxTextLength.value) &&
|
(textLength.value <= maxTextLength.value) &&
|
||||||
(!poll.value || poll.value.choices.length >= 2);
|
(!poll.value || poll.value.choices.length >= 2);
|
||||||
});
|
});
|
||||||
|
@ -382,7 +388,7 @@ function addMissingMention() {
|
||||||
for (const x of extractMentions(ast)) {
|
for (const x of extractMentions(ast)) {
|
||||||
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
|
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
|
||||||
misskeyApi('users/show', { username: x.username, host: x.host }).then(user => {
|
misskeyApi('users/show', { username: x.username, host: x.host }).then(user => {
|
||||||
visibleUsers.value.push(user);
|
pushVisibleUser(user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,6 +681,7 @@ function saveDraft() {
|
||||||
localOnly: localOnly.value,
|
localOnly: localOnly.value,
|
||||||
files: files.value,
|
files: files.value,
|
||||||
poll: poll.value,
|
poll: poll.value,
|
||||||
|
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(x => x.id) : undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -958,6 +965,15 @@ onMounted(() => {
|
||||||
if (draft.data.poll) {
|
if (draft.data.poll) {
|
||||||
poll.value = draft.data.poll;
|
poll.value = draft.data.poll;
|
||||||
}
|
}
|
||||||
|
if (draft.data.visibleUserIds) {
|
||||||
|
misskeyApi('users/show', { userIds: draft.data.visibleUserIds }).then(users => {
|
||||||
|
for (let i = 0; i < users.length; i++) {
|
||||||
|
if (users[i].id === draft.data.visibleUserIds[i]) {
|
||||||
|
pushVisibleUser(users[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ const left = ref(0);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const rect = props.source.getBoundingClientRect();
|
const rect = props.source.getBoundingClientRect();
|
||||||
const x = Math.max((rect.left + (props.source.offsetWidth / 2)) - (300 / 2), 6) + window.pageXOffset;
|
const x = Math.max((rect.left + (props.source.offsetWidth / 2)) - (300 / 2), 6) + window.scrollX;
|
||||||
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
const y = rect.top + props.source.offsetHeight + window.scrollY;
|
||||||
|
|
||||||
top.value = y;
|
top.value = y;
|
||||||
left.value = x;
|
left.value = x;
|
||||||
|
|
|
@ -106,8 +106,8 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const rect = props.source.getBoundingClientRect();
|
const rect = props.source.getBoundingClientRect();
|
||||||
const x = ((rect.left + (props.source.offsetWidth / 2)) - (300 / 2)) + window.pageXOffset;
|
const x = ((rect.left + (props.source.offsetWidth / 2)) - (300 / 2)) + window.scrollX;
|
||||||
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
const y = rect.top + props.source.offsetHeight + window.scrollY;
|
||||||
|
|
||||||
top.value = y;
|
top.value = y;
|
||||||
left.value = x;
|
left.value = x;
|
||||||
|
|
|
@ -47,7 +47,7 @@ const invalid = Number.isNaN(_time);
|
||||||
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
|
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
|
||||||
|
|
||||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
// eslint-disable-next-line vue/no-setup-props-destructure
|
||||||
const now = ref((props.origin ?? new Date()).getTime());
|
const now = ref(props.origin?.getTime() ?? Date.now());
|
||||||
const ago = computed(() => (now.value - _time) / 1000/*ms*/);
|
const ago = computed(() => (now.value - _time) / 1000/*ms*/);
|
||||||
|
|
||||||
const relative = computed<string>(() => {
|
const relative = computed<string>(() => {
|
||||||
|
@ -77,7 +77,7 @@ let tickId: number;
|
||||||
let currentInterval: number;
|
let currentInterval: number;
|
||||||
|
|
||||||
function tick() {
|
function tick() {
|
||||||
now.value = (new Date()).getTime();
|
now.value = Date.now();
|
||||||
const nextInterval = ago.value < 60 ? 10000 : ago.value < 3600 ? 60000 : 180000;
|
const nextInterval = ago.value < 60 ? 10000 : ago.value < 3600 ? 60000 : 180000;
|
||||||
|
|
||||||
if (currentInterval !== nextInterval) {
|
if (currentInterval !== nextInterval) {
|
||||||
|
|
|
@ -9,6 +9,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkSelect v-model="type" :class="$style.typeSelect">
|
<MkSelect v-model="type" :class="$style.typeSelect">
|
||||||
<option value="isLocal">{{ i18n.ts._role._condition.isLocal }}</option>
|
<option value="isLocal">{{ i18n.ts._role._condition.isLocal }}</option>
|
||||||
<option value="isRemote">{{ i18n.ts._role._condition.isRemote }}</option>
|
<option value="isRemote">{{ i18n.ts._role._condition.isRemote }}</option>
|
||||||
|
<option value="isSuspended">{{ i18n.ts._role._condition.isSuspended }}</option>
|
||||||
|
<option value="isLocked">{{ i18n.ts._role._condition.isLocked }}</option>
|
||||||
|
<option value="isBot">{{ i18n.ts._role._condition.isBot }}</option>
|
||||||
|
<option value="isCat">{{ i18n.ts._role._condition.isCat }}</option>
|
||||||
|
<option value="isExplorable">{{ i18n.ts._role._condition.isExplorable }}</option>
|
||||||
<option value="roleAssignedTo">{{ i18n.ts._role._condition.roleAssignedTo }}</option>
|
<option value="roleAssignedTo">{{ i18n.ts._role._condition.roleAssignedTo }}</option>
|
||||||
<option value="createdLessThan">{{ i18n.ts._role._condition.createdLessThan }}</option>
|
<option value="createdLessThan">{{ i18n.ts._role._condition.createdLessThan }}</option>
|
||||||
<option value="createdMoreThan">{{ i18n.ts._role._condition.createdMoreThan }}</option>
|
<option value="createdMoreThan">{{ i18n.ts._role._condition.createdMoreThan }}</option>
|
||||||
|
|
|
@ -9,11 +9,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkSpacer :contentMax="800">
|
<MkSpacer :contentMax="800">
|
||||||
<div v-if="clip" class="_gaps">
|
<div v-if="clip" class="_gaps">
|
||||||
<div class="_panel">
|
<div class="_panel">
|
||||||
<div v-if="clip.description" :class="$style.description">
|
<div class="_gaps_s" :class="$style.description">
|
||||||
|
<div v-if="clip.description">
|
||||||
<Mfm :text="clip.description" :isNote="false"/>
|
<Mfm :text="clip.description" :isNote="false"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>({{ i18n.ts.noDescription }})</div>
|
||||||
|
<div>
|
||||||
<MkButton v-if="favorited" v-tooltip="i18n.ts.unfavorite" asLike rounded primary @click="unfavorite()"><i class="ti ti-heart"></i><span v-if="clip.favoritedCount > 0" style="margin-left: 6px;">{{ clip.favoritedCount }}</span></MkButton>
|
<MkButton v-if="favorited" v-tooltip="i18n.ts.unfavorite" asLike rounded primary @click="unfavorite()"><i class="ti ti-heart"></i><span v-if="clip.favoritedCount > 0" style="margin-left: 6px;">{{ clip.favoritedCount }}</span></MkButton>
|
||||||
<MkButton v-else v-tooltip="i18n.ts.favorite" asLike rounded @click="favorite()"><i class="ti ti-heart"></i><span v-if="clip.favoritedCount > 0" style="margin-left: 6px;">{{ clip.favoritedCount }}</span></MkButton>
|
<MkButton v-else v-tooltip="i18n.ts.favorite" asLike rounded @click="favorite()"><i class="ti ti-heart"></i><span v-if="clip.favoritedCount > 0" style="margin-left: 6px;">{{ clip.favoritedCount }}</span></MkButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div :class="$style.user">
|
<div :class="$style.user">
|
||||||
<MkAvatar :user="clip.user" :class="$style.avatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
|
<MkAvatar :user="clip.user" :class="$style.avatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,15 +12,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton primary rounded class="add" @click="create"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
|
<MkButton primary rounded class="add" @click="create"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
|
||||||
|
|
||||||
<MkPagination v-slot="{ items }" ref="pagingComponent" :pagination="pagination" class="_gaps">
|
<MkPagination v-slot="{ items }" ref="pagingComponent" :pagination="pagination" class="_gaps">
|
||||||
<MkA v-for="item in items" :key="item.id" :to="`/clips/${item.id}`">
|
<MkClipPreview v-for="item in items" :key="item.id" :clip="item"/>
|
||||||
<MkClipPreview :clip="item"/>
|
|
||||||
</MkA>
|
|
||||||
</MkPagination>
|
</MkPagination>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'favorites'" key="favorites" class="_gaps">
|
<div v-else-if="tab === 'favorites'" key="favorites" class="_gaps">
|
||||||
<MkA v-for="item in favorites" :key="item.id" :to="`/clips/${item.id}`">
|
<MkClipPreview v-for="item in favorites" :key="item.id" :clip="item"/>
|
||||||
<MkClipPreview :clip="item"/>
|
|
||||||
</MkA>
|
|
||||||
</div>
|
</div>
|
||||||
</MkHorizontalSwipe>
|
</MkHorizontalSwipe>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
|
|
|
@ -26,9 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="clips && clips.length > 0" class="_margin">
|
<div v-if="clips && clips.length > 0" class="_margin">
|
||||||
<div style="font-weight: bold; padding: 12px;">{{ i18n.ts.clip }}</div>
|
<div style="font-weight: bold; padding: 12px;">{{ i18n.ts.clip }}</div>
|
||||||
<div class="_gaps">
|
<div class="_gaps">
|
||||||
<MkA v-for="item in clips" :key="item.id" :to="`/clips/${item.id}`">
|
<MkClipPreview v-for="item in clips" :key="item.id" :clip="item"/>
|
||||||
<MkClipPreview :clip="item"/>
|
|
||||||
</MkA>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!showPrev" class="_buttons" :class="$style.loadPrev">
|
<div v-if="!showPrev" class="_buttons" :class="$style.loadPrev">
|
||||||
|
|
|
@ -12,6 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
:leaveActiveClass="defaultStore.state.animation ? $style.fadeLeaveActive : ''"
|
:leaveActiveClass="defaultStore.state.animation ? $style.fadeLeaveActive : ''"
|
||||||
:enterFromClass="defaultStore.state.animation ? $style.fadeEnterFrom : ''"
|
:enterFromClass="defaultStore.state.animation ? $style.fadeEnterFrom : ''"
|
||||||
:leaveToClass="defaultStore.state.animation ? $style.fadeLeaveTo : ''"
|
:leaveToClass="defaultStore.state.animation ? $style.fadeLeaveTo : ''"
|
||||||
|
mode="out-in"
|
||||||
>
|
>
|
||||||
<div v-if="page" :key="page.id" class="_gaps">
|
<div v-if="page" :key="page.id" class="_gaps">
|
||||||
<div :class="$style.pageMain">
|
<div :class="$style.pageMain">
|
||||||
|
@ -41,9 +42,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.pageBannerTitle" class="_gaps_s">
|
<div :class="$style.pageBannerTitle" class="_gaps_s">
|
||||||
<h1>{{ page.title || page.name }}</h1>
|
<h1>{{ page.title || page.name }}</h1>
|
||||||
|
<div :class="$style.pageBannerTitleSub">
|
||||||
<div v-if="page.user" :class="$style.pageBannerTitleUser">
|
<div v-if="page.user" :class="$style.pageBannerTitleUser">
|
||||||
<MkAvatar :user="page.user" :class="$style.avatar" indicator link preview/> <MkA :to="`/@${username}`"><MkUserName :user="page.user" :nowrap="false"/></MkA>
|
<MkAvatar :user="page.user" :class="$style.avatar" indicator link preview/> <MkA :to="`/@${username}`"><MkUserName :user="page.user" :nowrap="false"/></MkA>
|
||||||
</div>
|
</div>
|
||||||
|
<div :class="$style.pageBannerTitleSubActions">
|
||||||
|
<MkA v-if="page.userId === $i?.id" v-tooltip="i18n.ts._pages.editThisPage" :to="`/pages/edit/${page.id}`" class="_button" :class="$style.generalActionButton"><i class="ti ti-pencil ti-fw"></i></MkA>
|
||||||
|
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.pageContent">
|
<div :class="$style.pageContent">
|
||||||
|
@ -355,8 +362,15 @@ definePageMetadata(() => ({
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pageBannerTitleSub {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.pageBannerTitleUser {
|
.pageBannerTitleUser {
|
||||||
--height: 32px;
|
--height: 32px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
|
@ -365,6 +379,14 @@ definePageMetadata(() => ({
|
||||||
|
|
||||||
line-height: var(--height);
|
line-height: var(--height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pageBannerTitleSubActions {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--marginHalf);
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div style="height: 100cqh; overflow: auto; text-align: center;">
|
<div style="height: 100cqh; overflow: auto; text-align: center;">
|
||||||
<MkSpacer :marginMin="20" :marginMax="28">
|
<MkSpacer :marginMin="20" :marginMax="28">
|
||||||
<div class="_gaps">
|
<div class="_gaps">
|
||||||
|
<MkInfo><MkLink url="https://misskey-hub.net/docs/for-users/stepped-guides/how-to-enable-2fa/" target="_blank">{{ i18n.ts._2fa.moreDetailedGuideHere }}</MkLink></MkInfo>
|
||||||
|
|
||||||
<I18n :src="i18n.ts._2fa.step1" tag="div">
|
<I18n :src="i18n.ts._2fa.step1" tag="div">
|
||||||
<template #a>
|
<template #a>
|
||||||
<a href="https://authy.com/" rel="noopener" target="_blank" class="_link">Authy</a>
|
<a href="https://authy.com/" rel="noopener" target="_blank" class="_link">Authy</a>
|
||||||
|
@ -113,6 +115,7 @@ import { i18n } from '@/i18n.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
import MkInfo from '@/components/MkInfo.vue';
|
import MkInfo from '@/components/MkInfo.vue';
|
||||||
|
import MkLink from '@/components/MkLink.vue';
|
||||||
import { confetti } from '@/scripts/confetti.js';
|
import { confetti } from '@/scripts/confetti.js';
|
||||||
import { signinRequired } from '@/account.js';
|
import { signinRequired } from '@/account.js';
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton v-else danger @click="unregisterTOTP">{{ i18n.ts.unregister }}</MkButton>
|
<MkButton v-else danger @click="unregisterTOTP">{{ i18n.ts.unregister }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MkButton v-else-if="!$i.twoFactorEnabled" primary gradate @click="registerTOTP">{{ i18n.ts._2fa.registerTOTP }}</MkButton>
|
<div v-else-if="!$i.twoFactorEnabled" class="_gaps_s">
|
||||||
|
<MkButton primary gradate @click="registerTOTP">{{ i18n.ts._2fa.registerTOTP }}</MkButton>
|
||||||
|
<MkLink url="https://misskey-hub.net/docs/for-users/stepped-guides/how-to-enable-2fa/" target="_blank"><i class="ti ti-help-circle"></i> {{ i18n.ts.learnMore }}</MkLink>
|
||||||
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
|
@ -79,6 +82,7 @@ import MkInfo from '@/components/MkInfo.vue';
|
||||||
import MkSwitch from '@/components/MkSwitch.vue';
|
import MkSwitch from '@/components/MkSwitch.vue';
|
||||||
import FormSection from '@/components/form/section.vue';
|
import FormSection from '@/components/form/section.vue';
|
||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
|
import MkLink from '@/components/MkLink.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { signinRequired, updateAccount } from '@/account.js';
|
import { signinRequired, updateAccount } from '@/account.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
|
@ -44,6 +44,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ i18n.ts.keepOriginalUploading }}</template>
|
<template #label>{{ i18n.ts.keepOriginalUploading }}</template>
|
||||||
<template #caption>{{ i18n.ts.keepOriginalUploadingDescription }}</template>
|
<template #caption>{{ i18n.ts.keepOriginalUploadingDescription }}</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
|
<MkSwitch v-model="keepOriginalFilename">
|
||||||
|
<template #label>{{ i18n.ts.keepOriginalFilename }}</template>
|
||||||
|
<template #caption>{{ i18n.ts.keepOriginalFilenameDescription }}</template>
|
||||||
|
</MkSwitch>
|
||||||
<MkSwitch v-model="alwaysMarkNsfw" @update:modelValue="saveProfile()">
|
<MkSwitch v-model="alwaysMarkNsfw" @update:modelValue="saveProfile()">
|
||||||
<template #label>{{ i18n.ts.alwaysMarkSensitive }}</template>
|
<template #label>{{ i18n.ts.alwaysMarkSensitive }}</template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
|
@ -96,6 +100,7 @@ const meterStyle = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const keepOriginalUploading = computed(defaultStore.makeGetterSetter('keepOriginalUploading'));
|
const keepOriginalUploading = computed(defaultStore.makeGetterSetter('keepOriginalUploading'));
|
||||||
|
const keepOriginalFilename = computed(defaultStore.makeGetterSetter('keepOriginalFilename'));
|
||||||
|
|
||||||
misskeyApi('drive').then(info => {
|
misskeyApi('drive').then(info => {
|
||||||
capacity.value = info.capacity;
|
capacity.value = info.capacity;
|
||||||
|
|
|
@ -165,6 +165,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkSwitch v-model="keepScreenOn">{{ i18n.ts.keepScreenOn }}</MkSwitch>
|
<MkSwitch v-model="keepScreenOn">{{ i18n.ts.keepScreenOn }}</MkSwitch>
|
||||||
<MkSwitch v-model="disableStreamingTimeline">{{ i18n.ts.disableStreamingTimeline }}</MkSwitch>
|
<MkSwitch v-model="disableStreamingTimeline">{{ i18n.ts.disableStreamingTimeline }}</MkSwitch>
|
||||||
<MkSwitch v-model="enableHorizontalSwipe">{{ i18n.ts.enableHorizontalSwipe }}</MkSwitch>
|
<MkSwitch v-model="enableHorizontalSwipe">{{ i18n.ts.enableHorizontalSwipe }}</MkSwitch>
|
||||||
|
<MkSwitch v-model="alwaysConfirmFollow">{{ i18n.ts.alwaysConfirmFollow }}</MkSwitch>
|
||||||
</div>
|
</div>
|
||||||
<MkSelect v-model="serverDisconnectedBehavior">
|
<MkSelect v-model="serverDisconnectedBehavior">
|
||||||
<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
|
<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
|
||||||
|
@ -310,6 +311,7 @@ const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroup
|
||||||
const enableSeasonalScreenEffect = computed(defaultStore.makeGetterSetter('enableSeasonalScreenEffect'));
|
const enableSeasonalScreenEffect = computed(defaultStore.makeGetterSetter('enableSeasonalScreenEffect'));
|
||||||
const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHorizontalSwipe'));
|
const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHorizontalSwipe'));
|
||||||
const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer'));
|
const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer'));
|
||||||
|
const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow'));
|
||||||
|
|
||||||
watch(lang, () => {
|
watch(lang, () => {
|
||||||
miLocalStorage.setItem('lang', lang.value as string);
|
miLocalStorage.setItem('lang', lang.value as string);
|
||||||
|
@ -351,6 +353,7 @@ watch([
|
||||||
keepScreenOn,
|
keepScreenOn,
|
||||||
disableStreamingTimeline,
|
disableStreamingTimeline,
|
||||||
enableSeasonalScreenEffect,
|
enableSeasonalScreenEffect,
|
||||||
|
alwaysConfirmFollow,
|
||||||
], async () => {
|
], async () => {
|
||||||
await reloadAsk();
|
await reloadAsk();
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,6 +26,14 @@ export async function getNoteClipMenu(props: {
|
||||||
isDeleted: Ref<boolean>;
|
isDeleted: Ref<boolean>;
|
||||||
currentClip?: Misskey.entities.Clip;
|
currentClip?: Misskey.entities.Clip;
|
||||||
}) {
|
}) {
|
||||||
|
function getClipName(clip: Misskey.entities.Clip) {
|
||||||
|
if ($i && clip.userId === $i.id && clip.notesCount != null) {
|
||||||
|
return `${clip.name} (${clip.notesCount}/${$i.policies.noteEachClipsLimit})`;
|
||||||
|
} else {
|
||||||
|
return clip.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const isRenote = (
|
const isRenote = (
|
||||||
props.note.renote != null &&
|
props.note.renote != null &&
|
||||||
props.note.text == null &&
|
props.note.text == null &&
|
||||||
|
@ -37,7 +45,7 @@ export async function getNoteClipMenu(props: {
|
||||||
|
|
||||||
const clips = await clipsCache.fetch();
|
const clips = await clipsCache.fetch();
|
||||||
const menu: MenuItem[] = [...clips.map(clip => ({
|
const menu: MenuItem[] = [...clips.map(clip => ({
|
||||||
text: clip.name,
|
text: getClipName(clip),
|
||||||
action: () => {
|
action: () => {
|
||||||
claimAchievement('noteClipped1');
|
claimAchievement('noteClipped1');
|
||||||
os.promiseDialog(
|
os.promiseDialog(
|
||||||
|
@ -50,7 +58,18 @@ export async function getNoteClipMenu(props: {
|
||||||
text: i18n.tsx.confirmToUnclipAlreadyClippedNote({ name: clip.name }),
|
text: i18n.tsx.confirmToUnclipAlreadyClippedNote({ name: clip.name }),
|
||||||
});
|
});
|
||||||
if (!confirm.canceled) {
|
if (!confirm.canceled) {
|
||||||
os.apiWithDialog('clips/remove-note', { clipId: clip.id, noteId: appearNote.id });
|
os.apiWithDialog('clips/remove-note', { clipId: clip.id, noteId: appearNote.id }).then(() => {
|
||||||
|
clipsCache.set(clips.map(c => {
|
||||||
|
if (c.id === clip.id) {
|
||||||
|
return {
|
||||||
|
...c,
|
||||||
|
notesCount: Math.max(0, ((c.notesCount ?? 0) - 1)),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
if (props.currentClip?.id === clip.id) props.isDeleted.value = true;
|
if (props.currentClip?.id === clip.id) props.isDeleted.value = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,7 +79,18 @@ export async function getNoteClipMenu(props: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
).then(() => {
|
||||||
|
clipsCache.set(clips.map(c => {
|
||||||
|
if (c.id === clip.id) {
|
||||||
|
return {
|
||||||
|
...c,
|
||||||
|
notesCount: (c.notesCount ?? 0) + 1,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
})), { type: 'divider' }, {
|
})), { type: 'divider' }, {
|
||||||
icon: 'ti ti-plus',
|
icon: 'ti ti-plus',
|
||||||
|
|
|
@ -15,6 +15,16 @@ const fallbackName = (key: string) => `idbfallback::${key}`;
|
||||||
|
|
||||||
let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && window.indexedDB.open) : true;
|
let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && window.indexedDB.open) : true;
|
||||||
|
|
||||||
|
// iframe.contentWindow.indexedDB.deleteDatabase() がchromeのバグで使用できないため、indexedDBを無効化している。
|
||||||
|
// バグが治って再度有効化するのであれば、cypressのコマンド内のコメントアウトを外すこと
|
||||||
|
// see https://github.com/misskey-dev/misskey/issues/13605#issuecomment-2053652123
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-expect-error
|
||||||
|
if (window.Cypress) {
|
||||||
|
idbAvailable = false;
|
||||||
|
console.log('Cypress detected. It will use localStorage.');
|
||||||
|
}
|
||||||
|
|
||||||
if (idbAvailable) {
|
if (idbAvailable) {
|
||||||
await iset('idb-test', 'test')
|
await iset('idb-test', 'test')
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
|
@ -26,8 +26,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
let top: number;
|
let top: number;
|
||||||
|
|
||||||
if (props.anchorElement) {
|
if (props.anchorElement) {
|
||||||
left = rect.left + window.pageXOffset + (props.anchorElement.offsetWidth / 2);
|
left = rect.left + window.scrollX + (props.anchorElement.offsetWidth / 2);
|
||||||
top = (rect.top + window.pageYOffset - contentHeight) - props.innerMargin;
|
top = (rect.top + window.scrollY - contentHeight) - props.innerMargin;
|
||||||
} else {
|
} else {
|
||||||
left = props.x;
|
left = props.x;
|
||||||
top = (props.y - contentHeight) - props.innerMargin;
|
top = (props.y - contentHeight) - props.innerMargin;
|
||||||
|
@ -35,8 +35,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
|
|
||||||
left -= (el.offsetWidth / 2);
|
left -= (el.offsetWidth / 2);
|
||||||
|
|
||||||
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
|
if (left + contentWidth - window.scrollX > window.innerWidth) {
|
||||||
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
|
left = window.innerWidth - contentWidth + window.scrollX - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [left, top];
|
return [left, top];
|
||||||
|
@ -47,8 +47,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
let top: number;
|
let top: number;
|
||||||
|
|
||||||
if (props.anchorElement) {
|
if (props.anchorElement) {
|
||||||
left = rect.left + window.pageXOffset + (props.anchorElement.offsetWidth / 2);
|
left = rect.left + window.scrollX + (props.anchorElement.offsetWidth / 2);
|
||||||
top = (rect.top + window.pageYOffset + props.anchorElement.offsetHeight) + props.innerMargin;
|
top = (rect.top + window.scrollY + props.anchorElement.offsetHeight) + props.innerMargin;
|
||||||
} else {
|
} else {
|
||||||
left = props.x;
|
left = props.x;
|
||||||
top = (props.y) + props.innerMargin;
|
top = (props.y) + props.innerMargin;
|
||||||
|
@ -56,8 +56,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
|
|
||||||
left -= (el.offsetWidth / 2);
|
left -= (el.offsetWidth / 2);
|
||||||
|
|
||||||
if (left + contentWidth - window.pageXOffset > window.innerWidth) {
|
if (left + contentWidth - window.scrollX > window.innerWidth) {
|
||||||
left = window.innerWidth - contentWidth + window.pageXOffset - 1;
|
left = window.innerWidth - contentWidth + window.scrollX - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [left, top];
|
return [left, top];
|
||||||
|
@ -68,8 +68,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
let top: number;
|
let top: number;
|
||||||
|
|
||||||
if (props.anchorElement) {
|
if (props.anchorElement) {
|
||||||
left = (rect.left + window.pageXOffset - contentWidth) - props.innerMargin;
|
left = (rect.left + window.scrollX - contentWidth) - props.innerMargin;
|
||||||
top = rect.top + window.pageYOffset + (props.anchorElement.offsetHeight / 2);
|
top = rect.top + window.scrollY + (props.anchorElement.offsetHeight / 2);
|
||||||
} else {
|
} else {
|
||||||
left = (props.x - contentWidth) - props.innerMargin;
|
left = (props.x - contentWidth) - props.innerMargin;
|
||||||
top = props.y;
|
top = props.y;
|
||||||
|
@ -77,8 +77,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
|
|
||||||
top -= (el.offsetHeight / 2);
|
top -= (el.offsetHeight / 2);
|
||||||
|
|
||||||
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
|
if (top + contentHeight - window.scrollY > window.innerHeight) {
|
||||||
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
|
top = window.innerHeight - contentHeight + window.scrollY - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [left, top];
|
return [left, top];
|
||||||
|
@ -89,15 +89,15 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
let top: number;
|
let top: number;
|
||||||
|
|
||||||
if (props.anchorElement) {
|
if (props.anchorElement) {
|
||||||
left = (rect.left + props.anchorElement.offsetWidth + window.pageXOffset) + props.innerMargin;
|
left = (rect.left + props.anchorElement.offsetWidth + window.scrollX) + props.innerMargin;
|
||||||
|
|
||||||
if (props.align === 'top') {
|
if (props.align === 'top') {
|
||||||
top = rect.top + window.pageYOffset;
|
top = rect.top + window.scrollY;
|
||||||
if (props.alignOffset != null) top += props.alignOffset;
|
if (props.alignOffset != null) top += props.alignOffset;
|
||||||
} else if (props.align === 'bottom') {
|
} else if (props.align === 'bottom') {
|
||||||
// TODO
|
// TODO
|
||||||
} else { // center
|
} else { // center
|
||||||
top = rect.top + window.pageYOffset + (props.anchorElement.offsetHeight / 2);
|
top = rect.top + window.scrollY + (props.anchorElement.offsetHeight / 2);
|
||||||
top -= (el.offsetHeight / 2);
|
top -= (el.offsetHeight / 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,8 +106,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
top -= (el.offsetHeight / 2);
|
top -= (el.offsetHeight / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top + contentHeight - window.pageYOffset > window.innerHeight) {
|
if (top + contentHeight - window.scrollY > window.innerHeight) {
|
||||||
top = window.innerHeight - contentHeight + window.pageYOffset - 1;
|
top = window.innerHeight - contentHeight + window.scrollY - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [left, top];
|
return [left, top];
|
||||||
|
@ -123,7 +123,7 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
const [left, top] = calcPosWhenTop();
|
const [left, top] = calcPosWhenTop();
|
||||||
|
|
||||||
// ツールチップを上に向かって表示するスペースがなければ下に向かって出す
|
// ツールチップを上に向かって表示するスペースがなければ下に向かって出す
|
||||||
if (top - window.pageYOffset < 0) {
|
if (top - window.scrollY < 0) {
|
||||||
const [left, top] = calcPosWhenBottom();
|
const [left, top] = calcPosWhenBottom();
|
||||||
return { left, top, transformOrigin: 'center top' };
|
return { left, top, transformOrigin: 'center top' };
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ export function calcPopupPosition(el: HTMLElement, props: {
|
||||||
const [left, top] = calcPosWhenLeft();
|
const [left, top] = calcPosWhenLeft();
|
||||||
|
|
||||||
// ツールチップを左に向かって表示するスペースがなければ右に向かって出す
|
// ツールチップを左に向かって表示するスペースがなければ右に向かって出す
|
||||||
if (left - window.pageXOffset < 0) {
|
if (left - window.scrollX < 0) {
|
||||||
const [left, top] = calcPosWhenRight();
|
const [left, top] = calcPosWhenRight();
|
||||||
return { left, top, transformOrigin: 'left center' };
|
return { left, top, transformOrigin: 'left center' };
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { v4 as uuid } from 'uuid';
|
||||||
import { readAndCompressImage } from '@misskey-dev/browser-image-resizer';
|
import { readAndCompressImage } from '@misskey-dev/browser-image-resizer';
|
||||||
import { getCompressionConfig } from './upload/compress-config.js';
|
import { getCompressionConfig } from './upload/compress-config.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
@ -39,13 +40,16 @@ export function uploadFile(
|
||||||
if (folder && typeof folder === 'object') folder = folder.id;
|
if (folder && typeof folder === 'object') folder = folder.id;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const id = Math.random().toString();
|
const id = uuid();
|
||||||
|
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = async (): Promise<void> => {
|
reader.onload = async (): Promise<void> => {
|
||||||
|
const filename = name ?? file.name ?? 'untitled';
|
||||||
|
const extension = filename.split('.').length > 1 ? '.' + filename.split('.').pop() : '';
|
||||||
|
|
||||||
const ctx = reactive<Uploading>({
|
const ctx = reactive<Uploading>({
|
||||||
id: id,
|
id,
|
||||||
name: name ?? file.name ?? 'untitled',
|
name: defaultStore.state.keepOriginalFilename ? filename : id + extension,
|
||||||
progressMax: undefined,
|
progressMax: undefined,
|
||||||
progressValue: undefined,
|
progressValue: undefined,
|
||||||
img: window.URL.createObjectURL(file),
|
img: window.URL.createObjectURL(file),
|
||||||
|
|
|
@ -53,11 +53,11 @@ export function useChartTooltip(opts: { position: 'top' | 'middle' } = { positio
|
||||||
const rect = context.chart.canvas.getBoundingClientRect();
|
const rect = context.chart.canvas.getBoundingClientRect();
|
||||||
|
|
||||||
tooltipShowing.value = true;
|
tooltipShowing.value = true;
|
||||||
tooltipX.value = rect.left + window.pageXOffset + context.tooltip.caretX;
|
tooltipX.value = rect.left + window.scrollX + context.tooltip.caretX;
|
||||||
if (opts.position === 'top') {
|
if (opts.position === 'top') {
|
||||||
tooltipY.value = rect.top + window.pageYOffset;
|
tooltipY.value = rect.top + window.scrollY;
|
||||||
} else if (opts.position === 'middle') {
|
} else if (opts.position === 'middle') {
|
||||||
tooltipY.value = rect.top + window.pageYOffset + context.tooltip.caretY;
|
tooltipY.value = rect.top + window.scrollY + context.tooltip.caretY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,6 +446,14 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
keepOriginalFilename: {
|
||||||
|
where: 'device',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
alwaysConfirmFollow: {
|
||||||
|
where: 'device',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
|
||||||
sound_masterVolume: {
|
sound_masterVolume: {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
|
|
|
@ -68,9 +68,9 @@ watch(showColon, (v) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const tick = () => {
|
const tick = () => {
|
||||||
const now = new Date();
|
const now = Date.now();
|
||||||
ss.value = Math.floor(now.getTime() / 1000).toString();
|
ss.value = Math.floor(now / 1000).toString();
|
||||||
ms.value = Math.floor(now.getTime() % 1000 / 10).toString().padStart(2, '0');
|
ms.value = Math.floor(now % 1000 / 10).toString().padStart(2, '0');
|
||||||
if (ss.value !== prevSec) showColon.value = true;
|
if (ss.value !== prevSec) showColon.value = true;
|
||||||
prevSec = ss.value;
|
prevSec = ss.value;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1713,6 +1713,7 @@ declare namespace entities {
|
||||||
RoleCondFormulaLogics,
|
RoleCondFormulaLogics,
|
||||||
RoleCondFormulaValueNot,
|
RoleCondFormulaValueNot,
|
||||||
RoleCondFormulaValueIsLocalOrRemote,
|
RoleCondFormulaValueIsLocalOrRemote,
|
||||||
|
RoleCondFormulaValueUserSettingBooleanSchema,
|
||||||
RoleCondFormulaValueAssignedRole,
|
RoleCondFormulaValueAssignedRole,
|
||||||
RoleCondFormulaValueCreated,
|
RoleCondFormulaValueCreated,
|
||||||
RoleCondFormulaFollowersOrFollowingOrNotes,
|
RoleCondFormulaFollowersOrFollowingOrNotes,
|
||||||
|
@ -2745,6 +2746,9 @@ type RoleCondFormulaValueIsLocalOrRemote = components['schemas']['RoleCondFormul
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type RoleCondFormulaValueNot = components['schemas']['RoleCondFormulaValueNot'];
|
type RoleCondFormulaValueNot = components['schemas']['RoleCondFormulaValueNot'];
|
||||||
|
|
||||||
|
// @public (undocumented)
|
||||||
|
type RoleCondFormulaValueUserSettingBooleanSchema = components['schemas']['RoleCondFormulaValueUserSettingBooleanSchema'];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type RoleLite = components['schemas']['RoleLite'];
|
type RoleLite = components['schemas']['RoleLite'];
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ export type Signin = components['schemas']['Signin'];
|
||||||
export type RoleCondFormulaLogics = components['schemas']['RoleCondFormulaLogics'];
|
export type RoleCondFormulaLogics = components['schemas']['RoleCondFormulaLogics'];
|
||||||
export type RoleCondFormulaValueNot = components['schemas']['RoleCondFormulaValueNot'];
|
export type RoleCondFormulaValueNot = components['schemas']['RoleCondFormulaValueNot'];
|
||||||
export type RoleCondFormulaValueIsLocalOrRemote = components['schemas']['RoleCondFormulaValueIsLocalOrRemote'];
|
export type RoleCondFormulaValueIsLocalOrRemote = components['schemas']['RoleCondFormulaValueIsLocalOrRemote'];
|
||||||
|
export type RoleCondFormulaValueUserSettingBooleanSchema = components['schemas']['RoleCondFormulaValueUserSettingBooleanSchema'];
|
||||||
export type RoleCondFormulaValueAssignedRole = components['schemas']['RoleCondFormulaValueAssignedRole'];
|
export type RoleCondFormulaValueAssignedRole = components['schemas']['RoleCondFormulaValueAssignedRole'];
|
||||||
export type RoleCondFormulaValueCreated = components['schemas']['RoleCondFormulaValueCreated'];
|
export type RoleCondFormulaValueCreated = components['schemas']['RoleCondFormulaValueCreated'];
|
||||||
export type RoleCondFormulaFollowersOrFollowingOrNotes = components['schemas']['RoleCondFormulaFollowersOrFollowingOrNotes'];
|
export type RoleCondFormulaFollowersOrFollowingOrNotes = components['schemas']['RoleCondFormulaFollowersOrFollowingOrNotes'];
|
||||||
|
|
|
@ -4460,6 +4460,7 @@ export type components = {
|
||||||
isPublic: boolean;
|
isPublic: boolean;
|
||||||
favoritedCount: number;
|
favoritedCount: number;
|
||||||
isFavorited?: boolean;
|
isFavorited?: boolean;
|
||||||
|
notesCount?: number;
|
||||||
};
|
};
|
||||||
FederationInstance: {
|
FederationInstance: {
|
||||||
/** Format: id */
|
/** Format: id */
|
||||||
|
@ -4585,6 +4586,11 @@ export type components = {
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
type: 'isLocal' | 'isRemote';
|
type: 'isLocal' | 'isRemote';
|
||||||
};
|
};
|
||||||
|
RoleCondFormulaValueUserSettingBooleanSchema: {
|
||||||
|
id: string;
|
||||||
|
/** @enum {string} */
|
||||||
|
type: 'isSuspended' | 'isLocked' | 'isBot' | 'isCat' | 'isExplorable';
|
||||||
|
};
|
||||||
RoleCondFormulaValueAssignedRole: {
|
RoleCondFormulaValueAssignedRole: {
|
||||||
id: string;
|
id: string;
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
|
@ -4607,7 +4613,7 @@ export type components = {
|
||||||
type: 'followersLessThanOrEq' | 'followersMoreThanOrEq' | 'followingLessThanOrEq' | 'followingMoreThanOrEq' | 'notesLessThanOrEq' | 'notesMoreThanOrEq';
|
type: 'followersLessThanOrEq' | 'followersMoreThanOrEq' | 'followingLessThanOrEq' | 'followingMoreThanOrEq' | 'notesLessThanOrEq' | 'notesMoreThanOrEq';
|
||||||
value: number;
|
value: number;
|
||||||
};
|
};
|
||||||
RoleCondFormulaValue: components['schemas']['RoleCondFormulaLogics'] | components['schemas']['RoleCondFormulaValueNot'] | components['schemas']['RoleCondFormulaValueIsLocalOrRemote'] | components['schemas']['RoleCondFormulaValueAssignedRole'] | components['schemas']['RoleCondFormulaValueCreated'] | components['schemas']['RoleCondFormulaFollowersOrFollowingOrNotes'];
|
RoleCondFormulaValue: components['schemas']['RoleCondFormulaLogics'] | components['schemas']['RoleCondFormulaValueNot'] | components['schemas']['RoleCondFormulaValueIsLocalOrRemote'] | components['schemas']['RoleCondFormulaValueUserSettingBooleanSchema'] | components['schemas']['RoleCondFormulaValueAssignedRole'] | components['schemas']['RoleCondFormulaValueCreated'] | components['schemas']['RoleCondFormulaFollowersOrFollowingOrNotes'];
|
||||||
RoleLite: {
|
RoleLite: {
|
||||||
/**
|
/**
|
||||||
* Format: id
|
* Format: id
|
||||||
|
|
|
@ -76,7 +76,7 @@ globalThis.addEventListener('push', ev => {
|
||||||
case 'notification':
|
case 'notification':
|
||||||
case 'unreadAntennaNote':
|
case 'unreadAntennaNote':
|
||||||
// 1日以上経過している場合は無視
|
// 1日以上経過している場合は無視
|
||||||
if ((new Date()).getTime() - data.dateTime > 1000 * 60 * 60 * 24) break;
|
if (Date.now() - data.dateTime > 1000 * 60 * 60 * 24) break;
|
||||||
|
|
||||||
return createNotification(data);
|
return createNotification(data);
|
||||||
case 'readAllNotifications':
|
case 'readAllNotifications':
|
||||||
|
|
|
@ -722,8 +722,8 @@ importers:
|
||||||
specifier: 3.4.21
|
specifier: 3.4.21
|
||||||
version: 3.4.21
|
version: 3.4.21
|
||||||
aiscript-vscode:
|
aiscript-vscode:
|
||||||
specifier: github:aiscript-dev/aiscript-vscode#v0.1.2
|
specifier: github:aiscript-dev/aiscript-vscode#v0.1.4
|
||||||
version: github.com/aiscript-dev/aiscript-vscode/793211d40243c8775f6b85f015c221c82cbffb07
|
version: github.com/aiscript-dev/aiscript-vscode/3f79d6f0550369267220aa67702287948d885424
|
||||||
astring:
|
astring:
|
||||||
specifier: 1.8.6
|
specifier: 1.8.6
|
||||||
version: 1.8.6
|
version: 1.8.6
|
||||||
|
@ -5012,7 +5012,7 @@ packages:
|
||||||
resolution: {integrity: sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==}
|
resolution: {integrity: sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==}
|
||||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@nsfw-filter/gif-frames@1.0.2:
|
/@nsfw-filter/gif-frames@1.0.2:
|
||||||
|
@ -6681,7 +6681,7 @@ packages:
|
||||||
ts-dedent: 2.2.0
|
ts-dedent: 2.2.0
|
||||||
type-fest: 2.19.0
|
type-fest: 2.19.0
|
||||||
vue: 3.4.21(typescript@5.3.3)
|
vue: 3.4.21(typescript@5.3.3)
|
||||||
vue-component-type-helpers: 2.0.6
|
vue-component-type-helpers: 2.0.10
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- encoding
|
- encoding
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -10602,7 +10602,7 @@ packages:
|
||||||
'@one-ini/wasm': 0.1.1
|
'@one-ini/wasm': 0.1.1
|
||||||
commander: 10.0.1
|
commander: 10.0.1
|
||||||
minimatch: 9.0.1
|
minimatch: 9.0.1
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ee-first@1.1.1:
|
/ee-first@1.1.1:
|
||||||
|
@ -13132,7 +13132,7 @@ packages:
|
||||||
'@babel/parser': 7.23.9
|
'@babel/parser': 7.23.9
|
||||||
'@istanbuljs/schema': 0.1.3
|
'@istanbuljs/schema': 0.1.3
|
||||||
istanbul-lib-coverage: 3.2.2
|
istanbul-lib-coverage: 3.2.2
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -14128,7 +14128,7 @@ packages:
|
||||||
resolution: {integrity: sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==}
|
resolution: {integrity: sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==}
|
||||||
engines: {node: 14 || >=16.14}
|
engines: {node: 14 || >=16.14}
|
||||||
dependencies:
|
dependencies:
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
|
|
||||||
/lru-cache@4.1.5:
|
/lru-cache@4.1.5:
|
||||||
resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==}
|
resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==}
|
||||||
|
@ -14199,7 +14199,7 @@ packages:
|
||||||
resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
|
resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
dependencies:
|
dependencies:
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/make-fetch-happen@13.0.0:
|
/make-fetch-happen@13.0.0:
|
||||||
|
@ -15310,7 +15310,7 @@ packages:
|
||||||
dependencies:
|
dependencies:
|
||||||
hosted-git-info: 4.1.0
|
hosted-git-info: 4.1.0
|
||||||
is-core-module: 2.13.1
|
is-core-module: 2.13.1
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
validate-npm-package-license: 3.0.4
|
validate-npm-package-license: 3.0.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
@ -17453,7 +17453,6 @@ packages:
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache: 6.0.0
|
lru-cache: 6.0.0
|
||||||
dev: true
|
|
||||||
|
|
||||||
/send@0.18.0:
|
/send@0.18.0:
|
||||||
resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==}
|
resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==}
|
||||||
|
@ -19306,7 +19305,7 @@ packages:
|
||||||
engines: {vscode: ^1.82.0}
|
engines: {vscode: ^1.82.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
minimatch: 5.1.2
|
minimatch: 5.1.2
|
||||||
semver: 7.5.4
|
semver: 7.6.0
|
||||||
vscode-languageserver-protocol: 3.17.5
|
vscode-languageserver-protocol: 3.17.5
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
@ -19355,8 +19354,8 @@ packages:
|
||||||
resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==}
|
resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vue-component-type-helpers@2.0.6:
|
/vue-component-type-helpers@2.0.10:
|
||||||
resolution: {integrity: sha512-qdGXCtoBrwqk1BT6r2+1Wcvl583ZVkuSZ3or7Y1O2w5AvWtlvvxwjGhmz5DdPJS9xqRdDlgTJ/38ehWnEi0tFA==}
|
resolution: {integrity: sha512-FC5fKJjDks3Ue/KRSYBdsiCaZa0kUPQfs8yQpb8W9mlO6BenV8G1z58xobeRMzevnmEcDa09LLwuXDwb4f6NMQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vue-demi@0.14.7(vue@3.4.21):
|
/vue-demi@0.14.7(vue@3.4.21):
|
||||||
|
@ -19878,10 +19877,10 @@ packages:
|
||||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
'@github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.5/aiscript-dev-aiscript-languageserver-0.1.5.tgz':
|
'@github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.6/aiscript-dev-aiscript-languageserver-0.1.6.tgz':
|
||||||
resolution: {tarball: https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.5/aiscript-dev-aiscript-languageserver-0.1.5.tgz}
|
resolution: {tarball: https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.6/aiscript-dev-aiscript-languageserver-0.1.6.tgz}
|
||||||
name: '@aiscript-dev/aiscript-languageserver'
|
name: '@aiscript-dev/aiscript-languageserver'
|
||||||
version: 0.1.5
|
version: 0.1.6
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
seedrandom: 3.0.5
|
seedrandom: 3.0.5
|
||||||
|
@ -19891,13 +19890,13 @@ packages:
|
||||||
vscode-languageserver-textdocument: 1.0.11
|
vscode-languageserver-textdocument: 1.0.11
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
github.com/aiscript-dev/aiscript-vscode/793211d40243c8775f6b85f015c221c82cbffb07:
|
github.com/aiscript-dev/aiscript-vscode/3f79d6f0550369267220aa67702287948d885424:
|
||||||
resolution: {tarball: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/793211d40243c8775f6b85f015c221c82cbffb07}
|
resolution: {tarball: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/3f79d6f0550369267220aa67702287948d885424}
|
||||||
name: aiscript-vscode
|
name: aiscript-vscode
|
||||||
version: 0.1.2
|
version: 0.1.4
|
||||||
engines: {vscode: ^1.83.0}
|
engines: {vscode: ^1.83.0}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@aiscript-dev/aiscript-languageserver': '@github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.5/aiscript-dev-aiscript-languageserver-0.1.5.tgz'
|
'@aiscript-dev/aiscript-languageserver': '@github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.6/aiscript-dev-aiscript-languageserver-0.1.6.tgz'
|
||||||
vscode-languageclient: 9.0.1
|
vscode-languageclient: 9.0.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue