Commit Graph

10208 Commits

Author SHA1 Message Date
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
Hannah Wolfe
80358266b2 Added perf-improving PRAGMAs in testing mode
- These two things are meant to improve performance at the cost of reliability.
- Perfect for testing, however I think they make a minimal impact on modern SSDs :(
- Still worth a shot to see if it helps with CI
2021-11-19 10:47:21 +00:00
Peter Zimon
b417489664 Fixed default alignment for NFT cards 2021-11-19 11:02:17 +01:00
Sodbileg Gansukh
e7c810caf6 Removed callout text specific CSS, and fixed the vertical alignment 2021-11-19 16:00:39 +08:00
Rishabh
36b4c7de78 Refined frontend and email styles for toggle card
refs https://github.com/TryGhost/Team/issues/1209
2021-11-19 09:55:19 +05:30
djordje vlaisavljevic
aa00428e1f Updated accordion frontend styles 2021-11-18 21:49:06 +01:00
Sanne de Vries
53c22e5c08 Updated callout card rendering
Refs https://github.com/TryGhost/Team/issues/1206
2021-11-18 20:43:44 +01:00
Peter Zimon
7892bc9dfe Added button AMP styles 2021-11-18 17:54:36 +01:00
Daniel Lockyer
80d5f89382 Lazy loaded cheerio dependency
refs https://github.com/TryGhost/Toolbox/issues/136

- `cheerio` isn't needed during the boot but it takes time and memory to
  load the library
- this commit moves `cheerio` requires later into the code to when they
  are needed
2021-11-18 17:31:04 +01:00
Peter Zimon
bf18b89a45 NFT card refinements
- Added AMP support
- Refined default frontend styles
2021-11-18 17:29:18 +01:00
Peter Zimon
45a814f596 Added Opensea logo to NFT cards 2021-11-18 17:29:18 +01:00
djordje vlaisavljevic
bc457e206f Updated Accordion card styles on frontend 2021-11-18 09:58:14 +01:00
Kevin Ansfield
ca26c3ab0a Added logging of unexpected errors in oembed service
no issue

- if we encounter an unexpected error whilst fetching embed details we return a generic validation error so we're not leaking any details about the URL that is being hit, however that meant the error logs were only showing validation errors making debugging difficult
- added explicit logging of the unexpected error before throwing the generic validation error
2021-11-17 13:31:20 +00:00
Peter Zimon
bbceace31c Implemented table based NFT email styles 2021-11-17 14:05:39 +01:00
Sam Lord
0692ddf57d Revert "Replace update user last seen middleware with package version"
This reverts commit 07f8c6efbb.

Revert "Remove unused unit test file"

This reverts commit f1798119d3.
2021-11-17 11:00:55 +00:00
Sodbileg Gansukh
43ec108f75 Updated bookmark card CSS 2021-11-17 18:24:18 +08:00
Sodbileg Gansukh
dad9dba872 Updated gallery card CSS 2021-11-17 18:24:18 +08:00
Hannah Wolfe
332beaaf90
Moved "vhost-utils" to config helpers
- These are simple functions that get data from config in a specific format
- They are also used by the topmost part of the application
- Config helpers seems like a reasonable fit to get them out of the web folder
- Functions have also been renamed to try to get them to make more sense
2021-11-17 08:37:08 +00:00
Fabien O'Carroll
e6773d00e6 Updated NFT Embed custom provider
refs https://github.com/TryGhost/Team/issues/1211

Added ?format=json to the URL in an attempt to mitigate any issues with
weird caching and receiving HTML rather than JSON.

Used `type` in place of `card_type` to closer follow how the bookmark
card/embed works.

Removed the html & width/heihgt properties which are not needed at all.
2021-11-16 21:28:36 +02:00
Sanne de Vries
b6b024b132 Fixed missing bottom spacing on email callout cards 2021-11-16 19:19:49 +01:00
Kevin Ansfield
63b7ef7dc6 Added Tenor contentFilter setting to config
refs https://github.com/TryGhost/Team/issues/1217

- moved top-level `tenorApiKey` to `tenor:apiKey` and added `tenor:contentFilter`
- added base config to `defaults.json`
- updated `public-config.js` and API output serializer to use the new top-level `tenor` key
2021-11-16 17:42:26 +00:00
Sanne de Vries
9fba3d6661 Updated callout card for dark mode themes
Refs https://github.com/TryGhost/Team/issues/1206

- Switched to semi-transparent background colors so that it works out of the box with dark mode themes
2021-11-16 18:35:34 +01:00
Sam Lord
a5484a0fe1 Fixed transaction logic in data importer
https://github.com/TryGhost/Toolbox/issues/130

The transaction no longer commits in the promise chain, which wasn't
valid logic for a transaction, since it is commited automatically when
the promise chain resolves, and rollsback automatically when the
promise chain rejects.

This makes code which fails during the transaction error in the right
place, instead of getting stuck here. (Especially good for writing
tests).

The tests for this code can now live in the integration folder.
2021-11-16 17:09:55 +00:00
Sam Lord
07f8c6efbb Replace update user last seen middleware with package version
no issue

Part of the goal to move these middleware packages to remove untested code from the codebase
2021-11-16 15:58:45 +00:00
Hannah Wolfe
4f9b72ff43
Renamed middlewares to middleware consistently
- This is a minor bugbare, but it will affect some configuration I'm about to do for c8
- I've been wanting to do it for ages, middleware is plural all on it's own so it's an odd affectation in our codebase
- This also only exists in 2 places, everywhere else we use "middleware"
- Sadly it did result in a lot of churn as I did a full find and replace, but consistency is king!
2021-11-16 15:51:47 +00:00
Hannah Wolfe
9a8b18a473
Swapped boot order for version util
- The version util is now required in logging as well as sentry and migrations
- I can see us needing it in config too, so put it straight to the first item
- we do this so that the debug statements can tell us how long each step took as we look to optimise everything
2021-11-16 14:44:14 +00:00
Hannah Wolfe
b781e47cb9
Changed to use different fixtures during testing
- this keeps production and test fixtures separate, so that changing the prod fixtures doesn't change the shape of our tests.
- we may still want to test that the production fixtures do what we expect, but that can be handled in a separate integration test, by specifically setting the fixture path
2021-11-16 14:03:42 +00:00
Sanne de Vries
5ccc1914f5 Updated rendering of callout card to override theme dark mode 2021-11-16 13:55:06 +01:00
Hannah Wolfe
426c8bf918
Refactored fixtures to be loaded by fixture manager
refs: https://github.com/TryGhost/Toolbox/issues/133

- instead of just a collection of utils, we now have a class that manages fixtures
- this should allow us to change the path to fixtures, e.g. between prod/dev and test, so that different fixtures can be loaded by default
- also makes it easier to test the fixture manager code itself
2021-11-16 11:17:03 +00:00
Naz
458f5b894b Moved Urls and Rexources reinitialization
refs https://github.com/TryGhost/Toolbox/issues/127

- New instances or Urls and Resources during init were messing up test suites without an obvious solution. Moved them to only be triggered when the cache is present.
- Note the e2e-frontend tests are failing if thie initialization happens every time when init is called. There seems to be some reliance on Resources being the same intsance between "softReset" which seems wrong, but wasn't able to track it down definitevely
2021-11-17 00:00:23 +13:00
Naz
1a3a80cacc Added resource cache handling to UrlService
refs https://github.com/TryGhost/Toolbox/issues/127

- The resource cache is needed to have quick and reproducible state of the resouces tied to the urls instead of waiting for the db queries to finish.
- Allows to use UrlService without any database connection at all - useful for unit testing
2021-11-17 00:00:23 +13:00
Naz
9b309cf4e7 Refactored URL cache persistance
refs https://github.com/TryGhost/Toolbox/issues/127

- This refactor is needed to accomodate incoming "resource cache" which shares a lot of common logic with how url cache is operated
2021-11-17 00:00:23 +13:00
Hannah Wolfe
88311381ef Added a URL Service boot log
- At the moment there's no way to see in the logs when the URL Service finally finishes
- This is the moment when Ghost stops serving 503s
- Adding this log line so it's clear to see, which migh be useful whilst were refactorising
2021-11-16 19:13:36 +13:00
Sanne de Vries
632e15affc Added callout card email styles
Refs https://github.com/TryGhost/Team/issues/1206
2021-11-15 19:45:33 +01:00
Naz
83a54eeb99 Fixed UrlService's getPermalinkByUrl method
refs https://github.com/TryGhost/Toolbox/issues/127

- The "withUrlOptions" is used internally in the constructor by the frontend's routers. To avoid passing around a whole function from the frontend routers duplicated the functionality from there.
2021-11-15 19:40:44 +04:00
Naz
e1ebbff3b5 Removed unused field
refs https://github.com/TryGhost/Toolbox/issues/127

- Wasn't able to find any references to the "originalValue" field in permalinks, so removed it to keep the code clean and readable
2021-11-15 19:38:41 +04:00
Naz
042618fe93 Fixed failing tests
refs 5a62253466

- The UrlService was relying on a "hidden" identifier field that was passed along with a router object. Now it's passed as an explicit parameter from the "frontend" to the backend's UrlService
2021-11-15 19:37:49 +04:00
Naz
5a62253466 Removed "router" dependency from UrlGenerator
refs https://github.com/TryGhost/Toolbox/issues/127

- Passing around whole instance of a frontend router was an overkill when there are only 3 static pieces of information that needed to be loaded. Extracting the router out makes the UrlGenerator way more readable, tests slimer, and the memory footpring of the process should be slightly lighter
- The toString overloading didn't make sense at the time of this refactor, maybe if there's a concrete usecase we could resurect it in a form of passing in a router's name or something.
2021-11-15 18:32:34 +04:00
Naz
6e205a3f05 Extracted an explicit "permalink" parameter in UrlGenerator constructor
refs https://github.com/TryGhost/Toolbox/issues/127

- This is an effor t to define a precise set of data needed for the UrlGenerator to function, which should help with decoupling it from the frontend routes
- This is almost the last piece to free us up from the massive "router" object that has been passed around
2021-11-15 18:32:34 +04:00
Naz
677ea1073d Extracted an explicit "resourceType" parameter in UrlGenerator constructor
refs https://github.com/TryGhost/Toolbox/issues/127

- This is an effor t to define a precise set of data needed for the UrlGenerator to function, which should help with decoupling it from the frontend routes
2021-11-15 18:32:34 +04:00
Naz
ca2809d432 Extracted an explicit "filter" parameter in UrlGenerator constructor
refs https://github.com/TryGhost/Toolbox/issues/127

- This is an effor t to define a precise set of data needed for the UrlGenerator to function, which should help with decoupling it from the frontend routes
2021-11-15 18:32:34 +04:00
Naz
176c369620 Refactored UrlGenerator to use DI constructor pattern
refs https://github.com/TryGhost/Toolbox/issues/127

- This is a standard across the codebase which is good to follow for better testability
2021-11-15 18:32:34 +04:00
Daniel Lockyer
6fd5139372
Merged v4.22.3 into main
v4.22.3
2021-11-15 13:44:09 +00:00
Daniel Lockyer
c960a4bdeb Updated Admin to v4.22.3 2021-11-15 13:43:15 +00:00
Hannah Wolfe
bb47b9e327
🐛 Fixed EACCES error from card assets on boot
refs: https://github.com/TryGhost/Ghost/issues/13739

- This is a short term fix to prevent this new feature causing boot errors
- This will allow development to continue uninterrupted this week & also allow us to do a rollout
- The proper fix will be to move where these files live, which will be done before we go live
2021-11-15 12:12:22 +00:00
Rishabh
c3b6e21617 Refined frontend style for toggle cards
refs https://github.com/TryGhost/Team/issues/1209

- adds open/close behavior to toggle cards
- updates styling
2021-11-15 16:43:23 +05:30
Sanne de Vries
158285bfff Added variable background color to callout on frontend
Refs https://github.com/TryGhost/Team/issues/1206
2021-11-15 11:37:23 +01:00
Naz
33d02cddfe Added JSDocs to the UrlGenerator class
refs https://github.com/TryGhost/Toolbox/issues/127

- Before refactoring the URL Generator constructor to have a smaller construcotr, documented current state for future reference
2021-11-15 12:41:52 +04:00
Fabien O'Carroll
31e103be9d Updated NFT OEmbed provider to return metadata
refs https://github.com/TryGhost/Team/issues/1211

Instead of rendering the HTML as an embed - we will send back the
necessary data. This will allow us to keep all the knowledge of HTML
structure in the Koenig repository.
2021-11-15 10:31:35 +02:00
Daniel Lockyer
6a3429ed00 Updated Admin to v4.22.2 2021-11-12 16:00:24 +00:00
Peter Zimon
a68854c3bd Added NFT card email styles
- added email styles for NFT cards
- fixed buttons having capitalized text
2021-11-12 16:39:35 +01:00
Peter Zimon
661bde3892 NFT card frontend style refinements 2021-11-12 15:55:19 +01:00
Peter Zimon
19f74ff0f7 Added NFT card frontend styles 2021-11-12 13:57:01 +01:00
Naz
cb652aed3f Added url cache persistance on instance shutdown
refs https://github.com/TryGhost/Toolbox/issues/125

- The in-memory url objects would be persisted in the contents folder allowing to take advantage of the cache during the next instance start
2021-11-13 01:01:28 +13:00
Naz
04c6716171 Moved url cache loading logic behind the flag
refs https://github.com/TryGhost/Toolbox/issues/125

- The url loader is not fully working and is in very experimental mode. The aim is to ship this version to allow other team members to play with the feature in limited use-cases like testing evnironment
2021-11-13 01:01:28 +13:00
Naz
5b2009a268 Removed unuseful comment
no issue

- The file has been moved to the frontend and we have linting rules to remind moving "server" requires
2021-11-13 01:01:28 +13:00
Naz
4582fd48b5 Parameterized url cache storage path
refs https://github.com/TryGhost/Toolbox/issues/116

- This should allow testing in a bit easier manner and would place the file into a more suitable directory
- ideally we'd put an alfa flag bahind this new "cached routes" feature to have less consequences to deal with if we have to back out
2021-11-13 01:01:28 +13:00
Naz
36bc05447c Booting instance with persisted urls
refs https://github.com/TryGhost/Toolbox/issues/116

- This is a PoC to check out how viable this approach is and if it's worth merging into main as a very quick win
- The `urls.json` is in a bad place right now should probably live in a data folder
2021-11-13 01:01:28 +13:00
Peter Zimon
8714b4e2b7 Updated frontend styles for buttons 2021-11-12 11:50:20 +01:00
Fabien O'Carroll
39f01f4925 Removed SVG from NFT OEmbed
refs https://github.com/TryGhost/Team/issues/1211

The SVG is causing issues with copy/paste in Firefox, we're going to
remove it and later replace it with a PNG.
2021-11-12 12:43:25 +02:00
Naz
6023b78688 Added "urlCache" labs alpha flag
refs https://github.com/TryGhost/Toolbox/issues/126

- A flag go control the experimental URL Cache alpha feature
2021-11-12 12:24:27 +04:00
Naz
b707f325c8 Exposed config initialization from Resources
refs https://github.com/TryGhost/Toolbox/issues/125

- Config initialization for the URL Resouces is a separate stage which doesn't have to be bundled along with resouce fetching method
- It gives even more flexibility when composing different ways to get the "resources" loaded into memory: right now it's from the DB but could come from a cache
2021-11-12 12:18:17 +04:00
Naz
963df37aaa Reworded UrlService's init documentation
refs https://github.com/TryGhost/Toolbox/issues/125

- The "init" method pattern is not used across the codebase and it's pretty standard to start the service in this way. Previous description was outdated and misguiding
2021-11-12 12:16:08 +04:00
Naz
39b480682f Fixed UrlService initialization
refs https://github.com/TryGhost/Toolbox/issues/125

- The await was missing from the "fetchResources" call which made the queue pick up less information than it should've
2021-11-12 12:15:01 +04:00
Naz
376e2f4cf3 Separated event listeners from resource fetching
refs https://github.com/TryGhost/Toolbox/issues/125

- The "fetchResources" method did way to many things extracted event listener setup logic to a separate method
- This allows to call out these stages as needed if we retreive resources separately from a cache of some sort and don't need to wait for the database response
2021-11-12 11:56:16 +04:00
Naz
46c3b53979 Moved queue start into UrlServices init block
refs https://github.com/TryGhost/Toolbox/issues/125

- The "fetchResources" is only used from one place and does way to many things at once:
- Fetches resources from the DB-
- Hooks up event listeners
- Starts the queue

- These are three different things, and should be three different methods ideally
2021-11-12 11:56:16 +04:00
Kevin Ansfield
6431e1a01c
Exposed tenorApiKey via config endpoint if set (#13734)
refs https://github.com/TryGhost/Team/issues/1217

- add `tenorApiKey` to `publicConfig.config()
- update canary config endpoint output serializer to include `tenorApiKey` when the `gifsCard` labs flag is enabled
2021-11-11 18:07:19 +00:00
Fabien O'Carroll
dda8e0249b Wired up NFT custom provider to canary API
refs https://github.com/TryGhost/Team/issues/1211

This registers the NFT custom OEmbed provider to the OEmbed service for
the canary API. This should probably be done in a centralised place -
but we do not have a single instance of the OEmbed service.

When we have more information about why the OEmbed service is
instantiated like this, we can think about moving it into a singleton
service with an `init` method - which is where we can register custom
providers.
2021-11-11 17:16:03 +02:00
Fabien O'Carroll
3b7284b62f Initial OpenSea NFT OEmbed customer provider
refs https://github.com/TryGhost/Team/issues/1211

This adds the initial custom OEmbed provider for OpenSea NFT's - we're
using the new custom provider functionality so that we can easily change
the logic here without affecting the core functionality.
2021-11-11 17:16:03 +02:00
Fabien O'Carroll
e69d112c77 Added support for custom OEmbed providers
refs https://github.com/TryGhost/Team/issues/1211

In order to override the default OEmbeds for OpenSea NFT's we need a way
to provide out own OEmbed data. We will want this in future too for
custom Twitter embeds, so this has been built in a way which allows
extension.
2021-11-11 17:16:03 +02:00
Kevin Ansfield
4b78586ad1 Added gifsCard labs flag
refs https://github.com/TryGhost/Team/issues/1217

- labs flag for adding a gif selector in a similar fashion to our Unsplash image selector
2021-11-11 15:07:35 +00:00
Naz
a64c186179 Fixed typo
no issue
2021-11-11 16:52:11 +04:00
Daniel Lockyer
2f57e0ab6b
Merged v4.22.1 into main
v4.22.1
2021-11-10 12:58:49 +00:00
Daniel Lockyer
8d958fc167 Updated Admin to v4.22.1 2021-11-10 12:56:23 +00:00
Fabien 'egg' O'Carroll
7fae5b8341
🐛 Fixed setting Tier prices after changing Stripe accounts
refs https://github.com/TryGhost/Team/issues/1212

This now emits the event when the service is reconfigured, rather than
when we issue the reconfigure command, which causes the event and the
action to be run in the wrong order. This would then cause knock on effects
of having the database in an undefined state - with stripe data in not linked
to the current Stripe account.
2021-11-10 14:03:03 +02:00
Naz
975750afe9 Added ".ogg" audio support to Media API
refs https://github.com/TryGhost/Toolbox/issues/95
refs 9edd299905

- A follow up to the original audio support. ".ogg" format is widely supported by the most popular browsers (ref. https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers), so makes sense to support it out of the box too
2021-11-10 10:46:26 +04:00
Thibaut Patel
0b85068900 Added first pass of injected css for callout card
refs https://github.com/TryGhost/Team/issues/1205

- basic css for callout card display
2021-11-09 21:14:33 +01:00
Rishabh
ac61ac3d53 Added alpha flag for accordion card
refs https://github.com/TryGhost/Team/issues/1209

- adds alpha flag for editor accordion card
2021-11-09 19:07:50 +05:30
Naz
9edd299905 Added audio upload support to Media API
refs https://github.com/TryGhost/Toolbox/issues/95
refs 4907b7bf1e

- We need support for audio media uploads to be able to used them in cards. The new supported formats are .mp4 and .wav
- Example source files downloaded from https://filesamples.com/
2021-11-09 16:39:33 +04:00
Naz
4721b75463 Moved `/media/thumbnail/ Admin API endpoint to /media/thumbnail/upload
refs  https://github.com/TryGhost/Toolbox/issues/120

- Changed endpoint name as it suits way better to the `/upload` postfix convention we use along with all other endpoints that support file uploads
2021-11-09 16:39:33 +04:00
Kevin Ansfield
7aa8d9df5c Removed need for !important in button card css
refs https://github.com/TryGhost/Team/issues/1210

- `a.kg-btn` has higher specificity than the `.gh-content a` in Casper we were previously working around with `!important`
- dropping `!important` makes it easier for themes to override
2021-11-09 12:30:34 +00:00
Peter Zimon
a789528a56 Added NFT card alpha flag 2021-11-09 13:27:36 +01:00
Naz
61b82e3ae2 Added thumbnail upload endpoint to Media API
closes https://github.com/TryGhost/Toolbox/issues/120

- Allows to update and upload brand new thumbnail images for previusly uploaded media resources
- The endpoint is available udner alpa flag as part of Admin API at `PUT /media/thumbnail/`
- As an input accepts following parameters:
- *required* `file` field containing an image file
- *required* `url` field containing parent media file URL
- *optional* `ref` as a field to put in an ID to reference the resource on the client side

- The response has following format:
```
{
  media: [{
    url: 'http://127.0.0.1:2369/content/images/1991/11/nicevideo_thumb.png'
    ref: 'unique-id-420'
  }]
}
```
2021-11-09 16:07:23 +04:00
Naz
2a7ef77a7b Added ability to delete existing files through storage adapters
refs https://github.com/TryGhost/Toolbox/issues/120

- When editing an uploaded media thumbnail  file there'a need to remove existing thumbnail to keep media files:thumbnails 1:1. - Because the API client only has a public URL under which the resource is served it can only provide that as an API input, the `urlToPath` was also added to the base class of LocalStorageAdapter (it might be moved up to the BaseAdapter in the future if we see a need)
2021-11-09 16:07:23 +04:00
Naz
3f59c1893b Renamed variables to better fit the context
no issue

- Slightly less code without compromising readability
2021-11-09 16:07:23 +04:00
Kevin Ansfield
40c4342786 Added first pass of injected css for button card
refs https://github.com/TryGhost/Team/issues/1207

- basic CSS for button card display
  - accent color for button background
  - left/center alignment
2021-11-09 11:10:18 +00:00
Thibaut Patel
aebd042d1a Added calloutCard labs flag
refs https://github.com/TryGhost/Team/issues/1205

- flag for editor callout card development
2021-11-08 17:11:35 +01:00
Kevin Ansfield
4d54337a65 Added buttonCard labs flag
no issue

- flag for editor button card development
2021-11-08 15:42:02 +00:00
Naz
92986b77e3 Renamed whitelist -> allowlist
no issue

- Renames to follow the naming convention from https://mysqlhighavailability.com/mysql-terminology-updates/
2021-11-08 16:09:30 +04:00
Naz
f0242baf9f Added static file limit handling in Files API
refs https://github.com/TryGhost/Toolbox/issues/114

- Just like with media files same limits apply and can be configured through the usual limit service's config
2021-11-08 16:09:30 +04:00
Naz
be748f2f6d Added static file handling to the frontend
refs https://github.com/TryGhost/Toolbox/issues/114

- Static files uploaded through the Admin Files API should be accessible throught the world under `/content/files/`
- Note the feature is behind an alpha "filesAPI" flag, which has to be enabled in the labs first
2021-11-08 16:09:30 +04:00
Naz
a099073fde Added Files API behind an alpha flag
refs https://github.com/TryGhost/Toolbox/issues/114

- Files API is meant to be used for non-executable file uploads of all sorts
- The files are stored and retrieved for download as-is
2021-11-08 11:40:17 +04:00
Naz
c6e1e95c26 Added "filesAPI" labs alpha flag
refs https://github.com/TryGhost/Toolbox/issues/114

- A flag go control the Files API alpha feature
2021-11-08 11:33:06 +04:00
Naz
151ab6968c Added local file storage adapter
refs https://github.com/TryGhost/Toolbox/issues/114

- This adapter is meant to power Files API
- The files will be stored under `/files/` in the configured content path and under `/content/files/` URL.
2021-11-08 11:29:33 +04:00
Daniel Lockyer
dc69c839ae Updated Admin to v4.22.0 2021-11-05 16:00:29 +00:00
Hannah Wolfe
95d4111d58
Removed completed TODO for helper init
refs: 9d7049cd3f

- The helper service refactor I did  a little while back moved this to a better location:
9d7049cd3f (diff-81327b09890d6df7b87046cfdfa924f5f03c51221bf29980a015a30bee6d1884R134)
- But I forgot to clean up. Removing the commented block and now completed TODO
2021-11-05 14:00:47 +00:00
Naz
f43eeacfd0 Changed thumbnail to be an optional parameter
refs https://github.com/TryGhost/Toolbox/issues/95

- With incoming support of audio media files thumbnail would not be a required parameter
2021-11-05 17:17:18 +04:00
Naz
ad2583530a Renamed getLocalFileStoragePath
refs https://github.com/TryGhost/Toolbox/issues/95

- getLocalImagesStoragePath makes a lot more sense in context of what the method really does
2021-11-05 17:17:18 +04:00
Naz
12cad62a53 Fixed up JSDoc
no issue

- The method description was a complete tautology
2021-11-05 17:17:18 +04:00
Naz
22ac28b250 Fixed ThemeStorage inheritance
refs https://github.com/TryGhost/Toolbox/issues/95

- The ThemeStorage was never supposed to inherit image specific mehods. The LocalStorageBase is all it needs, might be even too much
- Look mum no saveRaw!
2021-11-05 17:17:18 +04:00
Naz
c802097b72 Renamed LocalFileStorage to LocalImages store
refs https://github.com/TryGhost/Toolbox/issues/95

- This naming corresponds way better to what the actual adapter does
2021-11-05 17:17:18 +04:00
Naz
f3fc1bd5d4 Extracted local storage adapters' into a base class
refs https://github.com/TryGhost/Toolbox/issues/95

- The MediaStorage adapter and LocalFileStorage were almost identical, having a common base class makes sense here.
- Having a distinct class for the "LocalFileStorage" makes it easy to spot the implementation difference from the StorageBase - the "saveRaw" method, which is not present in the StorageBase
- The LocalFileStorage will become an LocalImageStorage in next commit as that name corresponds way better to what it does!
- Test files need a good cleanup
2021-11-05 17:17:18 +04:00
Hannah Wolfe
e25f1df0ae
Added card-asset config with sensible default
- This comment removes the block on themes controlling card assets via config
- It also changes the default behaviour from "false" config (doing nothing) to excluding bookmark and gallery card assets
- This is essentially the same thing, as only bookmark and gallery card assets exist at the moment, but it's being done because it makes this feature future-proof for all theme developers.
- As we add new cards, all themes will automatically get the assets to make them work
- As theme developers want to, they can create their own custom assets and disble assets for any cards they support by adding them to the exclude list
- They can also remove any custom code they currently have to support bookmark and gallery cards, and set card_assets: true in package.json to use the defaults instead
2021-11-05 12:20:02 +00:00
Hannah Wolfe
e4c1e0d938
Added middleware for serving minified card assets
- Wired up the forntend to include and serve the minified css and js card assets if they exist
- This is a very naive implementation - ideally we wouldn't have to inject this in multiple places
- This allows us to add files to src/cards and have them included in themes
- The system is currently disabled due to an override in the theme config setting assets to false
2021-11-05 11:41:03 +00:00
Hannah Wolfe
d9bdc444a3
Ensured nonexistant public files fallback to 404
- If we register the serve public file middleware for a file that doesn't exist, this will currently throw an ENOENT error
- Instead, we want to fall back to a standard 404 so that this behaves normally
- This will be useful for the card asset service, where the cards.min.css and cards.min.js files may or may not exist
2021-11-05 09:13:23 +00:00
Naz
6435dec938 Added media file handling to the frontend
refs https://github.com/TryGhost/Toolbox/issues/95

- Media files uploaded through the Admin Media API should be accessible throught the frontend under `/content/media/`
- Note the feature is behind an alpha "mediaAPI" flag that has to be enabled in the labs first
2021-11-04 21:22:06 +04:00
Naz
142eff22ee Fixed thumbnail file name
refs https://github.com/TryGhost/Toolbox/issues/95

- The uploaded media thumbnail name should have a "_thumb" postfix to be able to distinguish thumbnails from other files. This can be handy if we decide to store them in a different location in the future.
2021-11-04 19:03:45 +04:00