Commit graph

30 commits

Author SHA1 Message Date
34d55e2dda
server: better matching for MFM mentions
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
When rendering the HTML for outgoing activities, the mentions are now
matched case insensitive and should also work properly for IDNs. The
username is also compared case insensitive. Mentions of local users
are also handled properly independed of whether the hostname was given
or omitted.

The query to get mentions is now also only executed once instead of
for each mention individually.

Changelog: Fixed
2023-04-28 23:47:48 +02:00
18664dbca3
server: add missing paren
All checks were successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
How did this not break yet?
2022-12-07 18:29:04 +01:00
97052b1f61
server: refactor fromHtml attribute handling
All checks were successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
Also try to recognize owncast hashtag links.
2022-12-04 03:43:22 +01:00
194fff3603
activitypub: hashtags no longer displaying as links
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
Some hashtags sent from Mastodon were erroneously displayed as links.
This is because Mastodon seems to mangle hashtags containing non-ASCII
codepoints (such as e.g. umlauts). This lead to the previous code which
depended on the list of hashtags to not recognize a hashtag. Instead,
the `rel="tag"` microformat is recognized instead.

This makes the `htmlToMfm` wrapper function unnecessary so it was removed.

Changelog: Fixed
2022-12-02 19:31:57 +01:00
9fd23b5dae
server: remove quote urls, 3rd try
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
First try was 66a7c62342 but classList is
not in parse5 DOM. Second try was 7ee6a09cf2
but forgot the contents of this commit.
2022-11-27 09:30:51 +01:00
7ee6a09cf2
fix errors from quote string removal
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
The parse5 tree does not have the full DOM methods and attributes.
2022-11-21 19:43:56 +01:00
66a7c62342 activitypub: remove akkoma quote URLs
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
Changelog: Fixed
2022-11-20 20:48:15 +00:00
b0489abd7f
translate japanese comments
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2022-11-13 13:47:22 +01:00
a2fad7ce61
backend: fix mentionedUsers and userInfo queries
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
Turns out `getMany` doesn't work with the specific query used, so use
`getRawMany` instead.

Also fixup the predicate used in userInfo to use the correct field
names.
2022-09-11 15:28:35 -04:00
9bcc247421
backend: Fix appendChildren TypeError
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
In #134, the mention `MfmNode` handler was made async to allow the
mentionedUsers query to be used there. This however changed the return
type of that handler to be a `Promise`, causing a `TypeError` in
`appendChildren`.

This fixes the `TypeError` by making every handler and the `appendChildren`
function also async and awaiting on the processed children.

This also attempts to fix the types issue with handlers by casting to
the newly defined `HandlerFunc` type instead of to `any`.
2022-09-11 14:29:37 -04:00
199622b415
add check if ids.length > 0 before executing query
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2022-09-08 17:47:23 -04:00
19e29c3465
backend: move mentionedUsers query to mention handler
Some checks failed
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
The mentionedUsers query was being run on every post, regardless of
whether a mention was in it or not.

This resulted in an SQL query ending in `WHERE userId IN ()` which is
not allowed in PostgreSQL.

Reference: #132
Changelog: Fixed
2022-09-08 16:17:35 -04:00
c33655bc4f backend: fix table name used in toHtml
Some checks failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
2022-09-08 17:14:23 +00:00
f21e1afaa4
backend: fix query for mentionedUsers
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2022-09-07 13:34:38 -04:00
3bdbbcadd9
adjust MFM to HTML conversion
Removed the misc/get-note-html module which was only used in one place.
Instead of it, the general MFM to HTML functionality has been improved to
take care of the use cases of that module as well.

Co-authored-by: Francis Dinh <normandy@biribiri.dev>
2022-09-07 14:42:39 +02:00
b230dc98a9
fix import path for TreeAdapter
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
2022-08-26 00:15:21 -04:00
4f2a9f8911
refactor: adjust HTML mention microformat
Some checks failed
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/test Pipeline failed
Adjust the federated HTML microformat to the one that is documented
at <https://docs.joinmastodon.org/spec/microformats/>, namely adding
the missing surrounding tag with the class `h-card`.
2022-08-25 00:06:11 +02:00
f119914b98
refactor: use optional chaining and nullish coalescing 2022-08-25 00:06:11 +02:00
6ce4b3fe2f
fix some lints
Some checks failed
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/test Pipeline failed
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
7a80015225
fix lint "no-param-reassign"
Some checks failed
ci/woodpecker/push/build Pipeline failed
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/lint-client Pipeline failed
2022-08-10 16:36:54 +02:00
MeiMei
6c330a1343
migrate parse5 to 7.0.0 (#8916)
* migrate parse5 to 7.0.0

* fix
2022-07-15 10:14:36 +02:00
syuilo
b6a31bdfcb
use parse5 6.0.1
Fix #8914
2022-07-15 10:14:36 +02:00
syuilo
ffa86c1d76
update deps 2022-07-15 10:09:44 +02:00
025bf4a5e7
fix(mfm): remove duplicate br tag/newline (#8616) 2022-05-31 18:57:55 +09:00
syuilo
d071d18dd7
refactor: Use ESM (#8358)
* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
2022-02-27 11:07:39 +09:00
syuilo
bd7662e5e4 refactor 2022-02-04 11:10:53 +09:00
af022fd8b8
fix html blockquote conversion (#8069) 2021-12-29 04:15:28 +09:00
syuilo
c69b72e199 fix lint 2021-12-09 23:58:30 +09:00
syuilo
b9eaf906e7 fix lint errors 2021-11-12 10:52:10 +09:00
syuilo
0e4a111f81 refactoring
Resolve #7779
2021-11-12 02:02:25 +09:00