Move admin stuff URL to /admin
This commit is contained in:
parent
6826e833fa
commit
97fdcca06e
2 changed files with 18 additions and 17 deletions
25
app.py
25
app.py
|
@ -390,6 +390,7 @@ def handle_activitypub_error(error):
|
|||
# App routes
|
||||
|
||||
ROBOTS_TXT = """User-agent: *
|
||||
Disallow: /login
|
||||
Disallow: /admin/
|
||||
Disallow: /static/
|
||||
Disallow: /media/
|
||||
|
@ -433,15 +434,15 @@ def serve_uploads(oid, fname):
|
|||
# Login
|
||||
|
||||
|
||||
@app.route("/logout")
|
||||
@app.route("/admin/logout")
|
||||
@login_required
|
||||
def logout():
|
||||
def admin_logout():
|
||||
session["logged_in"] = False
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@app.route("/login", methods=["POST", "GET"])
|
||||
def login():
|
||||
def admin_login():
|
||||
devices = [doc["device"] for doc in DB.u2f.find()]
|
||||
u2f_enabled = True if devices else False
|
||||
if request.method == "POST":
|
||||
|
@ -461,7 +462,7 @@ def login():
|
|||
session["challenge"] = None
|
||||
|
||||
session["logged_in"] = True
|
||||
return redirect(request.args.get("redirect") or "/admin")
|
||||
return redirect(request.args.get("redirect") or "/notifications")
|
||||
else:
|
||||
abort(401)
|
||||
|
||||
|
@ -1063,9 +1064,9 @@ def outbox_activity_shares(item_id):
|
|||
)
|
||||
|
||||
|
||||
@app.route("/admin", methods=["GET"])
|
||||
@app.route("/admin/stats", methods=["GET"])
|
||||
@login_required
|
||||
def admin():
|
||||
def admin_stats():
|
||||
q = {
|
||||
"meta.deleted": False,
|
||||
"meta.undo": False,
|
||||
|
@ -1087,9 +1088,9 @@ def admin():
|
|||
)
|
||||
|
||||
|
||||
@app.route("/new", methods=["GET"])
|
||||
@app.route("/admin/new", methods=["GET"])
|
||||
@login_required
|
||||
def new():
|
||||
def admin_new():
|
||||
reply_id = None
|
||||
content = ""
|
||||
thread = []
|
||||
|
@ -1111,9 +1112,9 @@ def new():
|
|||
return render_template("new.html", reply=reply_id, content=content, thread=thread)
|
||||
|
||||
|
||||
@app.route("/notifications")
|
||||
@app.route("/admin/notifications")
|
||||
@login_required
|
||||
def notifications():
|
||||
def admin_notifications():
|
||||
# FIXME(tsileo): show unfollow (performed by the current actor) and liked???
|
||||
mentions_query = {
|
||||
"type": ActivityType.CREATE.value,
|
||||
|
@ -1254,9 +1255,9 @@ def api_undo():
|
|||
return _user_api_response(activity=undo.id)
|
||||
|
||||
|
||||
@app.route("/stream")
|
||||
@app.route("/admin/stream")
|
||||
@login_required
|
||||
def stream():
|
||||
def admin_stream():
|
||||
q = {
|
||||
"box": Box.INBOX.value,
|
||||
"type": {"$in": [ActivityType.CREATE.value, ActivityType.ANNOUNCE.value]},
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
{% if logged_in %}
|
||||
<ul id="admin-menu">
|
||||
<li class="left"><span class="admin-title">Admin</span></li>
|
||||
<li class="left"><a href="/new"{% if request.path == "/new" %} class="selected" {% endif %}>New</a></li>
|
||||
<li class="left"><a href="/stream"{% if request.path == "/stream" %} class="selected" {% endif %}>Stream</a></li>
|
||||
<li class="left"><a href="/notifications"{% if request.path == "/notifications" %} class="selected" {% endif %}>Notifications</a></li>
|
||||
<li class="left"><a href="/admin"{% if request.path == "/admin" %} class="selected" {% endif %}>Stats</a></li>
|
||||
<li class="right"><a href="/logout">Logout</a></li>
|
||||
<li class="left"><a href="/admin/new"{% if request.path == "/admin/new" %} class="selected" {% endif %}>New</a></li>
|
||||
<li class="left"><a href="/admin/stream"{% if request.path == "/admin/stream" %} class="selected" {% endif %}>Stream</a></li>
|
||||
<li class="left"><a href="/admin/notifications"{% if request.path == "/admin/notifications" %} class="selected" {% endif %}>Notifications</a></li>
|
||||
<li class="left"><a href="/admin/stats"{% if request.path == "/admin/stats" %} class="selected" {% endif %}>Stats</a></li>
|
||||
<li class="right"><a href="/admin/logout">Logout</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue