joplin
joplin copied to clipboard
All: Add support for media links in plugin manifest.json
This feature is discussed at the forum
It adds a media field to manifest.json, a example:
{
"media": [{
"url": "https://raw.githubusercontent.com/laurent22/joplin/dev/Assets/ImageSources/RoundedCorners_64x64.png",
"type": "image/png",
"platform": "desktop",
"label": "Description"
}]
}
In the json above, the label member
is a string that serves as an accessible name for the media. It can also serve as alternative text. The platform
member is also a string that can define the distribution platform for which the specific media should apply to. It is reserved for future plugin systems on mobile devices. Potential values are desktop, and mobile. type
is the MIME type of the media, it can be image/jpeg
, image/png
, image/gif
, image/webp
, video/mp4
, video/webm
, and video/ogg
I've tested this commit locally with the following test case:
- media item without url
- media item with platform other than desktop and mobile
- media item with unsupported MIME type
I don't think we'll support URLs as those can changed (in fact I'm surprised Chome supports this). We wouldn't want someone to swap the URL content for malware or something after we've validated the plugin.
So all media should be bundled with the plugin when webpack runs. Are you able to implement this?
That makes sense. Media files can be packed into .jpl file using file-loader in webpack, and we can extract them when building the plugin discovery site. But there is another problem, this might increase the size of the jpl file when someone tries to bundle a demo video. Is that something we should be concerned about?
Let's not support videos for now.
And use this structure:
"screenshots": [ { "src": "path/to/image.png", "label": "Image description" },
For now we only have the src and label properties.
sounds good! I'll make some changes to the PR soon.
I changed media to screenshots now and validate screenshots by their type and file size in this commit.
Ok thank you, looks like it's ready to merge.