Commit Graph

10214 Commits

Author SHA1 Message Date
Peter Zimon
683ac885fd Updated email template for header card 2021-12-16 18:54:21 +01:00
Thibaut Patel
4984223bf2 Renamed the header styles
refs https://github.com/TryGhost/Team/issues/1253

- The naming is easier to understand for theme developers
2021-12-16 18:22:16 +01:00
James Morris
90c99afcfb Removed unnecessary styles from header card frontend
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 17:20:12 +00:00
James Morris
c373e41699 Added in proper header link colours
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 17:05:39 +00:00
James Morris
3490047a36 Updated frontend with header style tweaks
refs https://github.com/TryGhost/Team/issues/1253
2021-12-16 16:37:02 +00:00
Fabien 'egg' O'Carroll
a4783e1800
Removed empty class attribute from emails (#13906)
no-issue

This is causing some ESP's to think our markup is invalid, and this is
affecting deliverability
2021-12-16 16:58:33 +02:00
Sodbileg Gansukh
7898828cc6 Add gap to image card on smaller screen sizes 2021-12-16 21:54:23 +08:00
Sodbileg Gansukh
2649ba4c4b Add gap custom CSS property to image card
This adds margin to the image card next to a gallery card
2021-12-16 21:50:43 +08:00
Fabien 'egg' O'Carroll
0c853a372b
Supported restricting limit="all" in get helper (#13903)
refs https://github.com/TryGhost/Team/issues/1251

With sites that have a huge number of resources, using limit="all" can
cause OOM errors at the Node level. Administrators now have the ability
to cap limit="all" requests via config. This only affects the get helper
used in themes, not the API, this is by design as themes have less
visibility of issues.
2021-12-16 13:59:39 +02:00
Daniel Lockyer
78030ac848 Updated Admin to v4.31.0 2021-12-16 09:33:21 +00:00
Peter Zimon
41e4ba68c9 Updated toggle and product card spacings 2021-12-16 08:49:37 +01:00
Peter Zimon
9a8461e06b Added underline to accented callout card links 2021-12-16 08:45:31 +01:00
Naz
f882ebc58e Added support for additional wav MIME types
refs https://github.com/TryGhost/Toolbox/issues/95
refs 975750afe9

- The `audio/x-wav`, `audio/wav`, and `audio/wave` are also commonly used MIME types for the .wav files.
- As a reference for these new types used https://github.com/jshttp/mime-db
2021-12-16 10:58:39 +04:00
Naz
22d0c1efac Reformatted media content types
no issue

- The list is gonna get longer and has pottential to be edited few more times in the near future. It's a formatting change to allow seeing added/removed entries easier
2021-12-16 10:54:21 +04:00
Rishabh Garg
5927e38084
Added file card to editor
refs https://github.com/TryGhost/Team/issues/1231

- new file card in editor that allows custom file uploads
2021-12-16 01:11:41 +05:30
James Morris
5dc30ba6a9 Added AMP styles for headers as well as more tweaks for email and frontend
refs https://github.com/TryGhost/Team/issues/1253
2021-12-15 18:42:25 +00:00
Fabien egg O'Carroll
9db1c843c3 Updated Before/After card markup
refs https://github.com/TryGhost/Team/issues/1249

This removes some superfluous markup as well as renaming the slider
handle classname
2021-12-15 20:11:16 +02:00
James Morris
ad96ad4baa Next round of styles for headers in frontend and email
refs https://github.com/TryGhost/Team/issues/1253
2021-12-15 17:45:01 +00:00
Peter Zimon
4353763de1 Updated file upload frontend styles 2021-12-15 17:44:37 +01:00
Fabien egg O'Carroll
6938808276 Improved styling of mismatched aspect ratio sliders
refs https://github.com/TryGhost/Team/issues/1249

The height:100%; stops taller images escaping the slider component.
2021-12-15 17:04:06 +02:00
Fabien egg O'Carroll
6f97396c1b Removed focus from slider after use
refs https://github.com/TryGhost/Team/issues/1249

If we leave focus on the slider than after interacting with it, it will
capture scroll events and move the slider rather than scrolling the
page.
2021-12-15 16:59:25 +02:00
Fabien egg O'Carroll
c745211ee4 Fixed small images in "wide" before/after card
refs https://github.com/TryGhost/Team/issues/1249

Because we cannot resize the container of teh slider without affecting
the surrounding content, e.g. in the context of a grid. We need to
stretch images to fit the slider container.

This also applies the `object-fit: cover` property to the slider image
to help with mis-matched aspect ratios
2021-12-15 16:56:46 +02:00
Fabien egg O'Carroll
16c6e535be Fixed image widths for before/after slider
refs https://github.com/TryGhost/Team/issues/1249

Instead of attempting to calculate teh width of the container, we leave
one image to fill up space naturally as the browser allows it, and then
use that to set the width of the secondary image.
2021-12-15 16:32:35 +02:00
Peter Zimon
acd0223f5b Callout style refinements 2021-12-15 14:51:55 +01:00
Thibaut Patel
49170e7ff2 Added a first version of the header card frontend rendering
refs https://github.com/TryGhost/Team/issues/1253

- Based on the editor card, the css isn't correct yet as it has undefined css variables
2021-12-15 14:46:00 +01:00
Fabien egg O'Carroll
a21a436f98 Added handle for before/after slider
refs https://github.com/TryGhost/Team/issues/1249

Using an input as the slider handle meant setting a width of 100% + px,
which could push width over the size of the screen - not good! This
takes the same approach as the CodePen linked below and uses a separate
element, which has the position of it updated by JS in realtime.

https://codepen.io/josephwong2004/pen/NWRGxdR
2021-12-15 15:16:29 +02:00
Daniel Lockyer
66df325721 Updated Admin to v4.30.1 2021-12-15 13:10:47 +00:00
Daniel Lockyer
8397e9489c Updated Admin to v4.30.0 2021-12-15 12:49:15 +00:00
Peter Zimon
45066b11fd Default card style updates
- fixed video styles for small videos
- cleaned up callout card typography spacings
2021-12-15 13:40:26 +01:00
Rishabh Garg
306e565fc1
Added new video card
refs https://github.com/TryGhost/Team/issues/1229

- new video card allows adding custom video files with thumbnail to post/page
2021-12-15 18:02:28 +05:30
Rishabh
ffe502fa84 Refined layout for videos with smaller aspect ratio
refs https://github.com/TryGhost/Team/issues/1229
2021-12-15 17:57:25 +05:30
Peter Zimon
cebbc7ce38
Card css specificity updates (#13895)
The default CSS styles of the new cards that have been released in the past couple of weeks was overoptimised for overridability. It was done by defining the lowest specificity scores for each card style. This resulted in certain default styles being unusable for a lot of themes – e.g. the text color of a button (which is a a element that is usually defined on a higher specificity) could easily be the same color as its background (accent color by default).

The solution to this issue is to increase the specificity level of globally used default elements (such as a's h1 and other headings, p's etc.) to a medium level so that they have precedence over styles that are defined in most themes. Our baseline specificity score for these default style is 21, which seems to be covering most of the cases in popular themes.

This commit contains CSS updates in card default styles that implement this change.
2021-12-15 12:58:24 +01:00
Sodbileg Gansukh
aba5382070 Add pointer cursor to audio/video card buttons by default 2021-12-15 16:27:33 +08:00
Peter Zimon
a3078589dd Updated file styles 2021-12-14 20:50:35 +01:00
Rishabh
e21eb935f4 Fixed video player overlay issue on loop
refs https://github.com/TryGhost/Team/issues/1229
2021-12-15 00:44:49 +05:30
Sanne de Vries
2ac0302da1 Fixed responsive issues for video card
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 19:57:06 +01:00
Rishabh
c158f9ebfc Refined video controls hidden behavior
no refs

This reverts commit 182899150f.
2021-12-14 22:41:58 +05:30
Rishabh
182899150f Refined video controls hidden behavior
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 22:40:03 +05:30
Sanne de Vries
e574a8f2b3 Refined video player controls
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 18:04:25 +01:00
Rishabh
e43fe45d24 Removed play icon on video player after first play
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 22:25:30 +05:30
Rishabh
04baa88c23 Fixed video not playing sometimes via player controls
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 22:20:55 +05:30
Peter Zimon
ae2a782987 Audio and file card frontend styles refinements 2021-12-14 17:46:30 +01:00
Rishabh
a6a25dbb77 Updated event handling for custom video player
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 22:15:08 +05:30
Rishabh
61f7f29eed Fixed pause not working for video player
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 22:05:29 +05:30
Rishabh
9ec83214ba Fixed hidden controls for videos on loop
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 21:54:56 +05:30
Sanne de Vries
2364de5696 Added animation to control behavior for video cards
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 17:22:36 +01:00
Rishabh
b8b0a29a2e Refined video player UI behavior
refs https://github.com/TryGhost/Team/issues/1229

- allows pausing video by clicking on video overlay
2021-12-14 21:50:27 +05:30
Rishabh
441307c6ad Updated video card player behavior
refs https://github.com/TryGhost/Team/issues/1229

- refines player control UI behavior on mouseenter
2021-12-14 21:32:52 +05:30
Sanne de Vries
aa80cf415b Refined video controls behaviour
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 16:51:00 +01:00
Sanne de Vries
79a48df75c Updated video card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 16:31:42 +01:00
Rishabh
64b3bbf1a6 Refined video controls behavior
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 21:01:22 +05:30
Sam Lord
97c68dd388
Replace error handler middleware with @tryghost/mw-error-handler (#13879)
refs: https://github.com/TryGhost/Toolbox/issues/137

Extract error handling middleware and replace with a package.
2021-12-14 15:18:46 +00:00
Rishabh
271d2c02b0 Added video overlay icon handling
refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 20:38:07 +05:30
Sanne de Vries
ad35b4f17e Updated video card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 14:44:57 +01:00
Peter Zimon
5ddb2a8a40 Updated file card frontend styles 2021-12-14 14:37:36 +01:00
Sam Lord
80a385ef0c Replace GhostError with InternalServerError
no issue

@tryghost/errors no longer exports GhostError, as we should only be using subclasses. Replace with InternalServerError as a new default, but should be replaced with a relevant error when one exists.
2021-12-14 12:17:48 +00:00
Sam Lord
76f06fae3c
Revert "Revert "Extract logging from DI patterns, only use @tryghost/logging package"" (#13884)
This reverts commit fa8c3ebe99.

Reverting the revert, which will allow us to fully switch to @tryghost/logging v2.
2021-12-14 11:22:39 +00:00
Sanne de Vries
5a798c35ba Updated video card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1229
2021-12-14 11:48:33 +01:00
Sanne de Vries
7db12650f9 Fixed seeker width jumping when playing audio
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-14 09:46:14 +01:00
Fabien egg O'Carroll
ac5aa4e0c5 Logged in members after Stripe Checkout
refs https://github.com/TryGhost/Team/issues/1067

As well as providing a better UX for Members, allowing them to use the
site immediately after payment, rather than having to check emails and
use the magic link to sign in, this should reduce issues with members
signing up twice due to being confused after Stripe Checkout.
2021-12-14 09:54:46 +02:00
Daniel Lockyer
c20cbbbaa5 Updated Admin to v4.29.0 2021-12-14 07:25:03 +00:00
Rishabh Garg
daea92cf3f
Added new audio card
refs https://github.com/TryGhost/Team/issues/1230

- new audio card allows adding custom audio files with thumbnail to post/page
- also adds new file and media API to manage files/thumbnails uploaded for new cards
2021-12-14 10:54:45 +05:30
Sanne de Vries
93a81fc0ca Updated audio card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 22:15:20 +01:00
Sanne de Vries
57969dea6c Refined audio and bookmark frontend styles
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 19:10:06 +01:00
Rishabh
f91bf677ff Removed disallowed amp class names for audio player
refs https://github.com/TryGhost/Team/issues/1230

- `i-amphtml-media-component` class name is not allowed in amp styles as they are disallowed by amp spec
2021-12-13 22:36:30 +05:30
Daniel Lockyer
59d51b58d2 Updated Admin to v4.28.0 2021-12-13 16:58:05 +00:00
Thibaut Patel
3f2e4fc4d0 Added a product card to the editor
closes https://github.com/TryGhost/Team/issues/1245

The product card enables to show product recommendations in pages and posts.
2021-12-13 17:44:53 +01:00
Fabien egg O'Carroll
8966f45993 Added basic input styling for Before/After card
refs https://github.com/TryGhost/Team/issues/1249

This makes the input act as a slider over the image.
2021-12-13 17:41:21 +02:00
Thibaut Patel
2800f538bc Updated the product card classes
refs https://github.com/TryGhost/Team/issues/1245

- Removes dependency from the product card css to other cards' css
2021-12-13 16:13:57 +01:00
Sanne de Vries
8c52e001c1 Refined audio card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 15:54:38 +01:00
Rishabh
7e061cee39 Renamed generic class names for video card
refs https://github.com/TryGhost/Team/issues/1229
2021-12-13 19:01:30 +05:30
Rishabh
cd238c64ba Updated frontend styles for file card
refs https://github.com/TryGhost/Team/issues/1231
2021-12-13 19:01:30 +05:30
djordje vlaisavljevic
1256d28615 Updated product card amp styles
refs https://github.com/TryGhost/Team/issues/1245
2021-12-13 14:23:35 +01:00
Fabien egg O'Carroll
c665b65e03 Added initial CSS&JS for Before/After card
refs https://github.com/TryGhost/Team/issues/1249

This contains the initial frontend code to provide a working slider for
the Before/After card. The JS is enclosed in an IIFE so as to not leak
any variables, and the CSS is all scoped to the card only to avoid
interfering with existing styles.
2021-12-13 15:08:57 +02:00
Sanne de Vries
d4d98d0ab5 Refined audio player UI
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 14:08:39 +01:00
Sanne de Vries
10d59e9795 Updated audio player class-names
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 13:46:19 +01:00
Sanne de Vries
c10db9a885 Fixed audio thumbnail placeholder in email
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 13:35:40 +01:00
Sanne de Vries
c8ebe22a0c Updated audio card AMP styling
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 13:16:51 +01:00
Rishabh
f237879251 Updated loop behavior for video player on theme
refs https://github.com/TryGhost/Team/issues/1229
2021-12-13 17:31:57 +05:30
Rishabh
4205951f7a Added accent background color for default audio thumbnail
refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 16:53:41 +05:30
djordje vlaisavljevic
7f248381ec Updated product card styles
refs https://github.com/TryGhost/Team/issues/1245
2021-12-13 12:22:59 +01:00
Sanne de Vries
d8e49cb039 Fixed background color for transparent pngs as audio thumbnails
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 11:10:11 +01:00
Sanne de Vries
0322c47a58 Fixed audio card responsive behaviour on frontend
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-13 09:10:32 +01:00
Rishabh
3df7737de7 Added custom video player controls
refs https://github.com/TryGhost/Team/issues/1229

- adds custom video player controls, similar to audio player
2021-12-13 13:25:16 +05:30
Peter Zimon
baf6db2a48 Added dynamic styles for star rating in products 2021-12-13 08:31:06 +01:00
Peter Zimon
14f871e244 Adjusted product card frontend styles 2021-12-13 07:59:49 +01:00
Peter Zimon
3ec833266a Fixed NFT card margin 2021-12-13 07:34:43 +01:00
djordje vlaisavljevic
e0cb8cc3c9 Updated product card styles
refs https://github.com/TryGhost/Team/issues/1245
2021-12-12 19:23:42 +01:00
djordje vlaisavljevic
d55e44e5e9 Switched product card frontend to CSS grid
https://github.com/TryGhost/Team/issues/1245
2021-12-11 17:01:43 +01:00
Daniel Lockyer
8b9e1528f0 Updated Admin to v4.27.2 2021-12-10 16:00:27 +00:00
djordje vlaisavljevic
9b2b37b8f1 Updated product card line heights
ref https://github.com/TryGhost/Team/issues/1245
2021-12-10 16:36:18 +01:00
Sodbileg Gansukh
fc4d8d7de0 Fix audio card player button alignment 2021-12-10 11:27:35 +08:00
Rishabh
4f52e28c04 Cleaned up frontend audio card player script
refs https://github.com/TryGhost/Team/issues/1230

- removes unnecessary use of src attribute in the script as the theme file is already loaded with the src
2021-12-10 01:30:06 +05:30
Rishabh
f272da0536 Added post url option for mobiledoc cards conversion to html
refs https://github.com/TryGhost/Team/issues/1231
refs https://github.com/TryGhost/Team/issues/1230
refs https://github.com/TryGhost/Team/issues/1229

- passes post url to mobiledoc html renderer
- allows using the post url in email templates for upload cards, linking the static card ui to post directly
2021-12-10 00:05:07 +05:30
Kevin Ansfield
0fbec65a6e Added headerCard labs flag
refs https://github.com/TryGhost/Team/issues/1253

- setup for an editor card that lets you lay out a header title with background image
2021-12-09 13:35:29 +00:00
djordje vlaisavljevic
5b3f82dda2 Added padding between paragraphs in product card description
refs https://github.com/TryGhost/Team/issues/1245
2021-12-09 13:41:05 +01:00
djordje vlaisavljevic
7f89b07c85 Updated the way star rating colors are shown
ref https://github.com/TryGhost/Team/issues/1245
2021-12-09 13:41:05 +01:00
Sodbileg Gansukh
00546e6ff3 Add resets to audio card form elements 2021-12-09 19:30:30 +08:00
Peter Zimon
dc6e7a690a Updated NFT styles to use px sizings 2021-12-09 11:55:05 +01:00
Peter Zimon
4d59c7a694 Updated button styles to use relative sizings 2021-12-09 11:50:49 +01:00
Sanne de Vries
fc8ecc352f Updated rendering of audio cards without thumbnail
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-09 09:14:01 +00:00
Kevin Ansfield
d4c110a55b Added first pass of video card rendering
refs https://github.com/TryGhost/Team/issues/1229

- bumped @tryghost/kg-default-cards that contains initial video card rendering
- added video card CSS file with basic style that prevents video element rendering larger than the content width (similar to default image styles in most themes)
2021-12-08 18:01:44 +00:00
Rishabh
2d43c12276 Fixed global variable leak for new card scripts
no issue

- wraps the card js scripts into an IIFE to avoid polluting global variables on the site
- also any fixes errors caused by `swup` and its scripts-plugin that trips over already created global variables
2021-12-08 22:58:22 +05:30
Daniel Lockyer
44ad9fde09 Updated Admin to v4.27.1 2021-12-08 16:02:08 +00:00
Fabien egg O'Carroll
55d7176e51 🐛 Fixed card scripts executing before DOM is parsed
no-issue

Using the async attribute means that the script is downloaded in
parallel with the parsing of the html into DOM, and then executed upon
completion. This means that the script cannot be sure that particular
parts of the DOM exist as it may not have finished parsing. This has
resulted in bugs with the new toggle card not working.

Switching our script to use the defer attribute means that the script is
still downloaded in parallel with parsing, but it is not executed until
parsing is complete. This means that the script can safely access the
DOM.
2021-12-08 17:54:37 +02:00
Daniel Lockyer
52491e7a6e Updated Admin to v4.27.0 2021-12-08 15:38:06 +00:00
Kevin Ansfield
b3a57f702b Removed quoteStyles flag
refs https://github.com/TryGhost/Team/issues/1239

- alternative blockquote style feature is no longer behind the flag in Admin so we no longer need the flag server-side
2021-12-08 15:21:49 +00:00
Fabien egg O'Carroll
d6e6f2e4be Added support for rich Twitter embeds in emails
refs https://github.com/TryGhost/Team/issues/1001

This adds custom rendering to Twitter embeds for email newsletters, so
that rather than displaying a plaintext blockquote with the tweet
contents, we render an rich Twitter card.
2021-12-08 17:19:27 +02:00
Daniel Lockyer
fa8c3ebe99 Revert "Extract logging from DI patterns, only use @tryghost/logging package"
This reverts commit 97451a93cb.
2021-12-08 14:28:41 +00:00
Daniel Lockyer
2d090b8b2a Revert "Remove unnecessary references to ghostVersion"
This reverts commit 443ee369d2.
2021-12-08 14:28:41 +00:00
Sanne de Vries
6e4be46fb3 Updated audio card frontend styles in Chrome
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-08 12:22:39 +00:00
djordje vlaisavljevic
e72092fa5e Updated product card frontend styles
refs https://github.com/TryGhost/Team/issues/1245
2021-12-08 12:40:57 +01:00
Rishabh
9cbaab119b Refined audio card player with multiple playback rate options
refs https://github.com/TryGhost/Team/issues/1230

- adds multiple playback rate option to audio card player on click
2021-12-08 16:36:22 +05:30
Thibaut Patel
62988fe1db Added the tweetGridCard feature flag
refs https://github.com/TryGhost/Team/issues/1255

- developer flag for enabling tweet grid cards in the card menus
2021-12-08 10:07:56 +01:00
djordje vlaisavljevic
cb86c06504 Removed unnecessary CSS and !important declarations
refs https://github.com/TryGhost/Team/issues/1245
2021-12-08 10:03:12 +01:00
djordje vlaisavljevic
88238e6403 Updated frontend styles for product card
refs https://github.com/TryGhost/Team/issues/1245
2021-12-07 20:58:42 +01:00
djordje vlaisavljevic
325de3e5cf Updated frontend styles for product card
refs https://github.com/TryGhost/Team/issues/1245
2021-12-07 20:16:45 +01:00
Rishabh
27ced6cc84 Refined audio card player sliders
refs https://github.com/TryGhost/Team/issues/1230

- refines seek and volume sliders for audio player to show progress marker with background color
2021-12-08 00:16:32 +05:30
djordje vlaisavljevic
bf78df0e07 Added frontend CSS file for product card
refs https://github.com/TryGhost/Team/issues/1233
2021-12-07 17:33:13 +01:00
Rishabh
52faba6dac Added dynamic play/pause and unmute state for audio card player
refs https://github.com/TryGhost/Team/issues/1230

- adds dynamic play/pause icon toggle for audio player
- adds dynamic mute/unmute icon toggle for mute behavior
- fixed volume slider not working
2021-12-07 20:43:20 +05:30
Sam Lord
443ee369d2
Remove unnecessary references to ghostVersion
refs: https://github.com/TryGhost/Toolbox/issues/146
GhostVersion was passed in here but not used at all. This just removes those unnecessary usages.
2021-12-07 13:48:22 +00:00
Sanne de Vries
986f731e60 Updated audio card frontend styles
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-07 13:47:36 +00:00
Sanne de Vries
259d40641d Updated audio card playback speed characters
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-07 13:16:04 +00:00
Sanne de Vries
b6544afff5 Updated audio card frontend rendering
Refs https://github.com/TryGhost/Team/issues/1230
2021-12-07 13:04:44 +00:00
James Morris
0aaa1b9c75 Removed more unnecessary styles from blockquote card styles
refs https://github.com/TryGhost/Team/issues/1239
2021-12-07 11:53:46 +00:00
James Morris
5c4cfc785f Removed blockquote selector from card styles plus email tweaks
refs https://github.com/TryGhost/Team/issues/1239
2021-12-07 11:35:58 +00:00
Daniel Lockyer
0d8bc06fb9
Merged v4.26.1 into main
v4.26.1
2021-12-07 09:36:54 +00:00
Daniel Lockyer
9f0d72f159 Updated Admin to v4.26.1 2021-12-07 09:35:14 +00:00
Fabien egg O'Carroll
2a1eb3de88 Improved rendering for twitter newsletter embeds
refs https://github.com/TryGhost/Team/issues/1001

This also adds the missing alpha flag so that we can release this when
it's ready.
2021-12-07 11:23:54 +02:00
djordje vlaisavljevic
aa7d1e240c
🎨 Made toggle card closed by default
refs https://github.com/TryGhost/Team/issues/1209
2021-12-07 09:00:43 +00:00
djordje vlaisavljevic
67b6304807 Made toggle card closed by default
refs https://github.com/TryGhost/Team/issues/1209
2021-12-06 22:15:54 +01:00
Sam Lord
97451a93cb
Extract logging from DI patterns, only use @tryghost/logging package
refs: https://github.com/TryGhost/Toolbox/issues/146

Switched to @tryghost/logging instead of passing around the library. The main sticking points of this change are jobs. When jobs are launched we don't want them to use a separate @tryghost/logging instance because they would start parallel rotation jobs. @tryghost/logging v2.x passes all logs to the parent process if run in a child process, so that we can use the same patterns in jobs and the rest of the codebase.
2021-12-06 18:00:55 +00:00
Daniel Lockyer
070992b316 Updated Admin to v4.26.0 2021-12-06 13:29:21 +00:00
Thibaut Patel
361033ead2 Added a callout card
refs https://github.com/TryGhost/Team/issues/1206

- The callout card displays an emoji and a paragraph of text inside a highlighted box.

Co-authored-by:
- Sanne de Vries (@sanne-san)
2021-12-06 14:13:43 +01:00
James Morris
5b34af9954 Tweaked AMP and email CSS and moved from REM to EM
refs https://github.com/TryGhost/Team/issues/1239
2021-12-06 13:08:02 +00:00
Fabien egg O'Carroll
e43296f1d7 Added include data to Twitter embed
refs https://github.com/TryGhost/Team/issues/1001

This data is required to render information for linked content, for
example images, polls, and mentioned users.
2021-12-06 14:24:59 +02:00
Rishabh Garg
ea54393e88
Added toggle card to editor (#13834)
closes https://github.com/TryGhost/Team/issues/1209

The toggle card allows adding collapsible content in pages and posts.
2021-12-06 17:43:33 +05:30
djordje vlaisavljevic
024f735844 Moved svg arrow styles from inline to CSS file
refs https://github.com/TryGhost/Team/issues/1209
2021-12-06 12:58:47 +01:00
Sanne de Vries
1bc64dc7e4 Fixed callout card link invisible on brand-color background in AMP 2021-12-06 11:02:21 +00:00
Rishabh
2aa353a1a0 Added custom audio player UI for audio card
refs https://github.com/TryGhost/Team/issues/1230

- adds custom css and js for custom audio card player
- bumps `kg-default-cards` to add custom audio player ui for theme
2021-12-06 14:24:41 +05:30
Naz
abcd715907 Fixed express app stacking
refs https://github.com/TryGhost/Toolbox/issues/152

- Because the root app module was initialized only once per runtime it caused all the express apps to stack on each other causing all sorts of strange behavior when trying to test redirects/vhost mounts etc. Lesson here: be very cautious of how the module is initialized, an explicit function is almost always a better way!
2021-12-06 21:28:53 +13:00
Naz
91338b23d9 Fixed typo 2021-12-06 21:28:53 +13:00
Naz
de121e1219 Modified boot to conditionally return an express app
refs 3c7a8dead4

- The idea is a rip-off from the referenced commit. It allows to isolate initialization logic to "frontend" mounted on top of a "parent"
- Gives path to simplify the express-mock tests

Co-authored-by: Hannah Wolfe <erisds@gmail.com>
2021-12-06 21:28:53 +13:00
Naz
b19424acb3 Moved vhost mounts into boot file
refs https://github.com/TryGhost/Toolbox/issues/152

- This stops the mounting of the admin and frontend from being buried deep in express initialisation
- Instead it's explicit, which makes two things almost possible:
   1. we can potentially boot the frontend or backend independently
   2. we can pass services and settings loaded during boot into the frontend
- This needs more work, but we can start to group all the frontend code together
- Meanwhile we also need to rip apart the routing and url services to decouple the frontend from the backend fully
- BABY STEPS!

Co-authored-by: Hannah Wolfe <erisds@gmail.com>
2021-12-06 21:28:53 +13:00
Daniel Lockyer
71b647aab1
Removed unused import
refs ec28478435

- I removed use of the `logging` variable in the last commit so we no
  longer need the library import
- this fixes a linting issue
2021-12-06 08:17:07 +00:00
Daniel Lockyer
ec28478435
🐛 Fixed error when sending messages via bootstrap socket
refs https://github.com/TryGhost/Ghost/issues/13837

- a [refactor](9fa8800b9d) in `@tryghost/bootstrap-socket` changed the signature of the method it exprots, but the use of this
  library wasn't updated in Ghost
- therefore, the library was trying to send the `@tryghost/logging` library, which caused
  errors with Ghost-CLI down the line, as mentioned in the issue
- this commit updates the method signature to match what is expected
2021-12-06 08:04:26 +00:00
Peter Zimon
8515388ce6 Added Twitter styles to email template 2021-12-04 10:34:47 -04:00
Fabien egg O'Carroll
94cfbb19fc Added fallback for NFT title when name is missing
no-issue

Some NFT's are created without a title, for example the Bored Ape Yacht
Club collection does not name the tokens, instead just referring to them
by ID. This change falls back to the token_id, which is unqiue within
the collection to support these tokens.
2021-12-03 21:16:22 +02:00
Fabien egg O'Carroll
e5068a6557 Updated email content for paid signups
refs https://github.com/TryGhost/Team/issues/1067

Changes based on product feedback.
2021-12-03 21:15:55 +02:00
djordje vlaisavljevic
18be68a4bb Updated the spacing between toggle cards on frontend
refs https://github.com/TryGhost/Team/issues/1209
2021-12-03 17:55:26 +01:00
Daniel Lockyer
4716c76044 Updated Admin to v4.25.1 2021-12-03 16:00:37 +00:00
djordje vlaisavljevic
c229ada2b5 Updated toggle styles
refs https://github.com/TryGhost/Team/issues/1209
2021-12-03 16:41:50 +01:00
Sanne de Vries
c0d5711d6d Added link styling for callout card with brand color as background
Refs https://github.com/TryGhost/Team/issues/1206
2021-12-03 14:08:18 +00:00
Sanne de Vries
a07580b890 Updated callout card default styles
No ref

- Added default font sizes and line heights
- Switched from absolute to relative units to adapt to different themes
2021-12-03 13:28:19 +00:00
djordje vlaisavljevic
5c7e935b78 Removed the background from the arrow button
refs https://github.com/TryGhost/Team/issues/1209
2021-12-03 10:41:22 +01:00
Sanne de Vries
dae4cd7de6 Updated AMP styling for callout cards
Refs https://github.com/TryGhost/Team/issues/1206
2021-12-03 09:39:49 +00:00
djordje vlaisavljevic
07855bf8dc Updated toggle transition
refs https://github.com/TryGhost/Team/issues/1209
2021-12-02 19:42:38 +01:00
djordje vlaisavljevic
1a3b78bbff Fixed toggle transition
refs https://github.com/TryGhost/Team/issues/1209
2021-12-02 18:49:18 +01:00
James Morris
6f9fd79120 Add a basic style for alternative quote for AMP 2021-12-02 14:13:50 +00:00
James Morris
f13a49233c Add blockquote alternative card styling 2021-12-02 14:13:50 +00:00
James Morris
1731723624 Alternative quote for email template 2021-12-02 14:13:50 +00:00
Fabien egg O'Carroll
24e78dc60f Added alpha flag for Before/After card
refs https://github.com/TryGhost/Team/issues/1249

Until release this card will be behind a flag.
2021-12-02 12:29:11 +02:00
Thibaut Patel
77c0364efd 🐛 Fixed malformed URLs crashing the url helper
refs https://github.com/TryGhost/Team/issues/960

- Character like "%%" or "%80" would crash our current url escaping behavior. We consider they aren't valid URLs as the percentages haven't been properly escaped.
2021-12-02 10:34:24 +01:00
Hannah Wolfe
ecbdb2284e
Fixed MIME type for public/cards.min.js part deux
refs: 580ebfad39

- correct mime type is application/javascript
- mime types are weird
2021-12-02 09:03:06 +00:00
Marat Vyshegorodtsev
580ebfad39
Fixed MIME type for public/cards.min.js (#13808)
- This script does not load if `x-content-type-options: nosniff` is enforced due to wrong MIME type
2021-12-02 09:01:18 +00:00
Thibaut Patel
7d9721dd54 Added one error catching inside the oembed service
refs https://github.com/TryGhost/Team/issues/1200

- The error was fixed in a1421c2380
- The error catching prevents future 500 errors in the API
- The logging enable visibility on these errors to fix them if they happen
2021-12-01 17:46:23 +01:00
Daniel Lockyer
faef8f5f6d Updated Admin to v4.25.0 2021-12-01 15:49:29 +00:00
Thibaut Patel
a1421c2380 🐛 Fixes oembed bookmark with whitespaces
refs https://github.com/TryGhost/Team/issues/1200

- The leading/trailing whitespaces are trimmed by `new URL()` but are considered invalid in metascraper. Trimming solves this edge case.
2021-12-01 15:58:09 +01:00
Sanne de Vries
ea50944897 Updated callout card class for consistency
No ref

- Swapped "kg-card-callout" for "kg-callout-card"
2021-12-01 14:25:33 +00:00
Fabien egg O'Carroll
1096488446 Added NFT Card support to Ghost
refs https://github.com/TryGhost/Team/issues/1211

The NFT card allows embeding NFT's from OpenSea in posts and pages.
2021-12-01 16:02:52 +02:00
Peter Zimon
a727135800 Updateed Button styles to support alignment 2021-12-01 09:44:32 -04:00
Kevin Ansfield
e9df5b9310 Fixed linter error
refs f91fc2add5

- with the removal of the labs check the labs service require is no longer used
2021-12-01 12:32:10 +00:00
Kevin Ansfield
f91fc2add5 Finished gifsCard labs flag removal
refs 5aa08acd33

- removed the flag check in public config output
- fixes failing tests
2021-12-01 12:29:50 +00:00
Naz
3150c87935 Fixed hidden validation error during frontend reload
refs https://github.com/TryGhost/Toolbox/issues/151
refs cbec6aa49e

- Without the await the try/catch block does not catch a pottential validation error straight away, which leads to a 500 error instead of a validation error being returned. The regression was introduced during the refactor (part of referenced commit).
2021-12-01 16:24:09 +04:00
Kevin Ansfield
5aa08acd33 Removed gifsCard labs flag
refs cec3d91c57

- flag is no longer used by Admin
2021-12-01 12:21:40 +00:00
Kevin Ansfield
9790de1413 Removed buttonCard labs flags
refs e9472b3ee9

- flag is no longer used in Admin
2021-12-01 12:21:09 +00:00
Hannah Wolfe
004371be36
Revert "Removed overly-specific handling of handlebars errors"
This reverts commit 303ea87897.

- Although gscan catches these now, we have a number of sites that have slipped through the net
- Reverting until we get them all cleaned up
2021-12-01 12:04:36 +00:00
Hannah Wolfe
9f11140ec4
Split theme engine middleware into separate files
- one big file full of stuff is never good for clarity
- separating it out helps us see what requires what
- it also highlights the awful naming and opaque behaviour we have in themes - much to do, but this helps us start
2021-12-01 12:04:36 +00:00
Naz
e6503e5148 Fixed invalid filename error during settings restore
refs https://github.com/TryGhost/Toolbox/issues/151
refs cbec6aa49e

- The error was happening due to incorrect "this" context. Because the filename and extension are only used once in this class and only for the purposes of the error message have moved the whole thing into the error message itself. No need to keep additional variables around when there's no clear usecase.
2021-12-01 15:47:13 +04:00
Sam Lord
18b8eddd0d Added linting for use of @tryghost/errors
refs: https://github.com/TryGhost/Toolbox/issues/147
Errors in @tryghost/errors rely on being called with an object (with a `message` member) rather than with a string.
2021-12-01 11:22:21 +00:00
Fabien egg O'Carroll
579b34434f Added separate confirmation email for paid signups
refs https://github.com/TryGhost/Team/issues/1067

As part of the work of automatically logging members in after payment,
we want to revisit the emails. Currently after payment we send an email
asking a member to _confirm_ their subscription, and that they can
ignore the email to cancel the subscription. This is not the case
however, as the member has already been subscribed.
2021-12-01 12:42:11 +02:00
Sam Lord
2887e416da
Switch to @tryghost/errors from ignition errors package (#13807)
refs: TryGhost/Toolbox#147

* Replaces all references to isIgnitionError with isGhostError
* Switches use of GhostError to InternalServerError - as GhostError is no longer public
There are places where InternalServerError is not the valid error, and new errors should be added to the @tryghost/errors package to ensure that we can use semantically correct errors in those cases.
2021-12-01 10:22:01 +00:00
Fabien egg O'Carroll
c77263f35b Redirected to original image when resizing fails
refs https://github.com/TryGhost/Team/issues/1234

Sharp can occasionally fail resizing, this is usually due the the
underlying libvips library failing. We do not want this to cause an
error however, instead we should just show the original image - as
resizing is an optimisation, rather than a requirement.
2021-12-01 10:42:27 +02:00
Fabien egg O'Carroll
616cd107df Updated Tenor default config keys
refs https://github.com/TryGhost/Team/issues/1237

Including the scope & visibility of api keys as outlined in the issue.
2021-11-30 13:35:34 +02:00
Fabien egg O'Carroll
e6856f6ac6 Initial custom embed provider for Twitter
refs https://github.com/TryGhost/Team/issues/1001

We fall back to existing behaviour if no API key is present, or if there
is an error communicating with the Twitter API. We're also currently
requesting all the data, which will be thinned down once we understand
what we need.

This also includes a custom renderer for embeds of type "twitter" which
will be used to output the custom HTML for emails
2021-11-30 12:58:25 +02:00
Fabien egg O'Carroll
c4021b6eb4 Added OpenSea API key to config
refs https://github.com/TryGhost/Team/issues/1237

We want to use an API key for OpenSea where possible so that we do not
run into rate limit issues.
2021-11-30 12:58:25 +02:00
djordje vlaisavljevic
fb95fe2d48 Fixed Toggle card email view refs https://github.com/TryGhost/Team/issues/1209 2021-11-29 19:22:40 +01:00
Hannah Wolfe
ad9eb35746
Moved theme-specific error handling to frontend
- our themeErrorRenderer is only used in the frontend.. move it there
- this required exposing prepareError as shared middleware
- TODO: move these shared compontents to @tryghost/error
2021-11-29 17:04:01 +00:00
Hannah Wolfe
d7c4168452
Removed HTMLErrorRenderer completely
refs: 0799f02e80
refs: 5e931e2e37

- with the referenced two commits I replaced our old HTML renderer with some code borrowed heavily from finalHandler
- I had intended to modify this further to out put our message, context and help error messages
- However, I ended up doing this in prepareError so it's done for all error renderers
- There's now very little point keeping duplicated code from finalHandler just to output the status code
- If we remove this code, express will fall back to finalHandler anyway, so the output is near identical
2021-11-29 17:00:47 +00:00
Hannah Wolfe
3b069b544f
Cleaned code patterns in error handler
- got rid of old _private & variable pattern in favour of const and module.exports
- changed weird capitalisation naming conventions to be camelCase
- removed some very old TODOs that we're never gonna get TODONE
   - these are mostly old ideas that never made it, and it's been so long they're clearly not important
2021-11-29 16:53:58 +00:00
Sam Lord
a21b91cc71 Added lint rules for migrations
refs: https://github.com/TryGhost/Toolbox/issues/105

Lint rules prevent:

* Invalid naming conventions for new migrations
* Loop constructs in migrations - these should be used with caution
and are therefore a warning rule, use `// eslint-disable-next-line
no-restricted-syntax` to prevent this rule from firing where a loop is
required
* Returing within a loop - this is usually meant to be a
continue/break
* Multiple joins - these can be badly performing migrations, so should
be treated with caution, disable the rule for the line if the risk is
understood / the migration cannot be written without it
2021-11-29 16:21:43 +00:00
Hannah Wolfe
8c93bdff41
Removed unnecessary BasicErrorRenderer
refs: 4474ca1a1d
refs: 0799f02e80

The BasicErrorRenderer was created as a fallback for when we needed to not render templates, which is
chiefly when we're trying to render a 404 for an image. Using a template puts us at risk of an infinite 404 loop
if the missing image is referenced in the 404 template.

As of 0799f02e, the HTMLErrorRenderer no longer uses templates - instead we serve a very simple HTML page.
This can be used instead of the BasicErrorRenderer, as it results in a properly formatted error.
Even when sending responses in plain text, the content type is returned as HTML and therefore having an
unformatted error makes no sense - if we really need a non-html format I guess there should be no body at all.
2021-11-29 15:40:55 +00:00
Naz
fa9d2a4105 Reworked media API thumbnail endpoint
refs https://github.com/TryGhost/Toolbox/issues/120

- Having an "options" parameter in the controller definition was missleading as if the `url` or `ref` parameters were expected as a part of the qurey parameter. These variables should be provided as a part of the request body, thus having them in "data" attribute is more accurate
2021-11-29 13:12:47 +04:00
Daniel Lockyer
1dff8fabf2 Updated Admin to v4.24.0 2021-11-26 16:00:26 +00:00
Naz
b807be9699 Added JSDocs to redirects validator
refs https://github.com/TryGhost/Toolbox/issues/139

- Makes the expected file formatting easier to reason about
2021-11-26 06:18:36 +13:00
Naz
6ed5f64f4b Moved backup path calculation outside redirects module
refs https://github.com/TryGhost/Toolbox/issues/139

- Having tight coupling with backup file path calculation for redirects makes it extremely hard to test. In addition, having it injected will make it easier to swap this dependency to the mechanism similar to one used for routes files
2021-11-26 06:18:36 +13:00
Naz
edfe81e11c Moved validation dependency to constructor param
refs https://github.com/TryGhost/Toolbox/issues/139

- Having no external dependencies makes the class way easier to test
2021-11-26 06:18:36 +13:00
Naz
e6c9bcdf22 Moved custom redirects initialization to frontend init secton
refs https://github.com/TryGhost/Toolbox/issues/139

- The custom redirects services belong in the  initServicesForFrontend because frontend depends on these to function properly. When placed in general init section the middleware would not get initialized properly before it's used by the "frontend express app"
2021-11-26 06:18:36 +13:00
Naz
fd0a0ddf47 Refactored CustomRedirectsAPI constructor
refs https://github.com/TryGhost/Toolbox/issues/139

- The pattern we use accross the codebase is a single "options" object passed into a constructor instead of passing multiple parametes. Fixed the broken pattern in CustomRedirectsAPI constructor
2021-11-26 06:18:36 +13:00
Hannah Wolfe
303ea87897
Removed overly-specific handling of handlebars errors
refs: https://github.com/TryGhost/Ghost/issues/10496
refs: https://github.com/handlebars-lang/handlebars.js/issues/1548

- For a while, handlebars would and could generate quite a lot of obscure sytnax error messages for malformed helpers that we couldn't catch in gscan
- This was fixed in https://github.com/handlebars-lang/handlebars.js/issues/1548
- We have also since added AST parsing to gscan, so if there are more obscure syntax errors, we should be able to add rules to catch them
- Therefore, this additional, overly specific code block isn't needed anymore, so let's clean it up!
2021-11-25 14:53:36 +00:00
Naz
3315ed34ae 🐛 Fixed redirects.json file corruption on upload
refs 91efa4605c

- Referenced commit introduced a double json-stringification to uploaded redirects.json files.
- The endpoint has no stability index of any sort and is meant to be dropped in Ghost v5. It's best to rework the redirects to the yaml format as descirbe here - https://ghost.org/docs/tutorials/implementing-redirects/#file-structure
2021-11-25 18:43:45 +04:00
Hannah Wolfe
621cfd9866
Moved admin redirect middleware to named file
- moving this middleware because we're about to add a second piece of middleware
- it's easier to see what we have when each middleware is in its own file rather than in one big middleware.js file
2021-11-25 14:29:17 +00:00
Daniel Lockyer
d92eebd74e
Merged v4.23.0 into main
v4.23.0
2021-11-25 12:18:12 +01:00
Daniel Lockyer
de75b26976 Updated Admin to v4.23.0 2021-11-25 11:16:29 +00:00
Fabien 'egg' O'Carroll
483ba3e0f9
Truncated offers.name to 40 characters (#13781)
refs https://github.com/TryGhost/Team/issues/1236

We use Offer names for the Stripe Coupon name - which has a limit of 40
characters. We are now introducing a limit of 40 characters to Offer
names too. This migration ensures that all our data in the DB is valid.
2021-11-25 11:48:08 +01:00
Kevin Ansfield
f5f02d7168
Fixed errors being swallowed in oembed service
no issue

When switching the oembed service to async/await the error handling was not correctly refactored. `this.errorHandler(url)` was returning a curried function so it could be used as `.catch(this.errorHandler(url))` but that's not how it's being used after the async/await change meaning we were returning a function rather than the result of that function.

- `this.errorHandler(url)` is now only used in one place where `url` is available so removed the method and moved the body of the curried function inline into the `catch` handler
- added a message to the logged error so it's more clear what the log refers to
2021-11-25 11:38:49 +01:00
Fabien 'egg' O'Carroll
eace98d787
Truncated offers.name to 40 characters (#13781)
refs https://github.com/TryGhost/Team/issues/1236

We use Offer names for the Stripe Coupon name - which has a limit of 40
characters. We are now introducing a limit of 40 characters to Offer
names too. This migration ensures that all our data in the DB is valid.
2021-11-25 12:33:22 +02:00
djordje vlaisavljevic
9655ad1e88 Fixed the selector for toggle headings 2021-11-25 09:07:47 +01:00
Sodbileg Gansukh
93f24575bb Improved gallery card mobile styling
Adds a self-contained CSS custom property for gap which makes it easier to change its value
2021-11-25 14:04:40 +08:00
Sodbileg Gansukh
48e1abae52 Improved bookmark card mobile styling 2021-11-25 13:56:05 +08:00
Kevin Ansfield
7cc0fa6e62 Added quoteStyles labs flag
refs https://github.com/TryGhost/Team/issues/1239

- we're experimenting with adding an alternative blockquote style in addition to the current blockquote style
2021-11-24 16:33:47 +00:00
Hannah Wolfe
5e931e2e37
Added err.context & err.help to stack traces
- When we handle errors in Ghost, we are supposed to use a pattern of supplying 3 messages:
   - message: what went wrong
   - context: details about why how or where the error happened
   - help: where the user can go to get help with this error
- We do this in many places and our JSON error handler and CLI error logging tools are designed to output this extra information
- However, stack traces, which start with message as the first line and then output the stack are totally missing this
- By injecting the additional messages into the stack once an error has been "ghostified" we should get clearer messages everywhere

Notes:
- I've additionally injected a "Stack Trace:" line that makes it easier to read the error vs the stack
- This code looks a little weird because the lines are inserted backwards, but that allows us to always to the insert at position 1 as per the comment,
   so we don't have to keep track of whether we already injected something or not
2021-11-24 13:01:06 +00:00
Hannah Wolfe
0799f02e80
Rewritten HTMLErrorRenderer w/o asset helper & template
refs: 2af9e2e12

- This new HTMLErrorRenderer is borrowed heavily from finalHandler
   - This is the module that express uses to render errors if there is no custom errorhandler
- It just renders a really simple html page wrapping err.stack in a <pre>
   - This results in a nicely formatted, but unstyled error page
- I also updated BasicErrorRenderer to use the same res.statusCode + err.stack pattern rather than err.message

Note: This error renderer is _only_ used for renderering errors on the `/ghost/` route
 - In almost all cases, errors here are rendered by Ember
 - The only error that can be rendered here is a missing template error see: 2af9e2e12
2021-11-24 13:01:06 +00:00
Hannah Wolfe
2af9e2e125
Fixed error handling for missing admin templates
- If the admin templates default.html or default-prod.html are missing, don't throw a 500
- Instead throw a well considered 400 error with extra help for what to do to fix it
2021-11-24 12:30:41 +00:00
Hannah Wolfe
0c4c9ce553
Moved JSON error handlers next to each other
- helps for comparing and contrasting
- context is largely lost on why we have these two, need to figure it out and if possible, simplify
2021-11-24 11:42:53 +00:00
Hannah Wolfe
f417c4c732
Merged our two maintenance middleware into one
- Reduced our maintenance middleware code down to the bare minimum!
  - We have an old maintenance middleware in place to handle when a site is forcibly put into maintenance mode, or the urlService hasn't finished booting
    - This maintenance middleware was mounted on every sub app, instead of globally for reasons I no longer remember
  - Recently, we introduced a new, static version of maintenence middleware to show during the boot process so we can get the server started earlier & not drop requests
    - This version has its own HTML template and doesn't depend on any of Ghost's error rendering code
  - To simplify and help with decoupling, this commit merges the two middleware, so that the new independent & static middleware renders its template for any one of the 3 possible maintenance modes
    - It only needs to exist in the top level app 🙌

TODO: move the maintenance middleware to its own file/package so it's not part of the app.js as that is weird
2021-11-24 11:27:18 +00:00
Hannah Wolfe
6247aa4d8b
Added missing async/await calls
- throughout the theme activation flow there are several missing awaits and necessary async keywords
- we should be waiting on these processes, not letting them complete indeterministically
2021-11-23 17:24:50 +00:00
Hannah Wolfe
b98fd62a3d
Moved card-asset load to be last on activate
- I think this is the least important process, so it can go last
2021-11-23 17:24:49 +00:00
Hannah Wolfe
4c7330125f
Improved error handling in card-assets
refs bb47b9e327

- EACCESS error was previously caught to stop the boot process from failing with perms errors
- For clearFiless, we do not care if these files cannot be removed. Refactored to use allSettled which means we don't do them in sequence + can ignore the outcome
- For minifiy, this is now a legit error, however we don't need the activate method to fail for an EACCES error, we just need an error to be shown (I think)
2021-11-23 17:24:49 +00:00
Naz
6ee94f66b4 Fixed invalid settings file path configuration
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings
refs e457fd5fe0 (diff-b292e8480eee007786cc602f55ed05006a06b8da9fe6934d51fbef8328013278R36)

- There were two separate instances of the SettingsPathManager in route-settings and settings-loader causing the configured paths missmatching on test environment. Because of this missmatch, uploading and resetting the routes.yaml file didn't work!
2021-11-24 05:32:20 +13:00
Naz
2fed8dbbd5 Moved all settings module bootstrap logic into init method
refs refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- The initialization outside the init method is causing problems when the configs are mocked during the test setup
2021-11-24 05:32:20 +13:00
Naz
cbec6aa49e Refactored route settings module into class
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- It's a step to making the module follow class+DI pattern before fully extracting it into an external libarary
- Reminder, doing in Ghost repo instead of substituting big chunks all at once to have clear history of how the service evolved prior to the extraction into external lib!
2021-11-24 05:32:20 +13:00
Naz
a9d742c2d3 Extracted getBackupFilePath out of route settings module
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings
refs e457fd5fe0 (diff-b292e8480eee007786cc602f55ed05006a06b8da9fe6934d51fbef8328013278R36)

- The method is used in a similar fassion in redirects modules, so should be a gret target for extraction and reuse.
- Bonuses: we drop 'path' and 'moment-timezone' dependencies from route settings module!
2021-11-24 05:32:20 +13:00
Naz
6d6aa12afe Extracted routes.yaml path calculation into external package
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings
refs e457fd5fe0 (diff-b292e8480eee007786cc602f55ed05006a06b8da9fe6934d51fbef8328013278R36)

- The full logic for  file path calculation for routes.yaml has been duplicated in couple modules. It is aslo following similar pattern used in redirects services and should be reused there once those modules are touched
2021-11-24 05:32:20 +13:00
Hannah Wolfe
0ede559d5b
🐛 Fixed card asset init/reload behaviour
- Card asset reloading was incorrectly only happening if the API version changed 🙈
- In addition, having an init function was redundant, as theme activation happens on boot
- This meant that the card assets were being generated twice on boot
- Instead, we now only generate them on theme activation, which covers the boot case and simplifies all the logic
2021-11-23 12:53:58 +00:00
Hannah Wolfe
6e6a4822f2
Updated servePublicFile to honor v= cache keys
- Currently it's assumed that public files are 100% static
- With card assets, we're using it for files that are partially static, but can change between reboots and theme changes
- We already have a system for managing cache busting across theme changes and restarts - the ?v= key that is added via the asset helper
- This was already in place and used, but servePublicFile's internal cache didn't honor this key, and cached for the lifetime of boot
- This small change means that if a ?v= query param is present on a request for a public file, that we pay attention to it. Else we cache as before
2021-11-23 12:49:53 +00:00
Kevin Ansfield
1190ff1df0 Fixed errors being swallowed in oembed service
no issue

When switching the oembed service to async/await the error handling was not correctly refactored. `this.errorHandler(url)` was returning a curried function so it could be used as `.catch(this.errorHandler(url))` but that's not how it's being used after the async/await change meaning we were returning a function rather than the result of that function.

- `this.errorHandler(url)` is now only used in one place where `url` is available so removed the method and moved the body of the curried function inline into the `catch` handler
- added a message to the logged error so it's more clear what the log refers to
2021-11-23 10:58:52 +00:00
Naz
9c77abebb5 Removed force start from themes test
refs https://github.com/TryGhost/Toolbox/issues/135

- Looking closer into the reason why the test was failing without "forceStart" revealed that the server only start  was overoptimized - "initServicesForFrontend" should be a part of a backend as those are generic theme services.
2021-11-22 17:47:44 +04:00
Naz
23ba543abd Removed forceStart in theme e2e tests
refs https://github.com/TryGhost/Toolbox/issues/135

- The reason the test **settings** test was failing when the force start flag was removed in the **custom themes** was the bridge! The bridge was trying to execute function on the frontend when the boot was done without initializing the frontend. The setting test was changing locale and the timezone which triggered events calling up on frontend components - we clearly don't want to do this when the instance is booted without the frontend
- To make event initialization conditional moved it to the "init". This way the event listeners are only set up when we boot with the "frontend" flag set to true
2021-11-22 14:51:23 +04:00
Thibaut Patel
3a6efc73b3 Added productCard labs flag
refs https://github.com/TryGhost/Team/issues/1233

- flag for the product card development
2021-11-22 11:46:28 +01:00
Sanne de Vries
9e513f334a Fixed callout card emoji alignment
Refs https://github.com/TryGhost/Team/issues/1206
2021-11-22 10:52:21 +01:00
Sanne de Vries
969921f444 Fixed accent color background in email callout cards
Refs https://github.com/TryGhost/Team/issues/1206
2021-11-22 10:45:03 +01:00
Naz
917641be4f Removed no backend optimization in boot
refs https://github.com/TryGhost/Toolbox/issues/135

- The expectation is to only skip monting the backend API routes instead of skipping creation of whole GhostServer
2021-11-22 21:56:32 +13:00
Naz
bbc93ff996 Renamed withBackend/withFrotned to backend/frontend
refs https://github.com/TryGhost/Toolbox/issues/135

- Shorter name still makes sense and the "with" might be causing confusion understanding what's gonig on during the boot time
2021-11-22 21:56:32 +13:00
Naz
149c100b4c Fixed frontend initialization in "mock-express" tests
refs https://github.com/TryGhost/Toolbox/issues/135

- Without sensible defaults the web app was not initializing either the backend nor the frontned parts of the application. Fixed the defaults so the problem doesn't happen again and optimized mock-express-style initialization to only initialize the frontend routing
2021-11-22 21:56:32 +13:00
Naz
d0dfac438d Changed /^testing/ regexp use to startsWith method
no issue

- `startsWith` method is way easier to read and understand. also, **probably** has better performance comparing to building up a regexp and then matching
2021-11-22 21:56:32 +13:00
Naz
ae397eecdf Fixed UrlService initialization
refs https://github.com/TryGhost/Toolbox/issues/135

- When there's no instance of cache available the code to retreive it should not execut. Duh!
2021-11-22 21:56:32 +13:00
Naz
ae5dd8ad30 Fixed event listener pileup
refs https://github.com/TryGhost/Toolbox/issues/135

- When instantiating new Urls/Resources object in the UrlService's init on every test suite start it was loosing track of past events (softReset wasn't doing the cleanup properly). Not initializing new classes "fixes" the problem partially, by not loosing track of those event listeners. The real fix should be proper even listener cleanup on every soft reset!
2021-11-22 21:56:32 +13:00
Naz
34b0196c0f Added writeDisabled flag to URL file cache
refs https://github.com/TryGhost/Toolbox/issues/135

- Allows to turn off overwriting urls/resources JSON file caches on testing environment. This is needed to have predictable state when running multiple test suites that stop the Ghost process and try to persiste URL cache.
2021-11-22 21:56:32 +13:00
Naz
ee4d2dd1a8 Extracted a local file cache class for URLs
refs https://github.com/TryGhost/Toolbox/issues/135

- This extracts the file storage knowledge out of the URL Service an allows to have optional features based on the environment - for example turning off writing cache for when running tests
2021-11-22 21:56:32 +13:00
Naz
3b390639c4 Introduced booting from fixture url cache in test environment
refs https://github.com/TryGhost/Toolbox/issues/135

- To be able to reliably start ghost instance without a frontend the process needs access to urls/resources caches
- Storing the configuration in "paths" for now as there's no better place for it untill we are able to mock the content folder in pre-boot
2021-11-22 21:56:32 +13:00
Naz
c12ae81ece Introduced "withFrontend" and "withBackend" flags in boot
refs https://github.com/TryGhost/Toolbox/issues/135

- These flags are meant to control initialization of sections of the boot sequence depending on the needs - with or without bakend (API)/frontend (public handlebars site)
- Ideally these flags should not be passed deep into the components, and if the are (like in the web/parent/app case) it's a smell that we need to move things up into the boot process!
2021-11-22 21:56:32 +13:00
Rishabh
b59330c392 Added labs flag for file upload cards
refs https://github.com/TryGhost/Team/issues/1229
refs https://github.com/TryGhost/Team/issues/1230
refs https://github.com/TryGhost/Team/issues/1231
2021-11-22 13:25:34 +05:30
djordje vlaisavljevic
c77059f645 Updated accordion frontend styles 2021-11-19 19:00:59 +01:00
djordje vlaisavljevic
8fa2a45dd8 Removed flex from accordion content 2021-11-19 18:40:53 +01:00
djordje vlaisavljevic
d562166d26 Updated accordion frontend styles 2021-11-19 18:35:11 +01:00
djordje vlaisavljevic
b2f7b00875 Updated accordion frontend styles 2021-11-19 18:35:11 +01:00
Daniel Lockyer
85d0ee3568 Updated Admin to v4.22.4 2021-11-19 16:00:31 +00:00
Hannah Wolfe
592d02fd23 🐛 Fixed perms error when building public assets
closes: https://github.com/TryGhost/Ghost/issues/13739

- Ghost cannot write to the core folder in correctly configured production installations
- Built assets therefore need to be written to the content directory
- Ghost does not overwrite anything in the content folder as part of an upgrade, therefore static files that are provided by Ghost
  must still live inside /core
- So as a result, we now have core/frontend/public and content/public
2021-11-19 11:36:45 +00:00
Peter Zimon
f0a5c32411 Updated NFT card markup 2021-11-19 11:59:45 +01:00