Here’s the https://perchance.org/prompt-hunter , a gallery tag searching gen.

    if (formatTagName !== "no filter, currently showing all tags" && dataMatch) {
  
      // Modify the 'bannedPromptPhrases' array
      dataObj.bannedPromptPhrases = [`/^(?!.*(\\b${formatTagName}\\b)).*$/i`];
      localStorage.setItem("lookForThis", formatTagName);

    } else {
      localStorage.removeItem("lookForThis");
    }

    if (formatBadTags !== "no bad words to filter") {
      dataObj.bannedPromptPhrases.push(...formatBadTags);
      let badTagsJoin = formatBadTags.join(', ')
      localStorage.setItem("dontLookForThis", badTagsJoin);
      
    } else {
      localStorage.removeItem("dontLookForThis")
    }

I want to add my own banned list [jail.bannedPromptPhrases] and import jail, added after that as

      if (Array.isArray(jail?.bannedPromptPhrases)) {
        dataObj.bannedPromptPhrases.push(...jail.bannedPromptPhrases);
      }
    }

Now the problem is that’s giving unstable results, sometimes it works and sometimes not. I have no idea how or why. In this forked gen https://perchance.org/prompt-hunter#sharedlink=gen%3Aai-furry-generator&galleryname%3Atest3=&tag%3A=&bannedword=: Apple should be banned in PG-13 because it has a PG-13 banned tag “ContentLabel”. But sometimes it just won’t work!(what’s tricky is sometimes it also work) Help!

  • BlackYT@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    18 days ago

    I dont know if this is really the problem because i was testing using my own pics, but i forgot that i can still see my pics when they are banned if i am with admin mode disabled. But make sure your list is an array:

    let furryJail = jail.bannedPromptPhrases.selectAll.join(','); furryJail .split(",") .map(tag => tag.trim()) .filter(tag => tag !== "") ; dataObj.bannedPromptPhrases.push(...furryJail);

    like

    also you need to add it in 2 functions, changeAll() and changeGallerySubChannel() so it runs at the start.

    • RudBo@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      15 days ago

      Sorry it seems still being unstable. https://perchance.org/gallery-search-forking-rudbo3 in the test3 gallery, apple should be in 18+ but sometimes still in PG13

      But this way might works.

      It’s not the full banned list but the most critical one.

      Since we usually rely on user ban instead of prompt ban so this should work?

        // Modify the 'bannedPromptPhrases' array
        dataObj.bannedPromptPhrases = [
          `/^(?!.*(\\b${formatTagName}\\b)).*$/i`,
          "pg13:ContentLabel",
          "pg13:HornyJailed",
          "pg13:NullValue123"
        ];
        localStorage.setItem("lookForThis", formatTagName);
      
      • BlackYT@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        15 days ago

        The problem is the condition, that list is not an array, I’m pretty sure it is an object. An object is something like "BannedPromptPhrases = {banWord1: “banWord1”, banWord2: “banWord2”}; They are values stored inside the var. So the commands below (join() split() map() filter()) converts it to an array, the condition should be AFTER. But i think you don’t need that condition, and if you are lazy just change it to something that’s always true like 2===2.