diff options
author | Minteck <contact@minteck.org> | 2023-02-02 12:12:46 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-02 12:12:46 +0100 |
commit | ab266f5e5d89be0710c4c2d36cf1560e6e274b17 (patch) | |
tree | d6748371bece554f0b091dad4ff41572d0e360fd /includes | |
parent | 42ff743c9bdcc18a1f4ddfd350524de0ab8e0236 (diff) | |
download | booru-ab266f5e5d89be0710c4c2d36cf1560e6e274b17.tar.gz booru-ab266f5e5d89be0710c4c2d36cf1560e6e274b17.tar.bz2 booru-ab266f5e5d89be0710c4c2d36cf1560e6e274b17.zip |
Updated 15 files, added 6 files and deleted assets/gallery.svg (automated)
Diffstat (limited to 'includes')
-rw-r--r-- | includes/fetch.php | 2 | ||||
-rw-r--r-- | includes/filters.json | 8 | ||||
-rw-r--r-- | includes/footer.php | 8 | ||||
-rw-r--r-- | includes/header.php | 151 | ||||
-rw-r--r-- | includes/session.php | 84 |
5 files changed, 211 insertions, 42 deletions
diff --git a/includes/fetch.php b/includes/fetch.php index 86a1193..8443fe6 100644 --- a/includes/fetch.php +++ b/includes/fetch.php @@ -9,7 +9,7 @@ foreach ($tags["db"] as $name => $tag) { $data = json_decode(file_get_contents("https://derpibooru.org/api/v1/json/tags/" . urlencode($name), false, stream_context_create([ "http" => [ "method" => "GET", - "header" => "User-Agent: Mozilla/5.0 (+Booru/1.0)\r\n" + "header" => "User-Agent: Mozilla/5.0 (+Booru/1.0; contact@minteck.org)\r\n" ] ])), true)["tag"]; diff --git a/includes/filters.json b/includes/filters.json index 738b0d4..e355bb1 100644 --- a/includes/filters.json +++ b/includes/filters.json @@ -1,5 +1,7 @@ { - "default": "-bipedal, -human, -anthro, -face mask, -machine learning generated, -comic:pipp's ponyfans adventure, -content-aware scale, -pony creator, -youtube caption, -forced meme, -fluffy pony grimdark, -grimdark, -grotesque, -obligatory pony, -drama bait, -questionable, -not pony related, -text only, -deviantart stamp, -explicit, -exploitable meme, -nazi, -racial slur, -abuse, -suggestive, -1000 hours in ms paint, -politics, -semi-grimdark, -seizure warning, -screencap, -edited screencap, -vulgar, -mockup, -fat, -sexy, -equestria girls, -big breasts, -large butt, -butt, -scootadash, -pregnant, -belly, -fetish, -drugs, -animated, -webm, -hoof knuckles, -your character here, -alcohol, -cigarette, -gmod, -them's fightin' herds, -meme, -gameloft, -ponified, -ych result, -species swap", - "nsfw": "explicit, -sketch, -original species, -traditional art, -transparent background, -opaline, -opaline arcana, -princess luna, -princess cadance, -jazz (g5), -queen haven, -smolder, -machine learning generated, -content-aware scale, -pony creator, -youtube caption, -forced meme, -fluffy pony grimdark, -grimdark, -grotesque, -obligatory pony, -drama bait, -questionable, -not pony related, -text only, -deviantart stamp, -exploitable meme, -nazi, -racial slur, -abuse, -suggestive, -1000 hours in ms paint, -politics, -semi-grimdark, -seizure warning, -screencap, -edited screencap, -vulgar, -mockup, -fat, -equestria girls, -big breasts, -large butt, -safe, -foalcon, -human, -anthro, -rainbow dash, -fluttershy, -zoom zephyrwing, -thunder (g5), -posey, -babs seed, -sweetie belle, -scootaloo, -twilight, -twilight sparkle, -sweetie bot, -thunder, -zoom, -misty, -zipp storm, -pipp petals, -penis, -licking cock, -dickgirl, -dicks everywhere, -dickboop, -dick in a box, -fart on dick, -dick -flattening, -cockblock, -male, -solo male, -masturbation, -masturbating in stomach, -stallion, -balls, -big balls, -close-up, -rope, -tied up, -ballgag, -diaper, -diaper fetish, -incest, -cyborg, -bondage, -apple bloom, -merch sexploitation, -fetish, -tentacle porn, -chastity belt, -deer, -zebra, -big crotchboobs, -cat, -3d, -tentacles, -sunny starscout, -izzy moonbow, -derpy hooves, -princess celestia, -trixie, -starlight glimmer, -pinkie pie, -applejack, -rarity, -them's fightin' herds, -your character here, -alcohol, -cigarette, -gmod, -meme, -gameloft, -ponified, -ych result, -species swap", - "minimal": "-sketch, -original species, -traditional art, -transparent background, -machine learning generated, -content-aware scale, -pony creator, -youtube caption, -forced meme, -fluffy pony grimdark, -grimdark, -grotesque, -obligatory pony, -drama bait, -questionable, -not pony related, -text only, -deviantart stamp, -exploitable meme, -nazi, -racial slur, -abuse, -suggestive, -1000 hours in ms paint, -politics, -semi-grimdark, -seizure warning, -screencap, -edited screencap, -vulgar, -mockup, -fat, -big breasts, -large butt, -foalcon, -human, -anthro, -penis, -licking cock, -dickgirl, -dicks everywhere, -dickboop, -dick in a box, -fart on dick, -dick -flattening, -cockblock, -male, -solo male, -masturbation, -masturbating in stomach, -stallion, -balls, -big balls, -close-up, -rope, -tied up, -ballgag, -diaper, -diaper fetish, -incest, -cyborg, -bondage, -merch sexploitation, -fetish, -tentacle porn, -chastity belt, -deer, -zebra, -big crotchboobs, -cat, -3d, -tentacles, -them's fightin' herds, -your character here, -alcohol, -cigarette, -gmod, -meme, -gameloft, -ponified, -ych result, -species swap" + "default": ["bipedal","human","anthro","face mask","machine learning generated","comic:pipp's ponyfans adventure","content-aware scale","pony creator","youtube caption","forced meme","fluffy pony grimdark","grimdark","grotesque","obligatory pony","drama bait","questionable","not pony related","text only","deviantart stamp","explicit","exploitable meme","nazi","racial slur","abuse","suggestive","1000 hours in ms paint","politics","semi-grimdark","seizure warning","screencap","edited screencap","vulgar","mockup","fat","sexy","equestria girls","big breasts","large butt","butt","scootadash","pregnant","belly","fetish","drugs","animated","webm","hoof knuckles","your character here","alcohol","cigarette","gmod","them's fightin' herds","meme","gameloft","ponified","ych result","species swap","semi-incest","barely pony related","pixel art","spanish","oc","japan ponycon","semi-anthro","big belly","impossibly large belly","huge belly","belly bed","glory hole","selfie"], + + "nsfw": ["sketch","original species","traditional art","transparent background","opaline","opaline arcana","princess luna","princess cadance","jazz (g5)","queen haven","smolder","machine learning generated","content-aware scale","pony creator","youtube caption","forced meme","fluffy pony grimdark","grimdark","grotesque","obligatory pony","drama bait","questionable","not pony related","text only","deviantart stamp","exploitable meme","nazi","racial slur","abuse","suggestive","1000 hours in ms paint","politics","semi-grimdark","seizure warning","screencap","edited screencap","vulgar","mockup","fat","equestria girls","big breasts","large butt","safe","foalcon","human","anthro","rainbow dash","fluttershy","zoom zephyrwing","thunder (g5)","posey","babs seed","sweetie belle","scootaloo","twilight","twilight sparkle","sweetie bot","thunder","zoom","misty","zipp storm","pipp petals","penis","licking cock","dickgirl","dicks everywhere","dickboop","dick in a box","fart on dick","dick", "flattening","cockblock","male","solo male","masturbation","masturbating in stomach","stallion","balls","big balls","close-up","rope","tied up","ballgag","diaper","diaper fetish","incest","cyborg","bondage","apple bloom","merch sexploitation","fetish","tentacle porn","chastity belt","deer","zebra","big crotchboobs","cat","3d","tentacles","sunny starscout","izzy moonbow","derpy hooves","princess celestia","trixie","starlight glimmer","pinkie pie","applejack","rarity","them's fightin' herds","your character here","alcohol","cigarette","gmod","meme","gameloft","ponified","ych result","species swap","semi-incest","barely pony related","pixel art","spanish","japan ponycon","chastity cage","anal insertion","semi-anthro","big belly","impossibly large belly","huge belly","belly bed","glory hole","selfie"], + + "minimal": ["sketch","original species","traditional art","transparent background","machine learning generated","content-aware scale","pony creator","youtube caption","forced meme","fluffy pony grimdark","grimdark","grotesque","obligatory pony","drama bait","questionable","not pony related","text only","deviantart stamp","exploitable meme","nazi","racial slur","abuse","suggestive","1000 hours in ms paint","politics","semi-grimdark","seizure warning","screencap","edited screencap","vulgar","mockup","fat","big breasts","large butt","foalcon","human","anthro","penis","licking cock","dickgirl","dicks everywhere","dickboop","dick in a box","fart on dick","dick", "flattening","cockblock","male","solo male","masturbation","masturbating in stomach","stallion","balls","big balls","close-up","rope","tied up","ballgag","diaper","diaper fetish","incest","cyborg","bondage","merch sexploitation","fetish","tentacle porn","chastity belt","deer","zebra","big crotchboobs","cat","3d","tentacles","them's fightin' herds","your character here","alcohol","cigarette","gmod","meme","gameloft","ponified","ych result","species swap","semi-incest","barely pony related","pixel art","spanish","japan ponycon","chastity cage","anal insertion","semi-anthro","big belly","impossibly large belly","huge belly","belly bed","glory hole","selfie"] }
\ No newline at end of file diff --git a/includes/footer.php b/includes/footer.php index 03f714e..278b08c 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -14,8 +14,8 @@ </div> <script> - let tags = JSON.parse(atob(`<?= base64_encode(json_encode(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/tags.json"), true)["db"])) ?>`)); - let categories = JSON.parse(atob(`<?= base64_encode(json_encode(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/tags.json"), true)["categories"])) ?>`)); + let tags = JSON.parse(atob(`<?= base64_encode(json_encode(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/tags.json"))->db)) ?>`)) ?? {}; + let categories = JSON.parse(atob(`<?= base64_encode(json_encode(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/tags.json"))->categories)) ?>`)) ?? {}; function timeAgo(time) { if (!isNaN(parseInt(time))) { @@ -138,7 +138,7 @@ <tbody> <tr> <td style="padding-right: 10px; text-align: right;"><b>Tags:</b></td> - <td>${data['tags'].filter(tag => !tag.includes(":")).map((tag) => { let info = tags[tag] ?? {}; return `<a style="color:rgb(${info ? (info['category'] && categories[info['category']] ? categories[info['category']] : '0,0,0') : '0,0,0'});" href="/tag/?id=${encodeURIComponent(tag)}"><span style='display: inline-block; margin-right:10px; background-color: rgba(${info ? (info['category'] && categories[info['category']] ? categories[info['category']] : '0,0,0') : '0,0,0'},0.1); border: 1px solid rgba(${info ? (info['category'] && categories[info['category']] ? categories[info['category']] : '0,0,0') : '0,0,0'},0.5); padding: 2px 10px; margin-bottom: 2px; border-radius: 999px;'>${info['display_name'] ? info['display_name'] : titleCase(tag)}</span></a>`; }).join("")}</td> + <td>${data['tags'].filter(tag => !tag.includes(":")).map((tag) => { let info = tags[tag] ?? {}; return `<a class="tag" style="color:rgb(${info ? (info['category'] && categories[info['category']] ? categories[info['category']] : '0,0,0') : '0,0,0'});" href="/tag/?id=${encodeURIComponent(tag)}"><span style='display: inline-block; margin-right:10px; background-color: rgba(${info ? (info['category'] && categories[info['category']] ? categories[info['category']] : '0,0,0') : '0,0,0'},0.1); border: 1px solid rgba(${info ? (info['category'] && categories[info['category']] ? categories[info['category']] : '0,0,0') : '0,0,0'},0.5); padding: 2px 10px; margin-bottom: 2px; border-radius: 999px;'>${info['display_name'] ? info['display_name'] : titleCase(tag)}</span></a>`; }).join("")}</td> </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>Uploaded:</b></td> @@ -176,5 +176,7 @@ } </script> +<br><br> + </body> </html>
\ No newline at end of file diff --git a/includes/header.php b/includes/header.php index b899c3d..9838da5 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,4 +1,26 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $allowNsfw; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $allowNsfwGeneral; + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/nsfw.php")) require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/nsfw.php"; + +function parseFilters($filters, $ignore = []) { + if (function_exists("proprietary_nsfw_filter")) $filters = proprietary_nsfw_filter($filters); + + foreach ($filters as $name => $filter) { + $text = ""; + + foreach ($filter as $item) { + if (!in_array($item, $ignore)) { + $text .= "-" . $item . ", "; + } + } + + $filters[$name] = substr($text, 0, -3); + } + + return $filters; +} + +?> <!doctype html> <html lang="en"> <head> @@ -43,12 +65,133 @@ blockquote { margin-left: 5px; padding-left: 10px; - border-left: 5px solid rgba(0, 0, 0, .1); + border-left: 5px solid rgba(255, 255, 255, .1); } .modal img { max-width: 100%; } + + @media (max-width: 700px) { + .main-app { + margin-left: 20px !important; + margin-right: 20px !important; + } + + #grid { + grid-template-columns: repeat(3, 1fr) !important; + } + + #grid .card { + height: calc((100vw - 130px) / 3) !important; + } + + form { + grid-template-columns: 1fr !important; + grid-gap: 5px !important; + } + + .list-group-item.tag-item, .saved-list .list-group-item { + grid-template-columns: 17vw 1fr !important; + } + + #explicit-grid { + grid-template-columns: 1fr !important; + } + + form .btn { + width: max-content; + display: inline-block; + margin-left: auto; + margin-right: auto; + } + } + + :root { + --bs-link-color: #7eb1fc; + --bs-link-hover-color: #658dc9; + } + + a { + text-decoration: none; + } + + .navbar-brand, .nav-link { + color: white; + } + + .navbar-brand:hover, .nav-link:hover { + color: rgba(255, 255, 255, .75); + } + + .form-control, .form-select, .form-check-input { + filter: invert(1) hue-rotate(180deg); + } + + .icon { + filter: invert(1) hue-rotate(180deg); + } + + .progress { + --bs-progress-bg: #252525; + } + + .alert { + filter: invert(1) hue-rotate(180deg); + } + + .modal { + backdrop-filter: blur(20px); + } + + .modal-content { + background-color: #222; + } + + .dropdown-menu { + filter: invert(1) hue-rotate(180deg); + } + + .list-group-item { + background-color: #222; + color: white; + } + + .list-group-item-action:hover { + background-color: #272727; + color: white; + } + + .list-group-item-action:active, .list-group-item-action:focus { + background-color: #323232; + color: white; + } + + .tag { + filter: invert(1) hue-rotate(180deg) brightness(150%); + } + + .modal-header { + border-bottom-color: #333; + } + + .navbar-toggler, .btn-close { + filter: invert(1); + } + + .navbar { + color: white; + background-color: #222 !important; + } + + body, html { + background-color: #111; + color: white; + } + + .card { + background-color: #222; + } </style> </head> <body> @@ -69,9 +212,9 @@ <li class="nav-item"> <a class="nav-link" href="/saved">Saved</a> </li> - <?php if ($allowNsfw): ?> + <?php if ($allowNsfwGeneral): ?> <li class="nav-item"> - <a class="nav-link" href="/nsfw">NSFW</a> + <a class="nav-link" href="/nsfw">Explicit</a> </li> <?php endif; ?> </ul> diff --git a/includes/session.php b/includes/session.php index 9cb91da..5b72a3d 100644 --- a/includes/session.php +++ b/includes/session.php @@ -1,12 +1,6 @@ <?php -$debug = false; -if ($_SERVER['REQUEST_URI'] === "/debug/") { - $debug = true; - header("Content-Type: text/plain"); - echo("------------------------------\n"); - echo("NSFW FILTER DEBUG\n\n"); -} +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/nsfw.php")) require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/nsfw.php"; if (!isset($_COOKIE["booru_auth"])) { header("Location: /auth"); @@ -23,45 +17,60 @@ if (!isset($_COOKIE["booru_auth"])) { } } +$debug = false; +if ($_SERVER['REQUEST_URI'] === "/debug/") { + $debug = true; + header("Content-Type: text/plain"); + echo("------------------------------\n"); + echo("NSFW FILTER DEBUG\n\n"); +} + +if (function_exists("proprietary_nsfw_1")) proprietary_nsfw_1(); + global $userName; $userName = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['booru_auth']))), true)["login"]; global $allowNsfw; $allowNsfw = false; + +if (function_exists("proprietary_nsfw_2")) proprietary_nsfw_2(); + $name = "-"; -if ($debug) echo("Found PEH database: "); +if ($debug) echo("Found PEH database: "); if (file_exists("/peh") && file_exists("/peh/gdapd") && file_exists("/peh/ynmuc")) { if ($debug) echo("yes\n"); $fronters = json_decode(file_get_contents("/peh/" . ($userName === "raindrops" ? "gdapd" : "ynmuc") . "/fronters.json"), true); if ($debug) { - echo("Found fronters data: " . (isset($fronters) ? "yes (" . ($userName === "raindrops" ? "gdapd" : "ynmuc") . ")" : "no") . "\n"); + echo("Found fronters data: " . (isset($fronters) ? "yes (" . ($userName === "raindrops" ? "gdapd" : "ynmuc") . ")" : "no") . "\n"); } - if ($debug) echo("At least 1 pony at front: "); + if ($debug) echo("At least 1 pony at front: "); if (count($fronters["members"]) > 0) { if ($debug) echo("yes (" . count($fronters["members"]) . ")\n"); $name = $fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]; $id = $fronters["members"][0]["id"]; - if ($debug) echo("Pony has metadata: "); + if ($debug) echo("Pony has metadata: "); if (file_exists("/peh/metadata/" . $id . ".json")) { if ($debug) echo("yes (" . $id . ")\n"); + if (function_exists("proprietary_nsfw_3")) proprietary_nsfw_3($debug); + $info = json_decode(file_get_contents("/peh/metadata/" . $id . ".json"), true); - if ($debug) echo("Defined fixed age: " . (isset($info["birth"]["age"]) && ($info["birth"]["age"] > 0 || $info["birth"]["age"] === -1) ? "yes (" . ($info["birth"]["age"] === -1 ? "eternal" : $info["birth"]["age"]) . ")" : "no") . "\n"); - if ($debug) echo("Below 16 by fixed age: "); + if ($debug) echo(" Defined fixed age: " . (isset($info["birth"]["age"]) && ($info["birth"]["age"] > 0 || $info["birth"]["age"] === -1) ? "yes (" . ($info["birth"]["age"] === -1 ? "eternal" : $info["birth"]["age"]) . ")" : "no") . "\n"); + if ($debug) echo(" Below 16 by fixed age: "); if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) { if ($debug) echo("yes <--\n"); - if ($debug) echo("Has set birth year: no\n"); - if ($debug) echo("Calculated age over 16: no\n"); - if ($debug) echo("Is otherwise permitted: no\n"); + if ($debug) echo(" Has set birth year: no\n"); + if ($debug) echo(" Calculated age over 16: no\n"); + if ($debug) echo(" Is otherwise permitted: no\n"); $allowNsfw = false; } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) { if ($debug) echo("no\n"); @@ -69,30 +78,32 @@ if (file_exists("/peh") && file_exists("/peh/gdapd") && file_exists("/peh/ynmuc" $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1); - if ($debug) echo("Has set birth year: yes (" . $info["birth"]["year"] . ", " . $age . ")\n"); + if ($debug) echo(" Has set birth year: yes (" . $info["birth"]["year"] . ", " . $age . ")\n"); if ($age < 16) { - if ($debug) echo("Calculated age over 16: no <--\n"); + if ($debug) echo(" Calculated age over 16: no <--\n"); $allowNsfw = false; } else { - if ($debug) echo("Calculated age over 16: yes <--\n"); + if ($debug) echo(" Calculated age over 16: yes <--\n"); $allowNsfw = true; } - if ($debug) echo("Is otherwise permitted: no\n"); + if ($debug) echo(" Is otherwise permitted: no\n"); } else if ((!isset($info["birth"]["age"]) || $info["birth"]["age"] === 0) && (!isset($info["birth"]["year"]) || $info["birth"]["year"] > 1900)) { - echo("no\n"); - if ($debug) echo("Has set birth year: no\n"); - if ($debug) echo("Calculated age over 16: no\n"); - if ($debug) echo("Is otherwise permitted: no <--\n"); + if ($debug) echo("no\n"); + if ($debug) echo(" Has set birth year: no\n"); + if ($debug) echo(" Calculated age over 16: no\n"); + if ($debug) echo(" Is otherwise permitted: no <--\n"); $allowNsfw = false; } else { - echo("no\n"); - if ($debug) echo("Has set birth year: no\n"); - if ($debug) echo("Calculated age over 16: no\n"); - if ($debug) echo("Is otherwise permitted: yes <--\n"); + if ($debug) echo("no\n"); + if ($debug) echo(" Has set birth year: no\n"); + if ($debug) echo(" Calculated age over 16: no\n"); + if ($debug) echo(" Is otherwise permitted: yes <--\n"); $allowNsfw = true; } + + if (function_exists("proprietary_nsfw_4")) proprietary_nsfw_4($debug, $id, $info); } else { if ($debug) echo("no, stopping here\n"); } @@ -103,14 +114,25 @@ if (file_exists("/peh") && file_exists("/peh/gdapd") && file_exists("/peh/ynmuc" if ($debug) echo("no, stopping here\n"); } -if (str_starts_with($_SERVER['REQUEST_URI'], "/nsfw") && !$allowNsfw) { +if (function_exists("proprietary_nsfw_5")) { + $allowNsfwGeneral = $allowNsfw || proprietary_nsfw_5(); +} else { + $allowNsfwGeneral = $allowNsfw; +} + +if (str_starts_with($_SERVER['REQUEST_URI'], "/nsfw") && !$allowNsfwGeneral) { header("Location: /") and die(); } else if (str_starts_with($_SERVER['REQUEST_URI'], "/nsfw/") && $_SERVER['REQUEST_URI'] !== "/nsfw/" && (!isset($_COOKIE["booru_consent"]) || time() - strtotime($_COOKIE["booru_consent"]) > 3600)) { header("Location: /nsfw") and die(); } if ($debug) { - echo("\nAllowing NSFW content: " . ($allowNsfw ? "yes" : "no")); - echo("\nReport generated for: " . $name . "\n"); + if (function_exists("proprietary_nsfw_6")) { + proprietary_nsfw_6($name); + } else { + echo("\nAllowing NSFW content: " . ($allowNsfw ? "yes" : "no")); + echo("\nReport generated for: " . $name . "\n"); + } + echo("------------------------------\n"); }
\ No newline at end of file |