Merge branch 'misskey-dev:develop' into develop
This commit is contained in:
commit
b4da44bd44
141
.github/workflows/check-misskey-js-autogen.yml
vendored
141
.github/workflows/check-misskey-js-autogen.yml
vendored
@ -5,24 +5,23 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- improve-misskey-js-autogen-check
|
||||
paths:
|
||||
- packages/backend/**
|
||||
|
||||
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
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
api_json_name: "api-head.json"
|
||||
|
||||
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:
|
||||
submodules: true
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
@ -39,79 +38,81 @@ jobs:
|
||||
- name: install dependencies
|
||||
run: pnpm i --frozen-lockfile
|
||||
|
||||
- name: wait get-api-diff
|
||||
uses: lewagon/wait-on-check-action@v1.3.3
|
||||
# generate api.json
|
||||
- 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:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
check-regexp: get-from-misskey .+
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-interval: 30
|
||||
name: generated-misskey-js
|
||||
path: packages/misskey-js/generator/built/autogen
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/github-script@v7.0.1
|
||||
# pull_request_target safety: permissions: read-all, and there are no secrets used in this job
|
||||
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:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
submodules: true
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
|
||||
const workflows = await github.rest.actions.listWorkflowRunsForRepo({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
head_sha: `${{ github.event.pull_request.head.sha }}`
|
||||
}).then(x => x.data.workflow_runs);
|
||||
- name: Upload From Merged
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: actual-misskey-js
|
||||
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({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: run_id,
|
||||
});
|
||||
- name: check misskey-js changes
|
||||
id: check-changes
|
||||
run: |
|
||||
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) => {
|
||||
return artifact.name.startsWith("api-artifact-") || artifact.name == "api-artifact"
|
||||
});
|
||||
if [ -s misskey-js.diff ]; then
|
||||
echo "changes=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
await Promise.all(matchArtifacts.map(async (artifact) => {
|
||||
let download = await github.rest.actions.downloadArtifact({
|
||||
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: Print full diff
|
||||
run: cat ./misskey-js.diff
|
||||
|
||||
- name: send message
|
||||
if: failure()
|
||||
if: steps.check-changes.outputs.changes == 'true'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: check-misskey-js-autogen
|
||||
@ -125,7 +126,7 @@ jobs:
|
||||
```
|
||||
|
||||
- name: send message
|
||||
if: success()
|
||||
if: steps.check-changes.outputs.changes == 'false'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: check-misskey-js-autogen
|
||||
|
@ -50,12 +50,9 @@ jobs:
|
||||
|
||||
- name: Get PR ref
|
||||
id: get-ref
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
PR_NUMBER=$(jq --raw-output .issue.number $GITHUB_EVENT_PATH)
|
||||
PR_REF=$(gh pr view $PR_NUMBER --json headRefName -q '.headRefName')
|
||||
echo "pr-ref=$PR_REF" > $GITHUB_OUTPUT
|
||||
PR_REF="refs/pull/${{ github.event.issue.number }}/head"
|
||||
echo "pr-ref=$PR_REF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Extract wait time
|
||||
id: get-wait-time
|
||||
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@ -92,6 +92,6 @@ jobs:
|
||||
- run: pnpm i --frozen-lockfile
|
||||
- run: pnpm --filter misskey-js run build
|
||||
if: ${{ matrix.workspace == 'backend' }}
|
||||
- run: pnpm --filter misskey-reversi run build:tsc
|
||||
- run: pnpm --filter misskey-reversi run build
|
||||
if: ${{ matrix.workspace == 'backend' }}
|
||||
- run: pnpm --filter ${{ matrix.workspace }} run typecheck
|
||||
|
7
.github/workflows/storybook.yml
vendored
7
.github/workflows/storybook.yml
vendored
@ -87,12 +87,13 @@ jobs:
|
||||
if [ "$CHROMATIC_PARAMETER" = " --skip" ]; then
|
||||
echo "skip=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
BRANCH="${{ github.event.pull_request.head.user.login }}:${{ github.event.pull_request.head.ref }}"
|
||||
if [ "$BRANCH" = "misskey-dev:${{ github.event.pull_request.head.ref }}" ]; then
|
||||
BRANCH="${{ github.event.pull_request.head.ref }}"
|
||||
BRANCH="${{ github.event.pull_request.head.user.login }}:$HEAD_REF"
|
||||
if [ "$BRANCH" = "misskey-dev:$HEAD_REF" ]; then
|
||||
BRANCH="$HEAD_REF"
|
||||
fi
|
||||
pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name $BRANCH $(echo "$CHROMATIC_PARAMETER")
|
||||
env:
|
||||
HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
||||
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
||||
- name: Notify that Chromatic detects changes
|
||||
uses: actions/github-script@v7.0.1
|
||||
|
2
.github/workflows/test-backend.yml
vendored
2
.github/workflows/test-backend.yml
vendored
@ -45,6 +45,8 @@ jobs:
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
- name: Install FFmpeg
|
||||
uses: FedericoCarboni/setup-ffmpeg@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4.0.2
|
||||
with:
|
||||
|
48
CHANGELOG.md
48
CHANGELOG.md
@ -1,21 +1,69 @@
|
||||
## Unreleased
|
||||
|
||||
### Note
|
||||
- コントロールパネル内にあるサマリープロキシの設定個所がセキュリティから全般へ変更となります。
|
||||
|
||||
### General
|
||||
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
|
||||
- Enhance: アンテナでBotによるノートを除外できるように
|
||||
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/545)
|
||||
- Enhance: クリップのノート数を表示するように
|
||||
- Enhance: コンディショナルロールの条件として以下を新たに追加 (#13667)
|
||||
- 猫ユーザーか
|
||||
- botユーザーか
|
||||
- サスペンド済みユーザーか
|
||||
- 鍵アカウントユーザーか
|
||||
- 「アカウントを見つけやすくする」が有効なユーザーか
|
||||
- Fix: Play作成時に設定した公開範囲が機能していない問題を修正
|
||||
|
||||
### Client
|
||||
- Feat: アップロードするファイルの名前をランダム文字列にできるように
|
||||
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
|
||||
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
|
||||
- Enhance: リアクション・いいねの総数を表示するように
|
||||
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
|
||||
- Enhance: 設定>プラグインのページからプラグインの簡易的なログやエラーを見られるように
|
||||
- 実装の都合により、プラグインは1つエラーを起こした時に即時停止するようになりました
|
||||
- Enhance: ページのデザインを変更
|
||||
- Enhance: 2要素認証(ワンタイムパスワード)の入力欄を改善
|
||||
- Enhance: 「今日誕生日のフォロー中ユーザー」ウィジェットを手動でリロードできるように
|
||||
- Enhance: 映像・音声の再生にブラウザのネイティブプレイヤーを使用できるように
|
||||
- Enhance: 映像・音声の再生メニューに「再生速度」「ループ再生」「ピクチャインピクチャ」を追加
|
||||
- Enhance: 映像・音声の再生にキーボードショートカットが使えるように
|
||||
- Enhance: ノートについているリアクションの「もっと!」から、リアクションの一覧を表示できるように
|
||||
- Enhance: リプライにて引用がある場合テキストが空でもノートできるように
|
||||
- 引用したいノートのURLをコピーしリプライ投稿画面にペーストして添付することで達成できます
|
||||
- Enhance: フォローするかどうかの確認ダイアログを出せるように
|
||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
||||
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
||||
- Fix: WebGL2をサポートしないブラウザで「季節に応じた画面の演出」が有効になっているとき、Misskeyが起動できなくなる問題を修正
|
||||
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/459)
|
||||
- Fix: ページタイトルでローカルユーザーとリモートユーザーの区別がつかない問題を修正
|
||||
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/528)
|
||||
- Fix: コードブロックのシンタックスハイライトで使用される定義ファイルをCDNから取得するように #13177
|
||||
- CDNから取得せずMisskey本体にバンドルする場合は`pacakges/frontend/vite.config.ts`を修正してください。
|
||||
- Fix: タイムゾーンによっては、「今日誕生日のフォロー中ユーザー」ウィジェットが正しく動作しない問題を修正
|
||||
- Fix: CWのみの引用リノートが詳細ページで純粋なリノートとして誤って扱われてしまう問題を修正
|
||||
- Fix: ノート詳細ページにおいてCW付き引用リノートのCWボタンのラベルに「引用」が含まれていない問題を修正
|
||||
- Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正
|
||||
- Fix: ダイレクト投稿の宛先が保存されない問題を修正
|
||||
|
||||
### Server
|
||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
||||
- Enhance: misskey-dev/summaly@5.1.0の取り込み(プレビュー生成処理の効率化)
|
||||
- Fix: フォローリクエストを作成する際に既存のものは削除するように
|
||||
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
|
||||
- Fix: エンドポイント`notes/translate`のエラーを改善
|
||||
- Fix: CleanRemoteFilesProcessorService report progress from 100% (#13632)
|
||||
- Fix: 一部の音声ファイルが映像ファイルとして扱われる問題を修正
|
||||
- Fix: リプライのみの引用リノートと、CWのみの引用リノートが純粋なリノートとして誤って扱われてしまう問題を修正
|
||||
- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように
|
||||
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
|
||||
- Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正
|
||||
- Fix: 一部のタイムラインのストリーミングでインスタンスミュートが効かない問題を修正
|
||||
- Fix: グローバルタイムラインで返信が表示されないことがある問題を修正
|
||||
- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
|
||||
|
||||
## 2024.3.1
|
||||
|
||||
|
@ -30,9 +30,13 @@ Cypress.Commands.add('visitHome', () => {
|
||||
})
|
||||
|
||||
Cypress.Commands.add('resetState', () => {
|
||||
cy.window(win => {
|
||||
// iframe.contentWindow.indexedDB.deleteDatabase() がchromeのバグで使用できないため、indexedDBを無効化している。
|
||||
// see https://github.com/misskey-dev/misskey/issues/13605#issuecomment-2053652123
|
||||
/*
|
||||
cy.window().then(win => {
|
||||
win.indexedDB.deleteDatabase('keyval-store');
|
||||
});
|
||||
*/
|
||||
cy.request('POST', '/api/reset-db', {}).as('reset');
|
||||
cy.get('@reset').its('status').should('equal', 204);
|
||||
cy.reload(true);
|
19
cypress/support/index.ts
Normal file
19
cypress/support/index.ts
Normal file
@ -0,0 +1,19 @@
|
||||
declare global {
|
||||
namespace Cypress {
|
||||
interface Chainable {
|
||||
login(username: string, password: string): Chainable<void>;
|
||||
|
||||
registerUser(
|
||||
username: string,
|
||||
password: string,
|
||||
isAdmin?: boolean
|
||||
): Chainable<void>;
|
||||
|
||||
resetState(): Chainable<void>;
|
||||
|
||||
visitHome(): Chainable<void>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
8
cypress/tsconfig.json
Normal file
8
cypress/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "es5"],
|
||||
"target": "es5",
|
||||
"types": ["cypress", "node"]
|
||||
},
|
||||
"include": ["./**/*.ts"]
|
||||
}
|
146
locales/index.d.ts
vendored
146
locales/index.d.ts
vendored
@ -1616,6 +1616,10 @@ export interface Locale extends ILocale {
|
||||
* 除外キーワード
|
||||
*/
|
||||
"antennaExcludeKeywords": string;
|
||||
/**
|
||||
* Botアカウントを除外
|
||||
*/
|
||||
"antennaExcludeBots": string;
|
||||
/**
|
||||
* スペースで区切るとAND指定になり、改行で区切るとOR指定になります
|
||||
*/
|
||||
@ -4912,6 +4916,42 @@ export interface Locale extends ILocale {
|
||||
* リトライ
|
||||
*/
|
||||
"gameRetry": string;
|
||||
/**
|
||||
* 使用しない場合は空欄にしてください
|
||||
*/
|
||||
"notUsePleaseLeaveBlank": string;
|
||||
/**
|
||||
* ワンタイムパスワードを使う
|
||||
*/
|
||||
"useTotp": string;
|
||||
/**
|
||||
* バックアップコードを使う
|
||||
*/
|
||||
"useBackupCode": string;
|
||||
/**
|
||||
* アプリを起動
|
||||
*/
|
||||
"launchApp": string;
|
||||
/**
|
||||
* 動画・音声の再生にブラウザのUIを使用する
|
||||
*/
|
||||
"useNativeUIForVideoAudioPlayer": string;
|
||||
/**
|
||||
* オリジナルのファイル名を保持
|
||||
*/
|
||||
"keepOriginalFilename": string;
|
||||
/**
|
||||
* この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。
|
||||
*/
|
||||
"keepOriginalFilenameDescription": string;
|
||||
/**
|
||||
* 説明文はありません
|
||||
*/
|
||||
"noDescription": string;
|
||||
/**
|
||||
* フォローの際常に確認する
|
||||
*/
|
||||
"alwaysConfirmFollow": string;
|
||||
"_bubbleGame": {
|
||||
/**
|
||||
* 遊び方
|
||||
@ -6552,6 +6592,26 @@ export interface Locale extends ILocale {
|
||||
* リモートユーザー
|
||||
*/
|
||||
"isRemote": string;
|
||||
/**
|
||||
* 猫ユーザー
|
||||
*/
|
||||
"isCat": string;
|
||||
/**
|
||||
* botユーザー
|
||||
*/
|
||||
"isBot": string;
|
||||
/**
|
||||
* サスペンド済みユーザー
|
||||
*/
|
||||
"isSuspended": string;
|
||||
/**
|
||||
* 鍵アカウントユーザー
|
||||
*/
|
||||
"isLocked": string;
|
||||
/**
|
||||
* 「アカウントを見つけやすくする」が有効なユーザー
|
||||
*/
|
||||
"isExplorable": string;
|
||||
/**
|
||||
* アカウント作成から~以内
|
||||
*/
|
||||
@ -7526,13 +7586,9 @@ export interface Locale extends ILocale {
|
||||
*/
|
||||
"step1": ParameterizedString<"a" | "b">;
|
||||
/**
|
||||
* 次に、表示されているQRコードをアプリでスキャンします。
|
||||
* 次に、表示されているQRコードをアプリでスキャンするか、ボタンをクリックして端末上でアプリを開きます。
|
||||
*/
|
||||
"step2": string;
|
||||
/**
|
||||
* QRコードをクリックすると、お使いの端末にインストールされている認証アプリやキーリングに登録できます。
|
||||
*/
|
||||
"step2Click": string;
|
||||
/**
|
||||
* デスクトップアプリを使用する場合は次のURIを入力します
|
||||
*/
|
||||
@ -7625,6 +7681,10 @@ export interface Locale extends ILocale {
|
||||
* バックアップコードが全て使用されました。認証アプリを利用できない場合、これ以上アカウントにアクセスできなくなります。認証アプリを再登録してください。
|
||||
*/
|
||||
"backupCodesExhaustedWarning": string;
|
||||
/**
|
||||
* 詳細なガイドはこちら
|
||||
*/
|
||||
"moreDetailedGuideHere": string;
|
||||
};
|
||||
"_permissions": {
|
||||
/**
|
||||
@ -8810,6 +8870,14 @@ export interface Locale extends ILocale {
|
||||
* ボタン
|
||||
*/
|
||||
"button": string;
|
||||
/**
|
||||
* 動的ブロック
|
||||
*/
|
||||
"dynamic": string;
|
||||
/**
|
||||
* このブロックは廃止されています。今後は{play}を利用してください。
|
||||
*/
|
||||
"dynamicDescription": ParameterizedString<"play">;
|
||||
/**
|
||||
* ノート埋め込み
|
||||
*/
|
||||
@ -9764,6 +9832,74 @@ export interface Locale extends ILocale {
|
||||
*/
|
||||
"header": string;
|
||||
};
|
||||
"_urlPreviewSetting": {
|
||||
/**
|
||||
* URLプレビューの設定
|
||||
*/
|
||||
"title": string;
|
||||
/**
|
||||
* URLプレビューを有効にする
|
||||
*/
|
||||
"enable": string;
|
||||
/**
|
||||
* プレビュー取得時のタイムアウト(ms)
|
||||
*/
|
||||
"timeout": string;
|
||||
/**
|
||||
* プレビュー取得の所要時間がこの値を超えた場合、プレビューは生成されません。
|
||||
*/
|
||||
"timeoutDescription": string;
|
||||
/**
|
||||
* Content-Lengthの最大値(byte)
|
||||
*/
|
||||
"maximumContentLength": string;
|
||||
/**
|
||||
* Content-Lengthがこの値を超えた場合、プレビューは生成されません。
|
||||
*/
|
||||
"maximumContentLengthDescription": string;
|
||||
/**
|
||||
* Content-Lengthが取得できた場合のみプレビューを生成
|
||||
*/
|
||||
"requireContentLength": string;
|
||||
/**
|
||||
* 相手サーバがContent-Lengthを返さない場合、プレビューは生成されません。
|
||||
*/
|
||||
"requireContentLengthDescription": string;
|
||||
/**
|
||||
* User-Agent
|
||||
*/
|
||||
"userAgent": string;
|
||||
/**
|
||||
* プレビュー取得時に使用されるUser-Agentを設定します。空欄の場合、デフォルトのUser-Agentが使用されます。
|
||||
*/
|
||||
"userAgentDescription": string;
|
||||
/**
|
||||
* プレビューを生成するプロキシのエンドポイント
|
||||
*/
|
||||
"summaryProxy": string;
|
||||
/**
|
||||
* Misskey本体ではなく、サマリープロキシを使用してプレビューを生成します。
|
||||
*/
|
||||
"summaryProxyDescription": string;
|
||||
/**
|
||||
* プロキシには下記パラメータがクエリ文字列として連携されます。プロキシ側がこれらをサポートしない場合、設定値は無視されます。
|
||||
*/
|
||||
"summaryProxyDescription2": string;
|
||||
};
|
||||
"_mediaControls": {
|
||||
/**
|
||||
* ピクチャインピクチャ
|
||||
*/
|
||||
"pip": string;
|
||||
/**
|
||||
* 再生速度
|
||||
*/
|
||||
"playbackRate": string;
|
||||
/**
|
||||
* ループ再生
|
||||
*/
|
||||
"loop": string;
|
||||
};
|
||||
}
|
||||
declare const locales: {
|
||||
[lang: string]: Locale;
|
||||
|
@ -400,6 +400,7 @@ name: "名前"
|
||||
antennaSource: "受信ソース"
|
||||
antennaKeywords: "受信キーワード"
|
||||
antennaExcludeKeywords: "除外キーワード"
|
||||
antennaExcludeBots: "Botアカウントを除外"
|
||||
antennaKeywordsDescription: "スペースで区切るとAND指定になり、改行で区切るとOR指定になります"
|
||||
notifyAntenna: "新しいノートを通知する"
|
||||
withFileAntenna: "ファイルが添付されたノートのみ"
|
||||
@ -1224,6 +1225,15 @@ enableHorizontalSwipe: "スワイプしてタブを切り替える"
|
||||
loading: "読み込み中"
|
||||
surrender: "やめる"
|
||||
gameRetry: "リトライ"
|
||||
notUsePleaseLeaveBlank: "使用しない場合は空欄にしてください"
|
||||
useTotp: "ワンタイムパスワードを使う"
|
||||
useBackupCode: "バックアップコードを使う"
|
||||
launchApp: "アプリを起動"
|
||||
useNativeUIForVideoAudioPlayer: "動画・音声の再生にブラウザのUIを使用する"
|
||||
keepOriginalFilename: "オリジナルのファイル名を保持"
|
||||
keepOriginalFilenameDescription: "この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。"
|
||||
noDescription: "説明文はありません"
|
||||
alwaysConfirmFollow: "フォローの際常に確認する"
|
||||
|
||||
_bubbleGame:
|
||||
howToPlay: "遊び方"
|
||||
@ -1693,6 +1703,11 @@ _role:
|
||||
roleAssignedTo: "マニュアルロールにアサイン済み"
|
||||
isLocal: "ローカルユーザー"
|
||||
isRemote: "リモートユーザー"
|
||||
isCat: "猫ユーザー"
|
||||
isBot: "botユーザー"
|
||||
isSuspended: "サスペンド済みユーザー"
|
||||
isLocked: "鍵アカウントユーザー"
|
||||
isExplorable: "「アカウントを見つけやすくする」が有効なユーザー"
|
||||
createdLessThan: "アカウント作成から~以内"
|
||||
createdMoreThan: "アカウント作成から~経過"
|
||||
followersLessThanOrEq: "フォロワー数が~以下"
|
||||
@ -1979,8 +1994,7 @@ _2fa:
|
||||
alreadyRegistered: "既に設定は完了しています。"
|
||||
registerTOTP: "認証アプリの設定を開始"
|
||||
step1: "まず、{a}や{b}などの認証アプリをお使いのデバイスにインストールします。"
|
||||
step2: "次に、表示されているQRコードをアプリでスキャンします。"
|
||||
step2Click: "QRコードをクリックすると、お使いの端末にインストールされている認証アプリやキーリングに登録できます。"
|
||||
step2: "次に、表示されているQRコードをアプリでスキャンするか、ボタンをクリックして端末上でアプリを開きます。"
|
||||
step2Uri: "デスクトップアプリを使用する場合は次のURIを入力します"
|
||||
step3Title: "確認コードを入力"
|
||||
step3: "アプリに表示されている確認コード(トークン)を入力します。"
|
||||
@ -2004,6 +2018,7 @@ _2fa:
|
||||
backupCodesDescription: "認証アプリが使用できなくなった場合、以下のバックアップコードを使ってアカウントにアクセスできます。これらのコードは必ず安全な場所に保管してください。各コードは一回だけ使用できます。"
|
||||
backupCodeUsedWarning: "バックアップコードが使用されました。認証アプリが使えなくなっている場合、なるべく早く認証アプリを再設定してください。"
|
||||
backupCodesExhaustedWarning: "バックアップコードが全て使用されました。認証アプリを利用できない場合、これ以上アカウントにアクセスできなくなります。認証アプリを再登録してください。"
|
||||
moreDetailedGuideHere: "詳細なガイドはこちら"
|
||||
|
||||
_permissions:
|
||||
"read:account": "アカウントの情報を見る"
|
||||
@ -2326,6 +2341,8 @@ _pages:
|
||||
section: "セクション"
|
||||
image: "画像"
|
||||
button: "ボタン"
|
||||
dynamic: "動的ブロック"
|
||||
dynamicDescription: "このブロックは廃止されています。今後は{play}を利用してください。"
|
||||
|
||||
note: "ノート埋め込み"
|
||||
_note:
|
||||
@ -2601,3 +2618,22 @@ _offlineScreen:
|
||||
title: "オフライン - サーバーに接続できません"
|
||||
header: "サーバーに接続できません"
|
||||
|
||||
_urlPreviewSetting:
|
||||
title: "URLプレビューの設定"
|
||||
enable: "URLプレビューを有効にする"
|
||||
timeout: "プレビュー取得時のタイムアウト(ms)"
|
||||
timeoutDescription: "プレビュー取得の所要時間がこの値を超えた場合、プレビューは生成されません。"
|
||||
maximumContentLength: "Content-Lengthの最大値(byte)"
|
||||
maximumContentLengthDescription: "Content-Lengthがこの値を超えた場合、プレビューは生成されません。"
|
||||
requireContentLength: "Content-Lengthが取得できた場合のみプレビューを生成"
|
||||
requireContentLengthDescription: "相手サーバがContent-Lengthを返さない場合、プレビューは生成されません。"
|
||||
userAgent: "User-Agent"
|
||||
userAgentDescription: "プレビュー取得時に使用されるUser-Agentを設定します。空欄の場合、デフォルトのUser-Agentが使用されます。"
|
||||
summaryProxy: "プレビューを生成するプロキシのエンドポイント"
|
||||
summaryProxyDescription: "Misskey本体ではなく、サマリープロキシを使用してプレビューを生成します。"
|
||||
summaryProxyDescription2: "プロキシには下記パラメータがクエリ文字列として連携されます。プロキシ側がこれらをサポートしない場合、設定値は無視されます。"
|
||||
|
||||
_mediaControls:
|
||||
pip: "ピクチャインピクチャ"
|
||||
playbackRate: "再生速度"
|
||||
loop: "ループ再生"
|
||||
|
@ -56,9 +56,12 @@
|
||||
"postcss": "8.4.35",
|
||||
"tar": "6.2.0",
|
||||
"terser": "5.28.1",
|
||||
"typescript": "5.3.3"
|
||||
"typescript": "5.3.3",
|
||||
"esbuild": "0.19.11",
|
||||
"glob": "10.3.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.28",
|
||||
"@typescript-eslint/eslint-plugin": "7.1.0",
|
||||
"@typescript-eslint/parser": "7.1.0",
|
||||
"cross-env": "7.0.3",
|
||||
|
@ -19,5 +19,6 @@
|
||||
},
|
||||
"target": "es2022"
|
||||
},
|
||||
"minify": false
|
||||
"minify": false,
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
|
@ -19,6 +19,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<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>
|
||||
</html>
|
||||
|
42
packages/backend/migration/1710512074000-url-preview-meta.js
Normal file
42
packages/backend/migration/1710512074000-url-preview-meta.js
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class UrlPreviewMeta1710512074000 {
|
||||
name = 'UrlPreviewMeta1710512074000'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`
|
||||
alter table meta
|
||||
rename column "summalyProxy" to "urlPreviewSummaryProxyUrl";
|
||||
alter table meta
|
||||
add "urlPreviewEnabled" boolean default true not null;
|
||||
alter table meta
|
||||
add "urlPreviewTimeout" integer default 10000 not null;
|
||||
alter table meta
|
||||
add "urlPreviewMaximumContentLength" bigint default 10485760 not null;
|
||||
alter table meta
|
||||
add "urlPreviewRequireContentLength" boolean default false not null;
|
||||
alter table meta
|
||||
add "urlPreviewUserAgent" varchar(1024) default null;
|
||||
`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`
|
||||
alter table meta
|
||||
rename column "urlPreviewSummaryProxyUrl" to "summalyProxy";
|
||||
alter table meta
|
||||
drop column "urlPreviewEnabled";
|
||||
alter table meta
|
||||
drop column "urlPreviewTimeout";
|
||||
alter table meta
|
||||
drop column "urlPreviewMaximumContentLength";
|
||||
alter table meta
|
||||
drop column "urlPreviewRequireContentLength";
|
||||
alter table meta
|
||||
drop column "urlPreviewUserAgent";
|
||||
`);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class AntennaExcludeBots1710919614510 {
|
||||
name = 'AntennaExcludeBots1710919614510'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "antenna" ADD "excludeBots" boolean NOT NULL DEFAULT false`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "antenna" DROP COLUMN "excludeBots"`);
|
||||
}
|
||||
}
|
@ -11,14 +11,14 @@
|
||||
"start:test": "cross-env NODE_ENV=test node ./built/boot/entry.js",
|
||||
"migrate": "pnpm typeorm migration:run -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:test": "swc test-server -d built-test -D --config-file test-server/.swcrc",
|
||||
"watch:swc": "swc src -d built -D -w",
|
||||
"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",
|
||||
"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",
|
||||
"eslint": "eslint --quiet \"src/**/*.ts\"",
|
||||
"lint": "pnpm typecheck && pnpm eslint",
|
||||
@ -31,7 +31,7 @@
|
||||
"test:e2e": "pnpm build && pnpm build:test && pnpm jest:e2e",
|
||||
"test-and-coverage": "pnpm jest-and-coverage",
|
||||
"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": {
|
||||
"@swc/core-android-arm64": "1.3.11",
|
||||
@ -80,7 +80,7 @@
|
||||
"@fastify/static": "6.12.0",
|
||||
"@fastify/view": "8.2.0",
|
||||
"@misskey-dev/sharp-read-bmp": "1.2.0",
|
||||
"@misskey-dev/summaly": "5.0.3",
|
||||
"@misskey-dev/summaly": "5.1.0",
|
||||
"@nestjs/common": "10.3.3",
|
||||
"@nestjs/core": "10.3.3",
|
||||
"@nestjs/testing": "10.3.3",
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import Redis from 'ioredis';
|
||||
import { loadConfig } from './built/config.js';
|
||||
import { loadConfig } from '../built/config.js';
|
||||
|
||||
const config = loadConfig();
|
||||
const redis = new Redis(config.redis);
|
61
packages/backend/scripts/dev.mjs
Normal file
61
packages/backend/scripts/dev.mjs
Normal file
@ -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
|
||||
*/
|
||||
|
||||
import { loadConfig } from './built/config.js'
|
||||
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
|
||||
import { loadConfig } from '../built/config.js'
|
||||
import { genOpenapiSpec } from '../built/server/api/openapi/gen-spec.js'
|
||||
import { writeFileSync } from "node:fs";
|
||||
|
||||
const config = loadConfig();
|
@ -305,7 +305,7 @@ export class AccountMoveService {
|
||||
let resultUser: MiLocalUser | MiRemoteUser | null = null;
|
||||
|
||||
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);
|
||||
}
|
||||
dst = await this.apPersonService.fetchPerson(dst.uri) ?? dst;
|
||||
@ -321,7 +321,7 @@ export class AccountMoveService {
|
||||
if (!src) continue; // oldAccountを探してもこのサーバーに存在しない場合はフォロー関係もないということなのでスルー
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ export class AntennaService implements OnApplicationShutdown {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async addNoteToAntennas(note: MiNote, noteUser: { id: MiUser['id']; username: string; host: string | null; }): Promise<void> {
|
||||
public async addNoteToAntennas(note: MiNote, noteUser: { id: MiUser['id']; username: string; host: string | null; isBot: boolean; }): Promise<void> {
|
||||
const antennas = await this.getAntennas();
|
||||
const antennasWithMatchResult = await Promise.all(antennas.map(antenna => this.checkHitAntenna(antenna, note, noteUser).then(hit => [antenna, hit] as const)));
|
||||
const matchedAntennas = antennasWithMatchResult.filter(([, hit]) => hit).map(([antenna]) => antenna);
|
||||
@ -110,10 +110,12 @@ export class AntennaService implements OnApplicationShutdown {
|
||||
// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
|
||||
|
||||
@bindThis
|
||||
public async checkHitAntenna(antenna: MiAntenna, note: (MiNote | Packed<'Note'>), noteUser: { id: MiUser['id']; username: string; host: string | null; }): Promise<boolean> {
|
||||
public async checkHitAntenna(antenna: MiAntenna, note: (MiNote | Packed<'Note'>), noteUser: { id: MiUser['id']; username: string; host: string | null; isBot: boolean; }): Promise<boolean> {
|
||||
if (note.visibility === 'specified') return false;
|
||||
if (note.visibility === 'followers') return false;
|
||||
|
||||
if (antenna.excludeBots && noteUser.isBot) return false;
|
||||
|
||||
if (antenna.localOnly && noteUser.host != null) return false;
|
||||
|
||||
if (!antenna.withReplies && note.replyId != null) return false;
|
||||
|
@ -13,7 +13,7 @@ import type { NotesRepository } from '@/models/_.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { FanoutTimelineName, FanoutTimelineService } from '@/core/FanoutTimelineService.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 { isReply } from '@/misc/is-reply.js';
|
||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||
@ -95,7 +95,7 @@ export class FanoutTimelineEndpointService {
|
||||
|
||||
if (ps.excludePureRenotes) {
|
||||
const parentFilter = filter;
|
||||
filter = (note) => !isPureRenote(note) && parentFilter(note);
|
||||
filter = (note) => (!isRenote(note) || isQuote(note)) && parentFilter(note);
|
||||
}
|
||||
|
||||
if (ps.me) {
|
||||
@ -116,7 +116,7 @@ export class FanoutTimelineEndpointService {
|
||||
filter = (note) => {
|
||||
if (isUserRelated(note, userIdsWhoBlockingMe, ps.ignoreAuthorFromBlock)) 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;
|
||||
|
||||
return parentFilter(note);
|
||||
|
@ -14,11 +14,12 @@ import FFmpeg from 'fluent-ffmpeg';
|
||||
import isSvg from 'is-svg';
|
||||
import probeImageSize from 'probe-image-size';
|
||||
import { type predictionType } from 'nsfwjs';
|
||||
import sharp from 'sharp';
|
||||
import { sharpBmp } from '@misskey-dev/sharp-read-bmp';
|
||||
import { encode } from 'blurhash';
|
||||
import { createTempDir } from '@/misc/create-temp.js';
|
||||
import { AiService } from '@/core/AiService.js';
|
||||
import { LoggerService } from '@/core/LoggerService.js';
|
||||
import type Logger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
export type FileInfo = {
|
||||
@ -49,9 +50,13 @@ const TYPE_SVG = {
|
||||
|
||||
@Injectable()
|
||||
export class FileInfoService {
|
||||
private logger: Logger;
|
||||
|
||||
constructor(
|
||||
private aiService: AiService,
|
||||
private loggerService: LoggerService,
|
||||
) {
|
||||
this.logger = this.loggerService.getLogger('file-info');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -317,6 +322,34 @@ export class FileInfoService {
|
||||
return mime;
|
||||
}
|
||||
|
||||
/**
|
||||
* ビデオファイルにビデオトラックがあるかどうかチェック
|
||||
* (ない場合:m4a, webmなど)
|
||||
*
|
||||
* @param path ファイルパス
|
||||
* @returns ビデオトラックがあるかどうか(エラー発生時は常に`true`を返す)
|
||||
*/
|
||||
@bindThis
|
||||
private hasVideoTrackOnVideoFile(path: string): Promise<boolean> {
|
||||
const sublogger = this.logger.createSubLogger('ffprobe');
|
||||
sublogger.info(`Checking the video file. File path: ${path}`);
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
FFmpeg.ffprobe(path, (err, metadata) => {
|
||||
if (err) {
|
||||
sublogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err);
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
resolve(metadata.streams.some((stream) => stream.codec_type === 'video'));
|
||||
});
|
||||
} catch (err) {
|
||||
sublogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err as Error);
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect MIME Type and extension
|
||||
*/
|
||||
@ -339,6 +372,20 @@ export class FileInfoService {
|
||||
return TYPE_SVG;
|
||||
}
|
||||
|
||||
if ((type.mime.startsWith('video') || type.mime === 'application/ogg') && !(await this.hasVideoTrackOnVideoFile(path))) {
|
||||
const newMime = `audio/${type.mime.split('/')[1]}`;
|
||||
if (newMime === 'audio/mp4') {
|
||||
return {
|
||||
mime: 'audio/mp4',
|
||||
ext: 'm4a',
|
||||
};
|
||||
}
|
||||
return {
|
||||
mime: newMime,
|
||||
ext: type.ext,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
mime: this.fixMime(type.mime),
|
||||
ext: type.ext,
|
||||
|
@ -306,7 +306,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||
}
|
||||
|
||||
// Check blocking
|
||||
if (data.renote && !this.isQuote(data)) {
|
||||
if (this.isRenote(data) && !this.isQuote(data)) {
|
||||
if (data.renote.userHost === null) {
|
||||
if (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 (data.renote) {
|
||||
if (this.isRenote(data)) {
|
||||
const type = this.isQuote(data) ? 'quote' : 'renote';
|
||||
|
||||
// Notify
|
||||
@ -725,9 +725,20 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private isQuote(note: Option): note is Option & { renote: MiNote } {
|
||||
// sync with misc/is-quote.ts
|
||||
return !!note.renote && (!!note.text || !!note.cw || (!!note.files && !!note.files.length) || !!note.poll);
|
||||
private isRenote(note: Option): note is Option & { renote: MiNote } {
|
||||
return note.renote != null;
|
||||
}
|
||||
|
||||
@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
|
||||
@ -795,7 +806,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||
private async renderNoteOrRenoteActivity(data: Option, note: MiNote) {
|
||||
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.renderCreate(await this.apRendererService.renderNote(note, false), note);
|
||||
|
||||
|
@ -24,7 +24,7 @@ import { bindThis } from '@/decorators.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { SearchService } from '@/core/SearchService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import { isPureRenote } from '@/misc/is-pure-renote.js';
|
||||
import { isQuote, isRenote } from '@/misc/is-renote.js';
|
||||
|
||||
@Injectable()
|
||||
export class NoteDeleteService {
|
||||
@ -79,7 +79,7 @@ export class NoteDeleteService {
|
||||
let renote: MiNote | null = null;
|
||||
|
||||
// if deleted note is renote
|
||||
if (isPureRenote(note)) {
|
||||
if (isRenote(note) && !isQuote(note)) {
|
||||
renote = await this.notesRepository.findOneBy({
|
||||
id: note.renoteId,
|
||||
});
|
||||
|
@ -101,7 +101,7 @@ export class PushNotificationService implements OnApplicationShutdown {
|
||||
type,
|
||||
body: (type === 'notification' || type === 'unreadAntennaNote') ? truncateBody(type, body) : body,
|
||||
userId,
|
||||
dateTime: (new Date()).getTime(),
|
||||
dateTime: Date.now(),
|
||||
}), {
|
||||
proxy: this.config.proxy,
|
||||
}).catch((err: any) => {
|
||||
|
@ -205,45 +205,79 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||
private evalCond(user: MiUser, roles: MiRole[], value: RoleCondFormulaValue): boolean {
|
||||
try {
|
||||
switch (value.type) {
|
||||
// ~かつ~
|
||||
case 'and': {
|
||||
return value.values.every(v => this.evalCond(user, roles, v));
|
||||
}
|
||||
// ~または~
|
||||
case 'or': {
|
||||
return value.values.some(v => this.evalCond(user, roles, v));
|
||||
}
|
||||
// ~ではない
|
||||
case 'not': {
|
||||
return !this.evalCond(user, roles, value.value);
|
||||
}
|
||||
// マニュアルロールがアサインされている
|
||||
case 'roleAssignedTo': {
|
||||
return roles.some(r => r.id === value.roleId);
|
||||
}
|
||||
// ローカルユーザのみ
|
||||
case 'isLocal': {
|
||||
return this.userEntityService.isLocalUser(user);
|
||||
}
|
||||
// リモートユーザのみ
|
||||
case 'isRemote': {
|
||||
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': {
|
||||
return this.idService.parse(user.id).date.getTime() > (Date.now() - (value.sec * 1000));
|
||||
}
|
||||
// ユーザが作成されてから指定期間経っていない
|
||||
case 'createdMoreThan': {
|
||||
return this.idService.parse(user.id).date.getTime() < (Date.now() - (value.sec * 1000));
|
||||
}
|
||||
// フォロワー数が指定値以下
|
||||
case 'followersLessThanOrEq': {
|
||||
return user.followersCount <= value.value;
|
||||
}
|
||||
// フォロワー数が指定値以上
|
||||
case 'followersMoreThanOrEq': {
|
||||
return user.followersCount >= value.value;
|
||||
}
|
||||
// フォロー数が指定値以下
|
||||
case 'followingLessThanOrEq': {
|
||||
return user.followingCount <= value.value;
|
||||
}
|
||||
// フォロー数が指定値以上
|
||||
case 'followingMoreThanOrEq': {
|
||||
return user.followingCount >= value.value;
|
||||
}
|
||||
// ノート数が指定値以下
|
||||
case 'notesLessThanOrEq': {
|
||||
return user.notesCount <= value.value;
|
||||
}
|
||||
// ノート数が指定値以上
|
||||
case 'notesMoreThanOrEq': {
|
||||
return user.notesCount >= value.value;
|
||||
}
|
||||
|
@ -511,6 +511,12 @@ export class UserFollowingService implements OnModuleInit {
|
||||
if (blocking) throw new Error('blocking');
|
||||
if (blocked) throw new Error('blocked');
|
||||
|
||||
// Remove old follow requests before creating a new one.
|
||||
await this.followRequestsRepository.delete({
|
||||
followeeId: followee.id,
|
||||
followerId: follower.id,
|
||||
});
|
||||
|
||||
const followRequest = await this.followRequestsRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
followerId: follower.id,
|
||||
|
@ -459,13 +459,15 @@ export default abstract class Chart<T extends Schema> {
|
||||
}
|
||||
}
|
||||
|
||||
// bake unique count
|
||||
// bake cardinality
|
||||
for (const [k, v] of Object.entries(finalDiffs)) {
|
||||
if (this.schema[k].uniqueIncrement) {
|
||||
const name = COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof Columns<T>;
|
||||
const tempColumnName = UNIQUE_TEMP_COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof TempColumnsForUnique<T>;
|
||||
queryForHour[name] = new Set([...(v as string[]), ...(logHour[tempColumnName] as unknown as string[])]).size;
|
||||
queryForDay[name] = new Set([...(v as string[]), ...(logDay[tempColumnName] as unknown as string[])]).size;
|
||||
const cardinalityOfHour = new Set([...(v as string[]), ...(logHour[tempColumnName] as unknown as string[])]).size;
|
||||
const cardinalityOfDay = new Set([...(v as string[]), ...(logDay[tempColumnName] as unknown as string[])]).size;
|
||||
queryForHour[name] = cardinalityOfHour;
|
||||
queryForDay[name] = cardinalityOfDay;
|
||||
}
|
||||
}
|
||||
|
||||
@ -637,7 +639,7 @@ export default abstract class Chart<T extends Schema> {
|
||||
// 要求された範囲にログがひとつもなかったら
|
||||
if (logs.length === 0) {
|
||||
// もっとも新しいログを持ってくる
|
||||
// (すくなくともひとつログが無いと隙間埋めできないため)
|
||||
// (すくなくともひとつログが無いと補間できないため)
|
||||
const recentLog = await repository.findOne({
|
||||
where: group ? {
|
||||
group: group,
|
||||
@ -654,7 +656,7 @@ export default abstract class Chart<T extends Schema> {
|
||||
// 要求された範囲の最も古い箇所に位置するログが存在しなかったら
|
||||
} else if (!isTimeSame(new Date(logs.at(-1)!.date * 1000), gt)) {
|
||||
// 要求された範囲の最も古い箇所時点での最も新しいログを持ってきて末尾に追加する
|
||||
// (隙間埋めできないため)
|
||||
// (補間できないため)
|
||||
const outdatedLog = await repository.findOne({
|
||||
where: {
|
||||
date: LessThan(Chart.dateToTimestamp(gt)),
|
||||
@ -683,7 +685,7 @@ export default abstract class Chart<T extends Schema> {
|
||||
if (log) {
|
||||
chart.unshift(this.convertRawRecord(log));
|
||||
} else {
|
||||
// 隙間埋め
|
||||
// 補間
|
||||
const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current));
|
||||
const data = latest ? this.convertRawRecord(latest) : null;
|
||||
chart.unshift(this.getNewLog(data));
|
||||
|
@ -39,6 +39,7 @@ export class AntennaEntityService {
|
||||
caseSensitive: antenna.caseSensitive,
|
||||
localOnly: antenna.localOnly,
|
||||
notify: antenna.notify,
|
||||
excludeBots: antenna.excludeBots,
|
||||
withReplies: antenna.withReplies,
|
||||
withFile: antenna.withFile,
|
||||
isActive: antenna.isActive,
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
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 type { Packed } from '@/misc/json-schema.js';
|
||||
import type { } from '@/models/Blocking.js';
|
||||
@ -20,6 +20,9 @@ export class ClipEntityService {
|
||||
@Inject(DI.clipsRepository)
|
||||
private clipsRepository: ClipsRepository,
|
||||
|
||||
@Inject(DI.clipNotesRepository)
|
||||
private clipNotesRepository: ClipNotesRepository,
|
||||
|
||||
@Inject(DI.clipFavoritesRepository)
|
||||
private clipFavoritesRepository: ClipFavoritesRepository,
|
||||
|
||||
@ -47,6 +50,7 @@ export class ClipEntityService {
|
||||
isPublic: clip.isPublic,
|
||||
favoritedCount: await this.clipFavoritesRepository.countBy({ clipId: clip.id }),
|
||||
isFavorited: meId ? await this.clipFavoritesRepository.exists({ where: { clipId: clip.id, userId: meId } }) : undefined,
|
||||
notesCount: meId ? await this.clipNotesRepository.countBy({ clipId: clip.id }) : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -111,6 +111,7 @@ export class MetaEntityService {
|
||||
policies: { ...DEFAULT_POLICIES, ...instance.policies },
|
||||
|
||||
mediaProxy: this.config.mediaProxy,
|
||||
enableUrlPreview: instance.urlPreviewEnabled,
|
||||
};
|
||||
|
||||
return packed;
|
||||
|
@ -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));
|
||||
}
|
67
packages/backend/src/misc/is-renote.ts
Normal file
67
packages/backend/src/misc/is-renote.ts
Normal file
@ -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,
|
||||
packedRoleCondFormulaFollowersOrFollowingOrNotesSchema,
|
||||
packedRoleCondFormulaValueSchema,
|
||||
packedRoleCondFormulaValueUserSettingBooleanSchema,
|
||||
} from '@/models/json-schema/role.js';
|
||||
import { packedAdSchema } from '@/models/json-schema/ad.js';
|
||||
import { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js';
|
||||
@ -97,6 +98,7 @@ export const refs = {
|
||||
RoleCondFormulaLogics: packedRoleCondFormulaLogicsSchema,
|
||||
RoleCondFormulaValueNot: packedRoleCondFormulaValueNot,
|
||||
RoleCondFormulaValueIsLocalOrRemote: packedRoleCondFormulaValueIsLocalOrRemoteSchema,
|
||||
RoleCondFormulaValueUserSettingBooleanSchema: packedRoleCondFormulaValueUserSettingBooleanSchema,
|
||||
RoleCondFormulaValueAssignedRole: packedRoleCondFormulaValueAssignedRoleSchema,
|
||||
RoleCondFormulaValueCreated: packedRoleCondFormulaValueCreatedSchema,
|
||||
RoleCondFormulaFollowersOrFollowingOrNotes: packedRoleCondFormulaFollowersOrFollowingOrNotesSchema,
|
||||
|
@ -72,6 +72,11 @@ export class MiAntenna {
|
||||
})
|
||||
public caseSensitive: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public excludeBots: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
|
@ -277,12 +277,6 @@ export class MiMeta {
|
||||
})
|
||||
public enableSensitiveMediaDetectionForVideos: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public summalyProxy: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
@ -588,4 +582,36 @@ export class MiMeta {
|
||||
default: 0,
|
||||
})
|
||||
public notesPerOneAd: number;
|
||||
|
||||
@Column('boolean', {
|
||||
default: true,
|
||||
})
|
||||
public urlPreviewEnabled: boolean;
|
||||
|
||||
@Column('integer', {
|
||||
default: 10000,
|
||||
})
|
||||
public urlPreviewTimeout: number;
|
||||
|
||||
@Column('bigint', {
|
||||
default: 1024 * 1024 * 10,
|
||||
})
|
||||
public urlPreviewMaximumContentLength: number;
|
||||
|
||||
@Column('boolean', {
|
||||
default: true,
|
||||
})
|
||||
public urlPreviewRequireContentLength: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public urlPreviewSummaryProxyUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public urlPreviewUserAgent: string | null;
|
||||
}
|
||||
|
@ -6,69 +6,149 @@
|
||||
import { Entity, Column, PrimaryColumn } from 'typeorm';
|
||||
import { id } from './util/id.js';
|
||||
|
||||
/**
|
||||
* ~かつ~
|
||||
* 複数の条件を同時に満たす場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueAnd = {
|
||||
type: 'and';
|
||||
values: RoleCondFormulaValue[];
|
||||
};
|
||||
|
||||
/**
|
||||
* ~または~
|
||||
* 複数の条件のうち、いずれかを満たす場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueOr = {
|
||||
type: 'or';
|
||||
values: RoleCondFormulaValue[];
|
||||
};
|
||||
|
||||
/**
|
||||
* ~ではない
|
||||
* 条件を満たさない場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueNot = {
|
||||
type: 'not';
|
||||
value: RoleCondFormulaValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* ローカルユーザーのみ成立とする
|
||||
*/
|
||||
type CondFormulaValueIsLocal = {
|
||||
type: 'isLocal';
|
||||
};
|
||||
|
||||
/**
|
||||
* リモートユーザーのみ成立とする
|
||||
*/
|
||||
type CondFormulaValueIsRemote = {
|
||||
type: 'isRemote';
|
||||
};
|
||||
|
||||
/**
|
||||
* 既に指定のマニュアルロールにアサインされている場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueRoleAssignedTo = {
|
||||
type: 'roleAssignedTo';
|
||||
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: 'createdLessThan';
|
||||
sec: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* ユーザが作成されてから指定期間経っていない場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueCreatedMoreThan = {
|
||||
type: 'createdMoreThan';
|
||||
sec: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* フォロワー数が指定値以下の場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueFollowersLessThanOrEq = {
|
||||
type: 'followersLessThanOrEq';
|
||||
value: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* フォロワー数が指定値以上の場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueFollowersMoreThanOrEq = {
|
||||
type: 'followersMoreThanOrEq';
|
||||
value: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* フォロー数が指定値以下の場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueFollowingLessThanOrEq = {
|
||||
type: 'followingLessThanOrEq';
|
||||
value: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* フォロー数が指定値以上の場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueFollowingMoreThanOrEq = {
|
||||
type: 'followingMoreThanOrEq';
|
||||
value: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* 投稿数が指定値以下の場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueNotesLessThanOrEq = {
|
||||
type: 'notesLessThanOrEq';
|
||||
value: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* 投稿数が指定値以上の場合のみ成立とする
|
||||
*/
|
||||
type CondFormulaValueNotesMoreThanOrEq = {
|
||||
type: 'notesMoreThanOrEq';
|
||||
value: number;
|
||||
@ -80,6 +160,11 @@ export type RoleCondFormulaValue = { id: string } & (
|
||||
CondFormulaValueNot |
|
||||
CondFormulaValueIsLocal |
|
||||
CondFormulaValueIsRemote |
|
||||
CondFormulaValueIsSuspended |
|
||||
CondFormulaValueIsLocked |
|
||||
CondFormulaValueIsBot |
|
||||
CondFormulaValueIsCat |
|
||||
CondFormulaValueIsExplorable |
|
||||
CondFormulaValueRoleAssignedTo |
|
||||
CondFormulaValueCreatedLessThan |
|
||||
CondFormulaValueCreatedMoreThan |
|
||||
|
@ -76,6 +76,11 @@ export const packedAntennaSchema = {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
excludeBots: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
default: false,
|
||||
},
|
||||
withReplies: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
|
@ -52,5 +52,9 @@ export const packedClipSchema = {
|
||||
type: 'boolean',
|
||||
optional: true, nullable: false,
|
||||
},
|
||||
notesCount: {
|
||||
type: 'integer',
|
||||
optional: true, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -207,6 +207,10 @@ export const packedMetaLiteSchema = {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
enableUrlPreview: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
backgroundImageUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
|
@ -57,6 +57,20 @@ export const packedRoleCondFormulaValueIsLocalOrRemoteSchema = {
|
||||
},
|
||||
} 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 = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -135,6 +149,9 @@ export const packedRoleCondFormulaValueSchema = {
|
||||
{
|
||||
ref: 'RoleCondFormulaValueIsLocalOrRemote',
|
||||
},
|
||||
{
|
||||
ref: 'RoleCondFormulaValueUserSettingBooleanSchema',
|
||||
},
|
||||
{
|
||||
ref: 'RoleCondFormulaValueAssignedRole',
|
||||
},
|
||||
|
@ -63,7 +63,7 @@ export class CleanRemoteFilesProcessorService {
|
||||
isLink: false,
|
||||
});
|
||||
|
||||
job.updateProgress(deletedCount / total);
|
||||
job.updateProgress(100 / total * deletedCount);
|
||||
}
|
||||
|
||||
this.logger.succ('All cached remote files has been deleted.');
|
||||
|
@ -81,6 +81,7 @@ export class ExportAntennasProcessorService {
|
||||
}) : null,
|
||||
caseSensitive: antenna.caseSensitive,
|
||||
localOnly: antenna.localOnly,
|
||||
excludeBots: antenna.excludeBots,
|
||||
withReplies: antenna.withReplies,
|
||||
withFile: antenna.withFile,
|
||||
notify: antenna.notify,
|
||||
|
@ -44,6 +44,7 @@ const validate = new Ajv().compile({
|
||||
} },
|
||||
caseSensitive: { type: 'boolean' },
|
||||
localOnly: { type: 'boolean' },
|
||||
excludeBots: { type: 'boolean' },
|
||||
withReplies: { type: 'boolean' },
|
||||
withFile: { type: 'boolean' },
|
||||
notify: { type: 'boolean' },
|
||||
@ -88,6 +89,7 @@ export class ImportAntennasProcessorService {
|
||||
users: (antenna.src === 'list' && antenna.userListAccts !== null ? antenna.userListAccts : antenna.users).filter(Boolean),
|
||||
caseSensitive: antenna.caseSensitive,
|
||||
localOnly: antenna.localOnly,
|
||||
excludeBots: antenna.excludeBots,
|
||||
withReplies: antenna.withReplies,
|
||||
withFile: antenna.withFile,
|
||||
notify: antenna.notify,
|
||||
|
@ -28,7 +28,7 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { bindThis } from '@/decorators.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 { FindOptionsWhere } from 'typeorm';
|
||||
|
||||
@ -91,7 +91,7 @@ export class ActivityPubServerService {
|
||||
*/
|
||||
@bindThis
|
||||
private async packActivity(note: MiNote): Promise<any> {
|
||||
if (isPureRenote(note)) {
|
||||
if (isRenote(note) && !isQuote(note)) {
|
||||
const renote = await this.notesRepository.findOneByOrFail({ id: note.renoteId });
|
||||
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('Accept-Ranges', 'bytes');
|
||||
reply.header('Content-Length', chunksize);
|
||||
reply.code(206);
|
||||
} else {
|
||||
image = {
|
||||
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-Length', file.file.size);
|
||||
reply.header('Cache-Control', 'max-age=31536000, immutable');
|
||||
reply.header('Content-Disposition',
|
||||
contentDisposition(
|
||||
'inline',
|
||||
@ -255,6 +258,7 @@ export class FileServerService {
|
||||
return fs.createReadStream(file.path);
|
||||
} else {
|
||||
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('Content-Disposition', contentDisposition('inline', file.filename));
|
||||
|
||||
@ -263,7 +267,6 @@ export class FileServerService {
|
||||
const parts = range.replace(/bytes=/, '').split('-');
|
||||
const start = parseInt(parts[0], 10);
|
||||
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
|
||||
console.log(end);
|
||||
if (end > file.file.size) {
|
||||
end = file.file.size - 1;
|
||||
}
|
||||
@ -433,6 +436,7 @@ export class FileServerService {
|
||||
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
|
||||
reply.header('Accept-Ranges', 'bytes');
|
||||
reply.header('Content-Length', chunksize);
|
||||
reply.code(206);
|
||||
} else {
|
||||
image = {
|
||||
data: fs.createReadStream(file.path),
|
||||
@ -529,6 +533,7 @@ export class FileServerService {
|
||||
if (!file.storedInternal) {
|
||||
if (!(file.isLink && file.uri)) return '204';
|
||||
const result = await this.downloadAndDetectTypeFromUrl(file.uri);
|
||||
file.size = (await fs.promises.stat(result.path)).size; // DB file.sizeは正確とは限らないので
|
||||
return {
|
||||
...result,
|
||||
url: file.uri,
|
||||
|
@ -434,6 +434,8 @@ export const meta = {
|
||||
summalyProxy: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
deprecated: true,
|
||||
description: '[Deprecated] Use "urlPreviewSummaryProxyUrl" instead.',
|
||||
},
|
||||
themeColor: {
|
||||
type: 'string',
|
||||
@ -451,6 +453,30 @@ export const meta = {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
urlPreviewEnabled: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
urlPreviewTimeout: {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
urlPreviewMaximumContentLength: {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
urlPreviewRequireContentLength: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
urlPreviewUserAgent: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
urlPreviewSummaryProxyUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
@ -533,7 +559,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
|
||||
enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
|
||||
proxyAccountId: instance.proxyAccountId,
|
||||
summalyProxy: instance.summalyProxy,
|
||||
email: instance.email,
|
||||
smtpSecure: instance.smtpSecure,
|
||||
smtpHost: instance.smtpHost,
|
||||
@ -577,6 +602,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
||||
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
||||
notesPerOneAd: instance.notesPerOneAd,
|
||||
summalyProxy: instance.urlPreviewSummaryProxyUrl,
|
||||
urlPreviewEnabled: instance.urlPreviewEnabled,
|
||||
urlPreviewTimeout: instance.urlPreviewTimeout,
|
||||
urlPreviewMaximumContentLength: instance.urlPreviewMaximumContentLength,
|
||||
urlPreviewRequireContentLength: instance.urlPreviewRequireContentLength,
|
||||
urlPreviewUserAgent: instance.urlPreviewUserAgent,
|
||||
urlPreviewSummaryProxyUrl: instance.urlPreviewSummaryProxyUrl,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ export const paramDef = {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
summalyProxy: { type: 'string', nullable: true },
|
||||
deeplAuthKey: { type: 'string', nullable: true },
|
||||
deeplIsPro: { type: 'boolean' },
|
||||
enableEmail: { type: 'boolean' },
|
||||
@ -150,6 +149,16 @@ export const paramDef = {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
summalyProxy: {
|
||||
type: 'string', nullable: true,
|
||||
description: '[Deprecated] Use "urlPreviewSummaryProxyUrl" instead.',
|
||||
},
|
||||
urlPreviewEnabled: { type: 'boolean' },
|
||||
urlPreviewTimeout: { type: 'integer' },
|
||||
urlPreviewMaximumContentLength: { type: 'integer' },
|
||||
urlPreviewRequireContentLength: { type: 'boolean' },
|
||||
urlPreviewUserAgent: { type: 'string', nullable: true },
|
||||
urlPreviewSummaryProxyUrl: { type: 'string', nullable: true },
|
||||
},
|
||||
required: [],
|
||||
} as const;
|
||||
@ -353,10 +362,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
set.langs = ps.langs.filter(Boolean);
|
||||
}
|
||||
|
||||
if (ps.summalyProxy !== undefined) {
|
||||
set.summalyProxy = ps.summalyProxy;
|
||||
}
|
||||
|
||||
if (ps.enableEmail !== undefined) {
|
||||
set.enableEmail = ps.enableEmail;
|
||||
}
|
||||
@ -581,6 +586,32 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
set.bannedEmailDomains = ps.bannedEmailDomains;
|
||||
}
|
||||
|
||||
if (ps.urlPreviewEnabled !== undefined) {
|
||||
set.urlPreviewEnabled = ps.urlPreviewEnabled;
|
||||
}
|
||||
|
||||
if (ps.urlPreviewTimeout !== undefined) {
|
||||
set.urlPreviewTimeout = ps.urlPreviewTimeout;
|
||||
}
|
||||
|
||||
if (ps.urlPreviewMaximumContentLength !== undefined) {
|
||||
set.urlPreviewMaximumContentLength = ps.urlPreviewMaximumContentLength;
|
||||
}
|
||||
|
||||
if (ps.urlPreviewRequireContentLength !== undefined) {
|
||||
set.urlPreviewRequireContentLength = ps.urlPreviewRequireContentLength;
|
||||
}
|
||||
|
||||
if (ps.urlPreviewUserAgent !== undefined) {
|
||||
const value = (ps.urlPreviewUserAgent ?? '').trim();
|
||||
set.urlPreviewUserAgent = value === '' ? null : ps.urlPreviewUserAgent;
|
||||
}
|
||||
|
||||
if (ps.summalyProxy !== undefined || ps.urlPreviewSummaryProxyUrl !== undefined) {
|
||||
const value = ((ps.urlPreviewSummaryProxyUrl ?? ps.summalyProxy) ?? '').trim();
|
||||
set.urlPreviewSummaryProxyUrl = value === '' ? null : value;
|
||||
}
|
||||
|
||||
const before = await this.metaService.fetch(true);
|
||||
|
||||
await this.metaService.update(set);
|
||||
|
@ -64,6 +64,7 @@ export const paramDef = {
|
||||
} },
|
||||
caseSensitive: { type: 'boolean' },
|
||||
localOnly: { type: 'boolean' },
|
||||
excludeBots: { type: 'boolean' },
|
||||
withReplies: { type: 'boolean' },
|
||||
withFile: { type: 'boolean' },
|
||||
notify: { type: 'boolean' },
|
||||
@ -124,6 +125,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
users: ps.users,
|
||||
caseSensitive: ps.caseSensitive,
|
||||
localOnly: ps.localOnly,
|
||||
excludeBots: ps.excludeBots,
|
||||
withReplies: ps.withReplies,
|
||||
withFile: ps.withFile,
|
||||
notify: ps.notify,
|
||||
|
@ -63,6 +63,7 @@ export const paramDef = {
|
||||
} },
|
||||
caseSensitive: { type: 'boolean' },
|
||||
localOnly: { type: 'boolean' },
|
||||
excludeBots: { type: 'boolean' },
|
||||
withReplies: { type: 'boolean' },
|
||||
withFile: { type: 'boolean' },
|
||||
notify: { type: 'boolean' },
|
||||
@ -120,6 +121,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
users: ps.users,
|
||||
caseSensitive: ps.caseSensitive,
|
||||
localOnly: ps.localOnly,
|
||||
excludeBots: ps.excludeBots,
|
||||
withReplies: ps.withReplies,
|
||||
withFile: ps.withFile,
|
||||
notify: ps.notify,
|
||||
|
@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
|
||||
const checkMoving = await this.accountMoveService.validateAlsoKnownAs(
|
||||
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,
|
||||
);
|
||||
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(
|
||||
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,
|
||||
);
|
||||
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(
|
||||
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,
|
||||
);
|
||||
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(
|
||||
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,
|
||||
);
|
||||
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 { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { UserAuthService } from '@/core/UserAuthService.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
@ -39,6 +40,12 @@ export const meta = {
|
||||
code: 'UNAVAILABLE',
|
||||
id: 'a2defefb-f220-8849-0af6-17f816099323',
|
||||
},
|
||||
|
||||
emailRequired: {
|
||||
message: 'Email address is required.',
|
||||
code: 'EMAIL_REQUIRED',
|
||||
id: '324c7a88-59f2-492f-903f-89134f93e47e',
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -66,6 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
@Inject(DI.userProfilesRepository)
|
||||
private userProfilesRepository: UserProfilesRepository,
|
||||
|
||||
private metaService: MetaService,
|
||||
private userEntityService: UserEntityService,
|
||||
private emailService: EmailService,
|
||||
private userAuthService: UserAuthService,
|
||||
@ -97,6 +105,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
if (!res.available) {
|
||||
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, {
|
||||
|
@ -16,7 +16,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { NoteCreateService } from '@/core/NoteCreateService.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 { UtilityService } from '@/core/UtilityService.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) {
|
||||
throw new ApiError(meta.errors.noSuchRenoteTarget);
|
||||
} else if (isPureRenote(renote)) {
|
||||
} else if (isRenote(renote) && !isQuote(renote)) {
|
||||
throw new ApiError(meta.errors.cannotReRenote);
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
|
||||
if (reply == null) {
|
||||
throw new ApiError(meta.errors.noSuchReplyTarget);
|
||||
} else if (isPureRenote(reply)) {
|
||||
} else if (isRenote(reply) && !isQuote(reply)) {
|
||||
throw new ApiError(meta.errors.cannotReplyToPureRenote);
|
||||
} else if (!await this.noteEntityService.isVisibleForMe(reply, me.id)) {
|
||||
throw new ApiError(meta.errors.cannotReplyToInvisibleNote);
|
||||
|
@ -21,7 +21,7 @@ export const meta = {
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
optional: true, nullable: false,
|
||||
properties: {
|
||||
sourceLang: { type: 'string' },
|
||||
text: { type: 'string' },
|
||||
@ -39,6 +39,11 @@ export const meta = {
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'bea9b03f-36e0-49c5-a4db-627a029f8971',
|
||||
},
|
||||
cannotTranslateInvisibleNote: {
|
||||
message: 'Cannot translate invisible note.',
|
||||
code: 'CANNOT_TRANSLATE_INVISIBLE_NOTE',
|
||||
id: 'ea29f2ca-c368-43b3-aaf1-5ac3e74bbe5d',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
@ -72,17 +77,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
});
|
||||
|
||||
if (!(await this.noteEntityService.isVisibleForMe(note, me.id))) {
|
||||
return 204; // TODO: 良い感じのエラー返す
|
||||
throw new ApiError(meta.errors.cannotTranslateInvisibleNote);
|
||||
}
|
||||
|
||||
if (note.text == null) {
|
||||
return 204;
|
||||
return;
|
||||
}
|
||||
|
||||
const instance = await this.metaService.fetch();
|
||||
|
||||
if (instance.deeplAuthKey == null) {
|
||||
return 204; // TODO: 良い感じのエラー返す
|
||||
throw new ApiError(meta.errors.unavailable);
|
||||
}
|
||||
|
||||
let targetLang = ps.targetLang;
|
||||
|
@ -6,6 +6,7 @@
|
||||
import { IsNull } from 'typeorm';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { UsersRepository, FollowingsRepository, UserProfilesRepository } from '@/models/_.js';
|
||||
import { birthdaySchema } from '@/models/User.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { QueryService } from '@/core/QueryService.js';
|
||||
import { FollowingEntityService } from '@/core/entities/FollowingEntityService.js';
|
||||
@ -66,7 +67,7 @@ export const paramDef = {
|
||||
description: 'The local host is represented with `null`.',
|
||||
},
|
||||
|
||||
birthday: { type: 'string', nullable: true },
|
||||
birthday: { ...birthdaySchema, nullable: true },
|
||||
},
|
||||
anyOf: [
|
||||
{ required: ['userId'] },
|
||||
@ -127,9 +128,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
|
||||
if (ps.birthday) {
|
||||
try {
|
||||
const d = new Date(ps.birthday);
|
||||
d.setHours(0, 0, 0, 0);
|
||||
const birthday = `${(d.getMonth() + 1).toString().padStart(2, '0')}-${d.getDate().toString().padStart(2, '0')}`;
|
||||
const birthday = ps.birthday.substring(5, 10);
|
||||
const birthdayUserQuery = this.userProfilesRepository.createQueryBuilder('user_profile');
|
||||
birthdayUserQuery.select('user_profile.userId')
|
||||
.where(`SUBSTR(user_profile.birthday, 6, 5) = '${birthday}'`);
|
||||
|
@ -93,7 +93,7 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
|
||||
const hasBody = (schema.type === 'object' && schema.properties && Object.keys(schema.properties).length >= 1);
|
||||
|
||||
const info = {
|
||||
operationId: endpoint.name,
|
||||
operationId: endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
|
||||
summary: endpoint.name,
|
||||
description: desc,
|
||||
externalDocs: {
|
||||
|
@ -4,6 +4,10 @@
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
/**
|
||||
@ -54,6 +58,24 @@ export default abstract class Channel {
|
||||
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) {
|
||||
this.id = id;
|
||||
this.connection = connection;
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
@ -40,12 +39,7 @@ class AntennaChannel extends Channel {
|
||||
if (data.type === 'note') {
|
||||
const note = await this.noteEntityService.pack(data.body.id, this.user, { detail: true });
|
||||
|
||||
// 流れてきた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.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
*/
|
||||
|
||||
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 { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class ChannelChannel extends Channel {
|
||||
@ -38,14 +38,9 @@ class ChannelChannel extends Channel {
|
||||
private async onNote(note: Packed<'Note'>) {
|
||||
if (note.channelId !== this.channelId) return;
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||
|
||||
if (this.user && note.renoteId && !note.text) {
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
|
@ -4,14 +4,12 @@
|
||||
*/
|
||||
|
||||
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 { MetaService } from '@/core/MetaService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class GlobalTimelineChannel extends Channel {
|
||||
@ -52,26 +50,11 @@ class GlobalTimelineChannel extends Channel {
|
||||
if (note.visibility !== 'public') return;
|
||||
if (note.channelId != null) 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 (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) 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 (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 (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
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))));
|
||||
if (!matched) return;
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||
|
||||
if (this.user && note.renoteId && !note.text) {
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
|
@ -4,12 +4,10 @@
|
||||
*/
|
||||
|
||||
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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class HomeTimelineChannel extends Channel {
|
||||
@ -51,9 +49,6 @@ class HomeTimelineChannel extends Channel {
|
||||
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 (!isMe && !Object.hasOwn(this.following, note.userId)) return;
|
||||
} 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 (note.renote.reply) {
|
||||
const reply = note.renote.reply;
|
||||
@ -81,14 +76,9 @@ class HomeTimelineChannel extends Channel {
|
||||
}
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||
|
||||
if (this.user && note.renoteId && !note.text) {
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
|
@ -4,14 +4,12 @@
|
||||
*/
|
||||
|
||||
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 { MetaService } from '@/core/MetaService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class HybridTimelineChannel extends Channel {
|
||||
@ -71,8 +69,7 @@ class HybridTimelineChannel extends Channel {
|
||||
if (!isMe && !note.visibleUserIds!.includes(this.user!.id)) return;
|
||||
}
|
||||
|
||||
// Ignore notes from instances the user has muted
|
||||
if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (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;
|
||||
|
||||
// 流れてきた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 (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
|
||||
|
||||
if (this.user && note.renoteId && !note.text) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
|
@ -4,13 +4,12 @@
|
||||
*/
|
||||
|
||||
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 { MetaService } from '@/core/MetaService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
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 (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 (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||
|
||||
if (this.user && note.renoteId && !note.text) {
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
|
@ -4,8 +4,6 @@
|
||||
*/
|
||||
|
||||
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 { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
@ -46,12 +44,7 @@ class RoleTimelineChannel extends Channel {
|
||||
}
|
||||
if (note.visibility !== 'public') 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.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
this.send('note', note);
|
||||
} else {
|
||||
|
@ -5,12 +5,11 @@
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
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 { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { DI } from '@/di-symbols.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';
|
||||
|
||||
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 (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||
|
||||
if (this.user && note.renoteId && !note.text) {
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
}
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているインスタンスに関わるものだったら無視する
|
||||
if (isInstanceMuted(note, this.userMutedInstances)) return;
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { summaly } from '@misskey-dev/summaly';
|
||||
import { SummalyResult } from '@misskey-dev/summaly/built/summary.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
@ -14,6 +15,7 @@ import { query } from '@/misc/prelude/url.js';
|
||||
import { LoggerService } from '@/core/LoggerService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { ApiError } from '@/server/api/error.js';
|
||||
import { MiMeta } from '@/models/Meta.js';
|
||||
import type { FastifyRequest, FastifyReply } from 'fastify';
|
||||
|
||||
@Injectable()
|
||||
@ -62,24 +64,25 @@ export class UrlPreviewService {
|
||||
|
||||
const meta = await this.metaService.fetch();
|
||||
|
||||
this.logger.info(meta.summalyProxy
|
||||
if (!meta.urlPreviewEnabled) {
|
||||
reply.code(403);
|
||||
return {
|
||||
error: new ApiError({
|
||||
message: 'URL preview is disabled',
|
||||
code: 'URL_PREVIEW_DISABLED',
|
||||
id: '58b36e13-d2f5-0323-b0c6-76aa9dabefb8',
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
this.logger.info(meta.urlPreviewSummaryProxyUrl
|
||||
? `(Proxy) Getting preview of ${url}@${lang} ...`
|
||||
: `Getting preview of ${url}@${lang} ...`);
|
||||
|
||||
try {
|
||||
const summary = meta.summalyProxy ?
|
||||
await this.httpRequestService.getJson<ReturnType<typeof summaly>>(`${meta.summalyProxy}?${query({
|
||||
url: url,
|
||||
lang: lang ?? 'ja-JP',
|
||||
})}`)
|
||||
:
|
||||
await summaly(url, {
|
||||
followRedirects: false,
|
||||
lang: lang ?? 'ja-JP',
|
||||
agent: this.config.proxy ? {
|
||||
http: this.httpRequestService.httpAgent,
|
||||
https: this.httpRequestService.httpsAgent,
|
||||
} : undefined,
|
||||
});
|
||||
const summary = meta.urlPreviewSummaryProxyUrl
|
||||
? await this.fetchSummaryFromProxy(url, meta, lang)
|
||||
: await this.fetchSummary(url, meta, lang);
|
||||
|
||||
this.logger.succ(`Got preview of ${url}: ${summary.title}`);
|
||||
|
||||
@ -100,6 +103,7 @@ export class UrlPreviewService {
|
||||
return summary;
|
||||
} catch (err) {
|
||||
this.logger.warn(`Failed to get preview of ${url}: ${err}`);
|
||||
|
||||
reply.code(422);
|
||||
reply.header('Cache-Control', 'max-age=86400, immutable');
|
||||
return {
|
||||
@ -111,4 +115,37 @@ export class UrlPreviewService {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private fetchSummary(url: string, meta: MiMeta, lang?: string): Promise<SummalyResult> {
|
||||
const agent = this.config.proxy
|
||||
? {
|
||||
http: this.httpRequestService.httpAgent,
|
||||
https: this.httpRequestService.httpsAgent,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return summaly(url, {
|
||||
followRedirects: false,
|
||||
lang: lang ?? 'ja-JP',
|
||||
agent: agent,
|
||||
userAgent: meta.urlPreviewUserAgent ?? undefined,
|
||||
operationTimeout: meta.urlPreviewTimeout,
|
||||
contentLengthLimit: meta.urlPreviewMaximumContentLength,
|
||||
contentLengthRequired: meta.urlPreviewRequireContentLength,
|
||||
});
|
||||
}
|
||||
|
||||
private fetchSummaryFromProxy(url: string, meta: MiMeta, lang?: string): Promise<SummalyResult> {
|
||||
const proxy = meta.urlPreviewSummaryProxyUrl!;
|
||||
const queryStr = query({
|
||||
url: url,
|
||||
lang: lang ?? 'ja-JP',
|
||||
userAgent: meta.urlPreviewUserAgent ?? undefined,
|
||||
operationTimeout: meta.urlPreviewTimeout,
|
||||
contentLengthLimit: meta.urlPreviewMaximumContentLength,
|
||||
contentLengthRequired: meta.urlPreviewRequireContentLength,
|
||||
});
|
||||
|
||||
return this.httpRequestService.getJson<SummalyResult>(`${proxy}?${queryStr}`);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ extends ./base
|
||||
|
||||
block vars
|
||||
- const user = note.user;
|
||||
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
||||
- const title = user.name ? `${user.name} (@${user.username}${user.host ? `@${user.host}` : ''})` : `@${user.username}${user.host ? `@${user.host}` : ''}`;
|
||||
- const url = `${config.url}/notes/${note.id}`;
|
||||
- const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null;
|
||||
- const images = (note.files || []).filter(file => file.type.startsWith('image/') && !file.isSensitive)
|
||||
@ -28,7 +28,7 @@ block og
|
||||
// FIXME: add embed player for Twitter
|
||||
if images.length
|
||||
meta(property='twitter:card' content='summary_large_image')
|
||||
each image in images
|
||||
each image in images
|
||||
meta(property='og:image' content= image.url)
|
||||
else
|
||||
meta(property='twitter:card' content='summary')
|
||||
|
@ -1,7 +1,7 @@
|
||||
extends ./base
|
||||
|
||||
block vars
|
||||
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
||||
- const title = user.name ? `${user.name} (@${user.username}${user.host ? `@${user.host}` : ''})` : `@${user.username}${user.host ? `@${user.host}` : ''}`;
|
||||
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
|
||||
|
||||
block title
|
||||
|
@ -44,6 +44,7 @@ describe('アンテナ', () => {
|
||||
users: [''],
|
||||
withFile: false,
|
||||
withReplies: false,
|
||||
excludeBots: false,
|
||||
};
|
||||
|
||||
let root: User;
|
||||
@ -156,6 +157,7 @@ describe('アンテナ', () => {
|
||||
users: [''],
|
||||
withFile: false,
|
||||
withReplies: false,
|
||||
excludeBots: false,
|
||||
localOnly: false,
|
||||
};
|
||||
assert.deepStrictEqual(response, expected);
|
||||
|
@ -8,12 +8,13 @@ process.env.NODE_ENV = 'test';
|
||||
import * as assert from 'assert';
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
import { api, initTestDb, post, signup, uploadFile, uploadUrl } from '../utils.js';
|
||||
import { api, initTestDb, post, role, signup, uploadFile, uploadUrl } from '../utils.js';
|
||||
import type * as misskey from 'misskey-js';
|
||||
|
||||
describe('Note', () => {
|
||||
let Notes: any;
|
||||
|
||||
let root: misskey.entities.SignupResponse;
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
let bob: misskey.entities.SignupResponse;
|
||||
let tom: misskey.entities.SignupResponse;
|
||||
@ -21,6 +22,7 @@ describe('Note', () => {
|
||||
beforeAll(async () => {
|
||||
const connection = await initTestDb(true);
|
||||
Notes = connection.getRepository(MiNote);
|
||||
root = await signup({ username: 'root' });
|
||||
alice = await signup({ username: 'alice' });
|
||||
bob = await signup({ username: 'bob' });
|
||||
tom = await signup({ username: 'tom', host: 'example.com' });
|
||||
@ -473,14 +475,14 @@ describe('Note', () => {
|
||||
value: true,
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
||||
const assign = await api('admin/roles/assign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(assign.status, 204);
|
||||
assert.strictEqual(file.body!.isSensitive, false);
|
||||
@ -508,11 +510,11 @@ describe('Note', () => {
|
||||
await api('admin/roles/unassign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
});
|
||||
}, root);
|
||||
|
||||
await api('admin/roles/delete', {
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
});
|
||||
});
|
||||
|
||||
@ -644,7 +646,7 @@ describe('Note', () => {
|
||||
sensitiveWords: [
|
||||
'test',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(sensitive.status, 204);
|
||||
|
||||
@ -663,7 +665,7 @@ describe('Note', () => {
|
||||
sensitiveWords: [
|
||||
'/Test/i',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(sensitive.status, 204);
|
||||
|
||||
@ -680,7 +682,7 @@ describe('Note', () => {
|
||||
sensitiveWords: [
|
||||
'Test hoge',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(sensitive.status, 204);
|
||||
|
||||
@ -697,7 +699,7 @@ describe('Note', () => {
|
||||
prohibitedWords: [
|
||||
'test',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(prohibited.status, 204);
|
||||
|
||||
@ -716,7 +718,7 @@ describe('Note', () => {
|
||||
prohibitedWords: [
|
||||
'/Test/i',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(prohibited.status, 204);
|
||||
|
||||
@ -733,7 +735,7 @@ describe('Note', () => {
|
||||
prohibitedWords: [
|
||||
'Test hoge',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(prohibited.status, 204);
|
||||
|
||||
@ -750,7 +752,7 @@ describe('Note', () => {
|
||||
prohibitedWords: [
|
||||
'test',
|
||||
],
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(prohibited.status, 204);
|
||||
|
||||
@ -785,7 +787,7 @@ describe('Note', () => {
|
||||
value: 0,
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
||||
@ -794,7 +796,7 @@ describe('Note', () => {
|
||||
const assign = await api('admin/roles/assign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(assign.status, 204);
|
||||
|
||||
@ -810,11 +812,11 @@ describe('Note', () => {
|
||||
await api('admin/roles/unassign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
});
|
||||
}, root);
|
||||
|
||||
await api('admin/roles/delete', {
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
});
|
||||
|
||||
test('ダイレクト投稿もエラーになる', async () => {
|
||||
@ -839,7 +841,7 @@ describe('Note', () => {
|
||||
value: 0,
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
||||
@ -848,7 +850,7 @@ describe('Note', () => {
|
||||
const assign = await api('admin/roles/assign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(assign.status, 204);
|
||||
|
||||
@ -866,11 +868,11 @@ describe('Note', () => {
|
||||
await api('admin/roles/unassign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
});
|
||||
}, root);
|
||||
|
||||
await api('admin/roles/delete', {
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
});
|
||||
|
||||
test('ダイレクトの宛先とメンションが同じ場合は重複してカウントしない', async () => {
|
||||
@ -895,7 +897,7 @@ describe('Note', () => {
|
||||
value: 1,
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
||||
@ -904,7 +906,7 @@ describe('Note', () => {
|
||||
const assign = await api('admin/roles/assign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
|
||||
assert.strictEqual(assign.status, 204);
|
||||
|
||||
@ -921,11 +923,11 @@ describe('Note', () => {
|
||||
await api('admin/roles/unassign', {
|
||||
userId: alice.id,
|
||||
roleId: res.body.id,
|
||||
});
|
||||
}, root);
|
||||
|
||||
await api('admin/roles/delete', {
|
||||
roleId: res.body.id,
|
||||
}, alice);
|
||||
}, root);
|
||||
});
|
||||
});
|
||||
|
||||
@ -960,4 +962,61 @@ describe('Note', () => {
|
||||
assert.strictEqual(mainNote.repliesCount, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('notes/translate', () => {
|
||||
describe('翻訳機能の利用が許可されていない場合', () => {
|
||||
let cannotTranslateRole: misskey.entities.Role;
|
||||
|
||||
beforeAll(async () => {
|
||||
cannotTranslateRole = await role(root, {}, { canUseTranslator: false });
|
||||
await api('admin/roles/assign', { roleId: cannotTranslateRole.id, userId: alice.id }, root);
|
||||
});
|
||||
|
||||
test('翻訳機能の利用が許可されていない場合翻訳できない', async () => {
|
||||
const aliceNote = await post(alice, { text: 'Hello' });
|
||||
const res = await api('notes/translate', {
|
||||
noteId: aliceNote.id,
|
||||
targetLang: 'ja',
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 400);
|
||||
assert.strictEqual(res.body.error.code, 'UNAVAILABLE');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await api('admin/roles/unassign', { roleId: cannotTranslateRole.id, userId: alice.id }, root);
|
||||
});
|
||||
});
|
||||
|
||||
test('存在しないノートは翻訳できない', async () => {
|
||||
const res = await api('notes/translate', { noteId: 'foo', targetLang: 'ja' }, alice);
|
||||
|
||||
assert.strictEqual(res.status, 400);
|
||||
assert.strictEqual(res.body.error.code, 'NO_SUCH_NOTE');
|
||||
});
|
||||
|
||||
test('不可視なノートは翻訳できない', async () => {
|
||||
const aliceNote = await post(alice, { visibility: 'followers', text: 'Hello' });
|
||||
const bobTranslateAttempt = await api('notes/translate', { noteId: aliceNote.id, targetLang: 'ja' }, bob);
|
||||
|
||||
assert.strictEqual(bobTranslateAttempt.status, 400);
|
||||
assert.strictEqual(bobTranslateAttempt.body.error.code, 'CANNOT_TRANSLATE_INVISIBLE_NOTE');
|
||||
});
|
||||
|
||||
test('text: null なノートを翻訳すると空のレスポンスが返ってくる', async () => {
|
||||
const aliceNote = await post(alice, { text: null, poll: { choices: ['kinoko', 'takenoko'] } });
|
||||
const res = await api('notes/translate', { noteId: aliceNote.id, targetLang: 'ja' }, alice);
|
||||
|
||||
assert.strictEqual(res.status, 204);
|
||||
});
|
||||
|
||||
test('サーバーに DeepL 認証キーが登録されていない場合翻訳できない', async () => {
|
||||
const aliceNote = await post(alice, { text: 'Hello' });
|
||||
const res = await api('notes/translate', { noteId: aliceNote.id, targetLang: 'ja' }, alice);
|
||||
|
||||
// NOTE: デフォルトでは登録されていないので落ちる
|
||||
assert.strictEqual(res.status, 400);
|
||||
assert.strictEqual(res.body.error.code, 'UNAVAILABLE');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -63,6 +63,22 @@ describe('Renote Mute', () => {
|
||||
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 () => {
|
||||
const bobNote = await post(bob, { text: 'hi' });
|
||||
|
||||
@ -86,4 +102,17 @@ describe('Renote Mute', () => {
|
||||
|
||||
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' });
|
||||
|
||||
// Follow: ayano => kyoko
|
||||
await api('following/create', { userId: kyoko.id }, ayano);
|
||||
await api('following/create', { userId: kyoko.id, withReplies: false }, ayano);
|
||||
|
||||
// Follow: ayano => akari
|
||||
await follow(ayano, akari);
|
||||
@ -158,19 +158,17 @@ describe('Streaming', () => {
|
||||
assert.strictEqual(fired, true);
|
||||
});
|
||||
|
||||
/* なんか失敗する
|
||||
test('フォローしているユーザーの visibility: followers な投稿への返信が流れる', async () => {
|
||||
const note = await api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko);
|
||||
const note = await post(kyoko, { text: 'foo', visibility: 'followers' });
|
||||
|
||||
const fired = await waitFire(
|
||||
ayano, 'homeTimeline', // ayano:home
|
||||
() => api('notes/create', { text: 'bar', visibility: 'followers', replyId: note.body.id }, kyoko), // kyoko posts
|
||||
() => api('notes/create', { text: 'bar', visibility: 'followers', replyId: note.id }, kyoko), // kyoko posts
|
||||
msg => msg.type === 'note' && msg.body.userId === kyoko.id && msg.body.reply.text === 'foo',
|
||||
);
|
||||
|
||||
assert.strictEqual(fired, true);
|
||||
});
|
||||
*/
|
||||
|
||||
test('フォローしているユーザーのフォローしていないユーザーの visibility: followers な投稿への返信が流れない', async () => {
|
||||
const chitoseNote = await post(chitose, { text: 'followers-only post', visibility: 'followers' });
|
||||
@ -511,6 +509,16 @@ describe('Streaming', () => {
|
||||
|
||||
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', () => {
|
||||
|
BIN
packages/backend/test/resources/kick_gaba7.m4a
Normal file
BIN
packages/backend/test/resources/kick_gaba7.m4a
Normal file
Binary file not shown.
@ -15,6 +15,7 @@ import { GlobalModule } from '@/GlobalModule.js';
|
||||
import { FileInfoService } from '@/core/FileInfoService.js';
|
||||
//import { DI } from '@/di-symbols.js';
|
||||
import { AiService } from '@/core/AiService.js';
|
||||
import { LoggerService } from '@/core/LoggerService.js';
|
||||
import type { TestingModule } from '@nestjs/testing';
|
||||
import type { MockFunctionMetadata } from 'jest-mock';
|
||||
|
||||
@ -35,6 +36,7 @@ describe('FileInfoService', () => {
|
||||
],
|
||||
providers: [
|
||||
AiService,
|
||||
LoggerService,
|
||||
FileInfoService,
|
||||
],
|
||||
})
|
||||
@ -323,8 +325,26 @@ describe('FileInfoService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* video/webmとして検出されてしまう
|
||||
test('MPEG-4 AUDIO (M4A)', async () => {
|
||||
const path = `${resources}/kick_gaba7.m4a`;
|
||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||
delete info.warnings;
|
||||
delete info.blurhash;
|
||||
delete info.sensitive;
|
||||
delete info.porn;
|
||||
delete info.width;
|
||||
delete info.height;
|
||||
delete info.orientation;
|
||||
assert.deepStrictEqual(info, {
|
||||
size: 9817,
|
||||
md5: '74c9279a4abe98789565f1dc1a541a42',
|
||||
type: {
|
||||
mime: 'audio/mp4',
|
||||
ext: 'm4a',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('WEBM AUDIO', async () => {
|
||||
const path = `${resources}/kick_gaba7.webm`;
|
||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||
@ -337,13 +357,12 @@ describe('FileInfoService', () => {
|
||||
delete info.orientation;
|
||||
assert.deepStrictEqual(info, {
|
||||
size: 8879,
|
||||
md5: '3350083dec312419cfdc06c16413aca7',
|
||||
md5: '53bc1adcb6acbbda67ff9bd484896438',
|
||||
type: {
|
||||
mime: 'audio/webm',
|
||||
ext: 'webm',
|
||||
},
|
||||
});
|
||||
});
|
||||
*/
|
||||
});
|
||||
});
|
||||
|
144
packages/backend/test/unit/NoteCreateService.ts
Normal file
144
packages/backend/test/unit/NoteCreateService.ts
Normal file
@ -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
|
||||
*/
|
||||
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
@ -20,6 +22,7 @@ import { IdService } from '@/core/IdService.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import { RoleCondFormulaValue } from '@/models/Role.js';
|
||||
import { sleep } from '../utils.js';
|
||||
import type { TestingModule } from '@nestjs/testing';
|
||||
import type { MockFunctionMetadata } from 'jest-mock';
|
||||
@ -52,12 +55,26 @@ describe('RoleService', () => {
|
||||
id: genAidx(Date.now()),
|
||||
updatedAt: new Date(),
|
||||
lastUsedAt: new Date(),
|
||||
name: '',
|
||||
description: '',
|
||||
...data,
|
||||
})
|
||||
.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 () => {
|
||||
clock = lolex.install({
|
||||
now: new Date(),
|
||||
@ -73,6 +90,7 @@ describe('RoleService', () => {
|
||||
CacheService,
|
||||
IdService,
|
||||
GlobalEventService,
|
||||
UserEntityService,
|
||||
{
|
||||
provide: NotificationService,
|
||||
useFactory: () => ({
|
||||
@ -209,79 +227,6 @@ describe('RoleService', () => {
|
||||
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 () => {
|
||||
const user = await createUser();
|
||||
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', () => {
|
||||
test('公開ロールの場合は通知される', async () => {
|
||||
const user = await createUser();
|
||||
|
88
packages/backend/test/unit/misc/is-renote.ts
Normal file
88
packages/backend/test/unit/misc/is-renote.ts
Normal file
@ -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",
|
||||
"@vitejs/plugin-vue": "5.0.4",
|
||||
"@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",
|
||||
"broadcast-channel": "7.0.0",
|
||||
"buraha": "0.0.1",
|
||||
@ -60,7 +60,7 @@
|
||||
"rollup": "4.12.0",
|
||||
"sanitize-html": "2.12.1",
|
||||
"sass": "1.71.1",
|
||||
"shiki": "1.1.7",
|
||||
"shiki": "1.2.0",
|
||||
"strict-event-emitter-types": "2.0.0",
|
||||
"textarea-caret": "3.1.0",
|
||||
"three": "0.162.0",
|
||||
|
@ -145,8 +145,11 @@ export async function common(createVue: () => App<Element>) {
|
||||
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
|
||||
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
||||
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
||||
document.documentElement.dataset.colorMode = darkMode ? 'dark' : 'light';
|
||||
}, { immediate: miLocalStorage.getItem('theme') == null });
|
||||
|
||||
document.documentElement.dataset.colorMode = defaultStore.state.darkMode ? 'dark' : 'light';
|
||||
|
||||
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
||||
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
||||
|
||||
|
@ -75,27 +75,31 @@ export async function mainBoot() {
|
||||
mainRouter.push('/search');
|
||||
},
|
||||
};
|
||||
|
||||
if (defaultStore.state.enableSeasonalScreenEffect) {
|
||||
const month = new Date().getMonth() + 1;
|
||||
if (defaultStore.state.hemisphere === 'S') {
|
||||
// ▼南半球
|
||||
if (month === 7 || month === 8) {
|
||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||
new SnowfallEffect({}).render();
|
||||
try {
|
||||
if (defaultStore.state.enableSeasonalScreenEffect) {
|
||||
const month = new Date().getMonth() + 1;
|
||||
if (defaultStore.state.hemisphere === 'S') {
|
||||
// ▼南半球
|
||||
if (month === 7 || month === 8) {
|
||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||
new SnowfallEffect({}).render();
|
||||
}
|
||||
} else {
|
||||
// ▼北半球
|
||||
if (month === 12 || month === 1) {
|
||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||
new SnowfallEffect({}).render();
|
||||
} else if (month === 3 || month === 4) {
|
||||
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||
new SakuraEffect({
|
||||
sakura: true,
|
||||
}).render();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// ▼北半球
|
||||
if (month === 12 || month === 1) {
|
||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||
new SnowfallEffect({}).render();
|
||||
} else if (month === 3 || month === 4) {
|
||||
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||
new SakuraEffect({
|
||||
sakura: true,
|
||||
}).render();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// console.error(error);
|
||||
console.error('Failed to initialise the seasonal screen effect canvas context:', error);
|
||||
}
|
||||
|
||||
if ($i) {
|
||||
|
@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
v-else class="_button"
|
||||
:class="[$style.root, { [$style.inline]: inline, [$style.primary]: primary, [$style.gradate]: gradate, [$style.danger]: danger, [$style.rounded]: rounded, [$style.full]: full, [$style.small]: small, [$style.large]: large, [$style.transparent]: transparent, [$style.asLike]: asLike }]"
|
||||
:to="to ?? '#'"
|
||||
:behavior="linkBehavior"
|
||||
@mousedown="onMousedown"
|
||||
>
|
||||
<div ref="ripples" :class="$style.ripples" :data-children-class="$style.ripple"></div>
|
||||
@ -43,6 +44,7 @@ const props = defineProps<{
|
||||
inline?: boolean;
|
||||
link?: boolean;
|
||||
to?: string;
|
||||
linkBehavior?: null | 'window' | 'browser';
|
||||
autofocus?: boolean;
|
||||
wait?: boolean;
|
||||
danger?: boolean;
|
||||
|
@ -4,37 +4,59 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div :class="$style.root" class="_panel">
|
||||
<b>{{ clip.name }}</b>
|
||||
<div v-if="clip.description" :class="$style.description">{{ clip.description }}</div>
|
||||
<div v-if="clip.lastClippedAt">{{ i18n.ts.updatedAt }}: <MkTime :time="clip.lastClippedAt" mode="detail"/></div>
|
||||
<div :class="$style.user">
|
||||
<MkAvatar :user="clip.user" :class="$style.userAvatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
|
||||
<MkA :to="`/clips/${clip.id}`" :class="$style.link">
|
||||
<div :class="$style.root" class="_panel _gaps_s">
|
||||
<b>{{ clip.name }}</b>
|
||||
<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.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"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</MkA>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { computed } from 'vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { $i } from '@/account.js';
|
||||
import number from '@/filters/number.js';
|
||||
|
||||
defineProps<{
|
||||
clip: any;
|
||||
const props = defineProps<{
|
||||
clip: Misskey.entities.Clip;
|
||||
}>();
|
||||
|
||||
const remaining = computed(() => {
|
||||
return ($i?.policies && props.clip.notesCount != null) ? ($i.policies.noteEachClipsLimit - props.clip.notesCount) : i18n.ts.unknown;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.root {
|
||||
.link {
|
||||
display: block;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
color: var(--accent);
|
||||
}
|
||||
}
|
||||
|
||||
.root {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.description {
|
||||
padding: 8px 0;
|
||||
.divider {
|
||||
height: 1px;
|
||||
background: var(--divider);
|
||||
}
|
||||
|
||||
.user {
|
||||
padding-top: 16px;
|
||||
border-top: solid 0.5px var(--divider);
|
||||
.description {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.userAvatar {
|
||||
|
@ -9,9 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { bundledLanguagesInfo } from 'shiki';
|
||||
import type { BuiltinLanguage } from 'shiki';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { bundledLanguagesInfo } from 'shiki/langs';
|
||||
import type { BundledLanguage } from 'shiki/langs';
|
||||
import { getHighlighter, getTheme } from '@/scripts/code-highlighter.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
|
||||
@ -23,7 +23,7 @@ const props = defineProps<{
|
||||
|
||||
const highlighter = await getHighlighter();
|
||||
const darkMode = defaultStore.reactiveState.darkMode;
|
||||
const codeLang = ref<BuiltinLanguage | 'aiscript'>('js');
|
||||
const codeLang = ref<BundledLanguage | 'aiscript'>('js');
|
||||
|
||||
const [lightThemeName, darkThemeName] = await Promise.all([
|
||||
getTheme('light', true),
|
||||
@ -42,7 +42,7 @@ const html = computed(() => highlighter.codeToHtml(props.code, {
|
||||
}));
|
||||
|
||||
async function fetchLanguage(to: string): Promise<void> {
|
||||
const language = to as BuiltinLanguage;
|
||||
const language = to as BundledLanguage;
|
||||
|
||||
// Check for the loaded languages, and load the language if it's not loaded yet.
|
||||
if (!highlighter.getLoadedLanguages().includes(language)) {
|
||||
|
@ -80,11 +80,9 @@ function copy() {
|
||||
.codePlaceholderRoot {
|
||||
display: block;
|
||||
width: 100%;
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
@ -47,12 +47,12 @@ onMounted(() => {
|
||||
const width = rootEl.value!.offsetWidth;
|
||||
const height = rootEl.value!.offsetHeight;
|
||||
|
||||
if (left + width - window.pageXOffset >= (window.innerWidth - SCROLLBAR_THICKNESS)) {
|
||||
left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.pageXOffset;
|
||||
if (left + width - window.scrollX >= (window.innerWidth - SCROLLBAR_THICKNESS)) {
|
||||
left = (window.innerWidth - SCROLLBAR_THICKNESS) - width + window.scrollX;
|
||||
}
|
||||
|
||||
if (top + height - window.pageYOffset >= (window.innerHeight - SCROLLBAR_THICKNESS)) {
|
||||
top = (window.innerHeight - SCROLLBAR_THICKNESS) - height + window.pageYOffset;
|
||||
if (top + height - window.scrollY >= (window.innerHeight - SCROLLBAR_THICKNESS)) {
|
||||
top = (window.innerHeight - SCROLLBAR_THICKNESS) - height + window.scrollY;
|
||||
}
|
||||
|
||||
if (top < 0) {
|
||||
|
@ -161,7 +161,7 @@ function onKeydown(evt: KeyboardEvent) {
|
||||
}
|
||||
|
||||
function onInputKeydown(evt: KeyboardEvent) {
|
||||
if (evt.key === 'Enter') {
|
||||
if (evt.key === 'Enter' && okButtonDisabledReason.value === null) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
ok();
|
||||
|
@ -93,6 +93,18 @@ async function onClick() {
|
||||
userId: props.user.id,
|
||||
});
|
||||
} 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) {
|
||||
await misskeyApi('following/requests/cancel', {
|
||||
userId: props.user.id,
|
||||
|
@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
:autocomplete="autocomplete"
|
||||
:autocapitalize="autocapitalize"
|
||||
:spellcheck="spellcheck"
|
||||
:inputmode="inputmode"
|
||||
:step="step"
|
||||
:list="id"
|
||||
:min="min"
|
||||
@ -63,6 +64,7 @@ const props = defineProps<{
|
||||
mfmAutocomplete?: boolean | SuggestionType[],
|
||||
autocapitalize?: string;
|
||||
spellcheck?: boolean;
|
||||
inputmode?: 'none' | 'text' | 'search' | 'email' | 'url' | 'numeric' | 'tel' | 'decimal';
|
||||
step?: any;
|
||||
datalist?: string[];
|
||||
min?: number;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user