Commit Graph

30 Commits

Author SHA1 Message Date
Matt Baer 8a555567a6 Fix tagged posts SQLite query
SQLite doesn't have an `RLIKE` function, so the query for hashtagged
posts was failing before. This adds a `regexp` function to SQLite and
correctly retrieves all posts on a blog with the requested hashtag.

This closes #55
2019-01-07 11:55:23 -05:00
Matt Baer 1c58c64c7c Fix SQLite deadlock when creating user
This avoids reading from the database after a transaction has been
started in CreateUser(), fixing the deadlock that occurred before.

Closes #53
2019-01-06 21:30:34 -05:00
Matt Baer bf7d422039 Add pager to admin user list
This enables paging through the entire list of users.

Ref T553
2019-01-05 09:37:53 -05:00
Matt Baer 3d301c97e9 Fix admin user paging query 2019-01-05 08:47:42 -05:00
Matt Baer 0e722de82c Add admin user list
This enables admins on multi-user instances to see all users registered,
and view the details of each, including:

- Username
- Join date
- Total posts
- Last post date
- All blogs
  - Public info
  - Views
  - Total posts
  - Last post date
  - Fediverse followers count

This is the foundation for future user moderation features.

Ref T553
2019-01-04 22:28:29 -05:00
Matt Baer fca3019e4b Support building without SQLite support
This adds a new `sqlite` build tag that you should include only if you
want SQLite3 support built in. Both `make run` and `make release` create
builds with SQLite included.
2019-01-03 17:57:06 -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 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 c6851fee50 Fix duplicate key checks in SQLite
Ref T529
2018-12-08 13:25:20 -05:00
Matt Baer 4b780361bf Fix upsert queries on SQLite
Ref T529
2018-12-08 12:58:45 -05:00
Matt Baer 026604b3dd Fix pinned post content truncation with SQLite
This extracts the LEFT/SUBSTR logic into its own datastore.clip() method
that also works correctly with SQLite.

Ref T529
2018-12-08 12:54:49 -05:00
Matt Baer daaa4564bb Fix post `created` date in SQLite
We store times in UTC in all other places, but the post.Created logic
when creating a post meant that dates were being stored in a user's
local timezone. This fixes that.

Ref T529
2018-12-08 12:51:27 -05:00
Matt Baer 6f4c004e8c Fix SQLite date format string
The formatted string was invalid before, causing date parsing to fail.
This fixes that.

Ref T529
2018-12-08 12:28:52 -05:00
Matt Baer bc1b3fdfb7 Move NOW() calls to datastore.now() method
Ref T529
2018-12-08 12:15:16 -05:00
Ben Overmyer 6cb86214d7 SQLite support added. 2018-12-01 12:07:25 -06: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 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 99a10a2563 Accept different `created` time on post publish
This helps with post importing and clients that want to support post
scheduling. It also changes how Collection.ForPublic() works, no longer
resetting the ID.

Closes T532
2018-11-18 14:39:50 -05:00
Matt Baer b58cb1e541 Fix Novel blog post order in feeds and outbox 2018-11-17 21:59:04 -05:00
Matt Baer 8e6d0daa06 Federate draft when published to a blog
This now sends out a `Create` activity when a post is moved from a draft
to a blog.

This closes #9. Closes T526.
2018-11-16 12:42:21 -05:00
Matt Baer a0f8a2df3b Fix MathJax value not sticking
This closes #28
2018-11-16 12:19:56 -05:00
Matt Baer ac3d454f22 Include default `posts`.`privacy` value on post creation
This closes #7
2018-11-12 21:00:54 -05:00
Matt Baer efbba9e1ba Reuse statement on post insert 2018-11-12 20:51:04 -05:00
Matt Baer a0ac7bbbcd Insert missing default values on post creation
- view_count

This closes #7
2018-11-11 10:31:37 -05:00
Matt Baer 7538fa68bc Insert default values on collection creation
This fixes MySQL errors about missing default values.
2018-11-11 09:35:01 -05:00
Matt Baer aecbc3c014 Support fuzzy username matching on login
This allows logging in with a non-normalized username.
2018-11-09 21:55:35 -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 3e1d3530ad Fetch collection description with user collections 2018-11-06 13:30:15 -05:00
Matt Baer 0c1e1dd57e Add data layer
This includes config changes, collections, posts, some post rendering
funcs, and actual database connection when the server starts up.
2018-10-16 22:31:27 -04:00