File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import logging
22import os
33import signal
4+ import sys
45
56from fastapi import APIRouter , Depends , HTTPException
67from fastapi .responses import JSONResponse
@@ -68,18 +69,14 @@ async def stop():
6869
6970@router .get ("/status" , response_model = dict , dependencies = [Depends (get_current_user )])
7071async def program_status ():
71- if not program .is_running :
72- return {
73- "status" : False ,
74- "version" : VERSION ,
75- "first_run" : program .first_run ,
76- }
77- else :
78- return {
79- "status" : True ,
80- "version" : VERSION ,
81- "first_run" : program .first_run ,
82- }
72+ is_linux = sys .platform == "linux"
73+ base = {
74+ "status" : program .is_running ,
75+ "version" : VERSION ,
76+ "first_run" : program .first_run ,
77+ "platform" : "linux" if is_linux else "windows" ,
78+ }
79+ return base
8380
8481
8582@router .get (
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const apiProgram = {
2929 * 状态
3030 */
3131 async status ( ) {
32- const { data } = await axios . get < { status : boolean ; version : string } > (
32+ const { data } = await axios . get < { status : boolean ; version : string ; platform : string ; first_run : boolean } > (
3333 'api/v1/status'
3434 ) ;
3535
You can’t perform that action at this time.
0 commit comments