hi, is it possible to delete or move some images into 18+ as some images posted on generator gallery might not be suitable for 13- ?

  • allo@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    9 months ago

    basically the way perchance pages seem to communicate with each other, including to and from the gallery, is contentWindow.postMessage and according to mozilla

    “Normally, scripts on different pages are allowed to access each other if and only if the pages they originate from share the same protocol, port number, and host (also known as the “same-origin policy”). window.postMessage() provides a controlled mechanism to securely circumvent this restriction (if used properly).”

    https://perchance.org/71s7lmmx0l

    click edit and look at the html

    that is basically how perchance pages listen to signals from each other

    this code then selects all galleries on the page and sends each the doRefreshIfSortingByRecent message.

    just an example of how this page can talk to the gallery on it. see in the image on the right side where i have right clicked and am inspecting the gallery element and you can see in this iframe of the gallery it is listening for signals, including doRefreshIfSortingByRecent. So the gallery has a hearer for doRefreshIfSortingByRecent and we can send it the signal doRefreshIfSortingByRecent. So that works fine and, if you upload an image to the gallery, it runs thru all that code no problem and says meow at the end. So it IS possible to touch the inside of the gallery, but only barely and very specifically.

    Also, I have not browsed 100% fully thru all the inspected page of the iframe containing the gallery, but you see how the creator of perchance will have had to code in that iframe another ‘listening’ for a specific command to change the rating of a picture… and they probably haven’t.

    The other and seems to me more feasible option is that each image that is created with all it’s buttons doing their different things inside the gallery is created with one additional button… that checks if the user is admin (piggybacking the admin aspect of the comment plugin) and, if so, sends a message straight from iframe gallery to perchance server to change that variable holding the rating of the image. To me that seems obviously the way to do it and puts it squarely in the hands of the creator of perchance with all other ways seeming much worse.

    having looked thru it again just now i feel firmly the above ~with more understanding of the signalling aspect of perchance