Commit Graph

11393 Commits

Author SHA1 Message Date
Renovate Bot
1f3363e0a9
Update dependency @tryghost/session-service to v0.1.6 2020-08-10 00:08:31 +00:00
Hannah Wolfe
e4ab28b70f Prevent grunt from exiting without letting express stop 2020-08-09 17:40:38 +01:00
Hannah Wolfe
f8cdaf0c24 Removed unused connection handling + restart method
- Connection handling is legacy code added in 1438278ce4
- Although we were tracking all connections in memory, we weren't actually closing any because stop isn't called
- This (and restart) were both added as part of the now long-deprecated system for using Ghost directly as an npm module
- If we want to close connections cleanly, we should use a tool to do this
2020-08-09 17:31:01 +01:00
Hannah Wolfe
71f02d25e9 Refactored server announce functions to be clearer
- the announce functions exist for the purpose of communicating with Ghost CLI
- the functions were called announceServerStart and announceServerStopped, which implies they tell Ghost CLI when the server starts and stops
- however, the true intention / purpose of these functions is to:
    - either tell Ghost CLI when Ghost has successfully booted (e.g. is ready to serve requests)
    - or tell Ghost CLI when the server failed to boot, and report the error so that Ghost CLI can communicate it to the user
- therefore, I've refactored the old functions into 1 function to make it clearer they do the same job, but with 2 different states
- also added some tests :D
2020-08-09 17:25:15 +01:00
Hannah Wolfe
c577007afe Update dependency @tryghost/bootstrap-socket to v0.2.0
- includes API changes
2020-08-09 17:22:27 +01:00
Renovate Bot
7b4565cd3e
Update dependency @tryghost/mw-session-from-token to v0.1.6 2020-08-07 21:12:14 +00:00
Renovate Bot
8229c695cf
Update dependency @tryghost/image-transform to v1.0.1 2020-08-07 19:47:53 +00:00
Renovate Bot
bee234f859
Update dependency @tryghost/errors to v0.2.1 2020-08-07 17:45:12 +00:00
Hannah Wolfe
b765a30ee9 Moved bootstap-socket code to @tryghost/bootstrap-socket
- this code has zero deps and is much easier to reason about standalone
2020-08-07 18:43:46 +01:00
Renovate Bot
d4843b4ea8
Update dependency @tryghost/adapter-manager to v0.1.8 2020-08-07 16:09:42 +00:00
Hannah Wolfe
b09504e7cc Moved bootstrap socket logic out of server
- this logic is a dependency rather than part of the server code
- moved it out ready to be moved elsewhere, doesn't need to be here
2020-08-07 16:27:45 +01:00
Hannah Wolfe
028d3fc88b Added missing debug info for IPC on start
refs 022a433e56

