forked from MarseyWorld/MarseyWorld
remove retarded bullshit I wasn't consulted about
parent
2937872035
commit
ad358650e1
1
env
1
env
|
@ -1,6 +1,5 @@
|
|||
export FLASK_APP="/rDrama/files/cli:app"
|
||||
export SITE="localhost"
|
||||
export SITE_HOSTS="localhost,127.0.0.1"
|
||||
export SITE_NAME="rDrama"
|
||||
export SECRET_KEY="blahblahblah"
|
||||
export DATABASE_URL="postgresql://postgres@localhost:5432"
|
||||
|
|
|
@ -25,8 +25,8 @@ app.jinja_env.add_extension('jinja2.ext.do')
|
|||
faulthandler.enable()
|
||||
|
||||
SITE = environ.get("SITE").strip()
|
||||
SITE_HOSTS = environ.get("SITE_HOSTS").split(',')
|
||||
|
||||
app.config['SERVER_NAME'] = SITE
|
||||
app.config['SECRET_KEY'] = environ.get('SECRET_KEY').strip()
|
||||
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 3153600
|
||||
app.config["SESSION_COOKIE_NAME"] = "session_" + environ.get("SITE_NAME").strip().lower()
|
||||
|
@ -75,9 +75,7 @@ if not path.isfile(f'/site_settings.json'):
|
|||
|
||||
@app.before_request
|
||||
def before_request():
|
||||
if SITE != 'localhost':
|
||||
app.config['SESSION_COOKIE_DOMAIN'] = f'.{request.host}'
|
||||
if request.host == 'marsey.world' and request.path != '/kofi':
|
||||
if SITE == 'marsey.world' and request.path != '/kofi':
|
||||
abort(404)
|
||||
|
||||
g.agent = request.headers.get("User-Agent")
|
||||
|
@ -90,7 +88,7 @@ def before_request():
|
|||
with open('/site_settings.json', 'r', encoding='utf_8') as f:
|
||||
app.config['SETTINGS'] = json.load(f)
|
||||
|
||||
if request.host not in SITE_HOSTS:
|
||||
if request.host != SITE:
|
||||
return {"error": "Unauthorized host provided"}, 403
|
||||
|
||||
if request.headers.get("CF-Worker"): return {"error": "Cloudflare workers are not allowed to access this website."}, 403
|
||||
|
|
|
@ -11,7 +11,6 @@ from files.helpers.const import *
|
|||
from files.helpers.regex import *
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.sorting_and_time import *
|
||||
from files.helpers.hosts import current_host
|
||||
from .flags import CommentFlag
|
||||
from .votes import CommentVote
|
||||
from .saves import CommentSaveRelationship
|
||||
|
@ -183,12 +182,12 @@ class Comment(Base):
|
|||
@property
|
||||
@lazy
|
||||
def permalink(self):
|
||||
return f"{current_host()}{self.shortlink}"
|
||||
return f"{SITE_FULL}{self.shortlink}"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def log_link(self):
|
||||
return f"{current_host()}/transfers/{self.id}"
|
||||
return f"{SITE_FULL}/transfers/{self.id}"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -10,7 +10,6 @@ from files.helpers.const import *
|
|||
from files.helpers.regex import *
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.sorting_and_time import make_age_string
|
||||
from files.helpers.hosts import current_host
|
||||
from .flags import Flag
|
||||
from .comment import Comment, normalize_urls_runtime
|
||||
from .saves import SaveRelationship
|
||||
|
@ -139,7 +138,7 @@ class Submission(Base):
|
|||
@property
|
||||
@lazy
|
||||
def permalink(self):
|
||||
return current_host() + self.shortlink
|
||||
return SITE_FULL + self.shortlink
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
@ -164,17 +163,16 @@ class Submission(Base):
|
|||
@property
|
||||
@lazy
|
||||
def thumb_url(self):
|
||||
host = current_host()
|
||||
if self.over_18: return f"{host}/assets/images/nsfw.webp?v=1"
|
||||
elif not self.url: return f"{host}/assets/images/{SITE_NAME}/default_text.webp?v=2"
|
||||
if self.over_18: return f"{SITE_FULL}/assets/images/nsfw.webp?v=1"
|
||||
elif not self.url: return f"{SITE_FULL}/assets/images/{SITE_NAME}/default_text.webp?v=2"
|
||||
elif self.thumburl:
|
||||
if self.thumburl.startswith('/'): return host + self.thumburl
|
||||
if self.thumburl.startswith('/'): return SITE_FULL + self.thumburl
|
||||
return self.thumburl
|
||||
elif self.is_youtube or self.is_video: return f"{host}/assets/images/default_thumb_video.webp?v=1"
|
||||
elif self.is_audio: return f"{host}/assets/images/default_thumb_audio.webp?v=1"
|
||||
elif self.is_youtube or self.is_video: return f"{SITE_FULL}/assets/images/default_thumb_video.webp?v=1"
|
||||
elif self.is_audio: return f"{SITE_FULL}/assets/images/default_thumb_audio.webp?v=1"
|
||||
elif self.domain.split('.')[0] == SITE.split('.')[0]:
|
||||
return f"{host}/assets/images/{SITE_NAME}/site_preview.webp?v=3009"
|
||||
else: return f"{host}/assets/images/default_thumb_link.webp?v=1"
|
||||
return f"{SITE_FULL}/assets/images/{SITE_NAME}/site_preview.webp?v=3009"
|
||||
else: return f"{SITE_FULL}/assets/images/default_thumb_link.webp?v=1"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
@ -254,7 +252,7 @@ class Submission(Base):
|
|||
|
||||
if not url: return ''
|
||||
|
||||
if url.startswith('/'): return current_host() + url
|
||||
if url.startswith('/'): return SITE_FULL + url
|
||||
|
||||
url = normalize_urls_runtime(url, v)
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ from .sub_join import *
|
|||
from .hats import *
|
||||
from files.__main__ import Base, cache
|
||||
from files.helpers.security import *
|
||||
from files.helpers.hosts import current_host
|
||||
from copy import deepcopy
|
||||
import random
|
||||
from os import remove, path
|
||||
|
@ -756,13 +755,12 @@ class User(Base):
|
|||
@property
|
||||
@lazy
|
||||
def profile_url(self):
|
||||
host = current_host()
|
||||
if self.agendaposter:
|
||||
return f"{host}/e/chudsey.webp"
|
||||
if self.rainbow:
|
||||
return f"{host}/e/marseysalutepride.webp"
|
||||
return f"{SITE_FULL}/e/marseysalutepride.webp"
|
||||
if self.profileurl:
|
||||
if self.profileurl.startswith('/'): return host + self.profileurl
|
||||
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
|
||||
return self.profileurl
|
||||
return f"{host}/assets/images/default-profile-pic.webp?v=1008"
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ from os import path
|
|||
|
||||
SITE = environ.get("SITE").strip()
|
||||
SITE_NAME = environ.get("SITE_NAME").strip()
|
||||
SITE_HOSTS = environ.get("SITE_HOSTS").strip().split(',')
|
||||
SECRET_KEY = environ.get("SECRET_KEY").strip()
|
||||
PROXY_URL = environ.get("PROXY_URL").strip()
|
||||
GIPHY_KEY = environ.get('GIPHY_KEY').strip()
|
||||
|
@ -41,7 +40,7 @@ MAILGUN_KEY = environ.get("MAILGUN_KEY").strip()
|
|||
DESCRIPTION = environ.get("DESCRIPTION").strip()
|
||||
CF_KEY = environ.get("CF_KEY").strip()
|
||||
CF_ZONE = environ.get("CF_ZONE").strip()
|
||||
TELEGRAM_LINK = environ.get("TELEGRAM_LINK", "blahblahblah").strip()
|
||||
TELEGRAM_LINK = environ.get("TELEGRAM_LINK").strip()
|
||||
|
||||
GLOBAL = environ.get("GLOBAL", "").strip()
|
||||
blackjack = environ.get("BLACKJACK", "").strip()
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
from .const import *
|
||||
|
||||
def current_host():
|
||||
if SITE == "localhost": prefix = "http://"
|
||||
else: prefix = "https://"
|
||||
|
||||
if request.host not in SITE_HOSTS: return SITE_FULL
|
||||
return prefix + request.host
|
|
@ -6,7 +6,6 @@ from .const import *
|
|||
import time
|
||||
from files.helpers.assetcache import assetcache_path
|
||||
from files.helpers.wrappers import calc_users
|
||||
from files.helpers.hosts import current_host
|
||||
|
||||
@app.template_filter("post_embed")
|
||||
def post_embed(id, v):
|
||||
|
@ -53,5 +52,4 @@ def inject_constants():
|
|||
"EMAIL_REGEX_PATTERN":EMAIL_REGEX_PATTERN,
|
||||
"CONTENT_SECURITY_POLICY_DEFAULT":CONTENT_SECURITY_POLICY_DEFAULT,
|
||||
"CONTENT_SECURITY_POLICY_HOME":CONTENT_SECURITY_POLICY_HOME,
|
||||
"current_host": current_host()
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ def auth_desired_with_logingate(f):
|
|||
if app.config['SETTINGS']['login_required'] and not v: abort(401)
|
||||
|
||||
#### WPD TEMP #### disable this /logged_out thing on .co
|
||||
if request.host == 'watchpeopledie.co':
|
||||
if SITE == 'watchpeopledie.co':
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
#### END WPD TEMP ####
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ def front_all(v, sub=None, subdomain=None):
|
|||
from files.helpers.security import generate_hash, validate_hash
|
||||
from datetime import datetime
|
||||
now = datetime.utcnow()
|
||||
if request.host == 'watchpeopledie.co':
|
||||
if SITE == 'watchpeopledie.co':
|
||||
if v and not v.admin_level and not v.id <= 9: # security: don't auto login admins or bots
|
||||
hash = generate_hash(f'{v.id}+{now.year}+{now.month}+{now.day}+{now.hour}+WPDusermigration')
|
||||
return redirect(f'https://watchpeopledie.tv/logged_out?user={v.id}&code={hash}', 301)
|
||||
else:
|
||||
return redirect('https://watchpeopledie.tv/logged_out', 301)
|
||||
elif request.host == 'watchpeopledie.tv' and not v: # security: don't try to login people into accounts more than once
|
||||
elif SITE == 'watchpeopledie.tv' and not v: # security: don't try to login people into accounts more than once
|
||||
req_user = request.values.get('user')
|
||||
req_code = request.values.get('code')
|
||||
if req_user and req_code:
|
||||
|
|
|
@ -5,7 +5,6 @@ from files.helpers.const import *
|
|||
from files.helpers.regex import *
|
||||
from files.helpers.actions import *
|
||||
from files.helpers.get import *
|
||||
from files.helpers.hosts import current_host
|
||||
import requests
|
||||
import secrets
|
||||
|
||||
|
@ -190,7 +189,7 @@ def sign_up_get(v):
|
|||
if not app.config['SETTINGS']['Signups']:
|
||||
return {"error": "New account registration is currently closed. Please come back later."}, 403
|
||||
|
||||
if v: return redirect(current_host())
|
||||
if v: return redirect(SITE_FULL)
|
||||
|
||||
ref = request.values.get("ref")
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ from files.helpers.slots import *
|
|||
from files.helpers.get import *
|
||||
from files.helpers.actions import *
|
||||
from files.helpers.sorting_and_time import *
|
||||
from files.helpers.hosts import current_host
|
||||
from files.classes import *
|
||||
from flask import *
|
||||
from io import BytesIO
|
||||
|
@ -537,7 +536,7 @@ def thumbnail_thread(pid):
|
|||
fetch_url = post.url
|
||||
|
||||
if fetch_url.startswith('/') and '\\' not in fetch_url:
|
||||
fetch_url = f"{SITE}{fetch_url}"
|
||||
fetch_url = f"{SITE_FULL}{fetch_url}"
|
||||
|
||||
headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ from files.helpers.sanitize import *
|
|||
from files.helpers.const import *
|
||||
from files.helpers.sorting_and_time import *
|
||||
from files.helpers.actions import *
|
||||
from files.helpers.hosts import current_host
|
||||
from files.mail import *
|
||||
from flask import *
|
||||
from files.__main__ import app, limiter, db_session
|
||||
|
@ -759,7 +758,7 @@ def u_username(username, v=None):
|
|||
|
||||
|
||||
if username != u.username:
|
||||
return redirect(current_host() + request.full_path.replace(username, u.username))
|
||||
return redirect(SITE_FULL + request.full_path.replace(username, u.username))
|
||||
|
||||
if v and v.id not in (u.id, DAD_ID) and u.viewers_recorded:
|
||||
g.db.flush()
|
||||
|
|
Loading…
Reference in New Issue