Commit graph

547 commits

Author SHA1 Message Date
tsmethurst 7bfcc5f505 skip long search if local account 2022-06-02 17:08:15 +02:00
tsmethurst 8ac9001df2 simplify GetParseMentionFunc 2022-06-02 17:07:59 +02:00
tsmethurst 5e993f6799 add more extraction tests 2022-06-02 17:07:29 +02:00
tsmethurst c53226cf99 be more permissive in namestring lookup 2022-06-02 16:39:48 +02:00
tsmethurst 5fc230710d final search for discovered accountDomain 2022-06-02 16:38:44 +02:00
tsmethurst 2edc5c702a don't repeat regex parsing 2022-06-02 16:38:30 +02:00
tsmethurst d2c512575c increase default worker count to 4 per cpu 2022-06-02 15:52:12 +02:00
tsmethurst c1f225f373 test webfinger part extraction 2022-06-02 13:39:16 +02:00
tsmethurst 61a8d97bc3 don't finger instance accounts 2022-06-02 13:39:08 +02:00
tsmethurst 2f1b638357 update mentionName regex
recognize instance accounts
2022-06-02 13:38:56 +02:00
tsmethurst c0ab7f5d69 cheeky linting with the lads 2022-06-02 12:56:21 +02:00
tsmethurst bbe2985d9b webfinger only if necessary 2022-06-02 12:38:59 +02:00
tsmethurst 49490d8999 fix up tests to use main mock httpclient 2022-06-02 12:38:39 +02:00
tsmethurst 181f782d13 break a lot of tests
Move shared test logic into the testrig,
rather than having it scattered all over
the place. This allows us to just mock
the transport controller once, and have
all tests use it (unless they need not to
for some other reason).
2022-06-01 18:13:16 +02:00
tsmethurst 1a3f974223 start updating tests to remove repetition 2022-06-01 16:11:02 +02:00
tsmethurst 098aa4f781 rework GetRemoteAccount 2022-06-01 16:10:41 +02:00
tsmethurst aaeef76ceb fix for new getRemoteAccount 2022-06-01 16:10:28 +02:00
tsmethurst f34844850c fix incorrect debug call 2022-06-01 16:07:44 +02:00
tsmethurst 997e6f6c06 use new ASRepToAccount signature 2022-06-01 11:50:46 +02:00
tsmethurst b23fdac317 remove refresh from account 2022-06-01 11:50:30 +02:00
tsmethurst 3de882a255 just a real nasty commit, the worst 2022-05-31 16:58:08 +02:00
tsmethurst a4c64bd56d rework finger again, final form 2022-05-31 16:57:43 +02:00
tsmethurst 124ff8ca0b use accountDomain 2022-05-31 16:57:32 +02:00
tsmethurst 8ffb1a8845 use util function to extract webfinger parts 2022-05-31 12:26:55 +02:00
tsmethurst e8a65b9675 rework webfingerget 2022-05-31 12:26:40 +02:00
tsmethurst 863231cc97 move mention parts to namestring 2022-05-31 12:26:31 +02:00
tsmethurst c746b00731 start reworking getRemoteAccount a bit 2022-05-30 18:45:38 +02:00
tsmethurst af018e42c0 start reworking finger func a bit 2022-05-30 18:45:25 +02:00
tsmethurst 6a9b6afdf3 totally break GetRemoteAccount 2022-05-30 16:20:10 +02:00
tsmethurst 95b6c1b866 move finger to dereferencer 2022-05-30 16:19:52 +02:00
kim 43ac0cdb9c
[chore] Global server configuration overhaul (#575)
* move config flag names and usage to config package, rewrite config package to use global Configuration{} struct

Signed-off-by: kim <grufwub@gmail.com>

* improved code comment

Signed-off-by: kim <grufwub@gmail.com>

* linter

Signed-off-by: kim <grufwub@gmail.com>

* fix unmarshaling

Signed-off-by: kim <grufwub@gmail.com>

* remove kim's custom go compiler changes

Signed-off-by: kim <grufwub@gmail.com>

* generate setter and flag-name functions, implement these in codebase

Signed-off-by: kim <grufwub@gmail.com>

* update deps

Signed-off-by: kim <grufwub@gmail.com>

* small change

Signed-off-by: kim <grufwub@gmail.com>

* appease the linter...

Signed-off-by: kim <grufwub@gmail.com>

* move configuration into ConfigState structure, ensure reloading to/from viper settings to keep in sync

Signed-off-by: kim <grufwub@gmail.com>

* lint

Signed-off-by: kim <grufwub@gmail.com>

* update code comments

Signed-off-by: kim <grufwub@gmail.com>

* fix merge issue

Signed-off-by: kim <grufwub@gmail.com>

* fix merge issue

Signed-off-by: kim <grufwub@gmail.com>

* improved version string (removes time + go version)

Signed-off-by: kim <grufwub@gmail.com>

* fix version string build to pass test script + consolidate logic in func

Signed-off-by: kim <grufwub@gmail.com>

* add license text, update config.Defaults comment

Signed-off-by: kim <grufwub@gmail.com>

* add license text to generated config helpers file

Signed-off-by: kim <grufwub@gmail.com>

* defer unlock on config.Set___(), to ensure unlocked on panic

Signed-off-by: kim <grufwub@gmail.com>

* make it more obvious which cmd flags are being attached

Signed-off-by: kim <grufwub@gmail.com>
2022-05-30 14:41:24 +02:00
tobi ae5402ada6
[chore] Mastodon api fixups (#617)
* don't omitempty on description

* don't omitempty on any fields

* add ms to timestamp format

* don't omitempty on text_url

* rearrange attachment fields a bit

* just give URL again as attachment text url

* update tests

* fix accidental replace
2022-05-28 18:59:55 +01:00
Sashanoraa 323dbca4f7
[frontend] Reduce width of profile img with screen width (#615)
The commit makes the profile image on the profile page reduce in width
if the screen width is less then it's normal width while maintaining
it's 1:1 aspect ration.

Signed-off-by: Sashanoraa <sasha@noraa.gay>
2022-05-28 13:19:24 +02:00
Sashanoraa 8de9b7a34b
[frontend] Add padding to the bottom of main (#616)
This way the footer doesn't touch on the content on mobile.

Signed-off-by: Sashanoraa <sasha@noraa.gay>
2022-05-28 13:18:35 +02:00
tobi 2b11d4b7b0
[bugfix] Add accept: application/activity+json to dereferencer (#611)
* add Accept application/activity+json to transport

* add application/activity+json comma-separated
2022-05-27 20:09:57 +01:00
tobi 73d5766572
[chore] Debug failed account get (#612) 2022-05-27 16:44:33 +02:00
tobi dc8cc7e364
[chore] Add test for dereferencing Owncast service account (#613) 2022-05-27 16:35:35 +02:00
tobi 1cdc163276
[performance] Don't retry/backoff invalid http requests that will never succeed (#609)
* add httpguts (ew)

* add ValidateRequest err wrapping logic

* don't retry on unrecoverable errors

* i am very clever
2022-05-26 13:38:41 +02:00
tobi 0f01f72db0
[performance] Bump default workers to CPUs * 2 (#608)
* add license text to workers.go
* bump default workers to maxprocs*2
2022-05-26 11:51:59 +02:00
tobi 5668ce1ec7
[bugfix] Fix HTML escaping in instance title (#607)
* move caption sanitization -> sanitize.go

* use sanitizeplaintext rather than removehtml

* rename sanitizecaption to sanitizeplaintext

* avoid removing html twice from statuses

* unexport remoteHTML
it's no longer used outside the text package so this
makes it less confusing

* test instance PATCH
2022-05-26 11:37:13 +02:00
tobi f848aaa81f
[security] Set SameSite to strict instead of browser default (#606) 2022-05-25 18:08:12 +02:00
tobi a54efa09f9
[chore] Serialize times as UTC ISO8601 instead of RFC3339 (#602)
* add time util to mimic utc ISO8601

* use ISO8601 when serializing to frontend

* update test notification
2022-05-24 17:21:27 +01:00
tobi 196d542e4a
[bugfix] Don't serialize instance account if not set (#603)
* omit contactAccount from json if not set

* test instance serialization
2022-05-24 17:20:13 +01:00
tobi 2d748a68ae
[bugfix] Only search remote if protocol is http(s) (#601) 2022-05-24 13:38:11 +02:00
tobi 21557c92d9
[bugfix] Set refetch to true in iterateDescendants (#600) 2022-05-24 11:00:37 +02:00
tobi f0c9f4169b
[bugfix] Fix multiple dereferences of boosted status causing media duplication (#589)
* add some announces to test models

* start on announce test logic

* test federatingDB.Announce

* change signature of GetRemoteStatus

* remove 'refresh' logic and replace it with refetch

* go fmt

* remove timeline manager from processor test

* make zork created at determinate

* test get account statuses

* test get + serialize zork

* make account keys determinate

* make admin accountCreate time determinate

* test account to as

* init test config before test log

* test status to frontend

* remove daft Within check

* hack around a bit

* use index of slice
2022-05-23 16:40:03 +01:00
Mina Galić 1461adfd3a
[docs] document a checklist for how to go about a release (#592)
This is the way.
well, my recommendations, anyway.
2022-05-23 17:16:12 +02:00
tobi f5a4f4321a
[bugfix] Fix error extracting status content: no content found (#598)
* don't return error if no content found in Activity

* add test for content extraction

* go fmt
2022-05-23 16:12:46 +01:00
tobi a09e101931
[bugfix] If status URL is empty, use URI instead and don't log unnecessary error (#597)
* test parse status with no URL

* if no status URL is available, use the URI instead
2022-05-23 16:10:48 +01:00
tobi 469da93678
[security] Check all involved IRIs during block checking (#593)
* tidy up context keys, add otherInvolvedIRIs

* add ReplyToable interface

* skip block check if we own the requesting domain

* add block check for other involved IRIs

* use cacheable status fetch

* remove unused ContextActivity

* remove unused ContextActivity

* add helper for unique URIs

* check through CCs and clean slice

* add GetAccountIDForStatusURI

* add GetAccountIDForAccountURI

* check blocks on involved account

* add statuses to tests

* add some blocked tests

* go fmt

* extract Tos as well as CCs

* test PostInboxRequestBodyHook

* add some more testActivities

* deduplicate involvedAccountIDs

* go fmt

* use cacheable db functions, remove new functions
2022-05-23 11:46:50 +02:00