test/custom-admin-ui #3

Merged
orion merged 673 commits from test/custom-admin-ui into master 2026-06-05 17:20:58 +08:00
3 changed files with 11 additions and 35 deletions
Showing only changes of commit b83497c4c8 - Show all commits
+1 -4
View File
@@ -16,11 +16,8 @@ async def admin_required(pwd: Union[str, None] = Header(default=None), request:
class IPRateLimit: class IPRateLimit:
ips = {}
count = 0
minutes = 0
def __init__(self, count, minutes): def __init__(self, count, minutes):
self.ips = {}
self.count = count self.count = count
self.minutes = minutes self.minutes = minutes
-24
View File
@@ -9,30 +9,6 @@ from fastapi import UploadFile
import settings 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: class FileSystemStorage:
DATA_ROOT = Path(settings.DATA_ROOT) DATA_ROOT = Path(settings.DATA_ROOT)
STATIC_URL = settings.STATIC_URL STATIC_URL = settings.STATIC_URL
+5 -2
View File
@@ -397,20 +397,23 @@
this.code = value; this.code = value;
}, },
checkFile: function (file) { checkFile: function (file) {
if (!this.enable) { if (!this.enableUpload) {
this.$message({ this.$message({
message: '上传功能已关闭', message: '上传功能已关闭',
type: 'error' type: 'error'
}); });
return false return false
} }
if (file != null) {
if (file.size > this.fileSizeLimit) { if (file.size > this.fileSizeLimit) {
this.$message({ this.$message({
message: `文件大小不能超过${this.fileSizeLimit/1024/1024}MB`, message: `文件大小不能超过${this.fileSizeLimit/1024/1024}MB`,
type: 'error' type: 'error'
}); });
return false return false;
} }
}
return true;
}, },
toUploadData: function () { toUploadData: function () {
if (this.uploadData.text === '' && this.uploadData.file === null) { if (this.uploadData.text === '' && this.uploadData.file === null) {