Commit Graph

48 Commits

Author SHA1 Message Date
Marie db012fc8c3
merge: upstream (1) 2024-01-21 13:11:23 +01:00
かっこかり fb309f3d4f
return a `Vary: Accept` header for all dual-format endpoints #365 (#13044)
`/users/:user`, `/@:user`, `/notes/:note` return different responses
depending on the request's `Accept:` header. If we don't consistently
return a `Vary: Accept` header, browsers and caching proxies will get
confused, and return AP representations when HTML was requested, or
vice versa.

Co-authored-by: dakkar <dakkar@thenautilus.net>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2024-01-21 18:14:42 +09:00
dakkar 9d939bcc49 authorised fetch: log more details
this will help debugging problems in the implementation; thanks to
@ShittyKopper for the suggestion
2024-01-08 18:54:01 +00:00
dakkar 61c193c08f lint 2023-12-31 16:17:45 +00:00
dakkar 6d5d3d9ea1 auth-fetch: ask to never cache responses
I could have factored out all the lines that set cache headers, but
that would have made future merges even more complicated ☹

thanks ShittyCopper for reporting the problem!
2023-12-31 13:27:38 +00:00
dakkar a3dd61dec4 fix logging 2023-12-23 21:27:48 +00:00
dakkar e6c02909c7 fix typo
thanks @Marie
2023-12-23 20:11:53 +00:00
dakkar 477cda0b63 authorized fetch: log when things go wrong 2023-12-23 15:26:42 +00:00
dakkar 1984416e3e authorized fetch: let /@instance.actor through
this is probably never actually used, but it still looks like a good
idea (also, FireFish does it)

