Change force_img_referer to force_img_self_referer_regexp See #940 #941

This commit is contained in:
Jim Miller 2023-04-27 13:37:13 -05:00
parent 98f95a7da8
commit f6dafecfa1
4 changed files with 14 additions and 12 deletions

View file

@ -1265,11 +1265,11 @@ remove_transparency: true
## kept.)
#dedup_img_files:false
## If set true, FFF will use the img tag's own src URL as the HTTP
## Referer instead of the page URL. This is useful for some image
## hosting sites that watermark or return HTML instead of image data
## without it.
#force_img_self_referer:false
## If set, and the img tag's URL matches the regular expression, FFF
## will use the img tag's own src URL as the HTTP Referer instead of
## the page URL. This is useful for some image hosting sites that
## watermark or return HTML instead of image data without it.
#force_img_self_referer_regexp:gelbooru.com|photobucket.com
## if the <img> tag doesn't have a div or a p around it, nook gets
## confused and displays it on every page after that under the text

View file

@ -375,7 +375,7 @@ def get_valid_keywords():
'dateUpdated_format',
'default_cover_image',
'force_cover_image',
'force_img_referer',
'force_img_self_referer_regexp',
'description_limit',
'do_update_hook',
'use_archived_author',

View file

@ -1264,11 +1264,11 @@ remove_transparency: true
## kept.)
#dedup_img_files:false
## If set true, FFF will use the img tag's own src URL as the HTTP
## Referer instead of the page URL. This is useful for some image
## hosting sites that watermark or return HTML instead of image data
## without it.
#force_img_self_referer:false
## If set, and the img tag's URL matches the regular expression, FFF
## will use the img tag's own src URL as the HTTP Referer instead of
## the page URL. This is useful for some image hosting sites that
## watermark or return HTML instead of image data without it.
#force_img_self_referer_regexp:gelbooru.com|photobucket.com
## if the <img> tag doesn't have a div or a p around it, nook gets
## confused and displays it on every page after that under the text

View file

@ -1548,7 +1548,9 @@ class Story(Requestable):
# and authors who link images that watermark or
# don't work anymore.
refererurl = parenturl
if self.getConfig("force_img_self_referer"):
if( self.getConfig("force_img_self_referer_regexp") and
re.search(self.getConfig("force_img_self_referer_regexp"),
url) ):
refererurl = url
logger.debug("Use Referer:%s"%refererurl)
imgdata = fetch(imgurl,referer=refererurl)