fix nsfw posts not showing cause of apikey. add message when not showing
This commit is contained in:
9
view.php
9
view.php
@ -8,9 +8,13 @@
|
|||||||
include('misc/tools.php');
|
include('misc/tools.php');
|
||||||
$config = require('config.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']) {
|
if ((!$_POST['purity'] && !$_POST['wall']) && $_GET['w']) {
|
||||||
$_POST['purity'] = $_GET['p'];
|
$_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"];
|
$_POST['wall'] = $wall["path"];
|
||||||
}
|
}
|
||||||
/* get wallpaper id and get info from api */
|
/* get wallpaper id and get info from api */
|
||||||
@ -49,7 +53,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id='bwallpaperview'>
|
<div id='bwallpaperview'>
|
||||||
<?php
|
<?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>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user