Commit Graph

617 Commits

Author SHA1 Message Date
Michael Demetriou efbef83362 make sure app exits after error in --sections argument 2019-06-21 10:40:40 +03:00
Matt Baer 77bf403443 Merge branch 'develop' into private-instance 2019-06-20 21:10:36 -04:00
Matt Baer 86a128483b Fix more missing hostNames
This fixes places, especially around federation, where the Collection's
`hostName` wasn't set.
2019-06-20 21:08:30 -04:00
Michael Demetriou 07fe366c15 Fix T657: add --sections argument to allow partial configuration.
Use the split argument list (slice) just for validation purposes
as it's substantially easier to do `.contains` in a string instead
of a slice. As such, pass the `configSections` arguments to
`Configure()` and check the existence of each one before showing
the options to the user.

An empty argument list is replaced by "server db app" so everything
is there negating the need to check anything else in `Configure()`.
In the same vein the default is "server db app".

The parsing is done in `app.go` alongside the other flags instead
of `main.go` as described in T657.
2019-06-20 23:41:03 +03:00
Michael Demetriou 1d5c396327 Add --sections flag to app.go and pass it to setup.go
Add --sections flag to app.go according to T657, parse them
into a string array (check for invalid arguments and abort)
and pass them to Configure(). For now Configure() doesn't do
anything with them yet.
2019-06-20 23:14:36 +03:00
Matt Baer bbd775bcc6 Always initialize database after --config
Previously, this would only run when configuring an instance for
single-user usage. Now it'll also run when configuring for multi-user
usage.

It also adds a log when the database has already been initialized.
2019-06-20 09:04:52 -04:00
Matt Baer 2b39b714de Use UserLevelReader func for read routes
Previously, that func was duplicated here.
2019-06-19 19:26:10 -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 d6a77d6668 Check reader permissions on RSS feed & sitemap
(on private instances)

Ref T576
2019-06-16 21:16:23 -04:00
Matt Baer 63b536ec87 Don't federate anything when instance is private
Ref T576
2019-06-16 20:34:32 -04:00
Matt Baer 35718cd239 Change blog visibility explanations on Private instance
Ref T576
2019-06-16 20:30:56 -04:00
Matt Baer bf989eb696 Hide Reader link on private instance when unauth'd
Ref T576
2019-06-16 20:29:31 -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 161f7a8de2 Support changing landing conf val from Admin UI
Closes T651
2019-06-16 17:38:34 -04:00
Matt Baer 2b8b52285d
Merge pull request #122 from writeas/update-script
Update script

Closes T555
2019-06-14 20:36:07 -04:00
Rob Loranger 075f25b829
fix: update script: non-standard version numbers
store version output in new variable
slice output indexed from beginning instead of end. allowing for custom
build version numbers.

also fix weird spacing from tabs being two spaces wide, sorry :)
2019-06-14 17:26:56 -07:00
Matt Baer 872ec4809b Tweak status wording
And fix a typo

Ref T555
2019-06-14 19:50:41 -04:00
Matt Baer ac7d727435
Merge pull request #102 from writeas/librarization
Decouple writefreely library from executable

Ref T613
2019-06-14 19:25:24 -04:00
Matt Baer 36b160b706 Add TODO for multierror 2019-06-14 19:12:14 -04:00
Matt Baer f38a135bfa Remove global hostName var
This moves `hostName` to the `Collection` struct, where it's needed. The
field is populated after successful `GetCollection...()` calls.

This isn't the cleanest way to do things, but it accomplishes the goal.
Eventually, we should accept the AppCfg to `GetCollection...()` calls,
or make them `App` methods, instead of `datastore` methods.

