Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,27 +6,22 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 6 |
import json
|
| 7 |
import base64
|
| 8 |
from components.middleware import x401Kit
|
|
|
|
| 9 |
import hashlib
|
| 10 |
import secrets
|
| 11 |
|
| 12 |
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
app=FastAPI()
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
origins=["*"]
|
| 31 |
|
| 32 |
|
|
@@ -68,3 +63,18 @@ def WebAuthChallange(request:Request):
|
|
| 68 |
challange=generate_sha256_hex_challenge()
|
| 69 |
return {"challange":challange}
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
import json
|
| 7 |
import base64
|
| 8 |
from components.middleware import x401Kit
|
| 9 |
+
from components.mongodbconnection import provideClient
|
| 10 |
import hashlib
|
| 11 |
import secrets
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
+
app=FastAPI()
|
| 16 |
+
dbclient=provideClient()
|
| 17 |
+
db=dbclient["sdklogs_db"]
|
| 18 |
+
col=db["sdklogs_col"]
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
origins=["*"]
|
| 26 |
|
| 27 |
|
|
|
|
| 63 |
challange=generate_sha256_hex_challenge()
|
| 64 |
return {"challange":challange}
|
| 65 |
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
@app.get("/sdklogs/{id}")
|
| 69 |
+
def SDKLog(id):
|
| 70 |
+
document=col.find_one({"owner":"system"})
|
| 71 |
+
details=None
|
| 72 |
+
if document:
|
| 73 |
+
logs=document["logs"]
|
| 74 |
+
for data in logs:
|
| 75 |
+
if data.signer==id:
|
| 76 |
+
details=data
|
| 77 |
+
|
| 78 |
+
return details
|
| 79 |
+
|
| 80 |
+
|