thanks @ShittyKoper for noticing!
2023-12-23 15:26:42 +00:00
dakkar e5ea882ed7 authorized fetch #217
the implementation is copied from the other places we already check
HTTP signatures, and cross-checked with Firefish's implementation
2023-12-23 15:26:42 +00:00
zawa-ch 4e2d802967
enhance: “つながりの公開範囲”がフォロー・フォロワー個別設定できるように (#12702)
* Enhance: “つながりの公開範囲”がフォロー・フォロワー個別設定できるように (#12072)

* refactor: crowdin 編集部分のコミットを打ち消し

https://github.com/misskey-dev/misskey/pull/12702#issuecomment-1859417158

* refactor: オブジェクトの名前修正

https://github.com/misskey-dev/misskey/pull/12702#issuecomment-1859417158

* fix: 設定項目の説明を削除

名称が具体的になって必要なくなったため
https://github.com/misskey-dev/misskey/pull/12702#discussion_r1429932463
2023-12-18 20:59:20 +09:00
syuilo 9f49b9f4d2 fix(backend): HTTP Digestヘッダのアルゴリズム部分に大文字の"SHA-256"しか使えない
Fix #12678
2023-12-16 10:58:44 +09:00
woxtu 5cc3d3c873
Remove an unnecessary type assertion (#12666) 2023-12-15 11:22:49 +09:00
MeiMei 238e8ce939
fix: Filter featured collection (#12541) 2023-12-02 19:32:30 +09:00
Jaehong Kang 04075ee0be
enhance(backend): Implementation of HTTP header and body validation to fix SIF-2023-002 (#12334)
Using Buffer instead of string

Co-authored-by: perillamint <perillamint@silicon.moe>
2023-11-15 11:13:34 +09:00
syuilo 65c5626b65
Merge pull request from GHSA-3f39-6537-3cgc
This commit implements HTTP header and body validation to fix
[SIF-2023-002](https://advisory.silicon.moe/advisory/sif-2023-002/)

Signed-off-by: perillamint <perillamint@silicon.moe>
Co-authored-by: perillamint <perillamint@silicon.moe>
Co-authored-by: yunochi <yuno@yunochi.com>
2023-11-14 17:09:45 +09:00
anatawa12 7015cc937b
fix(backend): We can renote pure renote (#12171)
* chore: make pure renote detection an function

* fix: we can renote pure renote

* docs(changelog): リノートをリノートできるのを修正

* fix: remaining debug log

* chore: move isPureRenote to misc

* chore: make isPureRenote type guard

* chore: use isPureRenote in other places

* fix CHANGELOG

* style: fix lint

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-10-30 13:48:22 +09:00
syuilo 4f20c87186 lint fixes 2023-10-09 13:32:41 +09:00
syuilo 053da10e94 refactor(backend): update directory structure for models 2023-09-20 11:33:36 +09:00
syuilo 6cf466e5d1
update deps (#11820)
* update deps

* fix

* wip

* wip

* wip

* Update docker-compose.yml.example

* Delete reviewer-lottery.yml

* Update RepositoryModule.ts

* wip

* wip

* clean up

* update deps

* wip

* wip
2023-09-15 14:28:29 +09:00
syuilo 792622aead
refactor: prefix Mi for all entities (#11719)
* wip

* wip

* wip

* wip

* Update RepositoryModule.ts

* wip

* wip

* wip

* Revert "wip"

This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
2023-08-16 17:51:28 +09:00
Shun Sakai c2370a1be6
chore: 著作権とライセンスについての情報を各ファイルに追加する (#11348)
* chore: Add the SPDX information to each file

Add copyright and licensing information as defined in version 3.0 of
the REUSE Specification.

* tweak format

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-07-27 14:31:52 +09:00
okayurisotto 2b6dbd4fcb
refactor: 可読性のため一部で`Array.prototype.at`を使うように (#11274)
* refactor: `Array.prototype.at`を使うように

* fixup! refactor: `Array.prototype.at`を使うように
2023-07-14 10:45:01 +09:00
okayurisotto e35a370af0
refactor(backend): `core/activitypub` (#11247)
* eslint: `explicit-function-return-type`

* eslint: `no-unnecessary-condition`

* eslint: `eslint-disable-next-line`

* eslint: `no-unused-vars`

* eslint: `comma-dangle`

* eslint: `import/order`

* cleanup: unnecessary non-null assertion

* cleanup: `IActivity`に`actor`は常に存在するようなので

* cleanup: unnecessary `as`

* cleanup: unnecessary `Promise.resolve`

* cleanup

* refactor: `String.prototype.match()`である必要がない部分をよりシンプルな書き方に変更

* refactor: よりよい型定義

* refactor: よりよい型定義

- `LdSignature`の`normalize`メソッドでの使われ方から、
	- `data`引数の型定義を`any`から`JsonLdDocument`へ修正
	- `getLoader`メソッドの返り値の型定義の一部を`any`から`RemoteDocument`へ修正
		- `contextUrl`が不正な値(`null`)となっていたことが判明したため`undefined`へ修正
		- `document`の型と合わせるために`CONTEXTS`の型定義の一部を`unknown`から`JsonLd`へ修正
			- とりあえず`satisfies`を使用
		- `document`の型と合わせるために`fetchDocument`メソッドの返り値の型定義の一部を`unknown`から`JsonLd`へ修正
			- どうしようもなく`as`を使用

* refactor: 型ガードを使うことでnon-null assertionをやめた

* refactor: non-null assertionをやめた

`.filter()`で行っている型ガードなどの文脈から、より適しているだろうと思われる書き方に変更した。

* refactor: 型ガードを使うことで`as`をやめた

* refactor: `as`をやめた

* refactor: よりよい型定義

- `id`は`null`とのunionになっていたが、`null`を渡している場面はなかった
	- またおそらくこのメソッドは`IOrderedCollection`を返すため、そちらに合わせて`null`とのunionをやめた
		- `IOrderedCollection`とはまだ型に相違がある
- `totalItems`をコメントや使われ方を元に`number`へ推論

* refactor: `for-of` -> `Array.prototype.map`

* refactor: `delete`演算子を使わない形に
2023-07-13 12:48:34 +09:00
syuilo 081a14d6f3 perf(backend): use limit() instead of take() 2023-07-08 16:53:07 +09:00
syuilo db1098a180 feat(backend): カスタム絵文字ごとに連合するかどうか設定できるように 2023-05-18 18:48:35 +09:00
Namekuji d28866f71a
enhance: account migration (#10592)
* copy block and mute then create follow and unfollow jobs

* copy block and mute and update lists when detecting an account has moved

* no need to care promise orders

* refactor updating actor and target

* automatically accept if a locked account had accepted an old account

* fix exception format

* prevent the old account from calling some endpoints

* do not unfollow when moving

* adjust following and follower counts

* check movedToUri when receiving a follow request

* skip if no need to adjust

* Revert "disable account migration"

This reverts commit 2321214c98.

* fix translation specifier

* fix checking alsoKnownAs and uri

* fix updating account

* fix refollowing locked account

* decrease followersCount if followed by the old account

* adjust following and followers counts when unfollowing

* fix copying mutings

* prohibit moved account from moving again

* fix move service

* allow app creation after moving

* fix lint

* remove unnecessary field

* fix cache update

* add e2e test

* add e2e test of accepting the new account automatically

* force follow if any error happens

* remove unnecessary joins

* use Array.map instead of for const of

* ユーザーリストの移行は追加のみを行う

* nanka iroiro

* fix misskey-js?

* ✌️

* 移行を行ったアカウントからのフォローリクエストの自動許可を調整

* newUriを外に出す

* newUriを外に出す2

* clean up

* fix newUri

* prevent moving if the destination account has already moved

* set alsoKnownAs via /i/update

* fix database initialization

* add return type

* prohibit updating alsoKnownAs after moving

* skip to add to alsoKnownAs if toUrl is known

* skip adding to the list if it already has

* use Acct.parse instead

* rename error code

* 🎨

* 制限を5から10に緩和

* movedTo(Uri), alsoKnownAsはユーザーidを返すように

* test api res

* fix

* 元アカウントはミュートし続ける

* 🎨

* unfollow

* fix

* getUserUriをUserEntityServiceに

* ?

* job!

* 🎨

* instance => server

* accountMovedShort, forbiddenBecauseYouAreMigrated

* accountMovedShort

* fix test

* import, pin禁止

* 実績を凍結する

* clean up

* ✌️

* change message

* ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに

* Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに"

This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1.

* validateAlsoKnownAs

* 移行後2時間以内はインポート可能なファイルサイズを拡大

* clean up

* どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする

* handle error?

* リモートからの移行処理の条件を是正

* log, port

* fix

* fix

* enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように

* refactor (use checkHttps)

* MISSKEY_WEBFINGER_USE_HTTP

* Environment Variable readme

* NEVER USE IN PRODUCTION

* fix punyHost

* fix indent

* fix

* experimental

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-30 00:09:29 +09:00
hutchisr b7d056fb22
Use unique identifier for each follow request (#10600)
Co-authored-by: anemone <anemoneya@icloud.com>
2023-04-12 20:22:50 +09:00
syuilo 28647de196 enhance(backend): improve userkeypair cache 2023-04-05 12:10:40 +09:00
syuilo 1b21bad202 refactor 2023-02-13 15:50:22 +09:00
syuilo 451bc0b444 refactor: fix types 2023-02-12 18:47:30 +09:00
momoirodouhu f28aea9e30
add cors header to ActivityPubServerService.ts (#9888)
* add cors header to ActivityPubServerService.ts

* Update CHANGELOG.md
2023-02-12 08:22:42 +09:00
syuilo 5facd11592 refactor: fix types 2023-02-09 11:02:37 +09:00
syuilo 21331e53fe refactor: fix types 2023-02-09 10:46:01 +09:00
syuilo 225dbec8b9 64kb 2022-12-25 14:56:59 +09:00
syuilo ab1a433400 fix 2022-12-25 14:53:50 +09:00
syuilo b518c35e00 fix(server): Ap inboxの最大ペイロードサイズを256kbに制限 2022-12-25 14:52:42 +09:00
syuilo 145c15f0d9 fix(server): add missing vary header
Fix #9393
2022-12-23 08:50:58 +09:00
Kagami Sascha Rosylight 4b98920f02
Fix import related TypeScript errors (#9321)
* Add missing @types packages

* Fix TS1272 type only imports

* Fix TS2821 import assertion
2022-12-14 00:01:45 +09:00
syuilo d8611506cf inboxが処理できない問題を多分修正 2022-12-06 09:21:36 +09:00
syuilo bbb49457f9 refactor: introduce bindThis decorator to bind this automaticaly 2022-12-04 15:03:09 +09:00
syuilo 8950114f7d refactor: remove needless const notation 2022-12-04 10:32:12 +09:00
syuilo 22ccb0fa71 refactor 2022-12-04 10:16:03 +09:00
syuilo 3a7182bfb5
Fastify (#9106)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix

* Update SignupApiService.ts

* wip

* wip

* Update ClientServerService.ts

* wip

* wip

* wip

* Update WellKnownServerService.ts

* wip

* wip

* update des

* wip

* Update ApiServerService.ts

* wip

* update deps

* Update WellKnownServerService.ts

* wip

* update deps

* Update ApiCallService.ts

* Update ApiCallService.ts

* Update ApiServerService.ts
2022-12-03 19:42:05 +09:00
syuilo 174a8b1b3e fixes 2022-09-23 06:21:31 +09:00
syuilo 01d4d55e78 fix import type 2022-09-21 05:33:11 +09:00
syuilo a2eac9fff6 test 2022-09-19 03:11:50 +09:00
syuilo b75184ec8e
なんかもうめっちゃ変えた 2022-09-18 03:27:08 +09:00