diff --git a/main.py b/main.py index 7bc7b1c..00b0a4a 100644 --- a/main.py +++ b/main.py @@ -205,7 +205,7 @@ class ShareDataModel(BaseModel): exp_value: int type: str name: str - key: str = uuid.uuid4 + key: str = uuid.uuid4().hex @app.post('/share/file/', dependencies=[Depends(admin_required)], description='分享文件') @@ -231,7 +231,7 @@ async def share_text(text_model: ShareDataModel, s: AsyncSession = Depends(get_s if exp_error: raise HTTPException(status_code=400, detail='过期值异常') exp_status, exp_time, exp_count, code = await get_expire_info(text_model.exp_style, text_model.exp_value, s) - size, _text, _type, name, key = len(text_model.text), text_model.text, 'text', '文本分享', text_model.key().hex + size, _text, _type, name, key = len(text_model.text), text_model.text, 'text', '文本分享', text_model.key s.add(Codes(code=code, text=_text, size=size, type=_type, name=name, count=exp_count, exp_time=exp_time, key=key)) await s.commit() upload_ip_limit.add_ip(ip) diff --git a/templates/index.html b/templates/index.html index 3d1d874..93569b3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -72,10 +72,14 @@ background-color: rgba(0, 0, 0, 0.4); } - .el-drawer, #el-drawer__title, .el-drawer__body, .el-drawer__wrapper { + .el-drawer, #el-drawer__title, .el-drawer__body, .el-drawer__wrapper .el-loading-mask { background-color: rgba(0, 0, 0, 0.5); border: 1px solid transparent; } + + .el-loading-mask { + background-color: rgba(0, 0, 0, 0.8) !important; + } } @@ -168,7 +172,6 @@ - { + await this.http('post', `/file/upload/${file_key}/`, formData).then((res) => { this.upload_groups[chunk_index - 1] = 1; }).catch((res) => { this.upload_groups[chunk_index - 1] = 2; @@ -497,7 +501,7 @@ const start = chunk_index * shardSize const end = Math.min(start + shardSize, size) chunk_index += 1; - this.uploadChunk(file.slice(start, end), res.data, chunk_index, total_chunks); + await this.uploadChunk(file.slice(start, end), res.data, chunk_index, total_chunks); } const interval = setInterval(() => { let success = 0;