Commit graph

55 commits

Author SHA1 Message Date
Matt Baer
1274914207 Add copyright / license notices to .go files 2018-12-24 12:45:15 -05:00
Matt Baer
1439c8c359 Add --create-user option for regular user
This supports creating a regular user via the command-line.
2018-12-22 10:54:08 -05:00
Matt Baer
5e5b283daf Validate username in admin user creation process
This runs usernames through the same checks as the web interface,
ensuring no invalid user is created, such as user_name or userName.

This closes #49
2018-12-19 21:26:13 -05:00
Matt Baer
f99244b93f Factor out admin user creation logic 2018-12-17 18:13:26 -05:00
Matt Baer
11de25237d Fix db.Ping() call 2018-12-15 14:14:09 -05:00
Matt Baer
2178b4abf2 Check database connection on startup 2018-12-13 19:15:09 -05:00
Matt Baer
4b8d5e3e37 Bump version to 0.6.0 2018-12-10 16:17:57 -05:00
Matt Baer
25a68d0c0e Add Reader section
This adds a "Reader" section of the site for admins who want to enable
it for their instance. That means visitors can go to /read and see who
has publicly shared their writing. They can also follow all public posts
via RSS by going to /read/feed/. Writers on an instance with this
`local_timeline` setting enabled can publish to the timeline by going
into their blog settings and choosing the "Public" visibility setting.

The `local_timeline` feature is disabled by default, as is the Public
setting on writer blogs. Enabling it adds a "Reader" navigation item and
enables the reader endpoints. This feature will also consume more
memory, as public posts are cached in memory for 10 minutes.

These changes include code ported over from Read.Write.as, and thus
include some experimental features like filtering public posts by tags
and authors. These features aren't well-tested or complete.

Closes T554
2018-12-10 16:08:07 -05:00
Matt Baer
111945bc5d Add new -c [filename] option for supplying config file
This allows users to load a different configuration file instead of the
default config.ini. It works in combination with other configuration
actions, like --config and --create-config.
2018-12-08 17:49:19 -05:00
Matt Baer
ba3d6ae64c Support custom SQLite database file name
Ref T529
2018-12-08 13:34:29 -05:00
Matt Baer
7fab11b3c8 Move initial config loading to its own func 2018-12-08 10:39:25 -05:00
Matt Baer
afede80e87 Merge branch 'master' into sqlite-support 2018-12-08 10:34:43 -05:00
Matt Baer
df4cd9ed00 Add --create-admin option
This enables automated user creation by running:

  writefreely --create-admin username:password

It will fail if an admin (first user) already exists, which makes this
suitable for use on both for single- and multi-user instances.

Closes T544
2018-12-05 21:41:51 -05:00
Matt Baer
8ceb165020 Bump version to 0.5 2018-12-03 18:57:31 -05:00
Matt Baer
f04469beee Fix SQLite concurrency issues
A quick test with ApacheBench revealed that SQLite really can't handle
multiple concurrent requests with the default settings, due to a locked
database. This fixes that by following the suggestions here:
https://github.com/mattn/go-sqlite3#faq

Testing with ab -n 100 -c 5 http://localhost:8080/blog/post shows that
this fixes the issue. But we could improve performance by reducing
writes, like what's mentioned in T545.

Part of T529
2018-12-03 12:05:52 -05:00
Matt Baer
61de04338e Extract out common DB connection logic
T529
2018-12-02 17:21:43 -05:00
Ben Overmyer
6cb86214d7 SQLite support added. 2018-12-01 12:07:25 -06:00
Matt Baer
fe78d6d47f Re-add https in log message 2018-11-27 10:55:43 -05:00
Ben Overmyer
dd5f6870d8 Add SQLite option for database. 2018-11-26 14:11:10 -06:00
Marcel van der Boom
875c758ba2 Also use bind address on standalone redirect 2018-11-26 18:34:09 +01:00
Marcel van der Boom
543f6c9ae3 Allow 'bind' in config to specify bind address
Minimal changes, definitely WIP, to resolve:

- how to support dualstack when not using localhost?
- net/http package uses string, mentions IP address instead of bind,
  need info.
