Commit graph

73 commits

Author SHA1 Message Date
375323bc25
update parameter type and docs 2022-09-02 14:28:55 +02:00
8e5a350f1b Simplify fetching object in resolver.ts
this.user will always be true, so we aren't doing unsigned fetches.
2022-08-21 13:13:34 -04:00
77bfc2450d Remove signToActivityPubGet option
Makes it so that all requests are signed, equivalent to
signToActivityPubGet always being true.
2022-08-21 12:38:43 -04:00
c8afce6b2c
fix blocking of remote accounts
The property name was misspelled.
2022-08-14 11:33:08 +02:00
6ce4b3fe2f
fix some lints
Many of these were fixed automatically with eslint --fix.

Some of them (e.g. adding return types to functions) were done manually.
2022-08-11 00:09:29 +02:00
961fb0d2df
fix: use correct variable
Fixes an error introduced in commit 7a80015225.
2022-08-10 23:59:35 +02:00
7a80015225
fix lint "no-param-reassign" 2022-08-10 16:36:54 +02:00
09a7eabda1
backend: fix lint "no-throw-literal" 2022-08-04 11:00:02 +02:00
c8f49bae76
fix lint "object-shorthand" 2022-08-03 14:58:24 +02:00
37e47a257e
fix lints "import/order" and "import/no-duplicate"
Also simplified some import paths by replacing relative with absolute paths.
2022-08-03 14:05:50 +02:00
a6df127d3b
fix lint "quotes" 2022-08-02 23:25:36 +02:00
6060e7d220
enhance: better rendering of reports
Passing the report object reduces the number of parameters to be passed.
2022-07-19 17:18:19 +02:00
d92d389cda
extract note URLs from Activity 2022-07-19 17:18:18 +02:00
912c19222e
fix lints 2022-07-13 10:42:16 +02:00
yzhe819
9111d238c1
chore: fix lint errors (#8981) 2022-07-13 00:45:57 +02:00
ba0236700d
chore: remove unused imports 2022-07-12 14:41:10 +02:00
9a1e6bf10f fix: render empty note content correctly
Instead of coercing to `null`, coercing to an empty string should simplify handling.
2022-07-09 05:38:38 -04:00
bc9c79b9ef fix: correctly render note text
Fix a regression from #8787 that was previously fixed in #8440.
2022-07-09 05:35:27 -04:00
a683a7092d
enhance(federation): use ActivityPub defined property in favour of proprietary property. (#8787)
* add activitypub `source` property

* parse MFM from new `source` attribute
2022-06-10 14:31:58 +09:00
syuilo
11afdf7e24 fix bug 2022-06-04 15:15:44 +09:00
32dff28460
fix: add id for activitypub follows (#8689)
* add id for activitypub follows

* fix lint

* fix: follower must be local, followee must be remote

Misskey will only use ActivityPub follow requests for users that are local
and are requesting to follow a remote user. This check is to ensure that
this endpoint can not be used by other services or instances.

* fix: missing import

* render block with id

* fix comment
2022-06-04 13:52:42 +09:00
9954c054a7
fix: ensure resolver does not fetch local resources via HTTP(S) (#8733)
* refactor: parseUri types and checks

The type has been refined to better represent what it actually is. Uses of
parseUri are now also checking the parsed object type before resolving.

* cannot resolve URLs with fragments

* also take remaining part of URL into account

Needed for parsing the follows URIs.

* Resolver uses DbResolver for local

* remove unnecessary use of DbResolver

Using DbResolver would mean that the URL is parsed and handled again.
This duplicated processing can be avoided by querying the database directly.

* fix missing property name
2022-06-04 11:29:20 +09:00
81109b14b5
fix: correctly render empty note text (#8746)
Ensure that the _misskey_content attribute will always exist. Because
the API endpoint does not require the existence of the `text` field,
that field may be `undefined`. By using `?? null` it can be ensured
that the value is at least `null`.

Furthermore, the rendered HTML of a note with empty text will also be
the empty string. From git blame it seems that this behaviour was added
because of a Mastodon bug that might have previously existed. Hoever,
this seems to be no longer the case as I can find mastodon posts that
have empty content.

The code could be made a bit more succinct by using the null coercion
operator.
2022-06-03 23:18:44 +09:00
804fa33535
refactor: improve code quality (#8751)
* remove unnecessary if

`Array.prototype.some` already returns a boolean so an if to return
true or false is completely unnecessary in this case.

* perf: use count instead of find

When using `count` instead of `findOneBy`, the data is not
unnecessarily loaded.

* remove duplicate null check

The variable is checked for null in the lines above and the function
returns if so. Therefore, it can not be null at this point.

* simplify `getJsonSchema`

Because the assigned value is `null` and the used keys are only
shallow, use of `nestedProperty.set` seems inappropriate. Because the
value is not read, the initial for loop can be replaced by a `for..in`
loop.

Since all keys will be assigned `null`, the condition of the ternary
expression in the nested function will always be true. Therefore the
recursion case will never happen. With this the nested function can be
eliminated.

* remove duplicate condition

The code above already checks `dragging` and returns if it is truthy.
Checking it again later is therefore unnecessary.

To make this more obvious the `return` is removed in favour of using
an if...else construct.

* remove impossible "unknown" time

The `ago` variable will always be a number and all non-negative numbers
are already covered by other cases, the negative case is handled with
`future` so there is no case when `unkown` could be achieved.
2022-05-29 15:15:52 +09:00
e54aa56ee1
chore: remove unused imports 2022-05-28 21:17:23 +02:00
6b109c7b0f
fix: wrong type for isVisibleForMe 2022-05-24 10:12:42 +02:00
edfded7fb7
fix(activitypub): add authorization checks (#8534)
* fix spelling

* fix(activitypub): add authorization checks
2022-05-19 20:40:16 +09:00
syuilo
ce51ef5df5 refactor 2022-04-17 21:01:02 +09:00
syuilo
31e5c5f69a refactor
Resolve #8467
2022-04-17 20:58:37 +09:00
syuilo
02bb36cdc4 refactor: fix type 2022-04-17 20:44:21 +09:00
syuilo
2d2b3edaaf refactor: fix type 2022-04-17 13:26:31 +09:00
syuilo
ddd655c0c1 refactor: fix type 2022-04-17 13:14:29 +09:00
syuilo
d39465085c refactor: fix type 2022-04-17 12:59:41 +09:00
syuilo
4907dc91f7 lint 2022-04-16 17:18:51 +09:00
syuilo
7f5d189528 fix type 2022-04-03 16:40:47 +09:00
syuilo
ff9a074ab6 fix type 2022-04-03 16:35:36 +09:00
syuilo
91f4ec3747 fix types 2022-04-03 16:30:22 +09:00
syuilo
41c2aed7dc chore: fix lint 2022-04-03 15:33:22 +09:00
syuilo
6b6464a659 fix syntax error 2022-04-02 15:31:11 +09:00
1033e8e57f
fix(federation): avoid duplicate activity delivery (#8429)
* prefer shared inbox over individual inbox

* no new shared inbox for direct recipes

* fix type error
2022-04-02 15:16:35 +09:00
syuilo
17589843da perf(server): use cached user info in getUserFromApId 2022-03-26 19:09:57 +09:00
syuilo
8cbfc047bb refactor 2022-03-26 18:42:37 +09:00
syuilo
3cac8e0f6f perf(server): improve deliver performance 2022-03-26 17:43:08 +09:00
syuilo
1c67c26bd8
refactor: migrate to typeorm 3.0 (#8443)
* wip

* wip

* wip

* Update following.ts

* wip

* wip

* wip

* Update resolve-user.ts

* maxQueryExecutionTime

* wip

* wip
2022-03-26 15:34:00 +09:00
syuilo
ac8c66f5ab perf(server): refactor and performance improvements 2022-03-25 16:27:41 +09:00
725b78349a
recognize null in _misskey_content for notes (#8440) 2022-03-23 03:16:04 +09:00
MeiMei
ba9563b983
Use unique id for Undo (#8434) 2022-03-22 00:39:00 +09:00
syuilo
21de5c4a9c perf(server): reduce db query 2022-03-21 05:42:11 +09:00
syuilo
aebd77ad38 perf(server): reduce db query 2022-03-20 15:44:49 +09:00
xianon
0a6c9a00bd
リレーが動作するように修正する (#8396) 2022-03-12 13:21:04 +09:00