forked from MarseyWorld/MarseyWorld
testing
parent
7275a0b8c4
commit
1e22d766f9
|
@ -17,6 +17,7 @@ import redis
|
|||
import time
|
||||
from sys import stdout
|
||||
import faulthandler
|
||||
import atexit
|
||||
|
||||
app = Flask(__name__, template_folder='templates')
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
|
||||
|
@ -84,6 +85,8 @@ mail = Mail(app)
|
|||
@app.before_request
|
||||
def before_request():
|
||||
|
||||
print(request.access_route[0])
|
||||
print(request.remote_addr)
|
||||
if request.method.lower() != "get" and app.config["READ_ONLY"]:
|
||||
return {"error":f"{app.config['SITE_NAME']} is currently in read-only mode."}, 500
|
||||
|
||||
|
@ -109,4 +112,13 @@ def after_request(response):
|
|||
response.headers.add("X-Frame-Options", "deny")
|
||||
return response
|
||||
|
||||
from files.routes import *
|
||||
from files.routes import *
|
||||
|
||||
def close_running_threads():
|
||||
with open("marsey_count.json", 'r') as f: marsey_file = loads(f.read())
|
||||
print(marsey_count['marseylove'])
|
||||
if marsey_file != marsey_count:
|
||||
with open('marsey_count.json', 'w') as f: dump(marsey_count, f)
|
||||
print("Marsey count saved!")
|
||||
stdout.flush()
|
||||
atexit.register(close_running_threads)
|
||||
|
|
|
@ -797,3 +797,10 @@ NOTIFIED_USERS = {
|
|||
|
||||
num_banners = len(listdir('files/assets/images/Drama/banners')) + 1
|
||||
num_sidebar = len(listdir('files/assets/images/Drama/sidebar')) + 1
|
||||
|
||||
|
||||
with open("marsey_count.json", 'r') as f: marsey_count = loads(f.read())
|
||||
marsey_counted = []
|
||||
for k, val in marseys.items():
|
||||
marsey_counted.append((k, val, marsey_count[k]))
|
||||
marsey_counted = sorted(marsey_counted, key=lambda x: x[2], reverse=True)
|
|
@ -178,7 +178,6 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
sanitized = re.sub('\|\|(.*?)\|\|', r'<span class="spoiler">\1</span>', sanitized)
|
||||
|
||||
if comment:
|
||||
with open("marsey_count.json", 'r') as f: marsey_count = loads(f.read())
|
||||
marseys_used = set()
|
||||
|
||||
for i in re.finditer("[^a]>\s*(:[!#]{0,2}\w+:\s*)+<\/", sanitized):
|
||||
|
@ -260,7 +259,6 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
if comment:
|
||||
for emoji in marseys_used:
|
||||
if emoji in marsey_count: marsey_count[emoji] += 1
|
||||
with open('marsey_count.json', 'w') as f: dump(marsey_count, f)
|
||||
|
||||
return sanitized
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ def api_comment(v):
|
|||
'body': notifbody,
|
||||
},
|
||||
'data': {
|
||||
'url': f'comment/{c.id}?context=9&read=true#context',
|
||||
'url': f'/comment/{c.id}?context=9&read=true#context',
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -17,12 +17,6 @@ def privacy(v):
|
|||
@app.get("/marseys")
|
||||
@auth_required
|
||||
def emojis(v):
|
||||
with open("marsey_count.json", 'r') as file:
|
||||
marsey_count = loads(file.read())
|
||||
marsey_counted = []
|
||||
for k, val in marseys.items():
|
||||
marsey_counted.append((k, val, marsey_count[k]))
|
||||
marsey_counted = sorted(marsey_counted, key=lambda x: x[2], reverse=True)
|
||||
return render_template("marseys.html", v=v, marseys=marsey_counted)
|
||||
|
||||
@app.get("/terms")
|
||||
|
|
|
@ -503,7 +503,7 @@ def message2(v, username):
|
|||
'body': notifbody,
|
||||
},
|
||||
'data': {
|
||||
'url': 'notifications?messages=true',
|
||||
'url': '/notifications?messages=true',
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -570,7 +570,7 @@ def messagereply(v):
|
|||
'body': notifbody,
|
||||
},
|
||||
'data': {
|
||||
'url': 'notifications?messages=true',
|
||||
'url': '/notifications?messages=true',
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ bleach
|
|||
Flask
|
||||
Flask-Caching
|
||||
Flask-Compress
|
||||
Flask-Limiter==1.1.0
|
||||
Flask-Limiter
|
||||
Flask-Mail
|
||||
gevent
|
||||
greenlet
|
||||
|
|
Loading…
Reference in New Issue