Commit Graph

14492 Commits

Author SHA1 Message Date
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
Kevin Ansfield
4d54337a65 Added buttonCard labs flag
no issue

- flag for editor button card development
2021-11-08 15:42:02 +00:00
Naz
405603d530 Fixed liniting error for validators' index.js files
refs f0242baf9f

- The index.js files in "input validators" are exposing an API and not doing anything else so these cases can be safely ignored
- Ideally we'd have a solution which would export all modules in the folder without having to add any more declarations, but that's for another time!
2021-11-08 16:43:16 +04:00
Naz
a12b3e6bbe Added content/files to gitignore list
refs https://github.com/TryGhost/Toolbox/issues/114
refs be748f2f6d
refs 6435dec938 (diff-bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947R107)

- The files uploaded through Files API should not get into version control.
2021-11-08 16:12:04 +04: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
renovate[bot]
b7d8d70ccf
Update dependency @tryghost/members-api to v2.7.3 (#13717)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-08 12:40:17 +02:00
Renovate Bot
13d282fb94 Update dependency cssnano to v5.0.10 2021-11-08 08:30:43 +00:00
Renovate Bot
6ad0ac4103 Update dependency nock to v13.2.0 2021-11-08 08:30:30 +00: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
Renovate Bot
9d0af694d0
Update dependency oembed-parser to v1.5.2 2021-11-08 03:57:58 +00:00
Renovate Bot
46762eb624
Update dependency luxon to v2.1.0 2021-11-08 01:53:51 +00:00
Renovate Bot
de6fff90b3
Update dependency @sentry/node to v6.14.1 2021-11-05 16:01:42 +00:00
Daniel Lockyer
40e2c89e3c v4.22.0 2021-11-05 16:00:29 +00:00
Daniel Lockyer
dc69c839ae Updated Admin to v4.22.0 2021-11-05 16:00:29 +00:00
Daniel Lockyer
333fdcf8fe 🎨 Updated Casper to v4.2.0 2021-11-05 16:00:28 +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
Renovate Bot
fa03052187 Update dependency @tryghost/job-manager to v0.8.12 2021-11-05 13:35:34 +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
65d79f4a74 Fixed failing test
no issue

- Not sure what the purpose of this test is. Seems like it's kind of like an db integrity check where it makes sure the change is double checked before commiting
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
Daniel Lockyer
ed4586c28c
Disabled Sharp image cache to improve memory usage
refs 03d24ea4fe

- see the referenced commit for the full explanation but in short, Sharp
  has an internal cache it uses when optimizing images and it defaults
  to 50MB. This cache is not needed for our use-case because we never
  optimize images twice
- `@tryghost/image-transform` has been updated to disable the cache and
  this commit bumps the package in Ghost
2021-11-05 12:32:13 +00: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
Matt Hanley
64e8fdf4bb
Added migration review checklist (#13711)
no issue
- Adds a comment to PRs containing migrations with a checklist for the reviewer to complete
2021-11-05 09:33:55 +00:00