up link and change to post

This commit is contained in:
Dantenerosas 2023-09-26 00:15:04 +03:00
parent c0f25383a6
commit a03b9b1a0b
2 changed files with 4 additions and 5 deletions

View File

@ -148,7 +148,7 @@ async def download_video(file_path):
return StreamingResponse(iterfile(), media_type="video/mp4")
@app.get('/check/', response_class=FileResponse, status_code=200)
@app.post('/check/', response_class=FileResponse, status_code=200)
async def download_video(request: Request, link: str):
try:
red = RedisClient()
@ -188,5 +188,4 @@ async def download_video(request: Request, link: str):
except Exception as ex:
print(ex)
if __name__ == '__main__':
uvicorn.run("src.web.main:app", host="0.0.0.0", log_level="info")

View File

@ -93,7 +93,7 @@
const link = document.getElementById("link").value
const xhr2 = new XMLHttpRequest();
// TODO: скорректировать ссылку, она должна быть относительной
xhr2.open('GET', 'http://'+document.location.host+'/check/?link=' + link);
xhr2.open('POST', 'http://'+document.location.host+'/check');
xhr2.responseType = 'json';
xhr2.onload = function() {
// TODO: добавить обработку исключений и всех возможных кодов в ответе
@ -112,7 +112,7 @@
document.forms.download.querySelector('.submit-spinner').classList.add('submit-spinner_hide');
};
};
xhr2.send()
xhr2.send(link)
}