-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for local hosted plugin logo files (png only) #18811
base: main
Are you sure you want to change the base?
Conversation
Added support for local hosted logo files (png only).
src/Glpi/Marketplace/View.php
Outdated
// found a logo from online resource? | ||
if (isset($apidata['logo_url']) && strpos(strtolower($apidata['logo_url']), '.png') !== false) return $apidata['logo_url']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, it would even be preferable to serve the local icon first. Some GLPI administrators complains about the fact that the marketplace view requires access to remote contents.
Co-authored-by: Cédric Anne <[email protected]>
src/Glpi/Marketplace/View.php
Outdated
{ | ||
|
||
// found a logo from online resource? | ||
if (isset($apidata['logo_url']) && strpos(strtolower($apidata['logo_url']), '.png') !== false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why restricting on PNG files only? As far as I see, there is no such existing restriction; this would break existing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same remarks for other png extension checks)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation does not mention other file formats than png:
https://glpi-developer-documentation.readthedocs.io/en/master/plugins/guidelines.html#directories-structure
But I can remove the check for the online logo url - no problem.
For the local checks it is too much work to check for other file formats and I guess it is not really necessary. Gifs are annoying and who needs a jpg for an plugin icon at all? Maybe webp would be an alternative...
src/Glpi/Marketplace/View.php
Outdated
$logo = $pluginDir . $key . '.png'; | ||
|
||
// logo named as the key found? | ||
if (file_exists($logo) && is_readable($logo)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a check that the file is actually an image I think. Not sure it is a big issue, but should be safer.
The local check is only intended for developing purposes if a plugin is not (yet) published on the marketplace. Otherwise the icon defined in the xml file of the plugin will be used as symbol. Note: Most plugins in the marketplace uses png files. The plugin "Webhook" uses a svg file instead.
Added support for local hosted logo files (png only).
Checklist before requesting a review
Please delete options that are not relevant.
Description
Screenshots (if appropriate):