Commit graph

612 commits

Author SHA1 Message Date
Matt Baer
f6f116d672 Fix missing hostname when publishing via API
This fixes a bug that occurred only when publishing via API and
authenticating via token (rather than cookie).

Previously, the instance's hostname wouldn't be added to the Collection
that got passed around after retrieving the owned post, meaning an
incomplete URL was returned in the API response, and federation failed due
to the missing host.
2019-07-22 14:02:53 -04:00
Matt Baer
f541f72224 Style collection 404 page like rest of blog
This displays the "page is missing" text within the same page as any
other blog post, keeping customizations, pinned pages, and general blog
navigation.

Ref T493
2019-07-21 15:15:52 -04:00
Matt Baer
ba3cb4b4ff
Merge pull request #138 from writeas/fix-unpublished-state
Don't consider post unpublished when title exists
2019-07-21 11:35:16 -04:00
Matt Baer
1f7a0f0122 Add option for automated cert in config process
This adds a new "Secure (port 443), auto certificate" option to the "Web
server mode" prompt when running `writefreely --config`. When chosen,
it'll set `autocert` to `true` and set the path for certs and keys to
`certs`.

Ref T542
2019-07-20 21:46:10 -04:00
Matt Baer
3346e735d3 Fix autocert insecure server redirect
This fixes certificate validation, while keeping HTTP -> HTTPS
redirection.

Ref T542
2019-07-20 21:38:02 -04:00
Matt Baer
42386beabc Fix autocert HostPolicy
Previously, this would pass in the instance's full (and invalid) URL.
Now it passes only the host name.

Ref T542
2019-07-20 21:37:27 -04:00
Matt Baer
36fb7ecb2b Support automatically generated certificates
This adds a new config option in the `[server]` section: `autocert`.
When true, WF will automatically generate certificates instead of using
ones from the provided cert path. However, all generated certificates
will be stored in the configured `tls_cert_path`.

Ref T542
2019-07-20 20:49:20 -04:00
Matt Baer
41062728f5 Fix go-sitemap-generator overriding GOMAXPROCs
This upgrades the library to v2, which lets you specify that GOMAXPROCs
should always be the max number of CPUs -- and then sets it to that.

One side effect of this is that images are no longer listed in sitemaps.
I'm somehow at a loss on how to build and append the images array we
need, with the library's latest changes.

Fixes #86
2019-07-20 19:47:13 -04:00
Matt Baer
22c1fabbcb
Merge pull request #137 from writeas/fix-long-slugs-chinese
Prevent transliterated slugs exceeding length limit
2019-07-18 14:32:06 -04:00
Matt Baer
909976dd90 Don't consider post unpublished when title exists
Previously, you could create a post with a title but no body, e.g. by
publishing via email. This would still show the post on a blog, but
would give a 410 Gone page when trying to access the page.

This issue originally reported on the forum:
https://discuss.write.as/t/removing-post-unpublished-by-author-post/725
2019-07-14 12:59:33 -04:00
Matt Baer
31b521c11c Prevent transliterated slugs exceeding limit
Transliteration during slug generation can cause slugs to exceed their
80-character limit. This fixes that by making a second truncation pass
on the slug during generation.

Originally reported on the forum:
https://discuss.write.as/t/title-convert-to-url-function-bug-under-chinese/723
2019-07-11 09:18:39 -04:00
Matt Baer
71fb63580a Merge branch 'master' into develop 2019-07-08 08:57:05 -04:00
Matt Baer
e0666baa5d Include ARMv7 build in make release
This closes #135
2019-07-08 08:56:25 -04:00
Matt Baer
0b25109a6b Add make build-arm7
This makes it easy to build WF for ARMv7, e.g. the Raspberry Pi.

part of #135
2019-07-08 08:55:22 -04:00
Matt Baer
3b079810bb Accept Apper in writefreely.ResetPassword()
instead of *App
2019-07-03 14:39:43 -04:00
Matt Baer
79cf6ce0eb Accept Apper in writefreely.Migrate()
instead of *App
2019-07-03 14:39:05 -04:00
Matt Baer
3faa2def08 Add Documentation section and fix dev setup link 2019-07-02 11:41:43 -04:00
Matt Baer
5923b6401c Replace old "quick start" section with Getting Started link 2019-07-02 11:02:54 -04:00
Matt Baer
ad6fd5e809 Use "Draft" in post meta page
instead of "Anonymous".
2019-07-01 19:59:52 -04:00
Matt Baer
554995916e Replace top-left "w" button on post meta page
This was still a relic of Write.as. Now it has the same icon as the
WriteFreely editor.
2019-07-01 19:56:50 -04:00
Matt Baer
7aaff778da
Merge pull request #123 from writeas/private-instance
Private instances

