Skip to content

Commit

Permalink
feat: Add status detection
Browse files Browse the repository at this point in the history
  • Loading branch information
WCY-dt committed Dec 18, 2024
1 parent 31e5639 commit ab7a8ec
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

[简体中文](README_zh-CN.md) | English

[![Deploy state](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml/badge.svg)](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml)
[![Deploy state](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml/badge.svg)](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml) [![Server Status](https://img.shields.io/badge/dynamic/json?logo=linux&color=brightgreen&label=Server%20status&query=%24.status&cacheSeconds=600&url=https%3A%2F%2F2024.ch3nyang.top%2Fstatus)](https://2024.ch3nyang.top)

<strong style="font-size: 20px;">👉 Try it now: <a href="https://2024.ch3nyang.top">https://2024.ch3nyang.top</a></strong>
<strong style="font-size: 24px;">👉 Try it now: <a href="https://2024.ch3nyang.top">https://2024.ch3nyang.top</a></strong>
</div>

> [!NOTE]
Expand Down
4 changes: 2 additions & 2 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

[English](README.md) | 简体中文

[![Deploy state](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml/badge.svg)](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml)
[![Deploy state](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml/badge.svg)](https://github.com/WCY-dt/my-github-2024/actions/workflows/deploy.yml) [![Server Status](https://img.shields.io/badge/dynamic/json?logo=linux&color=brightgreen&label=Server%20status&query=%24.status&cacheSeconds=600&url=https%3A%2F%2F2024.ch3nyang.top%2Fstatus)](https://2024.ch3nyang.top)

<strong style="font-size: 20px;">👉 立即体验: <a href="https://2024.ch3nyang.top">https://2024.ch3nyang.top</a></strong>
<strong style="font-size: 24px;">👉 立即体验: <a href="https://2024.ch3nyang.top">https://2024.ch3nyang.top</a></strong>
</div>

> [!NOTE]
Expand Down
28 changes: 24 additions & 4 deletions my-github-2024.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,35 @@ class UserContext(db.Model):
@app.before_request
def before_request():
if (
request.endpoint not in ("index", "login", "callback", "static")
and "access_token" not in session
request.endpoint not in (
"status",
"index",
"login",
"callback",
"static"
) and "access_token" not in session
):
return redirect(url_for("index"))

if request.endpoint not in ("index", "login", "callback", "dashboard", "load", "wait", "display", "static"):

if request.endpoint not in (
"status",
"index",
"login",
"callback",
"dashboard",
"load",
"wait",
"display",
"static",
):
return redirect(url_for("index"))


@app.route("/status", methods=["GET"])
def status():
return jsonify({"status": "ok"}), 200


@app.route("/", methods=["GET"])
def index():
if session.get("access_token"):
Expand Down

0 comments on commit ab7a8ec

Please sign in to comment.