Merge branch 'develop' into ssmucny-events
This commit is contained in:
commit
a4c726498b
|
@ -4,7 +4,10 @@
|
||||||
"service": "app",
|
"service": "app",
|
||||||
"workspaceFolder": "/workspace",
|
"workspaceFolder": "/workspace",
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers-contrib/features/pnpm:2": {}
|
"ghcr.io/devcontainers-contrib/features/pnpm:2": {},
|
||||||
|
"ghcr.io/devcontainers/features/node:1": {
|
||||||
|
"version": "18.16.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"forwardPorts": [3000],
|
"forwardPorts": [3000],
|
||||||
"postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh",
|
"postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh",
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
'⚙️Server':
|
'packages/backend':
|
||||||
- packages/backend/**/*
|
- packages/backend/**/*
|
||||||
|
|
||||||
'🖥️Client':
|
'packages/backend:test':
|
||||||
- packages/frontend/**/*
|
|
||||||
|
|
||||||
'🧪Test':
|
|
||||||
- cypress/**/*
|
|
||||||
- packages/backend/test/**/*
|
- packages/backend/test/**/*
|
||||||
|
|
||||||
'‼️ wrong locales':
|
'packages/frontend':
|
||||||
- any: ['locales/*.yml', '!locales/ja-JP.yml']
|
- packages/frontend/**/*
|
||||||
|
|
||||||
|
'packages/frontend:test':
|
||||||
|
- cypress/**/*
|
||||||
|
|
||||||
|
'packages/sw':
|
||||||
|
- packages/sw/**/*
|
||||||
|
|
||||||
|
'packages/misskey-js':
|
||||||
|
- packages/misskey-js/**/*
|
||||||
|
|
||||||
|
'packages/misskey-js:test':
|
||||||
|
- packages/misskey-js/test/**/*
|
||||||
|
- packages/misskey-js/test-d/**/*
|
||||||
|
|
|
@ -19,5 +19,6 @@ https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md
|
||||||
## Checklist
|
## Checklist
|
||||||
- [ ] Read the [contribution guide](https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md)
|
- [ ] Read the [contribution guide](https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md)
|
||||||
- [ ] Test working in a local environment
|
- [ ] Test working in a local environment
|
||||||
|
- [ ] (If needed) Add story of storybook
|
||||||
- [ ] (If needed) Update CHANGELOG.md
|
- [ ] (If needed) Update CHANGELOG.md
|
||||||
- [ ] (If possible) Add tests
|
- [ ] (If possible) Add tests
|
||||||
|
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.6.0
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version-file: '.node-version'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
run_install: false
|
run_install: false
|
||||||
- uses: actions/setup-node@v3.6.0
|
- uses: actions/setup-node@v3.6.0
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version-file: '.node-version'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- run: pnpm i --frozen-lockfile
|
- run: pnpm i --frozen-lockfile
|
||||||
|
@ -48,7 +48,7 @@ jobs:
|
||||||
run_install: false
|
run_install: false
|
||||||
- uses: actions/setup-node@v3.6.0
|
- uses: actions/setup-node@v3.6.0
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version-file: '.node-version'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- run: pnpm i --frozen-lockfile
|
- run: pnpm i --frozen-lockfile
|
||||||
|
@ -74,7 +74,7 @@ jobs:
|
||||||
run_install: false
|
run_install: false
|
||||||
- uses: actions/setup-node@v3.6.0
|
- uses: actions/setup-node@v3.6.0
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version-file: '.node-version'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- run: pnpm i --frozen-lockfile
|
- run: pnpm i --frozen-lockfile
|
||||||
|
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
- name: Use Node.js 18.x
|
- name: Use Node.js 18.x
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.6.0
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version-file: '.node-version'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- run: pnpm i --frozen-lockfile
|
- run: pnpm i --frozen-lockfile
|
||||||
|
|
|
@ -106,7 +106,7 @@ jobs:
|
||||||
install: false
|
install: false
|
||||||
start: pnpm start:test
|
start: pnpm start:test
|
||||||
wait-on: 'http://localhost:61812'
|
wait-on: 'http://localhost:61812'
|
||||||
headless: false
|
headed: true
|
||||||
browser: ${{ matrix.browser }}
|
browser: ${{ matrix.browser }}
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: failure()
|
if: failure()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
v18.13.0
|
18.16.0
|
||||||
|
|
48
CHANGELOG.md
48
CHANGELOG.md
|
@ -11,18 +11,58 @@
|
||||||
-
|
-
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## 13.x.x (unreleased)
|
## 13.x.x (unreleased)
|
||||||
|
|
||||||
|
### NOTE
|
||||||
|
- Node.js 18.6.0以上が必要になりました
|
||||||
|
|
||||||
### General
|
### General
|
||||||
- Add support for user created events. Includes basic federation of ActivityPub Event objects. [PR 10628](https://github.com/misskey-dev/misskey/pull/10628) @ssmucny
|
- Add support for user created events. Includes basic federation of ActivityPub Event objects. [PR 10628](https://github.com/misskey-dev/misskey/pull/10628) @ssmucny
|
||||||
|
- 新規登録前に簡潔なルールをユーザーに表示できる、サーバールール機能を追加
|
||||||
|
- ユーザーへの自分用メモ機能
|
||||||
|
* ユーザーに対して、自分だけが見られるメモを追加できるようになりました。
|
||||||
|
(自分自身に対してもメモを追加できます。)
|
||||||
|
* ユーザーメニューから追加できます。
|
||||||
|
(デスクトップ表示ではusernameの右側のボタンからも追加可能)
|
||||||
|
- ロールタイムラインをロールごとに表示するかどうかの選択できるようになりました。
|
||||||
|
* デフォルトがオフになるので、ロールタイムラインを表示する場合はオンにしてください。
|
||||||
|
- カスタム絵文字のライセンスを複数でセットできるようになりました。
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
-
|
- 通知の表示をカスタマイズできるように
|
||||||
|
- コントロールパネルのカスタム絵文字ページおよびaboutのカスタム絵文字の検索インプットで、`:emojiname1::emojiname2:`のように検索して絵文字を検索できるように
|
||||||
|
* 絵文字ピッカーから入力可能になります
|
||||||
|
- データセーバーモードを追加
|
||||||
|
* 画像が全て隠れた状態で表示されるようになります
|
||||||
|
- 1枚だけのメディアリストの画像のアスペクト比を画像に応じて縦長にするように
|
||||||
|
- Fix: リアクションをホバーした時のユーザーリストで猫耳が切れてしまっていた問題を修正
|
||||||
|
- 新しい実績を追加
|
||||||
|
|
||||||
|
### Server
|
||||||
|
- Fix: エクスポートデータの拡張子がunknownになる問題を修正
|
||||||
|
- Fix: Content-Dispositionのパースでエラーが発生した場合にダウンロードが完了しない問題を修正
|
||||||
|
- Fix: API: i/update avatarIdとbannerIdにnullを渡した時、画像がリセットされない問題を修正
|
||||||
|
- Fix: 1:1ではない画像のリアクション通知バッジが左や上に寄ってしまっていたのを中央に来るように修正
|
||||||
|
|
||||||
|
## 13.11.3
|
||||||
|
|
||||||
|
### General
|
||||||
|
- 指定したロールを持つユーザーのノートのみが流れるロールタイムラインを追加
|
||||||
|
- Deckのカラムとしても追加可能
|
||||||
|
- カスタム絵文字関連の改善
|
||||||
|
* ノートなどに含まれるemojis(populateEmojiの結果)は(プロキシされたURLではなく)オリジナルのURLを指すように
|
||||||
|
* MFMでx3/x4もしくはscale.x/yが2.5以上に指定されていた場合にはオリジナル品質の絵文字を使用するように
|
||||||
|
- カスタム絵文字でリアクションできないことがある問題を修正
|
||||||
|
|
||||||
|
### Client
|
||||||
|
- チャンネルのピン留めされたノートの順番が正しくない問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- ノート作成時のアンテナ追加パフォーマンスを改善
|
|
||||||
- フォローインポートなどでの大量のフォロー等操作をキューイングするように #10544 @nmkj-io
|
- フォローインポートなどでの大量のフォロー等操作をキューイングするように #10544 @nmkj-io
|
||||||
|
- Misskey Webでのサーバーサイドエラー画面を改善
|
||||||
|
- Misskey Webでのサーバーサイドエラーのログが残るように
|
||||||
|
- ノート作成時のアンテナ追加パフォーマンスを改善
|
||||||
|
- アンテナとロールTLのuntil/sinceプロパティが動くように
|
||||||
|
|
||||||
## 13.11.2
|
## 13.11.2
|
||||||
|
|
||||||
|
@ -99,6 +139,8 @@
|
||||||
- 猫耳のアバター内部部分をぼかしでマスク表示してより猫耳っぽく見えるように
|
- 猫耳のアバター内部部分をぼかしでマスク表示してより猫耳っぽく見えるように
|
||||||
- 「UIのアニメーションを減らす」 (`reduceAnimation`) で猫耳を撫でられなくなります
|
- 「UIのアニメーションを減らす」 (`reduceAnimation`) で猫耳を撫でられなくなります
|
||||||
- Add Minimizing ("folding") of windows
|
- Add Minimizing ("folding") of windows
|
||||||
|
- 「データセーバー」モードを追加
|
||||||
|
- 非NSFWメディアが隠れている際にも「閲覧注意」が出てしまう問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- PostgreSQLのレプリケーション対応
|
- PostgreSQLのレプリケーション対応
|
||||||
|
|
|
@ -245,7 +245,6 @@ You can override the default story by creating a impl story file (`MyComponent.s
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
/* eslint-disable import/no-duplicates */
|
|
||||||
import { StoryObj } from '@storybook/vue3';
|
import { StoryObj } from '@storybook/vue3';
|
||||||
import MyComponent from './MyComponent.vue';
|
import MyComponent from './MyComponent.vue';
|
||||||
export const Default = {
|
export const Default = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# syntax = docker/dockerfile:1.4
|
# syntax = docker/dockerfile:1.4
|
||||||
|
|
||||||
ARG NODE_VERSION=18.13.0-bullseye
|
ARG NODE_VERSION=18.16.0-bullseye
|
||||||
|
|
||||||
# build assets & compile TypeScript
|
# build assets & compile TypeScript
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,11 @@ describe('After setup instance', () => {
|
||||||
cy.intercept('POST', '/api/signup').as('signup');
|
cy.intercept('POST', '/api/signup').as('signup');
|
||||||
|
|
||||||
cy.get('[data-cy-signup]').click();
|
cy.get('[data-cy-signup]').click();
|
||||||
|
cy.get('[data-cy-signup-rules-continue]').should('be.disabled');
|
||||||
|
cy.get('[data-cy-signup-rules-notes-agree] [data-cy-switch-toggle]').click();
|
||||||
|
cy.get('[data-cy-signup-rules-continue]').should('not.be.disabled');
|
||||||
|
cy.get('[data-cy-signup-rules-continue]').click();
|
||||||
|
|
||||||
cy.get('[data-cy-signup-submit]').should('be.disabled');
|
cy.get('[data-cy-signup-submit]').should('be.disabled');
|
||||||
cy.get('[data-cy-signup-username] input').type('alice');
|
cy.get('[data-cy-signup-username] input').type('alice');
|
||||||
cy.get('[data-cy-signup-submit]').should('be.disabled');
|
cy.get('[data-cy-signup-submit]').should('be.disabled');
|
||||||
|
@ -71,6 +76,11 @@ describe('After setup instance', () => {
|
||||||
|
|
||||||
// ユーザー名が重複している場合の挙動確認
|
// ユーザー名が重複している場合の挙動確認
|
||||||
cy.get('[data-cy-signup]').click();
|
cy.get('[data-cy-signup]').click();
|
||||||
|
cy.get('[data-cy-signup-rules-continue]').should('be.disabled');
|
||||||
|
cy.get('[data-cy-signup-rules-notes-agree] [data-cy-switch-toggle]').click();
|
||||||
|
cy.get('[data-cy-signup-rules-continue]').should('not.be.disabled');
|
||||||
|
cy.get('[data-cy-signup-rules-continue]').click();
|
||||||
|
|
||||||
cy.get('[data-cy-signup-username] input').type('alice');
|
cy.get('[data-cy-signup-username] input').type('alice');
|
||||||
cy.get('[data-cy-signup-password] input').type('alice1234');
|
cy.get('[data-cy-signup-password] input').type('alice1234');
|
||||||
cy.get('[data-cy-signup-password-retype] input').type('alice1234');
|
cy.get('[data-cy-signup-password-retype] input').type('alice1234');
|
||||||
|
|
|
@ -45,7 +45,7 @@ gulp.task('build:backend:script', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build:backend:style', () => {
|
gulp.task('build:backend:style', () => {
|
||||||
return gulp.src(['./packages/backend/src/server/web/style.css', './packages/backend/src/server/web/bios.css', './packages/backend/src/server/web/cli.css'])
|
return gulp.src(['./packages/backend/src/server/web/style.css', './packages/backend/src/server/web/bios.css', './packages/backend/src/server/web/cli.css', './packages/backend/src/server/web/error.css'])
|
||||||
.pipe(cssnano({
|
.pipe(cssnano({
|
||||||
zindex: false
|
zindex: false
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -20,6 +20,7 @@ noNotes: "Keine Notizen gefunden"
|
||||||
noNotifications: "Keine Benachrichtigungen gefunden"
|
noNotifications: "Keine Benachrichtigungen gefunden"
|
||||||
instance: "Instanz"
|
instance: "Instanz"
|
||||||
settings: "Einstellungen"
|
settings: "Einstellungen"
|
||||||
|
notificationSettings: "Benachrichtigungseinstellungen"
|
||||||
basicSettings: "Allgemeine Einstellungen"
|
basicSettings: "Allgemeine Einstellungen"
|
||||||
otherSettings: "Weitere Einstellungen"
|
otherSettings: "Weitere Einstellungen"
|
||||||
openInWindow: "In einem Fenster öffnen"
|
openInWindow: "In einem Fenster öffnen"
|
||||||
|
@ -1407,6 +1408,8 @@ _channel:
|
||||||
following: "Gefolgt"
|
following: "Gefolgt"
|
||||||
usersCount: "{n} Teilnehmer"
|
usersCount: "{n} Teilnehmer"
|
||||||
notesCount: "{n} Notizen"
|
notesCount: "{n} Notizen"
|
||||||
|
nameAndDescription: "Name und Beschreibung"
|
||||||
|
nameOnly: "Nur Name"
|
||||||
_menuDisplay:
|
_menuDisplay:
|
||||||
sideFull: "Seitlich"
|
sideFull: "Seitlich"
|
||||||
sideIcon: "Seitlich (Icons)"
|
sideIcon: "Seitlich (Icons)"
|
||||||
|
@ -1887,6 +1890,7 @@ _deck:
|
||||||
channel: "Kanal"
|
channel: "Kanal"
|
||||||
mentions: "Erwähnungen"
|
mentions: "Erwähnungen"
|
||||||
direct: "Direktnachrichten"
|
direct: "Direktnachrichten"
|
||||||
|
roleTimeline: "Rollenchronik"
|
||||||
_dialog:
|
_dialog:
|
||||||
charactersExceeded: "Maximallänge überschritten! Momentan {current} von {max}"
|
charactersExceeded: "Maximallänge überschritten! Momentan {current} von {max}"
|
||||||
charactersBelow: "Minimallänge unterschritten! Momentan {current} von {min}"
|
charactersBelow: "Minimallänge unterschritten! Momentan {current} von {min}"
|
||||||
|
|
|
@ -20,6 +20,7 @@ noNotes: "No notes"
|
||||||
noNotifications: "No notifications"
|
noNotifications: "No notifications"
|
||||||
instance: "Instance"
|
instance: "Instance"
|
||||||
settings: "Settings"
|
settings: "Settings"
|
||||||
|
notificationSettings: "Notification Settings"
|
||||||
basicSettings: "Basic Settings"
|
basicSettings: "Basic Settings"
|
||||||
otherSettings: "Other Settings"
|
otherSettings: "Other Settings"
|
||||||
openInWindow: "Open in window"
|
openInWindow: "Open in window"
|
||||||
|
@ -904,6 +905,7 @@ remoteOnly: "Remote only"
|
||||||
failedToUpload: "Upload failed"
|
failedToUpload: "Upload failed"
|
||||||
cannotUploadBecauseInappropriate: "This file could not be uploaded because parts of it have been detected as potentially NSFW."
|
cannotUploadBecauseInappropriate: "This file could not be uploaded because parts of it have been detected as potentially NSFW."
|
||||||
cannotUploadBecauseNoFreeSpace: "Upload failed due to lack of Drive capacity."
|
cannotUploadBecauseNoFreeSpace: "Upload failed due to lack of Drive capacity."
|
||||||
|
cannotUploadBecauseExceedsFileSizeLimit: "This file could not be uploaded because it exceeds the maximum allowed size."
|
||||||
beta: "Beta"
|
beta: "Beta"
|
||||||
enableAutoSensitive: "Automatic NSFW-Marking"
|
enableAutoSensitive: "Automatic NSFW-Marking"
|
||||||
enableAutoSensitiveDescription: "Allows automatic detection and marking of NSFW media through Machine Learning where possible. Even if this option is disabled, it may be enabled instance-wide."
|
enableAutoSensitiveDescription: "Allows automatic detection and marking of NSFW media through Machine Learning where possible. Even if this option is disabled, it may be enabled instance-wide."
|
||||||
|
@ -1407,6 +1409,8 @@ _channel:
|
||||||
following: "Followed"
|
following: "Followed"
|
||||||
usersCount: "{n} Participants"
|
usersCount: "{n} Participants"
|
||||||
notesCount: "{n} Notes"
|
notesCount: "{n} Notes"
|
||||||
|
nameAndDescription: "Name and description"
|
||||||
|
nameOnly: "Name only"
|
||||||
_menuDisplay:
|
_menuDisplay:
|
||||||
sideFull: "Side"
|
sideFull: "Side"
|
||||||
sideIcon: "Side (Icons)"
|
sideIcon: "Side (Icons)"
|
||||||
|
@ -1887,6 +1891,7 @@ _deck:
|
||||||
channel: "Channel"
|
channel: "Channel"
|
||||||
mentions: "Mentions"
|
mentions: "Mentions"
|
||||||
direct: "Direct notes"
|
direct: "Direct notes"
|
||||||
|
roleTimeline: "Role Timeline"
|
||||||
_dialog:
|
_dialog:
|
||||||
charactersExceeded: "You've exceeded the maximum character limit! Currently at {current} of {max}."
|
charactersExceeded: "You've exceeded the maximum character limit! Currently at {current} of {max}."
|
||||||
charactersBelow: "You're below the minimum character limit! Currently at {current} of {min}."
|
charactersBelow: "You're below the minimum character limit! Currently at {current} of {min}."
|
||||||
|
|
|
@ -20,6 +20,7 @@ noNotes: "Nessuna nota!"
|
||||||
noNotifications: "Nessuna notifica"
|
noNotifications: "Nessuna notifica"
|
||||||
instance: "Istanza"
|
instance: "Istanza"
|
||||||
settings: "Impostazioni"
|
settings: "Impostazioni"
|
||||||
|
notificationSettings: "Preferenze di notifica"
|
||||||
basicSettings: "Impostazioni generali"
|
basicSettings: "Impostazioni generali"
|
||||||
otherSettings: "Altre impostazioni"
|
otherSettings: "Altre impostazioni"
|
||||||
openInWindow: "Apri in una finestra"
|
openInWindow: "Apri in una finestra"
|
||||||
|
@ -786,7 +787,7 @@ gallery: "Galleria"
|
||||||
recentPosts: "Le più recenti"
|
recentPosts: "Le più recenti"
|
||||||
popularPosts: "Le più visualizzate"
|
popularPosts: "Le più visualizzate"
|
||||||
shareWithNote: "Condividere in nota"
|
shareWithNote: "Condividere in nota"
|
||||||
ads: "Pubblicità"
|
ads: "Banner"
|
||||||
expiration: "Scadenza"
|
expiration: "Scadenza"
|
||||||
startingperiod: "Periodo di inizio"
|
startingperiod: "Periodo di inizio"
|
||||||
memo: "Promemoria"
|
memo: "Promemoria"
|
||||||
|
@ -991,6 +992,7 @@ largeNoteReactions: "Ingrandisci le reazioni"
|
||||||
noteIdOrUrl: "ID della Nota o URL"
|
noteIdOrUrl: "ID della Nota o URL"
|
||||||
accountMigration: "Migrazione del profilo"
|
accountMigration: "Migrazione del profilo"
|
||||||
accountMoved: "Questo profilo ha migrato altrove:"
|
accountMoved: "Questo profilo ha migrato altrove:"
|
||||||
|
forceShowAds: "Mostra sempre i banner"
|
||||||
_accountMigration:
|
_accountMigration:
|
||||||
moveTo: "Migrare questo profilo verso un un altro"
|
moveTo: "Migrare questo profilo verso un un altro"
|
||||||
moveToLabel: "Profilo verso cui migrare"
|
moveToLabel: "Profilo verso cui migrare"
|
||||||
|
@ -1406,6 +1408,8 @@ _channel:
|
||||||
following: "Seguiti"
|
following: "Seguiti"
|
||||||
usersCount: "{n} partecipanti"
|
usersCount: "{n} partecipanti"
|
||||||
notesCount: "{n} note"
|
notesCount: "{n} note"
|
||||||
|
nameAndDescription: "Nome e descrizione"
|
||||||
|
nameOnly: "Solo il nome"
|
||||||
_menuDisplay:
|
_menuDisplay:
|
||||||
sideFull: "Laterale"
|
sideFull: "Laterale"
|
||||||
sideIcon: "Laterale (solo icone)"
|
sideIcon: "Laterale (solo icone)"
|
||||||
|
|
|
@ -263,14 +263,16 @@ noMoreHistory: "これより過去の履歴はありません"
|
||||||
startMessaging: "チャットを開始"
|
startMessaging: "チャットを開始"
|
||||||
nUsersRead: "{n}人が読みました"
|
nUsersRead: "{n}人が読みました"
|
||||||
agreeTo: "{0}に同意"
|
agreeTo: "{0}に同意"
|
||||||
|
agree: "同意する"
|
||||||
agreeBelow: "下記に同意する"
|
agreeBelow: "下記に同意する"
|
||||||
basicNotesBeforeCreateAccount: "基本的な注意事項"
|
basicNotesBeforeCreateAccount: "基本的な注意事項"
|
||||||
tos: "利用規約"
|
termsOfService: "利用規約"
|
||||||
start: "始める"
|
start: "始める"
|
||||||
home: "ホーム"
|
home: "ホーム"
|
||||||
remoteUserCaution: "リモートユーザーのため、情報が不完全です。"
|
remoteUserCaution: "リモートユーザーのため、情報が不完全です。"
|
||||||
activity: "アクティビティ"
|
activity: "アクティビティ"
|
||||||
images: "画像"
|
images: "画像"
|
||||||
|
image: "画像"
|
||||||
birthday: "誕生日"
|
birthday: "誕生日"
|
||||||
yearsOld: "{age}歳"
|
yearsOld: "{age}歳"
|
||||||
registeredDate: "登録日"
|
registeredDate: "登録日"
|
||||||
|
@ -474,6 +476,8 @@ createAccount: "アカウントを作成"
|
||||||
existingAccount: "既存のアカウント"
|
existingAccount: "既存のアカウント"
|
||||||
regenerate: "再生成"
|
regenerate: "再生成"
|
||||||
fontSize: "フォントサイズ"
|
fontSize: "フォントサイズ"
|
||||||
|
mediaListWithOneImageAppearance: "画像が1枚のみのメディアリストの高さ"
|
||||||
|
limitTo: "{x}を上限に"
|
||||||
noFollowRequests: "フォロー申請はありません"
|
noFollowRequests: "フォロー申請はありません"
|
||||||
openImageInNewTab: "画像を新しいタブで開く"
|
openImageInNewTab: "画像を新しいタブで開く"
|
||||||
dashboard: "ダッシュボード"
|
dashboard: "ダッシュボード"
|
||||||
|
@ -905,6 +909,7 @@ remoteOnly: "リモートのみ"
|
||||||
failedToUpload: "アップロード失敗"
|
failedToUpload: "アップロード失敗"
|
||||||
cannotUploadBecauseInappropriate: "不適切な内容を含む可能性があると判定されたためアップロードできません。"
|
cannotUploadBecauseInappropriate: "不適切な内容を含む可能性があると判定されたためアップロードできません。"
|
||||||
cannotUploadBecauseNoFreeSpace: "ドライブの空き容量が無いためアップロードできません。"
|
cannotUploadBecauseNoFreeSpace: "ドライブの空き容量が無いためアップロードできません。"
|
||||||
|
cannotUploadBecauseExceedsFileSizeLimit: "ファイルサイズの制限を超えているためアップロードできません。"
|
||||||
beta: "ベータ"
|
beta: "ベータ"
|
||||||
enableAutoSensitive: "自動NSFW判定"
|
enableAutoSensitive: "自動NSFW判定"
|
||||||
enableAutoSensitiveDescription: "利用可能な場合は、機械学習を利用して自動でメディアにNSFWフラグを設定します。この機能をオフにしても、サーバーによっては自動で設定されることがあります。"
|
enableAutoSensitiveDescription: "利用可能な場合は、機械学習を利用して自動でメディアにNSFWフラグを設定します。この機能をオフにしても、サーバーによっては自動で設定されることがあります。"
|
||||||
|
@ -947,6 +952,10 @@ manageCustomEmojis: "カスタム絵文字の管理"
|
||||||
youCannotCreateAnymore: "これ以上作成することはできません。"
|
youCannotCreateAnymore: "これ以上作成することはできません。"
|
||||||
cannotPerformTemporary: "一時的に利用できません"
|
cannotPerformTemporary: "一時的に利用できません"
|
||||||
cannotPerformTemporaryDescription: "操作回数が制限を超過するため一時的に利用できません。しばらく時間を置いてから再度お試しください。"
|
cannotPerformTemporaryDescription: "操作回数が制限を超過するため一時的に利用できません。しばらく時間を置いてから再度お試しください。"
|
||||||
|
invalidParamError: "パラメータエラー"
|
||||||
|
invalidParamErrorDescription: "リクエストパラメータに問題があります。通常これはバグですが、入力した文字数が多すぎる等の可能性もあります。"
|
||||||
|
permissionDeniedError: "操作が拒否されました"
|
||||||
|
permissionDeniedErrorDescription: "このアカウントにはこの操作を行うための権限がありません。"
|
||||||
preset: "プリセット"
|
preset: "プリセット"
|
||||||
selectFromPresets: "プリセットから選択"
|
selectFromPresets: "プリセットから選択"
|
||||||
achievements: "実績"
|
achievements: "実績"
|
||||||
|
@ -990,12 +999,33 @@ enableChartsForFederatedInstances: "リモートサーバーのチャートを
|
||||||
showClipButtonInNoteFooter: "ノートのアクションにクリップを追加"
|
showClipButtonInNoteFooter: "ノートのアクションにクリップを追加"
|
||||||
largeNoteReactions: "ノートのリアクションを大きく表示"
|
largeNoteReactions: "ノートのリアクションを大きく表示"
|
||||||
noteIdOrUrl: "ノートIDまたはURL"
|
noteIdOrUrl: "ノートIDまたはURL"
|
||||||
|
video: "動画"
|
||||||
|
videos: "動画"
|
||||||
|
dataSaver: "データセーバー"
|
||||||
accountMigration: "アカウントの引っ越し"
|
accountMigration: "アカウントの引っ越し"
|
||||||
accountMoved: "このユーザーは新しいアカウントに引っ越しました:"
|
accountMoved: "このユーザーは新しいアカウントに引っ越しました:"
|
||||||
forceShowAds: "常に広告を表示する"
|
forceShowAds: "常に広告を表示する"
|
||||||
event: "イベント"
|
event: "イベント"
|
||||||
events: "イベント"
|
events: "イベント"
|
||||||
reverseChronological: "倒叙"
|
reverseChronological: "倒叙"
|
||||||
|
addMemo: "メモを追加"
|
||||||
|
editMemo: "メモを編集"
|
||||||
|
notificationDisplay: "通知の表示"
|
||||||
|
leftTop: "左上"
|
||||||
|
rightTop: "右上"
|
||||||
|
leftBottom: "左下"
|
||||||
|
rightBottom: "右下"
|
||||||
|
stackAxis: "スタック方向"
|
||||||
|
vertical: "縦"
|
||||||
|
horizontal: "横"
|
||||||
|
position: "位置"
|
||||||
|
serverRules: "サーバールール"
|
||||||
|
pleaseConfirmBelowBeforeSignup: "このサーバーに登録する前に、以下を確認してください。"
|
||||||
|
pleaseAgreeAllToContinue: "続けるには、全ての「同意する」にチェックが入っている必要があります。"
|
||||||
|
continue: "続ける"
|
||||||
|
|
||||||
|
_serverRules:
|
||||||
|
description: "新規登録前に表示する、サーバーの簡潔なルールを設定します。内容は利用規約の要約とすることを推奨します。"
|
||||||
|
|
||||||
_event:
|
_event:
|
||||||
title: "題"
|
title: "題"
|
||||||
|
@ -1186,6 +1216,9 @@ _achievements:
|
||||||
_client30min:
|
_client30min:
|
||||||
title: "ひとやすみ"
|
title: "ひとやすみ"
|
||||||
description: "クライアントを起動してから30分以上経過した"
|
description: "クライアントを起動してから30分以上経過した"
|
||||||
|
_client60min:
|
||||||
|
title: "Misskeyの見すぎ"
|
||||||
|
description: "クライアントを起動してから60分以上経過した"
|
||||||
_noteDeletedWithin1min:
|
_noteDeletedWithin1min:
|
||||||
title: "いまのなし"
|
title: "いまのなし"
|
||||||
description: "投稿してから1分以内にその投稿を削除した"
|
description: "投稿してから1分以内にその投稿を削除した"
|
||||||
|
@ -1275,6 +1308,8 @@ _role:
|
||||||
iconUrl: "アイコン画像のURL"
|
iconUrl: "アイコン画像のURL"
|
||||||
asBadge: "バッジとして表示"
|
asBadge: "バッジとして表示"
|
||||||
descriptionOfAsBadge: "オンにすると、ユーザー名の横にロールのアイコンが表示されます。"
|
descriptionOfAsBadge: "オンにすると、ユーザー名の横にロールのアイコンが表示されます。"
|
||||||
|
isExplorable: "ロールタイムラインを公開"
|
||||||
|
descriptionOfIsExplorable: "オンにすると、ロールのタイムラインを公開します。ロールの公開がオフの場合、タイムラインの公開はされません。"
|
||||||
displayOrder: "表示順"
|
displayOrder: "表示順"
|
||||||
descriptionOfDisplayOrder: "数値が大きいほどUI上で先頭に表示されます。"
|
descriptionOfDisplayOrder: "数値が大きいほどUI上で先頭に表示されます。"
|
||||||
canEditMembersByModerator: "モデレーターのメンバー編集を許可"
|
canEditMembersByModerator: "モデレーターのメンバー編集を許可"
|
||||||
|
@ -1955,6 +1990,7 @@ _deck:
|
||||||
channel: "チャンネル"
|
channel: "チャンネル"
|
||||||
mentions: "あなた宛て"
|
mentions: "あなた宛て"
|
||||||
direct: "ダイレクト"
|
direct: "ダイレクト"
|
||||||
|
roleTimeline: "ロールタイムライン"
|
||||||
|
|
||||||
_dialog:
|
_dialog:
|
||||||
charactersExceeded: "最大文字数を超えています! 現在 {current} / 制限 {max}"
|
charactersExceeded: "最大文字数を超えています! 現在 {current} / 制限 {max}"
|
||||||
|
|
|
@ -20,6 +20,7 @@ noNotes: "ノートはあらへん"
|
||||||
noNotifications: "通知はあらへん"
|
noNotifications: "通知はあらへん"
|
||||||
instance: "サーバー"
|
instance: "サーバー"
|
||||||
settings: "設定"
|
settings: "設定"
|
||||||
|
notificationSettings: "通知の設定"
|
||||||
basicSettings: "基本設定"
|
basicSettings: "基本設定"
|
||||||
otherSettings: "ほかの設定"
|
otherSettings: "ほかの設定"
|
||||||
openInWindow: "ウィンドウで開くで"
|
openInWindow: "ウィンドウで開くで"
|
||||||
|
@ -1407,6 +1408,8 @@ _channel:
|
||||||
following: "フォロー中やで"
|
following: "フォロー中やで"
|
||||||
usersCount: "{n}人が参加中やで"
|
usersCount: "{n}人が参加中やで"
|
||||||
notesCount: "{n}こ投稿があるで"
|
notesCount: "{n}こ投稿があるで"
|
||||||
|
nameAndDescription: "名前と説明"
|
||||||
|
nameOnly: "名前だけ"
|
||||||
_menuDisplay:
|
_menuDisplay:
|
||||||
sideFull: "横"
|
sideFull: "横"
|
||||||
sideIcon: "横(アイコン)"
|
sideIcon: "横(アイコン)"
|
||||||
|
@ -1887,6 +1890,7 @@ _deck:
|
||||||
channel: "チャンネル"
|
channel: "チャンネル"
|
||||||
mentions: "あんた宛て"
|
mentions: "あんた宛て"
|
||||||
direct: "ダイレクト"
|
direct: "ダイレクト"
|
||||||
|
roleTimeline: "ロールタイムライン"
|
||||||
_dialog:
|
_dialog:
|
||||||
charactersExceeded: "最大の文字数を上回っとるで!今は {current} / 最大でも {max}"
|
charactersExceeded: "最大の文字数を上回っとるで!今は {current} / 最大でも {max}"
|
||||||
charactersBelow: "最小の文字数を下回っとるで!今は {current} / 最低でも {min}"
|
charactersBelow: "最小の文字数を下回っとるで!今は {current} / 最低でも {min}"
|
||||||
|
|
|
@ -20,6 +20,7 @@ noNotes: "没有帖文"
|
||||||
noNotifications: "无通知"
|
noNotifications: "无通知"
|
||||||
instance: "服务器"
|
instance: "服务器"
|
||||||
settings: "设置"
|
settings: "设置"
|
||||||
|
notificationSettings: "通知设置"
|
||||||
basicSettings: "基本设置"
|
basicSettings: "基本设置"
|
||||||
otherSettings: "其他设置"
|
otherSettings: "其他设置"
|
||||||
openInWindow: "在新窗口中打开"
|
openInWindow: "在新窗口中打开"
|
||||||
|
@ -1407,6 +1408,8 @@ _channel:
|
||||||
following: "正在关注"
|
following: "正在关注"
|
||||||
usersCount: "有{n}人参与"
|
usersCount: "有{n}人参与"
|
||||||
notesCount: "有{n}个帖子"
|
notesCount: "有{n}个帖子"
|
||||||
|
nameAndDescription: "名称与描述"
|
||||||
|
nameOnly: "仅名称"
|
||||||
_menuDisplay:
|
_menuDisplay:
|
||||||
sideFull: "横向"
|
sideFull: "横向"
|
||||||
sideIcon: "横向(图标)"
|
sideIcon: "横向(图标)"
|
||||||
|
@ -1887,6 +1890,7 @@ _deck:
|
||||||
channel: "频道"
|
channel: "频道"
|
||||||
mentions: "提及"
|
mentions: "提及"
|
||||||
direct: "指定用户"
|
direct: "指定用户"
|
||||||
|
roleTimeline: "角色时间线"
|
||||||
_dialog:
|
_dialog:
|
||||||
charactersExceeded: "已经超过了最大字符数! 当前字符数 {current} / 限制字符数 {max}"
|
charactersExceeded: "已经超过了最大字符数! 当前字符数 {current} / 限制字符数 {max}"
|
||||||
charactersBelow: "低于最小字符数!当前字符数 {current} / 限制字符数 {min}"
|
charactersBelow: "低于最小字符数!当前字符数 {current} / 限制字符数 {min}"
|
||||||
|
|
|
@ -20,6 +20,7 @@ noNotes: "無貼文。"
|
||||||
noNotifications: "沒有通知"
|
noNotifications: "沒有通知"
|
||||||
instance: "實例"
|
instance: "實例"
|
||||||
settings: "設定"
|
settings: "設定"
|
||||||
|
notificationSettings: "通知選項"
|
||||||
basicSettings: "基本設定"
|
basicSettings: "基本設定"
|
||||||
otherSettings: "其他設定"
|
otherSettings: "其他設定"
|
||||||
openInWindow: "在新視窗開啟"
|
openInWindow: "在新視窗開啟"
|
||||||
|
@ -506,6 +507,7 @@ objectStorageUseSSLDesc: "如果不使用https進行API連接,請關閉"
|
||||||
objectStorageUseProxy: "使用網路代理"
|
objectStorageUseProxy: "使用網路代理"
|
||||||
objectStorageUseProxyDesc: "如果不使用代理進行API連接,請關閉"
|
objectStorageUseProxyDesc: "如果不使用代理進行API連接,請關閉"
|
||||||
objectStorageSetPublicRead: "上傳時設定為\"public-read\""
|
objectStorageSetPublicRead: "上傳時設定為\"public-read\""
|
||||||
|
s3ForcePathStyleDesc: "啟用 s3ForcePathStyle 會強制將儲存槽名稱指定為 URL 中路徑的一部分,而不是主機名。 使用自託管 Minio 之類的可能需要啟用。"
|
||||||
serverLogs: "伺服器日誌"
|
serverLogs: "伺服器日誌"
|
||||||
deleteAll: "刪除所有記錄"
|
deleteAll: "刪除所有記錄"
|
||||||
showFixedPostForm: "於時間軸頁頂顯示「發送貼文」方框"
|
showFixedPostForm: "於時間軸頁頂顯示「發送貼文」方框"
|
||||||
|
@ -560,7 +562,7 @@ inboxUrl: "收件夾URL"
|
||||||
addedRelays: "已加入的中繼"
|
addedRelays: "已加入的中繼"
|
||||||
serviceworkerInfo: "您需要啟用推送通知"
|
serviceworkerInfo: "您需要啟用推送通知"
|
||||||
deletedNote: "已删除的貼文"
|
deletedNote: "已删除的貼文"
|
||||||
invisibleNote: "隱藏的貼文"
|
invisibleNote: "私密的貼文"
|
||||||
enableInfiniteScroll: "啟用自動滾動頁面模式"
|
enableInfiniteScroll: "啟用自動滾動頁面模式"
|
||||||
visibility: "可見性"
|
visibility: "可見性"
|
||||||
poll: "投票"
|
poll: "投票"
|
||||||
|
@ -919,6 +921,7 @@ pushNotificationNotSupported: "瀏覽器或實例不支援推播通知"
|
||||||
sendPushNotificationReadMessage: "通知與訊息如果已讀的話,就將推播通知刪除"
|
sendPushNotificationReadMessage: "通知與訊息如果已讀的話,就將推播通知刪除"
|
||||||
sendPushNotificationReadMessageCaption: "「{emptyPushNotificationMessage}」通知將立刻顯示。可能會增加設備的電池消耗。"
|
sendPushNotificationReadMessageCaption: "「{emptyPushNotificationMessage}」通知將立刻顯示。可能會增加設備的電池消耗。"
|
||||||
windowMaximize: "最大化"
|
windowMaximize: "最大化"
|
||||||
|
windowMinimize: "最小化"
|
||||||
windowRestore: "復原"
|
windowRestore: "復原"
|
||||||
caption: "標題"
|
caption: "標題"
|
||||||
loggedInAsBot: "以機器人帳戶登入中"
|
loggedInAsBot: "以機器人帳戶登入中"
|
||||||
|
@ -960,6 +963,9 @@ copyErrorInfo: "複製錯誤資訊"
|
||||||
joinThisServer: "在此伺服器上註冊"
|
joinThisServer: "在此伺服器上註冊"
|
||||||
exploreOtherServers: "探索其他伺服器"
|
exploreOtherServers: "探索其他伺服器"
|
||||||
letsLookAtTimeline: "看看時間軸"
|
letsLookAtTimeline: "看看時間軸"
|
||||||
|
disableFederationConfirm: "要停止聯邦功能嗎?"
|
||||||
|
disableFederationConfirmWarn: "即使停止了聯邦功能,貼文也不會變成私密的。在大部分的情況下,沒有必要停止聯邦功能。"
|
||||||
|
disableFederationOk: "停止聯邦功能"
|
||||||
invitationRequiredToRegister: "目前這個伺服器為邀請制,必須擁有邀請碼才能註冊。"
|
invitationRequiredToRegister: "目前這個伺服器為邀請制,必須擁有邀請碼才能註冊。"
|
||||||
emailNotSupported: "這個伺服器不支援寄送郵件"
|
emailNotSupported: "這個伺服器不支援寄送郵件"
|
||||||
postToTheChannel: "發布到頻道"
|
postToTheChannel: "發布到頻道"
|
||||||
|
@ -985,6 +991,7 @@ showClipButtonInNoteFooter: "將摘錄添加至貼文"
|
||||||
largeNoteReactions: "將貼文的反應放大顯示"
|
largeNoteReactions: "將貼文的反應放大顯示"
|
||||||
noteIdOrUrl: "貼文ID或URL"
|
noteIdOrUrl: "貼文ID或URL"
|
||||||
accountMigration: "遷移帳戶"
|
accountMigration: "遷移帳戶"
|
||||||
|
accountMoved: "這個使用者已遷移至新的帳戶:"
|
||||||
forceShowAds: "總是顯示廣告"
|
forceShowAds: "總是顯示廣告"
|
||||||
_accountMigration:
|
_accountMigration:
|
||||||
moveTo: "將這個帳戶遷移至新的帳戶"
|
moveTo: "將這個帳戶遷移至新的帳戶"
|
||||||
|
@ -1401,6 +1408,8 @@ _channel:
|
||||||
following: "關注中"
|
following: "關注中"
|
||||||
usersCount: "有{n}人參與"
|
usersCount: "有{n}人參與"
|
||||||
notesCount: "有{n}個貼文"
|
notesCount: "有{n}個貼文"
|
||||||
|
nameAndDescription: "名稱與說明"
|
||||||
|
nameOnly: "僅名稱"
|
||||||
_menuDisplay:
|
_menuDisplay:
|
||||||
sideFull: "側向"
|
sideFull: "側向"
|
||||||
sideIcon: "側向(圖示)"
|
sideIcon: "側向(圖示)"
|
||||||
|
@ -1881,6 +1890,7 @@ _deck:
|
||||||
channel: "頻道"
|
channel: "頻道"
|
||||||
mentions: "提及"
|
mentions: "提及"
|
||||||
direct: "指定使用者"
|
direct: "指定使用者"
|
||||||
|
roleTimeline: "角色時間軸"
|
||||||
_dialog:
|
_dialog:
|
||||||
charactersExceeded: "已超過最大字數!現在 {current} / 限制 {max}"
|
charactersExceeded: "已超過最大字數!現在 {current} / 限制 {max}"
|
||||||
charactersBelow: "低於最少字數!現在 {current} / 限制 {max}"
|
charactersBelow: "低於最少字數!現在 {current} / 限制 {max}"
|
||||||
|
|
16
package.json
16
package.json
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "13.11.2",
|
"version": "13.11.3",
|
||||||
"codename": "nasubi",
|
"codename": "nasubi",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/misskey-dev/misskey.git"
|
"url": "https://github.com/misskey-dev/misskey.git"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.1.1",
|
"packageManager": "pnpm@8.3.1",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/frontend",
|
"packages/frontend",
|
||||||
"packages/backend",
|
"packages/backend",
|
||||||
|
@ -51,19 +51,19 @@
|
||||||
"gulp-replace": "1.1.4",
|
"gulp-replace": "1.1.4",
|
||||||
"gulp-terser": "2.1.0",
|
"gulp-terser": "2.1.0",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"typescript": "5.0.3"
|
"typescript": "5.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/gulp": "4.0.10",
|
"@types/gulp": "4.0.10",
|
||||||
"@types/gulp-rename": "2.0.1",
|
"@types/gulp-rename": "2.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "5.57.1",
|
"@typescript-eslint/eslint-plugin": "5.59.0",
|
||||||
"@typescript-eslint/parser": "5.57.1",
|
"@typescript-eslint/parser": "5.59.0",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"cypress": "12.9.0",
|
"cypress": "12.10.0",
|
||||||
"eslint": "8.37.0",
|
"eslint": "8.38.0",
|
||||||
"start-server-and-test": "2.0.0"
|
"start-server-and-test": "2.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@tensorflow/tfjs-core": "4.2.0"
|
"@tensorflow/tfjs-core": "4.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
export class UserMemo1680702787050 {
|
||||||
|
name = 'UserMemo1680702787050'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`CREATE TABLE "user_memo" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "targetUserId" character varying(32) NOT NULL, "memo" character varying(2048) NOT NULL, CONSTRAINT "PK_e9aaa58f7d3699a84d79078f4d9" PRIMARY KEY ("id")); COMMENT ON COLUMN "user_memo"."userId" IS 'The ID of author.'; COMMENT ON COLUMN "user_memo"."targetUserId" IS 'The ID of target user.'; COMMENT ON COLUMN "user_memo"."memo" IS 'Memo.'`);
|
||||||
|
await queryRunner.query(`CREATE INDEX "IDX_650b49c5639b5840ee6a2b8f83" ON "user_memo" ("userId") `);
|
||||||
|
await queryRunner.query(`CREATE INDEX "IDX_66ac4a82894297fd09ba61f3d3" ON "user_memo" ("targetUserId") `);
|
||||||
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_faef300913c738265638ba3ebc" ON "user_memo" ("userId", "targetUserId") `);
|
||||||
|
await queryRunner.query(`ALTER TABLE "user_memo" ADD CONSTRAINT "FK_650b49c5639b5840ee6a2b8f83e" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "user_memo" ADD CONSTRAINT "FK_66ac4a82894297fd09ba61f3d35" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "user_memo" DROP CONSTRAINT "FK_66ac4a82894297fd09ba61f3d35"`);
|
||||||
|
await queryRunner.query(`ALTER TABLE "user_memo" DROP CONSTRAINT "FK_650b49c5639b5840ee6a2b8f83e"`);
|
||||||
|
await queryRunner.query(`DROP TABLE "user_memo"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
export class ServerRules1681400427971 {
|
||||||
|
name = 'ServerRules1681400427971'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "serverRules" character varying(280) array NOT NULL DEFAULT '{}'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "serverRules"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
export class RoleTLSetting1681870960239 {
|
||||||
|
name = 'RoleTLSetting1681870960239'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "role" ADD "isExplorable" boolean NOT NULL DEFAULT false`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "isExplorable"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,33 +23,33 @@
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@swc/core-android-arm64": "1.3.11",
|
"@swc/core-android-arm64": "1.3.11",
|
||||||
"@swc/core-darwin-arm64": "1.3.46",
|
"@swc/core-darwin-arm64": "1.3.51",
|
||||||
"@swc/core-darwin-x64": "1.3.46",
|
"@swc/core-darwin-x64": "1.3.51",
|
||||||
"@swc/core-linux-arm-gnueabihf": "1.3.46",
|
"@swc/core-linux-arm-gnueabihf": "1.3.51",
|
||||||
"@swc/core-linux-arm64-gnu": "1.3.46",
|
"@swc/core-linux-arm64-gnu": "1.3.51",
|
||||||
"@swc/core-linux-arm64-musl": "1.3.46",
|
"@swc/core-linux-arm64-musl": "1.3.51",
|
||||||
"@swc/core-linux-x64-gnu": "1.3.46",
|
"@swc/core-linux-x64-gnu": "1.3.51",
|
||||||
"@swc/core-linux-x64-musl": "1.3.46",
|
"@swc/core-linux-x64-musl": "1.3.51",
|
||||||
"@swc/core-win32-arm64-msvc": "1.3.46",
|
"@swc/core-win32-arm64-msvc": "1.3.51",
|
||||||
"@swc/core-win32-ia32-msvc": "1.3.46",
|
"@swc/core-win32-ia32-msvc": "1.3.51",
|
||||||
"@swc/core-win32-x64-msvc": "1.3.46",
|
"@swc/core-win32-x64-msvc": "1.3.51",
|
||||||
"@tensorflow/tfjs": "4.2.0",
|
"@tensorflow/tfjs": "4.4.0",
|
||||||
"@tensorflow/tfjs-node": "4.2.0"
|
"@tensorflow/tfjs-node": "4.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "3.306.0",
|
"@aws-sdk/client-s3": "3.315.0",
|
||||||
"@aws-sdk/lib-storage": "3.306.0",
|
"@aws-sdk/lib-storage": "3.315.0",
|
||||||
"@aws-sdk/node-http-handler": "3.306.0",
|
"@aws-sdk/node-http-handler": "3.310.0",
|
||||||
"@bull-board/api": "5.0.0",
|
"@bull-board/api": "5.0.1",
|
||||||
"@bull-board/fastify": "5.0.0",
|
"@bull-board/fastify": "5.0.1",
|
||||||
"@bull-board/ui": "5.0.0",
|
"@bull-board/ui": "5.0.1",
|
||||||
"@discordapp/twemoji": "14.1.2",
|
"@discordapp/twemoji": "14.1.2",
|
||||||
"@fastify/accepts": "4.1.0",
|
"@fastify/accepts": "4.1.0",
|
||||||
"@fastify/cookie": "8.3.0",
|
"@fastify/cookie": "8.3.0",
|
||||||
"@fastify/cors": "8.2.1",
|
"@fastify/cors": "8.2.1",
|
||||||
"@fastify/http-proxy": "9.0.0",
|
"@fastify/http-proxy": "9.0.0",
|
||||||
"@fastify/multipart": "7.5.0",
|
"@fastify/multipart": "7.6.0",
|
||||||
"@fastify/static": "6.10.0",
|
"@fastify/static": "6.10.1",
|
||||||
"@fastify/view": "7.4.1",
|
"@fastify/view": "7.4.1",
|
||||||
"@nestjs/common": "9.4.0",
|
"@nestjs/common": "9.4.0",
|
||||||
"@nestjs/core": "9.4.0",
|
"@nestjs/core": "9.4.0",
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
"@peertube/http-signature": "1.7.0",
|
"@peertube/http-signature": "1.7.0",
|
||||||
"@sinonjs/fake-timers": "10.0.2",
|
"@sinonjs/fake-timers": "10.0.2",
|
||||||
"@swc/cli": "0.1.62",
|
"@swc/cli": "0.1.62",
|
||||||
"@swc/core": "1.3.46",
|
"@swc/core": "1.3.51",
|
||||||
"accepts": "1.3.8",
|
"accepts": "1.3.8",
|
||||||
"ajv": "8.12.0",
|
"ajv": "8.12.0",
|
||||||
"archiver": "5.3.1",
|
"archiver": "5.3.1",
|
||||||
|
@ -82,16 +82,16 @@
|
||||||
"fluent-ffmpeg": "2.1.2",
|
"fluent-ffmpeg": "2.1.2",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
"got": "12.6.0",
|
"got": "12.6.0",
|
||||||
"happy-dom": "8.9.0",
|
"happy-dom": "9.8.2",
|
||||||
"hpagent": "1.2.0",
|
"hpagent": "1.2.0",
|
||||||
"ioredis": "4.28.5",
|
"ioredis": "5.3.2",
|
||||||
"ip-cidr": "3.1.0",
|
"ip-cidr": "3.1.0",
|
||||||
"is-svg": "4.3.2",
|
"is-svg": "4.3.2",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"jsdom": "21.1.1",
|
"jsdom": "21.1.1",
|
||||||
"json5": "2.2.3",
|
"json5": "2.2.3",
|
||||||
"jsonld": "8.1.1",
|
"jsonld": "8.1.1",
|
||||||
"jsrsasign": "10.7.0",
|
"jsrsasign": "10.8.2",
|
||||||
"mfm-js": "0.23.3",
|
"mfm-js": "0.23.3",
|
||||||
"mime-types": "2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"misskey-js": "workspace:*",
|
"misskey-js": "workspace:*",
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"rename": "1.0.4",
|
"rename": "1.0.4",
|
||||||
"rndstr": "1.0.0",
|
"rndstr": "1.0.0",
|
||||||
"rss-parser": "3.12.0",
|
"rss-parser": "3.13.0",
|
||||||
"rxjs": "7.8.0",
|
"rxjs": "7.8.0",
|
||||||
"s-age": "1.1.2",
|
"s-age": "1.1.2",
|
||||||
"sanitize-html": "2.10.0",
|
"sanitize-html": "2.10.0",
|
||||||
|
@ -136,8 +136,8 @@
|
||||||
"tsc-alias": "1.8.5",
|
"tsc-alias": "1.8.5",
|
||||||
"tsconfig-paths": "4.2.0",
|
"tsconfig-paths": "4.2.0",
|
||||||
"twemoji-parser": "14.0.0",
|
"twemoji-parser": "14.0.0",
|
||||||
"typeorm": "0.3.13",
|
"typeorm": "0.3.15",
|
||||||
"typescript": "5.0.3",
|
"typescript": "5.0.4",
|
||||||
"ulid": "2.3.0",
|
"ulid": "2.3.0",
|
||||||
"unzipper": "0.10.11",
|
"unzipper": "0.10.11",
|
||||||
"uuid": "9.0.0",
|
"uuid": "9.0.0",
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/globals": "29.5.0",
|
"@jest/globals": "29.5.0",
|
||||||
"@swc/jest": "0.2.24",
|
"@swc/jest": "0.2.26",
|
||||||
"@types/accepts": "1.3.5",
|
"@types/accepts": "1.3.5",
|
||||||
"@types/archiver": "5.3.2",
|
"@types/archiver": "5.3.2",
|
||||||
"@types/bcryptjs": "2.4.2",
|
"@types/bcryptjs": "2.4.2",
|
||||||
|
@ -159,7 +159,6 @@
|
||||||
"@types/content-disposition": "0.5.5",
|
"@types/content-disposition": "0.5.5",
|
||||||
"@types/escape-regexp": "0.0.1",
|
"@types/escape-regexp": "0.0.1",
|
||||||
"@types/fluent-ffmpeg": "2.1.21",
|
"@types/fluent-ffmpeg": "2.1.21",
|
||||||
"@types/ioredis": "4.28.10",
|
|
||||||
"@types/jest": "29.5.0",
|
"@types/jest": "29.5.0",
|
||||||
"@types/js-yaml": "4.0.5",
|
"@types/js-yaml": "4.0.5",
|
||||||
"@types/jsdom": "21.1.1",
|
"@types/jsdom": "21.1.1",
|
||||||
|
@ -190,11 +189,11 @@
|
||||||
"@types/web-push": "3.3.2",
|
"@types/web-push": "3.3.2",
|
||||||
"@types/websocket": "1.0.5",
|
"@types/websocket": "1.0.5",
|
||||||
"@types/ws": "8.5.4",
|
"@types/ws": "8.5.4",
|
||||||
"@typescript-eslint/eslint-plugin": "5.57.1",
|
"@typescript-eslint/eslint-plugin": "5.59.0",
|
||||||
"@typescript-eslint/parser": "5.57.1",
|
"@typescript-eslint/parser": "5.59.0",
|
||||||
"aws-sdk-client-mock": "^2.1.1",
|
"aws-sdk-client-mock": "^2.1.1",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"eslint": "8.37.0",
|
"eslint": "8.38.0",
|
||||||
"eslint-plugin-import": "2.27.5",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"execa": "6.1.0",
|
"execa": "6.1.0",
|
||||||
"jest": "29.5.0",
|
"jest": "29.5.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { setTimeout } from 'node:timers/promises';
|
import { setTimeout } from 'node:timers/promises';
|
||||||
import { Global, Inject, Module } from '@nestjs/common';
|
import { Global, Inject, Module } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import { DI } from './di-symbols.js';
|
import { DI } from './di-symbols.js';
|
||||||
import { loadConfig } from './config.js';
|
import { loadConfig } from './config.js';
|
||||||
|
@ -25,7 +25,7 @@ const $db: Provider = {
|
||||||
const $redis: Provider = {
|
const $redis: Provider = {
|
||||||
provide: DI.redis,
|
provide: DI.redis,
|
||||||
useFactory: (config) => {
|
useFactory: (config) => {
|
||||||
return new Redis({
|
return new Redis.Redis({
|
||||||
port: config.redis.port,
|
port: config.redis.port,
|
||||||
host: config.redis.host,
|
host: config.redis.host,
|
||||||
family: config.redis.family == null ? 0 : config.redis.family,
|
family: config.redis.family == null ? 0 : config.redis.family,
|
||||||
|
@ -40,7 +40,7 @@ const $redis: Provider = {
|
||||||
const $redisForPub: Provider = {
|
const $redisForPub: Provider = {
|
||||||
provide: DI.redisForPub,
|
provide: DI.redisForPub,
|
||||||
useFactory: (config) => {
|
useFactory: (config) => {
|
||||||
const redis = new Redis({
|
const redis = new Redis.Redis({
|
||||||
port: config.redisForPubsub.port,
|
port: config.redisForPubsub.port,
|
||||||
host: config.redisForPubsub.host,
|
host: config.redisForPubsub.host,
|
||||||
family: config.redisForPubsub.family == null ? 0 : config.redisForPubsub.family,
|
family: config.redisForPubsub.family == null ? 0 : config.redisForPubsub.family,
|
||||||
|
@ -56,7 +56,7 @@ const $redisForPub: Provider = {
|
||||||
const $redisForSub: Provider = {
|
const $redisForSub: Provider = {
|
||||||
provide: DI.redisForSub,
|
provide: DI.redisForSub,
|
||||||
useFactory: (config) => {
|
useFactory: (config) => {
|
||||||
const redis = new Redis({
|
const redis = new Redis.Redis({
|
||||||
port: config.redisForPubsub.port,
|
port: config.redisForPubsub.port,
|
||||||
host: config.redisForPubsub.host,
|
host: config.redisForPubsub.host,
|
||||||
family: config.redisForPubsub.family == null ? 0 : config.redisForPubsub.family,
|
family: config.redisForPubsub.family == null ? 0 : config.redisForPubsub.family,
|
||||||
|
|
|
@ -64,6 +64,7 @@ export const ACHIEVEMENT_TYPES = [
|
||||||
'iLoveMisskey',
|
'iLoveMisskey',
|
||||||
'foundTreasure',
|
'foundTreasure',
|
||||||
'client30min',
|
'client30min',
|
||||||
|
'client60min',
|
||||||
'noteDeletedWithin1min',
|
'noteDeletedWithin1min',
|
||||||
'postedAtLateNight',
|
'postedAtLateNight',
|
||||||
'postedAt0min0sec',
|
'postedAt0min0sec',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import type { Antenna } from '@/models/entities/Antenna.js';
|
import type { Antenna } from '@/models/entities/Antenna.js';
|
||||||
import type { Note } from '@/models/entities/Note.js';
|
import type { Note } from '@/models/entities/Note.js';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { promisify } from 'node:util';
|
import { promisify } from 'node:util';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import redisLock from 'redis-lock';
|
import redisLock from 'redis-lock';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import type { BlockingsRepository, ChannelFollowingsRepository, FollowingsRepository, MutingsRepository, RenoteMutingsRepository, UserProfile, UserProfilesRepository, UsersRepository } from '@/models/index.js';
|
import type { BlockingsRepository, ChannelFollowingsRepository, FollowingsRepository, MutingsRepository, RenoteMutingsRepository, UserProfile, UserProfilesRepository, UsersRepository } from '@/models/index.js';
|
||||||
import { MemoryKVCache, RedisKVCache } from '@/misc/cache.js';
|
import { MemoryKVCache, RedisKVCache } from '@/misc/cache.js';
|
||||||
import type { LocalUser, User } from '@/models/entities/User.js';
|
import type { LocalUser, User } from '@/models/entities/User.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DataSource, In, IsNull } from 'typeorm';
|
import { DataSource, In, IsNull } from 'typeorm';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
|
import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
|
||||||
|
@ -13,6 +13,7 @@ import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import { query } from '@/misc/prelude/url.js';
|
import { query } from '@/misc/prelude/url.js';
|
||||||
|
import type { Serialized } from '@/server/api/stream/types.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CustomEmojiService {
|
export class CustomEmojiService {
|
||||||
|
@ -44,7 +45,13 @@ export class CustomEmojiService {
|
||||||
memoryCacheLifetime: 1000 * 60 * 3, // 3m
|
memoryCacheLifetime: 1000 * 60 * 3, // 3m
|
||||||
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
|
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
|
||||||
toRedisConverter: (value) => JSON.stringify(Array.from(value.values())),
|
toRedisConverter: (value) => JSON.stringify(Array.from(value.values())),
|
||||||
fromRedisConverter: (value) => new Map(JSON.parse(value).map((x: Emoji) => [x.name, x])), // TODO: Date型の変換
|
fromRedisConverter: (value) => {
|
||||||
|
if (!Array.isArray(JSON.parse(value))) return undefined; // 古いバージョンの壊れたキャッシュが残っていることがある(そのうち消す)
|
||||||
|
return new Map(JSON.parse(value).map((x: Serialized<Emoji>) => [x.name, {
|
||||||
|
...x,
|
||||||
|
updatedAt: x.updatedAt ? new Date(x.updatedAt) : null,
|
||||||
|
}]));
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +198,22 @@ export class CustomEmojiService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public async setLicenseBulk(ids: Emoji['id'][], license: string | null) {
|
||||||
|
await this.emojisRepository.update({
|
||||||
|
id: In(ids),
|
||||||
|
}, {
|
||||||
|
updatedAt: new Date(),
|
||||||
|
license: license,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.localEmojisCache.refresh();
|
||||||
|
|
||||||
|
this.globalEventService.publishBroadcastStream('emojiUpdated', {
|
||||||
|
emojis: await this.emojiEntityService.packDetailedMany(ids),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async delete(id: Emoji['id']) {
|
public async delete(id: Emoji['id']) {
|
||||||
const emoji = await this.emojisRepository.findOneByOrFail({ id: id });
|
const emoji = await this.emojisRepository.findOneByOrFail({ id: id });
|
||||||
|
@ -267,16 +290,7 @@ export class CustomEmojiService {
|
||||||
const emoji = await this.cache.fetch(`${name} ${host}`, queryOrNull);
|
const emoji = await this.cache.fetch(`${name} ${host}`, queryOrNull);
|
||||||
|
|
||||||
if (emoji == null) return null;
|
if (emoji == null) return null;
|
||||||
|
return emoji.publicUrl || emoji.originalUrl; // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ)
|
||||||
const isLocal = emoji.host == null;
|
|
||||||
const emojiUrl = emoji.publicUrl || emoji.originalUrl; // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ)
|
|
||||||
const url = isLocal
|
|
||||||
? emojiUrl
|
|
||||||
: this.config.proxyRemoteFiles
|
|
||||||
? `${this.config.mediaProxy}/emoji.webp?${query({ url: emojiUrl })}`
|
|
||||||
: emojiUrl;
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,10 +86,14 @@ export class DownloadService {
|
||||||
|
|
||||||
const contentDisposition = res.headers['content-disposition'];
|
const contentDisposition = res.headers['content-disposition'];
|
||||||
if (contentDisposition != null) {
|
if (contentDisposition != null) {
|
||||||
|
try {
|
||||||
const parsed = parse(contentDisposition);
|
const parsed = parse(contentDisposition);
|
||||||
if (parsed.parameters.filename) {
|
if (parsed.parameters.filename) {
|
||||||
filename = parsed.parameters.filename;
|
filename = parsed.parameters.filename;
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.warn(`Failed to parse content-disposition: ${contentDisposition}`, { stack: e });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).on('downloadProgress', (progress: Got.Progress) => {
|
}).on('downloadProgress', (progress: Got.Progress) => {
|
||||||
if (progress.transferred > maxSize) {
|
if (progress.transferred > maxSize) {
|
||||||
|
|
|
@ -59,6 +59,8 @@ type AddFileArgs = {
|
||||||
uri?: string | null;
|
uri?: string | null;
|
||||||
/** Mark file as sensitive */
|
/** Mark file as sensitive */
|
||||||
sensitive?: boolean | null;
|
sensitive?: boolean | null;
|
||||||
|
/** Extension to force */
|
||||||
|
ext?: string | null;
|
||||||
|
|
||||||
requestIp?: string | null;
|
requestIp?: string | null;
|
||||||
requestHeaders?: Record<string, string> | null;
|
requestHeaders?: Record<string, string> | null;
|
||||||
|
@ -125,7 +127,7 @@ export class DriveService {
|
||||||
/***
|
/***
|
||||||
* Save file
|
* Save file
|
||||||
* @param path Path for original
|
* @param path Path for original
|
||||||
* @param name Name for original
|
* @param name Name for original (should be extention corrected)
|
||||||
* @param type Content-Type for original
|
* @param type Content-Type for original
|
||||||
* @param hash Hash for original
|
* @param hash Hash for original
|
||||||
* @param size Size for original
|
* @param size Size for original
|
||||||
|
@ -151,7 +153,7 @@ export class DriveService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拡張子からContent-Typeを設定してそうな挙動を示すオブジェクトストレージ (upcloud?) も存在するので、
|
// 拡張子からContent-Typeを設定してそうな挙動を示すオブジェクトストレージ (upcloud?) も存在するので、
|
||||||
// 許可されているファイル形式でしか拡張子をつけない
|
// 許可されているファイル形式でしかURLに拡張子をつけない
|
||||||
if (!FILE_TYPE_BROWSERSAFE.includes(type)) {
|
if (!FILE_TYPE_BROWSERSAFE.includes(type)) {
|
||||||
ext = '';
|
ext = '';
|
||||||
}
|
}
|
||||||
|
@ -173,7 +175,7 @@ export class DriveService {
|
||||||
//#region Uploads
|
//#region Uploads
|
||||||
this.registerLogger.info(`uploading original: ${key}`);
|
this.registerLogger.info(`uploading original: ${key}`);
|
||||||
const uploads = [
|
const uploads = [
|
||||||
this.upload(key, fs.createReadStream(path), type, ext, name),
|
this.upload(key, fs.createReadStream(path), type, null, name),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (alts.webpublic) {
|
if (alts.webpublic) {
|
||||||
|
@ -189,7 +191,7 @@ export class DriveService {
|
||||||
thumbnailUrl = `${ baseUrl }/${ thumbnailKey }`;
|
thumbnailUrl = `${ baseUrl }/${ thumbnailKey }`;
|
||||||
|
|
||||||
this.registerLogger.info(`uploading thumbnail: ${thumbnailKey}`);
|
this.registerLogger.info(`uploading thumbnail: ${thumbnailKey}`);
|
||||||
uploads.push(this.upload(thumbnailKey, alts.thumbnail.data, alts.thumbnail.type, alts.thumbnail.ext));
|
uploads.push(this.upload(thumbnailKey, alts.thumbnail.data, alts.thumbnail.type, alts.thumbnail.ext, `${name}.thumbnail`));
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(uploads);
|
await Promise.all(uploads);
|
||||||
|
@ -396,8 +398,9 @@ export class DriveService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expire oldest file (without avatar or banner) of remote user
|
||||||
@bindThis
|
@bindThis
|
||||||
private async deleteOldFile(user: RemoteUser) {
|
private async expireOldFile(user: RemoteUser, driveCapacity: number) {
|
||||||
const q = this.driveFilesRepository.createQueryBuilder('file')
|
const q = this.driveFilesRepository.createQueryBuilder('file')
|
||||||
.where('file.userId = :userId', { userId: user.id })
|
.where('file.userId = :userId', { userId: user.id })
|
||||||
.andWhere('file.isLink = FALSE');
|
.andWhere('file.isLink = FALSE');
|
||||||
|
@ -410,12 +413,17 @@ export class DriveService {
|
||||||
q.andWhere('file.id != :bannerId', { bannerId: user.bannerId });
|
q.andWhere('file.id != :bannerId', { bannerId: user.bannerId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This selete is hard coded, be careful if change database schema
|
||||||
|
q.addSelect('SUM("file"."size") OVER (ORDER BY "file"."id" DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)', 'acc_usage');
|
||||||
q.orderBy('file.id', 'ASC');
|
q.orderBy('file.id', 'ASC');
|
||||||
|
|
||||||
const oldFile = await q.getOne();
|
const fileList = await q.getRawMany();
|
||||||
|
const exceedFileIds = fileList.filter((x: any) => x.acc_usage > driveCapacity).map((x: any) => x.file_id);
|
||||||
|
|
||||||
if (oldFile) {
|
for (const fileId of exceedFileIds) {
|
||||||
this.deleteFile(oldFile, true);
|
const file = await this.driveFilesRepository.findOneBy({ id: fileId });
|
||||||
|
if (file == null) continue;
|
||||||
|
this.deleteFile(file, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +445,7 @@ export class DriveService {
|
||||||
sensitive = null,
|
sensitive = null,
|
||||||
requestIp = null,
|
requestIp = null,
|
||||||
requestHeaders = null,
|
requestHeaders = null,
|
||||||
|
ext = null,
|
||||||
}: AddFileArgs): Promise<DriveFile> {
|
}: AddFileArgs): Promise<DriveFile> {
|
||||||
let skipNsfwCheck = false;
|
let skipNsfwCheck = false;
|
||||||
const instance = await this.metaService.fetch();
|
const instance = await this.metaService.fetch();
|
||||||
|
@ -468,7 +477,7 @@ export class DriveService {
|
||||||
// DriveFile.nameは256文字, validateFileNameは200文字制限であるため、
|
// DriveFile.nameは256文字, validateFileNameは200文字制限であるため、
|
||||||
// extを付加してデータベースの文字数制限に当たることはまずない
|
// extを付加してデータベースの文字数制限に当たることはまずない
|
||||||
(name && this.driveFileEntityService.validateFileName(name)) ? name : 'untitled',
|
(name && this.driveFileEntityService.validateFileName(name)) ? name : 'untitled',
|
||||||
info.type.ext,
|
ext ?? info.type.ext,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (user && !force) {
|
if (user && !force) {
|
||||||
|
@ -489,22 +498,19 @@ export class DriveService {
|
||||||
//#region Check drive usage
|
//#region Check drive usage
|
||||||
if (user && !isLink) {
|
if (user && !isLink) {
|
||||||
const usage = await this.driveFileEntityService.calcDriveUsageOf(user);
|
const usage = await this.driveFileEntityService.calcDriveUsageOf(user);
|
||||||
|
const isLocalUser = this.userEntityService.isLocalUser(user);
|
||||||
|
|
||||||
const policies = await this.roleService.getUserPolicies(user.id);
|
const policies = await this.roleService.getUserPolicies(user.id);
|
||||||
const driveCapacity = 1024 * 1024 * policies.driveCapacityMb;
|
const driveCapacity = 1024 * 1024 * policies.driveCapacityMb;
|
||||||
this.registerLogger.debug('drive capacity override applied');
|
this.registerLogger.debug('drive capacity override applied');
|
||||||
this.registerLogger.debug(`overrideCap: ${driveCapacity}bytes, usage: ${usage}bytes, u+s: ${usage + info.size}bytes`);
|
this.registerLogger.debug(`overrideCap: ${driveCapacity}bytes, usage: ${usage}bytes, u+s: ${usage + info.size}bytes`);
|
||||||
|
|
||||||
this.registerLogger.debug(`drive usage is ${usage} (max: ${driveCapacity})`);
|
|
||||||
|
|
||||||
// If usage limit exceeded
|
// If usage limit exceeded
|
||||||
if (usage + info.size > driveCapacity) {
|
if (driveCapacity < usage + info.size) {
|
||||||
if (this.userEntityService.isLocalUser(user)) {
|
if (isLocalUser) {
|
||||||
throw new IdentifiableError('c6244ed2-a39a-4e1c-bf93-f0fbd7764fa6', 'No free space.');
|
throw new IdentifiableError('c6244ed2-a39a-4e1c-bf93-f0fbd7764fa6', 'No free space.');
|
||||||
} else {
|
|
||||||
// (アバターまたはバナーを含まず)最も古いファイルを削除する
|
|
||||||
this.deleteOldFile(await this.usersRepository.findOneByOrFail({ id: user.id }) as RemoteUser);
|
|
||||||
}
|
}
|
||||||
|
await this.expireOldFile(await this.usersRepository.findOneByOrFail({ id: user.id }) as RemoteUser, driveCapacity - info.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import type { InstancesRepository } from '@/models/index.js';
|
import type { InstancesRepository } from '@/models/index.js';
|
||||||
import type { Instance } from '@/models/entities/Instance.js';
|
import type { Instance } from '@/models/entities/Instance.js';
|
||||||
import { MemoryKVCache, RedisKVCache } from '@/misc/cache.js';
|
import { MemoryKVCache, RedisKVCache } from '@/misc/cache.js';
|
||||||
|
@ -23,8 +23,8 @@ export class FederatedInstanceService {
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
) {
|
) {
|
||||||
this.federatedInstanceCache = new RedisKVCache<Instance | null>(this.redisClient, 'federatedInstance', {
|
this.federatedInstanceCache = new RedisKVCache<Instance | null>(this.redisClient, 'federatedInstance', {
|
||||||
lifetime: 1000 * 60 * 60 * 24, // 24h
|
lifetime: 1000 * 60 * 30, // 30m
|
||||||
memoryCacheLifetime: 1000 * 60 * 30, // 30m
|
memoryCacheLifetime: 1000 * 60 * 3, // 3m
|
||||||
fetcher: (key) => this.instancesRepository.findOneBy({ host: key }),
|
fetcher: (key) => this.instancesRepository.findOneBy({ host: key }),
|
||||||
toRedisConverter: (value) => JSON.stringify(value),
|
toRedisConverter: (value) => JSON.stringify(value),
|
||||||
fromRedisConverter: (value) => {
|
fromRedisConverter: (value) => {
|
||||||
|
@ -65,15 +65,18 @@ export class FederatedInstanceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async updateCachePartial(host: string, data: Partial<Instance>): Promise<void> {
|
public async update(id: Instance['id'], data: Partial<Instance>): Promise<void> {
|
||||||
host = this.utilityService.toPuny(host);
|
const result = await this.instancesRepository.createQueryBuilder().update()
|
||||||
|
.set(data)
|
||||||
const cached = await this.federatedInstanceCache.get(host);
|
.where('id = :id', { id })
|
||||||
if (cached == null) return;
|
.returning('*')
|
||||||
|
.execute()
|
||||||
this.federatedInstanceCache.set(host, {
|
.then((response) => {
|
||||||
...cached,
|
return response.raw[0];
|
||||||
...data,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const updated = result.raw[0];
|
||||||
|
|
||||||
|
this.federatedInstanceCache.set(updated.host, updated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { DI } from '@/di-symbols.js';
|
||||||
import { LoggerService } from '@/core/LoggerService.js';
|
import { LoggerService } from '@/core/LoggerService.js';
|
||||||
import { HttpRequestService } from '@/core/HttpRequestService.js';
|
import { HttpRequestService } from '@/core/HttpRequestService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||||
import type { DOMWindow } from 'jsdom';
|
import type { DOMWindow } from 'jsdom';
|
||||||
|
|
||||||
type NodeInfo = {
|
type NodeInfo = {
|
||||||
|
@ -42,6 +43,7 @@ export class FetchInstanceMetadataService {
|
||||||
private appLockService: AppLockService,
|
private appLockService: AppLockService,
|
||||||
private httpRequestService: HttpRequestService,
|
private httpRequestService: HttpRequestService,
|
||||||
private loggerService: LoggerService,
|
private loggerService: LoggerService,
|
||||||
|
private federatedInstanceService: FederatedInstanceService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.loggerService.getLogger('metadata', 'cyan');
|
this.logger = this.loggerService.getLogger('metadata', 'cyan');
|
||||||
}
|
}
|
||||||
|
@ -96,7 +98,7 @@ export class FetchInstanceMetadataService {
|
||||||
if (favicon) updates.faviconUrl = favicon;
|
if (favicon) updates.faviconUrl = favicon;
|
||||||
if (themeColor) updates.themeColor = themeColor;
|
if (themeColor) updates.themeColor = themeColor;
|
||||||
|
|
||||||
await this.instancesRepository.update(instance.id, updates);
|
await this.federatedInstanceService.update(instance.id, updates);
|
||||||
|
|
||||||
this.logger.succ(`Successfuly updated metadata of ${instance.host}`);
|
this.logger.succ(`Successfuly updated metadata of ${instance.host}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { Note } from '@/models/entities/Note.js';
|
import type { Note } from '@/models/entities/Note.js';
|
||||||
import type { UserList } from '@/models/entities/UserList.js';
|
import type { UserList } from '@/models/entities/UserList.js';
|
||||||
|
@ -14,11 +14,13 @@ import type {
|
||||||
MainStreamTypes,
|
MainStreamTypes,
|
||||||
NoteStreamTypes,
|
NoteStreamTypes,
|
||||||
UserListStreamTypes,
|
UserListStreamTypes,
|
||||||
|
RoleTimelineStreamTypes,
|
||||||
} from '@/server/api/stream/types.js';
|
} from '@/server/api/stream/types.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.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 { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { Role } from '@/models';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GlobalEventService {
|
export class GlobalEventService {
|
||||||
|
@ -81,6 +83,11 @@ export class GlobalEventService {
|
||||||
this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value);
|
this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public publishRoleTimelineStream<K extends keyof RoleTimelineStreamTypes>(roleId: Role['id'], type: K, value?: RoleTimelineStreamTypes[K]): void {
|
||||||
|
this.publish(`roleTimelineStream:${roleId}`, type, typeof value === 'undefined' ? null : value);
|
||||||
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public publishNotesStream(note: Packed<'Note'>): void {
|
public publishNotesStream(note: Packed<'Note'>): void {
|
||||||
this.publish('notesStream', null, note);
|
this.publish('notesStream', null, note);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { Meta } from '@/models/entities/Meta.js';
|
import { Meta } from '@/models/entities/Meta.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { setImmediate } from 'node:timers/promises';
|
import { setImmediate } from 'node:timers/promises';
|
||||||
import * as mfm from 'mfm-js';
|
import * as mfm from 'mfm-js';
|
||||||
import { In, DataSource } from 'typeorm';
|
import { In, DataSource } from 'typeorm';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||||
import { extractMentions } from '@/misc/extract-mentions.js';
|
import { extractMentions } from '@/misc/extract-mentions.js';
|
||||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
||||||
|
@ -567,6 +567,8 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
|
|
||||||
this.globalEventService.publishNotesStream(noteObj);
|
this.globalEventService.publishNotesStream(noteObj);
|
||||||
|
|
||||||
|
this.roleService.addNoteToRoleTimeline(noteObj);
|
||||||
|
|
||||||
this.webhookService.getActiveWebhooks().then(webhooks => {
|
this.webhookService.getActiveWebhooks().then(webhooks => {
|
||||||
webhooks = webhooks.filter(x => x.userId === user.id && x.on.includes('note'));
|
webhooks = webhooks.filter(x => x.userId === user.id && x.on.includes('note'));
|
||||||
for (const webhook of webhooks) {
|
for (const webhook of webhooks) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { setTimeout } from 'node:timers/promises';
|
import { setTimeout } from 'node:timers/promises';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
@ -111,7 +111,7 @@ export class NotificationService implements OnApplicationShutdown {
|
||||||
// 2秒経っても(今回作成した)通知が既読にならなかったら「未読の通知がありますよ」イベントを発行する
|
// 2秒経っても(今回作成した)通知が既読にならなかったら「未読の通知がありますよ」イベントを発行する
|
||||||
setTimeout(2000, 'unread notification', { signal: this.#shutdownController.signal }).then(async () => {
|
setTimeout(2000, 'unread notification', { signal: this.#shutdownController.signal }).then(async () => {
|
||||||
const latestReadNotificationId = await this.redisClient.get(`latestReadNotification:${notifieeId}`);
|
const latestReadNotificationId = await this.redisClient.get(`latestReadNotification:${notifieeId}`);
|
||||||
if (latestReadNotificationId && (latestReadNotificationId >= await redisIdPromise)) return;
|
if (latestReadNotificationId && (latestReadNotificationId >= (await redisIdPromise)!)) return;
|
||||||
|
|
||||||
this.globalEventService.publishMainStream(notifieeId, 'unreadNotification', packed);
|
this.globalEventService.publishMainStream(notifieeId, 'unreadNotification', packed);
|
||||||
this.pushNotificationService.pushNotification(notifieeId, 'notification', packed);
|
this.pushNotificationService.pushNotification(notifieeId, 'notification', packed);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import push from 'web-push';
|
import push from 'web-push';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
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';
|
import type { Packed } from '@/misc/json-schema';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
import type { Role, RoleAssignment, RoleAssignmentsRepository, RolesRepository, UsersRepository } from '@/models/index.js';
|
import type { Role, RoleAssignment, RoleAssignmentsRepository, RolesRepository, UsersRepository } from '@/models/index.js';
|
||||||
import { MemoryKVCache, MemorySingleCache } from '@/misc/cache.js';
|
import { MemoryKVCache, MemorySingleCache } from '@/misc/cache.js';
|
||||||
|
@ -13,6 +13,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { StreamMessages } from '@/server/api/stream/types.js';
|
import { StreamMessages } from '@/server/api/stream/types.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
import type { Packed } from '@/misc/json-schema';
|
||||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||||
|
|
||||||
export type RolePolicies = {
|
export type RolePolicies = {
|
||||||
|
@ -64,6 +65,9 @@ export class RoleService implements OnApplicationShutdown {
|
||||||
public static NotAssignedError = class extends Error {};
|
public static NotAssignedError = class extends Error {};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.redis)
|
||||||
|
private redisClient: Redis.Redis,
|
||||||
|
|
||||||
@Inject(DI.redisForSub)
|
@Inject(DI.redisForSub)
|
||||||
private redisForSub: Redis.Redis,
|
private redisForSub: Redis.Redis,
|
||||||
|
|
||||||
|
@ -398,6 +402,25 @@ export class RoleService implements OnApplicationShutdown {
|
||||||
this.globalEventService.publishInternalEvent('userRoleUnassigned', existing);
|
this.globalEventService.publishInternalEvent('userRoleUnassigned', existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public async addNoteToRoleTimeline(note: Packed<'Note'>): Promise<void> {
|
||||||
|
const roles = await this.getUserRoles(note.userId);
|
||||||
|
|
||||||
|
const redisPipeline = this.redisClient.pipeline();
|
||||||
|
|
||||||
|
for (const role of roles) {
|
||||||
|
redisPipeline.xadd(
|
||||||
|
`roleTimeline:${role.id}`,
|
||||||
|
'MAXLEN', '~', '1000',
|
||||||
|
'*',
|
||||||
|
'note', note.id);
|
||||||
|
|
||||||
|
this.globalEventService.publishRoleTimelineStream(role.id, 'note', note);
|
||||||
|
}
|
||||||
|
|
||||||
|
redisPipeline.exec();
|
||||||
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public onApplicationShutdown(signal?: string | undefined) {
|
public onApplicationShutdown(signal?: string | undefined) {
|
||||||
this.redisForSub.off('message', this.onMessage);
|
this.redisForSub.off('message', this.onMessage);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
import { UserBlockingService } from '@/core/UserBlockingService.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
|
import type { Config } from '@/config.js';
|
||||||
import Logger from '../logger.js';
|
import Logger from '../logger.js';
|
||||||
|
|
||||||
const logger = new Logger('following/create');
|
const logger = new Logger('following/create');
|
||||||
|
@ -44,6 +45,9 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
constructor(
|
constructor(
|
||||||
private moduleRef: ModuleRef,
|
private moduleRef: ModuleRef,
|
||||||
|
|
||||||
|
@Inject(DI.config)
|
||||||
|
private config: Config,
|
||||||
|
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
@ -411,7 +415,7 @@ export class UserFollowingService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.userEntityService.isLocalUser(follower) && this.userEntityService.isRemoteUser(followee)) {
|
if (this.userEntityService.isLocalUser(follower) && this.userEntityService.isRemoteUser(followee)) {
|
||||||
const content = this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee));
|
const content = this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee, requestId ?? `${this.config.url}/follows/${followRequest.id}`));
|
||||||
this.queueService.deliver(follower, content, followee.inbox, false);
|
this.queueService.deliver(follower, content, followee.inbox, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import type { User } from '@/models/entities/User.js';
|
import type { User } from '@/models/entities/User.js';
|
||||||
import type { UserKeypairsRepository } from '@/models/index.js';
|
import type { UserKeypairsRepository } from '@/models/index.js';
|
||||||
import { RedisKVCache } from '@/misc/cache.js';
|
import { RedisKVCache } from '@/misc/cache.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import type { WebhooksRepository } from '@/models/index.js';
|
import type { WebhooksRepository } from '@/models/index.js';
|
||||||
import type { Webhook } from '@/models/entities/Webhook.js';
|
import type { Webhook } from '@/models/entities/Webhook.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
|
|
@ -73,7 +73,7 @@ export class ApNoteService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public validateNote(object: any, uri: string) {
|
public validateNote(object: IObject, uri: string) {
|
||||||
const expectHost = this.utilityService.extractDbHost(uri);
|
const expectHost = this.utilityService.extractDbHost(uri);
|
||||||
|
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
|
@ -88,8 +88,9 @@ export class ApNoteService {
|
||||||
return new Error(`invalid Note: id has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.id)}`);
|
return new Error(`invalid Note: id has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.id)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object.attributedTo && this.utilityService.extractDbHost(getOneApId(object.attributedTo)) !== expectHost) {
|
const actualHost = object.attributedTo && this.utilityService.extractDbHost(getOneApId(object.attributedTo));
|
||||||
return new Error(`invalid Note: attributedTo has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.attributedTo)}`);
|
if (object.attributedTo && actualHost !== expectHost) {
|
||||||
|
return new Error(`invalid Note: attributedTo has different host. expected: ${expectHost}, actual: ${actualHost}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class ChannelEntityService {
|
||||||
} : {}),
|
} : {}),
|
||||||
|
|
||||||
...(detailed ? {
|
...(detailed ? {
|
||||||
pinnedNotes: await this.noteEntityService.packMany(pinnedNotes, me),
|
pinnedNotes: (await this.noteEntityService.packMany(pinnedNotes, me)).sort((a, b) => channel.pinnedNoteIds.indexOf(a.id) - channel.pinnedNoteIds.indexOf(b.id)),
|
||||||
} : {}),
|
} : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ export class RoleEntityService {
|
||||||
isPublic: role.isPublic,
|
isPublic: role.isPublic,
|
||||||
isAdministrator: role.isAdministrator,
|
isAdministrator: role.isAdministrator,
|
||||||
isModerator: role.isModerator,
|
isModerator: role.isModerator,
|
||||||
|
isExplorable: role.isExplorable,
|
||||||
asBadge: role.asBadge,
|
asBadge: role.asBadge,
|
||||||
canEditMembersByModerator: role.canEditMembersByModerator,
|
canEditMembersByModerator: role.canEditMembersByModerator,
|
||||||
displayOrder: role.displayOrder,
|
displayOrder: role.displayOrder,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { In, Not } from 'typeorm';
|
import { In, Not } from 'typeorm';
|
||||||
import 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 { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
@ -12,7 +12,7 @@ import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||||
import type { Instance } from '@/models/entities/Instance.js';
|
import type { Instance } from '@/models/entities/Instance.js';
|
||||||
import type { LocalUser, RemoteUser, User } from '@/models/entities/User.js';
|
import type { LocalUser, RemoteUser, User } from '@/models/entities/User.js';
|
||||||
import { birthdaySchema, descriptionSchema, localUsernameSchema, locationSchema, nameSchema, passwordSchema } from '@/models/entities/User.js';
|
import { birthdaySchema, descriptionSchema, localUsernameSchema, locationSchema, nameSchema, passwordSchema } from '@/models/entities/User.js';
|
||||||
import type { UsersRepository, UserSecurityKeysRepository, FollowingsRepository, FollowRequestsRepository, BlockingsRepository, MutingsRepository, DriveFilesRepository, NoteUnreadsRepository, ChannelFollowingsRepository, UserNotePiningsRepository, UserProfilesRepository, InstancesRepository, AnnouncementReadsRepository, AnnouncementsRepository, PagesRepository, UserProfile, RenoteMutingsRepository } from '@/models/index.js';
|
import type { UsersRepository, UserSecurityKeysRepository, FollowingsRepository, FollowRequestsRepository, BlockingsRepository, MutingsRepository, DriveFilesRepository, NoteUnreadsRepository, ChannelFollowingsRepository, UserNotePiningsRepository, UserProfilesRepository, InstancesRepository, AnnouncementReadsRepository, AnnouncementsRepository, PagesRepository, UserProfile, RenoteMutingsRepository, UserMemoRepository } from '@/models/index.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';
|
||||||
|
@ -114,6 +114,9 @@ export class UserEntityService implements OnModuleInit {
|
||||||
@Inject(DI.pagesRepository)
|
@Inject(DI.pagesRepository)
|
||||||
private pagesRepository: PagesRepository,
|
private pagesRepository: PagesRepository,
|
||||||
|
|
||||||
|
@Inject(DI.userMemosRepository)
|
||||||
|
private userMemosRepository: UserMemoRepository,
|
||||||
|
|
||||||
//private noteEntityService: NoteEntityService,
|
//private noteEntityService: NoteEntityService,
|
||||||
//private driveFileEntityService: DriveFileEntityService,
|
//private driveFileEntityService: DriveFileEntityService,
|
||||||
//private pageEntityService: PageEntityService,
|
//private pageEntityService: PageEntityService,
|
||||||
|
@ -409,6 +412,10 @@ 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({
|
||||||
|
userId: meId,
|
||||||
|
targetUserId: user.id,
|
||||||
|
}).then(row => row?.memo ?? null),
|
||||||
} : {}),
|
} : {}),
|
||||||
|
|
||||||
...(opts.detail && isMe ? {
|
...(opts.detail && isMe ? {
|
||||||
|
|
|
@ -71,5 +71,6 @@ export const DI = {
|
||||||
roleAssignmentsRepository: Symbol('roleAssignmentsRepository'),
|
roleAssignmentsRepository: Symbol('roleAssignmentsRepository'),
|
||||||
flashsRepository: Symbol('flashsRepository'),
|
flashsRepository: Symbol('flashsRepository'),
|
||||||
flashLikesRepository: Symbol('flashLikesRepository'),
|
flashLikesRepository: Symbol('flashLikesRepository'),
|
||||||
|
userMemosRepository: Symbol('userMemosRepository'),
|
||||||
//#endregion
|
//#endregion
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
|
||||||
export class RedisKVCache<T> {
|
export class RedisKVCache<T> {
|
||||||
|
@ -8,7 +8,7 @@ export class RedisKVCache<T> {
|
||||||
private memoryCache: MemoryKVCache<T>;
|
private memoryCache: MemoryKVCache<T>;
|
||||||
private fetcher: (key: string) => Promise<T>;
|
private fetcher: (key: string) => Promise<T>;
|
||||||
private toRedisConverter: (value: T) => string;
|
private toRedisConverter: (value: T) => string;
|
||||||
private fromRedisConverter: (value: string) => T;
|
private fromRedisConverter: (value: string) => T | undefined;
|
||||||
|
|
||||||
constructor(redisClient: RedisKVCache<T>['redisClient'], name: RedisKVCache<T>['name'], opts: {
|
constructor(redisClient: RedisKVCache<T>['redisClient'], name: RedisKVCache<T>['name'], opts: {
|
||||||
lifetime: RedisKVCache<T>['lifetime'];
|
lifetime: RedisKVCache<T>['lifetime'];
|
||||||
|
@ -38,7 +38,7 @@ export class RedisKVCache<T> {
|
||||||
await this.redisClient.set(
|
await this.redisClient.set(
|
||||||
`kvcache:${this.name}:${key}`,
|
`kvcache:${this.name}:${key}`,
|
||||||
this.toRedisConverter(value),
|
this.toRedisConverter(value),
|
||||||
'ex', Math.round(this.lifetime / 1000),
|
'EX', Math.round(this.lifetime / 1000),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ export class RedisSingleCache<T> {
|
||||||
private memoryCache: MemorySingleCache<T>;
|
private memoryCache: MemorySingleCache<T>;
|
||||||
private fetcher: () => Promise<T>;
|
private fetcher: () => Promise<T>;
|
||||||
private toRedisConverter: (value: T) => string;
|
private toRedisConverter: (value: T) => string;
|
||||||
private fromRedisConverter: (value: string) => T;
|
private fromRedisConverter: (value: string) => T | undefined;
|
||||||
|
|
||||||
constructor(redisClient: RedisSingleCache<T>['redisClient'], name: RedisSingleCache<T>['name'], opts: {
|
constructor(redisClient: RedisSingleCache<T>['redisClient'], name: RedisSingleCache<T>['name'], opts: {
|
||||||
lifetime: RedisSingleCache<T>['lifetime'];
|
lifetime: RedisSingleCache<T>['lifetime'];
|
||||||
|
@ -122,7 +122,7 @@ export class RedisSingleCache<T> {
|
||||||
await this.redisClient.set(
|
await this.redisClient.set(
|
||||||
`singlecache:${this.name}`,
|
`singlecache:${this.name}`,
|
||||||
this.toRedisConverter(value),
|
this.toRedisConverter(value),
|
||||||
'ex', Math.round(this.lifetime / 1000),
|
'EX', Math.round(this.lifetime / 1000),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { User, Note, Announcement, AnnouncementRead, App, NoteFavorite, NoteThreadMuting, NoteReaction, NoteUnread, Poll, PollVote, UserProfile, UserKeypair, UserPending, AttestationChallenge, UserSecurityKey, UserPublickey, UserList, UserListJoining, UserNotePining, UserIp, UsedUsername, Following, FollowRequest, Instance, Emoji, Event, DriveFile, DriveFolder, Meta, Muting, RenoteMuting, Blocking, SwSubscription, Hashtag, AbuseUserReport, RegistrationTicket, AuthSession, AccessToken, Signin, Page, PageLike, GalleryPost, GalleryLike, ModerationLog, Clip, ClipNote, Antenna, PromoNote, PromoRead, Relay, MutedNote, Channel, ChannelFollowing, ChannelFavorite, RegistryItem, Webhook, Ad, PasswordResetRequest, RetentionAggregation, FlashLike, Flash, Role, RoleAssignment, ClipFavorite } from './index.js';
|
import { User, Note, Announcement, AnnouncementRead, App, NoteFavorite, NoteThreadMuting, NoteReaction, NoteUnread, Poll, PollVote, UserProfile, UserKeypair, UserPending, AttestationChallenge, UserSecurityKey, UserPublickey, UserList, UserListJoining, UserNotePining, UserIp, UsedUsername, Following, FollowRequest, Instance, Emoji, Event, DriveFile, DriveFolder, Meta, Muting, RenoteMuting, Blocking, SwSubscription, Hashtag, AbuseUserReport, RegistrationTicket, AuthSession, AccessToken, Signin, Page, PageLike, GalleryPost, GalleryLike, ModerationLog, Clip, ClipNote, Antenna, PromoNote, PromoRead, Relay, MutedNote, Channel, ChannelFollowing, ChannelFavorite, RegistryItem, Webhook, Ad, PasswordResetRequest, RetentionAggregation, FlashLike, Flash, Role, RoleAssignment, ClipFavorite, UserMemo } from './index.js';
|
||||||
import type { DataSource } from 'typeorm';
|
import type { DataSource } from 'typeorm';
|
||||||
import type { Provider } from '@nestjs/common';
|
import type { Provider } from '@nestjs/common';
|
||||||
|
|
||||||
|
@ -394,6 +394,12 @@ const $roleAssignmentsRepository: Provider = {
|
||||||
inject: [DI.db],
|
inject: [DI.db],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const $userMemosRepository: Provider = {
|
||||||
|
provide: DI.userMemosRepository,
|
||||||
|
useFactory: (db: DataSource) => db.getRepository(UserMemo),
|
||||||
|
inject: [DI.db],
|
||||||
|
};
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
],
|
],
|
||||||
|
@ -463,6 +469,7 @@ const $roleAssignmentsRepository: Provider = {
|
||||||
$roleAssignmentsRepository,
|
$roleAssignmentsRepository,
|
||||||
$flashsRepository,
|
$flashsRepository,
|
||||||
$flashLikesRepository,
|
$flashLikesRepository,
|
||||||
|
$userMemosRepository,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
$usersRepository,
|
$usersRepository,
|
||||||
|
@ -530,6 +537,7 @@ const $roleAssignmentsRepository: Provider = {
|
||||||
$roleAssignmentsRepository,
|
$roleAssignmentsRepository,
|
||||||
$flashsRepository,
|
$flashsRepository,
|
||||||
$flashLikesRepository,
|
$flashLikesRepository,
|
||||||
|
$userMemosRepository,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class RepositoryModule {}
|
export class RepositoryModule {}
|
||||||
|
|
|
@ -405,4 +405,11 @@ export class Meta {
|
||||||
default: { },
|
default: { },
|
||||||
})
|
})
|
||||||
public policies: Record<string, any>;
|
public policies: Record<string, any>;
|
||||||
|
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 280,
|
||||||
|
array: true,
|
||||||
|
default: '{}',
|
||||||
|
})
|
||||||
|
public serverRules: string[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,11 @@ export class Role {
|
||||||
})
|
})
|
||||||
public isAdministrator: boolean;
|
public isAdministrator: boolean;
|
||||||
|
|
||||||
|
@Column('boolean', {
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
public isExplorable: boolean;
|
||||||
|
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||||
|
import { id } from '../id.js';
|
||||||
|
import { User } from './User.js';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
@Index(['userId', 'targetUserId'], { unique: true })
|
||||||
|
export class UserMemo {
|
||||||
|
@PrimaryColumn(id())
|
||||||
|
public id: string;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
...id(),
|
||||||
|
comment: 'The ID of author.',
|
||||||
|
})
|
||||||
|
public userId: User['id'];
|
||||||
|
|
||||||
|
@ManyToOne(type => User, {
|
||||||
|
onDelete: 'CASCADE',
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public user: User | null;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
...id(),
|
||||||
|
comment: 'The ID of target user.',
|
||||||
|
})
|
||||||
|
public targetUserId: User['id'];
|
||||||
|
|
||||||
|
@ManyToOne(type => User, {
|
||||||
|
onDelete: 'CASCADE',
|
||||||
|
})
|
||||||
|
@JoinColumn()
|
||||||
|
public targetUser: User | null;
|
||||||
|
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 2048,
|
||||||
|
comment: 'Memo.',
|
||||||
|
})
|
||||||
|
public memo: string;
|
||||||
|
}
|
|
@ -56,6 +56,7 @@ import { UserPending } from '@/models/entities/UserPending.js';
|
||||||
import { UserProfile } from '@/models/entities/UserProfile.js';
|
import { UserProfile } from '@/models/entities/UserProfile.js';
|
||||||
import { UserPublickey } from '@/models/entities/UserPublickey.js';
|
import { UserPublickey } from '@/models/entities/UserPublickey.js';
|
||||||
import { UserSecurityKey } from '@/models/entities/UserSecurityKey.js';
|
import { UserSecurityKey } from '@/models/entities/UserSecurityKey.js';
|
||||||
|
import { UserMemo } from '@/models/entities/UserMemo.js';
|
||||||
import { Webhook } from '@/models/entities/Webhook.js';
|
import { Webhook } from '@/models/entities/Webhook.js';
|
||||||
import { Channel } from '@/models/entities/Channel.js';
|
import { Channel } from '@/models/entities/Channel.js';
|
||||||
import { RetentionAggregation } from '@/models/entities/RetentionAggregation.js';
|
import { RetentionAggregation } from '@/models/entities/RetentionAggregation.js';
|
||||||
|
@ -131,6 +132,7 @@ export {
|
||||||
RoleAssignment,
|
RoleAssignment,
|
||||||
Flash,
|
Flash,
|
||||||
FlashLike,
|
FlashLike,
|
||||||
|
UserMemo,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AbuseUserReportsRepository = Repository<AbuseUserReport>;
|
export type AbuseUserReportsRepository = Repository<AbuseUserReport>;
|
||||||
|
@ -198,3 +200,4 @@ export type RolesRepository = Repository<Role>;
|
||||||
export type RoleAssignmentsRepository = Repository<RoleAssignment>;
|
export type RoleAssignmentsRepository = Repository<RoleAssignment>;
|
||||||
export type FlashsRepository = Repository<Flash>;
|
export type FlashsRepository = Repository<Flash>;
|
||||||
export type FlashLikesRepository = Repository<FlashLike>;
|
export type FlashLikesRepository = Repository<FlashLike>;
|
||||||
|
export type UserMemoRepository = Repository<UserMemo>;
|
||||||
|
|
|
@ -250,6 +250,10 @@ export const packedUserDetailedNotMeOnlySchema = {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: true,
|
nullable: false, optional: true,
|
||||||
},
|
},
|
||||||
|
memo: {
|
||||||
|
type: 'string',
|
||||||
|
nullable: false, optional: true,
|
||||||
|
},
|
||||||
//#endregion
|
//#endregion
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
@ -71,6 +71,7 @@ import { Role } from '@/models/entities/Role.js';
|
||||||
import { RoleAssignment } from '@/models/entities/RoleAssignment.js';
|
import { RoleAssignment } from '@/models/entities/RoleAssignment.js';
|
||||||
import { Flash } from '@/models/entities/Flash.js';
|
import { Flash } from '@/models/entities/Flash.js';
|
||||||
import { FlashLike } from '@/models/entities/FlashLike.js';
|
import { FlashLike } from '@/models/entities/FlashLike.js';
|
||||||
|
import { UserMemo } from '@/models/entities/UserMemo.js';
|
||||||
|
|
||||||
import { Config } from '@/config.js';
|
import { Config } from '@/config.js';
|
||||||
import MisskeyLogger from '@/logger.js';
|
import MisskeyLogger from '@/logger.js';
|
||||||
|
@ -185,6 +186,7 @@ export const entities = [
|
||||||
RoleAssignment,
|
RoleAssignment,
|
||||||
Flash,
|
Flash,
|
||||||
FlashLike,
|
FlashLike,
|
||||||
|
UserMemo,
|
||||||
...charts,
|
...charts,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,7 @@ export class DeliverProcessorService {
|
||||||
// Update stats
|
// Update stats
|
||||||
this.federatedInstanceService.fetch(host).then(i => {
|
this.federatedInstanceService.fetch(host).then(i => {
|
||||||
if (i.isNotResponding) {
|
if (i.isNotResponding) {
|
||||||
this.instancesRepository.update(i.id, {
|
this.federatedInstanceService.update(i.id, {
|
||||||
isNotResponding: false,
|
|
||||||
});
|
|
||||||
this.federatedInstanceService.updateCachePartial(host, {
|
|
||||||
isNotResponding: false,
|
isNotResponding: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -101,10 +98,7 @@ export class DeliverProcessorService {
|
||||||
// Update stats
|
// Update stats
|
||||||
this.federatedInstanceService.fetch(host).then(i => {
|
this.federatedInstanceService.fetch(host).then(i => {
|
||||||
if (!i.isNotResponding) {
|
if (!i.isNotResponding) {
|
||||||
this.instancesRepository.update(i.id, {
|
this.federatedInstanceService.update(i.id, {
|
||||||
isNotResponding: true,
|
|
||||||
});
|
|
||||||
this.federatedInstanceService.updateCachePartial(host, {
|
|
||||||
isNotResponding: true,
|
isNotResponding: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -123,10 +117,7 @@ export class DeliverProcessorService {
|
||||||
// 相手が閉鎖していることを明示しているため、配送停止する
|
// 相手が閉鎖していることを明示しているため、配送停止する
|
||||||
if (job.data.isSharedInbox && res.statusCode === 410) {
|
if (job.data.isSharedInbox && res.statusCode === 410) {
|
||||||
this.federatedInstanceService.fetch(host).then(i => {
|
this.federatedInstanceService.fetch(host).then(i => {
|
||||||
this.instancesRepository.update(i.id, {
|
this.federatedInstanceService.update(i.id, {
|
||||||
isSuspended: true,
|
|
||||||
});
|
|
||||||
this.federatedInstanceService.updateCachePartial(host, {
|
|
||||||
isSuspended: true,
|
isSuspended: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -106,7 +106,7 @@ export class ExportBlockingProcessorService {
|
||||||
this.logger.succ(`Exported to: ${path}`);
|
this.logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'blocking-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
const fileName = 'blocking-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true });
|
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'csv' });
|
||||||
|
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -121,7 +121,7 @@ export class ExportFavoritesProcessorService {
|
||||||
this.logger.succ(`Exported to: ${path}`);
|
this.logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'favorites-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.json';
|
const fileName = 'favorites-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.json';
|
||||||
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true });
|
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'json' });
|
||||||
|
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -110,7 +110,7 @@ export class ExportFollowingProcessorService {
|
||||||
this.logger.succ(`Exported to: ${path}`);
|
this.logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'following-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
const fileName = 'following-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true });
|
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'csv' });
|
||||||
|
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -110,7 +110,7 @@ export class ExportMutingProcessorService {
|
||||||
this.logger.succ(`Exported to: ${path}`);
|
this.logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'mute-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
const fileName = 'mute-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true });
|
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'csv' });
|
||||||
|
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -117,7 +117,7 @@ export class ExportNotesProcessorService {
|
||||||
this.logger.succ(`Exported to: ${path}`);
|
this.logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'notes-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.json';
|
const fileName = 'notes-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.json';
|
||||||
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true });
|
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'json' });
|
||||||
|
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -86,7 +86,7 @@ export class ExportUserListsProcessorService {
|
||||||
this.logger.succ(`Exported to: ${path}`);
|
this.logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'user-lists-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
const fileName = 'user-lists-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true });
|
const driveFile = await this.driveService.addFile({ user, path, name: fileName, force: true, ext: 'csv' });
|
||||||
|
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -174,13 +174,10 @@ export class InboxProcessorService {
|
||||||
|
|
||||||
// Update stats
|
// Update stats
|
||||||
this.federatedInstanceService.fetch(authUser.user.host).then(i => {
|
this.federatedInstanceService.fetch(authUser.user.host).then(i => {
|
||||||
this.instancesRepository.update(i.id, {
|
this.federatedInstanceService.update(i.id, {
|
||||||
latestRequestReceivedAt: new Date(),
|
latestRequestReceivedAt: new Date(),
|
||||||
isNotResponding: false,
|
isNotResponding: false,
|
||||||
});
|
});
|
||||||
this.federatedInstanceService.updateCachePartial(host, {
|
|
||||||
isNotResponding: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.fetchInstanceMetadataService.fetchInstanceMetadata(i);
|
this.fetchInstanceMetadataService.fetchInstanceMetadata(i);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { Brackets, In, IsNull, LessThan, Not } from 'typeorm';
|
||||||
import accepts from 'accepts';
|
import accepts from 'accepts';
|
||||||
import vary from 'vary';
|
import vary from 'vary';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { FollowingsRepository, NotesRepository, EmojisRepository, NoteReactionsRepository, UserProfilesRepository, UserNotePiningsRepository, UsersRepository } from '@/models/index.js';
|
import type { FollowingsRepository, NotesRepository, EmojisRepository, NoteReactionsRepository, UserProfilesRepository, UserNotePiningsRepository, UsersRepository, FollowRequestsRepository } from '@/models/index.js';
|
||||||
import * as url from '@/misc/prelude/url.js';
|
import * as url from '@/misc/prelude/url.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||||
|
@ -54,6 +54,9 @@ export class ActivityPubServerService {
|
||||||
@Inject(DI.followingsRepository)
|
@Inject(DI.followingsRepository)
|
||||||
private followingsRepository: FollowingsRepository,
|
private followingsRepository: FollowingsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.followRequestsRepository)
|
||||||
|
private followRequestsRepository: FollowRequestsRepository,
|
||||||
|
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private apRendererService: ApRendererService,
|
private apRendererService: ApRendererService,
|
||||||
|
@ -639,6 +642,41 @@ export class ActivityPubServerService {
|
||||||
return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee)));
|
return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// follow
|
||||||
|
fastify.get<{ Params: { followRequestId: string ; } }>('/follows/:followRequestId', async (request, reply) => {
|
||||||
|
// This may be used before the follow is completed, so we do not
|
||||||
|
// check if the following exists and only check if the follow request exists.
|
||||||
|
|
||||||
|
const followRequest = await this.followRequestsRepository.findOneBy({
|
||||||
|
id: request.params.followRequestId,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (followRequest == null) {
|
||||||
|
reply.code(404);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [follower, followee] = await Promise.all([
|
||||||
|
this.usersRepository.findOneBy({
|
||||||
|
id: followRequest.followerId,
|
||||||
|
host: IsNull(),
|
||||||
|
}),
|
||||||
|
this.usersRepository.findOneBy({
|
||||||
|
id: followRequest.followeeId,
|
||||||
|
host: Not(IsNull()),
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (follower == null || followee == null) {
|
||||||
|
reply.code(404);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reply.header('Cache-Control', 'public, max-age=180');
|
||||||
|
this.setResponseType(request, reply);
|
||||||
|
return (this.apRendererService.addContext(this.apRendererService.renderFollow(follower, followee)));
|
||||||
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,8 @@ export class FileServerService {
|
||||||
} else if ('badge' in request.query) {
|
} else if ('badge' in request.query) {
|
||||||
const mask = (await sharpBmp(file.path, file.mime))
|
const mask = (await sharpBmp(file.path, file.mime))
|
||||||
.resize(96, 96, {
|
.resize(96, 96, {
|
||||||
fit: 'inside',
|
fit: 'contain',
|
||||||
|
position: 'centre',
|
||||||
withoutEnlargement: false,
|
withoutEnlargement: false,
|
||||||
})
|
})
|
||||||
.greyscale()
|
.greyscale()
|
||||||
|
|
|
@ -34,6 +34,8 @@ import { QueueStatsChannelService } from './api/stream/channels/queue-stats.js';
|
||||||
import { ServerStatsChannelService } from './api/stream/channels/server-stats.js';
|
import { ServerStatsChannelService } from './api/stream/channels/server-stats.js';
|
||||||
import { UserListChannelService } from './api/stream/channels/user-list.js';
|
import { UserListChannelService } from './api/stream/channels/user-list.js';
|
||||||
import { OpenApiServerService } from './api/openapi/OpenApiServerService.js';
|
import { OpenApiServerService } from './api/openapi/OpenApiServerService.js';
|
||||||
|
import { ClientLoggerService } from './web/ClientLoggerService.js';
|
||||||
|
import { RoleTimelineChannelService } from './api/stream/channels/role-timeline.js';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -42,6 +44,7 @@ import { OpenApiServerService } from './api/openapi/OpenApiServerService.js';
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ClientServerService,
|
ClientServerService,
|
||||||
|
ClientLoggerService,
|
||||||
FeedService,
|
FeedService,
|
||||||
UrlPreviewService,
|
UrlPreviewService,
|
||||||
ActivityPubServerService,
|
ActivityPubServerService,
|
||||||
|
@ -67,6 +70,7 @@ import { OpenApiServerService } from './api/openapi/OpenApiServerService.js';
|
||||||
DriveChannelService,
|
DriveChannelService,
|
||||||
GlobalTimelineChannelService,
|
GlobalTimelineChannelService,
|
||||||
HashtagChannelService,
|
HashtagChannelService,
|
||||||
|
RoleTimelineChannelService,
|
||||||
HomeTimelineChannelService,
|
HomeTimelineChannelService,
|
||||||
HybridTimelineChannelService,
|
HybridTimelineChannelService,
|
||||||
LocalTimelineChannelService,
|
LocalTimelineChannelService,
|
||||||
|
|
|
@ -29,6 +29,7 @@ import * as ep___admin_emoji_list from './endpoints/admin/emoji/list.js';
|
||||||
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
||||||
|
import * as ep___admin_emoji_setLicenseBulk from './endpoints/admin/emoji/set-license-bulk.js';
|
||||||
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
||||||
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
||||||
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
||||||
|
@ -295,6 +296,7 @@ import * as ep___promo_read from './endpoints/promo/read.js';
|
||||||
import * as ep___roles_list from './endpoints/roles/list.js';
|
import * as ep___roles_list from './endpoints/roles/list.js';
|
||||||
import * as ep___roles_show from './endpoints/roles/show.js';
|
import * as ep___roles_show from './endpoints/roles/show.js';
|
||||||
import * as ep___roles_users from './endpoints/roles/users.js';
|
import * as ep___roles_users from './endpoints/roles/users.js';
|
||||||
|
import * as ep___roles_notes from './endpoints/roles/notes.js';
|
||||||
import * as ep___requestResetPassword from './endpoints/request-reset-password.js';
|
import * as ep___requestResetPassword from './endpoints/request-reset-password.js';
|
||||||
import * as ep___resetDb from './endpoints/reset-db.js';
|
import * as ep___resetDb from './endpoints/reset-db.js';
|
||||||
import * as ep___resetPassword from './endpoints/reset-password.js';
|
import * as ep___resetPassword from './endpoints/reset-password.js';
|
||||||
|
@ -330,6 +332,7 @@ import * as ep___users_search from './endpoints/users/search.js';
|
||||||
import * as ep___users_show from './endpoints/users/show.js';
|
import * as ep___users_show from './endpoints/users/show.js';
|
||||||
import * as ep___users_stats from './endpoints/users/stats.js';
|
import * as ep___users_stats from './endpoints/users/stats.js';
|
||||||
import * as ep___users_achievements from './endpoints/users/achievements.js';
|
import * as ep___users_achievements from './endpoints/users/achievements.js';
|
||||||
|
import * as ep___users_updateMemo from './endpoints/users/update-memo.js';
|
||||||
import * as ep___fetchRss from './endpoints/fetch-rss.js';
|
import * as ep___fetchRss from './endpoints/fetch-rss.js';
|
||||||
import * as ep___retention from './endpoints/retention.js';
|
import * as ep___retention from './endpoints/retention.js';
|
||||||
import { GetterService } from './GetterService.js';
|
import { GetterService } from './GetterService.js';
|
||||||
|
@ -364,6 +367,7 @@ const $admin_emoji_list: Provider = { provide: 'ep:admin/emoji/list', useClass:
|
||||||
const $admin_emoji_removeAliasesBulk: Provider = { provide: 'ep:admin/emoji/remove-aliases-bulk', useClass: ep___admin_emoji_removeAliasesBulk.default };
|
const $admin_emoji_removeAliasesBulk: Provider = { provide: 'ep:admin/emoji/remove-aliases-bulk', useClass: ep___admin_emoji_removeAliasesBulk.default };
|
||||||
const $admin_emoji_setAliasesBulk: Provider = { provide: 'ep:admin/emoji/set-aliases-bulk', useClass: ep___admin_emoji_setAliasesBulk.default };
|
const $admin_emoji_setAliasesBulk: Provider = { provide: 'ep:admin/emoji/set-aliases-bulk', useClass: ep___admin_emoji_setAliasesBulk.default };
|
||||||
const $admin_emoji_setCategoryBulk: Provider = { provide: 'ep:admin/emoji/set-category-bulk', useClass: ep___admin_emoji_setCategoryBulk.default };
|
const $admin_emoji_setCategoryBulk: Provider = { provide: 'ep:admin/emoji/set-category-bulk', useClass: ep___admin_emoji_setCategoryBulk.default };
|
||||||
|
const $admin_emoji_setLicenseBulk: Provider = { provide: 'ep:admin/emoji/set-license-bulk', useClass: ep___admin_emoji_setLicenseBulk.default };
|
||||||
const $admin_emoji_update: Provider = { provide: 'ep:admin/emoji/update', useClass: ep___admin_emoji_update.default };
|
const $admin_emoji_update: Provider = { provide: 'ep:admin/emoji/update', useClass: ep___admin_emoji_update.default };
|
||||||
const $admin_federation_deleteAllFiles: Provider = { provide: 'ep:admin/federation/delete-all-files', useClass: ep___admin_federation_deleteAllFiles.default };
|
const $admin_federation_deleteAllFiles: Provider = { provide: 'ep:admin/federation/delete-all-files', useClass: ep___admin_federation_deleteAllFiles.default };
|
||||||
const $admin_federation_refreshRemoteInstanceMetadata: Provider = { provide: 'ep:admin/federation/refresh-remote-instance-metadata', useClass: ep___admin_federation_refreshRemoteInstanceMetadata.default };
|
const $admin_federation_refreshRemoteInstanceMetadata: Provider = { provide: 'ep:admin/federation/refresh-remote-instance-metadata', useClass: ep___admin_federation_refreshRemoteInstanceMetadata.default };
|
||||||
|
@ -630,6 +634,7 @@ const $promo_read: Provider = { provide: 'ep:promo/read', useClass: ep___promo_r
|
||||||
const $roles_list: Provider = { provide: 'ep:roles/list', useClass: ep___roles_list.default };
|
const $roles_list: Provider = { provide: 'ep:roles/list', useClass: ep___roles_list.default };
|
||||||
const $roles_show: Provider = { provide: 'ep:roles/show', useClass: ep___roles_show.default };
|
const $roles_show: Provider = { provide: 'ep:roles/show', useClass: ep___roles_show.default };
|
||||||
const $roles_users: Provider = { provide: 'ep:roles/users', useClass: ep___roles_users.default };
|
const $roles_users: Provider = { provide: 'ep:roles/users', useClass: ep___roles_users.default };
|
||||||
|
const $roles_notes: Provider = { provide: 'ep:roles/notes', useClass: ep___roles_notes.default };
|
||||||
const $requestResetPassword: Provider = { provide: 'ep:request-reset-password', useClass: ep___requestResetPassword.default };
|
const $requestResetPassword: Provider = { provide: 'ep:request-reset-password', useClass: ep___requestResetPassword.default };
|
||||||
const $resetDb: Provider = { provide: 'ep:reset-db', useClass: ep___resetDb.default };
|
const $resetDb: Provider = { provide: 'ep:reset-db', useClass: ep___resetDb.default };
|
||||||
const $resetPassword: Provider = { provide: 'ep:reset-password', useClass: ep___resetPassword.default };
|
const $resetPassword: Provider = { provide: 'ep:reset-password', useClass: ep___resetPassword.default };
|
||||||
|
@ -665,6 +670,7 @@ const $users_search: Provider = { provide: 'ep:users/search', useClass: ep___use
|
||||||
const $users_show: Provider = { provide: 'ep:users/show', useClass: ep___users_show.default };
|
const $users_show: Provider = { provide: 'ep:users/show', useClass: ep___users_show.default };
|
||||||
const $users_stats: Provider = { provide: 'ep:users/stats', useClass: ep___users_stats.default };
|
const $users_stats: Provider = { provide: 'ep:users/stats', useClass: ep___users_stats.default };
|
||||||
const $users_achievements: Provider = { provide: 'ep:users/achievements', useClass: ep___users_achievements.default };
|
const $users_achievements: Provider = { provide: 'ep:users/achievements', useClass: ep___users_achievements.default };
|
||||||
|
const $users_updateMemo: Provider = { provide: 'ep:users/update-memo', useClass: ep___users_updateMemo.default };
|
||||||
const $fetchRss: Provider = { provide: 'ep:fetch-rss', useClass: ep___fetchRss.default };
|
const $fetchRss: Provider = { provide: 'ep:fetch-rss', useClass: ep___fetchRss.default };
|
||||||
const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention.default };
|
const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention.default };
|
||||||
|
|
||||||
|
@ -703,6 +709,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$admin_emoji_removeAliasesBulk,
|
$admin_emoji_removeAliasesBulk,
|
||||||
$admin_emoji_setAliasesBulk,
|
$admin_emoji_setAliasesBulk,
|
||||||
$admin_emoji_setCategoryBulk,
|
$admin_emoji_setCategoryBulk,
|
||||||
|
$admin_emoji_setLicenseBulk,
|
||||||
$admin_emoji_update,
|
$admin_emoji_update,
|
||||||
$admin_federation_deleteAllFiles,
|
$admin_federation_deleteAllFiles,
|
||||||
$admin_federation_refreshRemoteInstanceMetadata,
|
$admin_federation_refreshRemoteInstanceMetadata,
|
||||||
|
@ -969,6 +976,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$roles_list,
|
$roles_list,
|
||||||
$roles_show,
|
$roles_show,
|
||||||
$roles_users,
|
$roles_users,
|
||||||
|
$roles_notes,
|
||||||
$requestResetPassword,
|
$requestResetPassword,
|
||||||
$resetDb,
|
$resetDb,
|
||||||
$resetPassword,
|
$resetPassword,
|
||||||
|
@ -1004,6 +1012,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$users_show,
|
$users_show,
|
||||||
$users_stats,
|
$users_stats,
|
||||||
$users_achievements,
|
$users_achievements,
|
||||||
|
$users_updateMemo,
|
||||||
$fetchRss,
|
$fetchRss,
|
||||||
$retention,
|
$retention,
|
||||||
],
|
],
|
||||||
|
@ -1036,6 +1045,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$admin_emoji_removeAliasesBulk,
|
$admin_emoji_removeAliasesBulk,
|
||||||
$admin_emoji_setAliasesBulk,
|
$admin_emoji_setAliasesBulk,
|
||||||
$admin_emoji_setCategoryBulk,
|
$admin_emoji_setCategoryBulk,
|
||||||
|
$admin_emoji_setLicenseBulk,
|
||||||
$admin_emoji_update,
|
$admin_emoji_update,
|
||||||
$admin_federation_deleteAllFiles,
|
$admin_federation_deleteAllFiles,
|
||||||
$admin_federation_refreshRemoteInstanceMetadata,
|
$admin_federation_refreshRemoteInstanceMetadata,
|
||||||
|
@ -1302,6 +1312,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$roles_list,
|
$roles_list,
|
||||||
$roles_show,
|
$roles_show,
|
||||||
$roles_users,
|
$roles_users,
|
||||||
|
$roles_notes,
|
||||||
$requestResetPassword,
|
$requestResetPassword,
|
||||||
$resetDb,
|
$resetDb,
|
||||||
$resetPassword,
|
$resetPassword,
|
||||||
|
@ -1335,6 +1346,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$users_show,
|
$users_show,
|
||||||
$users_stats,
|
$users_stats,
|
||||||
$users_achievements,
|
$users_achievements,
|
||||||
|
$users_updateMemo,
|
||||||
$fetchRss,
|
$fetchRss,
|
||||||
$retention,
|
$retention,
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Limiter from 'ratelimiter';
|
import Limiter from 'ratelimiter';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type Logger from '@/logger.js';
|
import type Logger from '@/logger.js';
|
||||||
import { LoggerService } from '@/core/LoggerService.js';
|
import { LoggerService } from '@/core/LoggerService.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import * as websocket from 'websocket';
|
import * as websocket from 'websocket';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { UsersRepository, BlockingsRepository, ChannelFollowingsRepository, FollowingsRepository, MutingsRepository, UserProfilesRepository, RenoteMutingsRepository } from '@/models/index.js';
|
import type { UsersRepository, BlockingsRepository, ChannelFollowingsRepository, FollowingsRepository, MutingsRepository, UserProfilesRepository, RenoteMutingsRepository } from '@/models/index.js';
|
||||||
|
|
|
@ -29,6 +29,7 @@ import * as ep___admin_emoji_list from './endpoints/admin/emoji/list.js';
|
||||||
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
||||||
|
import * as ep___admin_emoji_setLicenseBulk from './endpoints/admin/emoji/set-license-bulk.js';
|
||||||
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
||||||
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
||||||
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
||||||
|
@ -295,6 +296,7 @@ import * as ep___promo_read from './endpoints/promo/read.js';
|
||||||
import * as ep___roles_list from './endpoints/roles/list.js';
|
import * as ep___roles_list from './endpoints/roles/list.js';
|
||||||
import * as ep___roles_show from './endpoints/roles/show.js';
|
import * as ep___roles_show from './endpoints/roles/show.js';
|
||||||
import * as ep___roles_users from './endpoints/roles/users.js';
|
import * as ep___roles_users from './endpoints/roles/users.js';
|
||||||
|
import * as ep___roles_notes from './endpoints/roles/notes.js';
|
||||||
import * as ep___requestResetPassword from './endpoints/request-reset-password.js';
|
import * as ep___requestResetPassword from './endpoints/request-reset-password.js';
|
||||||
import * as ep___resetDb from './endpoints/reset-db.js';
|
import * as ep___resetDb from './endpoints/reset-db.js';
|
||||||
import * as ep___resetPassword from './endpoints/reset-password.js';
|
import * as ep___resetPassword from './endpoints/reset-password.js';
|
||||||
|
@ -330,6 +332,7 @@ import * as ep___users_search from './endpoints/users/search.js';
|
||||||
import * as ep___users_show from './endpoints/users/show.js';
|
import * as ep___users_show from './endpoints/users/show.js';
|
||||||
import * as ep___users_stats from './endpoints/users/stats.js';
|
import * as ep___users_stats from './endpoints/users/stats.js';
|
||||||
import * as ep___users_achievements from './endpoints/users/achievements.js';
|
import * as ep___users_achievements from './endpoints/users/achievements.js';
|
||||||
|
import * as ep___users_updateMemo from './endpoints/users/update-memo.js';
|
||||||
import * as ep___fetchRss from './endpoints/fetch-rss.js';
|
import * as ep___fetchRss from './endpoints/fetch-rss.js';
|
||||||
import * as ep___retention from './endpoints/retention.js';
|
import * as ep___retention from './endpoints/retention.js';
|
||||||
|
|
||||||
|
@ -362,6 +365,7 @@ const eps = [
|
||||||
['admin/emoji/remove-aliases-bulk', ep___admin_emoji_removeAliasesBulk],
|
['admin/emoji/remove-aliases-bulk', ep___admin_emoji_removeAliasesBulk],
|
||||||
['admin/emoji/set-aliases-bulk', ep___admin_emoji_setAliasesBulk],
|
['admin/emoji/set-aliases-bulk', ep___admin_emoji_setAliasesBulk],
|
||||||
['admin/emoji/set-category-bulk', ep___admin_emoji_setCategoryBulk],
|
['admin/emoji/set-category-bulk', ep___admin_emoji_setCategoryBulk],
|
||||||
|
['admin/emoji/set-license-bulk', ep___admin_emoji_setLicenseBulk],
|
||||||
['admin/emoji/update', ep___admin_emoji_update],
|
['admin/emoji/update', ep___admin_emoji_update],
|
||||||
['admin/federation/delete-all-files', ep___admin_federation_deleteAllFiles],
|
['admin/federation/delete-all-files', ep___admin_federation_deleteAllFiles],
|
||||||
['admin/federation/refresh-remote-instance-metadata', ep___admin_federation_refreshRemoteInstanceMetadata],
|
['admin/federation/refresh-remote-instance-metadata', ep___admin_federation_refreshRemoteInstanceMetadata],
|
||||||
|
@ -628,6 +632,7 @@ const eps = [
|
||||||
['roles/list', ep___roles_list],
|
['roles/list', ep___roles_list],
|
||||||
['roles/show', ep___roles_show],
|
['roles/show', ep___roles_show],
|
||||||
['roles/users', ep___roles_users],
|
['roles/users', ep___roles_users],
|
||||||
|
['roles/notes', ep___roles_notes],
|
||||||
['request-reset-password', ep___requestResetPassword],
|
['request-reset-password', ep___requestResetPassword],
|
||||||
['reset-db', ep___resetDb],
|
['reset-db', ep___resetDb],
|
||||||
['reset-password', ep___resetPassword],
|
['reset-password', ep___resetPassword],
|
||||||
|
@ -663,6 +668,7 @@ const eps = [
|
||||||
['users/show', ep___users_show],
|
['users/show', ep___users_show],
|
||||||
['users/stats', ep___users_stats],
|
['users/stats', ep___users_stats],
|
||||||
['users/achievements', ep___users_achievements],
|
['users/achievements', ep___users_achievements],
|
||||||
|
['users/update-memo', ep___users_updateMemo],
|
||||||
['fetch-rss', ep___fetchRss],
|
['fetch-rss', ep___fetchRss],
|
||||||
['retention', ep___retention],
|
['retention', ep___retention],
|
||||||
];
|
];
|
||||||
|
|
|
@ -87,12 +87,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
//const emojis = await q.take(ps.limit).getMany();
|
//const emojis = await q.take(ps.limit).getMany();
|
||||||
|
|
||||||
emojis = await q.getMany();
|
emojis = await q.getMany();
|
||||||
|
const queryarry = ps.query.match(/\:([a-z0-9_]*)\:/g);
|
||||||
|
|
||||||
|
if (queryarry) {
|
||||||
|
emojis = emojis.filter(emoji =>
|
||||||
|
queryarry.includes(`:${emoji.name}:`)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
emojis = emojis.filter(emoji =>
|
emojis = emojis.filter(emoji =>
|
||||||
emoji.name.includes(ps.query!) ||
|
emoji.name.includes(ps.query!) ||
|
||||||
emoji.aliases.some(a => a.includes(ps.query!)) ||
|
emoji.aliases.some(a => a.includes(ps.query!)) ||
|
||||||
emoji.category?.includes(ps.query!));
|
emoji.category?.includes(ps.query!));
|
||||||
|
}
|
||||||
emojis.splice(ps.limit + 1);
|
emojis.splice(ps.limit + 1);
|
||||||
} else {
|
} else {
|
||||||
emojis = await q.take(ps.limit).getMany();
|
emojis = await q.take(ps.limit).getMany();
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['admin'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
requireRolePolicy: 'canManageCustomEmojis',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
ids: { type: 'array', items: {
|
||||||
|
type: 'string', format: 'misskey:id',
|
||||||
|
} },
|
||||||
|
license: {
|
||||||
|
type: 'string',
|
||||||
|
nullable: true,
|
||||||
|
description: 'Use `null` to reset the license.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['ids'],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
@Injectable()
|
||||||
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
constructor(
|
||||||
|
private customEmojiService: CustomEmojiService,
|
||||||
|
) {
|
||||||
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
await this.customEmojiService.setLicenseBulk(ps.ids, ps.license ?? null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { InstancesRepository } from '@/models/index.js';
|
import type { InstancesRepository } from '@/models/index.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
@ -28,6 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
private instancesRepository: InstancesRepository,
|
private instancesRepository: InstancesRepository,
|
||||||
|
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
|
private federatedInstanceService: FederatedInstanceService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const instance = await this.instancesRepository.findOneBy({ host: this.utilityService.toPuny(ps.host) });
|
const instance = await this.instancesRepository.findOneBy({ host: this.utilityService.toPuny(ps.host) });
|
||||||
|
@ -36,7 +38,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
throw new Error('instance not found');
|
throw new Error('instance not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.instancesRepository.update({ host: this.utilityService.toPuny(ps.host) }, {
|
this.federatedInstanceService.update(instance.id, {
|
||||||
isSuspended: ps.isSuspended,
|
isSuspended: ps.isSuspended,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,6 +25,7 @@ export const paramDef = {
|
||||||
isPublic: { type: 'boolean' },
|
isPublic: { type: 'boolean' },
|
||||||
isModerator: { type: 'boolean' },
|
isModerator: { type: 'boolean' },
|
||||||
isAdministrator: { type: 'boolean' },
|
isAdministrator: { type: 'boolean' },
|
||||||
|
isExplorable: { type: 'boolean', default: false }, // optional for backward compatibility
|
||||||
asBadge: { type: 'boolean' },
|
asBadge: { type: 'boolean' },
|
||||||
canEditMembersByModerator: { type: 'boolean' },
|
canEditMembersByModerator: { type: 'boolean' },
|
||||||
displayOrder: { type: 'number' },
|
displayOrder: { type: 'number' },
|
||||||
|
@ -76,6 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
isPublic: ps.isPublic,
|
isPublic: ps.isPublic,
|
||||||
isAdministrator: ps.isAdministrator,
|
isAdministrator: ps.isAdministrator,
|
||||||
isModerator: ps.isModerator,
|
isModerator: ps.isModerator,
|
||||||
|
isExplorable: ps.isExplorable,
|
||||||
asBadge: ps.asBadge,
|
asBadge: ps.asBadge,
|
||||||
canEditMembersByModerator: ps.canEditMembersByModerator,
|
canEditMembersByModerator: ps.canEditMembersByModerator,
|
||||||
displayOrder: ps.displayOrder,
|
displayOrder: ps.displayOrder,
|
||||||
|
|
|
@ -33,6 +33,7 @@ export const paramDef = {
|
||||||
isPublic: { type: 'boolean' },
|
isPublic: { type: 'boolean' },
|
||||||
isModerator: { type: 'boolean' },
|
isModerator: { type: 'boolean' },
|
||||||
isAdministrator: { type: 'boolean' },
|
isAdministrator: { type: 'boolean' },
|
||||||
|
isExplorable: { type: 'boolean' },
|
||||||
asBadge: { type: 'boolean' },
|
asBadge: { type: 'boolean' },
|
||||||
canEditMembersByModerator: { type: 'boolean' },
|
canEditMembersByModerator: { type: 'boolean' },
|
||||||
displayOrder: { type: 'number' },
|
displayOrder: { type: 'number' },
|
||||||
|
@ -85,6 +86,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
isPublic: ps.isPublic,
|
isPublic: ps.isPublic,
|
||||||
isModerator: ps.isModerator,
|
isModerator: ps.isModerator,
|
||||||
isAdministrator: ps.isAdministrator,
|
isAdministrator: ps.isAdministrator,
|
||||||
|
isExplorable: ps.isExplorable,
|
||||||
asBadge: ps.asBadge,
|
asBadge: ps.asBadge,
|
||||||
canEditMembersByModerator: ps.canEditMembersByModerator,
|
canEditMembersByModerator: ps.canEditMembersByModerator,
|
||||||
displayOrder: ps.displayOrder,
|
displayOrder: ps.displayOrder,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as os from 'node:os';
|
||||||
import si from 'systeminformation';
|
import si from 'systeminformation';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ export const paramDef = {
|
||||||
enableActiveEmailValidation: { type: 'boolean' },
|
enableActiveEmailValidation: { type: 'boolean' },
|
||||||
enableChartsForRemoteUser: { type: 'boolean' },
|
enableChartsForRemoteUser: { type: 'boolean' },
|
||||||
enableChartsForFederatedInstances: { type: 'boolean' },
|
enableChartsForFederatedInstances: { type: 'boolean' },
|
||||||
|
serverRules: { type: 'array', items: { type: 'string' } },
|
||||||
},
|
},
|
||||||
required: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -387,6 +388,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
set.enableChartsForFederatedInstances = ps.enableChartsForFederatedInstances;
|
set.enableChartsForFederatedInstances = ps.enableChartsForFederatedInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.serverRules !== undefined) {
|
||||||
|
set.serverRules = ps.serverRules;
|
||||||
|
}
|
||||||
|
|
||||||
await this.metaService.update(set);
|
await this.metaService.update(set);
|
||||||
this.moderationLogService.insertModerationLog(me, 'updateMeta');
|
this.moderationLogService.insertModerationLog(me, 'updateMeta');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { NotesRepository, AntennasRepository } from '@/models/index.js';
|
import type { NotesRepository, AntennasRepository } from '@/models/index.js';
|
||||||
import { QueryService } from '@/core/QueryService.js';
|
import { QueryService } from '@/core/QueryService.js';
|
||||||
|
@ -76,17 +76,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
throw new ApiError(meta.errors.noSuchAntenna);
|
throw new ApiError(meta.errors.noSuchAntenna);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const limit = ps.limit + (ps.untilId ? 1 : 0) + (ps.sinceId ? 1 : 0); // untilIdに指定したものも含まれるため+1
|
||||||
const noteIdsRes = await this.redisClient.xrevrange(
|
const noteIdsRes = await this.redisClient.xrevrange(
|
||||||
`antennaTimeline:${antenna.id}`,
|
`antennaTimeline:${antenna.id}`,
|
||||||
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : '+',
|
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : ps.untilDate ?? '+',
|
||||||
'-',
|
ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime() : ps.sinceDate ?? '-',
|
||||||
'COUNT', ps.limit + 1); // untilIdに指定したものも含まれるため+1
|
'COUNT', limit);
|
||||||
|
|
||||||
if (noteIdsRes.length === 0) {
|
if (noteIdsRes.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const noteIds = noteIdsRes.map(x => x[1][1]).filter(x => x !== ps.untilId);
|
const noteIds = noteIdsRes.map(x => x[1][1]).filter(x => x !== ps.untilId && x !== ps.sinceId);
|
||||||
|
|
||||||
if (noteIds.length === 0) {
|
if (noteIds.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { ChannelsRepository, Note, NotesRepository } from '@/models/index.js';
|
import type { ChannelsRepository, Note, NotesRepository } from '@/models/index.js';
|
||||||
import { QueryService } from '@/core/QueryService.js';
|
import { QueryService } from '@/core/QueryService.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Brackets, In } from 'typeorm';
|
import { Brackets, In } from 'typeorm';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { UsersRepository, FollowingsRepository, MutingsRepository, UserProfilesRepository, NotesRepository } from '@/models/index.js';
|
import type { UsersRepository, FollowingsRepository, MutingsRepository, UserProfilesRepository, NotesRepository } from '@/models/index.js';
|
||||||
import { obsoleteNotificationTypes, notificationTypes } from '@/types.js';
|
import { obsoleteNotificationTypes, notificationTypes } from '@/types.js';
|
||||||
|
@ -91,11 +91,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
const includeTypes = ps.includeTypes && ps.includeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
|
const includeTypes = ps.includeTypes && ps.includeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
|
||||||
const excludeTypes = ps.excludeTypes && ps.excludeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
|
const excludeTypes = ps.excludeTypes && ps.excludeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
|
||||||
|
|
||||||
|
const limit = ps.limit + (ps.untilId ? 1 : 0); // untilIdに指定したものも含まれるため+1
|
||||||
const notificationsRes = await this.redisClient.xrevrange(
|
const notificationsRes = await this.redisClient.xrevrange(
|
||||||
`notificationTimeline:${me.id}`,
|
`notificationTimeline:${me.id}`,
|
||||||
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : '+',
|
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : '+',
|
||||||
'-',
|
'-',
|
||||||
'COUNT', ps.limit + 1); // untilIdに指定したものも含まれるため+1
|
'COUNT', limit);
|
||||||
|
|
||||||
if (notificationsRes.length === 0) {
|
if (notificationsRes.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -221,6 +221,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
updates.avatarId = avatar.id;
|
updates.avatarId = avatar.id;
|
||||||
updates.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar');
|
updates.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar');
|
||||||
updates.avatarBlurhash = avatar.blurhash;
|
updates.avatarBlurhash = avatar.blurhash;
|
||||||
|
} else if (ps.avatarId === null) {
|
||||||
|
updates.avatarId = null;
|
||||||
|
updates.avatarUrl = null;
|
||||||
|
updates.avatarBlurhash = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.bannerId) {
|
if (ps.bannerId) {
|
||||||
|
@ -232,6 +236,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
updates.bannerId = banner.id;
|
updates.bannerId = banner.id;
|
||||||
updates.bannerUrl = this.driveFileEntityService.getPublicUrl(banner);
|
updates.bannerUrl = this.driveFileEntityService.getPublicUrl(banner);
|
||||||
updates.bannerBlurhash = banner.blurhash;
|
updates.bannerBlurhash = banner.blurhash;
|
||||||
|
} else if (ps.bannerId === null) {
|
||||||
|
updates.bannerId = null;
|
||||||
|
updates.bannerUrl = null;
|
||||||
|
updates.bannerBlurhash = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.pinnedPageId) {
|
if (ps.pinnedPageId) {
|
||||||
|
|
|
@ -310,6 +310,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
|
||||||
translatorAvailable: instance.deeplAuthKey != null,
|
translatorAvailable: instance.deeplAuthKey != null,
|
||||||
|
|
||||||
|
serverRules: instance.serverRules,
|
||||||
|
|
||||||
policies: { ...DEFAULT_POLICIES, ...instance.policies },
|
policies: { ...DEFAULT_POLICIES, ...instance.policies },
|
||||||
|
|
||||||
mediaProxy: this.config.mediaProxy,
|
mediaProxy: this.config.mediaProxy,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { resetDb } from '@/misc/reset-db.js';
|
import { resetDb } from '@/misc/reset-db.js';
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import * as Redis from 'ioredis';
|
||||||
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
|
import type { NotesRepository, RolesRepository } from '@/models/index.js';
|
||||||
|
import { QueryService } from '@/core/QueryService.js';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
|
import { IdService } from '@/core/IdService.js';
|
||||||
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['role', 'notes'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
noSuchRole: {
|
||||||
|
message: 'No such role.',
|
||||||
|
code: 'NO_SUCH_ROLE',
|
||||||
|
id: 'eb70323a-df61-4dd4-ad90-89c83c7cf26e',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
res: {
|
||||||
|
type: 'array',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
ref: 'Note',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
roleId: { type: 'string', format: 'misskey:id' },
|
||||||
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
|
sinceId: { type: 'string', format: 'misskey:id' },
|
||||||
|
untilId: { type: 'string', format: 'misskey:id' },
|
||||||
|
sinceDate: { type: 'integer' },
|
||||||
|
untilDate: { type: 'integer' },
|
||||||
|
},
|
||||||
|
required: ['roleId'],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
@Injectable()
|
||||||
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
constructor(
|
||||||
|
@Inject(DI.redis)
|
||||||
|
private redisClient: Redis.Redis,
|
||||||
|
|
||||||
|
@Inject(DI.notesRepository)
|
||||||
|
private notesRepository: NotesRepository,
|
||||||
|
|
||||||
|
@Inject(DI.rolesRepository)
|
||||||
|
private rolesRepository: RolesRepository,
|
||||||
|
|
||||||
|
private idService: IdService,
|
||||||
|
private noteEntityService: NoteEntityService,
|
||||||
|
private queryService: QueryService,
|
||||||
|
) {
|
||||||
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
const role = await this.rolesRepository.findOneBy({
|
||||||
|
id: ps.roleId,
|
||||||
|
isPublic: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (role == null) {
|
||||||
|
throw new ApiError(meta.errors.noSuchRole);
|
||||||
|
}
|
||||||
|
if (!role.isExplorable) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const limit = ps.limit + (ps.untilId ? 1 : 0) + (ps.sinceId ? 1 : 0); // untilIdに指定したものも含まれるため+1
|
||||||
|
const noteIdsRes = await this.redisClient.xrevrange(
|
||||||
|
`roleTimeline:${role.id}`,
|
||||||
|
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : ps.untilDate ?? '+',
|
||||||
|
ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime() : ps.sinceDate ?? '-',
|
||||||
|
'COUNT', limit);
|
||||||
|
|
||||||
|
if (noteIdsRes.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const noteIds = noteIdsRes.map(x => x[1][1]).filter(x => x !== ps.untilId && x !== ps.sinceId);
|
||||||
|
|
||||||
|
if (noteIds.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = this.notesRepository.createQueryBuilder('note')
|
||||||
|
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
|
||||||
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
|
.leftJoinAndSelect('note.reply', 'reply')
|
||||||
|
.leftJoinAndSelect('note.renote', 'renote')
|
||||||
|
.leftJoinAndSelect('reply.user', 'replyUser')
|
||||||
|
.leftJoinAndSelect('renote.user', 'renoteUser');
|
||||||
|
|
||||||
|
this.queryService.generateVisibilityQuery(query, me);
|
||||||
|
this.queryService.generateMutedUserQuery(query, me);
|
||||||
|
this.queryService.generateBlockedUserQuery(query, me);
|
||||||
|
|
||||||
|
const notes = await query.getMany();
|
||||||
|
notes.sort((a, b) => a.id > b.id ? -1 : 1);
|
||||||
|
|
||||||
|
return await this.noteEntityService.packMany(notes, me);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,8 +41,6 @@ export const paramDef = {
|
||||||
],
|
],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// TODO: avatar,bannerをJOINしたいけどエラーになる
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
|
import { IdService } from '@/core/IdService.js';
|
||||||
|
import type { UserMemoRepository } from '@/models/index.js';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { GetterService } from '@/server/api/GetterService.js';
|
||||||
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['account'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'write:account',
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
noSuchUser: {
|
||||||
|
message: 'No such user.',
|
||||||
|
code: 'NO_SUCH_USER',
|
||||||
|
id: '6fef56f3-e765-4957-88e5-c6f65329b8a5',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
userId: { type: 'string', format: 'misskey:id' },
|
||||||
|
memo: {
|
||||||
|
type: 'string',
|
||||||
|
nullable: true,
|
||||||
|
description: 'A personal memo for the target user. If null or empty, delete the memo.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['userId', 'memo'],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
@Injectable()
|
||||||
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
constructor(
|
||||||
|
@Inject(DI.userMemosRepository)
|
||||||
|
private userMemosRepository: UserMemoRepository,
|
||||||
|
private getterService: GetterService,
|
||||||
|
private idService: IdService,
|
||||||
|
) {
|
||||||
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
// Get target
|
||||||
|
const target = await this.getterService.getUser(ps.userId).catch(err => {
|
||||||
|
if (err.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 引数がnullか空文字であれば、パーソナルメモを削除する
|
||||||
|
if (ps.memo === '' || ps.memo == null) {
|
||||||
|
await this.userMemosRepository.delete({
|
||||||
|
userId: me.id,
|
||||||
|
targetUserId: target.id,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 以前に作成されたパーソナルメモがあるかどうか確認
|
||||||
|
const previousMemo = await this.userMemosRepository.findOneBy({
|
||||||
|
userId: me.id,
|
||||||
|
targetUserId: target.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!previousMemo) {
|
||||||
|
await this.userMemosRepository.insert({
|
||||||
|
id: this.idService.genId(),
|
||||||
|
userId: me.id,
|
||||||
|
targetUserId: target.id,
|
||||||
|
memo: ps.memo,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await this.userMemosRepository.update(previousMemo.id, {
|
||||||
|
userId: me.id,
|
||||||
|
targetUserId: target.id,
|
||||||
|
memo: ps.memo,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ import { UserListChannelService } from './channels/user-list.js';
|
||||||
import { AntennaChannelService } from './channels/antenna.js';
|
import { AntennaChannelService } from './channels/antenna.js';
|
||||||
import { DriveChannelService } from './channels/drive.js';
|
import { DriveChannelService } from './channels/drive.js';
|
||||||
import { HashtagChannelService } from './channels/hashtag.js';
|
import { HashtagChannelService } from './channels/hashtag.js';
|
||||||
|
import { RoleTimelineChannelService } from './channels/role-timeline.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ChannelsService {
|
export class ChannelsService {
|
||||||
|
@ -24,6 +25,7 @@ export class ChannelsService {
|
||||||
private globalTimelineChannelService: GlobalTimelineChannelService,
|
private globalTimelineChannelService: GlobalTimelineChannelService,
|
||||||
private userListChannelService: UserListChannelService,
|
private userListChannelService: UserListChannelService,
|
||||||
private hashtagChannelService: HashtagChannelService,
|
private hashtagChannelService: HashtagChannelService,
|
||||||
|
private roleTimelineChannelService: RoleTimelineChannelService,
|
||||||
private antennaChannelService: AntennaChannelService,
|
private antennaChannelService: AntennaChannelService,
|
||||||
private channelChannelService: ChannelChannelService,
|
private channelChannelService: ChannelChannelService,
|
||||||
private driveChannelService: DriveChannelService,
|
private driveChannelService: DriveChannelService,
|
||||||
|
@ -43,6 +45,7 @@ export class ChannelsService {
|
||||||
case 'globalTimeline': return this.globalTimelineChannelService;
|
case 'globalTimeline': return this.globalTimelineChannelService;
|
||||||
case 'userList': return this.userListChannelService;
|
case 'userList': return this.userListChannelService;
|
||||||
case 'hashtag': return this.hashtagChannelService;
|
case 'hashtag': return this.hashtagChannelService;
|
||||||
|
case 'roleTimeline': return this.roleTimelineChannelService;
|
||||||
case 'antenna': return this.antennaChannelService;
|
case 'antenna': return this.antennaChannelService;
|
||||||
case 'channel': return this.channelChannelService;
|
case 'channel': return this.channelChannelService;
|
||||||
case 'drive': return this.driveChannelService;
|
case 'drive': return this.driveChannelService;
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import Channel from '../channel.js';
|
||||||
|
import { StreamMessages } from '../types.js';
|
||||||
|
|
||||||
|
class RoleTimelineChannel extends Channel {
|
||||||
|
public readonly chName = 'roleTimeline';
|
||||||
|
public static shouldShare = false;
|
||||||
|
public static requireCredential = false;
|
||||||
|
private roleId: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private noteEntityService: NoteEntityService,
|
||||||
|
|
||||||
|
id: string,
|
||||||
|
connection: Channel['connection'],
|
||||||
|
) {
|
||||||
|
super(id, connection);
|
||||||
|
//this.onNote = this.onNote.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public async init(params: any) {
|
||||||
|
this.roleId = params.roleId as string;
|
||||||
|
|
||||||
|
this.subscriber.on(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
private async onEvent(data: StreamMessages['roleTimeline']['payload']) {
|
||||||
|
if (data.type === 'note') {
|
||||||
|
const note = data.body;
|
||||||
|
|
||||||
|
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||||
|
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
|
||||||
|
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||||
|
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
|
||||||
|
|
||||||
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
|
this.send('note', note);
|
||||||
|
} else {
|
||||||
|
this.send(data.type, data.body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public dispose() {
|
||||||
|
// Unsubscribe events
|
||||||
|
this.subscriber.off(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class RoleTimelineChannelService {
|
||||||
|
public readonly shouldShare = RoleTimelineChannel.shouldShare;
|
||||||
|
public readonly requireCredential = RoleTimelineChannel.requireCredential;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private noteEntityService: NoteEntityService,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public create(id: string, connection: Channel['connection']): RoleTimelineChannel {
|
||||||
|
return new RoleTimelineChannel(
|
||||||
|
this.noteEntityService,
|
||||||
|
id,
|
||||||
|
connection,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -148,6 +148,10 @@ export interface AntennaStreamTypes {
|
||||||
note: Note;
|
note: Note;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RoleTimelineStreamTypes {
|
||||||
|
note: Packed<'Note'>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AdminStreamTypes {
|
export interface AdminStreamTypes {
|
||||||
newAbuseUserReport: {
|
newAbuseUserReport: {
|
||||||
id: AbuseUserReport['id'];
|
id: AbuseUserReport['id'];
|
||||||
|
@ -168,7 +172,7 @@ type EventUnionFromDictionary<
|
||||||
> = U[keyof U];
|
> = U[keyof U];
|
||||||
|
|
||||||
// redis通すとDateのインスタンスはstringに変換されるので
|
// redis通すとDateのインスタンスはstringに変換されるので
|
||||||
type Serialized<T> = {
|
export type Serialized<T> = {
|
||||||
[K in keyof T]:
|
[K in keyof T]:
|
||||||
T[K] extends Date
|
T[K] extends Date
|
||||||
? string
|
? string
|
||||||
|
@ -209,6 +213,10 @@ export type StreamMessages = {
|
||||||
name: `userListStream:${UserList['id']}`;
|
name: `userListStream:${UserList['id']}`;
|
||||||
payload: EventUnionFromDictionary<SerializedAll<UserListStreamTypes>>;
|
payload: EventUnionFromDictionary<SerializedAll<UserListStreamTypes>>;
|
||||||
};
|
};
|
||||||
|
roleTimeline: {
|
||||||
|
name: `roleTimelineStream:${Role['id']}`;
|
||||||
|
payload: EventUnionFromDictionary<SerializedAll<RoleTimelineStreamTypes>>;
|
||||||
|
};
|
||||||
antenna: {
|
antenna: {
|
||||||
name: `antennaStream:${Antenna['id']}`;
|
name: `antennaStream:${Antenna['id']}`;
|
||||||
payload: EventUnionFromDictionary<SerializedAll<AntennaStreamTypes>>;
|
payload: EventUnionFromDictionary<SerializedAll<AntennaStreamTypes>>;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import type Logger from '@/logger.js';
|
||||||
|
import { LoggerService } from '@/core/LoggerService.js';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ClientLoggerService {
|
||||||
|
public logger: Logger;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private loggerService: LoggerService,
|
||||||
|
) {
|
||||||
|
this.logger = this.loggerService.getLogger('client');
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import { dirname } from 'node:path';
|
import { dirname } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import { v4 as uuid } from 'uuid';
|
||||||
import { createBullBoard } from '@bull-board/api';
|
import { createBullBoard } from '@bull-board/api';
|
||||||
import { BullAdapter } from '@bull-board/api/bullAdapter.js';
|
import { BullAdapter } from '@bull-board/api/bullAdapter.js';
|
||||||
import { FastifyAdapter } from '@bull-board/fastify';
|
import { FastifyAdapter } from '@bull-board/fastify';
|
||||||
|
@ -26,6 +27,7 @@ import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityServi
|
||||||
import { ClipEntityService } from '@/core/entities/ClipEntityService.js';
|
import { ClipEntityService } from '@/core/entities/ClipEntityService.js';
|
||||||
import { ChannelEntityService } from '@/core/entities/ChannelEntityService.js';
|
import { ChannelEntityService } from '@/core/entities/ChannelEntityService.js';
|
||||||
import type { ChannelsRepository, ClipsRepository, FlashsRepository, GalleryPostsRepository, NotesRepository, PagesRepository, UserProfilesRepository, UsersRepository } from '@/models/index.js';
|
import type { ChannelsRepository, ClipsRepository, FlashsRepository, GalleryPostsRepository, NotesRepository, PagesRepository, UserProfilesRepository, UsersRepository } from '@/models/index.js';
|
||||||
|
import type Logger from '@/logger.js';
|
||||||
import { deepClone } from '@/misc/clone.js';
|
import { deepClone } from '@/misc/clone.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { FlashEntityService } from '@/core/entities/FlashEntityService.js';
|
import { FlashEntityService } from '@/core/entities/FlashEntityService.js';
|
||||||
|
@ -34,6 +36,7 @@ import manifest from './manifest.json' assert { type: 'json' };
|
||||||
import { FeedService } from './FeedService.js';
|
import { FeedService } from './FeedService.js';
|
||||||
import { UrlPreviewService } from './UrlPreviewService.js';
|
import { UrlPreviewService } from './UrlPreviewService.js';
|
||||||
import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
|
import type { FastifyInstance, FastifyPluginOptions, FastifyReply } from 'fastify';
|
||||||
|
import { ClientLoggerService } from './ClientLoggerService.js';
|
||||||
|
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
const _dirname = dirname(_filename);
|
const _dirname = dirname(_filename);
|
||||||
|
@ -46,6 +49,8 @@ const viteOut = `${_dirname}/../../../../../built/_vite_/`;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ClientServerService {
|
export class ClientServerService {
|
||||||
|
private logger: Logger;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.config)
|
@Inject(DI.config)
|
||||||
private config: Config,
|
private config: Config,
|
||||||
|
@ -85,6 +90,7 @@ export class ClientServerService {
|
||||||
private urlPreviewService: UrlPreviewService,
|
private urlPreviewService: UrlPreviewService,
|
||||||
private feedService: FeedService,
|
private feedService: FeedService,
|
||||||
private roleService: RoleService,
|
private roleService: RoleService,
|
||||||
|
private clientLoggerService: ClientLoggerService,
|
||||||
|
|
||||||
@Inject('queue:system') public systemQueue: SystemQueue,
|
@Inject('queue:system') public systemQueue: SystemQueue,
|
||||||
@Inject('queue:endedPollNotification') public endedPollNotificationQueue: EndedPollNotificationQueue,
|
@Inject('queue:endedPollNotification') public endedPollNotificationQueue: EndedPollNotificationQueue,
|
||||||
|
@ -649,6 +655,24 @@ export class ClientServerService {
|
||||||
return await renderBase(reply);
|
return await renderBase(reply);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fastify.setErrorHandler(async (error, request, reply) => {
|
||||||
|
const errId = uuid();
|
||||||
|
this.clientLoggerService.logger.error(`Internal error occured in ${request.routerPath}: ${error.message}`, {
|
||||||
|
path: request.routerPath,
|
||||||
|
params: request.params,
|
||||||
|
query: request.query,
|
||||||
|
code: error.name,
|
||||||
|
stack: error.stack,
|
||||||
|
id: errId,
|
||||||
|
});
|
||||||
|
reply.code(500);
|
||||||
|
reply.header('Cache-Control', 'max-age=10, must-revalidate');
|
||||||
|
return await reply.view('error', {
|
||||||
|
code: error.code,
|
||||||
|
id: errId,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
* {
|
||||||
|
font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#misskey_app,
|
||||||
|
#splash {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body,
|
||||||
|
html {
|
||||||
|
background-color: #222;
|
||||||
|
color: #dfddcc;
|
||||||
|
justify-content: center;
|
||||||
|
margin: auto;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0px 12px 0px 12px;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-big {
|
||||||
|
background: linear-gradient(90deg, rgb(134, 179, 0), rgb(74, 179, 0));
|
||||||
|
line-height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-big:hover {
|
||||||
|
background: rgb(153, 204, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-small {
|
||||||
|
background: #444;
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-small:hover {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-label-big {
|
||||||
|
color: #222;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 20px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-label-small {
|
||||||
|
color: rgb(153, 204, 0);
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: rgb(134, 179, 0);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
li {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dont-worry,
|
||||||
|
#msg {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-warning {
|
||||||
|
color: #dec340;
|
||||||
|
height: 4rem;
|
||||||
|
padding-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
display: block;
|
||||||
|
font-family: Fira, FiraCode, monospace;
|
||||||
|
background: #333;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
max-width: 40rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
justify-content: center;
|
||||||
|
margin: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary > * {
|
||||||
|
display: inline;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 500px) {
|
||||||
|
details {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
doctype html
|
||||||
|
|
||||||
|
//
|
||||||
|
-
|
||||||
|
_____ _ _
|
||||||
|
| |_|___ ___| |_ ___ _ _
|
||||||
|
| | | | |_ -|_ -| '_| -_| | |
|
||||||
|
|_|_|_|_|___|___|_,_|___|_ |
|
||||||
|
|___|
|
||||||
|
Thank you for using Misskey!
|
||||||
|
If you are reading this message... how about joining the development?
|
||||||
|
https://github.com/misskey-dev/misskey
|
||||||
|
|
||||||
|
|
||||||
|
html
|
||||||
|
|
||||||
|
head
|
||||||
|
meta(charset='utf-8')
|
||||||
|
meta(name='viewport' content='width=device-width, initial-scale=1')
|
||||||
|
meta(name='application-name' content='Misskey')
|
||||||
|
meta(name='referrer' content='origin')
|
||||||
|
|
||||||
|
title
|
||||||
|
block title
|
||||||
|
= 'An error has occurred... | Misskey'
|
||||||
|
|
||||||
|
style
|
||||||
|
include ../error.css
|
||||||
|
|
||||||
|
body
|
||||||
|
svg.icon-warning(xmlns="http://www.w3.org/2000/svg", viewBox="0 0 24 24", stroke-width="2", stroke="currentColor", fill="none", stroke-linecap="round", stroke-linejoin="round")
|
||||||
|
path(stroke="none", d="M0 0h24v24H0z", fill="none")
|
||||||
|
path(d="M12 9v2m0 4v.01")
|
||||||
|
path(d="M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75")
|
||||||
|
|
||||||
|
h1 An error has occurred!
|
||||||
|
|
||||||
|
button.button-big(onclick="location.reload();")
|
||||||
|
span.button-label-big Refresh
|
||||||
|
|
||||||
|
p.dont-worry Don't worry, it's (probably) not your fault.
|
||||||
|
|
||||||
|
p If reloading after a period of time does not resolve the problem, contact the server administrator with the following ERROR ID.
|
||||||
|
|
||||||
|
div#errors
|
||||||
|
code.
|
||||||
|
ERROR CODE: #{code}
|
||||||
|
ERROR ID: #{id}
|
||||||
|
|
||||||
|
p You may also try the following options:
|
||||||
|
|
||||||
|
p Update your os and browser.
|
||||||
|
p Disable an adblocker.
|
||||||
|
|
||||||
|
a(href="/flush")
|
||||||
|
button.button-small
|
||||||
|
span.button-label-small Clear preferences and cache
|
||||||
|
br
|
||||||
|
a(href="/cli")
|
||||||
|
button.button-small
|
||||||
|
span.button-label-small Start the simple client
|
||||||
|
br
|
||||||
|
a(href="/bios")
|
||||||
|
button.button-small
|
||||||
|
span.button-label-small Start the repair tool
|
|
@ -849,4 +849,85 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.body.error.code, 'URL_PREVIEW_FAILED');
|
assert.strictEqual(res.body.error.code, 'URL_PREVIEW_FAILED');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('パーソナルメモ機能のテスト', () => {
|
||||||
|
test('他者に関するメモを更新できる', async () => {
|
||||||
|
const memo = '10月まで低浮上とのこと。';
|
||||||
|
|
||||||
|
const res1 = await api('/users/update-memo', {
|
||||||
|
memo,
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
const res2 = await api('/users/show', {
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice);
|
||||||
|
assert.strictEqual(res1.status, 204);
|
||||||
|
assert.strictEqual(res2.body?.memo, memo);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('自分に関するメモを更新できる', async () => {
|
||||||
|
const memo = 'チケットを月末までに買う。';
|
||||||
|
|
||||||
|
const res1 = await api('/users/update-memo', {
|
||||||
|
memo,
|
||||||
|
userId: alice.id,
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
const res2 = await api('/users/show', {
|
||||||
|
userId: alice.id,
|
||||||
|
}, alice);
|
||||||
|
assert.strictEqual(res1.status, 204);
|
||||||
|
assert.strictEqual(res2.body?.memo, memo);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('メモを削除できる', async () => {
|
||||||
|
const memo = '10月まで低浮上とのこと。';
|
||||||
|
|
||||||
|
await api('/users/update-memo', {
|
||||||
|
memo,
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
await api('/users/update-memo', {
|
||||||
|
memo: '',
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
const res = await api('/users/show', {
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
// memoには常に文字列かnullが入っている(5cac151)
|
||||||
|
assert.strictEqual(res.body.memo, null);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('メモは個人ごとに独立して保存される', async () => {
|
||||||
|
const memoAliceToBob = '10月まで低浮上とのこと。';
|
||||||
|
const memoCarolToBob = '例の件について今度問いただす。';
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
api('/users/update-memo', {
|
||||||
|
memo: memoAliceToBob,
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice),
|
||||||
|
api('/users/update-memo', {
|
||||||
|
memo: memoCarolToBob,
|
||||||
|
userId: bob.id,
|
||||||
|
}, carol),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const [resAlice, resCarol] = await Promise.all([
|
||||||
|
api('/users/show', {
|
||||||
|
userId: bob.id,
|
||||||
|
}, alice),
|
||||||
|
api('/users/show', {
|
||||||
|
userId: bob.id,
|
||||||
|
}, carol),
|
||||||
|
]);
|
||||||
|
|
||||||
|
assert.strictEqual(resAlice.body.memo, memoAliceToBob);
|
||||||
|
assert.strictEqual(resCarol.body.memo, memoCarolToBob);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,887 @@
|
||||||
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
|
import * as assert from 'assert';
|
||||||
|
import { inspect } from 'node:util';
|
||||||
|
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
||||||
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
|
import {
|
||||||
|
signup,
|
||||||
|
post,
|
||||||
|
page,
|
||||||
|
role,
|
||||||
|
startServer,
|
||||||
|
api,
|
||||||
|
successfulApiCall,
|
||||||
|
failedApiCall,
|
||||||
|
uploadFile,
|
||||||
|
} from '../utils.js';
|
||||||
|
import type * as misskey from 'misskey-js';
|
||||||
|
import type { INestApplicationContext } from '@nestjs/common';
|
||||||
|
|
||||||
|
describe('ユーザー', () => {
|
||||||
|
// エンティティとしてのユーザーを主眼においたテストを記述する
|
||||||
|
// (Userを返すエンドポイントとUserエンティティを書き換えるエンドポイントをテストする)
|
||||||
|
|
||||||
|
const stripUndefined = <T extends { [key: string]: any }, >(orig: T): Partial<T> => {
|
||||||
|
return Object.entries({ ...orig })
|
||||||
|
.filter(([, value]) => value !== undefined)
|
||||||
|
.reduce((obj: Partial<T>, [key, value]) => {
|
||||||
|
obj[key as keyof T] = value;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
// BUG misskey-jsとjson-schemaと実際に返ってくるデータが全部違う
|
||||||
|
type UserLite = misskey.entities.UserLite & {
|
||||||
|
badgeRoles: any[],
|
||||||
|
};
|
||||||
|
|
||||||
|
type UserDetailedNotMe = UserLite &
|
||||||
|
misskey.entities.UserDetailed & {
|
||||||
|
roles: any[],
|
||||||
|
};
|
||||||
|
|
||||||
|
type MeDetailed = UserDetailedNotMe &
|
||||||
|
misskey.entities.MeDetailed & {
|
||||||
|
showTimelineReplies: boolean,
|
||||||
|
achievements: object[],
|
||||||
|
loggedInDays: number,
|
||||||
|
policies: object,
|
||||||
|
};
|
||||||
|
|
||||||
|
type User = MeDetailed & { token: string };
|
||||||
|
|
||||||
|
const show = async (id: string, me = alice): Promise<MeDetailed | UserDetailedNotMe> => {
|
||||||
|
return successfulApiCall({ endpoint: 'users/show', parameters: { userId: id }, user: me }) as any;
|
||||||
|
};
|
||||||
|
|
||||||
|
// UserLiteのキーが過不足なく入っている?
|
||||||
|
const userLite = (user: User): Partial<UserLite> => {
|
||||||
|
return stripUndefined({
|
||||||
|
id: user.id,
|
||||||
|
name: user.name,
|
||||||
|
username: user.username,
|
||||||
|
host: user.host,
|
||||||
|
avatarUrl: user.avatarUrl,
|
||||||
|
avatarBlurhash: user.avatarBlurhash,
|
||||||
|
isBot: user.isBot,
|
||||||
|
isCat: user.isCat,
|
||||||
|
instance: user.instance,
|
||||||
|
emojis: user.emojis,
|
||||||
|
onlineStatus: user.onlineStatus,
|
||||||
|
badgeRoles: user.badgeRoles,
|
||||||
|
|
||||||
|
// BUG isAdmin/isModeratorはUserLiteではなくMeDetailedOnlyに含まれる。
|
||||||
|
isAdmin: undefined,
|
||||||
|
isModerator: undefined,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// UserDetailedNotMeのキーが過不足なく入っている?
|
||||||
|
const userDetailedNotMe = (user: User): Partial<UserDetailedNotMe> => {
|
||||||
|
return stripUndefined({
|
||||||
|
...userLite(user),
|
||||||
|
url: user.url,
|
||||||
|
uri: user.uri,
|
||||||
|
movedToUri: user.movedToUri,
|
||||||
|
alsoKnownAs: user.alsoKnownAs,
|
||||||
|
createdAt: user.createdAt,
|
||||||
|
updatedAt: user.updatedAt,
|
||||||
|
lastFetchedAt: user.lastFetchedAt,
|
||||||
|
bannerUrl: user.bannerUrl,
|
||||||
|
bannerBlurhash: user.bannerBlurhash,
|
||||||
|
isLocked: user.isLocked,
|
||||||
|
isSilenced: user.isSilenced,
|
||||||
|
isSuspended: user.isSuspended,
|
||||||
|
description: user.description,
|
||||||
|
location: user.location,
|
||||||
|
birthday: user.birthday,
|
||||||
|
lang: user.lang,
|
||||||
|
fields: user.fields,
|
||||||
|
followersCount: user.followersCount,
|
||||||
|
followingCount: user.followingCount,
|
||||||
|
notesCount: user.notesCount,
|
||||||
|
pinnedNoteIds: user.pinnedNoteIds,
|
||||||
|
pinnedNotes: user.pinnedNotes,
|
||||||
|
pinnedPageId: user.pinnedPageId,
|
||||||
|
pinnedPage: user.pinnedPage,
|
||||||
|
publicReactions: user.publicReactions,
|
||||||
|
ffVisibility: user.ffVisibility,
|
||||||
|
twoFactorEnabled: user.twoFactorEnabled,
|
||||||
|
usePasswordLessLogin: user.usePasswordLessLogin,
|
||||||
|
securityKeys: user.securityKeys,
|
||||||
|
roles: user.roles,
|
||||||
|
memo: user.memo,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Relations関連のキーが過不足なく入っている?
|
||||||
|
const userDetailedNotMeWithRelations = (user: User): Partial<UserDetailedNotMe> => {
|
||||||
|
return stripUndefined({
|
||||||
|
...userDetailedNotMe(user),
|
||||||
|
isFollowing: user.isFollowing ?? false,
|
||||||
|
isFollowed: user.isFollowed ?? false,
|
||||||
|
hasPendingFollowRequestFromYou: user.hasPendingFollowRequestFromYou ?? false,
|
||||||
|
hasPendingFollowRequestToYou: user.hasPendingFollowRequestToYou ?? false,
|
||||||
|
isBlocking: user.isBlocking ?? false,
|
||||||
|
isBlocked: user.isBlocked ?? false,
|
||||||
|
isMuted: user.isMuted ?? false,
|
||||||
|
isRenoteMuted: user.isRenoteMuted ?? false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// MeDetailedのキーが過不足なく入っている?
|
||||||
|
const meDetailed = (user: User, security = false): Partial<MeDetailed> => {
|
||||||
|
return stripUndefined({
|
||||||
|
...userDetailedNotMe(user),
|
||||||
|
avatarId: user.avatarId,
|
||||||
|
bannerId: user.bannerId,
|
||||||
|
isModerator: user.isModerator,
|
||||||
|
isAdmin: user.isAdmin,
|
||||||
|
injectFeaturedNote: user.injectFeaturedNote,
|
||||||
|
receiveAnnouncementEmail: user.receiveAnnouncementEmail,
|
||||||
|
alwaysMarkNsfw: user.alwaysMarkNsfw,
|
||||||
|
autoSensitive: user.autoSensitive,
|
||||||
|
carefulBot: user.carefulBot,
|
||||||
|
autoAcceptFollowed: user.autoAcceptFollowed,
|
||||||
|
noCrawle: user.noCrawle,
|
||||||
|
isExplorable: user.isExplorable,
|
||||||
|
isDeleted: user.isDeleted,
|
||||||
|
hideOnlineStatus: user.hideOnlineStatus,
|
||||||
|
hasUnreadSpecifiedNotes: user.hasUnreadSpecifiedNotes,
|
||||||
|
hasUnreadMentions: user.hasUnreadMentions,
|
||||||
|
hasUnreadAnnouncement: user.hasUnreadAnnouncement,
|
||||||
|
hasUnreadAntenna: user.hasUnreadAntenna,
|
||||||
|
hasUnreadChannel: user.hasUnreadChannel,
|
||||||
|
hasUnreadNotification: user.hasUnreadNotification,
|
||||||
|
hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest,
|
||||||
|
mutedWords: user.mutedWords,
|
||||||
|
mutedInstances: user.mutedInstances,
|
||||||
|
mutingNotificationTypes: user.mutingNotificationTypes,
|
||||||
|
emailNotificationTypes: user.emailNotificationTypes,
|
||||||
|
showTimelineReplies: user.showTimelineReplies,
|
||||||
|
achievements: user.achievements,
|
||||||
|
loggedInDays: user.loggedInDays,
|
||||||
|
policies: user.policies,
|
||||||
|
...(security ? {
|
||||||
|
email: user.email,
|
||||||
|
emailVerified: user.emailVerified,
|
||||||
|
securityKeysList: user.securityKeysList,
|
||||||
|
} : {}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let app: INestApplicationContext;
|
||||||
|
|
||||||
|
let root: User;
|
||||||
|
let alice: User;
|
||||||
|
let aliceNote: misskey.entities.Note;
|
||||||
|
let alicePage: misskey.entities.Page;
|
||||||
|
let aliceList: misskey.entities.UserList;
|
||||||
|
|
||||||
|
let bob: User;
|
||||||
|
let bobNote: misskey.entities.Note;
|
||||||
|
|
||||||
|
let carol: User;
|
||||||
|
let dave: User;
|
||||||
|
let ellen: User;
|
||||||
|
let frank: User;
|
||||||
|
|
||||||
|
let usersReplying: User[];
|
||||||
|
|
||||||
|
let userNoNote: User;
|
||||||
|
let userNotExplorable: User;
|
||||||
|
let userLocking: User;
|
||||||
|
let userAdmin: User;
|
||||||
|
let roleAdmin: any;
|
||||||
|
let userModerator: User;
|
||||||
|
let roleModerator: any;
|
||||||
|
let userRolePublic: User;
|
||||||
|
let rolePublic: any;
|
||||||
|
let userRoleBadge: User;
|
||||||
|
let roleBadge: any;
|
||||||
|
let userSilenced: User;
|
||||||
|
let roleSilenced: any;
|
||||||
|
let userSuspended: User;
|
||||||
|
let userDeletedBySelf: User;
|
||||||
|
let userDeletedByAdmin: User;
|
||||||
|
let userFollowingAlice: User;
|
||||||
|
let userFollowedByAlice: User;
|
||||||
|
let userBlockingAlice: User;
|
||||||
|
let userBlockedByAlice: User;
|
||||||
|
let userMutingAlice: User;
|
||||||
|
let userMutedByAlice: User;
|
||||||
|
let userRnMutingAlice: User;
|
||||||
|
let userRnMutedByAlice: User;
|
||||||
|
let userFollowRequesting: User;
|
||||||
|
let userFollowRequested: User;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
app = await startServer();
|
||||||
|
}, 1000 * 60 * 2);
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
root = await signup({ username: 'alice' });
|
||||||
|
alice = root;
|
||||||
|
aliceNote = await post(alice, { text: 'test' }) as any;
|
||||||
|
alicePage = await page(alice);
|
||||||
|
aliceList = (await api('users/list/create', { name: 'aliceList' }, alice)).body;
|
||||||
|
bob = await signup({ username: 'bob' });
|
||||||
|
bobNote = await post(bob, { text: 'test' }) as any;
|
||||||
|
carol = await signup({ username: 'carol' });
|
||||||
|
dave = await signup({ username: 'dave' });
|
||||||
|
ellen = await signup({ username: 'ellen' });
|
||||||
|
frank = await signup({ username: 'frank' });
|
||||||
|
|
||||||
|
// @alice -> @replyingへのリプライ。Promise.allで一気に作るとtimeoutしてしまうのでreduceで一つ一つawaitする
|
||||||
|
usersReplying = await [...Array(10)].map((_, i) => i).reduce(async (acc, i) => {
|
||||||
|
const u = await signup({ username: `replying${i}` });
|
||||||
|
for (let j = 0; j < 10 - i; j++) {
|
||||||
|
const p = await post(u, { text: `test${j}` });
|
||||||
|
await post(alice, { text: `@${u.username} test${j}`, replyId: p.id });
|
||||||
|
}
|
||||||
|
|
||||||
|
return (await acc).concat(u);
|
||||||
|
}, Promise.resolve([] as User[]));
|
||||||
|
|
||||||
|
userNoNote = await signup({ username: 'userNoNote' });
|
||||||
|
userNotExplorable = await signup({ username: 'userNotExplorable' });
|
||||||
|
await post(userNotExplorable, { text: 'test' });
|
||||||
|
await api('i/update', { isExplorable: false }, userNotExplorable);
|
||||||
|
userLocking = await signup({ username: 'userLocking' });
|
||||||
|
await post(userLocking, { text: 'test' });
|
||||||
|
await api('i/update', { isLocked: true }, userLocking);
|
||||||
|
userAdmin = await signup({ username: 'userAdmin' });
|
||||||
|
roleAdmin = await role(root, { isAdministrator: true, name: 'Admin Role' });
|
||||||
|
await api('admin/roles/assign', { userId: userAdmin.id, roleId: roleAdmin.id }, root);
|
||||||
|
userModerator = await signup({ username: 'userModerator' });
|
||||||
|
roleModerator = await role(root, { isModerator: true, name: 'Moderator Role' });
|
||||||
|
await api('admin/roles/assign', { userId: userModerator.id, roleId: roleModerator.id }, root);
|
||||||
|
userRolePublic = await signup({ username: 'userRolePublic' });
|
||||||
|
rolePublic = await role(root, { isPublic: true, name: 'Public Role' });
|
||||||
|
await api('admin/roles/assign', { userId: userRolePublic.id, roleId: rolePublic.id }, root);
|
||||||
|
userRoleBadge = await signup({ username: 'userRoleBadge' });
|
||||||
|
roleBadge = await role(root, { asBadge: true, name: 'Badge Role' });
|
||||||
|
await api('admin/roles/assign', { userId: userRoleBadge.id, roleId: roleBadge.id }, root);
|
||||||
|
userSilenced = await signup({ username: 'userSilenced' });
|
||||||
|
await post(userSilenced, { text: 'test' });
|
||||||
|
roleSilenced = await role(root, {}, { canPublicNote: { priority: 0, useDefault: false, value: false } });
|
||||||
|
await api('admin/roles/assign', { userId: userSilenced.id, roleId: roleSilenced.id }, root);
|
||||||
|
userSuspended = await signup({ username: 'userSuspended' });
|
||||||
|
await post(userSuspended, { text: 'test' });
|
||||||
|
await successfulApiCall({ endpoint: 'i/update', parameters: { description: '#user_testuserSuspended' }, user: userSuspended });
|
||||||
|
await api('admin/suspend-user', { userId: userSuspended.id }, root);
|
||||||
|
userDeletedBySelf = await signup({ username: 'userDeletedBySelf', password: 'userDeletedBySelf' });
|
||||||
|
await post(userDeletedBySelf, { text: 'test' });
|
||||||
|
await api('i/delete-account', { password: 'userDeletedBySelf' }, userDeletedBySelf);
|
||||||
|
userDeletedByAdmin = await signup({ username: 'userDeletedByAdmin' });
|
||||||
|
await post(userDeletedByAdmin, { text: 'test' });
|
||||||
|
await api('admin/delete-account', { userId: userDeletedByAdmin.id }, root);
|
||||||
|
userFollowingAlice = await signup({ username: 'userFollowingAlice' });
|
||||||
|
await post(userFollowingAlice, { text: 'test' });
|
||||||
|
await api('following/create', { userId: alice.id }, userFollowingAlice);
|
||||||
|
userFollowedByAlice = await signup({ username: 'userFollowedByAlice' });
|
||||||
|
await post(userFollowedByAlice, { text: 'test' });
|
||||||
|
await api('following/create', { userId: userFollowedByAlice.id }, alice);
|
||||||
|
userBlockingAlice = await signup({ username: 'userBlockingAlice' });
|
||||||
|
await post(userBlockingAlice, { text: 'test' });
|
||||||
|
await api('blocking/create', { userId: alice.id }, userBlockingAlice);
|
||||||
|
userBlockedByAlice = await signup({ username: 'userBlockedByAlice' });
|
||||||
|
await post(userBlockedByAlice, { text: 'test' });
|
||||||
|
await api('blocking/create', { userId: userBlockedByAlice.id }, alice);
|
||||||
|
userMutingAlice = await signup({ username: 'userMutingAlice' });
|
||||||
|
await post(userMutingAlice, { text: 'test' });
|
||||||
|
await api('mute/create', { userId: alice.id }, userMutingAlice);
|
||||||
|
userMutedByAlice = await signup({ username: 'userMutedByAlice' });
|
||||||
|
await post(userMutedByAlice, { text: 'test' });
|
||||||
|
await api('mute/create', { userId: userMutedByAlice.id }, alice);
|
||||||
|
userRnMutingAlice = await signup({ username: 'userRnMutingAlice' });
|
||||||
|
await post(userRnMutingAlice, { text: 'test' });
|
||||||
|
await api('renote-mute/create', { userId: alice.id }, userRnMutingAlice);
|
||||||
|
userRnMutedByAlice = await signup({ username: 'userRnMutedByAlice' });
|
||||||
|
await post(userRnMutedByAlice, { text: 'test' });
|
||||||
|
await api('renote-mute/create', { userId: userRnMutedByAlice.id }, alice);
|
||||||
|
userFollowRequesting = await signup({ username: 'userFollowRequesting' });
|
||||||
|
await post(userFollowRequesting, { text: 'test' });
|
||||||
|
userFollowRequested = userLocking;
|
||||||
|
await api('following/create', { userId: userFollowRequested.id }, userFollowRequesting);
|
||||||
|
}, 1000 * 60 * 10);
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await app.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
alice = {
|
||||||
|
...alice,
|
||||||
|
...await successfulApiCall({ endpoint: 'i', parameters: {}, user: alice }) as any,
|
||||||
|
};
|
||||||
|
aliceNote = await successfulApiCall({ endpoint: 'notes/show', parameters: { noteId: aliceNote.id }, user: alice });
|
||||||
|
});
|
||||||
|
|
||||||
|
//#region サインアップ(signup)
|
||||||
|
|
||||||
|
test('が作れる。(作りたての状態で自分のユーザー情報が取れる)', async () => {
|
||||||
|
// SignupApiService.ts
|
||||||
|
const response = await successfulApiCall({
|
||||||
|
endpoint: 'signup',
|
||||||
|
parameters: { username: 'zoe', password: 'password' },
|
||||||
|
user: undefined,
|
||||||
|
}) as unknown as User; // BUG MeDetailedに足りないキーがある
|
||||||
|
|
||||||
|
// signupの時はtokenが含まれる特別なMeDetailedが返ってくる
|
||||||
|
assert.match(response.token, /[a-zA-Z0-9]{16}/);
|
||||||
|
|
||||||
|
// UserLite
|
||||||
|
assert.match(response.id, /[0-9a-z]{10}/);
|
||||||
|
assert.strictEqual(response.name, null);
|
||||||
|
assert.strictEqual(response.username, 'zoe');
|
||||||
|
assert.strictEqual(response.host, null);
|
||||||
|
assert.match(response.avatarUrl, /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/);
|
||||||
|
assert.strictEqual(response.avatarBlurhash, null);
|
||||||
|
assert.strictEqual(response.isBot, false);
|
||||||
|
assert.strictEqual(response.isCat, false);
|
||||||
|
assert.strictEqual(response.instance, undefined);
|
||||||
|
assert.deepStrictEqual(response.emojis, {});
|
||||||
|
assert.strictEqual(response.onlineStatus, 'unknown');
|
||||||
|
assert.deepStrictEqual(response.badgeRoles, []);
|
||||||
|
// UserDetailedNotMeOnly
|
||||||
|
assert.strictEqual(response.url, null);
|
||||||
|
assert.strictEqual(response.uri, null);
|
||||||
|
assert.strictEqual(response.movedToUri, null);
|
||||||
|
assert.strictEqual(response.alsoKnownAs, null);
|
||||||
|
assert.strictEqual(response.createdAt, new Date(response.createdAt).toISOString());
|
||||||
|
assert.strictEqual(response.updatedAt, null);
|
||||||
|
assert.strictEqual(response.lastFetchedAt, null);
|
||||||
|
assert.strictEqual(response.bannerUrl, null);
|
||||||
|
assert.strictEqual(response.bannerBlurhash, null);
|
||||||
|
assert.strictEqual(response.isLocked, false);
|
||||||
|
assert.strictEqual(response.isSilenced, false);
|
||||||
|
assert.strictEqual(response.isSuspended, false);
|
||||||
|
assert.strictEqual(response.description, null);
|
||||||
|
assert.strictEqual(response.location, null);
|
||||||
|
assert.strictEqual(response.birthday, null);
|
||||||
|
assert.strictEqual(response.lang, null);
|
||||||
|
assert.deepStrictEqual(response.fields, []);
|
||||||
|
assert.strictEqual(response.followersCount, 0);
|
||||||
|
assert.strictEqual(response.followingCount, 0);
|
||||||
|
assert.strictEqual(response.notesCount, 0);
|
||||||
|
assert.deepStrictEqual(response.pinnedNoteIds, []);
|
||||||
|
assert.deepStrictEqual(response.pinnedNotes, []);
|
||||||
|
assert.strictEqual(response.pinnedPageId, null);
|
||||||
|
assert.strictEqual(response.pinnedPage, null);
|
||||||
|
assert.strictEqual(response.publicReactions, false);
|
||||||
|
assert.strictEqual(response.ffVisibility, 'public');
|
||||||
|
assert.strictEqual(response.twoFactorEnabled, false);
|
||||||
|
assert.strictEqual(response.usePasswordLessLogin, false);
|
||||||
|
assert.strictEqual(response.securityKeys, false);
|
||||||
|
assert.deepStrictEqual(response.roles, []);
|
||||||
|
assert.strictEqual(response.memo, null);
|
||||||
|
|
||||||
|
// MeDetailedOnly
|
||||||
|
assert.strictEqual(response.avatarId, null);
|
||||||
|
assert.strictEqual(response.bannerId, null);
|
||||||
|
assert.strictEqual(response.isModerator, false);
|
||||||
|
assert.strictEqual(response.isAdmin, false);
|
||||||
|
assert.strictEqual(response.injectFeaturedNote, true);
|
||||||
|
assert.strictEqual(response.receiveAnnouncementEmail, true);
|
||||||
|
assert.strictEqual(response.alwaysMarkNsfw, false);
|
||||||
|
assert.strictEqual(response.autoSensitive, false);
|
||||||
|
assert.strictEqual(response.carefulBot, false);
|
||||||
|
assert.strictEqual(response.autoAcceptFollowed, true);
|
||||||
|
assert.strictEqual(response.noCrawle, false);
|
||||||
|
assert.strictEqual(response.isExplorable, true);
|
||||||
|
assert.strictEqual(response.isDeleted, false);
|
||||||
|
assert.strictEqual(response.hideOnlineStatus, false);
|
||||||
|
assert.strictEqual(response.hasUnreadSpecifiedNotes, false);
|
||||||
|
assert.strictEqual(response.hasUnreadMentions, false);
|
||||||
|
assert.strictEqual(response.hasUnreadAnnouncement, false);
|
||||||
|
assert.strictEqual(response.hasUnreadAntenna, false);
|
||||||
|
assert.strictEqual(response.hasUnreadChannel, false);
|
||||||
|
assert.strictEqual(response.hasUnreadNotification, false);
|
||||||
|
assert.strictEqual(response.hasPendingReceivedFollowRequest, false);
|
||||||
|
assert.deepStrictEqual(response.mutedWords, []);
|
||||||
|
assert.deepStrictEqual(response.mutedInstances, []);
|
||||||
|
assert.deepStrictEqual(response.mutingNotificationTypes, []);
|
||||||
|
assert.deepStrictEqual(response.emailNotificationTypes, ['follow', 'receiveFollowRequest']);
|
||||||
|
assert.strictEqual(response.showTimelineReplies, false);
|
||||||
|
assert.deepStrictEqual(response.achievements, []);
|
||||||
|
assert.deepStrictEqual(response.loggedInDays, 0);
|
||||||
|
assert.deepStrictEqual(response.policies, DEFAULT_POLICIES);
|
||||||
|
assert.notStrictEqual(response.email, undefined);
|
||||||
|
assert.strictEqual(response.emailVerified, false);
|
||||||
|
assert.deepStrictEqual(response.securityKeysList, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region 自分の情報(i)
|
||||||
|
|
||||||
|
test('を読み取ることができること(自分)、キーが過不足なく入っていること。', async () => {
|
||||||
|
const response = await successfulApiCall({
|
||||||
|
endpoint: 'i',
|
||||||
|
parameters: {},
|
||||||
|
user: userNoNote,
|
||||||
|
});
|
||||||
|
const expected = meDetailed(userNoNote, true);
|
||||||
|
expected.loggedInDays = 1; // iはloggedInDaysを更新する
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region 自分の情報の更新(i/update)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ parameters: (): object => ({ name: null }) },
|
||||||
|
{ parameters: (): object => ({ name: 'x'.repeat(50) }) },
|
||||||
|
{ parameters: (): object => ({ name: 'x' }) },
|
||||||
|
{ parameters: (): object => ({ name: 'My name' }) },
|
||||||
|
{ parameters: (): object => ({ description: null }) },
|
||||||
|
{ parameters: (): object => ({ description: 'x'.repeat(1500) }) },
|
||||||
|
{ parameters: (): object => ({ description: 'x' }) },
|
||||||
|
{ parameters: (): object => ({ description: 'My description' }) },
|
||||||
|
{ parameters: (): object => ({ location: null }) },
|
||||||
|
{ parameters: (): object => ({ location: 'x'.repeat(50) }) },
|
||||||
|
{ parameters: (): object => ({ location: 'x' }) },
|
||||||
|
{ parameters: (): object => ({ location: 'My location' }) },
|
||||||
|
{ parameters: (): object => ({ birthday: '0000-00-00' }) },
|
||||||
|
{ parameters: (): object => ({ birthday: '9999-99-99' }) },
|
||||||
|
{ parameters: (): object => ({ lang: 'en-US' }) },
|
||||||
|
{ parameters: (): object => ({ fields: [] }) },
|
||||||
|
{ parameters: (): object => ({ fields: [{ name: 'x', value: 'x' }] }) },
|
||||||
|
{ parameters: (): object => ({ fields: [{ name: 'x'.repeat(3000), value: 'x'.repeat(3000) }] }) }, // BUG? fieldには制限がない
|
||||||
|
{ parameters: (): object => ({ fields: Array(16).fill({ name: 'x', value: 'y' }) }) },
|
||||||
|
{ parameters: (): object => ({ isLocked: true }) },
|
||||||
|
{ parameters: (): object => ({ isLocked: false }) },
|
||||||
|
{ parameters: (): object => ({ isExplorable: false }) },
|
||||||
|
{ parameters: (): object => ({ isExplorable: true }) },
|
||||||
|
{ parameters: (): object => ({ hideOnlineStatus: true }) },
|
||||||
|
{ parameters: (): object => ({ hideOnlineStatus: false }) },
|
||||||
|
{ parameters: (): object => ({ publicReactions: false }) },
|
||||||
|
{ parameters: (): object => ({ publicReactions: true }) },
|
||||||
|
{ parameters: (): object => ({ autoAcceptFollowed: true }) },
|
||||||
|
{ parameters: (): object => ({ autoAcceptFollowed: false }) },
|
||||||
|
{ parameters: (): object => ({ noCrawle: true }) },
|
||||||
|
{ parameters: (): object => ({ noCrawle: false }) },
|
||||||
|
{ parameters: (): object => ({ isBot: true }) },
|
||||||
|
{ parameters: (): object => ({ isBot: false }) },
|
||||||
|
{ parameters: (): object => ({ isCat: true }) },
|
||||||
|
{ parameters: (): object => ({ isCat: false }) },
|
||||||
|
{ parameters: (): object => ({ showTimelineReplies: true }) },
|
||||||
|
{ parameters: (): object => ({ showTimelineReplies: false }) },
|
||||||
|
{ parameters: (): object => ({ injectFeaturedNote: true }) },
|
||||||
|
{ parameters: (): object => ({ injectFeaturedNote: false }) },
|
||||||
|
{ parameters: (): object => ({ receiveAnnouncementEmail: true }) },
|
||||||
|
{ parameters: (): object => ({ receiveAnnouncementEmail: false }) },
|
||||||
|
{ parameters: (): object => ({ alwaysMarkNsfw: true }) },
|
||||||
|
{ parameters: (): object => ({ alwaysMarkNsfw: false }) },
|
||||||
|
{ parameters: (): object => ({ autoSensitive: true }) },
|
||||||
|
{ parameters: (): object => ({ autoSensitive: false }) },
|
||||||
|
{ parameters: (): object => ({ ffVisibility: 'private' }) },
|
||||||
|
{ parameters: (): object => ({ ffVisibility: 'followers' }) },
|
||||||
|
{ parameters: (): object => ({ ffVisibility: 'public' }) },
|
||||||
|
{ parameters: (): object => ({ mutedWords: Array(19).fill(['xxxxx']) }) },
|
||||||
|
{ parameters: (): object => ({ mutedWords: [['x'.repeat(194)]] }) },
|
||||||
|
{ parameters: (): object => ({ mutedWords: [] }) },
|
||||||
|
{ parameters: (): object => ({ mutedInstances: ['xxxx.xxxxx'] }) },
|
||||||
|
{ parameters: (): object => ({ mutedInstances: [] }) },
|
||||||
|
{ parameters: (): object => ({ mutingNotificationTypes: ['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'achievementEarned', 'app'] }) },
|
||||||
|
{ parameters: (): object => ({ mutingNotificationTypes: [] }) },
|
||||||
|
{ parameters: (): object => ({ emailNotificationTypes: ['mention', 'reply', 'quote', 'follow', 'receiveFollowRequest'] }) },
|
||||||
|
{ parameters: (): object => ({ emailNotificationTypes: [] }) },
|
||||||
|
] as const)('を書き換えることができる($#)', async ({ parameters }) => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'i/update', parameters: parameters(), user: alice });
|
||||||
|
const expected = { ...meDetailed(alice, true), ...parameters() };
|
||||||
|
assert.deepStrictEqual(response, expected, inspect(parameters()));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('を書き換えることができる(Avatar)', async () => {
|
||||||
|
const aliceFile = (await uploadFile(alice)).body;
|
||||||
|
const parameters = { avatarId: aliceFile.id };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'i/update', parameters: parameters, user: alice });
|
||||||
|
assert.match(response.avatarUrl ?? '.', /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/);
|
||||||
|
assert.match(response.avatarBlurhash ?? '.', /[ -~]{54}/);
|
||||||
|
const expected = {
|
||||||
|
...meDetailed(alice, true),
|
||||||
|
avatarId: aliceFile.id,
|
||||||
|
avatarBlurhash: response.avatarBlurhash,
|
||||||
|
avatarUrl: response.avatarUrl,
|
||||||
|
};
|
||||||
|
assert.deepStrictEqual(response, expected, inspect(parameters));
|
||||||
|
|
||||||
|
const parameters2 = { avatarId: null };
|
||||||
|
const response2 = await successfulApiCall({ endpoint: 'i/update', parameters: parameters2, user: alice });
|
||||||
|
const expected2 = {
|
||||||
|
...meDetailed(alice, true),
|
||||||
|
avatarId: null,
|
||||||
|
avatarBlurhash: null,
|
||||||
|
avatarUrl: alice.avatarUrl, // 解除した場合、identiconになる
|
||||||
|
};
|
||||||
|
assert.deepStrictEqual(response2, expected2, inspect(parameters));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('を書き換えることができる(Banner)', async () => {
|
||||||
|
const aliceFile = (await uploadFile(alice)).body;
|
||||||
|
const parameters = { bannerId: aliceFile.id };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'i/update', parameters: parameters, user: alice });
|
||||||
|
assert.match(response.bannerUrl ?? '.', /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/);
|
||||||
|
assert.match(response.bannerBlurhash ?? '.', /[ -~]{54}/);
|
||||||
|
const expected = {
|
||||||
|
...meDetailed(alice, true),
|
||||||
|
bannerId: aliceFile.id,
|
||||||
|
bannerBlurhash: response.bannerBlurhash,
|
||||||
|
bannerUrl: response.bannerUrl,
|
||||||
|
};
|
||||||
|
assert.deepStrictEqual(response, expected, inspect(parameters));
|
||||||
|
|
||||||
|
const parameters2 = { bannerId: null };
|
||||||
|
const response2 = await successfulApiCall({ endpoint: 'i/update', parameters: parameters2, user: alice });
|
||||||
|
const expected2 = {
|
||||||
|
...meDetailed(alice, true),
|
||||||
|
bannerId: null,
|
||||||
|
bannerBlurhash: null,
|
||||||
|
bannerUrl: null,
|
||||||
|
};
|
||||||
|
assert.deepStrictEqual(response2, expected2, inspect(parameters));
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region 自分の情報の更新(i/pin, i/unpin)
|
||||||
|
|
||||||
|
test('を書き換えることができる(ピン止めノート)', async () => {
|
||||||
|
const parameters = { noteId: aliceNote.id };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'i/pin', parameters, user: alice });
|
||||||
|
const expected = { ...meDetailed(alice, false), pinnedNoteIds: [aliceNote.id], pinnedNotes: [aliceNote] };
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
|
||||||
|
const response2 = await successfulApiCall({ endpoint: 'i/unpin', parameters, user: alice });
|
||||||
|
const expected2 = meDetailed(alice, false);
|
||||||
|
assert.deepStrictEqual(response2, expected2);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region メモの更新(users/update-memo)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ label: '最大長', memo: 'x'.repeat(2048) },
|
||||||
|
{ label: '空文字', memo: '', expects: null },
|
||||||
|
{ label: 'null', memo: null },
|
||||||
|
])('を書き換えることができる(メモを$labelに)', async ({ memo, expects }) => {
|
||||||
|
const expected = { ...await show(bob.id), memo: expects === undefined ? memo : expects };
|
||||||
|
const parameters = { userId: bob.id, memo };
|
||||||
|
await successfulApiCall({ endpoint: 'users/update-memo', parameters, user: alice });
|
||||||
|
const response = await show(bob.id);
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region ユーザー(users)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ label: 'ID昇順', parameters: { limit: 5 }, selector: (u: UserLite): string => u.id },
|
||||||
|
{ label: 'フォロワー昇順', parameters: { sort: '+follower' }, selector: (u: UserDetailedNotMe): string => String(u.followersCount) },
|
||||||
|
{ label: 'フォロワー降順', parameters: { sort: '-follower' }, selector: (u: UserDetailedNotMe): string => String(u.followersCount) },
|
||||||
|
{ label: '登録日時昇順', parameters: { sort: '+createdAt' }, selector: (u: UserDetailedNotMe): string => u.createdAt },
|
||||||
|
{ label: '登録日時降順', parameters: { sort: '-createdAt' }, selector: (u: UserDetailedNotMe): string => u.createdAt },
|
||||||
|
{ label: '投稿日時昇順', parameters: { sort: '+updatedAt' }, selector: (u: UserDetailedNotMe): string => String(u.updatedAt) },
|
||||||
|
{ label: '投稿日時降順', parameters: { sort: '-updatedAt' }, selector: (u: UserDetailedNotMe): string => String(u.updatedAt) },
|
||||||
|
] as const)('をリスト形式で取得することができる($label)', async ({ parameters, selector }) => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users', parameters, user: alice });
|
||||||
|
|
||||||
|
// 結果の並びを事前にアサートするのは困難なので返ってきたidに対応するユーザーが返っており、ソート順が正しいことだけを検証する
|
||||||
|
const users = await Promise.all(response.map(u => show(u.id)));
|
||||||
|
const expected = users.sort((x, y) => {
|
||||||
|
const index = (selector(x) < selector(y)) ? -1 : (selector(x) > selector(y)) ? 1 : 0;
|
||||||
|
return index * (parameters.sort?.startsWith('+') ? -1 : 1);
|
||||||
|
});
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: '「見つけやすくする」がOFFのユーザーが含まれない', user: (): User => userNotExplorable, excluded: true },
|
||||||
|
{ label: 'ミュートユーザーが含まれない', user: (): User => userMutedByAlice, excluded: true },
|
||||||
|
{ label: 'ブロックされているユーザーが含まれない', user: (): User => userBlockedByAlice, excluded: true },
|
||||||
|
{ label: 'ブロックしてきているユーザーが含まれる', user: (): User => userBlockingAlice, excluded: true },
|
||||||
|
{ label: '承認制ユーザーが含まれる', user: (): User => userLocking },
|
||||||
|
{ label: 'サイレンスユーザーが含まれる', user: (): User => userSilenced },
|
||||||
|
{ label: 'サスペンドユーザーが含まれる', user: (): User => userSuspended },
|
||||||
|
{ label: '削除済ユーザーが含まれる', user: (): User => userDeletedBySelf },
|
||||||
|
{ label: '削除済(byAdmin)ユーザーが含まれる', user: (): User => userDeletedByAdmin },
|
||||||
|
] as const)('をリスト形式で取得することができ、結果に$label', async ({ user, excluded }) => {
|
||||||
|
const parameters = { limit: 100 };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users', parameters, user: alice });
|
||||||
|
const expected = (excluded ?? false) ? [] : [await show(user().id)];
|
||||||
|
assert.deepStrictEqual(response.filter((u) => u.id === user().id), expected);
|
||||||
|
});
|
||||||
|
test.todo('をリスト形式で取得することができる(リモート, hostname指定)');
|
||||||
|
test.todo('をリスト形式で取得することができる(pagenation)');
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region ユーザー情報(users/show)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ label: 'ID指定で自分自身を', parameters: (): object => ({ userId: alice.id }), user: (): User => alice, type: meDetailed },
|
||||||
|
{ label: 'ID指定で他人を', parameters: (): object => ({ userId: alice.id }), user: (): User => bob, type: userDetailedNotMeWithRelations },
|
||||||
|
{ label: 'ID指定かつ未認証', parameters: (): object => ({ userId: alice.id }), user: undefined, type: userDetailedNotMe },
|
||||||
|
{ label: '@指定で自分自身を', parameters: (): object => ({ username: alice.username }), user: (): User => alice, type: meDetailed },
|
||||||
|
{ label: '@指定で他人を', parameters: (): object => ({ username: alice.username }), user: (): User => bob, type: userDetailedNotMeWithRelations },
|
||||||
|
{ label: '@指定かつ未認証', parameters: (): object => ({ username: alice.username }), user: undefined, type: userDetailedNotMe },
|
||||||
|
] as const)('を取得することができる($label)', async ({ parameters, user, type }) => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters: parameters(), user: user?.() });
|
||||||
|
const expected = type(alice);
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: 'Administratorになっている', user: (): User => userAdmin, me: (): User => userAdmin, selector: (user: User): unknown => user.isAdmin },
|
||||||
|
{ label: '自分以外から見たときはAdministratorか判定できない', user: (): User => userAdmin, selector: (user: User): unknown => user.isAdmin, expected: (): undefined => undefined },
|
||||||
|
{ label: 'Moderatorになっている', user: (): User => userModerator, me: (): User => userModerator, selector: (user: User): unknown => user.isModerator },
|
||||||
|
{ label: '自分以外から見たときはModeratorか判定できない', user: (): User => userModerator, selector: (user: User): unknown => user.isModerator, expected: (): undefined => undefined },
|
||||||
|
{ label: 'サイレンスになっている', user: (): User => userSilenced, selector: (user: User): unknown => user.isSilenced },
|
||||||
|
{ label: 'サスペンドになっている', user: (): User => userSuspended, selector: (user: User): unknown => user.isSuspended },
|
||||||
|
{ label: '削除済みになっている', user: (): User => userDeletedBySelf, me: (): User => userDeletedBySelf, selector: (user: User): unknown => user.isDeleted },
|
||||||
|
{ label: '自分以外から見たときは削除済みか判定できない', user: (): User => userDeletedBySelf, selector: (user: User): unknown => user.isDeleted, expected: (): undefined => undefined },
|
||||||
|
{ label: '削除済み(byAdmin)になっている', user: (): User => userDeletedByAdmin, me: (): User => userDeletedByAdmin, selector: (user: User): unknown => user.isDeleted },
|
||||||
|
{ label: '自分以外から見たときは削除済み(byAdmin)か判定できない', user: (): User => userDeletedByAdmin, selector: (user: User): unknown => user.isDeleted, expected: (): undefined => undefined },
|
||||||
|
{ label: 'フォロー中になっている', user: (): User => userFollowedByAlice, selector: (user: User): unknown => user.isFollowing },
|
||||||
|
{ label: 'フォローされている', user: (): User => userFollowingAlice, selector: (user: User): unknown => user.isFollowed },
|
||||||
|
{ label: 'ブロック中になっている', user: (): User => userBlockedByAlice, selector: (user: User): unknown => user.isBlocking },
|
||||||
|
{ label: 'ブロックされている', user: (): User => userBlockingAlice, selector: (user: User): unknown => user.isBlocked },
|
||||||
|
{ label: 'ミュート中になっている', user: (): User => userMutedByAlice, selector: (user: User): unknown => user.isMuted },
|
||||||
|
{ label: 'リノートミュート中になっている', user: (): User => userRnMutedByAlice, selector: (user: User): unknown => user.isRenoteMuted },
|
||||||
|
{ label: 'フォローリクエスト中になっている', user: (): User => userFollowRequested, me: (): User => userFollowRequesting, selector: (user: User): unknown => user.hasPendingFollowRequestFromYou },
|
||||||
|
{ label: 'フォローリクエストされている', user: (): User => userFollowRequesting, me: (): User => userFollowRequested, selector: (user: User): unknown => user.hasPendingFollowRequestToYou },
|
||||||
|
] as const)('を取得することができ、$labelこと', async ({ user, me, selector, expected }) => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters: { userId: user().id }, user: me?.() ?? alice });
|
||||||
|
assert.strictEqual(selector(response), (expected ?? ((): true => true))());
|
||||||
|
});
|
||||||
|
test('を取得することができ、Publicなロールがセットされていること', async () => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters: { userId: userRolePublic.id }, user: alice });
|
||||||
|
assert.deepStrictEqual(response.badgeRoles, []);
|
||||||
|
assert.deepStrictEqual(response.roles, [{
|
||||||
|
id: rolePublic.id,
|
||||||
|
name: rolePublic.name,
|
||||||
|
color: rolePublic.color,
|
||||||
|
iconUrl: rolePublic.iconUrl,
|
||||||
|
description: rolePublic.description,
|
||||||
|
isModerator: rolePublic.isModerator,
|
||||||
|
isAdministrator: rolePublic.isAdministrator,
|
||||||
|
displayOrder: rolePublic.displayOrder,
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
test('を取得することができ、バッヂロールがセットされていること', async () => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters: { userId: userRoleBadge.id }, user: alice });
|
||||||
|
assert.deepStrictEqual(response.badgeRoles, [{
|
||||||
|
name: roleBadge.name,
|
||||||
|
iconUrl: roleBadge.iconUrl,
|
||||||
|
displayOrder: roleBadge.displayOrder,
|
||||||
|
}]);
|
||||||
|
assert.deepStrictEqual(response.roles, []); // バッヂだからといってrolesが取れるとは限らない
|
||||||
|
});
|
||||||
|
test('をID指定のリスト形式で取得することができる(空)', async () => {
|
||||||
|
const parameters = { userIds: [] };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters, user: alice });
|
||||||
|
const expected: [] = [];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test('をID指定のリスト形式で取得することができる', async() => {
|
||||||
|
const parameters = { userIds: [bob.id, alice.id, carol.id] };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters, user: alice });
|
||||||
|
const expected = [
|
||||||
|
await successfulApiCall({ endpoint: 'users/show', parameters: { userId: bob.id }, user: alice }),
|
||||||
|
await successfulApiCall({ endpoint: 'users/show', parameters: { userId: alice.id }, user: alice }),
|
||||||
|
await successfulApiCall({ endpoint: 'users/show', parameters: { userId: carol.id }, user: alice }),
|
||||||
|
];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: '「見つけやすくする」がOFFのユーザーが含まれる', user: (): User => userNotExplorable },
|
||||||
|
{ label: 'ミュートユーザーが含まれる', user: (): User => userMutedByAlice },
|
||||||
|
{ label: 'ブロックされているユーザーが含まれる', user: (): User => userBlockedByAlice },
|
||||||
|
{ label: 'ブロックしてきているユーザーが含まれる', user: (): User => userBlockingAlice },
|
||||||
|
{ label: '承認制ユーザーが含まれる', user: (): User => userLocking },
|
||||||
|
{ label: 'サイレンスユーザーが含まれる', user: (): User => userSilenced },
|
||||||
|
{ label: 'サスペンドユーザーが(モデレーターが見るときは)含まれる', user: (): User => userSuspended, me: (): User => root },
|
||||||
|
// BUG サスペンドユーザーを一般ユーザーから見るとrootユーザーが返ってくる
|
||||||
|
//{ label: 'サスペンドユーザーが(一般ユーザーが見るときは)含まれない', user: (): User => userSuspended, me: (): User => bob, excluded: true },
|
||||||
|
{ label: '削除済ユーザーが含まれる', user: (): User => userDeletedBySelf },
|
||||||
|
{ label: '削除済(byAdmin)ユーザーが含まれる', user: (): User => userDeletedByAdmin },
|
||||||
|
] as const)('をID指定のリスト形式で取得することができ、結果に$label', async ({ user, me, excluded }) => {
|
||||||
|
const parameters = { userIds: [user().id] };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/show', parameters, user: me?.() ?? alice });
|
||||||
|
const expected = (excluded ?? false) ? [] : [await show(user().id, me?.() ?? alice)];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.todo('をID指定のリスト形式で取得することができる(リモート)');
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region 検索(users/search)
|
||||||
|
|
||||||
|
test('を検索することができる', async () => {
|
||||||
|
const parameters = { query: 'carol', limit: 10 };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/search', parameters, user: alice });
|
||||||
|
const expected = [await show(carol.id)];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test('を検索することができる(UserLite)', async () => {
|
||||||
|
const parameters = { query: 'carol', detail: false, limit: 10 };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/search', parameters, user: alice });
|
||||||
|
const expected = [userLite(await show(carol.id))];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: '「見つけやすくする」がOFFのユーザーが含まれる', user: (): User => userNotExplorable },
|
||||||
|
{ label: 'ミュートユーザーが含まれる', user: (): User => userMutedByAlice },
|
||||||
|
{ label: 'ブロックされているユーザーが含まれる', user: (): User => userBlockedByAlice },
|
||||||
|
{ label: 'ブロックしてきているユーザーが含まれる', user: (): User => userBlockingAlice },
|
||||||
|
{ label: '承認制ユーザーが含まれる', user: (): User => userLocking },
|
||||||
|
{ label: 'サイレンスユーザーが含まれる', user: (): User => userSilenced },
|
||||||
|
{ label: 'サスペンドユーザーが含まれない', user: (): User => userSuspended, excluded: true },
|
||||||
|
{ label: '削除済ユーザーが含まれる', user: (): User => userDeletedBySelf },
|
||||||
|
{ label: '削除済(byAdmin)ユーザーが含まれる', user: (): User => userDeletedByAdmin },
|
||||||
|
] as const)('を検索することができ、結果に$labelが含まれる', async ({ user, excluded }) => {
|
||||||
|
const parameters = { query: user().username, limit: 1 };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/search', parameters, user: alice });
|
||||||
|
const expected = (excluded ?? false) ? [] : [await show(user().id)];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.todo('を検索することができる(リモート)');
|
||||||
|
test.todo('を検索することができる(pagenation)');
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region ID指定検索(users/search-by-username-and-host)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ label: '自分', parameters: { username: 'alice' }, user: (): User[] => [alice] },
|
||||||
|
{ label: '自分かつusernameが大文字', parameters: { username: 'ALICE' }, user: (): User[] => [alice] },
|
||||||
|
{ label: 'ローカルのフォロイーでノートなし', parameters: { username: 'userFollowedByAlice' }, user: (): User[] => [userFollowedByAlice] },
|
||||||
|
{ label: 'ローカルでノートなしは検索に載らない', parameters: { username: 'userNoNote' }, user: (): User[] => [] },
|
||||||
|
{ label: 'ローカルの他人1', parameters: { username: 'bob' }, user: (): User[] => [bob] },
|
||||||
|
{ label: 'ローカルの他人2', parameters: { username: 'bob', host: null }, user: (): User[] => [bob] },
|
||||||
|
{ label: 'ローカルの他人3', parameters: { username: 'bob', host: '.' }, user: (): User[] => [bob] },
|
||||||
|
{ label: 'ローカル', parameters: { host: null, limit: 1 }, user: (): User[] => [userFollowedByAlice] },
|
||||||
|
{ label: 'ローカル', parameters: { host: '.', limit: 1 }, user: (): User[] => [userFollowedByAlice] },
|
||||||
|
])('をID&ホスト指定で検索できる($label)', async ({ parameters, user }) => {
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/search-by-username-and-host', parameters, user: alice });
|
||||||
|
const expected = await Promise.all(user().map(u => show(u.id)));
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: '「見つけやすくする」がOFFのユーザーが含まれる', user: (): User => userNotExplorable },
|
||||||
|
{ label: 'ミュートユーザーが含まれる', user: (): User => userMutedByAlice },
|
||||||
|
{ label: 'ブロックされているユーザーが含まれる', user: (): User => userBlockedByAlice },
|
||||||
|
{ label: 'ブロックしてきているユーザーが含まれる', user: (): User => userBlockingAlice },
|
||||||
|
{ label: '承認制ユーザーが含まれる', user: (): User => userLocking },
|
||||||
|
{ label: 'サイレンスユーザーが含まれる', user: (): User => userSilenced },
|
||||||
|
{ label: 'サスペンドユーザーが含まれない', user: (): User => userSuspended, excluded: true },
|
||||||
|
{ label: '削除済ユーザーが含まれる', user: (): User => userDeletedBySelf },
|
||||||
|
{ label: '削除済(byAdmin)ユーザーが含まれる', user: (): User => userDeletedByAdmin },
|
||||||
|
] as const)('をID&ホスト指定で検索でき、結果に$label', async ({ user, excluded }) => {
|
||||||
|
const parameters = { username: user().username };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/search-by-username-and-host', parameters, user: alice });
|
||||||
|
const expected = (excluded ?? false) ? [] : [await show(user().id)];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.todo('をID&ホスト指定で検索できる(リモート)');
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region ID指定検索(users/get-frequently-replied-users)
|
||||||
|
|
||||||
|
test('がよくリプライをするユーザーのリストを取得できる', async () => {
|
||||||
|
const parameters = { userId: alice.id, limit: 5 };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/get-frequently-replied-users', parameters, user: alice });
|
||||||
|
const expected = await Promise.all(usersReplying.slice(0, parameters.limit).map(async (s, i) => ({
|
||||||
|
user: await show(s.id),
|
||||||
|
weight: (usersReplying.length - i) / usersReplying.length,
|
||||||
|
})));
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: '「見つけやすくする」がOFFのユーザーが含まれる', user: (): User => userNotExplorable },
|
||||||
|
{ label: 'ミュートユーザーが含まれる', user: (): User => userMutedByAlice },
|
||||||
|
{ label: 'ブロックされているユーザーが含まれる', user: (): User => userBlockedByAlice },
|
||||||
|
{ label: 'ブロックしてきているユーザーが含まれない', user: (): User => userBlockingAlice, excluded: true },
|
||||||
|
{ label: '承認制ユーザーが含まれる', user: (): User => userLocking },
|
||||||
|
{ label: 'サイレンスユーザーが含まれる', user: (): User => userSilenced },
|
||||||
|
{ label: 'サスペンドユーザーが含まれない', user: (): User => userSuspended },
|
||||||
|
{ label: '削除済ユーザーが含まれる', user: (): User => userDeletedBySelf },
|
||||||
|
{ label: '削除済(byAdmin)ユーザーが含まれる', user: (): User => userDeletedByAdmin },
|
||||||
|
] as const)('がよくリプライをするユーザーのリストを取得でき、結果に$label', async ({ user, excluded }) => {
|
||||||
|
const replyTo = (await successfulApiCall({ endpoint: 'users/notes', parameters: { userId: user().id }, user: undefined }))[0];
|
||||||
|
await post(alice, { text: `@${user().username} test`, replyId: replyTo.id });
|
||||||
|
const parameters = { userId: alice.id, limit: 100 };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/get-frequently-replied-users', parameters, user: alice });
|
||||||
|
const expected = (excluded ?? false) ? [] : [await show(user().id)];
|
||||||
|
assert.deepStrictEqual(response.map(s => s.user).filter((u) => u.id === user().id), expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region ハッシュタグ(hashtags/users)
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
{ label: 'フォロワー昇順', sort: { sort: '+follower' }, selector: (u: UserDetailedNotMe): string => String(u.followersCount) },
|
||||||
|
{ label: 'フォロワー降順', sort: { sort: '-follower' }, selector: (u: UserDetailedNotMe): string => String(u.followersCount) },
|
||||||
|
{ label: '登録日時昇順', sort: { sort: '+createdAt' }, selector: (u: UserDetailedNotMe): string => u.createdAt },
|
||||||
|
{ label: '登録日時降順', sort: { sort: '-createdAt' }, selector: (u: UserDetailedNotMe): string => u.createdAt },
|
||||||
|
{ label: '投稿日時昇順', sort: { sort: '+updatedAt' }, selector: (u: UserDetailedNotMe): string => String(u.updatedAt) },
|
||||||
|
{ label: '投稿日時降順', sort: { sort: '-updatedAt' }, selector: (u: UserDetailedNotMe): string => String(u.updatedAt) },
|
||||||
|
] as const)('をハッシュタグ指定で取得することができる($label)', async ({ sort, selector }) => {
|
||||||
|
const hashtag = 'test_hashtag';
|
||||||
|
await successfulApiCall({ endpoint: 'i/update', parameters: { description: `#${hashtag}` }, user: alice });
|
||||||
|
const parameters = { tag: hashtag, limit: 5, ...sort };
|
||||||
|
const response = await successfulApiCall({ endpoint: 'hashtags/users', parameters, user: alice });
|
||||||
|
const users = await Promise.all(response.map(u => show(u.id)));
|
||||||
|
const expected = users.sort((x, y) => {
|
||||||
|
const index = (selector(x) < selector(y)) ? -1 : (selector(x) > selector(y)) ? 1 : 0;
|
||||||
|
return index * (parameters.sort.startsWith('+') ? -1 : 1);
|
||||||
|
});
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.each([
|
||||||
|
{ label: '「見つけやすくする」がOFFのユーザーが含まれる', user: (): User => userNotExplorable },
|
||||||
|
{ label: 'ミュートユーザーが含まれる', user: (): User => userMutedByAlice },
|
||||||
|
{ label: 'ブロックされているユーザーが含まれる', user: (): User => userBlockedByAlice },
|
||||||
|
{ label: 'ブロックしてきているユーザーが含まれる', user: (): User => userBlockingAlice },
|
||||||
|
{ label: '承認制ユーザーが含まれる', user: (): User => userLocking },
|
||||||
|
{ label: 'サイレンスユーザーが含まれる', user: (): User => userSilenced },
|
||||||
|
{ label: 'サスペンドユーザーが含まれる', user: (): User => userSuspended },
|
||||||
|
{ label: '削除済ユーザーが含まれる', user: (): User => userDeletedBySelf },
|
||||||
|
{ label: '削除済(byAdmin)ユーザーが含まれる', user: (): User => userDeletedByAdmin },
|
||||||
|
] as const)('をハッシュタグ指定で取得することができ、結果に$label', async ({ user }) => {
|
||||||
|
const hashtag = `user_test${user().username}`;
|
||||||
|
if (user() !== userSuspended) {
|
||||||
|
// サスペンドユーザーはupdateできない。
|
||||||
|
await successfulApiCall({ endpoint: 'i/update', parameters: { description: `#${hashtag}` }, user: user() });
|
||||||
|
}
|
||||||
|
const parameters = { tag: hashtag, limit: 100, sort: '-follower' } as const;
|
||||||
|
const response = await successfulApiCall({ endpoint: 'hashtags/users', parameters, user: alice });
|
||||||
|
const expected = [await show(user().id)];
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
test.todo('をハッシュタグ指定で取得することができる(リモート)');
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region オススメユーザー(users/recommendation)
|
||||||
|
|
||||||
|
// BUG users/recommendationは壊れている? > QueryFailedError: missing FROM-clause entry for table "note"
|
||||||
|
test.skip('のオススメを取得することができる', async () => {
|
||||||
|
const parameters = {};
|
||||||
|
const response = await successfulApiCall({ endpoint: 'users/recommendation', parameters, user: alice });
|
||||||
|
const expected = await Promise.all(response.map(u => show(u.id)));
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
//#region ピン止めユーザー(pinned-users)
|
||||||
|
|
||||||
|
test('のピン止めユーザーを取得することができる', async () => {
|
||||||
|
await successfulApiCall({ endpoint: 'admin/update-meta', parameters: { pinnedUsers: [bob.username, `@${carol.username}`] }, user: root });
|
||||||
|
const parameters = {} as const;
|
||||||
|
const response = await successfulApiCall({ endpoint: 'pinned-users', parameters, user: alice });
|
||||||
|
const expected = await Promise.all([bob, carol].map(u => show(u.id)));
|
||||||
|
assert.deepStrictEqual(response, expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
test.todo('を管理人として確認することができる(admin/show-user)');
|
||||||
|
test.todo('を管理人として確認することができる(admin/show-users)');
|
||||||
|
test.todo('をサーバー向けに取得することができる(federation/users)');
|
||||||
|
});
|
|
@ -6,6 +6,7 @@ import WebSocket from 'ws';
|
||||||
import fetch, { Blob, File, RequestInit } from 'node-fetch';
|
import fetch, { Blob, File, RequestInit } from 'node-fetch';
|
||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
import { JSDOM } from 'jsdom';
|
import { JSDOM } from 'jsdom';
|
||||||
|
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
|
||||||
import { entities } from '../src/postgres.js';
|
import { entities } from '../src/postgres.js';
|
||||||
import { loadConfig } from '../src/config.js';
|
import { loadConfig } from '../src/config.js';
|
||||||
import type * as misskey from 'misskey-js';
|
import type * as misskey from 'misskey-js';
|
||||||
|
@ -31,12 +32,12 @@ export type ApiRequest = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const successfulApiCall = async <T, >(request: ApiRequest, assertion: {
|
export const successfulApiCall = async <T, >(request: ApiRequest, assertion: {
|
||||||
status: number,
|
status?: number,
|
||||||
} = { status: 200 }): Promise<T> => {
|
} = {}): Promise<T> => {
|
||||||
const { endpoint, parameters, user } = request;
|
const { endpoint, parameters, user } = request;
|
||||||
const { status } = assertion;
|
|
||||||
const res = await api(endpoint, parameters, user);
|
const res = await api(endpoint, parameters, user);
|
||||||
assert.strictEqual(res.status, status, inspect(res.body));
|
const status = assertion.status ?? (res.body == null ? 204 : 200);
|
||||||
|
assert.strictEqual(res.status, status, inspect(res.body, { depth: 5, colors: true }));
|
||||||
return res.body;
|
return res.body;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -188,6 +189,36 @@ export const channel = async (user: any, channel: any = {}): Promise<any> => {
|
||||||
return res.body;
|
return res.body;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const role = async (user: any, role: any = {}, policies: any = {}): Promise<any> => {
|
||||||
|
const res = await api('admin/roles/create', {
|
||||||
|
asBadge: false,
|
||||||
|
canEditMembersByModerator: false,
|
||||||
|
color: null,
|
||||||
|
condFormula: {
|
||||||
|
id: 'ebef1684-672d-49b6-ad82-1b3ec3784f85',
|
||||||
|
type: 'isRemote',
|
||||||
|
},
|
||||||
|
description: '',
|
||||||
|
displayOrder: 0,
|
||||||
|
iconUrl: null,
|
||||||
|
isAdministrator: false,
|
||||||
|
isModerator: false,
|
||||||
|
isPublic: false,
|
||||||
|
name: 'New Role',
|
||||||
|
target: 'manual',
|
||||||
|
policies: {
|
||||||
|
...Object.entries(DEFAULT_POLICIES).map(([k, v]) => [k, {
|
||||||
|
priority: 0,
|
||||||
|
useDefault: true,
|
||||||
|
value: v,
|
||||||
|
}]),
|
||||||
|
...policies,
|
||||||
|
},
|
||||||
|
...role,
|
||||||
|
}, user);
|
||||||
|
return res.body;
|
||||||
|
};
|
||||||
|
|
||||||
interface UploadOptions {
|
interface UploadOptions {
|
||||||
/** Optional, absolute path or relative from ./resources/ */
|
/** Optional, absolute path or relative from ./resources/ */
|
||||||
path?: string | URL;
|
path?: string | URL;
|
||||||
|
|
|
@ -38,6 +38,7 @@ fs.readFile(
|
||||||
path.resolve(__dirname, '../../..', arg)
|
path.resolve(__dirname, '../../..', arg)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.map((path) => path.replace(/(?:(?<=\.stories)\.(?:impl|meta)|\.msw)(?=\.ts$)/g, ''))
|
||||||
.map((path) => (path.startsWith('.') ? path : `./${path}`))
|
.map((path) => (path.startsWith('.') ? path : `./${path}`))
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -118,7 +118,7 @@ function toStories(component: string): string {
|
||||||
.replace(/[-.]|^(?=\d)/g, '_')
|
.replace(/[-.]|^(?=\d)/g, '_')
|
||||||
.replace(/(?<=^[^A-Z_]*$)/, '_')}
|
.replace(/(?<=^[^A-Z_]*$)/, '_')}
|
||||||
/> as estree.Identifier;
|
/> as estree.Identifier;
|
||||||
const parameters = (
|
const parameters =
|
||||||
<object-expression
|
<object-expression
|
||||||
properties={[
|
properties={[
|
||||||
<property
|
<property
|
||||||
|
@ -137,9 +137,8 @@ function toStories(component: string): string {
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
]}
|
]}
|
||||||
/>
|
/> as estree.ObjectExpression;
|
||||||
) as estree.ObjectExpression;
|
const program =
|
||||||
const program = (
|
|
||||||
<program
|
<program
|
||||||
body={[
|
body={[
|
||||||
<import-declaration
|
<import-declaration
|
||||||
|
@ -379,11 +378,11 @@ function toStories(component: string): string {
|
||||||
declaration={(<identifier name='meta' />) as estree.Identifier}
|
declaration={(<identifier name='meta' />) as estree.Identifier}
|
||||||
/> as estree.ExportDefaultDeclaration,
|
/> as estree.ExportDefaultDeclaration,
|
||||||
]}
|
]}
|
||||||
/>
|
/> as estree.Program;
|
||||||
) as estree.Program;
|
|
||||||
return format(
|
return format(
|
||||||
'/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' +
|
'/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' +
|
||||||
'/* eslint-disable import/no-default-export */\n' +
|
'/* eslint-disable import/no-default-export */\n' +
|
||||||
|
'/* eslint-disable import/no-duplicates */\n' +
|
||||||
generate(program, { generator }) +
|
generate(program, { generator }) +
|
||||||
(hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''),
|
(hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''),
|
||||||
{
|
{
|
||||||
|
@ -397,7 +396,9 @@ function toStories(component: string): string {
|
||||||
// glob('src/{components,pages,ui,widgets}/**/*.vue')
|
// glob('src/{components,pages,ui,widgets}/**/*.vue')
|
||||||
Promise.all([
|
Promise.all([
|
||||||
glob('src/components/global/*.vue'),
|
glob('src/components/global/*.vue'),
|
||||||
|
glob('src/components/Mk{A,B}*.vue'),
|
||||||
glob('src/components/MkGalleryPostPreview.vue'),
|
glob('src/components/MkGalleryPostPreview.vue'),
|
||||||
|
glob('src/components/MkSignupServerRules.vue'),
|
||||||
glob('src/pages/user/home.vue'),
|
glob('src/pages/user/home.vue'),
|
||||||
])
|
])
|
||||||
.then((globs) => globs.flat())
|
.then((globs) => globs.flat())
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue