From ab266f5e5d89be0710c4c2d36cf1560e6e274b17 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 2 Feb 2023 12:12:46 +0100 Subject: Updated 15 files, added 6 files and deleted assets/gallery.svg (automated) --- README.md | 3 + assets/explicit.png | Bin 0 -> 2469 bytes assets/gallery.png | Bin 0 -> 3247 bytes assets/gallery.svg | 1 - assets/next.svg | 1 + assets/previous.svg | 1 + categories/unsave.php | 6 ++ followed/index.php | 6 +- includes/fetch.php | 2 +- includes/filters.json | 8 ++- includes/footer.php | 8 ++- includes/header.php | 151 ++++++++++++++++++++++++++++++++++++++++++++++++-- includes/session.php | 84 +++++++++++++++++----------- index.php | 4 +- nsfw/g/index.php | 11 ++-- nsfw/home/index.php | 50 +++++++++++------ nsfw/index.php | 8 ++- nsfw/l/index.php | 1 + nsfw/sp/index.php | 7 ++- saved/index.php | 14 ++--- search/index.php | 4 +- tag/index.php | 4 +- 22 files changed, 291 insertions(+), 83 deletions(-) create mode 100644 README.md create mode 100644 assets/explicit.png create mode 100644 assets/gallery.png delete mode 100644 assets/gallery.svg create mode 100644 assets/next.svg create mode 100644 assets/previous.svg create mode 100644 nsfw/l/index.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..71ab492 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Booru + +A custom Derpibooru interface. \ No newline at end of file diff --git a/assets/explicit.png b/assets/explicit.png new file mode 100644 index 0000000..23bee6d Binary files /dev/null and b/assets/explicit.png differ diff --git a/assets/gallery.png b/assets/gallery.png new file mode 100644 index 0000000..ca6383b Binary files /dev/null and b/assets/gallery.png differ diff --git a/assets/gallery.svg b/assets/gallery.svg deleted file mode 100644 index 0d3ee3e..0000000 --- a/assets/gallery.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/next.svg b/assets/next.svg new file mode 100644 index 0000000..65b7014 --- /dev/null +++ b/assets/next.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/previous.svg b/assets/previous.svg new file mode 100644 index 0000000..22c19e6 --- /dev/null +++ b/assets/previous.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/categories/unsave.php b/categories/unsave.php index d17a04e..4ffe651 100644 --- a/categories/unsave.php +++ b/categories/unsave.php @@ -15,6 +15,12 @@ foreach ($saved[$userName] as $name => $group) { } } +foreach ($saved[$userName] as $name => $group) { + if (count($group["items"]) === 0) { + unset($saved[$userName][$name]); + } +} + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/saved.json", json_encode($saved, JSON_PRETTY_PRINT)); while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/saved.json")) === "") { diff --git a/followed/index.php b/followed/index.php index e7ee625..007f4bd 100644 --- a/followed/index.php +++ b/followed/index.php @@ -5,11 +5,11 @@ $tags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/dat ?> -
+
-
+
@@ -62,7 +62,7 @@ $tags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/dat imgData = JSON.parse(await (await window.fetch("https://derpibooru.org/api/v1/json/images/" + imgId)).text()); } else { imgData = { - image: JSON.parse(await (await window.fetch("https://derpibooru.org/api/v1/json/search/images/?q=" + encodeURIComponent(id).replaceAll("%20", "+") + "&sf=wilson_score&sd=desc")).text())['images'][0] + image: JSON.parse(await (await window.fetch("https://derpibooru.org/api/v1/json/search/images/?q=" + encodeURIComponent(id).replaceAll("%20", "+") + "&sf=wilson_score&sd=desc")).text())['images'].filter(i => !i['animated'])[0] }; } 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 @@
+

+ \ 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 @@ - + $filter) { + $text = ""; + + foreach ($filter as $item) { + if (!in_array($item, $ignore)) { + $text .= "-" . $item . ", "; + } + } + + $filters[$name] = substr($text, 0, -3); + } + + return $filters; +} + +?> @@ -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; + } @@ -69,9 +212,9 @@
- + 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 @@ 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 diff --git a/index.php b/index.php index 9dc5107..666e3e7 100644 --- a/index.php +++ b/index.php @@ -6,11 +6,11 @@ if (isset($_GET["page"]) && is_numeric($_GET["page"]) && (int)$_GET["page"] > 0) $page = $_GET["page"]; } -$filters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/filters.json"), true); +$filters = parseFilters(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/filters.json"), true)); ?> -
+
Loading...
diff --git a/nsfw/g/index.php b/nsfw/g/index.php index 50a1b56..2f4c625 100644 --- a/nsfw/g/index.php +++ b/nsfw/g/index.php @@ -1,4 +1,7 @@ - 0) $page = $_GET["page"]; } -$filters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/filters.json"), true); +$filters = parseFilters(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/filters.json"), true)); ?> -
+
Loading...
- +