Commit Graph

21 Commits

Author SHA1 Message Date
Matt Baer af23e28d05 Pass OAuth requests through new OAuth handler
This gives us our standard logging and passes around errors with
impart.HTTPError.

Ref T705
2019-12-30 18:14:01 -05:00
Nick Gerakines 7a0863f71b Added oauth handlers and tests with mocks. Part of T705. 2019-12-19 11:51:19 -05:00
Rob Loranger f87371b594
update IsJSON to check for Accept header
this changes the helper IsJSON to take a request instead of a string,
allowing to check multiple headers. In this case both Content-Type and
Accept.
2019-09-18 12:39:53 -07:00
Matt Baer b06d1c2762
Merge pull request #143 from writeas/collection-404
Style collection 404 page like rest of blog

Resolves T493
2019-08-07 10:39:38 -04:00
Matt Baer 35906118d0 Return only 404 on ActivityPub coll post request
Ref T493
2019-08-07 10:18:40 -04:00
Matt Baer 5953a50f4a Let Apper set request log format
This adds a new ReqLog() func to the Apper interface that'll return the
log message for incoming requests.

Ref T649
2019-08-01 16:12:22 -04:00
Matt Baer 60a6848361 Fix userlevel error logging
Previously, we just included the value of `ul`, which is a func. This
now calls `ul()` and logs that value.
2019-07-01 16:45:35 -04:00
Matt Baer 44a4fd7a79 Correctly log and return after serving static file 2019-06-19 19:17:45 -04:00
Matt Baer 7dc620aff1 Check reader permissions on .well-known endpoints
(for private instances)

Ref T576
2019-06-16 21:22:56 -04:00
Matt Baer a2088c1646 Restrict API read access based on Private setting
This verifies that a user is authenticated before getting to the actual
handler on API endpoints where a user is reading content.

Ref T576
2019-06-16 20:24:47 -04:00
Matt Baer b3a36a3be7 Allow completely private instances, part 1
This is the start of all changes needed to support entirely private
instances, where all blogs are only visible to other authenticated users
on an instance (ref T576). It begins by changing how Handler methods check an
endpoint's permissions.

- Renames UserLevelLEVEL consts to UserLevelLEVELType
- Adds UserLevelLEVEL funcs with same names as previous consts. Each
  returns a UserLevel
- Adds a new UserLevelReader that restricts access based on app
  configuration. This is now used on collections and posts.
- Changes routing a bit so static files are always accessible
2019-06-16 18:55:50 -04:00
Matt Baer 26a0990014 Save config via Apper interface from Admin dash
Ref T613
2019-06-13 21:56:13 -04:00
Matt Baer 034db22f8c Break functionality out of Serve() func
- Adds a new interface, Apper, that enables loading and persisting
  instance-level data in new ways
- Converts some initialization funcs to methods
- Exports funcs and methods needed for intialization
- In general, moves a ton of stuff around

Overall, this should maintain all existing functionality, but with the
ability to now better manage a WF instance.

Ref T613
2019-06-13 18:50:23 -04:00
Matt Baer d8937e89a8 Make App struct public 2019-05-12 17:19:38 -04:00
Matt Baer 8513def899 Send correct status on 410/500 in handleHTTPError 2019-01-03 15:43:44 -05:00
Matt Baer 19215b0355 Send correct status on 404 in handleHTTPError 2019-01-03 12:27:52 -05:00
Matt Baer 3ae45bc156 Fix spacing around copyright notices 2018-12-31 01:05:26 -05:00
Matt Baer 1274914207 Add copyright / license notices to .go files 2018-12-24 12:45:15 -05:00
Matt Baer 7d87aad55a Add basic admin dashboard with app stats
Start of T538
2018-11-18 20:18:22 -05:00
Matt Baer 704558114d Remove r.Host from server logs 2018-11-11 09:40:18 -05:00
Matt Baer a30fc5b52b Add handler, page, template loading 2018-11-07 23:50:50 -05:00