镜像自地址
https://github.com/binary-husky/gpt_academic.git
已同步 2025-12-06 06:26:47 +00:00
add check path back
这个提交包含在:
@@ -62,4 +62,4 @@ AUTHENTICATION = []
|
||||
API_URL_REDIRECT = {}
|
||||
|
||||
# 如果你需要把网址放在二级地址下(常规情况下,不要修改!!)
|
||||
CUSTOM_PATH = "/gra"
|
||||
CUSTOM_PATH = "/"
|
||||
|
||||
19
toolbox.py
19
toolbox.py
@@ -522,6 +522,25 @@ class DummyWith():
|
||||
return
|
||||
|
||||
def run_gradio(demo, auth, port, custom_path):
|
||||
def is_path_legal(path: str)->bool:
|
||||
'''
|
||||
check path for sub url
|
||||
path: path to check
|
||||
return value: do sub url wrap
|
||||
'''
|
||||
if path == "/": return True
|
||||
if len(path) == 0:
|
||||
print("ilegal custom path: {}\npath must not be empty\ndeploy on root url".format(path))
|
||||
return False
|
||||
if path[0] == '/':
|
||||
if path[1] != '/':
|
||||
print("deploy on sub-path {}".format(path))
|
||||
return True
|
||||
return False
|
||||
print("ilegal custom path: {}\npath should begin with \'/\'\ndeploy on root url".format(path))
|
||||
return False
|
||||
|
||||
if not is_path_legal(custom_path): raise RuntimeError('Ilegal custom path')
|
||||
import uvicorn
|
||||
import gradio as gr
|
||||
from fastapi import FastAPI
|
||||
|
||||
在新工单中引用
屏蔽一个用户