Only include raw file url for Danbooru posts if the ratings are General or Sensitive.
This commit is contained in:
parent
b0deca7d6c
commit
293e3c5b81
1 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,8 @@ namespace Satori\Booru\Danbooru;
|
||||||
use Satori\Booru\IBooruPostWithSpecificTags;
|
use Satori\Booru\IBooruPostWithSpecificTags;
|
||||||
|
|
||||||
class DanbooruPost implements IBooruPostWithSpecificTags {
|
class DanbooruPost implements IBooruPostWithSpecificTags {
|
||||||
|
private const ALLOW_FILE_URL_RATING = ['g', 's'];
|
||||||
|
|
||||||
public function __construct(private array $info) {}
|
public function __construct(private array $info) {}
|
||||||
|
|
||||||
public function getId(): string {
|
public function getId(): string {
|
||||||
|
@ -23,7 +25,7 @@ class DanbooruPost implements IBooruPostWithSpecificTags {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasFileUrl(): bool {
|
public function hasFileUrl(): bool {
|
||||||
return array_key_exists('file_url', $this->info);
|
return array_key_exists('file_url', $this->info) && in_array($this->info['rating'], self::ALLOW_FILE_URL_RATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileUrl(): string {
|
public function getFileUrl(): string {
|
||||||
|
|
Reference in a new issue