vc
This commit is contained in:
parent
c3f9b38182
commit
a795bd39e9
10 changed files with 33 additions and 33 deletions
|
@ -624,7 +624,7 @@ def admin_link_accounts(v):
|
|||
g.db.add(new_alt)
|
||||
|
||||
g.db.commit()
|
||||
return redirect(f"/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}")
|
||||
return redirect(f"{SITE_FULL}/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}")
|
||||
|
||||
|
||||
@app.get("/admin/removed/posts")
|
||||
|
@ -1247,7 +1247,7 @@ def admin_toggle_ban_domain(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect("/admin/banned_domains/")
|
||||
return redirect(f"{SITE_FULL}/admin/banned_domains/")
|
||||
|
||||
|
||||
@app.post("/admin/nuke_user")
|
||||
|
|
|
@ -385,7 +385,7 @@ def award_post(pid, v):
|
|||
if request.referrer and len(request.referrer) > 1:
|
||||
if request.referrer == f'{SITE_FULL}/submit': return redirect(post.permalink)
|
||||
elif request.host in request.referrer: return redirect(request.referrer)
|
||||
return redirect("/")
|
||||
return redirect(f"{SITE_FULL}/")
|
||||
|
||||
|
||||
@app.get("/comment/<cid>/awards")
|
||||
|
@ -588,7 +588,7 @@ def award_comment(cid, v):
|
|||
g.db.commit()
|
||||
if request.referrer and len(request.referrer) > 1 and request.host in request.referrer:
|
||||
return redirect(request.referrer)
|
||||
return redirect("/")
|
||||
return redirect(f"{SITE_FULL}/")
|
||||
|
||||
@app.get("/admin/awards")
|
||||
@admin_level_required(2)
|
||||
|
|
|
@ -18,7 +18,7 @@ def error_401(e):
|
|||
path = request.path
|
||||
qs = urlencode(dict(request.values))
|
||||
argval = quote(f"{path}?{qs}", safe='')
|
||||
return redirect(f"/login?redirect={argval}")
|
||||
return redirect(f"{SITE_FULL}/login?redirect={argval}")
|
||||
|
||||
|
||||
@app.errorhandler(403)
|
||||
|
@ -62,4 +62,4 @@ def allow_nsfw():
|
|||
session["over_18"] = int(time.time()) + 3600
|
||||
redir = request.values.get("redir")
|
||||
if redir and redir.startswith(SITE_FULL) or redir.startswith('/'): return redirect(redir)
|
||||
return redirect('/')
|
||||
return redirect(f'{SITE_FULL}/')
|
|
@ -402,7 +402,7 @@ def random_post(v):
|
|||
n = random.randint(1, total - 2)
|
||||
|
||||
post = x.offset(n).limit(1).one_or_none()
|
||||
return redirect(f"/post/{post.id}")
|
||||
return redirect(f"{SITE_FULL}/post/{post.id}")
|
||||
|
||||
@cache.memoize(timeout=86400)
|
||||
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"):
|
||||
|
|
|
@ -111,13 +111,13 @@ def login_post():
|
|||
now = int(time.time())
|
||||
|
||||
if now - int(request.values.get("time")) > 600:
|
||||
return redirect('/login')
|
||||
return redirect(f'{SITE_FULL}/login')
|
||||
|
||||
formhash = request.values.get("hash")
|
||||
if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge",
|
||||
formhash
|
||||
):
|
||||
return redirect("/login")
|
||||
return redirect(f"{SITE_FULL}/login")
|
||||
|
||||
if not account.validate_2fa(request.values.get("2fa_token", "").strip()):
|
||||
hash = generate_hash(f"{account.id}+{time}+2fachallenge")
|
||||
|
@ -173,7 +173,7 @@ def sign_up_get(v):
|
|||
with open('disable_signups', 'r') as f:
|
||||
if f.read() == "yes": return {"error": "New account registration is currently closed. Please come back later."}, 403
|
||||
|
||||
if v: return redirect("/")
|
||||
if v: return redirect(f"{SITE_FULL}/")
|
||||
|
||||
agent = request.headers.get("User-Agent", None)
|
||||
if not agent: abort(403)
|
||||
|
@ -248,7 +248,7 @@ def sign_up_post(v):
|
|||
if user:
|
||||
args["ref"] = user.username
|
||||
|
||||
return redirect(f"/signup?{urlencode(args)}")
|
||||
return redirect(f"{SITE_FULL}/signup?{urlencode(args)}")
|
||||
|
||||
if now - int(form_timestamp) < 5:
|
||||
return new_signup("There was a problem. Please try again.")
|
||||
|
@ -344,7 +344,7 @@ def sign_up_post(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect("/")
|
||||
return redirect(f"{SITE_FULL}/")
|
||||
|
||||
|
||||
@app.get("/forgot")
|
||||
|
@ -417,7 +417,7 @@ def get_reset():
|
|||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
@auth_desired
|
||||
def post_reset(v):
|
||||
if v: return redirect('/')
|
||||
if v: return redirect(f'{SITE_FULL}/')
|
||||
|
||||
user_id = request.values.get("user_id")
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ def request_api_keys(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect('/settings/apps')
|
||||
return redirect(f'{SITE_FULL}/settings/apps')
|
||||
|
||||
|
||||
@app.post("/delete_app/<aid>")
|
||||
|
@ -88,7 +88,7 @@ def delete_oauth_app(v, aid):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect('/apps')
|
||||
return redirect(f'{SITE_FULL}/apps')
|
||||
|
||||
|
||||
@app.post("/edit_app/<aid>")
|
||||
|
@ -109,7 +109,7 @@ def edit_oauth_app(v, aid):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect('/settings/apps')
|
||||
return redirect(f'{SITE_FULL}/settings/apps')
|
||||
|
||||
|
||||
@app.post("/admin/app/approve/<aid>")
|
||||
|
|
|
@ -827,7 +827,7 @@ def submit_post(v):
|
|||
_note="spam"
|
||||
)
|
||||
g.db.add(ma)
|
||||
return redirect("/notifications")
|
||||
return redirect(f"{SITE_FULL}/notifications")
|
||||
|
||||
if len(str(body)) > 20000:
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ def namecolor(v):
|
|||
v.namecolor = color
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.post("/settings/themecolor")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -426,7 +426,7 @@ def themecolor(v):
|
|||
v.themecolor = themecolor
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.post("/settings/gumroad")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -491,7 +491,7 @@ def titlecolor(v):
|
|||
v.titlecolor = titlecolor
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.post("/settings/verifiedcolor")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -503,7 +503,7 @@ def verifiedcolor(v):
|
|||
v.verifiedcolor = verifiedcolor
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.post("/settings/security")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -808,7 +808,7 @@ def settings_remove_discord(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.get("/settings/content")
|
||||
@auth_required
|
||||
|
@ -858,7 +858,7 @@ def settings_name_change(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.post("/settings/song_change")
|
||||
@limiter.limit("1/second;5/day")
|
||||
|
@ -872,7 +872,7 @@ def settings_song_change(v):
|
|||
v.song = None
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
song = song.replace("https://music.youtube.com", "https://youtube.com")
|
||||
if song.startswith(("https://www.youtube.com/watch?v=", "https://youtube.com/watch?v=", "https://m.youtube.com/watch?v=")):
|
||||
|
@ -889,7 +889,7 @@ def settings_song_change(v):
|
|||
v.song = id
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
|
||||
req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json()
|
||||
|
@ -937,7 +937,7 @@ def settings_song_change(v):
|
|||
|
||||
g.db.commit()
|
||||
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
@app.post("/settings/title_change")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
@ -958,4 +958,4 @@ def settings_title_change(v):
|
|||
g.db.add(v)
|
||||
g.db.commit()
|
||||
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
|
|
@ -302,7 +302,7 @@ def submit_contact(v):
|
|||
@app.get('/archives')
|
||||
@cache.memoize(timeout=86400)
|
||||
def archivesindex():
|
||||
return redirect("/archives/index.html")
|
||||
return redirect(f"{SITE_FULL}/archives/index.html")
|
||||
|
||||
@app.get('/archives/<path:path>')
|
||||
@cache.memoize(timeout=86400)
|
||||
|
@ -351,7 +351,7 @@ def robots_txt():
|
|||
@app.get("/settings")
|
||||
@auth_required
|
||||
def settings(v):
|
||||
return redirect("/settings/profile")
|
||||
return redirect(f"{SITE_FULL}/settings/profile")
|
||||
|
||||
|
||||
@app.get("/settings/profile")
|
||||
|
|
|
@ -382,7 +382,7 @@ def get_profilecss(v, username):
|
|||
@app.get("/@<username>/song")
|
||||
def usersong(username):
|
||||
user = get_user(username)
|
||||
if user.song: return redirect(f"/static/song/{user.song}.mp3")
|
||||
if user.song: return redirect(f"{SITE_FULL}/static/song/{user.song}.mp3")
|
||||
else: abort(404)
|
||||
|
||||
@app.get("/song/<song>")
|
||||
|
@ -416,7 +416,7 @@ def unsubscribe(v, post_id):
|
|||
@app.get("/report_bugs")
|
||||
@auth_required
|
||||
def reportbugs(v):
|
||||
return redirect(f'/post/{BUG_THREAD}')
|
||||
return redirect(f'{SITE_FULL}/post/{BUG_THREAD}')
|
||||
|
||||
@app.post("/@<username>/message")
|
||||
@limiter.limit("1/second;2/minute;10/hour;50/day")
|
||||
|
@ -617,7 +617,7 @@ def user_id(id, v):
|
|||
@app.get("/u/<username>")
|
||||
@auth_required
|
||||
def redditor_moment_redirect(username, v):
|
||||
return redirect(f"/@{username}")
|
||||
return redirect(f"{SITE_FULL}/@{username}")
|
||||
|
||||
@app.get("/@<username>/followers")
|
||||
@auth_required
|
||||
|
@ -760,7 +760,7 @@ def u_username_comments(username, v=None):
|
|||
|
||||
user = get_user(username, v=v)
|
||||
|
||||
if username != user.username: return redirect(f'/@{user.username}/comments')
|
||||
if username != user.username: return redirect(f'{SITE_FULL}/@{user.username}/comments')
|
||||
|
||||
u = user
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue