fix: hardcode market_url fallback to turbosu.yeij.top
This commit is contained in:
+10
-10
@@ -494,7 +494,7 @@ async def api_delete_recording(filename: str):
|
||||
async def api_market_list():
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
resp = await client.get(f"{url}/api/collections/dashboards/records?sort=-name&perPage=50")
|
||||
@@ -507,7 +507,7 @@ async def api_market_list():
|
||||
async def api_market_auth(data: dict):
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
resp = await client.post(
|
||||
@@ -524,7 +524,7 @@ async def api_market_auth(data: dict):
|
||||
async def api_market_register(data: dict):
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
resp = await client.post(
|
||||
@@ -577,7 +577,7 @@ async def api_market_upload(file: UploadFile = File(...), name: str = "", catego
|
||||
return {"error": f"文件解析失败: {str(e)}"}
|
||||
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
resp = await client.post(
|
||||
@@ -600,7 +600,7 @@ async def api_market_upload(file: UploadFile = File(...), name: str = "", catego
|
||||
async def api_market_install(id: str = "", filename: str = ""):
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=60, follow_redirects=True) as client:
|
||||
resp = await client.get(f"{url}/api/files/dashboards/{id}/{filename}")
|
||||
@@ -632,7 +632,7 @@ async def api_market_install(id: str = "", filename: str = ""):
|
||||
async def api_market_scenes():
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
resp = await client.get(f"{url}/api/collections/scenes/records?sort=-name&perPage=50")
|
||||
@@ -666,7 +666,7 @@ async def api_market_upload_scene(file: UploadFile = File(...), token: str = "")
|
||||
|
||||
import httpx as _httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with _httpx.AsyncClient(timeout=30) as client:
|
||||
resp = await client.post(
|
||||
@@ -686,7 +686,7 @@ async def api_market_upload_scene(file: UploadFile = File(...), token: str = "")
|
||||
async def api_market_install_scene(id: str = "", filename: str = ""):
|
||||
import httpx, io, zipfile, json as _json
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=60, follow_redirects=True) as client:
|
||||
resp = await client.get(f"{url}/api/files/scenes/{id}/{filename}")
|
||||
@@ -712,7 +712,7 @@ async def api_market_install_scene(id: str = "", filename: str = ""):
|
||||
async def api_market_mine(token: str = ""):
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
result = {"dashboards": [], "scenes": []}
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
@@ -731,7 +731,7 @@ async def api_market_mine(token: str = ""):
|
||||
async def api_market_delete(data: dict):
|
||||
import httpx
|
||||
cfg = get_config()
|
||||
url = cfg.get("market_url", "http://127.0.0.1:5301")
|
||||
url = cfg.get("market_url", "https://turbosu.yeij.top")
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
collection = data.get("collection", "dashboards")
|
||||
|
||||
Reference in New Issue
Block a user