Commit graph

565 commits

Author SHA1 Message Date
kim c4682d19f9 Merge remote-tracking branch 'upstream/validate/set-accountDomain' 2022-06-11 09:56:00 +01:00
tsmethurst c4a223b7b7 fix broken test 2022-06-11 10:48:14 +02:00
tsmethurst 54d9778c4c Merge branch 'main' into webfinger_rework 2022-06-11 10:44:00 +02:00
tobi 694a490589
[feature] Add created_at and error_description to /oauth/token endpoint (#645)
* start fiddling about with oauth server

* start returning more helpful errors from oauth

* test helpful(ish) token errors

* add missing license header
2022-06-11 10:39:39 +02:00
tobi 2385b51d58
[bugfix] Make accounts media_only query also work with pg (#643) 2022-06-10 10:56:49 +02:00
tobi 5864954e2e
[bugfix] Fix domain blocks get regression (#642)
* fix domain blocks get regression

* add missing license text headers
2022-06-09 13:28:15 +02:00
f0x52 b43f9ceca9
[frontend] Restructure Frontend Sources (#634)
* 🐸restructure frontend stuff, include admin and future user panel in main repo, properly deduplicate bundles for css+js across uses

* rename bundled to dist, caught by gitignore

* re-include status.css for profile template

* default to localhost

* serve frontend panels

* add todo message for abstraction

* refactor oauth registration flow

* oauth restructure

* update footer template

* change panel routes

* remove superfluous css imports

* write bundle to disk from test server, use forked budo-express

* wrap all page content in container

for robustness with addons etc injection other elements in body

* update documentation, goreleaser, Dockerfile

* update template meta tags

* add AGPL-3.0+ license header everywhere

* only attach update listener on EventEmitter

* cleaner config for various frontend bundles

* fix bundler script paths

* Merge commit 'd191931932b9293ce1be44ed08a1e69b9fcc1e25'

* fix up dockerfile, goreleaser

* go mod tidy

* add uglifyify

* move status hide/show js to frontend bundle

* fix stylesheet color( func regressions

* update contributing docs for new build path

* update goreleaser + docker building

* resolve dependency paths properly

* update package name

* use api errorhandler

Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
2022-06-09 12:51:19 +02:00
f0x52 f30a581268
[chore] gitignore shell.nix (#639) 2022-06-08 21:31:12 +02:00
tobi 1ede54ddf6
[feature] More consistent API error handling (#637)
* update templates

* start reworking api error handling

* update template

* return AP status at web endpoint if negotiated

* start making api error handling much more consistent

* update account endpoints to new error handling

* use new api error handling in admin endpoints

* go fmt ./...

* use api error logic in app

* use generic error handling in auth

* don't export generic error handler

* don't defer clearing session

* user nicer error handling on oidc callback handler

* tidy up the sign in handler

* tidy up the token handler

* use nicer error handling in blocksget

* auth emojis endpoint

* fix up remaining api endpoints

* fix whoopsie during login flow

* regenerate swagger docs

* change http error logging to debug
2022-06-08 20:38:03 +02:00
kim 91c0ed863a
[bugfix] #621: add weak type handing to mapstructure decode (#625)
* Drone sig (#623)

* accept weakly typed input on mapstructure decode i.e. .UnmarshalMap()

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

* add envparsing script to test for panics during environment variable parsing

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

* add envparsing.sh script to drone commands

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

* update drone signature

Co-authored-by: kim <grufwub@gmail.com>

* compare expected with output

* update expected output of envparsing

* update expected output to correct value

* use viper's unmarshal function instead
There were problems with marshalling
string slices from viper into the st.config
struct with the other function. Now, we
can use viper's unmarshal function and pass
in the custom decoder config that we need
as a hook. This ensures that we marshal
string slices from viper into our config
struct correctly.

Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
2022-06-08 20:28:28 +02:00
f0x52 4e6625ee2d
[feature] add vscode workspace config for linting + debugging (#588)
* vscode workspace config for debug run + linting

* ignore debug build file
2022-06-08 20:26:44 +02:00
tobi 6f6e89e271
[feature] Add paging via Link header for notifications and account statuses (#629)
* test link headers

* page get account statuses properly

* page get notifications

* add util func for packaging timeline responses

* return timelined stuff from accountstatusesget

* rename timeline response

* use new convenience function

* go fmt
2022-06-08 20:22:49 +02:00
f0x52 99fab9c6b6
[frontend] linkify header mascot+title (#633) 2022-06-08 02:22:52 +02:00
tobi f3b44426f4
[bugfix] Update time marshalling format to provide 3 digits of ms (#630) 2022-06-04 20:03:01 +02:00
tobi 327d3f001f
[feature] Start adding advanced configuration options, starting with samesite (#628)
* fix incorrect port being used for db

* start adding advanced config flags

* use samesite lax by default
2022-06-03 15:40:38 +02:00
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
0hlov3 265b680098
[chore] Adds Issue templates to Github (#626)
* Adds ISSUE Templates

* Corrects the ISSUE_Templates
2022-06-01 18:18:25 +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
tsmethurst b0299d2343 set/validate accountDomain 2022-05-30 15:30:58 +02:00
tsmethurst c089a04183 add miekg/dns dependency 2022-05-30 15:30:38 +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