Commit graph

455 commits

Author SHA1 Message Date
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
Matt Baer
cf51fc4886
Merge pull request #113 from writeas/fix-json-export-2
Modify GetPost() to allow inclusion of pinned posts
2019-05-29 12:18:04 -04:00
Noëlle Anthony
f271e53925 Update GetPosts() docstring 2019-05-29 12:03:01 -04:00
Noëlle Anthony
95e84a1d0e Change GetPosts() to have includePinned parameter, change all calls to match 2019-05-28 14:54:56 -04:00
Rob Loranger
95215aa39d
fixes issue #100 - can't follow from pubgate
this moves the unmarshaling of a remote actor out into a new helper which
accounts for the possibility of a context being a list or a single entity.
i.e. a string or an object.

basics tests are provided for both situations

also go fmt'd the file activitypub.go
2019-05-24 19:38:35 -07:00
Matt Baer
cf1d2d30e9 Merge branch 'agd' into librarization 2019-05-23 08:26:52 -04:00
Rob Loranger
ff2d3fc3d5
fixes issue #100 - can't follow from pubgate
this moves the unmarshaling of a remote actor out into a new helper which
accounts for the possibility of a context being a list or a single entity.
i.e. a string or an object.

basics tests are provided for both situations

also go fmt'd the file activitypub.go
2019-05-21 07:02:35 -07:00
Rob Loranger
3986c8eec1
add missing string variable in log statement in export.go + go fmt 2019-05-20 14:51:54 -07:00
Matt Baer
b6da5d9711
Merge pull request #107 from writeas/go-bindata-as-dep
Add go-bindata as a module dependency
2019-05-20 14:18:36 -04:00
Matt Baer
b9b41b1ef7 Enable un-setting RTL setting via web
Previously, once RTL was enabled on a post, you couldn't unset it via
the web application. This fixes that. (Fixes #103)
2019-05-18 23:16:42 -04:00
Rob Loranger
6ff136455c
Add go-bindata as a module dependency
This adds https://github.com/jteeuwen/go-bindata as a module dependency
as the make target 'build' will result in it's addition.
2019-05-17 16:22:44 -07:00
Matt Baer
2fdd58387a
Merge pull request #105 from writeas/go-bindata-repo-fix
go-bindata url updated
2019-05-17 17:27:43 -04:00
Sandrockcstm
cf139ecd72 go-bindata url updated 2019-05-17 15:57:33 -05:00