2018-11-26 16:50:36 +01:00
Matt Baer
42a47258da Bump version to 0.4 2018-11-26 08:37:36 -05:00
Matt Baer
f0250d501f Move softwareVer to var() block 2018-11-26 08:37:06 -05:00
Matt Baer
09f5953431 Work as a standalone server, including TLS
This supports running the server on port 443, serving secure pages, with
automatic redirects from the insecure site. It also modifies the
configuration process to better guide users through configuring for
running behind a reverse proxy or as a standalone server.

This closes T537
2018-11-21 18:26:19 -05:00
Matt Baer
77e79acd06 Include About/Privacy page content in page description 2018-11-21 15:04:47 -05:00
Matt Baer
be2c7ef86b Show instance stats on About page
This also moves the stats database logic out of nodeinfo.go and into
database.go.
2018-11-21 14:08:47 -05:00
Matt Baer
b9d7d4ce24 Change default database name to writefreely
(not writeas)
2018-11-21 13:36:00 -05:00
Matt Baer
f3df2b4159 Use and validate database type before connecting
Just the start of changes needed for T529.
2018-11-21 13:10:10 -05:00
Marcel van der Boom
b030921691 Don't automatically include "v" from git
- "v" should not be part of the version (softwareVer variable is used
  in other places)
- formatting
2018-11-20 18:14:02 +01:00
Marcel van der Boom
c25d0bef67 Get versioninfo from the git repository
Sets value of softwareVer during build
2018-11-20 14:21:13 +01:00
Matt Baer
bdc4f270f8 Support editing About and Privacy pages from Admin panel
This allows admin to edit these pages from the web, using Markdown. It
also dynamically loads information on those pages now, and makes loading
`pages` templates a little easier to find in the code / more explicit.

It requires this new schema change:

CREATE TABLE IF NOT EXISTS `appcontent` (
  `id` varchar(36) NOT NULL,
  `content` mediumtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

This closes T533
2018-11-18 21:58:50 -05:00
Matt Baer
ad1180f202 Bump version to 0.3 2018-11-16 13:20:40 -05:00
Matt Baer
ed1b77ea3b Support outputting version with -v flag 2018-11-15 14:51:03 -05:00
Matt Baer
0eac9251c0 Add location to MySQL connection string
This should address #23
2018-11-14 17:47:58 -05:00
Matt Baer
9016f87041 Add --reset-pass option for admin pass reset
Usage: writefreely --reset-pass <username>

This closes #25, closes T534
2018-11-14 15:03:22 -05:00
Matt Baer
b1686b1d46 Add --init-db flag to create schema in app
Part of T530
2018-11-13 13:04:52 -05:00
Matt Baer
bf44236748 Bump version to 0.2.1 2018-11-12 21:02:45 -05:00
Matt Baer
002d0e6309 Bump version to 0.2 2018-11-11 18:37:30 -05:00
Matt Baer
7bc873580c Move key generation to app from keys.sh
This eliminates an external dependency needed for install, and ensures
the app can run on Windows.
2018-11-11 17:52:24 -05:00
Matt Baer
1cb593fd8c Fix unnecessarily connecting to DB after multi-user config 2018-11-10 20:43:00 -05:00
Matt Baer
ae019e4dc3 Show error when ListenAndServe fails
and exit with 1
2018-11-10 20:41:35 -05:00
Matt Baer
a6478f1b1d Create blog during config for single-user blogs 2018-11-09 22:16:13 -05:00
Matt Baer
5a062eb437 Include flashes on signup page 2018-11-09 21:14:22 -05:00
Matt Baer
be31da2fe7 Tweak capitalization / spacing in Write Freely name
This affects nodeinfo and ActivityPub requests
2018-11-08 13:37:42 -05:00
Matt Baer
55ada67170 Fill in remaining missing pieces
- Database schema changes, removing obsolete custom domain-related code
- Missing user structs
- Setup verbiage changes
- Missing routes
- Missing error messages
2018-11-08 01:33:26 -05:00
Matt Baer
86e7ba2579 Add editor
This includes the '/' route handler
2018-11-08 00:11:42 -05:00
Matt Baer
a30fc5b52b Add handler, page, template loading 2018-11-07 23:50:50 -05:00
Matt Baer
a3b7b260c5 Add debugging flag
This also includes a new Dev config options
2018-11-07 22:13:16 -05:00
Matt Baer
cc224db6e6 Add interactive configuration
This adds a new --config flag and rearranges some config fields.
2018-10-25 09:15:10 -04:00
Matt Baer
6bdb7a1c1c Output config saving errors 2018-10-24 14:21:42 -04:00