Skip to content

Commit

Permalink
flask自动尝试/docs/下的index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoZuohong committed Nov 20, 2023
1 parent 4954237 commit 6dc470e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env python3
import datetime
import re

import pandas as pd
import requests

from arknights_mower.solvers import record
from arknights_mower.solvers.report import get_report_data
from arknights_mower.solvers.skland import SKLand
from arknights_mower.utils.conf import load_conf, save_conf, load_plan, write_plan
from arknights_mower.utils import depot
Expand All @@ -16,6 +14,7 @@
from arknights_mower.data import agent_list, shop_items

from flask import Flask, send_from_directory, request, abort
from werkzeug.exceptions import NotFound
from flask_cors import CORS
from flask_sock import Sock

Expand Down Expand Up @@ -78,7 +77,13 @@ def serve_index(path):

@app.errorhandler(404)
def not_found(e):
return send_from_directory("dist", "index.html")
if (path := request.path).startswith("/docs/") and path.endswith("/"):
try:
return send_from_directory("dist" + path, "index.html")
except NotFound:
return send_from_directory("dist", "index.html")
else:
return send_from_directory("dist", "index.html")


@app.route("/conf", methods=["GET", "POST"])
Expand Down Expand Up @@ -435,7 +440,6 @@ def get_half_month_data():
logger.info("report.csv正在被占用")



@app.route("/test-email")
@require_token
def test_email():
Expand Down

0 comments on commit 6dc470e

Please sign in to comment.