dffd
parent
2747d41c5a
commit
f73362cab2
|
@ -1,3 +1,2 @@
|
|||
github: Aevann1
|
||||
patreon: Aevann
|
||||
custom: ["https://rdrama.gumroad.com/l/tfcvri"]
|
||||
|
|
|
@ -384,20 +384,19 @@ def api_comment(v):
|
|||
)
|
||||
g.db.add(c)
|
||||
g.db.flush()
|
||||
if v.dramacoins >= 0:
|
||||
if request.files.get("file"):
|
||||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'):
|
||||
return jsonify({"error": "That wasn't an image!"}), 400
|
||||
|
||||
name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}'
|
||||
url = upload_file(name, file)
|
||||
|
||||
body = request.form.get("body") + f"\n![]({url})"
|
||||
body = body.replace("\n", "\n\n")
|
||||
with CustomRenderer(post_id=parent_id) as renderer:
|
||||
body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
if request.files.get("file"):
|
||||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'):
|
||||
return jsonify({"error": "That wasn't an image!"}), 400
|
||||
|
||||
name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}'
|
||||
url = upload_file(name, file)
|
||||
|
||||
body = request.form.get("body") + f"\n![]({url})"
|
||||
body = body.replace("\n", "\n\n")
|
||||
with CustomRenderer(post_id=parent_id) as renderer:
|
||||
body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
|
||||
c_aux = CommentAux(
|
||||
id=c.id,
|
||||
|
@ -738,35 +737,34 @@ def edit_comment(cid, v):
|
|||
g.db.commit()
|
||||
return jsonify({"error": "Too much spam!"}), 403
|
||||
|
||||
if v.dramacoins >= 0:
|
||||
if request.files.get("file"):
|
||||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'):
|
||||
return jsonify({"error": "That wasn't an image!"}), 400
|
||||
|
||||
name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}'
|
||||
url = upload_file(name, file)
|
||||
if request.files.get("file"):
|
||||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'):
|
||||
return jsonify({"error": "That wasn't an image!"}), 400
|
||||
|
||||
name = f'comment/{c.base36id}/{secrets.token_urlsafe(8)}'
|
||||
url = upload_file(name, file)
|
||||
|
||||
body += f"\n![]({url})"
|
||||
body = body.replace("\n", "\n\n")
|
||||
with CustomRenderer(post_id=c.parent_submission) as renderer:
|
||||
body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
body += f"\n![]({url})"
|
||||
body = body.replace("\n", "\n\n")
|
||||
with CustomRenderer(post_id=c.parent_submission) as renderer:
|
||||
body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
|
||||
# #csam detection
|
||||
# def del_function():
|
||||
# delete_file(name)
|
||||
# c.is_banned=True
|
||||
# g.db.add(c)
|
||||
# g.db.commit()
|
||||
|
||||
# #csam detection
|
||||
# def del_function():
|
||||
# delete_file(name)
|
||||
# c.is_banned=True
|
||||
# g.db.add(c)
|
||||
# g.db.commit()
|
||||
|
||||
# csam_thread=threading.Thread(target=check_csam_url,
|
||||
# args=(f"https://s3.eu-central-1.amazonaws.com/i.ruqqus.ga/{name}",
|
||||
# v,
|
||||
# del_function
|
||||
# )
|
||||
# )
|
||||
# csam_thread.start()
|
||||
# csam_thread=threading.Thread(target=check_csam_url,
|
||||
# args=(f"https://s3.eu-central-1.amazonaws.com/i.ruqqus.ga/{name}",
|
||||
# v,
|
||||
# del_function
|
||||
# )
|
||||
# )
|
||||
# csam_thread.start()
|
||||
|
||||
c.body = body
|
||||
c.body_html = body_html
|
||||
|
|
|
@ -867,10 +867,6 @@ def submit_post(v):
|
|||
# check for embeddable video
|
||||
domain = parsed_url.netloc
|
||||
|
||||
if request.files.get('file') and not v.dramacoins >= 0:
|
||||
abort(403)
|
||||
|
||||
|
||||
new_post = Submission(
|
||||
private=bool(request.form.get("private","")),
|
||||
author_id=v.id,
|
||||
|
|
|
@ -324,45 +324,37 @@ def settings_log_out_others(v):
|
|||
@auth_required
|
||||
@validate_formkey
|
||||
def settings_images_profile(v):
|
||||
if v.dramacoins >= 0:
|
||||
|
||||
if request.content_length > 16 * 1024 * 1024:
|
||||
g.db.rollback()
|
||||
abort(413)
|
||||
if request.content_length > 16 * 1024 * 1024:
|
||||
g.db.rollback()
|
||||
abort(413)
|
||||
|
||||
v.profileurl = None
|
||||
imageurl = upload_file(name=f"profile.gif", file=request.files["profile"], resize=(100, 100))
|
||||
if imageurl:
|
||||
v.profileurl = imageurl
|
||||
g.db.add(v)
|
||||
v.profileurl = None
|
||||
imageurl = upload_file(name=f"profile.gif", file=request.files["profile"], resize=(100, 100))
|
||||
if imageurl:
|
||||
v.profileurl = imageurl
|
||||
g.db.add(v)
|
||||
|
||||
return render_template("settings_profile.html",
|
||||
v=v, msg="Profile picture successfully updated.")
|
||||
|
||||
return render_template("settings_profile.html", v=v,
|
||||
msg="Avatars require +0 dramacoins.")
|
||||
return render_template("settings_profile.html",
|
||||
v=v, msg="Profile picture successfully updated.")
|
||||
|
||||
|
||||
@app.route("/settings/images/banner", methods=["POST"])
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def settings_images_banner(v):
|
||||
if v.dramacoins >= 0:
|
||||
if request.content_length > 16 * 1024 * 1024:
|
||||
g.db.rollback()
|
||||
abort(413)
|
||||
if request.content_length > 16 * 1024 * 1024:
|
||||
g.db.rollback()
|
||||
abort(413)
|
||||
|
||||
v.bannerurl = None
|
||||
imageurl = upload_file(name=f"banner.gif", file=request.files["banner"])
|
||||
if imageurl:
|
||||
v.bannerurl = imageurl
|
||||
g.db.add(v)
|
||||
v.bannerurl = None
|
||||
imageurl = upload_file(name=f"banner.gif", file=request.files["banner"])
|
||||
if imageurl:
|
||||
v.bannerurl = imageurl
|
||||
g.db.add(v)
|
||||
|
||||
return render_template("settings_profile.html",
|
||||
v=v, msg="Banner successfully updated.")
|
||||
|
||||
return render_template("settings_profile.html", v=v,
|
||||
msg="Banners require +0 dramacoins.")
|
||||
return render_template("settings_profile.html",
|
||||
v=v, msg="Banner successfully updated.")
|
||||
|
||||
|
||||
@app.route("/settings/delete/profile", methods=["POST"])
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
<strong style="color: #999b2e;"><i class="far fa-fw fa-flag"></i> Reported by:</strong>
|
||||
<ul style="margin-bottom: 0;">
|
||||
{% for f in c.flags %}
|
||||
<li><a href="{{ f.user.url }}">@{{ f.user.username }}</a>: "{{f.reason}}"</li>
|
||||
<li><a href="{{ f.user.url }}">@{{ f.user.username }}</a>: {{f.reason}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
<h1 class="h5">401 Not Authorized</h1>
|
||||
<p class="text-muted">You have 0 ban awards (they're a patron perk):</p>
|
||||
<a href="https://rdrama.gumroad.com/l/tfcvri">https://rdrama.gumroad.com/l/tfcvri</a>
|
||||
<br>
|
||||
<a href="https://patreon.com/Aevann">https://patreon.com/Aevann</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
<h1 class="h5">401 Not Authorized</h1>
|
||||
<p class="text-muted">This page is only available to patrons:</p>
|
||||
<a href="https://rdrama.gumroad.com/l/tfcvri">https://rdrama.gumroad.com/l/tfcvri</a>
|
||||
<br>
|
||||
<a href="https://patreon.com/Aevann">https://patreon.com/Aevann</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -107,7 +107,6 @@
|
|||
<a class="dropdown-item" href="/changelog"><i class="fas fa-clipboard fa-fw text-left mr-3"></i>Changelog</a>
|
||||
<a class="dropdown-item" href="https://github.com/Aevann1/Drama"><i class="fab fa-github fa-fw text-left mr-3"></i>Source code</a>
|
||||
<a class="dropdown-item" href="/discord"><i class="fab fa-discord fa-fw text-left mr-3"></i>Discord</a>
|
||||
<a class="dropdown-item" href="https://patreon.com/Aevann"><i class="fab fa-patreon fa-fw text-left mr-3"></i>Patreon</a>
|
||||
<a class="dropdown-item" href="https://rdrama.gumroad.com/l/tfcvri"><i class="fas fa-dollar-sign fa-fw text-left mr-3"></i>Gumroad</a>
|
||||
<a class="dropdown-item" href="/archives"><i class="fas fa-book fa-fw text-left mr-3"></i>Subreddit Archives</a>
|
||||
<a class="dropdown-item" href="/contact"><i class="fas fa-file-signature fa-fw text-left mr-3"></i>Contact us</a>
|
||||
|
@ -163,7 +162,6 @@
|
|||
<li class="nav-item"><a class="nav-link" href="/post/1xq/posting-guidelines-policies-legal-shit"><i class="fas fa-balance-scale fa-fw mr-3"></i>Rules</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://github.com/Aevann1/Drama"><i class="fab fa-github fa-fw mr-3"></i>Source code</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/discord"><i class="fab fa-discord fa-fw mr-3"></i>Discord</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://patreon.com/Aevann"><i class="fab fa-patreon fa-fw mr-3"></i>Patreon</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://rdrama.gumroad.com/l/tfcvri"><i class="fas fa-dollar-sign fa-fw mr-3"></i>Gumroad</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/archives"><i class="fas fa-book fa-fw mr-3"></i>Subreddit Archives</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a></li>
|
||||
|
|
|
@ -84,8 +84,6 @@
|
|||
|
||||
<div>
|
||||
|
||||
{% if v.dramacoins >= 0 %}
|
||||
|
||||
<form action="/settings/images/profile" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<label class="btn btn-secondary text-capitalize mr-2 mb-0">
|
||||
|
@ -93,12 +91,6 @@
|
|||
</label>
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="text-muted">You can add a custom avatar after earning 30 Dramacoins.{% if request.headers.get("cf-ipcountry")=="T1" and not v.is_activated %} Additionally, you must have a verified email address to upload images via Tor.{% endif %}</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% if v.profileurl %}
|
||||
|
@ -112,12 +104,8 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% if v.dramacoins >= 0 %}
|
||||
|
||||
<div class="text-small-extra text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is 16 MB.</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -139,8 +127,6 @@
|
|||
|
||||
<div>
|
||||
|
||||
{% if v.dramacoins >= 0 %}
|
||||
|
||||
<form action="/settings/images/banner" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<label class="btn btn-secondary text-capitalize mr-2 mb-0">
|
||||
|
@ -148,12 +134,6 @@
|
|||
</label>
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="text-muted">You can add a custom banner after earning 30 Dramacoins.{% if request.headers.get("cf-ipcountry")=="T1" and not v.is_activated %} Additionally, you must have a verified email address to upload images via Tor.{% endif %}</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
@ -168,12 +148,8 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% if v.dramacoins >= 0 %}
|
||||
|
||||
<div class="text-small-extra text-muted mt-3">JPG, PNG, GIF files are supported. Max file size is 16 MB.</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -494,7 +494,7 @@
|
|||
<strong style="color: #999b2e;"><i class="far fa-fw fa-flag"></i> Reported by:</strong>
|
||||
<ul style="margin-bottom: 0;">
|
||||
{% for f in p.flags %}
|
||||
<li><a href="{{ f.user.url }}">@{{ f.user.username }}</a>: "{{f.reason}}"</li>
|
||||
<li><a href="{{ f.user.url }}">@{{ f.user.username }}</a>: {{f.reason}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -549,7 +549,7 @@
|
|||
<label class="btn btn-secondary format d-inline-block m-0" for="emoji-reply-btn-{{p.fullname}}">
|
||||
<div id="emoji-reply-btn-{{p.fullname}}" onclick="loadEmojis('reply-form-body-{{p.fullname}}')" aria-hidden="true" data-toggle="modal" data-target="#emojiModal" data-toggle="tooltip" data-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></div>
|
||||
</label>
|
||||
<label class="format btn btn-secondary m-0 ml-1 {% if v and v.dramacoins >= 0 %}d-inline-block{% else %}d-none{% endif %}" for="file-upload-reply-{{p.fullname}}">
|
||||
<label class="format btn btn-secondary m-0 ml-1 {% if v %}d-inline-block{% else %}d-none{% endif %}" for="file-upload-reply-{{p.fullname}}">
|
||||
<div id="filename-show-reply-{{p.base36id}}"><i class="far fa-image"></i></div>
|
||||
<input id="file-upload-reply-{{p.fullname}}" type="file" name="file" accept="image/*" onchange="document.getElementById('filename-show-reply-{{p.base36id}}').innerHTML='image';" hidden>
|
||||
</label>
|
||||
|
|
|
@ -333,7 +333,7 @@
|
|||
<strong style="color: #999b2e;"><i class="far fa-fw fa-flag"></i> Reported by:</strong>
|
||||
<ul style="margin-bottom: 0;">
|
||||
{% for f in p.flags %}
|
||||
<li><a href="{{ f.user.url }}">@{{ f.user.username }}</a>: "{{f.reason}}"</li>
|
||||
<li><a href="{{ f.user.url }}">@{{ f.user.username }}</a>: {{f.reason}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -322,9 +322,6 @@
|
|||
<small class="form-text text-muted">To post an image, use a direct image link such as i.imgur.com</small>
|
||||
</div>
|
||||
|
||||
<div {% if not v.dramacoins >= 0 %} class="d-none"{% else %} ondrop="event.preventDefault();let input=document.getElementById('file-upload');input.files=event.dataTransfer.files;input.onchange();" ondragover="event.preventDefault();"{% endif %}>
|
||||
|
||||
{% if v.dramacoins >= 0 %}
|
||||
<div id="image-upload-block">
|
||||
<div><label class="mt-3">Image Upload</label></div>
|
||||
|
||||
|
@ -335,18 +332,6 @@
|
|||
|
||||
<small class="form-text text-muted">Images uploaded will be public. Optional if you have text.</small>
|
||||
</div>
|
||||
{% else %}
|
||||
<div id="image-upload-block">
|
||||
<div><label class="mt-3">Image Upload</label></div>
|
||||
|
||||
<label class="btn btn-secondary m-0" for="file-upload">
|
||||
<div id="filename-show">Select Image</div>
|
||||
<input id="file-upload" type="file" accept="image/*" hidden disabled>
|
||||
</label>
|
||||
|
||||
<small class="form-text text-muted">You can upload images directly at 1000 Dramacoins.{% if request.headers.get("cf-ipcountry")=="T1" and not v.is_activated %} Additionally, you must have a verified email address to upload images via Tor.{% endif %}</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<label for="body" class="mt-3">Text<i class="fas fa-info-circle text-gray-400 ml-1" data-toggle="tooltip" data-placement="top" title="Uses markdown. Limited to 10000 characters."></i></label>
|
||||
|
@ -447,24 +432,30 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
{% if v.dramacoins >= 0 %}
|
||||
<script>
|
||||
document.onpaste = function(event) {
|
||||
f=document.getElementById('file-upload');
|
||||
f.files = event.clipboardData.files;
|
||||
$('#filename-show').text(f.files[0].name);
|
||||
$('#urlblock').addClass('d-none');
|
||||
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
|
||||
var fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
$('#image-preview').attr('src', this.result);
|
||||
});
|
||||
|
||||
$('#file-upload').attr('required', false);
|
||||
|
||||
checkForRequired();
|
||||
for (var item in items)
|
||||
{
|
||||
if (items[item].kind === "file")
|
||||
{
|
||||
f=document.getElementById('file-upload');
|
||||
f.files = event.clipboardData.files;
|
||||
$('#filename-show').text(f.files[0].name);
|
||||
$('#urlblock').addClass('d-none');
|
||||
|
||||
var fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
$('#image-preview').attr('src', this.result);
|
||||
});
|
||||
|
||||
$('#file-upload').attr('required', false);
|
||||
|
||||
checkForRequired();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$('#file-upload').on('change', function(e){
|
||||
|
@ -481,7 +472,6 @@
|
|||
checkForRequired();
|
||||
})
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
cd D:\1
|
||||
git pull
|
||||
|
||||
sass ./drama/assets/style/dark.scss D:/#D/drama/assets/style/dark_ff66ac.css
|
||||
sass ./drama/assets/style/light.scss D:/#D/drama/assets/style/light_ff66ac.css
|
||||
sass ./drama/assets/style/coffee.scss D:/#D/drama/assets/style/coffee_ff66ac.css
|
||||
|
@ -6,7 +9,4 @@ sass ./drama/assets/style/4chan.scss D:/#D/drama/assets/style/4chan_ff66ac.css
|
|||
python ./compilecss.py
|
||||
git add .
|
||||
git commit -m "css"
|
||||
git push
|
||||
|
||||
cd D:\1
|
||||
git pull
|
||||
git push
|
Loading…
Reference in New Issue