Spaces:
Running
Running
2410191313
Browse files- app.py +2 -2
- public/script.js +7 -6
app.py
CHANGED
@@ -60,13 +60,13 @@ async def load(zip_data: TextRequest):
|
|
60 |
|
61 |
@router.get('/check')
|
62 |
async def check():
|
63 |
-
global processing
|
64 |
return 'ng' if processing or defaultZip is None else 'ok'
|
65 |
|
66 |
@router.post('/zip')
|
67 |
async def zip(zip_data: TextRequest):
|
68 |
global defaultZip
|
69 |
-
|
70 |
return ''
|
71 |
|
72 |
@router.post('/sb3')
|
|
|
60 |
|
61 |
@router.get('/check')
|
62 |
async def check():
|
63 |
+
global processing, defaultZip
|
64 |
return 'ng' if processing or defaultZip is None else 'ok'
|
65 |
|
66 |
@router.post('/zip')
|
67 |
async def zip(zip_data: TextRequest):
|
68 |
global defaultZip
|
69 |
+
defaultZip = BytesIO(base64.b64decode(zip_data.text))
|
70 |
return ''
|
71 |
|
72 |
@router.post('/sb3')
|
public/script.js
CHANGED
@@ -181,12 +181,13 @@ const load = async () => {
|
|
181 |
reloadCos();
|
182 |
});
|
183 |
} else if (file.files[0].name.endsWith(`.zip`)) {
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
190 |
}
|
191 |
});
|
192 |
fileReader.readAsArrayBuffer(file.files[0]);
|
|
|
181 |
reloadCos();
|
182 |
});
|
183 |
} else if (file.files[0].name.endsWith(`.zip`)) {
|
184 |
+
if (confirm(`zip ファイルをセットします ( 管理者以外が行うと使えなくなる可能性があります )`)) {
|
185 |
+
await fetch(`/api/zip`, {
|
186 |
+
method: `post`,
|
187 |
+
headers: { 'Content-Type': 'application/json' },
|
188 |
+
body: JSON.stringify({ text: base64Data })
|
189 |
+
});
|
190 |
+
}
|
191 |
}
|
192 |
});
|
193 |
fileReader.readAsArrayBuffer(file.files[0]);
|