Commit Graph

28 Commits

Author SHA1 Message Date
Matt Baer 484d2736ce Update repo URL to writefreely org
From the writeas org on GitHub.
2021-04-06 17:24:07 -04:00
Josip Antoliš 1b1d3064c9 Move cacheControl func into handle.go file 2020-09-04 22:03:42 +02:00
Matt Baer f75d4cb75d
Merge pull request #327 from Dar13/add-cors-headers-public-api
Add CORS header ('Access-Control-Allow-Origin') to public APIs
2020-09-01 15:01:33 -04:00
Matt Baer 6dbc753ecb Merge branch 'develop' into gopher 2020-07-23 11:47:49 -04:00
Neil Moore 94bcb91220 Add CORS header ('Access-Control-Allow-Origin') to 'AllReader'
Allows all API endpoints using 'AllReader' to be queryable by any
origin.
2020-06-23 20:33:30 -04:00
Matt Baer 0285a9b0bd Show 503 page on collections under high load
This acknowledges "too many connections" and "max user connections"
errors in MySQL and propagates the error up the chain so we can notify
the user and return the correct HTTP code.
2020-03-18 16:14:05 -04:00
Matt Baer 6aa8de3a4b Add Gopher support
This adds gopher support to WriteFreely -- both single- and multi-user
instances. It is off by default, but can be enabled with the new
`gopher_port` config value in the `[server]` section.

When enabled, multi-user instances will show all public blogs at
gopher://[host]:[gopher_port]/ -- otherwise, blogs are accessible at
gopher://[host]:[gopher_port]/[blog]/

This is just a proof of concept for now. We still need to handle some
edge cases and different configurations, like private instances.

Ref T559
2020-03-01 20:12:47 -05:00
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