aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-02 12:12:46 +0100
committerMinteck <contact@minteck.org>2023-02-02 12:12:46 +0100
commitab266f5e5d89be0710c4c2d36cf1560e6e274b17 (patch)
treed6748371bece554f0b091dad4ff41572d0e360fd
parent42ff743c9bdcc18a1f4ddfd350524de0ab8e0236 (diff)
downloadbooru-ab266f5e5d89be0710c4c2d36cf1560e6e274b17.tar.gz
booru-ab266f5e5d89be0710c4c2d36cf1560e6e274b17.tar.bz2
booru-ab266f5e5d89be0710c4c2d36cf1560e6e274b17.zip
Updated 15 files, added 6 files and deleted assets/gallery.svg (automated)
-rw-r--r--README.md3
-rw-r--r--assets/explicit.pngbin0 -> 2469 bytes
-rw-r--r--assets/gallery.pngbin0 -> 3247 bytes
-rw-r--r--assets/gallery.svg1
-rw-r--r--assets/next.svg1
-rw-r--r--assets/previous.svg1
-rw-r--r--categories/unsave.php6
-rw-r--r--followed/index.php6
-rw-r--r--includes/fetch.php2
-rw-r--r--includes/filters.json8
-rw-r--r--includes/footer.php8
-rw-r--r--includes/header.php151
-rw-r--r--includes/session.php84
-rw-r--r--index.php4
-rw-r--r--nsfw/g/index.php11
-rw-r--r--nsfw/home/index.php50
-rw-r--r--nsfw/index.php8
-rw-r--r--nsfw/l/index.php1
-rw-r--r--nsfw/sp/index.php7
-rw-r--r--saved/index.php14
-rw-r--r--search/index.php4
-rw-r--r--tag/index.php4
22 files changed, 291 insertions, 83 deletions
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
--- /dev/null
+++ b/assets/explicit.png
Binary files differ
diff --git a/assets/gallery.png b/assets/gallery.png
new file mode 100644
index 0000000..ca6383b
--- /dev/null
+++ b/assets/gallery.png
Binary files 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 @@
-<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M2 6a2 2 0 0 1 2-2h1v16H4a2 2 0 0 1-2-2V6ZM16 8.5h-4a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5V9a.5.5 0 0 0-.5-.5Z" fill="#000000"/><path d="M6.5 20H20a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H6.5v16ZM12 7h4a2 2 0 0 1 2 2v1a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z" fill="#000000"/></svg> \ 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 @@
+<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13.704 4.284a1 1 0 1 0-1.403 1.424L17.67 11H4a1 1 0 1 0 0 2h13.665L12.3 18.285a1 1 0 0 0 1.403 1.424l6.925-6.822a1.25 1.25 0 0 0 0-1.78l-6.925-6.823Z" fill="#000000"/></svg> \ 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 @@
+<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M10.295 19.716a1 1 0 0 0 1.404-1.425l-5.37-5.29h13.67a1 1 0 1 0 0-2H6.336L11.7 5.714a1 1 0 0 0-1.404-1.424l-6.924 6.822a1.25 1.25 0 0 0 0 1.78l6.924 6.823Z" fill="#000000"/></svg> \ 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
?>
-<div style="margin: 20px 50px 0;">
+<div style="margin: 20px 50px 0;" class="main-app">
<div class="list-group">
<?php foreach ($follows as $tag): ?>
<a href="/tag/?id=<?= $tag ?>" class="list-group-item list-group-item-action tag-item" style="display: grid; grid-template-columns: 5vw 1fr; grid-gap: 15px;" data-tag="<?= $tag ?>">
- <div style="background-color: rgba(0, 0, 0, .1); height: 64px; border-radius: 5px;">
+ <div style="background-color: rgba(255, 255, 255, .1); height: 64px; border-radius: 5px;">
<div style="opacity: 0; transition: opacity 200ms; background-size: cover; background-position: center; height: 100%; width: 100%; border-radius: 5px;">
<div style="display:none;width: 100%;backdrop-filter: blur(5px);height: 100%;border-radius: 5px;"></div>
</div>
@@ -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 @@
</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
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));
?>
-<div style="margin: 20px 50px 0;">
+<div style="margin: 20px 50px 0;" class="main-app">
<div style="display: grid; grid-template-columns: repeat(6, 1fr); grid-gap: 10px;" id="grid">Loading...</div>
<p style="text-align: center; display: none;" id="pagination"><a href="/?page=<?= max($page - 1, 1) ?>"><</a> <b>Page <?= $page ?></b> <a href="/?page=<?= $page + 1 ?>">></a></p>
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 @@
-<?php $title = "NSFW Gallery"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
+<?php $title = "Explicit Gallery"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $allowNsfw;
+if (!$allowNsfw) header("Location: /nsfw/home") and die();
$page = 1;
@@ -6,14 +9,14 @@ 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));
?>
-<div style="margin: 20px 50px 0;">
+<div style="margin: 20px 50px 0;" class="main-app">
<div style="display: grid; grid-template-columns: repeat(6, 1fr); grid-gap: 10px;" id="grid">Loading...</div>
- <p style="text-align: center; display: none;" id="pagination"><a href="/nsfw/home?page=<?= max($page - 1, 1) ?>"><</a> <b>Page <?= $page ?></b> <a href="/nsfw/home?page=<?= $page + 1 ?>">></a></p>
+ <p style="text-align: center; display: none;" id="pagination"><a href="/nsfw/g?page=<?= max($page - 1, 1) ?>"><</a> <b>Page <?= $page ?></b> <a href="/nsfw/g?page=<?= $page + 1 ?>">></a></p>
<script>
_display_filter = `<?= $filters['nsfw'] ?>`;
diff --git a/nsfw/home/index.php b/nsfw/home/index.php
index 179b81c..7e0fd31 100644
--- a/nsfw/home/index.php
+++ b/nsfw/home/index.php
@@ -1,34 +1,50 @@
-<?php $title = "NSFW"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
+<?php $title = "NSFW"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; global $allowFillyNsfw; global $allowNsfw;
?>
-<div style="margin: 20px 50px 0;">
- <h2>NSFW</h2>
- <p>Select how you want to view NSFW pictures:</p>
+<div style="margin: 20px 50px 0;" class="main-app">
+ <h2>Explicit</h2>
+ <p>Select how you want to view explicit images:</p>
- <div style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 20px;">
+ <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;" id="explicit-grid">
<div class="card">
<div class="card-body">
<h4 class="card-title">
- <img src="/assets/gallery.svg" style="vertical-align: middle; width: 36px; height: 36px; margin-right: 2px;">
+ <img class="icon" src="/assets/gallery.png" style="vertical-align: middle; width: 36px; height: 36px; margin-right: 2px;">
<span style="vertical-align: middle;">Regular gallery</span>
</h4>
<p>View images in a gallery-like mode, similar to regular Booru. Useful when you are looking for something in particular or finding new ideas to reproduce.</p>
- <a href="/nsfw/g" class="btn btn-primary">Open</a>
+ <a href="/nsfw/g" class="btn btn-primary <?= !$allowNsfw ? "disabled" : "" ?>">Open</a><br>
+ <small class="text-muted">Built-in</small>
</div>
</div>
- <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/card.php")): require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/card.php"; else: ?>
- <div class="card">
- <div class="card-body">
- <h4 class="card-title">
- <img src="/assets/extension.svg" style="vertical-align: middle; width: 36px; height: 36px; margin-right: 2px;">
- <span style="vertical-align: middle;" class="text-danger">Missing proprietary extension</span>
- </h4>
- <p>An additional option is available, but it requires a proprietary extension that is not currently installed. Install the extension and try again.</p>
- <a href="#" class="btn btn-primary disabled">Open</a>
+ <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/card1.php")): require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/card1.php"; else: ?>
+ <div class="card">
+ <div class="card-body">
+ <h4 class="card-title">
+ <img class="icon" src="/assets/extension.svg" style="vertical-align: middle; width: 36px; height: 36px; margin-right: 2px;">
+ <span style="vertical-align: middle;" class="text-danger">Missing proprietary extension</span>
+ </h4>
+ <p>An additional option is available, but it requires a proprietary extension that is not currently installed. Install the extension and try again.</p>
+ <a href="#" class="btn btn-primary disabled <?= !$allowNsfw ? "disabled" : "" ?>">Open</a><br>
+ <small class="text-muted">Not installed</small>
+ </div>
+ </div>
+ <?php endif; ?>
+
+ <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/card2.php")): require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/card2.php"; else: ?>
+ <div class="card">
+ <div class="card-body">
+ <h4 class="card-title">
+ <img class="icon" src="/assets/extension.svg" style="vertical-align: middle; width: 36px; height: 36px; margin-right: 2px;">
+ <span style="vertical-align: middle;" class="text-danger">Missing proprietary extension</span>
+ </h4>
+ <p>An additional option is available, but it requires a proprietary extension that is not currently installed. Install the extension and try again.</p>
+ <a href="#" class="btn btn-primary disabled <?= !$allowNsfw ? "disabled" : "" ?>">Open</a><br>
+ <small class="text-muted">Not installed</small>
+ </div>
</div>
- </div>
<?php endif; ?>
</div>
</div>
diff --git a/nsfw/index.php b/nsfw/index.php
index 41f1024..d24ab89 100644
--- a/nsfw/index.php
+++ b/nsfw/index.php
@@ -1,11 +1,15 @@
<?php
+if (isset($_COOKIE["booru_consent"]) && time() - strtotime($_COOKIE["booru_consent"]) < 3600) {
+ header("Location: /nsfw/home") and die();
+}
+
$title = "Warning"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
?>
-<div style="margin: 20px 50px 0;">
- <h2>NSFW Warning</h2>
+<div style="margin: 20px 50px 0;" class="main-app">
+ <h2>Explicit Warning</h2>
<div class="alert alert-warning">
<p>
This section of the app presents uncensored graphically explicit sexual content that you may not want to see in some cases. Some of the content you see might be more explicit or realistic than the rest, and content filters might not be 100% perfect.
diff --git a/nsfw/l/index.php b/nsfw/l/index.php
new file mode 100644
index 0000000..ed78bb5
--- /dev/null
+++ b/nsfw/l/index.php
@@ -0,0 +1 @@
+<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/gallery.php")) require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/gallery.php";
diff --git a/nsfw/sp/index.php b/nsfw/sp/index.php
index 721fcc6..7600758 100644
--- a/nsfw/sp/index.php
+++ b/nsfw/sp/index.php
@@ -1 +1,6 @@
-<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/app.php")) require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/app.php";
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $allowNsfw;
+if (!$allowNsfw) header("Location: /nsfw/home") and die();
+
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/app.php")) require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/proprietary/app.php";
diff --git a/saved/index.php b/saved/index.php
index 17b5591..5387392 100644
--- a/saved/index.php
+++ b/saved/index.php
@@ -5,11 +5,11 @@ $saved = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/da
?>
<?php if (!isset($_GET["id"])): ?>
-<div style="margin: 20px 50px 0;">
- <div class="list-group">
+<div style="margin: 20px 50px 0;" class="main-app">
+ <div class="list-group saved-list">
<?php foreach ($saved as $id => $category): if ($id === "favorites"): $category["items"] = array_filter(array_values($category["items"]), function ($i) { return isset($i); }) ?>
<a href="/saved/?id=<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 5vw 1fr; grid-gap: 15px;">
- <div style="background-color: rgba(0, 0, 0, .1); height: 64px; border-radius: 5px;">
+ <div style="background-color: rgba(255, 255, 255, .1); height: 64px; border-radius: 5px;">
<div style="opacity: 0; transition: opacity 200ms; background-size: cover; background-position: center; height: 100%; width: 100%; border-radius: 5px;" class="category-img" data-category-img="<?= count($category["items"]) > 0 ? $category["items"][count($category["items"]) - 1] : "" ?>">
<div style="display:none;width: 100%;backdrop-filter: blur(5px);height: 100%;border-radius: 5px;"></div>
</div>
@@ -24,10 +24,10 @@ $saved = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/da
<?php endif; endforeach; ?>
</div>
- <div class="list-group" style="margin-top: 10px;">
+ <div class="list-group saved-list" style="margin-top: 10px;">
<?php foreach ($saved as $id => $category): if ($id !== "favorites"): ?>
<a href="/saved/?id=<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 5vw 1fr; grid-gap: 15px;">
- <div style="background-color: rgba(0, 0, 0, .1); height: 64px; border-radius: 5px;">
+ <div style="background-color: rgba(255, 255, 255, .1); height: 64px; border-radius: 5px;">
<div style="opacity: 0; transition: opacity 200ms; background-size: cover; background-position: center; height: 100%; width: 100%; border-radius: 5px;" class="category-img" data-category-img="<?= count($category["items"]) > 0 ? $category["items"][count($category["items"]) - 1] : "" ?>">
<div style="display:none;width: 100%;backdrop-filter: blur(5px);height: 100%;border-radius: 5px;"></div>
</div>
@@ -81,7 +81,7 @@ $saved = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/da
if (!isset($category)) die();
?>
-<div style="margin: 20px 50px 0;">
+<div style="margin: 20px 50px 0;" class="main-app">
<h2 <?= $_GET["id"] !== "favorites" ? "contenteditable" : "" ?> id="category-title"><?= $category["name"] ?></h2>
<p <?php if (!$allowNsfw): ?>style="display:none;"<?php endif; ?>>
@@ -91,7 +91,7 @@ if (!isset($category)) die();
</div>
</p>
- <div style="display: grid; grid-template-columns: repeat(6, 1fr); grid-gap: 10px;">
+ <div style="display: grid; grid-template-columns: repeat(6, 1fr); grid-gap: 10px;" id="grid">
<?php foreach ($category["items"] as $id) { ?>
<a style="cursor: pointer;" onclick="viewImage(<?= $id ?>)">
<div class="card" style="height: calc((100vw - 150px) / 6);">
diff --git a/search/index.php b/search/index.php
index d93b4f3..5a34fff 100644
--- a/search/index.php
+++ b/search/index.php
@@ -1,7 +1,7 @@
<?php
$title = "Search"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; global $allowNsfw;
-$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));
$page = 1;
@@ -15,7 +15,7 @@ if (isset($_GET["page"]) && is_numeric($_GET["page"]) && (int)$_GET["page"] > 0)
?>
-<div style="margin: 20px 50px 0;">
+<div style="margin: 20px 50px 0;" class="main-app">
<h2>Search</h2>
<form style="display: grid; grid-template-columns: <?php if (!$allowNsfw): ?>4fr 0.25fr<?php else: ?>1fr 3fr 0.25fr<?php endif; ?> ;grid-gap: 15px;" action="/search">
<?php if ($allowNsfw): ?>
diff --git a/tag/index.php b/tag/index.php
index fc806a5..eacd727 100644
--- a/tag/index.php
+++ b/tag/index.php
@@ -27,7 +27,7 @@ $tags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/dat
$name = isset($tags["db"][$_GET["id"]]) && isset($tags["db"][$_GET["id"]]["display_name"]) ? $tags["db"][$_GET["id"]]["display_name"] : ucwords(strip_tags($_GET["id"]));
$title = $name; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
-$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));
$page = 1;
@@ -37,7 +37,7 @@ if (isset($_GET["page"]) && is_numeric($_GET["page"]) && (int)$_GET["page"] > 0)
?>
-<div style="margin: 20px 50px 0;">
+<div style="margin: 20px 50px 0;" class="main-app">
<h2><?= $title ?></h2>
<p><a href="/tag?id=<?= $_GET['id'] ?>&follow"><?= in_array($_GET['id'], $follows[$userName]) ? 'Unfollow tag' : 'Follow tag' ?></a><?php if ($allowNsfw): ?> ยท
<?php if (isset($_GET['nsfw']) && !isset($_GET['only_nsfw'])): ?>