From 059f0d4c548c282a2385a6ef40c5ec9cc8e5a15a Mon Sep 17 00:00:00 2001 From: koehr Date: Wed, 16 Jan 2019 16:07:20 +0100 Subject: [PATCH 01/10] use font-display:optional to optimize web font loading --- less/fonts.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/less/fonts.less b/less/fonts.less index fd01dd4..3a2605f 100644 --- a/less/fonts.less +++ b/less/fonts.less @@ -3,6 +3,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 400; + font-display: optional; src: url('/fonts/open-sans-v13-latin-regular.eot'); /* IE9 Compat Modes */ src: local('Open Sans'), local('OpenSans'), url('/fonts/open-sans-v13-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -16,6 +17,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 700; + font-display: optional; src: url('/fonts/open-sans-v13-latin-700.eot'); /* IE9 Compat Modes */ src: local('Open Sans Bold'), local('OpenSans-Bold'), url('/fonts/open-sans-v13-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -29,6 +31,7 @@ font-family: 'Lora'; font-style: normal; font-weight: 400; + font-display: optional; src: url('/fonts/Lora-Regular.eot'); /* IE9 Compat Modes */ src: local('Lora'), local('Lora-Regular'), url('/fonts/Lora-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -41,6 +44,7 @@ font-family: 'Lora'; font-style: normal; font-weight: 700; + font-display: optional; src: url('/fonts/Lora-Bold.eot'); /* IE9 Compat Modes */ src: local('Lora Bold'), local('Lora-Bold'), url('/fonts/Lora-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -52,6 +56,7 @@ font-family: 'Lora'; font-style: italic; font-weight: 400; + font-display: optional; src: url('/fonts/Lora-Italic.eot'); /* IE9 Compat Modes */ src: local('Lora Italic'), local('Lora-Italic'), url('/fonts/Lora-Italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ From 7da8b3aef693c91fbccf2ecca5bb8063d57952b8 Mon Sep 17 00:00:00 2001 From: Norman Date: Wed, 16 Jan 2019 23:07:44 +0100 Subject: [PATCH 02/10] Fixes indentation --- less/fonts.less | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/less/fonts.less b/less/fonts.less index 3a2605f..7ee5356 100644 --- a/less/fonts.less +++ b/less/fonts.less @@ -3,7 +3,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 400; - font-display: optional; + font-display: optional; src: url('/fonts/open-sans-v13-latin-regular.eot'); /* IE9 Compat Modes */ src: local('Open Sans'), local('OpenSans'), url('/fonts/open-sans-v13-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -17,7 +17,7 @@ font-family: 'Open Sans'; font-style: normal; font-weight: 700; - font-display: optional; + font-display: optional; src: url('/fonts/open-sans-v13-latin-700.eot'); /* IE9 Compat Modes */ src: local('Open Sans Bold'), local('OpenSans-Bold'), url('/fonts/open-sans-v13-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -31,7 +31,7 @@ font-family: 'Lora'; font-style: normal; font-weight: 400; - font-display: optional; + font-display: optional; src: url('/fonts/Lora-Regular.eot'); /* IE9 Compat Modes */ src: local('Lora'), local('Lora-Regular'), url('/fonts/Lora-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -44,7 +44,7 @@ font-family: 'Lora'; font-style: normal; font-weight: 700; - font-display: optional; + font-display: optional; src: url('/fonts/Lora-Bold.eot'); /* IE9 Compat Modes */ src: local('Lora Bold'), local('Lora-Bold'), url('/fonts/Lora-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ @@ -53,14 +53,14 @@ url('/fonts/Lora-Bold.ttf') format('truetype'); /* Safari, Android, iOS */ } @font-face { - font-family: 'Lora'; - font-style: italic; - font-weight: 400; - font-display: optional; - src: url('/fonts/Lora-Italic.eot'); /* IE9 Compat Modes */ - src: local('Lora Italic'), local('Lora-Italic'), - url('/fonts/Lora-Italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('/fonts/Lora-Italic.woff2') format('woff2'), /* Super Modern Browsers */ - url('/fonts/Lora-Italic.woff') format('woff'), /* Modern Browsers */ - url('/fonts/Lora-Italic.ttf') format('truetype'); /* Safari, Android, iOS */ + font-family: 'Lora'; + font-style: italic; + font-weight: 400; + font-display: optional; + src: url('/fonts/Lora-Italic.eot'); /* IE9 Compat Modes */ + src: local('Lora Italic'), local('Lora-Italic'), + url('/fonts/Lora-Italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('/fonts/Lora-Italic.woff2') format('woff2'), /* Super Modern Browsers */ + url('/fonts/Lora-Italic.woff') format('woff'), /* Modern Browsers */ + url('/fonts/Lora-Italic.ttf') format('truetype'); /* Safari, Android, iOS */ } From 53dfe4d215aa8b972bf0adff3d1032a33fbb518f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 16:35:04 -0500 Subject: [PATCH 03/10] Add Hosting section to README --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 00778d8..2c53c16 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,18 @@ It's designed to be flexible and share your writing widely, so it's built around * Build more advanced apps and extensions with the [well-documented API](https://developers.write.as/docs/api/) * Designed around user privacy and consent +## Hosting + +We offer two kinds of hosting services that make WriteFreely deployment painless: [Write.as](https://write.as) for individuals, and [WriteFreely.host](https://writefreely.host) for communities. Besides saving you time, as a customer you directly help fund WriteFreely development. + +### [![Write.as](https://write.as/img/writeas-wf-readme.png)](https://write.as/) + +Start a personal blog on [Write.as](https://write.as), our flagship instance. Built to eliminate setup friction and preserve your privacy, Write.as helps you start a blog in seconds. It supports custom domains (with SSL) and multiple blogs / pen names per account. [Read more here](https://write.as/privacy). + +### [![WriteFreely.host](https://writefreely.host/img/wfhost-wf-readme.png)](https://writefreely.host) + +[WriteFreely.host](https://writefreely.host) makes it easy to start a close-knit community — to share knowledge, complement your Mastodon instance, or publish updates in your organization. We take care of the hosting, upgrades, backups, and maintenance so you can focus on writing. + ## Quick start WriteFreely has minimal requirements to get up and running — you only need to be able to run an executable. From b91c931ebd451c36b6edf2aba992a74fe65473ad Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 16:36:58 -0500 Subject: [PATCH 04/10] Tweak links at top of README --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 2c53c16..5440b3e 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,9 @@ WriteFreely is a beautifully pared-down blogging platform that's simple on the s It's designed to be flexible and share your writing widely, so it's built around plain text and can publish to the _fediverse_ via ActivityPub. It's easy to install and light enough to run on a Raspberry Pi. -**[Start a blog on our instance](https://write.as/new/blog/federated)** - [Try the editor](https://write.as/new) -[Find another instance](https://writefreely.org/instances) +[Find an instance](https://writefreely.org/instances) ## Features From 5e686a5b0f26d08f4ca2dee82ec8ba364895a99e Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 16:38:28 -0500 Subject: [PATCH 05/10] Update import schema step Note the step is only required for multi-user instances. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5440b3e..2f7acb9 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Now extract the files from the archive, change into the directory, and do the fo # 2) (if you chose MySQL in the previous step) Log into MySQL and run: # CREATE DATABASE writefreely; -# 3) Import the schema with: +# 3) (if you chose Multi-user setup) Import the schema with: ./writefreely --init-db # 4) Generate data encryption keys From 3a6118c2070344fdc74a5918aeba1dc55913e965 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 17:08:08 -0500 Subject: [PATCH 06/10] Set up migrations table on initial setup This includes the appmigrations table in the schema files, and inserts the current database version when running writefreely --init-db --- app.go | 10 ++++++++++ migrations/migrations.go | 13 +++++++++++++ schema.sql | 12 ++++++++++++ sqlite.sql | 12 ++++++++++++ 4 files changed, 47 insertions(+) diff --git a/app.go b/app.go index e286ef0..40f42c9 100644 --- a/app.go +++ b/app.go @@ -613,5 +613,15 @@ func adminInitDatabase(app *app) { log.Info("Created.") } } + + // Set up migrations table + log.Info("Updating appmigrations table...") + err = migrations.SetInitialMigrations(migrations.NewDatastore(app.db.DB, app.db.driverName)) + if err != nil { + log.Error("Unable to set initial migrations: %v", err) + os.Exit(1) + } + log.Info("Done.") + os.Exit(0) } diff --git a/migrations/migrations.go b/migrations/migrations.go index 2aa3643..1d6e0c4 100644 --- a/migrations/migrations.go +++ b/migrations/migrations.go @@ -58,6 +58,19 @@ var migrations = []Migration{ New("support user invites", supportUserInvites), // -> V1 (v0.8.0) } +// CurrentVer returns the current migration version the application is on +func CurrentVer() int { + return len(migrations) +} + +func SetInitialMigrations(db *datastore) error { + _, err := db.Exec("INSERT INTO appmigrations (version, migrated, result) VALUES (?, "+db.now()+", ?)", CurrentVer(), "") + if err != nil { + return err + } + return nil +} + func Migrate(db *datastore) error { var version int var err error diff --git a/schema.sql b/schema.sql index 6687f5d..b3fae97 100644 --- a/schema.sql +++ b/schema.sql @@ -34,6 +34,18 @@ CREATE TABLE IF NOT EXISTS `appcontent` ( -- -------------------------------------------------------- +-- +-- Table structure for table `appmigrations` +-- + +CREATE TABLE `appmigrations` ( + `version` int(11) NOT NULL, + `migrated` datetime NOT NULL, + `result` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + -- -- Table structure for table `collectionattributes` -- diff --git a/sqlite.sql b/sqlite.sql index 6c7160a..90989ed 100644 --- a/sqlite.sql +++ b/sqlite.sql @@ -32,6 +32,18 @@ CREATE TABLE IF NOT EXISTS `appcontent` ( -- -------------------------------------------------------- +-- +-- Table structure for table appmigrations +-- + +CREATE TABLE `appmigrations` ( + `version` INT NOT NULL, + `migrated` DATETIME NOT NULL, + `result` TEXT NOT NULL +); + +-- -------------------------------------------------------- + -- -- Table structure for table collectionattributes -- From 73ca34bb2181026529cac09e57c77d718e8a518c Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 17:09:48 -0500 Subject: [PATCH 07/10] Ignore all .ini files --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 95ad31b..3d021d7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ *.swo build -config.ini +*.ini *.db bindata.go From 8b94418d3f3faef8c6a0886a89f9699a7aee6748 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 17:10:09 -0500 Subject: [PATCH 08/10] Bump version to 0.8.0 --- app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.go b/app.go index 40f42c9..e942f7b 100644 --- a/app.go +++ b/app.go @@ -54,7 +54,7 @@ var ( debugging bool // Software version can be set from git env using -ldflags - softwareVer = "0.7.1" + softwareVer = "0.8.0" // DEPRECATED VARS // TODO: pass app.cfg into GetCollection* calls so we can get these values From e682824be51eee5fb1abc9d20745b5282fd8b979 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 17:24:07 -0500 Subject: [PATCH 09/10] Add @nkoehring to AUTHORS --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index bea1e4d..c9f40e6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -8,3 +8,4 @@ WriteFreely is built by [Matt Baer](https://github.com/thebaer), with contributi * [Brad Koehn](https://github.com/koehn) * [kaiyou](https://github.com/kaiyou) * [Aaron Ogle](https://github.com/geekgonecrazy) +* [Norman](https://github.com/nkoehring) From 9c6e7eda65f7934061c6b2b9552440b42f80d37f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 24 Jan 2019 21:11:04 -0500 Subject: [PATCH 10/10] Fix Write.as pricing link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f7acb9..bde2d7d 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ We offer two kinds of hosting services that make WriteFreely deployment painless ### [![Write.as](https://write.as/img/writeas-wf-readme.png)](https://write.as/) -Start a personal blog on [Write.as](https://write.as), our flagship instance. Built to eliminate setup friction and preserve your privacy, Write.as helps you start a blog in seconds. It supports custom domains (with SSL) and multiple blogs / pen names per account. [Read more here](https://write.as/privacy). +Start a personal blog on [Write.as](https://write.as), our flagship instance. Built to eliminate setup friction and preserve your privacy, Write.as helps you start a blog in seconds. It supports custom domains (with SSL) and multiple blogs / pen names per account. [Read more here](https://write.as/pricing). ### [![WriteFreely.host](https://writefreely.host/img/wfhost-wf-readme.png)](https://writefreely.host)