Review main Merged

69099[TASK] Show image of distribution even if not installed

Thomas Löffler CR +2 V +2 Hard +185 −137 updated 05/31/21, 09:37

Commit message

Previously the image of a distribution extension
was only shown in the extensionmanager, in case
the distribution was already installed. In the
list view, all distributions therefore displayed
the same fallback image.

This is now fixed by adding a new field to the
extension record, which is filled via the XML
parser. As it contains the URL to the image,
it can be directly used in the corresponding
templates and therefore allows to remove the
DistributionImageViewHelper. Instead, a new
web component handles the image and ensures
a preview image is displayed, even if the
distribution image is not available.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Anja Leichsenring +1
    • Christian Kuhn +1
    • Thomas Löffler +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Anja Leichsenring +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 16

Review log 5376

Show 3451 earlier messages
  1. Thomas Löffler uploaded patch set 1 05/10/21, 14:08

  2. core-ci voted on patch set 1 V +1 05/10/21, 14:20 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11347

  3. Thomas Löffler uploaded patch set 2 05/10/21, 16:30

  4. Thomas Löffler updated the commit message in patch set 3 05/10/21, 16:31

  5. core-ci voted on patch set 2 V +1 05/10/21, 16:42 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11352

  6. core-ci voted on patch set 3 V +1 05/10/21, 16:45 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11353

  7. Thomas Löffler uploaded patch set 4 05/15/21, 19:42

  8. core-ci voted on patch set 4 V +1 05/15/21, 19:52 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11547

  9. Thomas Löffler updated the commit message in patch set 5 05/15/21, 21:15

  10. core-ci voted on patch set 5 V +1 05/15/21, 21:24 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11557

  11. Thomas Löffler updated the commit message in patch set 6 05/16/21, 10:38

  12. core-ci voted on patch set 6 V +1 05/16/21, 10:49 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11562

  13. Oli Bartsch commented on patch set 6 05/16/21, 16:03

    Extension.php:706

    I prefer to define such static value as a class constant.

    AbstractExtensionXmlParser.php:251

    Let's name this "distributionImageUrl" here as well.

    AbstractExtensionXmlParser.php:276

    Let's name this "distributionImageUrl" here as well.

    ExtensionXmlPushParser.php:261

    Let's name this "distributionImageUrl" here as well.
  14. Thomas Löffler uploaded patch set 7 05/17/21, 06:01

  15. core-ci voted on patch set 7 V +1 05/17/21, 06:10 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11570

  16. Thomas Löffler uploaded patch set 8 05/17/21, 06:12

  17. core-ci voted on patch set 8 V +1 05/17/21, 06:22 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11571

  18. Thomas Löffler uploaded patch set 9 05/17/21, 07:32

  19. Thomas Löffler commented on patch set 9 05/17/21, 07:34

    Extension.php:706 Reply

    Done

    AbstractExtensionXmlParser.php:251 Reply

    Done

    AbstractExtensionXmlParser.php:276 Reply

    Done

    ExtensionXmlPushParser.php:261 Reply

    That needs to be changed in TER first as this is the name in the XML file.
  20. Thomas Löffler uploaded patch set 10 05/17/21, 07:40

  21. core-ci voted on patch set 9 V +1 05/17/21, 07:44 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11575

  22. core-ci voted on patch set 10 V +1 05/17/21, 07:47 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11576

  23. Thomas Löffler uploaded patch set 11 05/17/21, 08:08

  24. core-ci voted on patch set 11 V +1 05/17/21, 08:19 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11577

  25. Oli Bartsch uploaded patch set 12 05/17/21, 09:25

  26. Oli Bartsch voted on patch set 12 V +1 CR +1 05/17/21, 09:33

  27. core-ci voted on patch set 12 V +1 05/17/21, 09:35 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11581

  28. Thomas Löffler uploaded patch set 13 05/17/21, 13:51

  29. core-ci voted on patch set 13 V +1 05/17/21, 14:01 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11591

  30. Oli Bartsch voted on patch set 13 V +1 CR +1 05/18/21, 08:01

  31. Thomas Löffler uploaded patch set 14 05/20/21, 07:46

  32. core-ci voted on patch set 14 V +1 05/20/21, 07:58 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11696

  33. Oli Bartsch voted on patch set 14 V +1 CR +1 05/20/21, 22:02

  34. Jochen Roth voted on patch set 14 V +1 CR +1 05/21/21, 11:28

  35. Oli Bartsch commented on patch set 14 V -1 CR 0 05/21/21, 11:57

    Distribution.html:5

    Will now lead to "broken" images in case no internet connection or TER is unavailable.
  36. Oli Bartsch uploaded patch set 15 05/21/21, 12:01

  37. Oli Bartsch commented on patch set 15 05/21/21, 12:02

    Distribution.html:5 Reply

    Done
  38. core-ci voted on patch set 15 V -1 05/21/21, 12:09 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11769

  39. Jochen Roth commented on patch set 15 V -1 05/21/21, 12:38

    Extension.php:707

    Throws `file_get_contents(): php_network_getaddresses: getaddrinfo failed` @file_get_contents(... would fix it.
  40. Thomas Löffler uploaded patch set 16 05/21/21, 12:45

  41. Oli Bartsch uploaded patch set 17 05/21/21, 12:50

  42. Oli Bartsch commented on patch set 17 05/21/21, 12:52

    Extension.php:707 Reply

    Done
  43. core-ci voted on patch set 16 V +1 05/21/21, 12:52 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11771

  44. core-ci voted on patch set 17 V +1 05/21/21, 12:58 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11772

  45. Thomas Löffler voted on patch set 17 V +1 CR +1 05/21/21, 13:01

  46. Oli Bartsch voted on patch set 17 V +1 CR +1 05/21/21, 13:26

  47. Jochen Roth voted on patch set 17 V +1 CR +1 05/21/21, 13:40

  48. Oliver Hader voted on patch set 17 CR -1 05/21/21, 15:18

  49. Oliver Hader commented on patch set 17 05/21/21, 15:30

    I see the next discussion on data retrieved from 3rd party locations from within the TYPO3 backend...

    Extension.php:707

    `file_get_contents` is a blocking request - don't handle that on the PHP side

    ExtensionXmlPullParser.php:143

    Please ensure the URI is prefixed with verified origin locations, e.g. `https://extensions.typo3.org/fileadmin/ter/p` - `ftp://hacker.org/` is definitively not valid...

    ext_tables.sql:29

    What if the URI is longer than 255 characters?
  50. Oli Bartsch commented on patch set 17 V 0 CR 0 05/21/21, 15:56

    Reply

    Fully get your point. I'm however kind of unsure. Using the extension manager always means connecting to TER in some way. Be it on updating the extensions list, installing new extensions / distributions, checking composer status of extensions, and so on. This patch just adds another connection to TER (not any 3rd party) to retrieve the distribution images (They are stored in extensions.typo3.org/fileadmin/../). The alternative would be to store the distribution images locally when updating the extension list. TBH this also doesn't sound reasonable to me.

    Extension.php:707 Reply

    Ack

    ExtensionXmlPullParser.php:143 Reply

    As far as I understood Thomas correct, this URL is not maintained by the distribution author but build by the TER in a stanzdardized way. See: https://gitlab.typo3.org/services/t3o-sites/extensions.typo3.org/ter/-/blob/develop/extensions/ter_fe2/Classes/Service/ExtensionIndexService.php#L116

    ext_tables.sql:29 Reply

    Same as above. Since the URL is build in the TER we ensure 255 chars will never be exceeded. If I recall correctly, Thomas said, this URL won't be longer than ~100 characters.
  51. Oli Bartsch commented on patch set 17 05/21/21, 16:00

    Extension.php:707 Reply

    Do you have any preferred method, how to handle this instead?
  1. Oli Bartsch commented on patch set 17 05/21/21, 16:09

    ExtensionXmlPullParser.php:143 Reply

    Thought about it again. I'm convinced that it would definitely be a good idea to check the origin anyway.
  2. Oliver Hader commented on patch set 17 05/22/21, 07:04

    Reply

    My remark was based on the assumption the distribution image property can be an arbitrary URI - which would lead to scenarios when browsers fetch that image and would expose the personal IP. It's probably okay in case it's "just" the TER.

    ExtensionXmlPullParser.php:143 Reply

    Cool, thx. Since there might be different mirrors/repositories (not just extensions.typo3.org), at least that particular origin could be checked.
  3. Thomas Löffler uploaded patch set 18 05/26/21, 13:16

  4. Thomas Löffler commented on patch set 18 05/26/21, 13:19

    ext_tables.sql:29 Reply

    Longest possible URL currently would have 111 chars.
  5. core-ci voted on patch set 18 V +1 05/26/21, 13:24 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11867

  6. Oli Bartsch uploaded patch set 19 05/28/21, 15:37

  7. Oli Bartsch commented on patch set 19 05/28/21, 15:42

    Extension.php:707 Reply

    This is now done with an HTML only solution.

    ExtensionXmlPullParser.php:143 Reply

    Added the regExp /^https:\/\/extensions\.typo3\.org[a-zA-Z0-9._\/]+Distribution\.png$/ to check for origin and the filename.

    ext_tables.sql:29 Reply

    Done
  8. core-ci voted on patch set 19 V +1 05/28/21, 15:52 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11947

  9. Christian Kuhn commented on patch set 19 CR -1 05/28/21, 18:58

    This works in chrome, but firefox denies to load the remote images: "The loading of “https://extensions.typo3.org/fileadmin/ter/i/n/introduction_4.2.0_Distribution.png” in a frame is denied by “X-Frame-Options“ directive set to “SAMEORIGIN“."

    Show.html:8

    this is currently resolved to '<object data="EXT:extensionmanager/Resources/Public/Images/Distribution.svg"' leading to a 'GET ext:extensionmanager/Resources/Public/Images/Distribution.svg net::ERR_UNKNOWN_URL_SCHEME' in chrome.
  10. Oli Bartsch commented on patch set 19 05/28/21, 19:07

    Thanks for testing. So the current approach does not work. Seems like we unfortunately have to go with JavaScript to solve this..

    Reply

    ACK

    Show.html:8 Reply

    ACK
  11. Oli Bartsch uploaded patch set 20 05/28/21, 22:58

  12. Oli Bartsch uploaded patch set 21 05/28/21, 23:06

  13. core-ci voted on patch set 20 V -1 05/28/21, 23:07 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11962

  14. Oli Bartsch commented on patch set 21 05/28/21, 23:07

    Reply

    Done

    Show.html:8 Reply

    Done
  15. core-ci voted on patch set 21 V +1 05/28/21, 23:13 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11963

  16. Christian Kuhn uploaded patch set 22 05/30/21, 18:05

  17. Anja Leichsenring voted on patch set 22 V +1 CR +1 05/30/21, 18:07

  18. Christian Kuhn updated the commit message in patch set 23 05/30/21, 18:10

  19. Anja Leichsenring voted on patch set 23 V +1 CR +1 05/30/21, 18:11

  20. Christian Kuhn voted on patch set 23 V +1 CR +1 05/30/21, 18:11

  21. core-ci voted on patch set 22 V +1 05/30/21, 18:15 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12005

  22. core-ci voted on patch set 23 V +1 05/30/21, 18:19 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12006

  23. Thomas Löffler voted on patch set 23 CR +1 05/31/21, 08:58

  24. Oli Bartsch voted on patch set 23 V +2 CR +2 05/31/21, 09:37

  25. Oli Bartsch merged patch set 24 05/31/21, 09:37