Resolves T576
2019-07-01 19:14:20 -04:00
Matt Baer
7240bf0cdc
Merge pull request #131 from writeas/customize-landing
Customize landing page

Resolves T565
2019-07-01 19:12:58 -04:00
Matt Baer
bd180f56a8 Add comments about isRaw logic 2019-07-01 19:10:29 -04:00
Matt Baer
fdcdfe4d25 Open landing page preview in new window 2019-07-01 19:05:47 -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
5757407994 Bump version to 0.10.0 2019-07-01 15:20:29 -04:00
Matt Baer
18bafadc43
Merge pull request #127 from writeas/shorter-config-process
Shorter config process
2019-07-01 14:15:41 -04:00
Matt Baer
b8b15c8550 Move Environment prompt back under Server section 2019-07-01 14:00:56 -04:00
Matt Baer
a740c67495 Fix whitespace
This runs `go fmt` on changed files and moves around some blank lines.
2019-07-01 13:33:26 -04:00
Matt Baer
ebeb7b03e6 Explicitly set background-color
Closes #132
2019-06-28 08:26:15 -04:00
Matt Baer
c3f3eb0a65 Rename getLandingPage -> getLandingBody
This makes the naming scheme more consistent with other funcs.

Ref T565
2019-06-27 22:22:21 -04:00
Matt Baer
a72ce2ef29 Make landing page dynamic
This enables admins to customize their landing / home page via the Admin
dashboard -- including the text at the top of the page and the section
below it. It keeps the current default text, falling back to it if the
user hasn't overwritten it.

Ref T565
2019-06-27 17:06:37 -04:00
Matt Baer
aedb05080c Support ?landing=1 to always show landing page
This supports admins previewing changes to the landing page.

Ref T565
2019-06-27 16:38:24 -04:00
Matt Baer
6fdc343986
Merge pull request #130 from mrvdb/issue125
Construct version from annotated tags only
2019-06-27 15:32:14 -04:00
Marcel van der Boom
f6c129ed20 Construct version from annotated tags only
Fixes issue 125
2019-06-27 21:25:22 +02:00
Matt Baer
f26e0ca86e
Merge pull request #128 from writeas/fix-c-syntax-highlighting
Fix #124 according to the snippet by @mrvdb
2019-06-27 15:07:04 -04:00
Michael Demetriou
4feac6dcd2 Remove langs list from post-render as it does not actually
do anything useful (see https://github.com/writeas/writefreely/pull/128#issuecomment-506207107)
2019-06-27 18:15:58 +03:00
Matt Baer
8d9f60aaa9 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-27 18:15:58 +03:00
Michael Demetriou
a102f97c3e 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-27 18:15:58 +03:00
Matt Baer
bb0be02b4f
Merge pull request #126 from writeas/config-improvements
Always initialize database after --config
2019-06-27 09:31:58 -04:00
Matt Baer
00a8f8c951
Merge pull request #119 from qwazix/develop
Half-fix of #96
2019-06-27 09:29:25 -04:00
Michael Demetriou
0842119694 Change sh alias back to bash
because this is the alias in highlight itself.

(see https://github.com/writeas/writefreely/pull/128#issuecomment-505766645)
2019-06-27 00:12:18 +03:00
Michael Demetriou
c2d7c2c8b7 Fix #124 according to the snippet by @mrvdb
I changed the sh alias to shell instead of bash.

The additions to the `highlight(nodes)` function look redundant.
It works for me without them but maybe they cover an edge case I
cannot think about?
2019-06-25 21:17:30 +03:00
Michael Demetriou
6506709fbc Merge branch 'develop' into shorter-config-process
Move flag parsing to main.go as per the issue description
2019-06-21 12:07:01 +03:00
Michael Demetriou
aeab30db8a 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-21 10:48:40 +03:00
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