add SITE_FULL_IMAGES const
parent
0e4f886d92
commit
0b0ad438a8
|
@ -113,7 +113,7 @@ def execute_snappy(post:Submission, v:User):
|
|||
|
||||
body += "\n\n"
|
||||
|
||||
if post.url and not post.url.startswith('/') and not post.url.startswith(SITE_FULL) and not post.url.startswith(BAN_EVASION_FULL):
|
||||
if post.url and not post.url.startswith('/') and not post.url.startswith(SITE_FULL) and not post.url.startswith(SITE_FULL_IMAGES) and not post.url.startswith(BAN_EVASION_FULL):
|
||||
if post.url.startswith('https://old.reddit.com/r/'):
|
||||
rev = post.url.replace('https://old.reddit.com/', '')
|
||||
rev = f"* [unddit.com](https://unddit.com/{rev})\n\n"
|
||||
|
@ -142,7 +142,7 @@ def execute_snappy(post:Submission, v:User):
|
|||
|
||||
|
||||
for href, title in captured:
|
||||
if href.startswith(SITE_FULL) or href.startswith(BAN_EVASION_FULL): continue
|
||||
if href.startswith(SITE_FULL) or href.startswith(SITE_FULL_IMAGES) or href.startswith(BAN_EVASION_FULL): continue
|
||||
if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n"
|
||||
if f'**[{title}]({href})**:\n\n' not in body:
|
||||
addition = f'**[{title}]({href})**:\n\n'
|
||||
|
|
|
@ -64,8 +64,12 @@ PUSH_NOTIF_LIMIT = 1000
|
|||
|
||||
IS_LOCALHOST = SITE == "localhost" or SITE == "127.0.0.1" or SITE.startswith("192.168.") or SITE.endswith(".local")
|
||||
|
||||
if IS_LOCALHOST: SITE_FULL = 'http://' + SITE
|
||||
else: SITE_FULL = 'https://' + SITE
|
||||
if IS_LOCALHOST:
|
||||
SITE_FULL = 'http://' + SITE
|
||||
SITE_FULL_IMAGES = SITE_FULL
|
||||
else:
|
||||
SITE_FULL = 'https://' + SITE
|
||||
SITE_FULL_IMAGES = 'https://i.' + SITE
|
||||
|
||||
LOGGED_IN_CACHE_KEY = f"{SITE}_loggedin"
|
||||
LOGGED_OUT_CACHE_KEY = f"{SITE}_loggedout"
|
||||
|
|
|
@ -21,8 +21,7 @@ from files.helpers.settings import get_setting
|
|||
from .config.const import *
|
||||
|
||||
def remove_media_using_link(path):
|
||||
img_prefix = f'https://i.{SITE}'
|
||||
if path.startswith(img_prefix):
|
||||
if path.startswith(SITE_FULL_IMAGES):
|
||||
path = path.split(img_prefix, 1)[1]
|
||||
|
||||
video_prefix = f'https://videos.{SITE}'
|
||||
|
@ -269,8 +268,7 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in
|
|||
)
|
||||
db.add(media)
|
||||
|
||||
if IS_LOCALHOST: return f'{SITE_FULL}{filename}'
|
||||
return f'https://i.{SITE}{filename}'
|
||||
return f'{SITE_FULL_IMAGES}{filename}'
|
||||
|
||||
|
||||
def process_dm_images(v, user, body):
|
||||
|
|
Loading…
Reference in New Issue