Only include raw file url for Danbooru posts if the ratings are General or Sensitive.

This commit is contained in:
flash 2024-03-05 00:04:20 +00:00
parent b0deca7d6c
commit 293e3c5b81

View file

@ -4,6 +4,8 @@ namespace Satori\Booru\Danbooru;
use Satori\Booru\IBooruPostWithSpecificTags;
class DanbooruPost implements IBooruPostWithSpecificTags {
private const ALLOW_FILE_URL_RATING = ['g', 's'];
public function __construct(private array $info) {}
public function getId(): string {
@ -23,7 +25,7 @@ class DanbooruPost implements IBooruPostWithSpecificTags {
}
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 {