test/custom-admin-ui #3
+1
-4
@@ -16,11 +16,8 @@ async def admin_required(pwd: Union[str, None] = Header(default=None), request:
|
||||
|
||||
|
||||
class IPRateLimit:
|
||||
ips = {}
|
||||
count = 0
|
||||
minutes = 0
|
||||
|
||||
def __init__(self, count, minutes):
|
||||
self.ips = {}
|
||||
self.count = count
|
||||
self.minutes = minutes
|
||||
|
||||
|
||||
-24
@@ -9,30 +9,6 @@ from fastapi import UploadFile
|
||||
import settings
|
||||
|
||||
|
||||
class TencentCOS:
|
||||
def __init__(self, bucket: str, region: str, secret_id: str, secret_key: str):
|
||||
self.bucket = bucket
|
||||
self.region = region
|
||||
self.secret_id = secret_id
|
||||
self.secret_key = secret_key
|
||||
|
||||
def upload(self, file: UploadFile, path: str) -> str:
|
||||
# 上传文件
|
||||
pass
|
||||
|
||||
def download(self, path: str) -> BinaryIO:
|
||||
# 下载文件
|
||||
pass
|
||||
|
||||
def delete(self, path: str) -> None:
|
||||
# 删除文件
|
||||
pass
|
||||
|
||||
def get_url(self, path: str) -> str:
|
||||
# 获取文件访问链接
|
||||
pass
|
||||
|
||||
|
||||
class FileSystemStorage:
|
||||
DATA_ROOT = Path(settings.DATA_ROOT)
|
||||
STATIC_URL = settings.STATIC_URL
|
||||
|
||||
@@ -397,20 +397,23 @@
|
||||
this.code = value;
|
||||
},
|
||||
checkFile: function (file) {
|
||||
if (!this.enable) {
|
||||
if (!this.enableUpload) {
|
||||
this.$message({
|
||||
message: '上传功能已关闭',
|
||||
type: 'error'
|
||||
});
|
||||
return false
|
||||
}
|
||||
if (file != null) {
|
||||
if (file.size > this.fileSizeLimit) {
|
||||
this.$message({
|
||||
message: `文件大小不能超过${this.fileSizeLimit/1024/1024}MB`,
|
||||
type: 'error'
|
||||
});
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
toUploadData: function () {
|
||||
if (this.uploadData.text === '' && this.uploadData.file === null) {
|
||||
|
||||
Reference in New Issue
Block a user