aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-10-09 08:53:33 -0400
committerSquibid <me@zacharyscheiman.com>2023-10-09 08:53:33 -0400
commit44d6eb8d45f13183183d7793fb6ff50c11a16cda (patch)
treef76b7a3b0d61d1ffda4e31dad93a2ad0ff3193f5
parentc124debdf55403969b3c5c66b7ec194921e58f3c (diff)
downloadwallheaven-44d6eb8d45f13183183d7793fb6ff50c11a16cda.tar.gz
wallheaven-44d6eb8d45f13183183d7793fb6ff50c11a16cda.tar.bz2
wallheaven-44d6eb8d45f13183183d7793fb6ff50c11a16cda.zip
fix nsfw posts not showing cause of apikey. add message when not showing
Diffstat (limited to '')
-rw-r--r--view.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/view.php b/view.php
index bbc707b..697a7a9 100644
--- a/view.php
+++ b/view.php
@@ -8,9 +8,13 @@
include('misc/tools.php');
$config = require('config.php');
+ if ($_POST['purity'] == "nsfw" || $_GET['p'] == "nsfw")
+ $apikey = $config["frontends"]["wallhaven"]["apikey"];
+ else
+ $apikey = "";
if ((!$_POST['purity'] && !$_POST['wall']) && $_GET['w']) {
$_POST['purity'] = $_GET['p'];
- $wall = getwallpaper("https://wallhaven.cc/api/v1/w/".$_GET['w']);
+ $wall = getwallpaper("https://wallhaven.cc/api/v1/w/$_GET[w]?apikey=$apikey");
$_POST['wall'] = $wall["path"];
}
/* get wallpaper id and get info from api */
@@ -49,7 +53,8 @@
</div>
<div id='bwallpaperview'>
<?php
- printf("<img src='/proxy.php?i=%s' alt='loading image...'>\n", $_POST['wall']);
+ if ($_GET['p'] == "nsfw" && !$apikey)
+ printf("<p id='error'>Server doesn't have an apikey, cannot view image.</p>");
?>
</div>
</div>