Ref T613
2019-06-14 18:54:04 -04:00
Matt Baer 4c34b34736 Exit when no writefreely executable found
(or `writefreely -v` otherwise doesn't output anything)

Ref T555
2019-06-14 16:43:18 -04:00
Rob Loranger f6ba1fc9c8
update script: error check restarting service
basic error check with descriptive output in update_server.sh
2019-06-14 10:05:08 -07:00
Rob Loranger 0c44fe1c2e
add update script
this bash script will download a new version, if any, and exrtact it to
a temporary location. Then copy the new files to the current directory
and restart the systemd service.
2019-06-14 09:55:31 -07:00
Matt Baer 26a0990014 Save config via Apper interface from Admin dash
Ref T613
2019-06-13 21:56:13 -04:00
Matt Baer d5c2fe47da
Merge branch 'develop' into librarization 2019-06-13 20:44:55 -04:00
Matt Baer 830b859421 Fix activitypub.go imports 2019-06-13 20:44:13 -04:00
Matt Baer a10a4e9a28 Merge branch 'develop' into librarization 2019-06-13 20:39:52 -04:00
Matt Baer be0547a62c Include schema.sql when built with wflib tag
This ensures outside application builds will succeed when including the
writefreely pkg.

Ref T613
2019-06-13 20:25:30 -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 ed4aacd1ac Move static file ServeMux to App struct 2019-06-13 18:45:03 -04:00
Matt Baer f8de8f7f21 Merge branch 'librarization' of github.com:writeas/writefreely into librarization 2019-06-13 13:48:05 -04:00
Matt Baer eb6349f93a Allow compiling without go-sql-driver/mysql pkg
This ensures the writefreely pkg can be used in other applications that
need to load mysql themselves -- this can be done by building with the
tag: wflib

Ref T613
2019-06-13 13:47:27 -04:00
Matt Baer 23acabaeb3 Use db.isDuplicateKeyErr() in activitypub.go
(instead of writing out the logic of that helper function)

Ref T613
2019-06-13 13:47:37 -04:00
Matt Baer 758269e3d8 Move key generation and Keychain to key pkg
Ref T613
2019-06-13 13:47:28 -04:00
Matt Baer 584fe4fb93 Support changing default landing path
This adds a new `landing` value in the [app] section of config.ini.
If non-empty, unauthenticated users on multi-user instances will be
redirected to the path given there.

This closes T574
2019-06-13 13:47:27 -04:00
Michael Demetriou 9570388d1d Fix #96
This solves the error 500 on the /api/me endpoint.

Replace token search query `=` with `LIKE` to fix sqlite complaining about
no valid tokens. Also checked with MySQL and it still works after the change.
2019-06-11 20:18:58 +03:00
Matt Baer b2a9429db0
Merge pull request #117 from writeas/T612
change delete post authentication logic
2019-06-05 16:18:08 -04:00
Rob Loranger d58c142467
change delete post authentication logic
this reorders the logic for checking authentication on post deletes to
first check for a provided edit token and after check for an access
token or auth'd user.
2019-06-05 09:39:22 -07:00
Matt Baer c87b7ab39e
Merge pull request #111 from writeas/gh100
support pubgate
2019-06-03 16:37:36 -04:00
Rob Loranger 08799b220b
revert accidental .vscode folder inclusion 2019-06-03 11:55:42 -07:00
Rob Loranger d8fa85432d
fix for Pubgate user not having SharedInbox 2019-06-03 11:53:17 -07:00
Rob Loranger 702db2bf75
Merge branch 'gh100' of github.com:writeas/writefreely into gh100 2019-06-03 11:52:44 -07:00
Matt Baer 73f627a6c2
Merge pull request #110 from writeas/fix-rtl
Enable un-setting RTL setting via web
2019-06-02 13:19:32 -04:00
Matt Baer f82e11b3b3
Merge pull request #115 from writeas/blog-index-titles
Make post body h2's smaller on index pages
2019-06-01 12:16:36 -04:00
Matt Baer 6bf4e1a52e Add spacing around time element on index pages
This adds a small margin around a time element, which makes things look
better when the body of a post starts with a header.
2019-06-01 09:26:58 -04:00
Matt Baer 4b1ca3e296 Make post body h2's smaller on index pages
Previously, <h2>s in a post were the exact same size as post titles on
index pages (blog index, tag listing). This fixes that by reducing the
font-size of body h2's. Closes #82.
2019-06-01 09:17:28 -04:00
Matt Baer 68bd5ef01a
Merge pull request #114 from writeas/export-title
Include post title in zip export txt files
2019-05-31 09:26:20 -04:00
Matt Baer cba7f1223e Include post title in zip export txt files 2019-05-30 10:38:55 -04:00