Merge branch 'develop' into complete-emoji-after-last-colon
This commit is contained in:
commit
a0ba70303c
|
@ -0,0 +1,75 @@
|
||||||
|
name: Check SPDX-License-Identifier
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-spdx-license-id:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
- name: Check
|
||||||
|
run: |
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
search() {
|
||||||
|
local directory="$1"
|
||||||
|
find "$directory" -type f \
|
||||||
|
'(' \
|
||||||
|
-name "*.cjs" -and -not -name '*.config.cjs' -o \
|
||||||
|
-name "*.html" -o \
|
||||||
|
-name "*.js" -and -not -name '*.config.js' -o \
|
||||||
|
-name "*.mjs" -and -not -name '*.config.mjs' -o \
|
||||||
|
-name "*.scss" -o \
|
||||||
|
-name "*.ts" -and -not -name '*.config.ts' -o \
|
||||||
|
-name "*.vue" \
|
||||||
|
')' -and \
|
||||||
|
-not -name '*eslint*'
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
local file="$1"
|
||||||
|
if ! (
|
||||||
|
grep -q "SPDX-FileCopyrightText: syuilo and misskey-project" "$file" ||
|
||||||
|
grep -q "SPDX-License-Identifier: AGPL-3.0-only" "$file"
|
||||||
|
); then
|
||||||
|
echo "Missing: $file"
|
||||||
|
((counter++))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
directories=(
|
||||||
|
"cypress/e2e"
|
||||||
|
"packages/backend/migration"
|
||||||
|
"packages/backend/src"
|
||||||
|
"packages/backend/test"
|
||||||
|
"packages/frontend/.storybook"
|
||||||
|
"packages/frontend/@types"
|
||||||
|
"packages/frontend/lib"
|
||||||
|
"packages/frontend/public"
|
||||||
|
"packages/frontend/src"
|
||||||
|
"packages/frontend/test"
|
||||||
|
"packages/misskey-bubble-game/src"
|
||||||
|
"packages/misskey-reversi/src"
|
||||||
|
"packages/sw/src"
|
||||||
|
"scripts"
|
||||||
|
)
|
||||||
|
|
||||||
|
for directory in "${directories[@]}"; do
|
||||||
|
for file in $(search $directory); do
|
||||||
|
check "$file"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $counter -gt 0 ]; then
|
||||||
|
echo "SPDX-License-Identifier is missing in $counter files."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "SPDX-License-Identifier is certainly described in all target files!"
|
||||||
|
exit 0
|
||||||
|
fi
|
|
@ -4,7 +4,6 @@
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"Vue.volar",
|
"Vue.volar",
|
||||||
"Orta.vscode-jest",
|
"Orta.vscode-jest",
|
||||||
"dbaeumer.vscode-eslint",
|
|
||||||
"mrmlnc.vscode-json5"
|
"mrmlnc.vscode-json5"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"*.test.ts": "typescript"
|
"*.test.ts": "typescript"
|
||||||
},
|
},
|
||||||
"jest.jestCommandLine": "pnpm run jest",
|
"jest.jestCommandLine": "pnpm run jest",
|
||||||
"jest.autoRun": "off",
|
"jest.runMode": "on-demand",
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": "explicit"
|
"source.fixAll": "explicit"
|
||||||
},
|
},
|
||||||
|
|
26
CHANGELOG.md
26
CHANGELOG.md
|
@ -1,18 +1,38 @@
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Note
|
||||||
|
- コントロールパネル内にあるサマリープロキシの設定個所がセキュリティから全般へ変更となります。
|
||||||
|
|
||||||
### General
|
### General
|
||||||
-
|
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
|
||||||
|
- Enhance: アンテナでBotによるノートを除外できるように
|
||||||
|
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/545)
|
||||||
|
- Fix: Play作成時に設定した公開範囲が機能していない問題を修正
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
|
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
|
||||||
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
|
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
|
||||||
- Enhance: リアクション・いいねの総数を表示するように
|
- Enhance: リアクション・いいねの総数を表示するように
|
||||||
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
|
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
|
||||||
|
- Enhance: 設定>プラグインのページからプラグインの簡易的なログやエラーを見られるように
|
||||||
|
- 実装の都合により、プラグインは1つエラーを起こした時に即時停止するようになりました
|
||||||
|
- Enhance: ページのデザインを変更
|
||||||
|
- Enhance: 2要素認証(ワンタイムパスワード)の入力欄を改善
|
||||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||||
- 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`を修正してください。
|
||||||
|
|
||||||
### Server
|
### 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)
|
||||||
|
|
||||||
## 2024.3.1
|
## 2024.3.1
|
||||||
|
|
||||||
|
@ -26,7 +46,7 @@
|
||||||
- Fix: カスタム絵文字の画像読み込みに失敗した際はテキストではなくダミー画像を表示 #13487
|
- Fix: カスタム絵文字の画像読み込みに失敗した際はテキストではなくダミー画像を表示 #13487
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
-
|
||||||
|
|
||||||
## 2024.3.0
|
## 2024.3.0
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
describe('Before setup instance', () => {
|
describe('Before setup instance', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.resetState();
|
cy.resetState();
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
describe('Router transition', () => {
|
describe('Router transition', () => {
|
||||||
describe('Redirect', () => {
|
describe('Redirect', () => {
|
||||||
// サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う(使いまわした方が早い)
|
// サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う(使いまわした方が早い)
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
/* flaky
|
/* flaky
|
||||||
describe('After user signed in', () => {
|
describe('After user signed in', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
|
@ -30,7 +30,7 @@ Cypress.Commands.add('visitHome', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add('resetState', () => {
|
Cypress.Commands.add('resetState', () => {
|
||||||
cy.window(win => {
|
cy.window().then(win => {
|
||||||
win.indexedDB.deleteDatabase('keyval-store');
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
});
|
});
|
||||||
cy.request('POST', '/api/reset-db', {}).as('reset');
|
cy.request('POST', '/api/reset-db', {}).as('reset');
|
|
@ -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 {}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": ["dom", "es5"],
|
||||||
|
"target": "es5",
|
||||||
|
"types": ["cypress", "node"]
|
||||||
|
},
|
||||||
|
"include": ["./**/*.ts"]
|
||||||
|
}
|
|
@ -1616,6 +1616,10 @@ export interface Locale extends ILocale {
|
||||||
* 除外キーワード
|
* 除外キーワード
|
||||||
*/
|
*/
|
||||||
"antennaExcludeKeywords": string;
|
"antennaExcludeKeywords": string;
|
||||||
|
/**
|
||||||
|
* Botアカウントを除外
|
||||||
|
*/
|
||||||
|
"antennaExcludeBots": string;
|
||||||
/**
|
/**
|
||||||
* スペースで区切るとAND指定になり、改行で区切るとOR指定になります
|
* スペースで区切るとAND指定になり、改行で区切るとOR指定になります
|
||||||
*/
|
*/
|
||||||
|
@ -4912,6 +4916,18 @@ export interface Locale extends ILocale {
|
||||||
* リトライ
|
* リトライ
|
||||||
*/
|
*/
|
||||||
"gameRetry": string;
|
"gameRetry": string;
|
||||||
|
/**
|
||||||
|
* 使用しない場合は空欄にしてください
|
||||||
|
*/
|
||||||
|
"notUsePleaseLeaveBlank": string;
|
||||||
|
/**
|
||||||
|
* ワンタイムパスワードを使う
|
||||||
|
*/
|
||||||
|
"useTotp": string;
|
||||||
|
/**
|
||||||
|
* バックアップコードを使う
|
||||||
|
*/
|
||||||
|
"useBackupCode": string;
|
||||||
"_bubbleGame": {
|
"_bubbleGame": {
|
||||||
/**
|
/**
|
||||||
* 遊び方
|
* 遊び方
|
||||||
|
@ -6805,6 +6821,10 @@ export interface Locale extends ILocale {
|
||||||
* ソースを表示
|
* ソースを表示
|
||||||
*/
|
*/
|
||||||
"viewSource": string;
|
"viewSource": string;
|
||||||
|
/**
|
||||||
|
* ログを表示
|
||||||
|
*/
|
||||||
|
"viewLog": string;
|
||||||
};
|
};
|
||||||
"_preferencesBackups": {
|
"_preferencesBackups": {
|
||||||
/**
|
/**
|
||||||
|
@ -8631,6 +8651,10 @@ export interface Locale extends ILocale {
|
||||||
* 説明
|
* 説明
|
||||||
*/
|
*/
|
||||||
"summary": string;
|
"summary": string;
|
||||||
|
/**
|
||||||
|
* 非公開に設定するとプロフィールに表示されなくなりますが、URLを知っている人は引き続きアクセスできます。
|
||||||
|
*/
|
||||||
|
"visibilityDescription": string;
|
||||||
};
|
};
|
||||||
"_pages": {
|
"_pages": {
|
||||||
/**
|
/**
|
||||||
|
@ -9756,6 +9780,60 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"header": string;
|
"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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
declare const locales: {
|
declare const locales: {
|
||||||
[lang: string]: Locale;
|
[lang: string]: Locale;
|
||||||
|
|
|
@ -400,6 +400,7 @@ name: "名前"
|
||||||
antennaSource: "受信ソース"
|
antennaSource: "受信ソース"
|
||||||
antennaKeywords: "受信キーワード"
|
antennaKeywords: "受信キーワード"
|
||||||
antennaExcludeKeywords: "除外キーワード"
|
antennaExcludeKeywords: "除外キーワード"
|
||||||
|
antennaExcludeBots: "Botアカウントを除外"
|
||||||
antennaKeywordsDescription: "スペースで区切るとAND指定になり、改行で区切るとOR指定になります"
|
antennaKeywordsDescription: "スペースで区切るとAND指定になり、改行で区切るとOR指定になります"
|
||||||
notifyAntenna: "新しいノートを通知する"
|
notifyAntenna: "新しいノートを通知する"
|
||||||
withFileAntenna: "ファイルが添付されたノートのみ"
|
withFileAntenna: "ファイルが添付されたノートのみ"
|
||||||
|
@ -1224,6 +1225,9 @@ enableHorizontalSwipe: "スワイプしてタブを切り替える"
|
||||||
loading: "読み込み中"
|
loading: "読み込み中"
|
||||||
surrender: "やめる"
|
surrender: "やめる"
|
||||||
gameRetry: "リトライ"
|
gameRetry: "リトライ"
|
||||||
|
notUsePleaseLeaveBlank: "使用しない場合は空欄にしてください"
|
||||||
|
useTotp: "ワンタイムパスワードを使う"
|
||||||
|
useBackupCode: "バックアップコードを使う"
|
||||||
|
|
||||||
_bubbleGame:
|
_bubbleGame:
|
||||||
howToPlay: "遊び方"
|
howToPlay: "遊び方"
|
||||||
|
@ -1772,6 +1776,7 @@ _plugin:
|
||||||
installWarn: "信頼できないプラグインはインストールしないでください。"
|
installWarn: "信頼できないプラグインはインストールしないでください。"
|
||||||
manage: "プラグインの管理"
|
manage: "プラグインの管理"
|
||||||
viewSource: "ソースを表示"
|
viewSource: "ソースを表示"
|
||||||
|
viewLog: "ログを表示"
|
||||||
|
|
||||||
_preferencesBackups:
|
_preferencesBackups:
|
||||||
list: "作成したバックアップ"
|
list: "作成したバックアップ"
|
||||||
|
@ -2279,6 +2284,7 @@ _play:
|
||||||
title: "タイトル"
|
title: "タイトル"
|
||||||
script: "スクリプト"
|
script: "スクリプト"
|
||||||
summary: "説明"
|
summary: "説明"
|
||||||
|
visibilityDescription: "非公開に設定するとプロフィールに表示されなくなりますが、URLを知っている人は引き続きアクセスできます。"
|
||||||
|
|
||||||
_pages:
|
_pages:
|
||||||
newPage: "ページの作成"
|
newPage: "ページの作成"
|
||||||
|
@ -2599,3 +2605,17 @@ _offlineScreen:
|
||||||
title: "オフライン - サーバーに接続できません"
|
title: "オフライン - サーバーに接続できません"
|
||||||
header: "サーバーに接続できません"
|
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: "プロキシには下記パラメータがクエリ文字列として連携されます。プロキシ側がこれらをサポートしない場合、設定値は無視されます。"
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"typescript": "5.3.3"
|
"typescript": "5.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.28",
|
||||||
"@typescript-eslint/eslint-plugin": "7.1.0",
|
"@typescript-eslint/eslint-plugin": "7.1.0",
|
||||||
"@typescript-eslint/parser": "7.1.0",
|
"@typescript-eslint/parser": "7.1.0",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { loadConfig } from './built/config.js'
|
import { loadConfig } from './built/config.js'
|
||||||
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
|
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
|
||||||
import { writeFileSync } from "node:fs";
|
import { writeFileSync } from "node:fs";
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class UserBlacklistAnntena1689325027964 {
|
export class UserBlacklistAnntena1689325027964 {
|
||||||
name = 'UserBlacklistAnntena1689325027964'
|
name = 'UserBlacklistAnntena1689325027964'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class FixRenoteMuting1690417561185 {
|
export class FixRenoteMuting1690417561185 {
|
||||||
name = 'FixRenoteMuting1690417561185'
|
name = 'FixRenoteMuting1690417561185'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class ChangeCacheRemoteFilesDefault1690417561186 {
|
export class ChangeCacheRemoteFilesDefault1690417561186 {
|
||||||
name = 'ChangeCacheRemoteFilesDefault1690417561186'
|
name = 'ChangeCacheRemoteFilesDefault1690417561186'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class Fix1690417561187 {
|
export class Fix1690417561187 {
|
||||||
name = 'Fix1690417561187'
|
name = 'Fix1690417561187'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class User2faBackupCodes1690569881926 {
|
export class User2faBackupCodes1690569881926 {
|
||||||
name = 'User2faBackupCodes1690569881926'
|
name = 'User2faBackupCodes1690569881926'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class RefineAnnouncement1691649257651 {
|
export class RefineAnnouncement1691649257651 {
|
||||||
name = 'RefineAnnouncement1691649257651'
|
name = 'RefineAnnouncement1691649257651'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class RefineAnnouncement21691657412740 {
|
export class RefineAnnouncement21691657412740 {
|
||||||
name = 'RefineAnnouncement21691657412740'
|
name = 'RefineAnnouncement21691657412740'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class VerifiedLinks1695260774117 {
|
export class VerifiedLinks1695260774117 {
|
||||||
name = 'VerifiedLinks1695260774117'
|
name = 'VerifiedLinks1695260774117'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class FollowingNotify1695288787870 {
|
export class FollowingNotify1695288787870 {
|
||||||
name = 'FollowingNotify1695288787870'
|
name = 'FollowingNotify1695288787870'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class ShortName1695440131671 {
|
export class ShortName1695440131671 {
|
||||||
name = 'ShortName1695440131671'
|
name = 'ShortName1695440131671'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class MutingNotificationTypes1695605508898 {
|
export class MutingNotificationTypes1695605508898 {
|
||||||
name = 'MutingNotificationTypes1695605508898'
|
name = 'MutingNotificationTypes1695605508898'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class NoteUpdatedAt1695901659683 {
|
export class NoteUpdatedAt1695901659683 {
|
||||||
name = 'NoteUpdatedAt1695901659683'
|
name = 'NoteUpdatedAt1695901659683'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class UserListMembership1696323464251 {
|
export class UserListMembership1696323464251 {
|
||||||
name = 'UserListMembership1696323464251'
|
name = 'UserListMembership1696323464251'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class Hibernation1696331570827 {
|
export class Hibernation1696331570827 {
|
||||||
name = 'Hibernation1696331570827'
|
name = 'Hibernation1696331570827'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class Clean1696332072038 {
|
export class Clean1696332072038 {
|
||||||
name = 'Clean1696332072038'
|
name = 'Clean1696332072038'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export class HardMute1700383825690 {
|
export class HardMute1700383825690 {
|
||||||
name = 'HardMute1700383825690'
|
name = 'HardMute1700383825690'
|
||||||
|
|
||||||
|
|
|
@ -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"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,7 +80,7 @@
|
||||||
"@fastify/static": "6.12.0",
|
"@fastify/static": "6.12.0",
|
||||||
"@fastify/view": "8.2.0",
|
"@fastify/view": "8.2.0",
|
||||||
"@misskey-dev/sharp-read-bmp": "1.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/common": "10.3.3",
|
||||||
"@nestjs/core": "10.3.3",
|
"@nestjs/core": "10.3.3",
|
||||||
"@nestjs/testing": "10.3.3",
|
"@nestjs/testing": "10.3.3",
|
||||||
|
|
|
@ -92,7 +92,7 @@ export class AntennaService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@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 antennas = await this.getAntennas();
|
||||||
const antennasWithMatchResult = await Promise.all(antennas.map(antenna => this.checkHitAntenna(antenna, note, noteUser).then(hit => [antenna, hit] as const)));
|
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);
|
const matchedAntennas = antennasWithMatchResult.filter(([, hit]) => hit).map(([antenna]) => antenna);
|
||||||
|
@ -110,10 +110,12 @@ export class AntennaService implements OnApplicationShutdown {
|
||||||
// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
|
// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
|
||||||
|
|
||||||
@bindThis
|
@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 === 'specified') return false;
|
||||||
if (note.visibility === 'followers') 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.localOnly && noteUser.host != null) return false;
|
||||||
|
|
||||||
if (!antenna.withReplies && note.replyId != null) return false;
|
if (!antenna.withReplies && note.replyId != null) return false;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
|
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import Redis from 'ioredis';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
|
|
@ -511,6 +511,12 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
if (blocking) throw new Error('blocking');
|
if (blocking) throw new Error('blocking');
|
||||||
if (blocked) throw new Error('blocked');
|
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({
|
const followRequest = await this.followRequestsRepository.insert({
|
||||||
id: this.idService.gen(),
|
id: this.idService.gen(),
|
||||||
followerId: follower.id,
|
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)) {
|
for (const [k, v] of Object.entries(finalDiffs)) {
|
||||||
if (this.schema[k].uniqueIncrement) {
|
if (this.schema[k].uniqueIncrement) {
|
||||||
const name = COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof Columns<T>;
|
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>;
|
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;
|
const cardinalityOfHour = 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 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) {
|
if (logs.length === 0) {
|
||||||
// もっとも新しいログを持ってくる
|
// もっとも新しいログを持ってくる
|
||||||
// (すくなくともひとつログが無いと隙間埋めできないため)
|
// (すくなくともひとつログが無いと補間できないため)
|
||||||
const recentLog = await repository.findOne({
|
const recentLog = await repository.findOne({
|
||||||
where: group ? {
|
where: group ? {
|
||||||
group: 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)) {
|
} else if (!isTimeSame(new Date(logs.at(-1)!.date * 1000), gt)) {
|
||||||
// 要求された範囲の最も古い箇所時点での最も新しいログを持ってきて末尾に追加する
|
// 要求された範囲の最も古い箇所時点での最も新しいログを持ってきて末尾に追加する
|
||||||
// (隙間埋めできないため)
|
// (補間できないため)
|
||||||
const outdatedLog = await repository.findOne({
|
const outdatedLog = await repository.findOne({
|
||||||
where: {
|
where: {
|
||||||
date: LessThan(Chart.dateToTimestamp(gt)),
|
date: LessThan(Chart.dateToTimestamp(gt)),
|
||||||
|
@ -683,7 +685,7 @@ export default abstract class Chart<T extends Schema> {
|
||||||
if (log) {
|
if (log) {
|
||||||
chart.unshift(this.convertRawRecord(log));
|
chart.unshift(this.convertRawRecord(log));
|
||||||
} else {
|
} else {
|
||||||
// 隙間埋め
|
// 補間
|
||||||
const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current));
|
const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current));
|
||||||
const data = latest ? this.convertRawRecord(latest) : null;
|
const data = latest ? this.convertRawRecord(latest) : null;
|
||||||
chart.unshift(this.getNewLog(data));
|
chart.unshift(this.getNewLog(data));
|
||||||
|
|
|
@ -39,6 +39,7 @@ export class AntennaEntityService {
|
||||||
caseSensitive: antenna.caseSensitive,
|
caseSensitive: antenna.caseSensitive,
|
||||||
localOnly: antenna.localOnly,
|
localOnly: antenna.localOnly,
|
||||||
notify: antenna.notify,
|
notify: antenna.notify,
|
||||||
|
excludeBots: antenna.excludeBots,
|
||||||
withReplies: antenna.withReplies,
|
withReplies: antenna.withReplies,
|
||||||
withFile: antenna.withFile,
|
withFile: antenna.withFile,
|
||||||
isActive: antenna.isActive,
|
isActive: antenna.isActive,
|
||||||
|
|
|
@ -111,6 +111,7 @@ export class MetaEntityService {
|
||||||
policies: { ...DEFAULT_POLICIES, ...instance.policies },
|
policies: { ...DEFAULT_POLICIES, ...instance.policies },
|
||||||
|
|
||||||
mediaProxy: this.config.mediaProxy,
|
mediaProxy: this.config.mediaProxy,
|
||||||
|
enableUrlPreview: instance.urlPreviewEnabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
return packed;
|
return packed;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import * as Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import _Ajv from 'ajv';
|
import _Ajv from 'ajv';
|
||||||
import { ModuleRef } from '@nestjs/core';
|
import { ModuleRef } from '@nestjs/core';
|
||||||
|
import { In } from 'typeorm';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
|
@ -14,9 +15,30 @@ import type { Promiseable } from '@/misc/prelude/await-all.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||||
import type { MiLocalUser, MiPartialLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js';
|
import type { MiLocalUser, MiPartialLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js';
|
||||||
import { birthdaySchema, descriptionSchema, localUsernameSchema, locationSchema, nameSchema, passwordSchema } from '@/models/User.js';
|
import {
|
||||||
import { MiNotification } from '@/models/Notification.js';
|
birthdaySchema,
|
||||||
import type { UsersRepository, UserSecurityKeysRepository, FollowingsRepository, FollowRequestsRepository, BlockingsRepository, MutingsRepository, DriveFilesRepository, NoteUnreadsRepository, UserNotePiningsRepository, UserProfilesRepository, AnnouncementReadsRepository, AnnouncementsRepository, MiUserProfile, RenoteMutingsRepository, UserMemoRepository } from '@/models/_.js';
|
descriptionSchema,
|
||||||
|
localUsernameSchema,
|
||||||
|
locationSchema,
|
||||||
|
nameSchema,
|
||||||
|
passwordSchema,
|
||||||
|
} from '@/models/User.js';
|
||||||
|
import type {
|
||||||
|
BlockingsRepository,
|
||||||
|
FollowingsRepository,
|
||||||
|
FollowRequestsRepository,
|
||||||
|
MiFollowing,
|
||||||
|
MiUserNotePining,
|
||||||
|
MiUserProfile,
|
||||||
|
MutingsRepository,
|
||||||
|
NoteUnreadsRepository,
|
||||||
|
RenoteMutingsRepository,
|
||||||
|
UserMemoRepository,
|
||||||
|
UserNotePiningsRepository,
|
||||||
|
UserProfilesRepository,
|
||||||
|
UserSecurityKeysRepository,
|
||||||
|
UsersRepository,
|
||||||
|
} from '@/models/_.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
||||||
|
@ -46,11 +68,23 @@ function isRemoteUser(user: MiUser | { host: MiUser['host'] }): boolean {
|
||||||
return !isLocalUser(user);
|
return !isLocalUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type UserRelation = {
|
||||||
|
id: MiUser['id']
|
||||||
|
following: MiFollowing | null,
|
||||||
|
isFollowing: boolean
|
||||||
|
isFollowed: boolean
|
||||||
|
hasPendingFollowRequestFromYou: boolean
|
||||||
|
hasPendingFollowRequestToYou: boolean
|
||||||
|
isBlocking: boolean
|
||||||
|
isBlocked: boolean
|
||||||
|
isMuted: boolean
|
||||||
|
isRenoteMuted: boolean
|
||||||
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserEntityService implements OnModuleInit {
|
export class UserEntityService implements OnModuleInit {
|
||||||
private apPersonService: ApPersonService;
|
private apPersonService: ApPersonService;
|
||||||
private noteEntityService: NoteEntityService;
|
private noteEntityService: NoteEntityService;
|
||||||
private driveFileEntityService: DriveFileEntityService;
|
|
||||||
private pageEntityService: PageEntityService;
|
private pageEntityService: PageEntityService;
|
||||||
private customEmojiService: CustomEmojiService;
|
private customEmojiService: CustomEmojiService;
|
||||||
private announcementService: AnnouncementService;
|
private announcementService: AnnouncementService;
|
||||||
|
@ -89,9 +123,6 @@ export class UserEntityService implements OnModuleInit {
|
||||||
@Inject(DI.renoteMutingsRepository)
|
@Inject(DI.renoteMutingsRepository)
|
||||||
private renoteMutingsRepository: RenoteMutingsRepository,
|
private renoteMutingsRepository: RenoteMutingsRepository,
|
||||||
|
|
||||||
@Inject(DI.driveFilesRepository)
|
|
||||||
private driveFilesRepository: DriveFilesRepository,
|
|
||||||
|
|
||||||
@Inject(DI.noteUnreadsRepository)
|
@Inject(DI.noteUnreadsRepository)
|
||||||
private noteUnreadsRepository: NoteUnreadsRepository,
|
private noteUnreadsRepository: NoteUnreadsRepository,
|
||||||
|
|
||||||
|
@ -101,12 +132,6 @@ export class UserEntityService implements OnModuleInit {
|
||||||
@Inject(DI.userProfilesRepository)
|
@Inject(DI.userProfilesRepository)
|
||||||
private userProfilesRepository: UserProfilesRepository,
|
private userProfilesRepository: UserProfilesRepository,
|
||||||
|
|
||||||
@Inject(DI.announcementReadsRepository)
|
|
||||||
private announcementReadsRepository: AnnouncementReadsRepository,
|
|
||||||
|
|
||||||
@Inject(DI.announcementsRepository)
|
|
||||||
private announcementsRepository: AnnouncementsRepository,
|
|
||||||
|
|
||||||
@Inject(DI.userMemosRepository)
|
@Inject(DI.userMemosRepository)
|
||||||
private userMemosRepository: UserMemoRepository,
|
private userMemosRepository: UserMemoRepository,
|
||||||
) {
|
) {
|
||||||
|
@ -115,7 +140,6 @@ export class UserEntityService implements OnModuleInit {
|
||||||
onModuleInit() {
|
onModuleInit() {
|
||||||
this.apPersonService = this.moduleRef.get('ApPersonService');
|
this.apPersonService = this.moduleRef.get('ApPersonService');
|
||||||
this.noteEntityService = this.moduleRef.get('NoteEntityService');
|
this.noteEntityService = this.moduleRef.get('NoteEntityService');
|
||||||
this.driveFileEntityService = this.moduleRef.get('DriveFileEntityService');
|
|
||||||
this.pageEntityService = this.moduleRef.get('PageEntityService');
|
this.pageEntityService = this.moduleRef.get('PageEntityService');
|
||||||
this.customEmojiService = this.moduleRef.get('CustomEmojiService');
|
this.customEmojiService = this.moduleRef.get('CustomEmojiService');
|
||||||
this.announcementService = this.moduleRef.get('AnnouncementService');
|
this.announcementService = this.moduleRef.get('AnnouncementService');
|
||||||
|
@ -138,7 +162,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
public isRemoteUser = isRemoteUser;
|
public isRemoteUser = isRemoteUser;
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async getRelation(me: MiUser['id'], target: MiUser['id']) {
|
public async getRelation(me: MiUser['id'], target: MiUser['id']): Promise<UserRelation> {
|
||||||
const [
|
const [
|
||||||
following,
|
following,
|
||||||
isFollowed,
|
isFollowed,
|
||||||
|
@ -211,6 +235,59 @@ export class UserEntityService implements OnModuleInit {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public async getRelations(me: MiUser['id'], targets: MiUser['id'][]): Promise<Map<MiUser['id'], UserRelation>> {
|
||||||
|
const [
|
||||||
|
followers,
|
||||||
|
followees,
|
||||||
|
followersRequests,
|
||||||
|
followeesRequests,
|
||||||
|
blockers,
|
||||||
|
blockees,
|
||||||
|
muters,
|
||||||
|
renoteMuters,
|
||||||
|
] = await Promise.all([
|
||||||
|
this.followingsRepository.findBy({ followerId: me })
|
||||||
|
.then(f => new Map(f.map(it => [it.followeeId, it]))),
|
||||||
|
this.followingsRepository.findBy({ followeeId: me })
|
||||||
|
.then(it => it.map(it => it.followerId)),
|
||||||
|
this.followRequestsRepository.findBy({ followerId: me })
|
||||||
|
.then(it => it.map(it => it.followeeId)),
|
||||||
|
this.followRequestsRepository.findBy({ followeeId: me })
|
||||||
|
.then(it => it.map(it => it.followerId)),
|
||||||
|
this.blockingsRepository.findBy({ blockerId: me })
|
||||||
|
.then(it => it.map(it => it.blockeeId)),
|
||||||
|
this.blockingsRepository.findBy({ blockeeId: me })
|
||||||
|
.then(it => it.map(it => it.blockerId)),
|
||||||
|
this.mutingsRepository.findBy({ muterId: me })
|
||||||
|
.then(it => it.map(it => it.muteeId)),
|
||||||
|
this.renoteMutingsRepository.findBy({ muterId: me })
|
||||||
|
.then(it => it.map(it => it.muteeId)),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return new Map(
|
||||||
|
targets.map(target => {
|
||||||
|
const following = followers.get(target) ?? null;
|
||||||
|
|
||||||
|
return [
|
||||||
|
target,
|
||||||
|
{
|
||||||
|
id: target,
|
||||||
|
following: following,
|
||||||
|
isFollowing: following != null,
|
||||||
|
isFollowed: followees.includes(target),
|
||||||
|
hasPendingFollowRequestFromYou: followersRequests.includes(target),
|
||||||
|
hasPendingFollowRequestToYou: followeesRequests.includes(target),
|
||||||
|
isBlocking: blockers.includes(target),
|
||||||
|
isBlocked: blockees.includes(target),
|
||||||
|
isMuted: muters.includes(target),
|
||||||
|
isRenoteMuted: renoteMuters.includes(target),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async getHasUnreadAntenna(userId: MiUser['id']): Promise<boolean> {
|
public async getHasUnreadAntenna(userId: MiUser['id']): Promise<boolean> {
|
||||||
/*
|
/*
|
||||||
|
@ -303,6 +380,9 @@ export class UserEntityService implements OnModuleInit {
|
||||||
schema?: S,
|
schema?: S,
|
||||||
includeSecrets?: boolean,
|
includeSecrets?: boolean,
|
||||||
userProfile?: MiUserProfile,
|
userProfile?: MiUserProfile,
|
||||||
|
userRelations?: Map<MiUser['id'], UserRelation>,
|
||||||
|
userMemos?: Map<MiUser['id'], string | null>,
|
||||||
|
pinNotes?: Map<MiUser['id'], MiUserNotePining[]>,
|
||||||
},
|
},
|
||||||
): Promise<Packed<S>> {
|
): Promise<Packed<S>> {
|
||||||
const opts = Object.assign({
|
const opts = Object.assign({
|
||||||
|
@ -317,13 +397,41 @@ export class UserEntityService implements OnModuleInit {
|
||||||
const isMe = meId === user.id;
|
const isMe = meId === user.id;
|
||||||
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false;
|
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false;
|
||||||
|
|
||||||
const relation = meId && !isMe && isDetailed ? await this.getRelation(meId, user.id) : null;
|
const profile = isDetailed
|
||||||
const pins = isDetailed ? await this.userNotePiningsRepository.createQueryBuilder('pin')
|
? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id }))
|
||||||
.where('pin.userId = :userId', { userId: user.id })
|
: null;
|
||||||
.innerJoinAndSelect('pin.note', 'note')
|
|
||||||
.orderBy('pin.id', 'DESC')
|
let relation: UserRelation | null = null;
|
||||||
.getMany() : [];
|
if (meId && !isMe && isDetailed) {
|
||||||
const profile = isDetailed ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null;
|
if (opts.userRelations) {
|
||||||
|
relation = opts.userRelations.get(user.id) ?? null;
|
||||||
|
} else {
|
||||||
|
relation = await this.getRelation(meId, user.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let memo: string | null = null;
|
||||||
|
if (isDetailed && meId) {
|
||||||
|
if (opts.userMemos) {
|
||||||
|
memo = opts.userMemos.get(user.id) ?? null;
|
||||||
|
} else {
|
||||||
|
memo = await this.userMemosRepository.findOneBy({ userId: meId, targetUserId: user.id })
|
||||||
|
.then(row => row?.memo ?? null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let pins: MiUserNotePining[] = [];
|
||||||
|
if (isDetailed) {
|
||||||
|
if (opts.pinNotes) {
|
||||||
|
pins = opts.pinNotes.get(user.id) ?? [];
|
||||||
|
} else {
|
||||||
|
pins = await this.userNotePiningsRepository.createQueryBuilder('pin')
|
||||||
|
.where('pin.userId = :userId', { userId: user.id })
|
||||||
|
.innerJoinAndSelect('pin.note', 'note')
|
||||||
|
.orderBy('pin.id', 'DESC')
|
||||||
|
.getMany();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const followingCount = profile == null ? null :
|
const followingCount = profile == null ? null :
|
||||||
(profile.followingVisibility === 'public') || isMe ? user.followingCount :
|
(profile.followingVisibility === 'public') || isMe ? user.followingCount :
|
||||||
|
@ -416,9 +524,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
twoFactorEnabled: profile!.twoFactorEnabled,
|
twoFactorEnabled: profile!.twoFactorEnabled,
|
||||||
usePasswordLessLogin: profile!.usePasswordLessLogin,
|
usePasswordLessLogin: profile!.usePasswordLessLogin,
|
||||||
securityKeys: profile!.twoFactorEnabled
|
securityKeys: profile!.twoFactorEnabled
|
||||||
? this.userSecurityKeysRepository.countBy({
|
? this.userSecurityKeysRepository.countBy({ userId: user.id }).then(result => result >= 1)
|
||||||
userId: user.id,
|
|
||||||
}).then(result => result >= 1)
|
|
||||||
: false,
|
: false,
|
||||||
roles: this.roleService.getUserRoles(user.id).then(roles => roles.filter(role => role.isPublic).sort((a, b) => b.displayOrder - a.displayOrder).map(role => ({
|
roles: this.roleService.getUserRoles(user.id).then(roles => roles.filter(role => role.isPublic).sort((a, b) => b.displayOrder - a.displayOrder).map(role => ({
|
||||||
id: role.id,
|
id: role.id,
|
||||||
|
@ -430,10 +536,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
isAdministrator: role.isAdministrator,
|
isAdministrator: role.isAdministrator,
|
||||||
displayOrder: role.displayOrder,
|
displayOrder: role.displayOrder,
|
||||||
}))),
|
}))),
|
||||||
memo: meId == null ? null : await this.userMemosRepository.findOneBy({
|
memo: memo,
|
||||||
userId: meId,
|
|
||||||
targetUserId: user.id,
|
|
||||||
}).then(row => row?.memo ?? null),
|
|
||||||
moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined,
|
moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined,
|
||||||
} : {}),
|
} : {}),
|
||||||
|
|
||||||
|
@ -514,7 +617,7 @@ export class UserEntityService implements OnModuleInit {
|
||||||
return await awaitAll(packed);
|
return await awaitAll(packed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public packMany<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
|
public async packMany<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
|
||||||
users: (MiUser['id'] | MiUser)[],
|
users: (MiUser['id'] | MiUser)[],
|
||||||
me?: { id: MiUser['id'] } | null | undefined,
|
me?: { id: MiUser['id'] } | null | undefined,
|
||||||
options?: {
|
options?: {
|
||||||
|
@ -522,6 +625,70 @@ export class UserEntityService implements OnModuleInit {
|
||||||
includeSecrets?: boolean,
|
includeSecrets?: boolean,
|
||||||
},
|
},
|
||||||
): Promise<Packed<S>[]> {
|
): Promise<Packed<S>[]> {
|
||||||
return Promise.all(users.map(u => this.pack(u, me, options)));
|
// -- IDのみの要素を補完して完全なエンティティ一覧を作る
|
||||||
|
|
||||||
|
const _users = users.filter((user): user is MiUser => typeof user !== 'string');
|
||||||
|
if (_users.length !== users.length) {
|
||||||
|
_users.push(
|
||||||
|
...await this.usersRepository.findBy({
|
||||||
|
id: In(users.filter((user): user is string => typeof user === 'string')),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const _userIds = _users.map(u => u.id);
|
||||||
|
|
||||||
|
// -- 特に前提条件のない値群を取得
|
||||||
|
|
||||||
|
const profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
|
||||||
|
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
|
||||||
|
|
||||||
|
// -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得
|
||||||
|
|
||||||
|
let userRelations: Map<MiUser['id'], UserRelation> = new Map();
|
||||||
|
let userMemos: Map<MiUser['id'], string | null> = new Map();
|
||||||
|
let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map();
|
||||||
|
|
||||||
|
if (options?.schema !== 'UserLite') {
|
||||||
|
const meId = me ? me.id : null;
|
||||||
|
if (meId) {
|
||||||
|
userMemos = await this.userMemosRepository.findBy({ userId: meId })
|
||||||
|
.then(memos => new Map(memos.map(memo => [memo.targetUserId, memo.memo])));
|
||||||
|
|
||||||
|
if (_userIds.length > 0) {
|
||||||
|
userRelations = await this.getRelations(meId, _userIds);
|
||||||
|
pinNotes = await this.userNotePiningsRepository.createQueryBuilder('pin')
|
||||||
|
.where('pin.userId IN (:...userIds)', { userIds: _userIds })
|
||||||
|
.innerJoinAndSelect('pin.note', 'note')
|
||||||
|
.getMany()
|
||||||
|
.then(pinsNotes => {
|
||||||
|
const map = new Map<MiUser['id'], MiUserNotePining[]>();
|
||||||
|
for (const note of pinsNotes) {
|
||||||
|
const notes = map.get(note.userId) ?? [];
|
||||||
|
notes.push(note);
|
||||||
|
map.set(note.userId, notes);
|
||||||
|
}
|
||||||
|
for (const [, notes] of map.entries()) {
|
||||||
|
// pack側ではDESCで取得しているので、それに合わせて降順に並び替えておく
|
||||||
|
notes.sort((a, b) => b.id.localeCompare(a.id));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.all(
|
||||||
|
_users.map(u => this.pack(
|
||||||
|
u,
|
||||||
|
me,
|
||||||
|
{
|
||||||
|
...options,
|
||||||
|
userProfile: profilesMap.get(u.id),
|
||||||
|
userRelations: userRelations,
|
||||||
|
userMemos: userMemos,
|
||||||
|
pinNotes: pinNotes,
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import type { onRequestHookHandler } from 'fastify';
|
import type { onRequestHookHandler } from 'fastify';
|
||||||
|
|
||||||
export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => {
|
export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import type { MiNote } from '@/models/Note.js';
|
import type { MiNote } from '@/models/Note.js';
|
||||||
|
|
||||||
export function isPureRenote(note: MiNote): note is MiNote & { renoteId: NonNullable<MiNote['renoteId']> } {
|
export function isPureRenote(note: MiNote): note is MiNote & { renoteId: NonNullable<MiNote['renoteId']> } {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export type FetchFunction<K, V> = (key: K) => Promise<V>;
|
export type FetchFunction<K, V> = (key: K) => Promise<V>;
|
||||||
|
|
||||||
type ResolveReject<V> = Parameters<ConstructorParameters<typeof Promise<V>>[0]>;
|
type ResolveReject<V> = Parameters<ConstructorParameters<typeof Promise<V>>[0]>;
|
||||||
|
|
|
@ -72,6 +72,11 @@ export class MiAntenna {
|
||||||
})
|
})
|
||||||
public caseSensitive: boolean;
|
public caseSensitive: boolean;
|
||||||
|
|
||||||
|
@Column('boolean', {
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public excludeBots: boolean;
|
||||||
|
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
|
|
|
@ -277,12 +277,6 @@ export class MiMeta {
|
||||||
})
|
})
|
||||||
public enableSensitiveMediaDetectionForVideos: boolean;
|
public enableSensitiveMediaDetectionForVideos: boolean;
|
||||||
|
|
||||||
@Column('varchar', {
|
|
||||||
length: 1024,
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
public summalyProxy: string | null;
|
|
||||||
|
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
|
@ -588,4 +582,36 @@ export class MiMeta {
|
||||||
default: 0,
|
default: 0,
|
||||||
})
|
})
|
||||||
public notesPerOneAd: number;
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||||
import { id } from './util/id.js';
|
import { id } from './util/id.js';
|
||||||
import { MiUser } from './User.js';
|
import { MiUser } from './User.js';
|
||||||
|
|
|
@ -76,6 +76,11 @@ export const packedAntennaSchema = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
|
excludeBots: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
withReplies: {
|
withReplies: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
|
|
@ -207,6 +207,10 @@ export const packedMetaLiteSchema = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
|
enableUrlPreview: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
backgroundImageUrl: {
|
backgroundImageUrl: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: true,
|
optional: false, nullable: true,
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export const packedSigninSchema = {
|
export const packedSigninSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
|
|
|
@ -81,6 +81,7 @@ export class ExportAntennasProcessorService {
|
||||||
}) : null,
|
}) : null,
|
||||||
caseSensitive: antenna.caseSensitive,
|
caseSensitive: antenna.caseSensitive,
|
||||||
localOnly: antenna.localOnly,
|
localOnly: antenna.localOnly,
|
||||||
|
excludeBots: antenna.excludeBots,
|
||||||
withReplies: antenna.withReplies,
|
withReplies: antenna.withReplies,
|
||||||
withFile: antenna.withFile,
|
withFile: antenna.withFile,
|
||||||
notify: antenna.notify,
|
notify: antenna.notify,
|
||||||
|
|
|
@ -44,6 +44,7 @@ const validate = new Ajv().compile({
|
||||||
} },
|
} },
|
||||||
caseSensitive: { type: 'boolean' },
|
caseSensitive: { type: 'boolean' },
|
||||||
localOnly: { type: 'boolean' },
|
localOnly: { type: 'boolean' },
|
||||||
|
excludeBots: { type: 'boolean' },
|
||||||
withReplies: { type: 'boolean' },
|
withReplies: { type: 'boolean' },
|
||||||
withFile: { type: 'boolean' },
|
withFile: { type: 'boolean' },
|
||||||
notify: { 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),
|
users: (antenna.src === 'list' && antenna.userListAccts !== null ? antenna.userListAccts : antenna.users).filter(Boolean),
|
||||||
caseSensitive: antenna.caseSensitive,
|
caseSensitive: antenna.caseSensitive,
|
||||||
localOnly: antenna.localOnly,
|
localOnly: antenna.localOnly,
|
||||||
|
excludeBots: antenna.excludeBots,
|
||||||
withReplies: antenna.withReplies,
|
withReplies: antenna.withReplies,
|
||||||
withFile: antenna.withFile,
|
withFile: antenna.withFile,
|
||||||
notify: antenna.notify,
|
notify: antenna.notify,
|
||||||
|
|
|
@ -434,6 +434,8 @@ export const meta = {
|
||||||
summalyProxy: {
|
summalyProxy: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: true,
|
optional: false, nullable: true,
|
||||||
|
deprecated: true,
|
||||||
|
description: '[Deprecated] Use "urlPreviewSummaryProxyUrl" instead.',
|
||||||
},
|
},
|
||||||
themeColor: {
|
themeColor: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -451,6 +453,30 @@ export const meta = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
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;
|
} as const;
|
||||||
|
@ -533,7 +559,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
|
setSensitiveFlagAutomatically: instance.setSensitiveFlagAutomatically,
|
||||||
enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
|
enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos,
|
||||||
proxyAccountId: instance.proxyAccountId,
|
proxyAccountId: instance.proxyAccountId,
|
||||||
summalyProxy: instance.summalyProxy,
|
|
||||||
email: instance.email,
|
email: instance.email,
|
||||||
smtpSecure: instance.smtpSecure,
|
smtpSecure: instance.smtpSecure,
|
||||||
smtpHost: instance.smtpHost,
|
smtpHost: instance.smtpHost,
|
||||||
|
@ -577,6 +602,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
||||||
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
||||||
notesPerOneAd: instance.notesPerOneAd,
|
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',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
summalyProxy: { type: 'string', nullable: true },
|
|
||||||
deeplAuthKey: { type: 'string', nullable: true },
|
deeplAuthKey: { type: 'string', nullable: true },
|
||||||
deeplIsPro: { type: 'boolean' },
|
deeplIsPro: { type: 'boolean' },
|
||||||
enableEmail: { type: 'boolean' },
|
enableEmail: { type: 'boolean' },
|
||||||
|
@ -150,6 +149,16 @@ export const paramDef = {
|
||||||
type: 'string',
|
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: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -353,10 +362,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
set.langs = ps.langs.filter(Boolean);
|
set.langs = ps.langs.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.summalyProxy !== undefined) {
|
|
||||||
set.summalyProxy = ps.summalyProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ps.enableEmail !== undefined) {
|
if (ps.enableEmail !== undefined) {
|
||||||
set.enableEmail = ps.enableEmail;
|
set.enableEmail = ps.enableEmail;
|
||||||
}
|
}
|
||||||
|
@ -581,6 +586,32 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
set.bannedEmailDomains = ps.bannedEmailDomains;
|
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);
|
const before = await this.metaService.fetch(true);
|
||||||
|
|
||||||
await this.metaService.update(set);
|
await this.metaService.update(set);
|
||||||
|
|
|
@ -64,6 +64,7 @@ export const paramDef = {
|
||||||
} },
|
} },
|
||||||
caseSensitive: { type: 'boolean' },
|
caseSensitive: { type: 'boolean' },
|
||||||
localOnly: { type: 'boolean' },
|
localOnly: { type: 'boolean' },
|
||||||
|
excludeBots: { type: 'boolean' },
|
||||||
withReplies: { type: 'boolean' },
|
withReplies: { type: 'boolean' },
|
||||||
withFile: { type: 'boolean' },
|
withFile: { type: 'boolean' },
|
||||||
notify: { type: 'boolean' },
|
notify: { type: 'boolean' },
|
||||||
|
@ -124,6 +125,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
users: ps.users,
|
users: ps.users,
|
||||||
caseSensitive: ps.caseSensitive,
|
caseSensitive: ps.caseSensitive,
|
||||||
localOnly: ps.localOnly,
|
localOnly: ps.localOnly,
|
||||||
|
excludeBots: ps.excludeBots,
|
||||||
withReplies: ps.withReplies,
|
withReplies: ps.withReplies,
|
||||||
withFile: ps.withFile,
|
withFile: ps.withFile,
|
||||||
notify: ps.notify,
|
notify: ps.notify,
|
||||||
|
|
|
@ -63,6 +63,7 @@ export const paramDef = {
|
||||||
} },
|
} },
|
||||||
caseSensitive: { type: 'boolean' },
|
caseSensitive: { type: 'boolean' },
|
||||||
localOnly: { type: 'boolean' },
|
localOnly: { type: 'boolean' },
|
||||||
|
excludeBots: { type: 'boolean' },
|
||||||
withReplies: { type: 'boolean' },
|
withReplies: { type: 'boolean' },
|
||||||
withFile: { type: 'boolean' },
|
withFile: { type: 'boolean' },
|
||||||
notify: { type: 'boolean' },
|
notify: { type: 'boolean' },
|
||||||
|
@ -120,6 +121,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
users: ps.users,
|
users: ps.users,
|
||||||
caseSensitive: ps.caseSensitive,
|
caseSensitive: ps.caseSensitive,
|
||||||
localOnly: ps.localOnly,
|
localOnly: ps.localOnly,
|
||||||
|
excludeBots: ps.excludeBots,
|
||||||
withReplies: ps.withReplies,
|
withReplies: ps.withReplies,
|
||||||
withFile: ps.withFile,
|
withFile: ps.withFile,
|
||||||
notify: ps.notify,
|
notify: ps.notify,
|
||||||
|
|
|
@ -44,6 +44,7 @@ export const paramDef = {
|
||||||
permissions: { type: 'array', items: {
|
permissions: { type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
} },
|
||||||
|
visibility: { type: 'string', enum: ['public', 'private'], default: 'public' },
|
||||||
},
|
},
|
||||||
required: ['title', 'summary', 'script', 'permissions'],
|
required: ['title', 'summary', 'script', 'permissions'],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -66,6 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
summary: ps.summary,
|
summary: ps.summary,
|
||||||
script: ps.script,
|
script: ps.script,
|
||||||
permissions: ps.permissions,
|
permissions: ps.permissions,
|
||||||
|
visibility: ps.visibility,
|
||||||
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));
|
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
return await this.flashEntityService.pack(flash);
|
return await this.flashEntityService.pack(flash);
|
||||||
|
|
|
@ -132,11 +132,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const ids = Array.isArray(ps.userId) ? ps.userId : [ps.userId];
|
return Array.isArray(ps.userId)
|
||||||
|
? await this.userEntityService.getRelations(me.id, ps.userId).then(it => [...it.values()])
|
||||||
const relations = await Promise.all(ids.map(id => this.userEntityService.getRelation(me.id, id)));
|
: await this.userEntityService.getRelation(me.id, ps.userId).then(it => [it]);
|
||||||
|
|
||||||
return Array.isArray(ps.userId) ? relations : relations[0];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 hasBody = (schema.type === 'object' && schema.properties && Object.keys(schema.properties).length >= 1);
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
operationId: endpoint.name,
|
operationId: endpoint.name.replaceAll('/', '___'), // NOTE: スラッシュは使えない
|
||||||
summary: endpoint.name,
|
summary: endpoint.name,
|
||||||
description: desc,
|
description: desc,
|
||||||
externalDocs: {
|
externalDocs: {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { summaly } from '@misskey-dev/summaly';
|
import { summaly } from '@misskey-dev/summaly';
|
||||||
|
import { SummalyResult } from '@misskey-dev/summaly/built/summary.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import { MetaService } from '@/core/MetaService.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 { LoggerService } from '@/core/LoggerService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { ApiError } from '@/server/api/error.js';
|
import { ApiError } from '@/server/api/error.js';
|
||||||
|
import { MiMeta } from '@/models/Meta.js';
|
||||||
import type { FastifyRequest, FastifyReply } from 'fastify';
|
import type { FastifyRequest, FastifyReply } from 'fastify';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -62,24 +64,25 @@ export class UrlPreviewService {
|
||||||
|
|
||||||
const meta = await this.metaService.fetch();
|
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} ...`
|
? `(Proxy) Getting preview of ${url}@${lang} ...`
|
||||||
: `Getting preview of ${url}@${lang} ...`);
|
: `Getting preview of ${url}@${lang} ...`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const summary = meta.summalyProxy ?
|
const summary = meta.urlPreviewSummaryProxyUrl
|
||||||
await this.httpRequestService.getJson<ReturnType<typeof summaly>>(`${meta.summalyProxy}?${query({
|
? await this.fetchSummaryFromProxy(url, meta, lang)
|
||||||
url: url,
|
: await this.fetchSummary(url, meta, lang);
|
||||||
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,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.logger.succ(`Got preview of ${url}: ${summary.title}`);
|
this.logger.succ(`Got preview of ${url}: ${summary.title}`);
|
||||||
|
|
||||||
|
@ -100,6 +103,7 @@ export class UrlPreviewService {
|
||||||
return summary;
|
return summary;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.warn(`Failed to get preview of ${url}: ${err}`);
|
this.logger.warn(`Failed to get preview of ${url}: ${err}`);
|
||||||
|
|
||||||
reply.code(422);
|
reply.code(422);
|
||||||
reply.header('Cache-Control', 'max-age=86400, immutable');
|
reply.header('Cache-Control', 'max-age=86400, immutable');
|
||||||
return {
|
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
|
block vars
|
||||||
- const user = note.user;
|
- 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 url = `${config.url}/notes/${note.id}`;
|
||||||
- const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null;
|
- 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)
|
- const images = (note.files || []).filter(file => file.type.startsWith('image/') && !file.isSensitive)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends ./base
|
extends ./base
|
||||||
|
|
||||||
block vars
|
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)}`;
|
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
|
||||||
|
|
||||||
block title
|
block title
|
||||||
|
|
|
@ -44,6 +44,7 @@ describe('アンテナ', () => {
|
||||||
users: [''],
|
users: [''],
|
||||||
withFile: false,
|
withFile: false,
|
||||||
withReplies: false,
|
withReplies: false,
|
||||||
|
excludeBots: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let root: User;
|
let root: User;
|
||||||
|
@ -156,6 +157,7 @@ describe('アンテナ', () => {
|
||||||
users: [''],
|
users: [''],
|
||||||
withFile: false,
|
withFile: false,
|
||||||
withReplies: false,
|
withReplies: false,
|
||||||
|
excludeBots: false,
|
||||||
localOnly: false,
|
localOnly: false,
|
||||||
};
|
};
|
||||||
assert.deepStrictEqual(response, expected);
|
assert.deepStrictEqual(response, expected);
|
||||||
|
|
|
@ -158,19 +158,17 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* なんか失敗する
|
|
||||||
test('フォローしているユーザーの visibility: followers な投稿への返信が流れる', async () => {
|
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(
|
const fired = await waitFire(
|
||||||
ayano, 'homeTimeline', // ayano:home
|
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',
|
msg => msg.type === 'note' && msg.body.userId === kyoko.id && msg.body.reply.text === 'foo',
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
test('フォローしているユーザーのフォローしていないユーザーの visibility: followers な投稿への返信が流れない', async () => {
|
test('フォローしているユーザーのフォローしていないユーザーの visibility: followers な投稿への返信が流れない', async () => {
|
||||||
const chitoseNote = await post(chitose, { text: 'followers-only post', visibility: 'followers' });
|
const chitoseNote = await post(chitose, { text: 'followers-only post', visibility: 'followers' });
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { initTestDb, sendEnvResetRequest } from './utils.js';
|
import { initTestDb, sendEnvResetRequest } from './utils.js';
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { Test } from '@nestjs/testing';
|
import { Test } from '@nestjs/testing';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,528 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
|
import { GlobalModule } from '@/GlobalModule.js';
|
||||||
|
import { CoreModule } from '@/core/CoreModule.js';
|
||||||
|
import type { MiUser } from '@/models/User.js';
|
||||||
|
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||||
|
import { genAidx } from '@/misc/id/aidx.js';
|
||||||
|
import {
|
||||||
|
BlockingsRepository,
|
||||||
|
FollowingsRepository, FollowRequestsRepository,
|
||||||
|
MiUserProfile, MutingsRepository, RenoteMutingsRepository,
|
||||||
|
UserMemoRepository,
|
||||||
|
UserProfilesRepository,
|
||||||
|
UsersRepository,
|
||||||
|
} from '@/models/_.js';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
|
||||||
|
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
||||||
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
|
import { PageEntityService } from '@/core/entities/PageEntityService.js';
|
||||||
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
|
import { AnnouncementService } from '@/core/AnnouncementService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||||
|
import { IdService } from '@/core/IdService.js';
|
||||||
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
|
import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||||
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
|
import { FetchInstanceMetadataService } from '@/core/FetchInstanceMetadataService.js';
|
||||||
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
|
import { ApResolverService } from '@/core/activitypub/ApResolverService.js';
|
||||||
|
import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js';
|
||||||
|
import { ApImageService } from '@/core/activitypub/models/ApImageService.js';
|
||||||
|
import { ApMfmService } from '@/core/activitypub/ApMfmService.js';
|
||||||
|
import { MfmService } from '@/core/MfmService.js';
|
||||||
|
import { HashtagService } from '@/core/HashtagService.js';
|
||||||
|
import UsersChart from '@/core/chart/charts/users.js';
|
||||||
|
import { ChartLoggerService } from '@/core/chart/ChartLoggerService.js';
|
||||||
|
import InstanceChart from '@/core/chart/charts/instance.js';
|
||||||
|
import { ApLoggerService } from '@/core/activitypub/ApLoggerService.js';
|
||||||
|
import { AccountMoveService } from '@/core/AccountMoveService.js';
|
||||||
|
import { ReactionService } from '@/core/ReactionService.js';
|
||||||
|
import { NotificationService } from '@/core/NotificationService.js';
|
||||||
|
|
||||||
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
|
describe('UserEntityService', () => {
|
||||||
|
describe('pack/packMany', () => {
|
||||||
|
let app: TestingModule;
|
||||||
|
let service: UserEntityService;
|
||||||
|
let usersRepository: UsersRepository;
|
||||||
|
let userProfileRepository: UserProfilesRepository;
|
||||||
|
let userMemosRepository: UserMemoRepository;
|
||||||
|
let followingRepository: FollowingsRepository;
|
||||||
|
let followingRequestRepository: FollowRequestsRepository;
|
||||||
|
let blockingRepository: BlockingsRepository;
|
||||||
|
let mutingRepository: MutingsRepository;
|
||||||
|
let renoteMutingsRepository: RenoteMutingsRepository;
|
||||||
|
|
||||||
|
async function createUser(userData: Partial<MiUser> = {}, profileData: Partial<MiUserProfile> = {}) {
|
||||||
|
const un = secureRndstr(16);
|
||||||
|
const user = await usersRepository
|
||||||
|
.insert({
|
||||||
|
...userData,
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
username: un,
|
||||||
|
usernameLower: un,
|
||||||
|
})
|
||||||
|
.then(x => usersRepository.findOneByOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
|
await userProfileRepository.insert({
|
||||||
|
...profileData,
|
||||||
|
userId: user.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function memo(writer: MiUser, target: MiUser, memo: string) {
|
||||||
|
await userMemosRepository.insert({
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
userId: writer.id,
|
||||||
|
targetUserId: target.id,
|
||||||
|
memo,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function follow(follower: MiUser, followee: MiUser) {
|
||||||
|
await followingRepository.insert({
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
followerId: follower.id,
|
||||||
|
followeeId: followee.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function requestFollow(requester: MiUser, requestee: MiUser) {
|
||||||
|
await followingRequestRepository.insert({
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
followerId: requester.id,
|
||||||
|
followeeId: requestee.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function block(blocker: MiUser, blockee: MiUser) {
|
||||||
|
await blockingRepository.insert({
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
blockerId: blocker.id,
|
||||||
|
blockeeId: blockee.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function mute(mutant: MiUser, mutee: MiUser) {
|
||||||
|
await mutingRepository.insert({
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
muterId: mutant.id,
|
||||||
|
muteeId: mutee.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function muteRenote(mutant: MiUser, mutee: MiUser) {
|
||||||
|
await renoteMutingsRepository.insert({
|
||||||
|
id: genAidx(Date.now()),
|
||||||
|
muterId: mutant.id,
|
||||||
|
muteeId: mutee.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function randomIntRange(weight = 10) {
|
||||||
|
return [...Array(Math.floor(Math.random() * weight))].map((it, idx) => idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
const services = [
|
||||||
|
UserEntityService,
|
||||||
|
ApPersonService,
|
||||||
|
NoteEntityService,
|
||||||
|
PageEntityService,
|
||||||
|
CustomEmojiService,
|
||||||
|
AnnouncementService,
|
||||||
|
RoleService,
|
||||||
|
FederatedInstanceService,
|
||||||
|
IdService,
|
||||||
|
AvatarDecorationService,
|
||||||
|
UtilityService,
|
||||||
|
EmojiEntityService,
|
||||||
|
ModerationLogService,
|
||||||
|
GlobalEventService,
|
||||||
|
DriveFileEntityService,
|
||||||
|
MetaService,
|
||||||
|
FetchInstanceMetadataService,
|
||||||
|
CacheService,
|
||||||
|
ApResolverService,
|
||||||
|
ApNoteService,
|
||||||
|
ApImageService,
|
||||||
|
ApMfmService,
|
||||||
|
MfmService,
|
||||||
|
HashtagService,
|
||||||
|
UsersChart,
|
||||||
|
ChartLoggerService,
|
||||||
|
InstanceChart,
|
||||||
|
ApLoggerService,
|
||||||
|
AccountMoveService,
|
||||||
|
ReactionService,
|
||||||
|
NotificationService,
|
||||||
|
];
|
||||||
|
|
||||||
|
app = await Test.createTestingModule({
|
||||||
|
imports: [GlobalModule, CoreModule],
|
||||||
|
providers: [
|
||||||
|
...services,
|
||||||
|
...services.map(x => ({ provide: x.name, useExisting: x })),
|
||||||
|
],
|
||||||
|
}).compile();
|
||||||
|
await app.init();
|
||||||
|
app.enableShutdownHooks();
|
||||||
|
|
||||||
|
service = app.get<UserEntityService>(UserEntityService);
|
||||||
|
usersRepository = app.get<UsersRepository>(DI.usersRepository);
|
||||||
|
userProfileRepository = app.get<UserProfilesRepository>(DI.userProfilesRepository);
|
||||||
|
userMemosRepository = app.get<UserMemoRepository>(DI.userMemosRepository);
|
||||||
|
followingRepository = app.get<FollowingsRepository>(DI.followingsRepository);
|
||||||
|
followingRequestRepository = app.get<FollowRequestsRepository>(DI.followRequestsRepository);
|
||||||
|
blockingRepository = app.get<BlockingsRepository>(DI.blockingsRepository);
|
||||||
|
mutingRepository = app.get<MutingsRepository>(DI.mutingsRepository);
|
||||||
|
renoteMutingsRepository = app.get<RenoteMutingsRepository>(DI.renoteMutingsRepository);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await app.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('UserLite', async() => {
|
||||||
|
const me = await createUser();
|
||||||
|
const who = await createUser();
|
||||||
|
|
||||||
|
await memo(me, who, 'memo');
|
||||||
|
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserLite' }) as any;
|
||||||
|
// no detail
|
||||||
|
expect(actual.memo).toBeUndefined();
|
||||||
|
// no detail and me
|
||||||
|
expect(actual.birthday).toBeUndefined();
|
||||||
|
// no detail and me
|
||||||
|
expect(actual.achievements).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('UserDetailedNotMe', async() => {
|
||||||
|
const me = await createUser();
|
||||||
|
const who = await createUser({}, { birthday: '2000-01-01' });
|
||||||
|
|
||||||
|
await memo(me, who, 'memo');
|
||||||
|
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailedNotMe' }) as any;
|
||||||
|
// is detail
|
||||||
|
expect(actual.memo).toBe('memo');
|
||||||
|
// is detail
|
||||||
|
expect(actual.birthday).toBe('2000-01-01');
|
||||||
|
// no detail and me
|
||||||
|
expect(actual.achievements).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('MeDetailed', async() => {
|
||||||
|
const achievements = [{ name: 'achievement', unlockedAt: new Date().getTime() }];
|
||||||
|
const me = await createUser({}, {
|
||||||
|
birthday: '2000-01-01',
|
||||||
|
achievements: achievements,
|
||||||
|
});
|
||||||
|
await memo(me, me, 'memo');
|
||||||
|
|
||||||
|
const actual = await service.pack(me, me, { schema: 'MeDetailed' }) as any;
|
||||||
|
// is detail
|
||||||
|
expect(actual.memo).toBe('memo');
|
||||||
|
// is detail
|
||||||
|
expect(actual.birthday).toBe('2000-01-01');
|
||||||
|
// is detail and me
|
||||||
|
expect(actual.achievements).toEqual(achievements);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('packManyによるpreloadがある時、preloadが無い時とpackの結果が同じになるか見たい', () => {
|
||||||
|
test('no-preload', async() => {
|
||||||
|
const me = await createUser();
|
||||||
|
// meがフォローしてる人たち
|
||||||
|
const followeeMe = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of followeeMe) {
|
||||||
|
await follow(me, who);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(true);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meをフォローしてる人たち
|
||||||
|
const followerMe = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of followerMe) {
|
||||||
|
await follow(who, me);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(true);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meがフォローリクエストを送った人たち
|
||||||
|
const requestsFromYou = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of requestsFromYou) {
|
||||||
|
await requestFollow(me, who);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(true);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meにフォローリクエストを送った人たち
|
||||||
|
const requestsToYou = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of requestsToYou) {
|
||||||
|
await requestFollow(who, me);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(true);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meがブロックしてる人たち
|
||||||
|
const blockingYou = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of blockingYou) {
|
||||||
|
await block(me, who);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(true);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meをブロックしてる人たち
|
||||||
|
const blockingMe = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of blockingMe) {
|
||||||
|
await block(who, me);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(true);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meがミュートしてる人たち
|
||||||
|
const muters = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of muters) {
|
||||||
|
await mute(me, who);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(true);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// meがリノートミュートしてる人たち
|
||||||
|
const renoteMuters = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of renoteMuters) {
|
||||||
|
await muteRenote(me, who);
|
||||||
|
const actual = await service.pack(who, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('preload', async() => {
|
||||||
|
const me = await createUser();
|
||||||
|
|
||||||
|
{
|
||||||
|
// meがフォローしてる人たち
|
||||||
|
const followeeMe = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of followeeMe) {
|
||||||
|
await follow(me, who);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(followeeMe, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(true);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meをフォローしてる人たち
|
||||||
|
const followerMe = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of followerMe) {
|
||||||
|
await follow(who, me);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(followerMe, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(true);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meがフォローリクエストを送った人たち
|
||||||
|
const requestsFromYou = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of requestsFromYou) {
|
||||||
|
await requestFollow(me, who);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(requestsFromYou, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(true);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meにフォローリクエストを送った人たち
|
||||||
|
const requestsToYou = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of requestsToYou) {
|
||||||
|
await requestFollow(who, me);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(requestsToYou, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(true);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meがブロックしてる人たち
|
||||||
|
const blockingYou = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of blockingYou) {
|
||||||
|
await block(me, who);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(blockingYou, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(true);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meをブロックしてる人たち
|
||||||
|
const blockingMe = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of blockingMe) {
|
||||||
|
await block(who, me);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(blockingMe, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(true);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meがミュートしてる人たち
|
||||||
|
const muters = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of muters) {
|
||||||
|
await mute(me, who);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(muters, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(true);
|
||||||
|
expect(actual.isRenoteMuted).toBe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// meがリノートミュートしてる人たち
|
||||||
|
const renoteMuters = await Promise.all(randomIntRange().map(() => createUser()));
|
||||||
|
for (const who of renoteMuters) {
|
||||||
|
await muteRenote(me, who);
|
||||||
|
}
|
||||||
|
const actualList = await service.packMany(renoteMuters, me, { schema: 'UserDetailed' }) as any;
|
||||||
|
for (const actual of actualList) {
|
||||||
|
expect(actual.isFollowing).toBe(false);
|
||||||
|
expect(actual.isFollowed).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestFromYou).toBe(false);
|
||||||
|
expect(actual.hasPendingFollowRequestToYou).toBe(false);
|
||||||
|
expect(actual.isBlocking).toBe(false);
|
||||||
|
expect(actual.isBlocked).toBe(false);
|
||||||
|
expect(actual.isMuted).toBe(false);
|
||||||
|
expect(actual.isRenoteMuted).toBe(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
import { DebounceLoader } from '@/misc/loader.js';
|
import { DebounceLoader } from '@/misc/loader.js';
|
||||||
|
|
||||||
class Mock {
|
class Mock {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous">
|
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous">
|
||||||
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous">
|
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@2.44.0/tabler-icons.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@2.44.0/tabler-icons.min.css">
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"rollup": "4.12.0",
|
"rollup": "4.12.0",
|
||||||
"sanitize-html": "2.12.1",
|
"sanitize-html": "2.12.1",
|
||||||
"sass": "1.71.1",
|
"sass": "1.71.1",
|
||||||
"shiki": "1.1.7",
|
"shiki": "1.2.0",
|
||||||
"strict-event-emitter-types": "2.0.0",
|
"strict-event-emitter-types": "2.0.0",
|
||||||
"textarea-caret": "3.1.0",
|
"textarea-caret": "3.1.0",
|
||||||
"three": "0.162.0",
|
"three": "0.162.0",
|
||||||
|
|
|
@ -145,8 +145,11 @@ export async function common(createVue: () => App<Element>) {
|
||||||
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
|
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
|
||||||
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
||||||
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
||||||
|
document.documentElement.dataset.colorMode = darkMode ? 'dark' : 'light';
|
||||||
}, { immediate: miLocalStorage.getItem('theme') == null });
|
}, { immediate: miLocalStorage.getItem('theme') == null });
|
||||||
|
|
||||||
|
document.documentElement.dataset.colorMode = defaultStore.state.darkMode ? 'dark' : 'light';
|
||||||
|
|
||||||
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
||||||
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
||||||
|
|
||||||
|
|
|
@ -75,27 +75,31 @@ export async function mainBoot() {
|
||||||
mainRouter.push('/search');
|
mainRouter.push('/search');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
if (defaultStore.state.enableSeasonalScreenEffect) {
|
if (defaultStore.state.enableSeasonalScreenEffect) {
|
||||||
const month = new Date().getMonth() + 1;
|
const month = new Date().getMonth() + 1;
|
||||||
if (defaultStore.state.hemisphere === 'S') {
|
if (defaultStore.state.hemisphere === 'S') {
|
||||||
// ▼南半球
|
// ▼南半球
|
||||||
if (month === 7 || month === 8) {
|
if (month === 7 || month === 8) {
|
||||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SnowfallEffect({}).render();
|
new SnowfallEffect({}).render();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ▼北半球
|
// ▼北半球
|
||||||
if (month === 12 || month === 1) {
|
if (month === 12 || month === 1) {
|
||||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SnowfallEffect({}).render();
|
new SnowfallEffect({}).render();
|
||||||
} else if (month === 3 || month === 4) {
|
} else if (month === 3 || month === 4) {
|
||||||
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SakuraEffect({
|
new SakuraEffect({
|
||||||
sakura: true,
|
sakura: true,
|
||||||
}).render();
|
}).render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// console.error(error);
|
||||||
|
console.error('Failed to initialise the seasonal screen effect canvas context:', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
|
|
|
@ -9,9 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { bundledLanguagesInfo } from 'shiki';
|
import { bundledLanguagesInfo } from 'shiki/langs';
|
||||||
import type { BuiltinLanguage } from 'shiki';
|
import type { BundledLanguage } from 'shiki/langs';
|
||||||
import { getHighlighter, getTheme } from '@/scripts/code-highlighter.js';
|
import { getHighlighter, getTheme } from '@/scripts/code-highlighter.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const highlighter = await getHighlighter();
|
const highlighter = await getHighlighter();
|
||||||
const darkMode = defaultStore.reactiveState.darkMode;
|
const darkMode = defaultStore.reactiveState.darkMode;
|
||||||
const codeLang = ref<BuiltinLanguage | 'aiscript'>('js');
|
const codeLang = ref<BundledLanguage | 'aiscript'>('js');
|
||||||
|
|
||||||
const [lightThemeName, darkThemeName] = await Promise.all([
|
const [lightThemeName, darkThemeName] = await Promise.all([
|
||||||
getTheme('light', true),
|
getTheme('light', true),
|
||||||
|
@ -42,7 +42,7 @@ const html = computed(() => highlighter.codeToHtml(props.code, {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
async function fetchLanguage(to: string): Promise<void> {
|
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.
|
// Check for the loaded languages, and load the language if it's not loaded yet.
|
||||||
if (!highlighter.getLoadedLanguages().includes(language)) {
|
if (!highlighter.getLoadedLanguages().includes(language)) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
:autocomplete="autocomplete"
|
:autocomplete="autocomplete"
|
||||||
:autocapitalize="autocapitalize"
|
:autocapitalize="autocapitalize"
|
||||||
:spellcheck="spellcheck"
|
:spellcheck="spellcheck"
|
||||||
|
:inputmode="inputmode"
|
||||||
:step="step"
|
:step="step"
|
||||||
:list="id"
|
:list="id"
|
||||||
:min="min"
|
:min="min"
|
||||||
|
@ -63,6 +64,7 @@ const props = defineProps<{
|
||||||
mfmAutocomplete?: boolean | SuggestionType[],
|
mfmAutocomplete?: boolean | SuggestionType[],
|
||||||
autocapitalize?: string;
|
autocapitalize?: string;
|
||||||
spellcheck?: boolean;
|
spellcheck?: boolean;
|
||||||
|
inputmode?: 'none' | 'text' | 'search' | 'email' | 'url' | 'numeric' | 'tel' | 'decimal';
|
||||||
step?: any;
|
step?: any;
|
||||||
datalist?: string[];
|
datalist?: string[];
|
||||||
min?: number;
|
min?: number;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { defineAsyncComponent, ref } from 'vue';
|
||||||
import { url as local } from '@/config.js';
|
import { url as local } from '@/config.js';
|
||||||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
import { isEnabledUrlPreview } from '@/instance.js';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -29,15 +30,17 @@ const self = props.url.startsWith(local);
|
||||||
const attr = self ? 'to' : 'href';
|
const attr = self ? 'to' : 'href';
|
||||||
const target = self ? null : '_blank';
|
const target = self ? null : '_blank';
|
||||||
|
|
||||||
const el = ref<HTMLElement>();
|
const el = ref<HTMLElement | { $el: HTMLElement }>();
|
||||||
|
|
||||||
useTooltip(el, (showing) => {
|
if (isEnabledUrlPreview.value) {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
useTooltip(el, (showing) => {
|
||||||
showing,
|
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||||
url: props.url,
|
showing,
|
||||||
source: el.value,
|
url: props.url,
|
||||||
}, {}, 'closed');
|
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||||
});
|
}, {}, 'closed');
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
|
|
@ -82,7 +82,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkMediaList :mediaList="appearNote.files"/>
|
<MkMediaList :mediaList="appearNote.files"/>
|
||||||
</div>
|
</div>
|
||||||
<MkPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll"/>
|
<MkPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll"/>
|
||||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/>
|
<div v-if="isEnabledUrlPreview">
|
||||||
|
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/>
|
||||||
|
</div>
|
||||||
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
|
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
|
||||||
<button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false">
|
<button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false">
|
||||||
<span :class="$style.collapsedLabel">{{ i18n.ts.showMore }}</span>
|
<span :class="$style.collapsedLabel">{{ i18n.ts.showMore }}</span>
|
||||||
|
@ -165,6 +167,7 @@ import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||||
|
import MkReactionsViewerDetails from '@/components/MkReactionsViewer.details.vue';
|
||||||
import MkMediaList from '@/components/MkMediaList.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
import MkCwButton from '@/components/MkCwButton.vue';
|
import MkCwButton from '@/components/MkCwButton.vue';
|
||||||
import MkPoll from '@/components/MkPoll.vue';
|
import MkPoll from '@/components/MkPoll.vue';
|
||||||
|
@ -178,7 +181,7 @@ import { userPage } from '@/filters/user.js';
|
||||||
import number from '@/filters/number.js';
|
import number from '@/filters/number.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import * as sound from '@/scripts/sound.js';
|
import * as sound from '@/scripts/sound.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||||
import { defaultStore, noteViewInterruptors } from '@/store.js';
|
import { defaultStore, noteViewInterruptors } from '@/store.js';
|
||||||
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
||||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
||||||
|
@ -194,6 +197,7 @@ import { MenuItem } from '@/types/menu.js';
|
||||||
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
||||||
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
||||||
|
import { isEnabledUrlPreview } from '@/instance.js';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -268,7 +272,7 @@ const renoteCollapsed = ref(
|
||||||
defaultStore.state.collapseRenotes && isRenote && (
|
defaultStore.state.collapseRenotes && isRenote && (
|
||||||
($i && ($i.id === note.value.userId || $i.id === appearNote.value.userId)) || // `||` must be `||`! See https://github.com/misskey-dev/misskey/issues/13131
|
($i && ($i.id === note.value.userId || $i.id === appearNote.value.userId)) || // `||` must be `||`! See https://github.com/misskey-dev/misskey/issues/13131
|
||||||
(appearNote.value.myReaction != null)
|
(appearNote.value.myReaction != null)
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Overload FunctionにLintが対応していないのでコメントアウト
|
/* Overload FunctionにLintが対応していないのでコメントアウト
|
||||||
|
@ -337,6 +341,28 @@ if (!props.mock) {
|
||||||
targetElement: renoteButton.value,
|
targetElement: renoteButton.value,
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (appearNote.value.reactionAcceptance === 'likeOnly') {
|
||||||
|
useTooltip(reactButton, async (showing) => {
|
||||||
|
const reactions = await misskeyApiGet('notes/reactions', {
|
||||||
|
noteId: appearNote.value.id,
|
||||||
|
limit: 10,
|
||||||
|
_cacheKey_: appearNote.value.reactionCount,
|
||||||
|
});
|
||||||
|
|
||||||
|
const users = reactions.map(x => x.user);
|
||||||
|
|
||||||
|
if (users.length < 1) return;
|
||||||
|
|
||||||
|
os.popup(MkReactionsViewerDetails, {
|
||||||
|
showing,
|
||||||
|
reaction: '❤️',
|
||||||
|
users,
|
||||||
|
count: appearNote.value.reactionCount,
|
||||||
|
targetElement: reactButton.value!,
|
||||||
|
}, {}, 'closed');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(viaKeyboard = false) {
|
function renote(viaKeyboard = false) {
|
||||||
|
|
|
@ -95,7 +95,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkMediaList :mediaList="appearNote.files"/>
|
<MkMediaList :mediaList="appearNote.files"/>
|
||||||
</div>
|
</div>
|
||||||
<MkPoll v-if="appearNote.poll" ref="pollViewer" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll"/>
|
<MkPoll v-if="appearNote.poll" ref="pollViewer" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll"/>
|
||||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="true" style="margin-top: 6px;"/>
|
<div v-if="isEnabledUrlPreview">
|
||||||
|
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="true" style="margin-top: 6px;"/>
|
||||||
|
</div>
|
||||||
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
|
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
|
||||||
</div>
|
</div>
|
||||||
<MkA v-if="appearNote.channel && !inChannel" :class="$style.channel" :to="`/channels/${appearNote.channel.id}`"><i class="ti ti-device-tv"></i> {{ appearNote.channel.name }}</MkA>
|
<MkA v-if="appearNote.channel && !inChannel" :class="$style.channel" :to="`/channels/${appearNote.channel.id}`"><i class="ti ti-device-tv"></i> {{ appearNote.channel.name }}</MkA>
|
||||||
|
@ -199,6 +201,7 @@ import * as Misskey from 'misskey-js';
|
||||||
import MkNoteSub from '@/components/MkNoteSub.vue';
|
import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||||
|
import MkReactionsViewerDetails from '@/components/MkReactionsViewer.details.vue';
|
||||||
import MkMediaList from '@/components/MkMediaList.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
import MkCwButton from '@/components/MkCwButton.vue';
|
import MkCwButton from '@/components/MkCwButton.vue';
|
||||||
import MkPoll from '@/components/MkPoll.vue';
|
import MkPoll from '@/components/MkPoll.vue';
|
||||||
|
@ -211,7 +214,7 @@ import { userPage } from '@/filters/user.js';
|
||||||
import { notePage } from '@/filters/note.js';
|
import { notePage } from '@/filters/note.js';
|
||||||
import number from '@/filters/number.js';
|
import number from '@/filters/number.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||||
import * as sound from '@/scripts/sound.js';
|
import * as sound from '@/scripts/sound.js';
|
||||||
import { defaultStore, noteViewInterruptors } from '@/store.js';
|
import { defaultStore, noteViewInterruptors } from '@/store.js';
|
||||||
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
||||||
|
@ -229,6 +232,7 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||||
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
||||||
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
import { isEnabledUrlPreview } from '@/instance.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -345,6 +349,28 @@ useTooltip(renoteButton, async (showing) => {
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (appearNote.value.reactionAcceptance === 'likeOnly') {
|
||||||
|
useTooltip(reactButton, async (showing) => {
|
||||||
|
const reactions = await misskeyApiGet('notes/reactions', {
|
||||||
|
noteId: appearNote.value.id,
|
||||||
|
limit: 10,
|
||||||
|
_cacheKey_: appearNote.value.reactionCount,
|
||||||
|
});
|
||||||
|
|
||||||
|
const users = reactions.map(x => x.user);
|
||||||
|
|
||||||
|
if (users.length < 1) return;
|
||||||
|
|
||||||
|
os.popup(MkReactionsViewerDetails, {
|
||||||
|
showing,
|
||||||
|
reaction: '❤️',
|
||||||
|
users,
|
||||||
|
count: appearNote.value.reactionCount,
|
||||||
|
targetElement: reactButton.value!,
|
||||||
|
}, {}, 'closed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function renote(viaKeyboard = false) {
|
function renote(viaKeyboard = false) {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
|
@ -19,18 +19,21 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div style="margin-top: 16px;">{{ i18n.ts.authenticationRequiredToContinue }}</div>
|
<div style="margin-top: 16px;">{{ i18n.ts.authenticationRequiredToContinue }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="_gaps">
|
<form @submit.prevent="done">
|
||||||
<MkInput ref="passwordInput" v-model="password" :placeholder="i18n.ts.password" type="password" autocomplete="current-password webauthn" :withPasswordToggle="true">
|
<div class="_gaps">
|
||||||
<template #prefix><i class="ti ti-password"></i></template>
|
<MkInput ref="passwordInput" v-model="password" :placeholder="i18n.ts.password" type="password" autocomplete="current-password webauthn" required :withPasswordToggle="true">
|
||||||
</MkInput>
|
<template #prefix><i class="ti ti-password"></i></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
<MkInput v-if="$i.twoFactorEnabled" v-model="token" type="text" pattern="^([0-9]{6}|[A-Z0-9]{32})$" autocomplete="one-time-code" :spellcheck="false">
|
<MkInput v-if="$i.twoFactorEnabled" v-model="token" type="text" :pattern="isBackupCode ? '^[A-Z0-9]{32}$' :'^[0-9]{6}$'" autocomplete="one-time-code" required :spellcheck="false" :inputmode="isBackupCode ? undefined : 'numeric'">
|
||||||
<template #label>{{ i18n.ts.token }} ({{ i18n.ts['2fa'] }})</template>
|
<template #label>{{ i18n.ts.token }} ({{ i18n.ts['2fa'] }})</template>
|
||||||
<template #prefix><i class="ti ti-123"></i></template>
|
<template #prefix><i v-if="isBackupCode" class="ti ti-key"></i><i v-else class="ti ti-123"></i></template>
|
||||||
</MkInput>
|
<template #caption><button class="_textButton" type="button" @click="isBackupCode = !isBackupCode">{{ isBackupCode ? i18n.ts.useTotp : i18n.ts.useBackupCode }}</button></template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
<MkButton :disabled="(password ?? '') == '' || ($i.twoFactorEnabled && (token ?? '') == '')" primary rounded style="margin: 0 auto;" @click="done"><i class="ti ti-lock-open"></i> {{ i18n.ts.continue }}</MkButton>
|
<MkButton :disabled="(password ?? '') == '' || ($i.twoFactorEnabled && (token ?? '') == '')" type="submit" primary rounded style="margin: 0 auto;"><i class="ti ti-lock-open"></i> {{ i18n.ts.continue }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</MkModalWindow>
|
</MkModalWindow>
|
||||||
</template>
|
</template>
|
||||||
|
@ -54,6 +57,7 @@ const emit = defineEmits<{
|
||||||
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
||||||
const passwordInput = shallowRef<InstanceType<typeof MkInput>>();
|
const passwordInput = shallowRef<InstanceType<typeof MkInput>>();
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
|
const isBackupCode = ref(false);
|
||||||
const token = ref<string | null>(null);
|
const token = ref<string | null>(null);
|
||||||
|
|
||||||
function onClose() {
|
function onClose() {
|
||||||
|
@ -61,7 +65,7 @@ function onClose() {
|
||||||
if (dialog.value) dialog.value.close();
|
if (dialog.value) dialog.value.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function done(res) {
|
function done() {
|
||||||
emit('done', { password: password.value, token: token.value });
|
emit('done', { password: password.value, token: token.value });
|
||||||
if (dialog.value) dialog.value.close();
|
if (dialog.value) dialog.value.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,15 +31,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="user && user.securityKeys" class="or-hr">
|
<div v-if="user && user.securityKeys" class="or-hr">
|
||||||
<p class="or-msg">{{ i18n.ts.or }}</p>
|
<p class="or-msg">{{ i18n.ts.or }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="twofa-group totp-group">
|
<div class="twofa-group totp-group _gaps">
|
||||||
<p style="margin-bottom:0;">{{ i18n.ts['2fa'] }}</p>
|
|
||||||
<MkInput v-if="user && user.usePasswordLessLogin" v-model="password" type="password" autocomplete="current-password" :withPasswordToggle="true" required>
|
<MkInput v-if="user && user.usePasswordLessLogin" v-model="password" type="password" autocomplete="current-password" :withPasswordToggle="true" required>
|
||||||
<template #label>{{ i18n.ts.password }}</template>
|
<template #label>{{ i18n.ts.password }}</template>
|
||||||
<template #prefix><i class="ti ti-lock"></i></template>
|
<template #prefix><i class="ti ti-lock"></i></template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<MkInput v-model="token" type="text" pattern="^([0-9]{6}|[A-Z0-9]{32})$" autocomplete="one-time-code" :spellcheck="false" required>
|
<MkInput v-model="token" type="text" :pattern="isBackupCode ? '^[A-Z0-9]{32}$' :'^[0-9]{6}$'" autocomplete="one-time-code" required :spellcheck="false" :inputmode="isBackupCode ? undefined : 'numeric'">
|
||||||
<template #label>{{ i18n.ts.token }}</template>
|
<template #label>{{ i18n.ts.token }} ({{ i18n.ts['2fa'] }})</template>
|
||||||
<template #prefix><i class="ti ti-123"></i></template>
|
<template #prefix><i v-if="isBackupCode" class="ti ti-key"></i><i v-else class="ti ti-123"></i></template>
|
||||||
|
<template #caption><button class="_textButton" type="button" @click="isBackupCode = !isBackupCode">{{ isBackupCode ? i18n.ts.useTotp : i18n.ts.useBackupCode }}</button></template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<MkButton type="submit" :disabled="signing" large primary rounded style="margin: 0 auto;">{{ signing ? i18n.ts.loggingIn : i18n.ts.login }}</MkButton>
|
<MkButton type="submit" :disabled="signing" large primary rounded style="margin: 0 auto;">{{ signing ? i18n.ts.loggingIn : i18n.ts.login }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,6 +70,7 @@ const password = ref('');
|
||||||
const token = ref('');
|
const token = ref('');
|
||||||
const host = ref(toUnicode(configHost));
|
const host = ref(toUnicode(configHost));
|
||||||
const totpLogin = ref(false);
|
const totpLogin = ref(false);
|
||||||
|
const isBackupCode = ref(false);
|
||||||
const queryingKey = ref(false);
|
const queryingKey = ref(false);
|
||||||
const credentialRequest = ref<CredentialRequestOptions | null>(null);
|
const credentialRequest = ref<CredentialRequestOptions | null>(null);
|
||||||
|
|
||||||
|
|
|
@ -152,15 +152,16 @@ requestUrl.hash = '';
|
||||||
window.fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${versatileLang}`)
|
window.fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${versatileLang}`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
fetching.value = false;
|
if (_DEV_) {
|
||||||
unknownUrl.value = true;
|
console.warn(`[HTTP${res.status}] Failed to fetch url preview`);
|
||||||
return;
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
.then((info: SummalyResult) => {
|
.then((info: SummalyResult | null) => {
|
||||||
if (info.url == null) {
|
if (!info || info.url == null) {
|
||||||
fetching.value = false;
|
fetching.value = false;
|
||||||
unknownUrl.value = true;
|
unknownUrl.value = true;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<render/>
|
<render/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,13 +4,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu">
|
<a ref="el" :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue';
|
import { computed, shallowRef } from 'vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
||||||
import { url } from '@/config.js';
|
import { url } from '@/config.js';
|
||||||
|
@ -26,6 +26,10 @@ const props = withDefaults(defineProps<{
|
||||||
behavior: null,
|
behavior: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const el = shallowRef<HTMLElement>();
|
||||||
|
|
||||||
|
defineExpose({ $el: el });
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const active = computed(() => {
|
const active = computed(() => {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { url as local } from '@/config.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||||
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
|
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
|
||||||
|
import { isEnabledUrlPreview } from '@/instance.js';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -44,12 +45,12 @@ const url = new URL(props.url);
|
||||||
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('invalid url');
|
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('invalid url');
|
||||||
const el = ref();
|
const el = ref();
|
||||||
|
|
||||||
if (props.showUrlPreview) {
|
if (props.showUrlPreview && isEnabledUrlPreview.value) {
|
||||||
useTooltip(el, (showing) => {
|
useTooltip(el, (showing) => {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||||
showing,
|
showing,
|
||||||
url: props.url,
|
url: props.url,
|
||||||
source: el.value,
|
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div :class="$style.root">
|
||||||
<MediaImage
|
<MkMediaList v-if="image" :mediaList="[image]" :class="$style.mediaList"/>
|
||||||
v-if="image"
|
|
||||||
:image="image"
|
|
||||||
:disableImageLink="true"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MediaImage from '@/components/MkMediaImage.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
block: Misskey.entities.PageBlock,
|
block: Misskey.entities.PageBlock,
|
||||||
|
@ -28,5 +24,17 @@ const image = ref<Misskey.entities.DriveFile | null>(null);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
image.value = props.page.attachedFiles.find(x => x.id === props.block.fileId) ?? null;
|
image.value = props.page.attachedFiles.find(x => x.id === props.block.fileId) ?? null;
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.root {
|
||||||
|
border: 1px solid var(--divider);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.mediaList {
|
||||||
|
// MkMediaList 内の上部マージン 4px
|
||||||
|
margin-top: -4px;
|
||||||
|
height: calc(100% + 4px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -4,9 +4,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="margin: 1em 0;">
|
<div :class="$style.root">
|
||||||
<MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" v-model:note="note"/>
|
<MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" :note="note"/>
|
||||||
<MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" v-model:note="note"/>
|
<MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" :note="note"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -32,3 +32,10 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.root {
|
||||||
|
border: 1px solid var(--divider);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -4,9 +4,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="_gaps">
|
<div class="_gaps" :class="$style.textRoot">
|
||||||
<Mfm :text="block.text ?? ''" :isNote="false"/>
|
<Mfm :text="block.text ?? ''" :isNote="false"/>
|
||||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
|
<div v-if="isEnabledUrlPreview">
|
||||||
|
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -15,6 +17,7 @@ import { defineAsyncComponent } from 'vue';
|
||||||
import * as mfm from 'mfm-js';
|
import * as mfm from 'mfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
||||||
|
import { isEnabledUrlPreview } from '@/instance.js';
|
||||||
|
|
||||||
const MkUrlPreview = defineAsyncComponent(() => import('@/components/MkUrlPreview.vue'));
|
const MkUrlPreview = defineAsyncComponent(() => import('@/components/MkUrlPreview.vue'));
|
||||||
|
|
||||||
|
@ -25,3 +28,9 @@ const props = defineProps<{
|
||||||
|
|
||||||
const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : [];
|
const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : [];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.textRoot {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps_s">
|
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps">
|
||||||
<XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/>
|
<XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
export default (v, fractionDigits = 0) => {
|
export default (v, fractionDigits = 0) => {
|
||||||
if (v == null) return 'N/A';
|
if (v == null) return 'N/A';
|
||||||
if (v === 0) return '0';
|
if (v === 0) return '0';
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self' https://newassets.hcaptcha.com/ https://challenges.cloudflare.com/ http://localhost:7493/;
|
content="default-src 'self' https://newassets.hcaptcha.com/ https://challenges.cloudflare.com/ http://localhost:7493/;
|
||||||
worker-src 'self';
|
worker-src 'self';
|
||||||
script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com;
|
script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com https://esm.sh;
|
||||||
style-src 'self' 'unsafe-inline';
|
style-src 'self' 'unsafe-inline';
|
||||||
img-src 'self' data: blob: www.google.com xn--931a.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
img-src 'self' data: blob: www.google.com xn--931a.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
||||||
media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
||||||
|
|
|
@ -36,6 +36,8 @@ export const infoImageUrl = computed(() => instance.infoImageUrl ?? DEFAULT_INFO
|
||||||
|
|
||||||
export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFAULT_NOT_FOUND_IMAGE_URL);
|
export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFAULT_NOT_FOUND_IMAGE_URL);
|
||||||
|
|
||||||
|
export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true);
|
||||||
|
|
||||||
export async function fetchInstance(force = false): Promise<void> {
|
export async function fetchInstance(force = false): Promise<void> {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0;
|
const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0;
|
||||||
|
|
|
@ -222,6 +222,15 @@ const patronsWithIcon = [{
|
||||||
}, {
|
}, {
|
||||||
name: '有栖かずみ',
|
name: '有栖かずみ',
|
||||||
icon: 'https://assets.misskey-hub.net/patrons/9240e8e0ba294a8884143e99ac7ed6a0.jpg',
|
icon: 'https://assets.misskey-hub.net/patrons/9240e8e0ba294a8884143e99ac7ed6a0.jpg',
|
||||||
|
}, {
|
||||||
|
name: 'イカロ(コアラ)',
|
||||||
|
icon: 'https://assets.misskey-hub.net/patrons/50b9bdc03735412c80807dbdf32cecb6.jpg',
|
||||||
|
}, {
|
||||||
|
name: 'ハチノス3号',
|
||||||
|
icon: 'https://assets.misskey-hub.net/patrons/030347a6f8ce4e82bc5184b5aad09a18.jpg',
|
||||||
|
}, {
|
||||||
|
name: 'Takeno',
|
||||||
|
icon: 'https://assets.misskey-hub.net/patrons/6fba81536aea48fe94a30909c502dfa1.jpg',
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const patrons = [
|
const patrons = [
|
||||||
|
@ -325,6 +334,7 @@ const patrons = [
|
||||||
'たっくん',
|
'たっくん',
|
||||||
'SHO SEKIGUCHI',
|
'SHO SEKIGUCHI',
|
||||||
'塩キャベツ',
|
'塩キャベツ',
|
||||||
|
'はとぽぷさん',
|
||||||
];
|
];
|
||||||
|
|
||||||
const thereIsTreasure = ref($i && !claimedAchievements.includes('foundTreasure'));
|
const thereIsTreasure = ref($i && !claimedAchievements.includes('foundTreasure'));
|
||||||
|
|
|
@ -118,19 +118,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder>
|
|
||||||
<template #label>Summaly Proxy</template>
|
|
||||||
|
|
||||||
<div class="_gaps_m">
|
|
||||||
<MkInput v-model="summalyProxy">
|
|
||||||
<template #prefix><i class="ti ti-link"></i></template>
|
|
||||||
<template #label>Summaly Proxy URL</template>
|
|
||||||
</MkInput>
|
|
||||||
|
|
||||||
<MkButton primary @click="save"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
|
||||||
</div>
|
|
||||||
</MkFolder>
|
|
||||||
</div>
|
</div>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
|
@ -155,7 +142,6 @@ import { fetchInstance } from '@/instance.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
|
|
||||||
const summalyProxy = ref<string>('');
|
|
||||||
const enableHcaptcha = ref<boolean>(false);
|
const enableHcaptcha = ref<boolean>(false);
|
||||||
const enableMcaptcha = ref<boolean>(false);
|
const enableMcaptcha = ref<boolean>(false);
|
||||||
const enableRecaptcha = ref<boolean>(false);
|
const enableRecaptcha = ref<boolean>(false);
|
||||||
|
@ -175,7 +161,6 @@ const bannedEmailDomains = ref<string>('');
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
const meta = await misskeyApi('admin/meta');
|
const meta = await misskeyApi('admin/meta');
|
||||||
summalyProxy.value = meta.summalyProxy;
|
|
||||||
enableHcaptcha.value = meta.enableHcaptcha;
|
enableHcaptcha.value = meta.enableHcaptcha;
|
||||||
enableMcaptcha.value = meta.enableMcaptcha;
|
enableMcaptcha.value = meta.enableMcaptcha;
|
||||||
enableRecaptcha.value = meta.enableRecaptcha;
|
enableRecaptcha.value = meta.enableRecaptcha;
|
||||||
|
@ -201,7 +186,6 @@ async function init() {
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
summalyProxy: summalyProxy.value,
|
|
||||||
sensitiveMediaDetection: sensitiveMediaDetection.value,
|
sensitiveMediaDetection: sensitiveMediaDetection.value,
|
||||||
sensitiveMediaDetectionSensitivity:
|
sensitiveMediaDetectionSensitivity:
|
||||||
sensitiveMediaDetectionSensitivity.value === 0 ? 'veryLow' :
|
sensitiveMediaDetectionSensitivity.value === 0 ? 'veryLow' :
|
||||||
|
|
|
@ -143,6 +143,53 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
|
|
||||||
|
<FormSection>
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.title }}</template>
|
||||||
|
|
||||||
|
<div class="_gaps_m">
|
||||||
|
<MkSwitch v-model="urlPreviewEnabled">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.enable }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkSwitch v-model="urlPreviewRequireContentLength">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.requireContentLength }}</template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.requireContentLengthDescription }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
|
||||||
|
<MkInput v-model="urlPreviewMaximumContentLength" type="number">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.maximumContentLength }}</template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.maximumContentLengthDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="urlPreviewTimeout" type="number">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.timeout }}</template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.timeoutDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<MkInput v-model="urlPreviewUserAgent" type="text">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.userAgent }}</template>
|
||||||
|
<template #caption>{{ i18n.ts._urlPreviewSetting.userAgentDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<MkInput v-model="urlPreviewSummaryProxyUrl" type="text">
|
||||||
|
<template #label>{{ i18n.ts._urlPreviewSetting.summaryProxy }}</template>
|
||||||
|
<template #caption>[{{ i18n.ts.notUsePleaseLeaveBlank }}] {{ i18n.ts._urlPreviewSetting.summaryProxyDescription }}</template>
|
||||||
|
</MkInput>
|
||||||
|
|
||||||
|
<div :class="$style.subCaption">
|
||||||
|
{{ i18n.ts._urlPreviewSetting.summaryProxyDescription2 }}
|
||||||
|
<ul style="padding-left: 20px; margin: 4px 0">
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.timeout }} / key:timeout</li>
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.maximumContentLength }} / key:contentLengthLimit</li>
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.requireContentLength }} / key:contentLengthRequired</li>
|
||||||
|
<li>{{ i18n.ts._urlPreviewSetting.userAgent }} / key:userAgent</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</FormSection>
|
||||||
</div>
|
</div>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
|
@ -173,6 +220,8 @@ import { fetchInstance, instance } from '@/instance.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
|
import MkSelect from '@/components/MkSelect.vue';
|
||||||
|
|
||||||
const name = ref<string | null>(null);
|
const name = ref<string | null>(null);
|
||||||
const shortName = ref<string | null>(null);
|
const shortName = ref<string | null>(null);
|
||||||
|
@ -194,6 +243,12 @@ const perRemoteUserUserTimelineCacheMax = ref<number>(0);
|
||||||
const perUserHomeTimelineCacheMax = ref<number>(0);
|
const perUserHomeTimelineCacheMax = ref<number>(0);
|
||||||
const perUserListTimelineCacheMax = ref<number>(0);
|
const perUserListTimelineCacheMax = ref<number>(0);
|
||||||
const notesPerOneAd = ref<number>(0);
|
const notesPerOneAd = ref<number>(0);
|
||||||
|
const urlPreviewEnabled = ref<boolean>(true);
|
||||||
|
const urlPreviewTimeout = ref<number>(10000);
|
||||||
|
const urlPreviewMaximumContentLength = ref<number>(1024 * 1024 * 10);
|
||||||
|
const urlPreviewRequireContentLength = ref<boolean>(true);
|
||||||
|
const urlPreviewUserAgent = ref<string | null>(null);
|
||||||
|
const urlPreviewSummaryProxyUrl = ref<string | null>(null);
|
||||||
|
|
||||||
async function init(): Promise<void> {
|
async function init(): Promise<void> {
|
||||||
const meta = await misskeyApi('admin/meta');
|
const meta = await misskeyApi('admin/meta');
|
||||||
|
@ -217,9 +272,15 @@ async function init(): Promise<void> {
|
||||||
perUserHomeTimelineCacheMax.value = meta.perUserHomeTimelineCacheMax;
|
perUserHomeTimelineCacheMax.value = meta.perUserHomeTimelineCacheMax;
|
||||||
perUserListTimelineCacheMax.value = meta.perUserListTimelineCacheMax;
|
perUserListTimelineCacheMax.value = meta.perUserListTimelineCacheMax;
|
||||||
notesPerOneAd.value = meta.notesPerOneAd;
|
notesPerOneAd.value = meta.notesPerOneAd;
|
||||||
|
urlPreviewEnabled.value = meta.urlPreviewEnabled;
|
||||||
|
urlPreviewTimeout.value = meta.urlPreviewTimeout;
|
||||||
|
urlPreviewMaximumContentLength.value = meta.urlPreviewMaximumContentLength;
|
||||||
|
urlPreviewRequireContentLength.value = meta.urlPreviewRequireContentLength;
|
||||||
|
urlPreviewUserAgent.value = meta.urlPreviewUserAgent;
|
||||||
|
urlPreviewSummaryProxyUrl.value = meta.urlPreviewSummaryProxyUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save(): void {
|
async function save() {
|
||||||
await os.apiWithDialog('admin/update-meta', {
|
await os.apiWithDialog('admin/update-meta', {
|
||||||
name: name.value,
|
name: name.value,
|
||||||
shortName: shortName.value === '' ? null : shortName.value,
|
shortName: shortName.value === '' ? null : shortName.value,
|
||||||
|
@ -241,6 +302,12 @@ async function save(): void {
|
||||||
perUserHomeTimelineCacheMax: perUserHomeTimelineCacheMax.value,
|
perUserHomeTimelineCacheMax: perUserHomeTimelineCacheMax.value,
|
||||||
perUserListTimelineCacheMax: perUserListTimelineCacheMax.value,
|
perUserListTimelineCacheMax: perUserListTimelineCacheMax.value,
|
||||||
notesPerOneAd: notesPerOneAd.value,
|
notesPerOneAd: notesPerOneAd.value,
|
||||||
|
urlPreviewEnabled: urlPreviewEnabled.value,
|
||||||
|
urlPreviewTimeout: urlPreviewTimeout.value,
|
||||||
|
urlPreviewMaximumContentLength: urlPreviewMaximumContentLength.value,
|
||||||
|
urlPreviewRequireContentLength: urlPreviewRequireContentLength.value,
|
||||||
|
urlPreviewUserAgent: urlPreviewUserAgent.value,
|
||||||
|
urlPreviewSummaryProxyUrl: urlPreviewSummaryProxyUrl.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
fetchInstance(true);
|
fetchInstance(true);
|
||||||
|
@ -259,4 +326,9 @@ definePageMetadata(() => ({
|
||||||
-webkit-backdrop-filter: var(--blur, blur(15px));
|
-webkit-backdrop-filter: var(--blur, blur(15px));
|
||||||
backdrop-filter: var(--blur, blur(15px));
|
backdrop-filter: var(--blur, blur(15px));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subCaption {
|
||||||
|
font-size: 0.85em;
|
||||||
|
color: var(--fgTransparentWeak);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -18,16 +18,17 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkCodeEditor v-model="script" lang="is">
|
<MkCodeEditor v-model="script" lang="is">
|
||||||
<template #label>{{ i18n.ts._play.script }}</template>
|
<template #label>{{ i18n.ts._play.script }}</template>
|
||||||
</MkCodeEditor>
|
</MkCodeEditor>
|
||||||
|
<MkSelect v-model="visibility">
|
||||||
|
<template #label>{{ i18n.ts.visibility }}</template>
|
||||||
|
<template #caption>{{ i18n.ts._play.visibilityDescription }}</template>
|
||||||
|
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
|
||||||
|
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
|
||||||
|
</MkSelect>
|
||||||
<div class="_buttons">
|
<div class="_buttons">
|
||||||
<MkButton primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
|
<MkButton primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
|
||||||
<MkButton @click="show"><i class="ti ti-eye"></i> {{ i18n.ts.show }}</MkButton>
|
<MkButton @click="show"><i class="ti ti-eye"></i> {{ i18n.ts.show }}</MkButton>
|
||||||
<MkButton v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
<MkButton v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkSelect v-model="visibility">
|
|
||||||
<template #label>{{ i18n.ts.visibility }}</template>
|
|
||||||
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
|
|
||||||
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
|
|
||||||
</MkSelect>
|
|
||||||
</div>
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</MkStickyContainer>
|
</MkStickyContainer>
|
||||||
|
@ -367,7 +368,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const flash = ref<Misskey.entities.Flash | null>(null);
|
const flash = ref<Misskey.entities.Flash | null>(null);
|
||||||
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public');
|
const visibility = ref<'private' | 'public'>('public');
|
||||||
|
|
||||||
if (props.id) {
|
if (props.id) {
|
||||||
flash.value = await misskeyApi('flash/show', {
|
flash.value = await misskeyApi('flash/show', {
|
||||||
|
@ -420,6 +421,7 @@ async function save() {
|
||||||
summary: summary.value,
|
summary: summary.value,
|
||||||
permissions: permissions.value,
|
permissions: permissions.value,
|
||||||
script: script.value,
|
script: script.value,
|
||||||
|
visibility: visibility.value,
|
||||||
});
|
});
|
||||||
router.push('/play/' + created.id + '/edit');
|
router.push('/play/' + created.id + '/edit');
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ const draft = ref({
|
||||||
users: [],
|
users: [],
|
||||||
keywords: [],
|
keywords: [],
|
||||||
excludeKeywords: [],
|
excludeKeywords: [],
|
||||||
|
excludeBots: false,
|
||||||
withReplies: false,
|
withReplies: false,
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
localOnly: false,
|
localOnly: false,
|
||||||
|
|
|
@ -26,6 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ i18n.ts.users }}</template>
|
<template #label>{{ i18n.ts.users }}</template>
|
||||||
<template #caption>{{ i18n.ts.antennaUsersDescription }} <button class="_textButton" @click="addUser">{{ i18n.ts.addUser }}</button></template>
|
<template #caption>{{ i18n.ts.antennaUsersDescription }} <button class="_textButton" @click="addUser">{{ i18n.ts.addUser }}</button></template>
|
||||||
</MkTextarea>
|
</MkTextarea>
|
||||||
|
<MkSwitch v-model="excludeBots">{{ i18n.ts.antennaExcludeBots }}</MkSwitch>
|
||||||
<MkSwitch v-model="withReplies">{{ i18n.ts.withReplies }}</MkSwitch>
|
<MkSwitch v-model="withReplies">{{ i18n.ts.withReplies }}</MkSwitch>
|
||||||
<MkTextarea v-model="keywords">
|
<MkTextarea v-model="keywords">
|
||||||
<template #label>{{ i18n.ts.antennaKeywords }}</template>
|
<template #label>{{ i18n.ts.antennaKeywords }}</template>
|
||||||
|
@ -78,6 +79,7 @@ const keywords = ref<string>(props.antenna.keywords.map(x => x.join(' ')).join('
|
||||||
const excludeKeywords = ref<string>(props.antenna.excludeKeywords.map(x => x.join(' ')).join('\n'));
|
const excludeKeywords = ref<string>(props.antenna.excludeKeywords.map(x => x.join(' ')).join('\n'));
|
||||||
const caseSensitive = ref<boolean>(props.antenna.caseSensitive);
|
const caseSensitive = ref<boolean>(props.antenna.caseSensitive);
|
||||||
const localOnly = ref<boolean>(props.antenna.localOnly);
|
const localOnly = ref<boolean>(props.antenna.localOnly);
|
||||||
|
const excludeBots = ref<boolean>(props.antenna.excludeBots);
|
||||||
const withReplies = ref<boolean>(props.antenna.withReplies);
|
const withReplies = ref<boolean>(props.antenna.withReplies);
|
||||||
const withFile = ref<boolean>(props.antenna.withFile);
|
const withFile = ref<boolean>(props.antenna.withFile);
|
||||||
const notify = ref<boolean>(props.antenna.notify);
|
const notify = ref<boolean>(props.antenna.notify);
|
||||||
|
@ -94,6 +96,7 @@ async function saveAntenna() {
|
||||||
name: name.value,
|
name: name.value,
|
||||||
src: src.value,
|
src: src.value,
|
||||||
userListId: userListId.value,
|
userListId: userListId.value,
|
||||||
|
excludeBots: excludeBots.value,
|
||||||
withReplies: withReplies.value,
|
withReplies: withReplies.value,
|
||||||
withFile: withFile.value,
|
withFile: withFile.value,
|
||||||
notify: notify.value,
|
notify: notify.value,
|
||||||
|
|
|
@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<XContainer :draggable="true" @remove="() => $emit('remove')">
|
<XContainer :draggable="true" @remove="() => $emit('remove')">
|
||||||
<template #header><i class="ti ti-note"></i> {{ i18n.ts._pages.blocks.note }}</template>
|
<template #header><i class="ti ti-note"></i> {{ i18n.ts._pages.blocks.note }}</template>
|
||||||
|
|
||||||
<section style="padding: 0 16px 0 16px;">
|
<section style="padding: 16px;" class="_gaps_s">
|
||||||
<MkInput v-model="id">
|
<MkInput v-model="id">
|
||||||
<template #label>{{ i18n.ts._pages.blocks._note.id }}</template>
|
<template #label>{{ i18n.ts._pages.blocks._note.id }}</template>
|
||||||
<template #caption>{{ i18n.ts._pages.blocks._note.idDescription }}</template>
|
<template #caption>{{ i18n.ts._pages.blocks._note.idDescription }}</template>
|
||||||
|
|
|
@ -6,48 +6,73 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template>
|
<template>
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
<MkSpacer :contentMax="700">
|
<MkSpacer :contentMax="800">
|
||||||
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
|
<Transition
|
||||||
<div v-if="page" :key="page.id" class="xcukqgmh">
|
:enterActiveClass="defaultStore.state.animation ? $style.fadeEnterActive : ''"
|
||||||
<div class="main">
|
:leaveActiveClass="defaultStore.state.animation ? $style.fadeLeaveActive : ''"
|
||||||
<!--
|
:enterFromClass="defaultStore.state.animation ? $style.fadeEnterFrom : ''"
|
||||||
<div class="header">
|
:leaveToClass="defaultStore.state.animation ? $style.fadeLeaveTo : ''"
|
||||||
<h1>{{ page.title }}</h1>
|
>
|
||||||
</div>
|
<div v-if="page" :key="page.id" class="_gaps">
|
||||||
-->
|
<div :class="$style.pageMain">
|
||||||
<div class="banner">
|
<div :class="$style.pageBanner">
|
||||||
<MkMediaImage
|
<div :class="$style.pageBannerBgRoot">
|
||||||
v-if="page.eyeCatchingImageId"
|
<MkImgWithBlurhash
|
||||||
:image="page.eyeCatchingImage"
|
v-if="page.eyeCatchingImageId"
|
||||||
:cover="true"
|
:class="$style.pageBannerBg"
|
||||||
:disableImageLink="true"
|
:hash="page.eyeCatchingImage?.blurhash"
|
||||||
class="thumbnail"
|
:cover="true"
|
||||||
/>
|
:forceBlurhash="true"
|
||||||
|
/>
|
||||||
|
<img
|
||||||
|
v-else-if="instance.backgroundImageUrl || instance.bannerUrl"
|
||||||
|
:class="[$style.pageBannerBg, $style.pageBannerBgFallback1]"
|
||||||
|
:src="getStaticImageUrl(instance.backgroundImageUrl ?? instance.bannerUrl!)"
|
||||||
|
/>
|
||||||
|
<div v-else :class="[$style.pageBannerBg, $style.pageBannerBgFallback2]"></div>
|
||||||
|
</div>
|
||||||
|
<div v-if="page.eyeCatchingImageId" :class="$style.pageBannerImage">
|
||||||
|
<MkMediaImage
|
||||||
|
:image="page.eyeCatchingImage!"
|
||||||
|
:cover="true"
|
||||||
|
:disableImageLink="true"
|
||||||
|
:class="$style.thumbnail"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div :class="$style.pageBannerTitle" class="_gaps_s">
|
||||||
|
<h1>{{ page.title || page.name }}</h1>
|
||||||
|
<div v-if="page.user" :class="$style.pageBannerTitleUser">
|
||||||
|
<MkAvatar :user="page.user" :class="$style.avatar" indicator link preview/> <MkA :to="`/@${username}`"><MkUserName :user="page.user" :nowrap="false"/></MkA>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div :class="$style.pageContent">
|
||||||
<XPage :page="page"/>
|
<XPage :page="page"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div :class="$style.pageActions">
|
||||||
<div class="like">
|
<div>
|
||||||
<MkButton v-if="page.isLiked" v-tooltip="i18n.ts._pages.unlike" class="button" asLike primary @click="unlike()"><i class="ti ti-heart-off"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
<MkButton v-if="page.isLiked" v-tooltip="i18n.ts._pages.unlike" class="button" asLike primary @click="unlike()"><i class="ti ti-heart-off"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
||||||
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="other">
|
<div :class="$style.other">
|
||||||
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
||||||
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
||||||
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div :class="$style.pageUser">
|
||||||
<MkAvatar :user="page.user" class="avatar" link preview/>
|
<MkAvatar :user="page.user" :class="$style.avatar" link preview/>
|
||||||
<div class="name">
|
<MkA :to="`/@${username}`">
|
||||||
<MkUserName :user="page.user" style="display: block;"/>
|
<MkUserName :user="page.user" :class="$style.name"/>
|
||||||
<MkAcct :user="page.user"/>
|
<MkAcct :user="page.user" :class="$style.acct"/>
|
||||||
</div>
|
</MkA>
|
||||||
<MkFollowButton v-if="!$i || $i.id != page.user.id" :user="page.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/>
|
<MkFollowButton v-if="!$i || $i.id != page.user.id" :user="page.user!" :inline="true" :transparent="false" :full="true" :class="$style.follow"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="links">
|
<div :class="$style.pageDate">
|
||||||
<MkA :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
||||||
|
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
||||||
|
</div>
|
||||||
|
<div :class="$style.pageLinks">
|
||||||
|
<MkA v-if="!$i || $i.id !== page.userId" :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
||||||
<template v-if="$i && $i.id === page.userId">
|
<template v-if="$i && $i.id === page.userId">
|
||||||
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
||||||
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
||||||
|
@ -55,10 +80,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
|
||||||
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
|
||||||
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
|
||||||
</div>
|
|
||||||
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
||||||
<MkContainer :max-height="300" :foldable="true" class="other">
|
<MkContainer :max-height="300" :foldable="true" class="other">
|
||||||
<template #icon><i class="ti ti-clock"></i></template>
|
<template #icon><i class="ti ti-clock"></i></template>
|
||||||
|
@ -84,6 +105,7 @@ import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { url } from '@/config.js';
|
import { url } from '@/config.js';
|
||||||
import MkMediaImage from '@/components/MkMediaImage.vue';
|
import MkMediaImage from '@/components/MkMediaImage.vue';
|
||||||
|
import MkImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||||
import MkContainer from '@/components/MkContainer.vue';
|
import MkContainer from '@/components/MkContainer.vue';
|
||||||
import MkPagination from '@/components/MkPagination.vue';
|
import MkPagination from '@/components/MkPagination.vue';
|
||||||
|
@ -94,6 +116,8 @@ import { pageViewInterruptors, defaultStore } from '@/store.js';
|
||||||
import { deepClone } from '@/scripts/clone.js';
|
import { deepClone } from '@/scripts/clone.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { isSupportShare } from '@/scripts/navigator.js';
|
import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
|
import { instance } from '@/instance.js';
|
||||||
|
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||||
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -133,35 +157,63 @@ function fetchPage() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function share() {
|
function share(ev: MouseEvent) {
|
||||||
navigator.share({
|
if (!page.value) return;
|
||||||
title: page.value.title ?? page.value.name,
|
|
||||||
text: page.value.summary,
|
os.popupMenu([
|
||||||
url: `${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
{
|
||||||
});
|
text: i18n.ts.shareWithNote,
|
||||||
|
icon: 'ti ti-pencil',
|
||||||
|
action: shareWithNote,
|
||||||
|
},
|
||||||
|
...(isSupportShare() ? [{
|
||||||
|
text: i18n.ts.share,
|
||||||
|
icon: 'ti ti-share',
|
||||||
|
action: shareWithNavigator,
|
||||||
|
}] : []),
|
||||||
|
], ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyLink() {
|
function copyLink() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
copyToClipboard(`${url}/@${page.value.user.username}/pages/${page.value.name}`);
|
copyToClipboard(`${url}/@${page.value.user.username}/pages/${page.value.name}`);
|
||||||
os.success();
|
os.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
function shareWithNote() {
|
function shareWithNote() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
os.post({
|
os.post({
|
||||||
initialText: `${page.value.title || page.value.name} ${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
initialText: `${page.value.title || page.value.name}\n${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
||||||
|
instant: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function shareWithNavigator() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
|
navigator.share({
|
||||||
|
title: page.value.title ?? page.value.name,
|
||||||
|
text: page.value.summary ?? undefined,
|
||||||
|
url: `${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function like() {
|
function like() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
os.apiWithDialog('pages/like', {
|
os.apiWithDialog('pages/like', {
|
||||||
pageId: page.value.id,
|
pageId: page.value.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
page.value.isLiked = true;
|
page.value!.isLiked = true;
|
||||||
page.value.likedCount++;
|
page.value!.likedCount++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unlike() {
|
async function unlike() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
const confirm = await os.confirm({
|
const confirm = await os.confirm({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
text: i18n.ts.unlikeConfirm,
|
text: i18n.ts.unlikeConfirm,
|
||||||
|
@ -170,12 +222,14 @@ async function unlike() {
|
||||||
os.apiWithDialog('pages/unlike', {
|
os.apiWithDialog('pages/unlike', {
|
||||||
pageId: page.value.id,
|
pageId: page.value.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
page.value.isLiked = false;
|
page.value!.isLiked = false;
|
||||||
page.value.likedCount--;
|
page.value!.likedCount--;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function pin(pin) {
|
function pin(pin) {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
os.apiWithDialog('i/update', {
|
os.apiWithDialog('i/update', {
|
||||||
pinnedPageId: pin ? page.value.id : null,
|
pinnedPageId: pin ? page.value.id : null,
|
||||||
});
|
});
|
||||||
|
@ -200,109 +254,185 @@ definePageMetadata(() => ({
|
||||||
}));
|
}));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" module>
|
||||||
.fade-enter-active,
|
.fadeEnterActive,
|
||||||
.fade-leave-active {
|
.fadeLeaveActive {
|
||||||
transition: opacity 0.125s ease;
|
transition: opacity 0.125s ease;
|
||||||
}
|
}
|
||||||
.fade-enter-from,
|
.fadeEnterFrom,
|
||||||
.fade-leave-to {
|
.fadeLeaveTo {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xcukqgmh {
|
.generalActionButton {
|
||||||
> .main {
|
height: 2.5rem;
|
||||||
padding: 32px;
|
width: 2.5rem;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 99rem;
|
||||||
|
|
||||||
> .header {
|
& :global(.ti) {
|
||||||
padding: 16px;
|
line-height: 2.5rem;
|
||||||
|
|
||||||
> h1 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .banner {
|
|
||||||
> .thumbnail {
|
|
||||||
// TODO: 良い感じのアスペクト比で表示
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
aspect-ratio: 3/1;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
overflow: hidden;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .content {
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 16px 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 16px 0 0 0;
|
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
|
|
||||||
> .other {
|
|
||||||
margin-left: auto;
|
|
||||||
|
|
||||||
> button {
|
|
||||||
padding: 8px;
|
|
||||||
margin: 0 8px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: var(--fgHighlighted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .user {
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 16px 0 0 0;
|
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
> .avatar {
|
|
||||||
width: 52px;
|
|
||||||
height: 52px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .name {
|
|
||||||
margin: 0 0 0 12px;
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .koudoku {
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> .links {
|
|
||||||
margin-top: 16px;
|
|
||||||
padding: 24px 0 0 0;
|
|
||||||
border-top: solid 0.5px var(--divider);
|
|
||||||
|
|
||||||
> .link {
|
|
||||||
margin-right: 0.75em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> .footer {
|
&:hover,
|
||||||
margin: var(--margin) 0 var(--margin) 0;
|
&:focus-visible {
|
||||||
font-size: 85%;
|
background-color: var(--accentedBg);
|
||||||
opacity: 0.75;
|
color: var(--accent);
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
<style module>
|
.pageMain {
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 2rem;
|
||||||
|
background: var(--panel);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageBanner {
|
||||||
|
width: calc(100% + 4rem);
|
||||||
|
margin: -2rem -2rem 1.5rem;
|
||||||
|
border-radius: var(--radius) var(--radius) 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
> .pageBannerBgRoot {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.pageBannerBg {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
opacity: .2;
|
||||||
|
filter: brightness(1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageBannerBgFallback1 {
|
||||||
|
filter: blur(20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageBannerBgFallback2 {
|
||||||
|
background-color: var(--accentedBg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100px;
|
||||||
|
background: linear-gradient(0deg, var(--panel), transparent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> .pageBannerImage {
|
||||||
|
position: relative;
|
||||||
|
padding-top: 56.25%;
|
||||||
|
|
||||||
|
> .thumbnail {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> .pageBannerTitle {
|
||||||
|
position: relative;
|
||||||
|
padding: 1.5rem 2rem;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--fg);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageBannerTitleUser {
|
||||||
|
--height: 32px;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
height: var(--height);
|
||||||
|
width: var(--height);
|
||||||
|
}
|
||||||
|
|
||||||
|
line-height: var(--height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageContent {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageActions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
border-top: 1px solid var(--divider);
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
|
||||||
|
> .other {
|
||||||
|
margin-left: auto;
|
||||||
|
display: flex;
|
||||||
|
gap: var(--marginHalf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageUser {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
border-top: 1px solid var(--divider);
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
|
||||||
|
.avatar,
|
||||||
|
.name,
|
||||||
|
.acct {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 4rem;
|
||||||
|
height: 4rem;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-size: 110%;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.acct {
|
||||||
|
font-size: 90%;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageDate {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageLinks {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: var(--marginHalf);
|
||||||
|
}
|
||||||
|
|
||||||
.relatedPagesRoot {
|
.relatedPagesRoot {
|
||||||
padding: var(--margin);
|
padding: var(--margin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkSpacer :marginMin="20" :marginMax="28">
|
<MkSpacer :marginMin="20" :marginMax="28">
|
||||||
<div class="_gaps">
|
<div class="_gaps">
|
||||||
<div>{{ i18n.ts._2fa.step3Title }}</div>
|
<div>{{ i18n.ts._2fa.step3Title }}</div>
|
||||||
<MkInput v-model="token" autocomplete="one-time-code"></MkInput>
|
<MkInput v-model="token" autocomplete="one-time-code" inputmode="numeric"></MkInput>
|
||||||
<div>{{ i18n.ts._2fa.step3 }}</div>
|
<div>{{ i18n.ts._2fa.step3 }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="_buttonsCenter" style="margin-top: 16px;">
|
<div class="_buttonsCenter" style="margin-top: 16px;">
|
||||||
|
|
|
@ -80,7 +80,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
|
||||||
import FormSection from '@/components/form/section.vue';
|
import FormSection from '@/components/form/section.vue';
|
||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { signinRequired } from '@/account.js';
|
import { signinRequired, updateAccount } from '@/account.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
const $i = signinRequired();
|
const $i = signinRequired();
|
||||||
|
@ -116,6 +116,10 @@ async function unregisterTOTP(): Promise<void> {
|
||||||
os.apiWithDialog('i/2fa/unregister', {
|
os.apiWithDialog('i/2fa/unregister', {
|
||||||
password: auth.result.password,
|
password: auth.result.password,
|
||||||
token: auth.result.token,
|
token: auth.result.token,
|
||||||
|
}).then(res => {
|
||||||
|
updateAccount({
|
||||||
|
twoFactorEnabled: false,
|
||||||
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue