forked from MarseyWorld/MarseyWorld
add SITE_FULL_VIDEOS in preparation for next commit
parent
e5ae5c80b2
commit
9d50b43e8a
|
@ -203,7 +203,7 @@ def execute_snappy(post, v):
|
||||||
|
|
||||||
captured2 = []
|
captured2 = []
|
||||||
for href, title in captured:
|
for href, title in captured:
|
||||||
if not (href.startswith('/') or href.startswith(f'{SITE_FULL}/') or href.startswith(f'{SITE_FULL_IMAGES}/') or href.startswith('https://videos.watchpeopledie.tv/')):
|
if not any((href.startswith(x) for x in ('/', f'{SITE_FULL}/', f'{SITE_FULL_IMAGES}/', f'{SITE_FULL_VIDEOS}/'))):
|
||||||
captured2.append((href, title))
|
captured2.append((href, title))
|
||||||
|
|
||||||
if captured2:
|
if captured2:
|
||||||
|
|
|
@ -61,22 +61,27 @@ PUSH_NOTIF_LIMIT = 1000
|
||||||
|
|
||||||
IS_LOCALHOST = SITE == "localhost" or SITE == "127.0.0.1" or SITE.startswith("192.168.") or SITE.endswith(".local")
|
IS_LOCALHOST = SITE == "localhost" or SITE == "127.0.0.1" or SITE.startswith("192.168.") or SITE.endswith(".local")
|
||||||
|
|
||||||
if IS_LOCALHOST:
|
if SITE in {'rdrama.net', 'watchpeopledie.tv'}:
|
||||||
SITE_FULL = 'http://' + SITE
|
|
||||||
SITE_IMAGES = SITE
|
|
||||||
SITE_FULL_IMAGES = f'http://{SITE_IMAGES}'
|
|
||||||
elif SITE in {'rdrama.net', 'watchpeopledie.tv'}:
|
|
||||||
SITE_FULL = 'https://' + SITE
|
|
||||||
SITE_IMAGES = 'i.' + SITE
|
SITE_IMAGES = 'i.' + SITE
|
||||||
SITE_FULL_IMAGES = f'https://{SITE_IMAGES}'
|
elif SITE == 'staging.rdrama.net':
|
||||||
else:
|
|
||||||
SITE_FULL = 'https://' + SITE
|
|
||||||
SITE_IMAGES = SITE
|
|
||||||
SITE_FULL_IMAGES = SITE_FULL
|
|
||||||
|
|
||||||
if SITE == 'staging.rdrama.net':
|
|
||||||
SITE_IMAGES = 'i.rdrama.net'
|
SITE_IMAGES = 'i.rdrama.net'
|
||||||
|
else:
|
||||||
|
SITE_IMAGES = SITE
|
||||||
|
|
||||||
|
if SITE == 'watchpeopledie.tv':
|
||||||
|
SITE_VIDEOS = 'videos.watchpeopledie.tv'
|
||||||
|
else:
|
||||||
|
SITE_VIDEOS = f'{SITE}/videos'
|
||||||
|
|
||||||
|
if IS_LOCALHOST:
|
||||||
|
SITE_FULL = f'http://{SITE}'
|
||||||
|
SITE_FULL_IMAGES = f'http://{SITE_IMAGES}'
|
||||||
|
SITE_FULL_VIDEOS = f'http://{SITE_VIDEOS}'
|
||||||
|
else:
|
||||||
|
SITE_FULL = f'https://{SITE}'
|
||||||
SITE_FULL_IMAGES = f'https://{SITE_IMAGES}'
|
SITE_FULL_IMAGES = f'https://{SITE_IMAGES}'
|
||||||
|
SITE_FULL_VIDEOS = f'https://{SITE_VIDEOS}'
|
||||||
|
|
||||||
|
|
||||||
if SITE == 'rdrama.net':
|
if SITE == 'rdrama.net':
|
||||||
OTHER_SITE_NAME = 'WPD'
|
OTHER_SITE_NAME = 'WPD'
|
||||||
|
@ -884,8 +889,10 @@ approved_embed_hosts = [
|
||||||
### First-Party
|
### First-Party
|
||||||
'rdrama.net',
|
'rdrama.net',
|
||||||
'i.rdrama.net',
|
'i.rdrama.net',
|
||||||
'staging.rdrama.net',
|
'watchpeopledie.tv',
|
||||||
|
'i.watchpeopledie.tv',
|
||||||
'videos.watchpeopledie.tv',
|
'videos.watchpeopledie.tv',
|
||||||
|
'staging.rdrama.net',
|
||||||
|
|
||||||
### Third-Party Image Hosts
|
### Third-Party Image Hosts
|
||||||
'i.imgur.com',
|
'i.imgur.com',
|
||||||
|
@ -930,11 +937,9 @@ approved_embed_hosts = [
|
||||||
'i.ytimg.com/vi',
|
'i.ytimg.com/vi',
|
||||||
]
|
]
|
||||||
|
|
||||||
if SITE_IMAGES not in approved_embed_hosts:
|
for i in (SITE_VIDEOS, SITE_IMAGES, SITE):
|
||||||
approved_embed_hosts = [SITE_IMAGES] + approved_embed_hosts
|
if i not in approved_embed_hosts:
|
||||||
|
approved_embed_hosts = [i] + approved_embed_hosts
|
||||||
if SITE not in approved_embed_hosts:
|
|
||||||
approved_embed_hosts = [SITE] + approved_embed_hosts
|
|
||||||
|
|
||||||
def is_site_url(url):
|
def is_site_url(url):
|
||||||
return (url
|
return (url
|
||||||
|
|
|
@ -153,10 +153,8 @@ def reencode_video(old, new, check_sizes=False):
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv':
|
if SITE == 'watchpeopledie.tv':
|
||||||
rclone_copy(new)
|
rclone_copy(new)
|
||||||
url = f'https://videos.{SITE}' + new.split('/videos')[1]
|
|
||||||
else:
|
|
||||||
url = f"{SITE_FULL}{new}"
|
|
||||||
|
|
||||||
|
url = SITE_FULL_VIDEOS + new.split('/videos')[1]
|
||||||
purge_files_in_cloudflare_cache(url)
|
purge_files_in_cloudflare_cache(url)
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,20 +209,20 @@ def process_video(file, v):
|
||||||
)
|
)
|
||||||
g.db.add(media)
|
g.db.add(media)
|
||||||
|
|
||||||
|
url = SITE_FULL_VIDEOS + new.split('/videos')[1]
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv' and v and v.username.lower().startswith("icosaka"):
|
if SITE == 'watchpeopledie.tv' and v and v.username.lower().startswith("icosaka"):
|
||||||
gevent.spawn(delete_file, new, f'https://videos.{SITE}' + new.split('/videos')[1])
|
gevent.spawn(delete_file, new, url)
|
||||||
return f'https://videos.{SITE}' + new.split('/videos')[1], None, None
|
return url, None, None
|
||||||
|
|
||||||
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
||||||
ffmpeg.input(new).output(name, loglevel="quiet", map_metadata=-1, **{"vf":"scale='iw':-2", 'q:v':3, 'frames:v':1}).run()
|
ffmpeg.input(new).output(name, loglevel="quiet", map_metadata=-1, **{"vf":"scale='iw':-2", 'q:v':3, 'frames:v':1}).run()
|
||||||
posterurl = SITE_FULL_IMAGES + name
|
posterurl = SITE_FULL_IMAGES + name
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv':
|
if SITE == 'watchpeopledie.tv' and not is_reencoding:
|
||||||
if not is_reencoding:
|
gevent.spawn(rclone_copy, new)
|
||||||
gevent.spawn(rclone_copy, new)
|
|
||||||
return f'https://videos.{SITE}' + new.split('/videos')[1], posterurl, name
|
return url, posterurl, name
|
||||||
else:
|
|
||||||
return f"{SITE_FULL}{new}", posterurl, name
|
|
||||||
|
|
||||||
def process_image(filename, v, resize=0, trim=False, uploader_id=None):
|
def process_image(filename, v, resize=0, trim=False, uploader_id=None):
|
||||||
# thumbnails are processed in a thread and not in the request context
|
# thumbnails are processed in a thread and not in the request context
|
||||||
|
|
|
@ -1888,8 +1888,8 @@ def delete_media_post(v):
|
||||||
|
|
||||||
purge_files_in_cloudflare_cache(url)
|
purge_files_in_cloudflare_cache(url)
|
||||||
|
|
||||||
if url.startswith('https://videos.watchpeopledie.tv/'):
|
if SITE == 'watchpeopledie.tv' and url.startswith(SITE_FULL_VIDEOS):
|
||||||
filename = url.split('https://videos.watchpeopledie.tv/')[1]
|
filename = url.split(SITE_FULL_VIDEOS)[1]
|
||||||
gevent.spawn(rclone.delete, f'no:/videos/{filename}')
|
gevent.spawn(rclone.delete, f'no:/videos/{filename}')
|
||||||
|
|
||||||
return {"message": "Media deleted successfully!"}
|
return {"message": "Media deleted successfully!"}
|
||||||
|
|
Loading…
Reference in New Issue