this post was submitted on 21 Feb 2024
7 points (88.9% liked)

Perchance - Create a Random Text Generator

445 readers
11 users here now

⚄︎ Perchance

This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.

Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)

This community is mainly for discussions between those who are building generators. For discussions about using generators, especially the popular AI ones, the community-led Casual Perchance forum is likely a more appropriate venue.

See this post for the Complete Guide to Posting Here on the Community!

Rules

1. Please follow the Lemmy.World instance rules.

2. Be kind and friendly.

  • Please be kind to others on this community (and also in general), and remember that for many people Perchance is their first experience with coding. We have members for whom English is not their first language, so please be take that into account too :)

3. Be thankful to those who try to help you.

  • If you ask a question and someone has made a effort to help you out, please remember to be thankful! Even if they don't manage to help you solve your problem - remember that they're spending time out of their day to try to help a stranger :)

4. Only post about stuff related to perchance.

  • Please only post about perchance related stuff like generators on it, bugs, and the site.

5. Refrain from requesting Prompts for the AI Tools.

  • We would like to ask to refrain from posting here needing help specifically with prompting/achieving certain results with the AI plugins (text-to-image-plugin and ai-text-plugin) e.g. "What is the good prompt for X?", "How to achieve X with Y generator?"
  • See Perchance AI FAQ for FAQ about the AI tools.
  • You can ask for help with prompting at the 'sister' community Casual Perchance, which is for more casual discussions.
  • We will still be helping/answering questions about the plugins as long as it is related to building generators with them.

6. Search through the Community Before Posting.

  • Please Search through the Community Posts here (and on Reddit) before posting to see if what you will post has similar post/already been posted.

founded 1 year ago
MODERATORS
 

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- ?

all 16 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 8 months ago

You can block the person that generated those images on the gallery, and if enough people block them on their view as well, those images wouldn't be shown in the gallery anymore.

You can also downvote it, but it would only be hidden if the score is below a certain value, which is set on your settings, the hideIfScoreIsBelow property on the gallery, you can have it to -1 so when someone downvotes an image, it would be hidden immediately, but remember that only if the score is below that value that it would be removed.

[–] [email protected] 2 points 8 months ago

thanks allo, i'll look into this further as it is an amzaing tool but too easy to go too dark :)

[–] [email protected] 2 points 8 months ago

id be happy if the admin button only went in one direction ie safe to nsfw. as I would like a safe gallery. then a freedom of speach gallery. the alternative would be the ability to just delete but I would prefer to move to nsfw.looks at moment like this is not possible but would be a great addition. the only other thing I can think of is a compeltly other gallery structure but way beyind my limited programming knowledge. thanks for the contributions

[–] [email protected] 2 points 8 months ago

i was hoping i could move images , they are not offensive to me and am keen not to block people, just not really appropriate to 13-. ill try the downscore option, thanks

[–] [email protected] 2 points 8 months ago

ok so i had deleted that post because the forum here distorted so much of it and deleted like 80% of it so you couldn't even see what i was talking about.

I basically looked in to this for an hour or two last night ~delved far in to the workings of the text-to-image plugin and alot of rightclicking then inspecting the comment box and gallery to see what of iframes was touchable. also alot of messing with window.frames and such to see if i could get a hold on iframes and their contents housing things like the gallery.

let's see if i can sum up what i learned.

I found somewhere we don't have access to (i think it was while inspecting the iframe of the gallery) that marks created somewhere i couldn't see were tallied and they added up to an image being nsfw. I may have been seeing the end result of inner workings of the server, where images are judged for nsfwness and if they are beyond a certain amount they get flagged as nsfw. It would make sense much of the nsfw calculating is behind the perchance main server where we can't touch it so people are hardprevented from generatin 'the bad stuff', and this seems to be the case. Inspecting the gallery and looking at the iframe, here is what i was trying to bring to attention in my post originally but was magically cut out for no reason: every image in that iframe is programmatically generated BEFORE the page is written. It isn't a page which does clever code and generates X number of images... The code for 'generate image' has been repeated X number of times programmatically to write the page and the page placed there for us to interact with. And these programmatically generated text chunks containing the variable: data-is-nsfw = false . What this means is it is somewhere on the server we can't see, which is generating this page in real time, that has data of whether each image is nsfw or not.

It is also extremely hard to access and touch the inner contents of the iframe containing the gallery. I have not managed it yet, though it is also new territory for me and there may be simple things about iframe origins i do not know. I rarely have used iframes.

what other useful info is there, hmmm. so i got a hold on the iframe containing the gallery pretty easily and looked deep in to the windowmessages sent upon events from the server. But none of it allows touching the inner contents of the box holding the gallery, just the outside of the box.

All this implies it is actually REALLY EASY for the maker of perchance to do on their side since they would just add a button seeable by only the admin on each image... just have whatever is programmatically making the gallery page that gets iframed in have an additional button. then make a function on the server to toggle an image rating, which should be as simple as changing a variable false to true for the owner of the server but we cannot do from here. Then just have the button call the function. For us to do it it seems REALLY HARD to impossible through the existing Gallery as is. I have never, that I know of, seen nor met the perchance creator nor have any knowledge of how often they update nor how much they listen.

I could not find a way to A: get a useable reference to anything within the gallery iframe (which would allow finding the images and multiple paths to success)

and I could not find a way to hit any of the variables or do any of the authentication stuff to artificially manipulate gallery variables from afar. I tried looking at how the page that is the gallery within the iframe sends signals to the server, but my attempts to replicate the signals from another perchance site did not work. It may have to do with the server set up to only allow requests from certain paths and more likely may have to do with me not having the same variables as are available within the iframe.

I see your problem and if I think of anything I'll let you know. From delving through for hours it looks like it's behind walls but an easy fix for the one(s) with access behind the wall.

[–] [email protected] 2 points 8 months ago* (last edited 8 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

[–] [email protected] 2 points 8 months ago (3 children)

just wondering if possible to add a button or other code in generator to be able to moderate gallery. I am fine with everything in 18+ but the 13- should be vettable , so many great pics but some less so @eatham @perchance

[–] [email protected] 2 points 8 months ago (1 children)

@Gaipacub Someone ping the dev so they'll notice this

[–] [email protected] 1 points 8 months ago

i would if i knew how to ping :) @[email protected]

oh cool

@[email protected] dear perchancemaker can u pleas help this poor soul getting their gallery devoured by someone corrupting it with evil images that nonetheless are bypassing the age filter? need fix which may be easy on your side but seems to be soulgobbling to us innocent villagers. thank u!

[–] [email protected] 1 points 8 months ago

hey i just learned one post ago, if you want to link someone by name, type the @eatham then hover the mouse over the word and an option to link them will pop up.

[–] [email protected] 1 points 8 months ago
[–] [email protected] 2 points 8 months ago (1 children)

@Gaipacub Here's @Alllo's comment about this if you can't see it: https://mastodon.social/@BluePower/111970461407580936

(referring it as a link to my linkage reply to the comment since the Lemmy server somehow throwing an error when trying to load the comment, as of my testing)

[–] [email protected] 1 points 8 months ago (1 children)

the code got all jumbled somehow on the transition in to the post and huge chunks were lost enough that it lost so much meaning i chose to delete the post lol

[–] [email protected] 2 points 8 months ago

@Alllo Okay I didn't know that. I'm just thinking the Lemmy servers just broke in and cannot post the comment, however you can instead create some example generators to demonstrate that.