mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Delete paste in admin
This commit is contained in:
parent
b6732d7348
commit
e5faaac077
@ -75,15 +75,19 @@ def admin():
|
||||
if paste_id:
|
||||
try:
|
||||
if "/paste/" in paste_id:
|
||||
paste_id = urlparse(paste_id).path.split("/path/")[-1]
|
||||
paste_id = urlparse(paste_id).path.split("/paste/")[-1]
|
||||
paste = Paste.load(paste_id)
|
||||
paste.delete()
|
||||
except (TypeError, ValueError, FileNotFoundError):
|
||||
return {"status": "error", "message": f"Cannot find paste '{paste_id}'"}
|
||||
return {
|
||||
"status": "error",
|
||||
"message": f"Cannot find paste '{paste_id}'",
|
||||
**GLOBAL_CONTEXT,
|
||||
}
|
||||
|
||||
return {"status": "ok", "message": "Paste deleted"}
|
||||
return {"status": "ok", "message": "Paste deleted", **GLOBAL_CONTEXT}
|
||||
|
||||
return {"status": "ok", **GLOBAL_CONTEXT}
|
||||
return {"status": "ok", "message": "" ** GLOBAL_CONTEXT}
|
||||
|
||||
|
||||
@app.get(ADMIN_LOGIN_URL)
|
||||
|
@ -1,9 +1,14 @@
|
||||
<form action="./delete/" method="post">
|
||||
<form action="." method="post">
|
||||
%if status == "error":
|
||||
<div class="alert alert-danger" role="alert alert-danger">
|
||||
{{message}}
|
||||
</div>
|
||||
%end
|
||||
%if status == "ok" and message:
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{message}}
|
||||
</div>
|
||||
%end
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label>Paste to delete</label>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
<div id="app">
|
||||
|
||||
<div class="topnav">
|
||||
<div class="topnav" @mouseleave="openPreviousPastesMenu =false">
|
||||
<a class="brand" href="/"><span>ø</span>bin<em>.net</em></a>
|
||||
<span class="tagline">"A client side encrypted PasteBin"<br><span>All pastes are AES256 encrypted, we cannot know
|
||||
what you paste...</span>
|
||||
@ -36,8 +36,7 @@
|
||||
<ul>
|
||||
<li class="submenu"><a href="#" @click.prevent="openPreviousPastesMenu = !openPreviousPastesMenu">Previous
|
||||
pastes v</a>
|
||||
<ul class="previous-pastes" id="topmenu" v-if="openPreviousPastesMenu"
|
||||
@mouseleave="openPreviousPastesMenu =false">
|
||||
<ul class="previous-pastes" id="topmenu" v-if="openPreviousPastesMenu">
|
||||
<li class="item active" v-if="previousPastes.length === 0">
|
||||
<a href="#">No paste yet</a>
|
||||
</li>
|
||||
@ -64,19 +63,18 @@
|
||||
<footer class="footer">
|
||||
<ul>
|
||||
%for i, entry in enumerate(settings.MENU):
|
||||
<li>
|
||||
%if "mailto:" in entry[1]:
|
||||
<span :title='formatEmail(`{{ entry[1].replace("mailto:", "").replace("@", "__AT__") }}`)'
|
||||
class="email-link" >
|
||||
{{ entry[0] }}
|
||||
</span>
|
||||
%else:
|
||||
<a href="{{ entry[1] }}">{{ entry[0] }}</a>
|
||||
%end
|
||||
</li>
|
||||
<li>
|
||||
%if "mailto:" in entry[1]:
|
||||
<span :title='formatEmail(`{{ entry[1].replace("mailto:", "").replace("@", "__AT__") }}`)' class="email-link">
|
||||
{{ entry[0] }}
|
||||
</span>
|
||||
%else:
|
||||
<a href="{{ entry[1] }}">{{ entry[0] }}</a>
|
||||
%end
|
||||
</li>
|
||||
%end
|
||||
</ul>
|
||||
|
||||
|
||||
%if settings.DISPLAY_COUNTER:
|
||||
<strong>{{ pastes_count }}</strong> pastes øbinned
|
||||
%end
|
||||
|
Loading…
Reference in New Issue
Block a user