Commit Graph

14523 Commits

Author SHA1 Message Date
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
Renovate Bot
ef8852c5b6
Update dependency @sentry/node to v6.14.3 2021-11-11 18:59:47 +00: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
Kevin Ansfield
50b51e222c Added support for parsing Wordpress and Substack button html to button cards
refs https://github.com/TryGhost/Team/issues/1214

- bumps @tryghost/html-to-mobiledoc with support for parsing Wordpress/Substack HTML into our button cards

Example Wordpress html:
```html
<div class="wp-block-buttons">
    <div class="wp-block-button">
        <a href="https://example.com" class="wp-block-button__link">
            Testing  button
        </a>
    </div>
</div>
```

Example Substack html:
```html
<a class="button primary" href="https://ghost.org">
    <span>Custom Button</span>
</a>
```
2021-11-11 14:29:15 +00:00
Naz
a64c186179 Fixed typo
no issue
2021-11-11 16:52:11 +04:00
Sam Lord
0955caf311 Prevent Tailscale running in PRs on forks 2021-11-11 10:17:08 +00:00
Sam Lord
e4487c395c
Add metrics for test duration in Github workflow
refs: https://github.com/TryGhost/Toolbox/issues/118

Previously would attempt to run in forked repos, but couldn't access secrets so just hung.
2021-11-11 09:26:11 +00:00
Thibaut Patel
1139b0fdde Updated the callout card parsing and rendering
refs https://github.com/TryGhost/Team/issues/1205

- Adds support for optional enoji and background color
2021-11-10 18:33:21 +01:00
Renovate Bot
b401bc77a2 Update dependency @tryghost/social-urls to v0.1.27 2021-11-10 15:33:19 +00:00
Rishabh
7dcad6d5b5 Added default card for new toggle card
refs https://github.com/TryGhost/Team/issues/1209

- bumps koenig default cards to include support for toggle card
- bumps html to mobiledoc library to add support for toggle card
2021-11-10 20:13:42 +05:30
Daniel Lockyer
2f57e0ab6b
Merged v4.22.1 into main
v4.22.1
2021-11-10 12:58:49 +00:00
Daniel Lockyer
8fe425e176 v4.22.1 2021-11-10 12:56:23 +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
Renovate Bot
edff6e0ef1 Update dependency @tryghost/url-utils to v2.0.3 2021-11-10 10:49:01 +00:00
Renovate Bot
cc650d90cb Update dependency @tryghost/admin-api-schema to v2.6.1 2021-11-10 08:47:47 +00:00
Renovate Bot
f36b8b5af6 Update dependency @tryghost/color-utils to v0.1.4 2021-11-10 08:47:07 +00:00
Renovate Bot
184e20b4de Update dependency @tryghost/helpers to v1.1.53 2021-11-10 08:46:50 +00:00
Renovate Bot
710136926d Update dependency @tryghost/string to v0.1.21 2021-11-10 08:46:40 +00:00
Fabien O'Carroll
4d4e04ea65
🐛 Fixed offers remaining after subscription change
refs https://github.com/TryGhost/Team/issues/1092

This ensures that when a subscription is changed by a Member that the
Offer is removed and will no longer apply.
2021-11-10 08:41:09 +00: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
ea525e20a5 Updated callout card
refs https://github.com/TryGhost/Team/issues/1205

- Updated the rendered callout card to match the callout card from the admin interface
2021-11-09 21:47:03 +01: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
98de2d4274 Cleaned up uncecessary "purpose" fields from tests
refs https://github.com/TryGhost/Toolbox/issues/95

- The purpose field is not used in any way on the backend, so there's no need to have it in tests for Media API either
2021-11-09 16:41:38 +04:00
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
renovate[bot]
ced7b858dd
Update dependency @tryghost/members-offers to v0.10.2 (#13718)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-09 14:32:35 +02: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
ce63b87b2e 🐛 Fixed extention missmatching .mp4 as invalid
refs https://github.com/TryGhost/Toolbox/issues/120

- When a file name with an .mp4 extension was passed in it was mistakenly taken as an invalid extension. It is pretty valid!
- Fixing this bug allows for for duplicate file detection when uploading valid valies with extensions containing numbers
- Extensions that consiste only from numbers are still treated as invalid
2021-11-09 16:07:23 +04:00
Naz
fb8005f6e2 Refactored media tests
refs https://github.com/TryGhost/Toolbox/issues/120

- Introduced a new describe block before adding tests for a new endpoint
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
Kevin Ansfield
7e2af0910e Added server reload for injected CSS file changes when running yarn dev
no issue

- CSS is rebuilt on theme activation which is annoying to trigger manually whilst developing
- adding whole server reload also triggers theme activation + injected CSS/JS rebuild so it gives us the same reload behaviour as other server-side file changes
2021-11-09 11:07:28 +00:00
Kevin Ansfield
3150142b2f Updated button card frontend+email render output
refs https://github.com/TryGhost/Team/issues/1207

- uses koenig-specific classes to avoid clashes with theme CSS
- fixes email rendering by using table alignment
2021-11-09 10:44:18 +00:00
Thibaut Patel
bfaccadd4e Added initial callout card rendering
refs https://github.com/TryGhost/Team/issues/1205

- bumped rendering library to the version with `callout` card support
2021-11-09 10:36:51 +01:00
Fabien O'Carroll
3017f9d50c 🐛 Fixed offers remaining after subscription change
refs https://github.com/TryGhost/Team/issues/1092

This ensures that when a subscription is changed by a Member that the
Offer is removed and will no longer apply.
2021-11-09 11:22:04 +02:00
Renovate Bot
6b2cbe5c18
Update dependency luxon to v2.1.1 2021-11-08 22:35:35 +00:00
Kevin Ansfield
3a2bf93173 Added initial button card rendering and parsing support
refs https://github.com/TryGhost/Team/issues/1207

- bumped rendering and parsing libraries to versions with `button` card support
2021-11-08 18:33:26 +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