- noticed I missed adding debug info in one place (not that it's used, just for consistency)
- also made the SIGINT/TERM code slightly more readable
2020-08-06 20:39:49 +01:00
Kevin Ansfield
2efcf94645
Improved performance of sending newsletter emails (#12091)
no-issue

- switch from `membersService.api.members.list` to using bookshelf `Member.findPage()` with the `{paid: true}` filter to avoid per-member queries (N+1) to decorate members with subscriptions and a heavy post-fetch filter via `contentGating`
- add concurrency to the Mailgun API requests in `bulk-email` service to reduce overall time submitting API requests
- add debug statements with timing output for easier measurements
2020-08-06 15:19:39 +02:00
Kevin Ansfield
490f9787fa
Added migration to create indexes and constraints for member tables (#12108)
no issue

For large numbers of members we're unable to perform queries for free/paid members in a reasonable time without indexes. Bulk delete is also very slow when looping through bookshelf models and having bookshelf manage deletion of child records, adding `ON DELETE CASCADE` to the foreign key indexes moves child deletion to the DB level and allows for performant bulk delete queries.

- migrations only run on mysql because sqlite does not support altering tables
- adds foreign key indexes and constraints with 'ON DELETE CASCADE' for members_labels, members_stripe_customers, and members_stripe_customers_subscriptions
2020-08-06 14:57:05 +02:00
Fabien 'egg' O'Carroll
d3384975da
Cleaned up members_stripe_* tables on MySQL (#12103)
refs #12100

For performance reasons we want to add foreign key and unique constraints
to the members_stripe_* tables so we can utilised cascading deletes and 
joins across the tables when querying.

In order to do this we must first ensure that:
- There are no duplicate entries in the `subscription_id` or `customer_id` columns
- There are no orphaned rows in the subscription or customers tables

If the first is not true, the unique constraint will fail, and if the second is not true,
the foreign key constraint will fail.

As we are only adding the indexes to existing MySQL databases at this point, the
cleanup migrations will also only be done for existing MySQL databases too.

The migrations for removing orphaned rows splits the deletion into a `SELECT`
followed by a `WHERE IN` to avoid the database "optimising" the query into a
`JOIN` which ends up taking much longer due to the lack of indexes.
2020-08-06 11:13:41 +02:00
Fabien 'egg' O'Carroll
d15446593a
Added support for ON DELETE CASCADE to the schema (#12105)
no-issue

We are in the process of creating migrations to add foreign key constraints
and cascading deletes to the members_stripe_* tables to make listing members
and deleting members faster. As well as the migrations we need to update the
database schema so that new installations have the correct indexes and constraints.

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2020-08-05 13:20:30 +02:00
Renovate Bot
0eed0d8c88
Update dependency mocha to v8.1.1 2020-08-04 19:31:20 +00:00
Daniel Lockyer
0304280d96 v3.28.0 2020-08-04 11:23:41 +01:00
Daniel Lockyer
226fa76c51 Updated Ghost-Admin to v3.28.0 2020-08-04 11:23:40 +01:00
Daniel Lockyer
82f4b179fa Updated Casper to v3.1.0 2020-08-04 11:23:40 +01:00
Daniel Lockyer
9ff68dc3b0 Updated @tryghost/url-utils dependency to 0.6.19 2020-08-04 11:04:14 +01:00
Daniel Lockyer
bd14df328d Updated @tryghost/string dependency to 0.1.10 2020-08-04 11:03:34 +01:00
Renovate Bot
0e1708f220
Update dependency @tryghost/social-urls to v0.1.10 2020-08-04 07:59:42 +00:00
Renovate Bot
30fe92e3be Update dependency @tryghost/html-to-mobiledoc to v0.7.1 2020-08-04 07:58:49 +00:00
Renovate Bot
7239fdbe23
Update dependency @tryghost/helpers to v1.1.28 2020-08-04 06:01:45 +00:00
Nazar Gargol
60ae9e82f9 Fixed integration_id assignment for webhook when creating through API key auth
refs 173e3292fa

- The bug was initially introduced in referenced commit. When request is done with `api_key` context, there should always be an `integration` object associated with it - 71c17539d8/core/server/services/permissions/parse-context.js (L36) . An `id` from `context.integration` not `context.api_key` has to be assigned to newly created webhook!
- The webhooks API is about to be declared stable in upcoming release, so no migration will be done
2020-08-04 16:43:24 +12:00
CY Lim
71c17539d8
🐛 Fixed installation on windows #10890 (#12096)
closes #10890

- use platform agnostic `exit 0` to allow `yarn setup` to work on windows
- requires powershell to be run as admin
2020-08-03 20:15:58 +01:00
Gerardo Lopez Dueñas
275bf41ba3
Fixed bookmark card image size in fastmail (#11970)
closes #11907

The image in the bookmark card was being shown out of the bounds of
the card because of a general style `height: auto !important`.

I added a new `max-height` property to the image to avoid exceeding
parent height.
2020-08-03 18:38:45 +01:00
Hannah Wolfe
221f8c4a86
Update CONTRIBUTING.md
- commit messages = why
2020-08-03 16:10:22 +01:00
Rish
f770e9f2ad 🐛 Fixed incorrect member gating on custom static page routes
no issue

- Member gating on post/page content is done using member context on request's frame
- Custom static page route was incorrectly setting the member context as `members` instead of `member`, which caused logged-in members to still not able to see content while logged in as a member
- Fix corrects the member context for these routes to use `member` as expected
2020-08-03 17:28:55 +05:30
Nazar Gargol
2a4ad0e10f Updated stability index comments around Admin API v2 endpoints
refs 067d2eb614

- v2 API has been in maintenance mode since v3 has been released, updated comments accordingly
2020-08-03 23:46:23 +12:00
Nazar Gargol
067d2eb614 Moved canary/v3 webhooks API to "stable" group
no issue

- Webhooks API has been stabilized with latest changes and there are no breaking changes planned for v3. The change has strictly "informative" purpose
- Changed variable naming from "whitelisted" to "allowlisted" to follow updated naming convention (refs. https://mysqlhighavailability.com/mysql-terminology-updates/)
2020-08-03 23:40:15 +12:00
Nazar Gargol
b76a6a1eee Reduced error level to default for not found post error
refs #12064

- `critical` is meant to be something unpredictable like internal error, something worthy attention, as described in Ignition -3439456d94/README.md (list-of-errors)
- This error level was introduced with - this PR https://github.com/TryGhost/Ghost/pull/9426, but there is no context provided why this specific value was used. Assuming it's an outdated value as 'not found' is nowhere to be treated in any special way
2020-08-03 23:16:53 +12:00
Nazar Gargol
1b449f4f53 🐛 Fixed 500 error in webhooks API when modifying non-existing webhooks
closes #12064

- Handled permission check bug by returning 404, same way it is returned in other permissions related places when handling non-existing resource. Example - 60907a7ae4/core/server/models/relations/authors.js (L355-L358)
2020-08-03 23:08:47 +12:00
Renovate Bot
60907a7ae4
Update dependency eslint to v7.6.0 2020-08-03 00:06:23 +00:00
Renovate Bot
59f9b4345f
Update dependency mocha to v8.1.0 2020-07-30 20:37:56 +00:00
Kevin Ansfield
29d94e7814 Fixed mailgun config not allowing custom hosts with ports
no issue

- `mailgun()` expects the `host` option not to include a port but `url.host` will include the port, we instead want to use `url.hostname` which skips the port
2020-07-30 17:28:51 +01:00
Renovate Bot
56ceb1e312
Update dependency sanitize-html to v1.27.2 2020-07-29 15:18:07 +00:00
Kevin Ansfield
577a934f53
Removed DISTINCT from member labels association query (#12088)
no issue

- bookshelf adds `DISTINCT` to any relation query that does not have an explicit `columns` statement
- when measuring the impact of `DISTINCT` on the eager-loading association query when listing members using `{withRelated: 'labels'}`, it can be 2x slower with no index on the sort_order column or 4x slower with an index on sort_order
2020-07-29 12:50:22 +01:00
John O'Nolan
d9da01ea85
Added hiring link to readme 2020-07-29 15:24:59 +07:00
Kevin Ansfield
9f642c8107 Added moment package resolution to pin 2.24.0
refs 1a17f8069b

- sub-dependency update bumped moment versions to 2.27.0 which caused timezone problems again with dates not being written to the database in UTC
- added a resolution in package.json to pin all moment sub-dependencies to the same version we specify in our top-level dependencies
2020-07-28 17:55:23 +01:00
Nazar Gargol
ef6586bfdc Fixed failing members import with label associations
no issue

- When processing entries with new labels in parallel Bookshelf relations is trying to create them which caused unique key constraints to fail. To avoid the failure, all labels should be pre-created before proceeding with creating members
2020-07-28 22:37:48 +12:00
John O'Nolan
71e16bc6d2
Made readme install commands easier to copy/paste 2020-07-28 13:23:31 +07:00
John O'Nolan
cd2c710c9f
Updated GitHub sponsors credits 2020-07-28 13:21:55 +07:00
John O'Nolan
5ce1ea58a9
Update FUNDING.yml 2020-07-28 13:19:20 +07:00
Renovate Bot
fd64af5b78
Update dependency uuid to v8.3.0 2020-07-27 19:05:33 +00:00
Renovate Bot
f89e0d6e4b Update dependency nock to v13.0.3 2020-07-27 19:04:24 +00:00
renovate[bot]
1a17f8069b
Lock file maintenance (#11979)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-07-27 19:02:53 +01:00
Fabien O'Carroll
cd2e72542d v3.27.0 2020-07-27 18:38:26 +02:00
Fabien O'Carroll
5c9188b1e5 Updated Ghost-Admin to v3.27.0 2020-07-27 18:38:26 +02:00