mirror of
https://github.com/vastsa/FileCodeBox.git
synced 2026-11-20 13:29:56 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cdb972583 | ||
|
|
736e16a9f6 | ||
|
|
8e57a497f7 | ||
|
|
287d9aeedb | ||
|
|
f1a16a115a | ||
|
|
b2bfc045c2 | ||
|
|
900541baa5 | ||
|
|
8b813a2eaa | ||
|
|
4920b4b5db | ||
|
|
268f1537bb | ||
|
|
41b01b3faa | ||
|
|
c02fb7ce20 | ||
|
|
95f5e0dfbc | ||
|
|
e854eb068c | ||
|
|
c1966b3942 | ||
|
|
a20a0beb79 | ||
|
|
d7200f6b9b | ||
|
|
bd6f646f5d | ||
|
|
6eac746e83 | ||
|
|
5f82650c36 | ||
|
|
d3fe7b223e | ||
|
|
2d79fa5acd | ||
|
|
387f023372 | ||
|
|
e51380003c | ||
|
|
e41b3e1688 | ||
|
|
7be3b27415 | ||
|
|
bdab5bb375 | ||
|
|
c0984bfb1f | ||
|
|
62d1a23695 | ||
|
|
9a80d7a9e0 | ||
|
|
eeb70c7f44 | ||
|
|
136ea5830f | ||
|
|
c430af3d82 | ||
|
|
6fcf26fcbe | ||
|
|
f6649ecc81 | ||
|
|
3005ed1298 | ||
|
|
a23409f0af | ||
|
|
f7876c6e48 | ||
|
|
7c6aedb96e | ||
|
|
7ed09e2455 | ||
|
|
9f8e6d401f | ||
|
|
c4304d3525 | ||
|
|
e92ff30d8c | ||
|
|
fd913ababc | ||
|
|
45be97a258 | ||
|
|
fbd741ebcf | ||
|
|
e341e1afae | ||
|
|
4037ddb3b1 | ||
|
|
72190331b9 | ||
|
|
566dc3b94f | ||
|
|
cf96071167 | ||
|
|
ffe89060f4 | ||
|
|
79c1e0f949 | ||
|
|
df6722ac26 | ||
|
|
e897dbfe97 | ||
|
|
168ca8383f | ||
|
|
4d1cd4cbfc | ||
|
|
c61c2ee7fe | ||
|
|
548d625827 | ||
|
|
792f7a8a12 | ||
|
|
a65cf32214 | ||
|
|
4a50908455 | ||
|
|
c4e398bd31 | ||
|
|
39264cc32e | ||
|
|
7a15b6a44d | ||
|
|
591441e9a7 | ||
|
|
60756749b7 | ||
|
|
fdada809d9 |
No files matched your search
@@ -5,46 +5,59 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
REGISTRY_IMAGE: ${{ secrets.DOCKER_USERNAME }}/filecodebox
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=beta,enable={{is_default_branch}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
driver-opts: |
|
||||
image=moby/buildkit:latest
|
||||
network=host
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKER_USERNAME }}/filecodebox:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
provenance: false
|
||||
@@ -154,3 +154,11 @@ for_test.py
|
||||
data/.env
|
||||
.backup/
|
||||
/cloc-1.64.exe
|
||||
|
||||
# Ignore node_modules
|
||||
node_modules/
|
||||
|
||||
|
||||
AGENTS.md
|
||||
|
||||
dist/
|
||||
@@ -12,7 +12,7 @@ from core.settings import settings
|
||||
from apps.admin.services import FileService, ConfigService, LocalFileService
|
||||
|
||||
|
||||
def create_token(data: dict, expires_in: int = 3600 * 24) -> str:
|
||||
def create_token(data: dict, expires_in: int = 3600 * 24 * 30) -> str:
|
||||
"""
|
||||
创建JWT token
|
||||
:param data: 数据负载
|
||||
@@ -95,6 +95,39 @@ async def admin_required(
|
||||
raise HTTPException(status_code=401, detail=str(e))
|
||||
|
||||
|
||||
async def share_required_login(
|
||||
authorization: str = Header(default=None), request: Request = None
|
||||
):
|
||||
"""
|
||||
验证分享上传权限
|
||||
|
||||
当settings.openUpload为False时,要求用户必须登录并具有管理员权限
|
||||
当settings.openUpload为True时,允许游客上传
|
||||
|
||||
:param authorization: 认证头信息
|
||||
:param request: 请求对象
|
||||
:return: 验证结果
|
||||
"""
|
||||
if not settings.openUpload:
|
||||
try:
|
||||
if not authorization or not authorization.startswith("Bearer "):
|
||||
raise HTTPException(
|
||||
status_code=403, detail="本站未开启游客上传,如需上传请先登录后台"
|
||||
)
|
||||
|
||||
token = authorization.split(" ")[1]
|
||||
try:
|
||||
payload = verify_token(token)
|
||||
if not payload.get("is_admin", False):
|
||||
raise HTTPException(status_code=401, detail="未授权或授权校验失败")
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=401, detail=str(e))
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=401, detail="认证失败:" + str(e))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def get_file_service():
|
||||
return FileService()
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import datetime
|
||||
from typing import Optional, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
@@ -17,3 +20,12 @@ class DeleteItem(BaseModel):
|
||||
|
||||
class LoginData(BaseModel):
|
||||
password: str
|
||||
|
||||
|
||||
class UpdateFileData(BaseModel):
|
||||
id: int
|
||||
code: Optional[str] = None
|
||||
prefix: Optional[str] = None
|
||||
suffix: Optional[str] = None
|
||||
expired_at: Optional[Union[datetime.datetime, str]] = None
|
||||
expired_count: Optional[int] = None
|
||||
@@ -123,10 +123,14 @@ class LocalFileClass:
|
||||
def __init__(self, file):
|
||||
self.file = file
|
||||
self.path = data_root / "local" / file
|
||||
self.ctime = time.strftime(
|
||||
"%Y-%m-%d %H:%M:%S", time.localtime(os.path.getctime(self.path))
|
||||
)
|
||||
self.size = os.path.getsize(self.path)
|
||||
if os.path.exists(self.path):
|
||||
self.ctime = time.strftime(
|
||||
"%Y-%m-%d %H:%M:%S", time.localtime(os.path.getctime(self.path))
|
||||
)
|
||||
self.size = os.path.getsize(self.path)
|
||||
else:
|
||||
self.ctime = None
|
||||
self.size = None
|
||||
|
||||
async def read(self):
|
||||
return open(self.path, "rb")
|
||||
|
||||
+29
-1
@@ -12,7 +12,7 @@ from apps.admin.dependencies import (
|
||||
get_config_service,
|
||||
get_local_file_service,
|
||||
)
|
||||
from apps.admin.schemas import IDData, ShareItem, DeleteItem, LoginData
|
||||
from apps.admin.schemas import IDData, ShareItem, DeleteItem, LoginData, UpdateFileData
|
||||
from core.response import APIResponse
|
||||
from apps.base.models import FileCodes, KeyValue
|
||||
from apps.admin.dependencies import create_token
|
||||
@@ -146,3 +146,31 @@ async def share_local_file(
|
||||
):
|
||||
share_info = await file_service.share_local_file(item)
|
||||
return APIResponse(detail=share_info)
|
||||
|
||||
|
||||
@admin_api.patch("/file/update")
|
||||
async def update_file(
|
||||
data: UpdateFileData,
|
||||
admin: bool = Depends(admin_required),
|
||||
):
|
||||
file_code = await FileCodes.filter(id=data.id).first()
|
||||
if not file_code:
|
||||
raise HTTPException(status_code=404, detail="文件不存在")
|
||||
update_data = {}
|
||||
|
||||
if data.code is not None and data.code != file_code.code:
|
||||
# 判断code是否存在
|
||||
if await FileCodes.filter(code=data.code).first():
|
||||
raise HTTPException(status_code=400, detail="code已存在")
|
||||
update_data["code"] = data.code
|
||||
if data.prefix is not None and data.prefix != file_code.prefix:
|
||||
update_data["prefix"] = data.prefix
|
||||
if data.suffix is not None and data.suffix != file_code.suffix:
|
||||
update_data["suffix"] = data.suffix
|
||||
if data.expired_at is not None and data.expired_at != "" and data.expired_at != file_code.expired_at:
|
||||
update_data["expired_at"] = data.expired_at
|
||||
if data.expired_count is not None and data.expired_count != file_code.expired_count:
|
||||
update_data["expired_count"] = data.expired_count
|
||||
|
||||
await file_code.update_from_dict(update_data).save()
|
||||
return APIResponse(detail="更新成功")
|
||||
@@ -0,0 +1,28 @@
|
||||
from tortoise import connections
|
||||
|
||||
|
||||
async def create_upload_chunk_and_update_file_codes_table():
|
||||
conn = connections.get("default")
|
||||
await conn.execute_script(
|
||||
"""
|
||||
ALTER TABLE "filecodes" ADD "file_hash" VARCHAR(128);
|
||||
ALTER TABLE "filecodes" ADD "is_chunked" BOOL NOT NULL DEFAULT False;
|
||||
ALTER TABLE "filecodes" ADD "upload_id" VARCHAR(128);
|
||||
CREATE TABLE "uploadchunk" (
|
||||
id INTEGER not null primary key autoincrement,
|
||||
"upload_id" VARCHAR(36) NOT NULL,
|
||||
"chunk_index" INT NOT NULL,
|
||||
"chunk_hash" VARCHAR(128) NOT NULL,
|
||||
"total_chunks" INT NOT NULL,
|
||||
"file_size" BIGINT NOT NULL,
|
||||
"chunk_size" INT NOT NULL,
|
||||
"created_at" TIMESTAMPTZ NOT NULL,
|
||||
"file_name" VARCHAR(255) NOT NULL,
|
||||
"completed" BOOL NOT NULL
|
||||
);
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
async def migrate():
|
||||
await create_upload_chunk_and_update_file_codes_table()
|
||||
@@ -0,0 +1,26 @@
|
||||
from tortoise import connections
|
||||
|
||||
|
||||
async def create_presign_upload_session_table():
|
||||
conn = connections.get("default")
|
||||
await conn.execute_script(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS presignuploadsession (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
upload_id VARCHAR(36) NOT NULL UNIQUE,
|
||||
file_name VARCHAR(255) NOT NULL,
|
||||
file_size BIGINT NOT NULL,
|
||||
save_path VARCHAR(512) NOT NULL,
|
||||
mode VARCHAR(10) NOT NULL,
|
||||
expire_value INT NOT NULL DEFAULT 1,
|
||||
expire_style VARCHAR(20) NOT NULL DEFAULT 'day',
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at TIMESTAMP NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_presignuploadsession_upload_id ON presignuploadsession (upload_id);
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
async def migrate():
|
||||
await create_presign_upload_session_table()
|
||||
+51
-94
@@ -2,119 +2,55 @@
|
||||
# @Author : Lan
|
||||
# @File : models.py
|
||||
# @Software: PyCharm
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from tortoise import fields
|
||||
from tortoise.models import Model
|
||||
from tortoise.contrib.pydantic import pydantic_model_creator
|
||||
|
||||
from tortoise import fields, models
|
||||
from datetime import datetime
|
||||
from core.utils import get_now
|
||||
|
||||
|
||||
class FileCodes(Model):
|
||||
id: Optional[int] = fields.IntField(pk=True)
|
||||
code: Optional[int] = fields.CharField(
|
||||
description="分享码", max_length=255, index=True, unique=True
|
||||
)
|
||||
prefix: Optional[str] = fields.CharField(
|
||||
max_length=255, description="前缀", default=""
|
||||
)
|
||||
suffix: Optional[str] = fields.CharField(
|
||||
max_length=255, description="后缀", default=""
|
||||
)
|
||||
uuid_file_name: Optional[str] = fields.CharField(
|
||||
max_length=255, description="uuid文件名", null=True
|
||||
)
|
||||
file_path: Optional[str] = fields.CharField(
|
||||
max_length=255, description="文件路径", null=True
|
||||
)
|
||||
size: Optional[int] = fields.IntField(description="文件大小", default=0)
|
||||
text: Optional[str] = fields.TextField(description="文本内容", null=True)
|
||||
expired_at: Optional[datetime] = fields.DatetimeField(
|
||||
null=True, description="过期时间"
|
||||
)
|
||||
expired_count: Optional[int] = fields.IntField(description="可用次数", default=0)
|
||||
used_count: Optional[int] = fields.IntField(description="已用次数", default=0)
|
||||
created_at: Optional[datetime] = fields.DatetimeField(
|
||||
auto_now_add=True, description="创建时间"
|
||||
)
|
||||
#
|
||||
# file_hash = fields.CharField(
|
||||
# max_length=128, # SHA-256需要64字符,这里预留扩展空间
|
||||
# description="文件哈希值",
|
||||
# unique=True,
|
||||
# null=True # 允许旧数据为空
|
||||
# )
|
||||
# hash_algorithm = fields.CharField(
|
||||
# max_length=20,
|
||||
# description="哈希算法类型",
|
||||
# null=True,
|
||||
# default="sha256"
|
||||
# )
|
||||
|
||||
# # 新增分片字段
|
||||
# chunk_size = fields.IntField(
|
||||
# description="分片大小(字节)",
|
||||
# default=0
|
||||
# )
|
||||
# total_chunks = fields.IntField(
|
||||
# description="总分片数",
|
||||
# default=0
|
||||
# )
|
||||
# uploaded_chunks = fields.IntField(
|
||||
# description="已上传分片数",
|
||||
# default=0
|
||||
# )
|
||||
# upload_status = fields.CharField(
|
||||
# max_length=20,
|
||||
# description="上传状态",
|
||||
# default="pending", # pending/in_progress/completed
|
||||
# choices=["pending", "in_progress", "completed"]
|
||||
# )
|
||||
# is_chunked = fields.BooleanField(
|
||||
# description="是否分片上传",
|
||||
# default=False
|
||||
# )
|
||||
class FileCodes(models.Model):
|
||||
id = fields.IntField(pk=True)
|
||||
code = fields.CharField(max_length=255, unique=True, index=True)
|
||||
prefix = fields.CharField(max_length=255, default="")
|
||||
suffix = fields.CharField(max_length=255, default="")
|
||||
uuid_file_name = fields.CharField(max_length=255, null=True)
|
||||
file_path = fields.CharField(max_length=255, null=True)
|
||||
size = fields.IntField(default=0)
|
||||
text = fields.TextField(null=True)
|
||||
expired_at = fields.DatetimeField(null=True)
|
||||
expired_count = fields.IntField(default=0)
|
||||
used_count = fields.IntField(default=0)
|
||||
created_at = fields.DatetimeField(auto_now_add=True)
|
||||
file_hash = fields.CharField(max_length=64, null=True)
|
||||
is_chunked = fields.BooleanField(default=False)
|
||||
upload_id = fields.CharField(max_length=36, null=True)
|
||||
|
||||
async def is_expired(self):
|
||||
# 按时间
|
||||
if self.expired_at is None:
|
||||
return False
|
||||
if self.expired_at and self.expired_count < 0:
|
||||
return self.expired_at < await get_now()
|
||||
# 按次数
|
||||
else:
|
||||
return self.expired_count <= 0
|
||||
return self.expired_count <= 0
|
||||
|
||||
async def get_file_path(self):
|
||||
return f"{self.file_path}/{self.uuid_file_name}"
|
||||
|
||||
|
||||
#
|
||||
# class FileChunks(Model):
|
||||
# id = fields.IntField(pk=True)
|
||||
# file_code = fields.ForeignKeyField(
|
||||
# "models.FileCodes",
|
||||
# related_name="chunks",
|
||||
# on_delete=fields.CASCADE
|
||||
# )
|
||||
# chunk_number = fields.IntField(description="分片序号")
|
||||
# chunk_hash = fields.CharField(
|
||||
# max_length=128,
|
||||
# description="分片哈希校验值"
|
||||
# )
|
||||
# chunk_path = fields.CharField(
|
||||
# max_length=255,
|
||||
# description="分片存储路径"
|
||||
# )
|
||||
# created_at = fields.DatetimeField(
|
||||
# auto_now_add=True,
|
||||
# description="上传时间"
|
||||
# )
|
||||
#
|
||||
# class Meta:
|
||||
# unique_together = [("file_code", "chunk_number")]
|
||||
class UploadChunk(models.Model):
|
||||
id = fields.IntField(pk=True)
|
||||
upload_id = fields.CharField(max_length=36, index=True)
|
||||
chunk_index = fields.IntField()
|
||||
chunk_hash = fields.CharField(max_length=64)
|
||||
total_chunks = fields.IntField()
|
||||
file_size = fields.BigIntField()
|
||||
chunk_size = fields.IntField()
|
||||
file_name = fields.CharField(max_length=255)
|
||||
created_at = fields.DatetimeField(auto_now_add=True)
|
||||
completed = fields.BooleanField(default=False)
|
||||
|
||||
|
||||
class KeyValue(Model):
|
||||
@@ -128,4 +64,25 @@ class KeyValue(Model):
|
||||
)
|
||||
|
||||
|
||||
class PresignUploadSession(models.Model):
|
||||
"""预签名上传会话模型"""
|
||||
id = fields.IntField(pk=True)
|
||||
upload_id = fields.CharField(max_length=36, unique=True, index=True)
|
||||
file_name = fields.CharField(max_length=255)
|
||||
file_size = fields.BigIntField()
|
||||
save_path = fields.CharField(max_length=512)
|
||||
mode = fields.CharField(max_length=10) # "direct" 或 "proxy"
|
||||
expire_value = fields.IntField(default=1)
|
||||
expire_style = fields.CharField(max_length=20, default="day")
|
||||
created_at = fields.DatetimeField(auto_now_add=True)
|
||||
expires_at = fields.DatetimeField() # 会话过期时间
|
||||
|
||||
async def is_expired(self):
|
||||
"""检查会话是否已过期"""
|
||||
return self.expires_at < await get_now()
|
||||
|
||||
|
||||
file_codes_pydantic = pydantic_model_creator(FileCodes, name="FileCodes")
|
||||
upload_chunk_pydantic = pydantic_model_creator(UploadChunk, name="UploadChunk")
|
||||
key_value_pydantic = pydantic_model_creator(KeyValue, name="KeyValue")
|
||||
presign_upload_session_pydantic = pydantic_model_creator(PresignUploadSession, name="PresignUploadSession")
|
||||
@@ -1,5 +1,36 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class SelectFileModel(BaseModel):
|
||||
code: str
|
||||
|
||||
|
||||
class InitChunkUploadModel(BaseModel):
|
||||
file_name: str
|
||||
chunk_size: int = 5 * 1024 * 1024
|
||||
file_size: int
|
||||
file_hash: str
|
||||
|
||||
|
||||
class CompleteUploadModel(BaseModel):
|
||||
expire_value: int
|
||||
expire_style: str
|
||||
|
||||
|
||||
# 预签名上传相关模型
|
||||
class PresignUploadInitRequest(BaseModel):
|
||||
"""预签名上传初始化请求"""
|
||||
file_name: str
|
||||
file_size: int
|
||||
expire_value: int = 1
|
||||
expire_style: str = "day"
|
||||
|
||||
|
||||
class PresignUploadInitResponse(BaseModel):
|
||||
"""预签名上传初始化响应"""
|
||||
upload_id: str
|
||||
upload_url: str
|
||||
mode: str # "direct" 或 "proxy"
|
||||
save_path: str
|
||||
expires_in: int # URL过期时间(秒)
|
||||
+34
-12
@@ -1,6 +1,8 @@
|
||||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import uuid
|
||||
from urllib.parse import unquote
|
||||
|
||||
from fastapi import UploadFile, HTTPException
|
||||
from typing import Optional, Tuple
|
||||
@@ -8,7 +10,7 @@ from typing import Optional, Tuple
|
||||
from apps.base.dependencies import IPRateLimit
|
||||
from apps.base.models import FileCodes
|
||||
from core.settings import settings
|
||||
from core.utils import get_random_num, get_random_string, max_save_times_desc
|
||||
from core.utils import get_random_num, get_random_string, max_save_times_desc, sanitize_filename
|
||||
|
||||
|
||||
async def get_file_path_name(file: UploadFile) -> Tuple[str, str, str, str, str]:
|
||||
@@ -16,22 +18,30 @@ async def get_file_path_name(file: UploadFile) -> Tuple[str, str, str, str, str]
|
||||
today = datetime.datetime.now()
|
||||
storage_path = settings.storage_path.strip("/") # 移除开头和结尾的斜杠
|
||||
file_uuid = uuid.uuid4().hex
|
||||
|
||||
# 一些客户端对非ASCII字符会进行编码,需要解码
|
||||
filename = await sanitize_filename(unquote(file.filename))
|
||||
# 使用 UUID 作为子目录名
|
||||
base_path = f"share/data/{today.strftime('%Y/%m/%d')}/{file_uuid}"
|
||||
|
||||
# 如果设置了存储路径,将其添加到基础路径中
|
||||
path = f"{storage_path}/{base_path}" if storage_path else base_path
|
||||
|
||||
prefix, suffix = os.path.splitext(file.filename)
|
||||
prefix, suffix = os.path.splitext(filename)
|
||||
# 保持原始文件名
|
||||
save_path = f"{path}/{file.filename}"
|
||||
return path, suffix, prefix, file.filename, save_path
|
||||
save_path = f"{path}/{filename}"
|
||||
return path, suffix, prefix, filename, save_path
|
||||
|
||||
|
||||
async def get_expire_info(
|
||||
expire_value: int, expire_style: str
|
||||
) -> Tuple[Optional[datetime.datetime], int, int, str]:
|
||||
async def get_chunk_file_path_name(file_name: str, upload_id: str) -> Tuple[str, str, str, str, str]:
|
||||
"""获取切片文件的路径和文件名"""
|
||||
today = datetime.datetime.now()
|
||||
storage_path = settings.storage_path.strip("/") # 移除开头和结尾的斜杠
|
||||
base_path = f"share/data/{today.strftime('%Y/%m/%d')}/{upload_id}"
|
||||
path = f"{storage_path}/{base_path}" if storage_path else base_path
|
||||
prefix, suffix = os.path.splitext(file_name)
|
||||
save_path = f"{path}/{prefix}{suffix}"
|
||||
return path, suffix, prefix, file_name, save_path
|
||||
|
||||
|
||||
async def get_expire_info(expire_value: int, expire_style: str) -> Tuple[Optional[datetime.datetime], int, int, str]:
|
||||
"""获取过期信息"""
|
||||
expired_count, used_count = -1, 0
|
||||
now = datetime.datetime.now()
|
||||
@@ -86,7 +96,19 @@ async def get_random_code(style="num") -> str:
|
||||
return code
|
||||
|
||||
|
||||
async def calculate_file_hash(file: UploadFile, chunk_size=1024 * 1024) -> str:
|
||||
sha = hashlib.sha256()
|
||||
await file.seek(0)
|
||||
while True:
|
||||
chunk = await file.read(chunk_size)
|
||||
if not chunk:
|
||||
break
|
||||
sha.update(chunk)
|
||||
await file.seek(0)
|
||||
return sha.hexdigest()
|
||||
|
||||
|
||||
ip_limit = {
|
||||
"error": IPRateLimit(count=settings.uploadCount, minutes=settings.errorMinute),
|
||||
"upload": IPRateLimit(count=settings.errorCount, minutes=settings.errorMinute),
|
||||
"error": IPRateLimit(count=settings.errorCount, minutes=settings.errorMinute),
|
||||
"upload": IPRateLimit(count=settings.uploadCount, minutes=settings.uploadMinute),
|
||||
}
|
||||
+491
-28
@@ -1,34 +1,95 @@
|
||||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import uuid
|
||||
from datetime import timedelta
|
||||
from urllib.parse import unquote
|
||||
|
||||
from fastapi import APIRouter, Form, UploadFile, File, Depends, HTTPException
|
||||
from apps.admin.dependencies import admin_required
|
||||
from apps.base.models import FileCodes
|
||||
from apps.base.schemas import SelectFileModel
|
||||
from apps.base.utils import get_expire_info, get_file_path_name, ip_limit
|
||||
from starlette import status
|
||||
|
||||
from apps.admin.dependencies import share_required_login
|
||||
from apps.base.models import FileCodes, UploadChunk, PresignUploadSession
|
||||
from apps.base.schemas import SelectFileModel, InitChunkUploadModel, CompleteUploadModel, PresignUploadInitRequest
|
||||
from apps.base.utils import get_expire_info, get_file_path_name, ip_limit, get_chunk_file_path_name
|
||||
from core.response import APIResponse
|
||||
from core.settings import settings
|
||||
from core.storage import storages, FileStorageInterface
|
||||
from core.utils import get_select_token
|
||||
from core.utils import get_select_token, get_now, sanitize_filename
|
||||
|
||||
share_api = APIRouter(prefix="/share", tags=["分享"])
|
||||
|
||||
|
||||
async def validate_file_size(file: UploadFile, max_size: int):
|
||||
if file.size > max_size:
|
||||
# ============ 公共服务层 ============
|
||||
class FileUploadService:
|
||||
"""统一的文件上传服务"""
|
||||
|
||||
@staticmethod
|
||||
async def generate_file_path(file_name: str, upload_id: str = None) -> tuple[str, str, str, str, str]:
|
||||
"""统一的路径生成"""
|
||||
today = datetime.datetime.now()
|
||||
storage_path = settings.storage_path.strip("/")
|
||||
file_uuid = upload_id or uuid.uuid4().hex
|
||||
filename = await sanitize_filename(unquote(file_name))
|
||||
base_path = f"share/data/{today.strftime('%Y/%m/%d')}/{file_uuid}"
|
||||
path = f"{storage_path}/{base_path}" if storage_path else base_path
|
||||
prefix, suffix = os.path.splitext(filename)
|
||||
save_path = f"{path}/{filename}"
|
||||
return path, suffix, prefix, filename, save_path
|
||||
|
||||
@staticmethod
|
||||
async def create_file_record(
|
||||
file_name: str,
|
||||
file_size: int,
|
||||
file_path: str,
|
||||
expire_value: int,
|
||||
expire_style: str,
|
||||
**extra_fields
|
||||
) -> str:
|
||||
"""统一创建FileCodes记录,返回code"""
|
||||
expired_at, expired_count, used_count, code = await get_expire_info(expire_value, expire_style)
|
||||
prefix, suffix = os.path.splitext(file_name)
|
||||
|
||||
await FileCodes.create(
|
||||
code=code,
|
||||
prefix=prefix,
|
||||
suffix=suffix,
|
||||
uuid_file_name=file_name,
|
||||
file_path=file_path,
|
||||
size=file_size,
|
||||
expired_at=expired_at,
|
||||
expired_count=expired_count,
|
||||
used_count=used_count,
|
||||
**extra_fields
|
||||
)
|
||||
return code
|
||||
|
||||
|
||||
async def validate_file_size(file: UploadFile, max_size: int) -> int:
|
||||
size = file.size
|
||||
if size is None:
|
||||
# 读取流计算大小,保持指针复位
|
||||
await file.seek(0, 2)
|
||||
size = file.file.tell()
|
||||
await file.seek(0)
|
||||
if size > max_size:
|
||||
max_size_mb = max_size / (1024 * 1024)
|
||||
raise HTTPException(
|
||||
status_code=403, detail=f"大小超过限制,最大为{max_size_mb:.2f} MB"
|
||||
)
|
||||
return size
|
||||
|
||||
|
||||
async def create_file_code(code, **kwargs):
|
||||
return await FileCodes.create(code=code, **kwargs)
|
||||
|
||||
|
||||
@share_api.post("/text/", dependencies=[Depends(admin_required)])
|
||||
@share_api.post("/text/", dependencies=[Depends(share_required_login)])
|
||||
async def share_text(
|
||||
text: str = Form(...),
|
||||
expire_value: int = Form(default=1, gt=0),
|
||||
expire_style: str = Form(default="day"),
|
||||
ip: str = Depends(ip_limit["upload"]),
|
||||
text: str = Form(...),
|
||||
expire_value: int = Form(default=1, gt=0),
|
||||
expire_style: str = Form(default="day"),
|
||||
ip: str = Depends(ip_limit["upload"]),
|
||||
):
|
||||
text_size = len(text.encode("utf-8"))
|
||||
max_txt_size = 222 * 1024
|
||||
@@ -51,33 +112,27 @@ async def share_text(
|
||||
return APIResponse(detail={"code": code})
|
||||
|
||||
|
||||
@share_api.post("/file/", dependencies=[Depends(admin_required)])
|
||||
@share_api.post("/file/", dependencies=[Depends(share_required_login)])
|
||||
async def share_file(
|
||||
expire_value: int = Form(default=1, gt=0),
|
||||
expire_style: str = Form(default="day"),
|
||||
file: UploadFile = File(...),
|
||||
ip: str = Depends(ip_limit["upload"]),
|
||||
expire_value: int = Form(default=1, gt=0),
|
||||
expire_style: str = Form(default="day"),
|
||||
file: UploadFile = File(...),
|
||||
ip: str = Depends(ip_limit["upload"]),
|
||||
):
|
||||
await validate_file_size(file, settings.uploadSize)
|
||||
|
||||
file_size = await validate_file_size(file, settings.uploadSize)
|
||||
if expire_style not in settings.expireStyle:
|
||||
raise HTTPException(status_code=400, detail="过期时间类型错误")
|
||||
|
||||
expired_at, expired_count, used_count, code = await get_expire_info(
|
||||
expire_value, expire_style
|
||||
)
|
||||
expired_at, expired_count, used_count, code = await get_expire_info(expire_value, expire_style)
|
||||
path, suffix, prefix, uuid_file_name, save_path = await get_file_path_name(file)
|
||||
|
||||
file_storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
await file_storage.save_file(file, save_path)
|
||||
|
||||
await create_file_code(
|
||||
code=code,
|
||||
prefix=prefix,
|
||||
suffix=suffix,
|
||||
uuid_file_name=uuid_file_name,
|
||||
file_path=path,
|
||||
size=file.size,
|
||||
size=file_size,
|
||||
expired_at=expired_at,
|
||||
expired_count=expired_count,
|
||||
used_count=used_count,
|
||||
@@ -142,13 +197,421 @@ async def download_file(key: str, code: str, ip: str = Depends(ip_limit["error"]
|
||||
file_storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
if await get_select_token(code) != key:
|
||||
ip_limit["error"].add_ip(ip)
|
||||
|
||||
raise HTTPException(status_code=403, detail="下载鉴权失败")
|
||||
has, file_code = await get_code_file_by_code(code, False)
|
||||
if not has:
|
||||
return APIResponse(code=404, detail="文件不存在")
|
||||
|
||||
return (
|
||||
APIResponse(detail=file_code.text)
|
||||
if file_code.text
|
||||
else await file_storage.get_file_response(file_code)
|
||||
)
|
||||
|
||||
|
||||
chunk_api = APIRouter(prefix="/chunk", tags=["切片"])
|
||||
|
||||
|
||||
@chunk_api.post("/upload/init/", dependencies=[Depends(share_required_login)])
|
||||
async def init_chunk_upload(data: InitChunkUploadModel):
|
||||
# 服务端校验:根据 total_chunks * chunk_size 计算理论最大上传量
|
||||
total_chunks = (data.file_size + data.chunk_size - 1) // data.chunk_size
|
||||
max_possible_size = total_chunks * data.chunk_size
|
||||
if max_possible_size > settings.uploadSize:
|
||||
max_size_mb = settings.uploadSize / (1024 * 1024)
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
detail=f"文件大小超过限制,最大为 {max_size_mb:.2f} MB"
|
||||
)
|
||||
|
||||
# # 秒传检查
|
||||
# existing = await FileCodes.filter(file_hash=data.file_hash).first()
|
||||
# if existing:
|
||||
# if await existing.is_expired():
|
||||
# file_storage: FileStorageInterface = storages[settings.file_storage](
|
||||
# )
|
||||
# await file_storage.delete_file(existing)
|
||||
# await existing.delete()
|
||||
# else:
|
||||
# return APIResponse(detail={
|
||||
# "code": existing.code,
|
||||
# "existed": True,
|
||||
# "name": f'{existing.prefix}{existing.suffix}'
|
||||
# })
|
||||
|
||||
# 断点续传:检查是否存在相同文件的未完成上传会话
|
||||
existing_session = await UploadChunk.filter(
|
||||
chunk_hash=data.file_hash,
|
||||
chunk_index=-1,
|
||||
file_size=data.file_size,
|
||||
file_name=data.file_name,
|
||||
).first()
|
||||
|
||||
if existing_session:
|
||||
# 复用已有会话,获取已上传的分片列表
|
||||
uploaded_chunks = await UploadChunk.filter(
|
||||
upload_id=existing_session.upload_id,
|
||||
completed=True
|
||||
).values_list('chunk_index', flat=True)
|
||||
return APIResponse(detail={
|
||||
"existed": False,
|
||||
"upload_id": existing_session.upload_id,
|
||||
"chunk_size": existing_session.chunk_size,
|
||||
"total_chunks": existing_session.total_chunks,
|
||||
"uploaded_chunks": list(uploaded_chunks)
|
||||
})
|
||||
|
||||
# 创建新的上传会话
|
||||
upload_id = uuid.uuid4().hex
|
||||
await UploadChunk.create(
|
||||
upload_id=upload_id,
|
||||
chunk_index=-1,
|
||||
total_chunks=total_chunks,
|
||||
file_size=data.file_size,
|
||||
chunk_size=data.chunk_size,
|
||||
chunk_hash=data.file_hash,
|
||||
file_name=data.file_name,
|
||||
)
|
||||
return APIResponse(detail={
|
||||
"existed": False,
|
||||
"upload_id": upload_id,
|
||||
"chunk_size": data.chunk_size,
|
||||
"total_chunks": total_chunks,
|
||||
"uploaded_chunks": []
|
||||
})
|
||||
|
||||
|
||||
@chunk_api.post("/upload/chunk/{upload_id}/{chunk_index}", dependencies=[Depends(share_required_login)])
|
||||
async def upload_chunk(
|
||||
upload_id: str,
|
||||
chunk_index: int,
|
||||
chunk: UploadFile = File(...),
|
||||
):
|
||||
# 获取上传会话信息
|
||||
chunk_info = await UploadChunk.filter(upload_id=upload_id, chunk_index=-1).first()
|
||||
if not chunk_info:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="上传会话不存在")
|
||||
|
||||
# 检查分片索引有效性
|
||||
if chunk_index < 0 or chunk_index >= chunk_info.total_chunks:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, detail="无效的分片索引")
|
||||
|
||||
# 检查是否已上传(支持断点续传)
|
||||
existing_chunk = await UploadChunk.filter(
|
||||
upload_id=upload_id,
|
||||
chunk_index=chunk_index,
|
||||
completed=True
|
||||
).first()
|
||||
if existing_chunk:
|
||||
return APIResponse(detail={"chunk_hash": existing_chunk.chunk_hash, "skipped": True})
|
||||
|
||||
# 读取分片数据并计算哈希
|
||||
chunk_data = await chunk.read()
|
||||
chunk_size = len(chunk_data)
|
||||
|
||||
# 校验分片大小不超过声明的 chunk_size
|
||||
if chunk_size > chunk_info.chunk_size:
|
||||
raise HTTPException(
|
||||
status.HTTP_400_BAD_REQUEST,
|
||||
detail=f"分片大小超过声明值: 最大 {chunk_info.chunk_size}, 实际 {chunk_size}"
|
||||
)
|
||||
|
||||
# 计算已上传分片数,校验累计大小不超限(用分片数 * chunk_size 估算)
|
||||
uploaded_count = await UploadChunk.filter(
|
||||
upload_id=upload_id,
|
||||
completed=True
|
||||
).count()
|
||||
# 已上传分片的最大可能大小 + 当前分片
|
||||
max_uploaded_size = uploaded_count * chunk_info.chunk_size + chunk_size
|
||||
if max_uploaded_size > settings.uploadSize:
|
||||
max_size_mb = settings.uploadSize / (1024 * 1024)
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
detail=f"累计上传大小超过限制,最大为 {max_size_mb:.2f} MB"
|
||||
)
|
||||
|
||||
chunk_hash = hashlib.sha256(chunk_data).hexdigest()
|
||||
|
||||
# 获取文件路径
|
||||
_, _, _, _, save_path = await get_chunk_file_path_name(chunk_info.file_name, upload_id)
|
||||
|
||||
# 保存分片到存储
|
||||
storage = storages[settings.file_storage]()
|
||||
try:
|
||||
await storage.save_chunk(upload_id, chunk_index, chunk_data, chunk_hash, save_path)
|
||||
except Exception as e:
|
||||
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, detail=f"分片保存失败: {str(e)}")
|
||||
|
||||
# 更新或创建分片记录(保存成功后再记录)
|
||||
await UploadChunk.update_or_create(
|
||||
upload_id=upload_id,
|
||||
chunk_index=chunk_index,
|
||||
defaults={
|
||||
'chunk_hash': chunk_hash,
|
||||
'completed': True,
|
||||
'file_size': chunk_info.file_size,
|
||||
'total_chunks': chunk_info.total_chunks,
|
||||
'chunk_size': chunk_info.chunk_size,
|
||||
'file_name': chunk_info.file_name
|
||||
}
|
||||
)
|
||||
return APIResponse(detail={"chunk_hash": chunk_hash})
|
||||
|
||||
|
||||
@chunk_api.delete("/upload/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def cancel_upload(upload_id: str):
|
||||
"""取消上传并清理临时文件"""
|
||||
chunk_info = await UploadChunk.filter(upload_id=upload_id, chunk_index=-1).first()
|
||||
if not chunk_info:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="上传会话不存在")
|
||||
|
||||
# 获取文件路径
|
||||
_, _, _, _, save_path = await get_chunk_file_path_name(chunk_info.file_name, upload_id)
|
||||
|
||||
# 清理存储中的临时文件
|
||||
storage = storages[settings.file_storage]()
|
||||
try:
|
||||
await storage.clean_chunks(upload_id, save_path)
|
||||
except Exception as e:
|
||||
# 记录错误但不阻止删除数据库记录
|
||||
pass
|
||||
|
||||
# 清理数据库记录
|
||||
await UploadChunk.filter(upload_id=upload_id).delete()
|
||||
|
||||
return APIResponse(detail={"message": "上传已取消"})
|
||||
|
||||
|
||||
@chunk_api.get("/upload/status/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def get_upload_status(upload_id: str):
|
||||
"""获取上传状态"""
|
||||
chunk_info = await UploadChunk.filter(upload_id=upload_id, chunk_index=-1).first()
|
||||
if not chunk_info:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="上传会话不存在")
|
||||
|
||||
# 获取已上传的分片列表
|
||||
uploaded_chunks = await UploadChunk.filter(
|
||||
upload_id=upload_id,
|
||||
completed=True
|
||||
).values_list('chunk_index', flat=True)
|
||||
|
||||
return APIResponse(detail={
|
||||
"upload_id": upload_id,
|
||||
"file_name": chunk_info.file_name,
|
||||
"file_size": chunk_info.file_size,
|
||||
"chunk_size": chunk_info.chunk_size,
|
||||
"total_chunks": chunk_info.total_chunks,
|
||||
"uploaded_chunks": list(uploaded_chunks),
|
||||
"progress": len(uploaded_chunks) / chunk_info.total_chunks * 100
|
||||
})
|
||||
|
||||
|
||||
@chunk_api.post("/upload/complete/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def complete_upload(upload_id: str, data: CompleteUploadModel, ip: str = Depends(ip_limit["upload"])):
|
||||
# 获取上传基本信息
|
||||
chunk_info = await UploadChunk.filter(upload_id=upload_id, chunk_index=-1).first()
|
||||
if not chunk_info:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="上传会话不存在")
|
||||
|
||||
storage = storages[settings.file_storage]()
|
||||
# 验证所有分片
|
||||
completed_chunks_list = await UploadChunk.filter(
|
||||
upload_id=upload_id,
|
||||
completed=True
|
||||
).all()
|
||||
if len(completed_chunks_list) != chunk_info.total_chunks:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, detail="分片不完整")
|
||||
|
||||
# 用分片数 * chunk_size 校验最大可能大小
|
||||
max_total_size = len(completed_chunks_list) * chunk_info.chunk_size
|
||||
if max_total_size > settings.uploadSize:
|
||||
# 清理已上传的分片
|
||||
_, _, _, _, save_path = await get_chunk_file_path_name(chunk_info.file_name, upload_id)
|
||||
try:
|
||||
await storage.clean_chunks(upload_id, save_path)
|
||||
except Exception:
|
||||
pass
|
||||
await UploadChunk.filter(upload_id=upload_id).delete()
|
||||
max_size_mb = settings.uploadSize / (1024 * 1024)
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
detail=f"实际上传大小超过限制,最大为 {max_size_mb:.2f} MB"
|
||||
)
|
||||
|
||||
# 获取文件路径
|
||||
path, suffix, prefix, _, save_path = await get_chunk_file_path_name(chunk_info.file_name, upload_id)
|
||||
|
||||
try:
|
||||
# 合并文件并计算哈希
|
||||
_, file_hash = await storage.merge_chunks(upload_id, chunk_info, save_path)
|
||||
# 创建文件记录
|
||||
expired_at, expired_count, used_count, code = await get_expire_info(data.expire_value, data.expire_style)
|
||||
await FileCodes.create(
|
||||
code=code,
|
||||
file_hash=file_hash, # 使用合并后计算的哈希
|
||||
is_chunked=True,
|
||||
upload_id=upload_id,
|
||||
size=chunk_info.file_size,
|
||||
expired_at=expired_at,
|
||||
expired_count=expired_count,
|
||||
used_count=used_count,
|
||||
file_path=path,
|
||||
uuid_file_name=f"{prefix}{suffix}",
|
||||
prefix=prefix,
|
||||
suffix=suffix
|
||||
)
|
||||
# 清理临时文件
|
||||
await storage.clean_chunks(upload_id, save_path)
|
||||
# 清理数据库中的分片记录
|
||||
await UploadChunk.filter(upload_id=upload_id).delete()
|
||||
ip_limit["upload"].add_ip(ip)
|
||||
return APIResponse(detail={"code": code, "name": chunk_info.file_name})
|
||||
except ValueError as e:
|
||||
raise HTTPException(status.HTTP_400_BAD_REQUEST, detail=str(e))
|
||||
except Exception as e:
|
||||
# 合并失败时清理临时文件
|
||||
try:
|
||||
await storage.clean_chunks(upload_id, save_path)
|
||||
except Exception:
|
||||
pass
|
||||
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, detail=f"文件合并失败: {str(e)}")
|
||||
|
||||
|
||||
# ============ 预签名上传API ============
|
||||
presign_api = APIRouter(prefix="/presign", tags=["预签名上传"])
|
||||
|
||||
PRESIGN_SESSION_EXPIRES = 900 # 15分钟
|
||||
|
||||
|
||||
async def _get_valid_session(upload_id: str, expected_mode: str = None) -> PresignUploadSession:
|
||||
"""获取并验证会话"""
|
||||
session = await PresignUploadSession.filter(upload_id=upload_id).first()
|
||||
if not session:
|
||||
raise HTTPException(404, "上传会话不存在")
|
||||
if await session.is_expired():
|
||||
await session.delete()
|
||||
raise HTTPException(404, "上传会话已过期")
|
||||
if expected_mode and session.mode != expected_mode:
|
||||
raise HTTPException(400, f"此会话不支持{expected_mode}模式")
|
||||
return session
|
||||
|
||||
|
||||
@presign_api.post("/upload/init", dependencies=[Depends(share_required_login)])
|
||||
async def presign_upload_init(data: PresignUploadInitRequest, ip: str = Depends(ip_limit["upload"])):
|
||||
"""初始化预签名上传,S3返回直传URL,其他存储返回代理URL"""
|
||||
if data.file_size > settings.uploadSize:
|
||||
raise HTTPException(403, f"文件大小超过限制,最大为 {settings.uploadSize / (1024*1024):.2f} MB")
|
||||
if data.expire_style not in settings.expireStyle:
|
||||
raise HTTPException(400, "过期时间类型错误")
|
||||
|
||||
upload_id = uuid.uuid4().hex
|
||||
path, _, _, filename, save_path = await FileUploadService.generate_file_path(data.file_name, upload_id)
|
||||
|
||||
storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
presigned_url = await storage.generate_presigned_upload_url(save_path, PRESIGN_SESSION_EXPIRES)
|
||||
|
||||
mode = "direct" if presigned_url else "proxy"
|
||||
upload_url = presigned_url or f"/api/presign/upload/proxy/{upload_id}"
|
||||
|
||||
await PresignUploadSession.create(
|
||||
upload_id=upload_id,
|
||||
file_name=filename,
|
||||
file_size=data.file_size,
|
||||
save_path=save_path,
|
||||
mode=mode,
|
||||
expire_value=data.expire_value,
|
||||
expire_style=data.expire_style,
|
||||
expires_at=await get_now() + timedelta(seconds=PRESIGN_SESSION_EXPIRES),
|
||||
)
|
||||
|
||||
ip_limit["upload"].add_ip(ip)
|
||||
return APIResponse(detail={
|
||||
"upload_id": upload_id,
|
||||
"upload_url": upload_url,
|
||||
"mode": mode,
|
||||
"expires_in": PRESIGN_SESSION_EXPIRES,
|
||||
})
|
||||
|
||||
|
||||
@presign_api.put("/upload/proxy/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def presign_upload_proxy(upload_id: str, file: UploadFile = File(...), ip: str = Depends(ip_limit["upload"])):
|
||||
"""代理模式上传,服务器转存到存储后端"""
|
||||
session = await _get_valid_session(upload_id, expected_mode="proxy")
|
||||
|
||||
file_size = await validate_file_size(file, settings.uploadSize)
|
||||
if abs(file_size - session.file_size) > 1024:
|
||||
raise HTTPException(400, "文件大小与声明不符")
|
||||
|
||||
storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
try:
|
||||
await storage.save_file(file, session.save_path)
|
||||
except Exception as e:
|
||||
raise HTTPException(500, f"文件保存失败: {str(e)}")
|
||||
|
||||
code = await FileUploadService.create_file_record(
|
||||
session.file_name, file_size, os.path.dirname(session.save_path),
|
||||
session.expire_value, session.expire_style
|
||||
)
|
||||
|
||||
await session.delete()
|
||||
ip_limit["upload"].add_ip(ip)
|
||||
return APIResponse(detail={"code": code, "name": session.file_name})
|
||||
|
||||
|
||||
@presign_api.post("/upload/confirm/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def presign_upload_confirm(upload_id: str, ip: str = Depends(ip_limit["upload"])):
|
||||
"""直传确认,客户端完成S3直传后调用获取分享码"""
|
||||
session = await _get_valid_session(upload_id, expected_mode="direct")
|
||||
|
||||
storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
if not await storage.file_exists(session.save_path):
|
||||
raise HTTPException(404, "文件未上传或上传失败")
|
||||
|
||||
code = await FileUploadService.create_file_record(
|
||||
session.file_name, session.file_size, os.path.dirname(session.save_path),
|
||||
session.expire_value, session.expire_style
|
||||
)
|
||||
|
||||
await session.delete()
|
||||
ip_limit["upload"].add_ip(ip)
|
||||
return APIResponse(detail={"code": code, "name": session.file_name})
|
||||
|
||||
|
||||
@presign_api.get("/upload/status/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def presign_upload_status(upload_id: str):
|
||||
"""查询上传会话状态"""
|
||||
session = await PresignUploadSession.filter(upload_id=upload_id).first()
|
||||
if not session:
|
||||
raise HTTPException(404, "上传会话不存在")
|
||||
|
||||
return APIResponse(detail={
|
||||
"upload_id": session.upload_id,
|
||||
"file_name": session.file_name,
|
||||
"file_size": session.file_size,
|
||||
"mode": session.mode,
|
||||
"created_at": session.created_at.isoformat(),
|
||||
"expires_at": session.expires_at.isoformat(),
|
||||
"is_expired": await session.is_expired(),
|
||||
})
|
||||
|
||||
|
||||
@presign_api.delete("/upload/{upload_id}", dependencies=[Depends(share_required_login)])
|
||||
async def presign_upload_cancel(upload_id: str):
|
||||
"""取消上传会话"""
|
||||
session = await PresignUploadSession.filter(upload_id=upload_id).first()
|
||||
if not session:
|
||||
raise HTTPException(404, "上传会话不存在")
|
||||
|
||||
if session.mode == "direct":
|
||||
storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
try:
|
||||
if await storage.file_exists(session.save_path):
|
||||
temp_file_code = FileCodes(
|
||||
file_path=os.path.dirname(session.save_path),
|
||||
uuid_file_name=os.path.basename(session.save_path),
|
||||
)
|
||||
await storage.delete_file(temp_file_code)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
await session.delete()
|
||||
return APIResponse(detail={"message": "上传会话已取消"})
|
||||
+6
-5
@@ -4,6 +4,7 @@ import os
|
||||
|
||||
from tortoise import Tortoise
|
||||
|
||||
from core.logger import logger
|
||||
from core.settings import data_root
|
||||
|
||||
|
||||
@@ -32,7 +33,7 @@ async def init_db():
|
||||
await execute_migrations()
|
||||
|
||||
except Exception as e:
|
||||
print(f"数据库初始化失败: {str(e)}")
|
||||
logger.error(f"数据库初始化失败: {str(e)}")
|
||||
raise
|
||||
|
||||
|
||||
@@ -58,7 +59,7 @@ async def execute_migrations():
|
||||
)
|
||||
|
||||
if not executed[1]:
|
||||
print(f"执行迁移: {file_name}")
|
||||
logger.info(f"执行迁移: {file_name}")
|
||||
# 导入并执行migration
|
||||
module_path = migration_file.replace("/", ".").replace("\\", ".").replace(".py", "")
|
||||
try:
|
||||
@@ -70,11 +71,11 @@ async def execute_migrations():
|
||||
"INSERT INTO migrates (migration_file) VALUES (?)",
|
||||
[file_name]
|
||||
)
|
||||
print(f"迁移完成: {file_name}")
|
||||
logger.info(f"迁移完成: {file_name}")
|
||||
except Exception as e:
|
||||
print(f"迁移 {file_name} 执行失败: {str(e)}")
|
||||
logger.error(f"迁移 {file_name} 执行失败: {str(e)}")
|
||||
raise
|
||||
|
||||
except Exception as e:
|
||||
print(f"迁移过程发生错误: {str(e)}")
|
||||
logger.error(f"迁移过程发生错误: {str(e)}")
|
||||
raise
|
||||
@@ -0,0 +1,28 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
|
||||
def setup_logger():
|
||||
# 创建logger对象
|
||||
_logger = logging.getLogger('FileCodeBox')
|
||||
_logger.setLevel(logging.INFO)
|
||||
|
||||
# 创建控制台处理器
|
||||
console_handler = logging.StreamHandler(sys.stdout)
|
||||
console_handler.setLevel(logging.INFO)
|
||||
|
||||
# 设置日志格式
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
console_handler.setFormatter(formatter)
|
||||
|
||||
# 添加处理器到logger
|
||||
_logger.addHandler(console_handler)
|
||||
|
||||
return _logger
|
||||
|
||||
|
||||
# 创建全局logger实例
|
||||
logger = setup_logger()
|
||||
+4
-2
@@ -35,7 +35,6 @@ DEFAULT_CONFIG = {
|
||||
"onedrive_password": "",
|
||||
"onedrive_root_path": "filebox_storage",
|
||||
"onedrive_proxy": 0,
|
||||
"webdav_hostname": "",
|
||||
"webdav_root_path": "filebox_storage",
|
||||
"webdav_proxy": 0,
|
||||
"admin_token": "FileCodeBox2023",
|
||||
@@ -43,6 +42,7 @@ DEFAULT_CONFIG = {
|
||||
"uploadSize": 1024 * 1024 * 10,
|
||||
"expireStyle": ["day", "hour", "minute", "forever", "count"],
|
||||
"uploadMinute": 1,
|
||||
"enableChunk": 0,
|
||||
"webdav_url": "",
|
||||
"webdav_password": "",
|
||||
"webdav_username": "",
|
||||
@@ -66,7 +66,9 @@ DEFAULT_CONFIG = {
|
||||
"themesSelect": "themes/2024",
|
||||
"errorMinute": 1,
|
||||
"errorCount": 1,
|
||||
"port": 12345,
|
||||
"serverWorkers": 1,
|
||||
"serverHost": "0.0.0.0",
|
||||
"serverPort": 12345,
|
||||
"showAdminAddr": 0,
|
||||
"robotsText": "User-agent: *\nDisallow: /",
|
||||
}
|
||||
|
||||
+623
-37
@@ -2,34 +2,31 @@
|
||||
# @Author : Lan
|
||||
# @File : storage.py
|
||||
# @Software: PyCharm
|
||||
import base64
|
||||
import hashlib
|
||||
from core.logger import logger
|
||||
import shutil
|
||||
from typing import Optional
|
||||
from urllib.parse import quote, unquote
|
||||
|
||||
import aiofiles
|
||||
import aiohttp
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
import datetime
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
import aioboto3
|
||||
from botocore.config import Config
|
||||
from fastapi import HTTPException, Response, UploadFile
|
||||
from core.response import APIResponse
|
||||
from core.settings import data_root, settings
|
||||
from apps.base.models import FileCodes
|
||||
from core.utils import get_file_url
|
||||
from apps.base.models import FileCodes, UploadChunk
|
||||
from core.utils import get_file_url, sanitize_filename
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
|
||||
class FileStorageInterface:
|
||||
_instance: Optional["FileStorageInterface"] = None
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if cls._instance is None:
|
||||
cls._instance = super(FileStorageInterface, cls).__new__(
|
||||
cls, *args, **kwargs
|
||||
)
|
||||
return cls._instance
|
||||
|
||||
async def save_file(self, file: UploadFile, save_path: str):
|
||||
"""
|
||||
@@ -61,6 +58,52 @@ class FileStorageInterface:
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str):
|
||||
"""
|
||||
保存分片文件
|
||||
:param upload_id: 上传会话ID
|
||||
:param chunk_index: 分片索引
|
||||
:param chunk_data: 分片数据
|
||||
:param chunk_hash: 分片哈希值
|
||||
:param save_path: 文件保存路径
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]:
|
||||
"""
|
||||
合并分片文件并返回文件路径和完整哈希值
|
||||
:param upload_id: 上传会话ID
|
||||
:param chunk_info: 分片信息
|
||||
:param save_path: 文件保存路径
|
||||
:return: (文件路径, 文件哈希值)
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def generate_presigned_upload_url(self, save_path: str, expires_in: int = 900) -> Optional[str]:
|
||||
"""
|
||||
生成预签名上传URL
|
||||
:param save_path: 文件保存路径
|
||||
:param expires_in: URL过期时间(秒),默认15分钟
|
||||
:return: 预签名URL,如果不支持直传则返回None
|
||||
"""
|
||||
return None # 默认不支持直传,使用代理模式
|
||||
|
||||
async def file_exists(self, save_path: str) -> bool:
|
||||
"""
|
||||
检查文件是否存在
|
||||
:param save_path: 文件路径
|
||||
:return: 文件是否存在
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def clean_chunks(self, upload_id: str, save_path: str):
|
||||
"""
|
||||
清理临时分片文件
|
||||
:param upload_id: 上传会话ID
|
||||
:param save_path: 文件保存路径
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class SystemFileStorage(FileStorageInterface):
|
||||
def __init__(self):
|
||||
@@ -75,10 +118,16 @@ class SystemFileStorage(FileStorageInterface):
|
||||
chunk = file.read(self.chunk_size)
|
||||
|
||||
async def save_file(self, file: UploadFile, save_path: str):
|
||||
save_path = self.root_path / save_path
|
||||
if not save_path.parent.exists():
|
||||
save_path.parent.mkdir(parents=True)
|
||||
await asyncio.to_thread(self._save, file.file, save_path)
|
||||
path_obj = Path(save_path)
|
||||
directory = str(path_obj.parent)
|
||||
# 提取原始文件名并进行清理
|
||||
filename = await sanitize_filename(path_obj.name)
|
||||
# 构建安全的完整保存路径
|
||||
safe_save_path = self.root_path / directory / filename
|
||||
# 确保目录存在
|
||||
if not safe_save_path.parent.exists():
|
||||
safe_save_path.parent.mkdir(parents=True)
|
||||
await asyncio.to_thread(self._save, file.file, safe_save_path)
|
||||
|
||||
async def delete_file(self, file_code: FileCodes):
|
||||
save_path = self.root_path / await file_code.get_file_path()
|
||||
@@ -97,10 +146,105 @@ class SystemFileStorage(FileStorageInterface):
|
||||
content_disposition = f"attachment; filename*=UTF-8''{encoded_filename}"
|
||||
return FileResponse(
|
||||
file_path,
|
||||
media_type="application/octet-stream",
|
||||
headers={"Content-Disposition": content_disposition},
|
||||
filename=filename # 保留原始文件名以备某些场景使用
|
||||
)
|
||||
|
||||
async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str):
|
||||
"""
|
||||
保存分片文件到本地文件系统
|
||||
:param upload_id: 上传会话ID
|
||||
:param chunk_index: 分片索引
|
||||
:param chunk_data: 分片数据
|
||||
:param chunk_hash: 分片哈希值
|
||||
:param save_path: 文件保存路径
|
||||
"""
|
||||
chunk_dir = self.root_path / save_path
|
||||
chunk_path = chunk_dir.parent / 'chunks' / upload_id / f"{chunk_index}.part"
|
||||
if not chunk_path.parent.exists():
|
||||
chunk_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
# 使用临时文件写入,确保原子性
|
||||
temp_path = chunk_path.with_suffix('.tmp')
|
||||
try:
|
||||
async with aiofiles.open(temp_path, "wb") as f:
|
||||
await f.write(chunk_data)
|
||||
# 原子重命名
|
||||
temp_path.rename(chunk_path)
|
||||
except Exception as e:
|
||||
if temp_path.exists():
|
||||
temp_path.unlink()
|
||||
raise e
|
||||
|
||||
async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]:
|
||||
"""
|
||||
合并本地文件系统的分片文件并返回文件路径和完整哈希值
|
||||
:param upload_id: 上传会话ID
|
||||
:param chunk_info: 分片信息
|
||||
:param save_path: 文件保存路径
|
||||
:return: (文件路径, 文件哈希值)
|
||||
"""
|
||||
output_path = self.root_path / save_path
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
chunk_base_dir = output_path.parent / 'chunks' / upload_id
|
||||
file_sha256 = hashlib.sha256()
|
||||
|
||||
# 使用临时文件写入,确保原子性
|
||||
temp_output = output_path.with_suffix('.merging')
|
||||
try:
|
||||
async with aiofiles.open(temp_output, "wb") as out_file:
|
||||
for i in range(chunk_info.total_chunks):
|
||||
# 获取分片记录
|
||||
chunk_record = await UploadChunk.filter(upload_id=upload_id, chunk_index=i).first()
|
||||
if not chunk_record:
|
||||
raise ValueError(f"分片{i}记录不存在")
|
||||
chunk_path = chunk_base_dir / f"{i}.part"
|
||||
if not chunk_path.exists():
|
||||
raise ValueError(f"分片{i}文件不存在")
|
||||
async with aiofiles.open(chunk_path, "rb") as in_file:
|
||||
chunk_data = await in_file.read()
|
||||
current_hash = hashlib.sha256(chunk_data).hexdigest()
|
||||
if current_hash != chunk_record.chunk_hash:
|
||||
raise ValueError(f"分片{i}哈希不匹配: 期望 {chunk_record.chunk_hash}, 实际 {current_hash}")
|
||||
file_sha256.update(chunk_data)
|
||||
await out_file.write(chunk_data)
|
||||
# 原子重命名
|
||||
temp_output.rename(output_path)
|
||||
except Exception as e:
|
||||
if temp_output.exists():
|
||||
temp_output.unlink()
|
||||
raise e
|
||||
return str(output_path), file_sha256.hexdigest()
|
||||
|
||||
async def clean_chunks(self, upload_id: str, save_path: str):
|
||||
"""
|
||||
清理本地文件系统的临时分片文件
|
||||
:param upload_id: 上传会话ID
|
||||
:param save_path: 文件保存路径
|
||||
"""
|
||||
chunk_dir = (self.root_path / save_path).parent / 'chunks' / upload_id
|
||||
if chunk_dir.exists():
|
||||
try:
|
||||
shutil.rmtree(chunk_dir)
|
||||
except Exception as e:
|
||||
logger.info(f"清理本地分片目录失败: {e}")
|
||||
# 清理父级 chunks 目录(如果为空)
|
||||
chunks_parent = chunk_dir.parent
|
||||
if chunks_parent.exists() and not any(chunks_parent.iterdir()):
|
||||
try:
|
||||
chunks_parent.rmdir()
|
||||
except Exception as e:
|
||||
logger.info(f"清理 chunks 父目录失败: {e}")
|
||||
|
||||
async def file_exists(self, save_path: str) -> bool:
|
||||
"""
|
||||
检查文件是否存在于本地文件系统
|
||||
:param save_path: 文件路径
|
||||
:return: 文件是否存在
|
||||
"""
|
||||
file_path = self.root_path / save_path
|
||||
return file_path.exists()
|
||||
|
||||
|
||||
class S3FileStorage(FileStorageInterface):
|
||||
def __init__(self):
|
||||
@@ -205,6 +349,150 @@ class S3FileStorage(FileStorageInterface):
|
||||
)
|
||||
return result
|
||||
|
||||
async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str):
|
||||
"""
|
||||
保存分片到 S3(使用独立对象存储每个分片)
|
||||
注意:这里不使用 S3 原生的 multipart upload,而是将每个分片作为独立对象存储
|
||||
"""
|
||||
chunk_key = str(Path(save_path).parent / "chunks" / upload_id / f"{chunk_index}.part")
|
||||
async with self.session.client(
|
||||
's3',
|
||||
endpoint_url=self.endpoint_url,
|
||||
aws_session_token=self.aws_session_token,
|
||||
region_name=self.region_name,
|
||||
config=Config(signature_version=self.signature_version),
|
||||
) as s3:
|
||||
# 将分片作为独立对象上传
|
||||
await s3.put_object(
|
||||
Bucket=self.bucket_name,
|
||||
Key=chunk_key,
|
||||
Body=chunk_data,
|
||||
Metadata={
|
||||
'chunk-hash': chunk_hash,
|
||||
'chunk-index': str(chunk_index)
|
||||
}
|
||||
)
|
||||
|
||||
async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]:
|
||||
"""
|
||||
合并 S3 上的分片文件
|
||||
由于分片是独立对象存储的,需要下载后合并再上传
|
||||
"""
|
||||
file_sha256 = hashlib.sha256()
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
merged_data = io.BytesIO()
|
||||
|
||||
async with self.session.client(
|
||||
's3',
|
||||
endpoint_url=self.endpoint_url,
|
||||
aws_session_token=self.aws_session_token,
|
||||
region_name=self.region_name,
|
||||
config=Config(signature_version=self.signature_version),
|
||||
) as s3:
|
||||
# 按顺序读取并验证每个分片
|
||||
for i in range(chunk_info.total_chunks):
|
||||
chunk_key = f"{chunk_dir}/{i}.part"
|
||||
chunk_record = await UploadChunk.filter(upload_id=upload_id, chunk_index=i).first()
|
||||
if not chunk_record:
|
||||
raise ValueError(f"分片{i}记录不存在")
|
||||
|
||||
try:
|
||||
response = await s3.get_object(
|
||||
Bucket=self.bucket_name,
|
||||
Key=chunk_key
|
||||
)
|
||||
chunk_data = await response['Body'].read()
|
||||
except Exception as e:
|
||||
raise ValueError(f"分片{i}文件不存在: {e}")
|
||||
|
||||
current_hash = hashlib.sha256(chunk_data).hexdigest()
|
||||
if current_hash != chunk_record.chunk_hash:
|
||||
raise ValueError(f"分片{i}哈希不匹配: 期望 {chunk_record.chunk_hash}, 实际 {current_hash}")
|
||||
|
||||
file_sha256.update(chunk_data)
|
||||
merged_data.write(chunk_data)
|
||||
|
||||
# 上传合并后的文件
|
||||
merged_data.seek(0)
|
||||
await s3.put_object(
|
||||
Bucket=self.bucket_name,
|
||||
Key=save_path,
|
||||
Body=merged_data.getvalue(),
|
||||
ContentType='application/octet-stream'
|
||||
)
|
||||
|
||||
return save_path, file_sha256.hexdigest()
|
||||
|
||||
async def clean_chunks(self, upload_id: str, save_path: str):
|
||||
"""
|
||||
清理 S3 上的临时分片文件
|
||||
:param upload_id: 上传会话ID
|
||||
:param save_path: 文件保存路径
|
||||
"""
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
async with self.session.client(
|
||||
's3',
|
||||
endpoint_url=self.endpoint_url,
|
||||
aws_session_token=self.aws_session_token,
|
||||
region_name=self.region_name,
|
||||
config=Config(signature_version=self.signature_version),
|
||||
) as s3:
|
||||
try:
|
||||
# 列出并删除所有分片对象
|
||||
paginator = s3.get_paginator('list_objects_v2')
|
||||
async for page in paginator.paginate(Bucket=self.bucket_name, Prefix=chunk_dir):
|
||||
objects = page.get('Contents', [])
|
||||
if objects:
|
||||
delete_objects = [{'Key': obj['Key']} for obj in objects]
|
||||
await s3.delete_objects(
|
||||
Bucket=self.bucket_name,
|
||||
Delete={'Objects': delete_objects}
|
||||
)
|
||||
except Exception as e:
|
||||
logger.info(f"清理 S3 分片数据时出错: {e}")
|
||||
|
||||
async def generate_presigned_upload_url(self, save_path: str, expires_in: int = 900) -> Optional[str]:
|
||||
"""
|
||||
生成S3预签名上传URL
|
||||
:param save_path: 文件保存路径
|
||||
:param expires_in: URL过期时间(秒),默认15分钟
|
||||
:return: 预签名PUT URL
|
||||
"""
|
||||
async with self.session.client(
|
||||
"s3",
|
||||
endpoint_url=self.endpoint_url,
|
||||
aws_session_token=self.aws_session_token,
|
||||
region_name=self.region_name,
|
||||
config=Config(signature_version=self.signature_version),
|
||||
) as s3:
|
||||
return await s3.generate_presigned_url(
|
||||
"put_object",
|
||||
Params={
|
||||
"Bucket": self.bucket_name,
|
||||
"Key": save_path,
|
||||
},
|
||||
ExpiresIn=expires_in,
|
||||
)
|
||||
|
||||
async def file_exists(self, save_path: str) -> bool:
|
||||
"""
|
||||
检查文件是否存在于S3
|
||||
:param save_path: 文件路径
|
||||
:return: 文件是否存在
|
||||
"""
|
||||
async with self.session.client(
|
||||
"s3",
|
||||
endpoint_url=self.endpoint_url,
|
||||
aws_session_token=self.aws_session_token,
|
||||
region_name=self.region_name,
|
||||
config=Config(signature_version=self.signature_version),
|
||||
) as s3:
|
||||
try:
|
||||
await s3.head_object(Bucket=self.bucket_name, Key=save_path)
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
class OneDriveFileStorage(FileStorageInterface):
|
||||
def __init__(self):
|
||||
@@ -235,7 +523,8 @@ class OneDriveFileStorage(FileStorageInterface):
|
||||
if e.code == "itemNotFound":
|
||||
client.me.drive.root.create_folder(settings.onedrive_root_path)
|
||||
self.root_path = (
|
||||
client.me.drive.root.get_by_path(settings.onedrive_root_path)
|
||||
client.me.drive.root.get_by_path(
|
||||
settings.onedrive_root_path)
|
||||
.get()
|
||||
.execute_query()
|
||||
)
|
||||
@@ -268,7 +557,7 @@ class OneDriveFileStorage(FileStorageInterface):
|
||||
|
||||
def _save(self, file, save_path):
|
||||
content = file.file.read()
|
||||
name = file.filename
|
||||
name = save_path(file.filename)
|
||||
path = self._get_path_str(save_path)
|
||||
self.root_path.get_by_path(path).upload(name, content).execute_query()
|
||||
|
||||
@@ -289,9 +578,9 @@ class OneDriveFileStorage(FileStorageInterface):
|
||||
await asyncio.to_thread(self._delete, await file_code.get_file_path())
|
||||
|
||||
def _convert_link_to_download_link(self, link):
|
||||
p1 = re.search(r"https:\/\/(.+)\.sharepoint\.com", link).group(1)
|
||||
p2 = re.search(r"personal\/(.+)\/", link).group(1)
|
||||
p3 = re.search(rf"{p2}\/(.+)", link).group(1)
|
||||
p1 = re.search(r"https://(.+)\.sharepoint\.com", link).group(1)
|
||||
p2 = re.search(r"personal/(.+)/", link).group(1)
|
||||
p3 = re.search(rf"{p2}/(.+)", link).group(1)
|
||||
return f"https://{p1}.sharepoint.com/personal/{p2}/_layouts/52/download.aspx?share={p3}"
|
||||
|
||||
def _get_file_url(self, save_path, name):
|
||||
@@ -300,11 +589,12 @@ class OneDriveFileStorage(FileStorageInterface):
|
||||
expiration_datetime = datetime.datetime.now(
|
||||
tz=datetime.timezone.utc
|
||||
) + datetime.timedelta(hours=1)
|
||||
expiration_datetime = expiration_datetime.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
premission = remote_file.create_link(
|
||||
expiration_datetime = expiration_datetime.strftime(
|
||||
"%Y-%m-%dT%H:%M:%SZ")
|
||||
permission = remote_file.create_link(
|
||||
"view", "anonymous", expiration_datetime=expiration_datetime
|
||||
).execute_query()
|
||||
return self._convert_link_to_download_link(premission.link.webUrl)
|
||||
return self._convert_link_to_download_link(permission.link.webUrl)
|
||||
|
||||
async def get_file_response(self, file_code: FileCodes):
|
||||
try:
|
||||
@@ -339,6 +629,124 @@ class OneDriveFileStorage(FileStorageInterface):
|
||||
f"{file_code.prefix}{file_code.suffix}",
|
||||
)
|
||||
|
||||
def _save_chunk(self, chunk_path: str, chunk_data: bytes):
|
||||
"""同步保存分片到 OneDrive"""
|
||||
path_parts = chunk_path.replace("\\", "/").split("/")
|
||||
filename = path_parts[-1]
|
||||
dir_path = "/".join(path_parts[:-1])
|
||||
|
||||
# 确保目录存在
|
||||
current_folder = self.root_path
|
||||
for part in dir_path.split("/"):
|
||||
if part:
|
||||
try:
|
||||
current_folder = current_folder.get_by_path(part).get().execute_query()
|
||||
except self._ClientRequestException as e:
|
||||
if e.code == "itemNotFound":
|
||||
current_folder = current_folder.create_folder(part).execute_query()
|
||||
else:
|
||||
raise e
|
||||
|
||||
# 上传分片
|
||||
current_folder.upload(filename, chunk_data).execute_query()
|
||||
|
||||
async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str):
|
||||
"""保存分片到 OneDrive"""
|
||||
chunk_path = str(Path(save_path).parent / "chunks" / upload_id / f"{chunk_index}.part")
|
||||
await asyncio.to_thread(self._save_chunk, chunk_path, chunk_data)
|
||||
|
||||
def _read_chunk(self, chunk_path: str) -> bytes:
|
||||
"""同步读取分片"""
|
||||
path = self._get_path_str(chunk_path)
|
||||
file_obj = self.root_path.get_by_path(path).get().execute_query()
|
||||
return file_obj.get_content().execute_query().value
|
||||
|
||||
def _upload_merged(self, save_path: str, data: bytes):
|
||||
"""同步上传合并后的文件"""
|
||||
path_parts = save_path.replace("\\", "/").split("/")
|
||||
filename = path_parts[-1]
|
||||
dir_path = "/".join(path_parts[:-1])
|
||||
|
||||
# 确保目录存在
|
||||
current_folder = self.root_path
|
||||
for part in dir_path.split("/"):
|
||||
if part:
|
||||
try:
|
||||
current_folder = current_folder.get_by_path(part).get().execute_query()
|
||||
except self._ClientRequestException as e:
|
||||
if e.code == "itemNotFound":
|
||||
current_folder = current_folder.create_folder(part).execute_query()
|
||||
else:
|
||||
raise e
|
||||
|
||||
current_folder.upload(filename, data).execute_query()
|
||||
|
||||
async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]:
|
||||
"""合并 OneDrive 上的分片文件"""
|
||||
file_sha256 = hashlib.sha256()
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
merged_data = io.BytesIO()
|
||||
|
||||
for i in range(chunk_info.total_chunks):
|
||||
chunk_path = f"{chunk_dir}/{i}.part"
|
||||
chunk_record = await UploadChunk.filter(upload_id=upload_id, chunk_index=i).first()
|
||||
if not chunk_record:
|
||||
raise ValueError(f"分片{i}记录不存在")
|
||||
|
||||
try:
|
||||
chunk_data = await asyncio.to_thread(self._read_chunk, chunk_path)
|
||||
except Exception as e:
|
||||
raise ValueError(f"分片{i}文件不存在: {e}")
|
||||
|
||||
current_hash = hashlib.sha256(chunk_data).hexdigest()
|
||||
if current_hash != chunk_record.chunk_hash:
|
||||
raise ValueError(f"分片{i}哈希不匹配: 期望 {chunk_record.chunk_hash}, 实际 {current_hash}")
|
||||
|
||||
file_sha256.update(chunk_data)
|
||||
merged_data.write(chunk_data)
|
||||
|
||||
# 上传合并后的文件
|
||||
merged_data.seek(0)
|
||||
await asyncio.to_thread(self._upload_merged, save_path, merged_data.getvalue())
|
||||
|
||||
return save_path, file_sha256.hexdigest()
|
||||
|
||||
def _delete_chunk_dir(self, chunk_dir: str):
|
||||
"""同步删除分片目录"""
|
||||
try:
|
||||
path = self._get_path_str(chunk_dir)
|
||||
self.root_path.get_by_path(path).delete_object().execute_query()
|
||||
except self._ClientRequestException as e:
|
||||
if e.code != "itemNotFound":
|
||||
raise e
|
||||
|
||||
async def clean_chunks(self, upload_id: str, save_path: str):
|
||||
"""清理 OneDrive 上的临时分片文件"""
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
try:
|
||||
await asyncio.to_thread(self._delete_chunk_dir, chunk_dir)
|
||||
except Exception as e:
|
||||
logger.info(f"清理 OneDrive 分片时出错: {e}")
|
||||
|
||||
def _file_exists(self, save_path: str) -> bool:
|
||||
"""同步检查文件是否存在"""
|
||||
try:
|
||||
path = self._get_path_str(save_path)
|
||||
self.root_path.get_by_path(path).get().execute_query()
|
||||
return True
|
||||
except self._ClientRequestException as e:
|
||||
if e.code == "itemNotFound":
|
||||
return False
|
||||
raise e
|
||||
|
||||
async def file_exists(self, save_path: str) -> bool:
|
||||
"""
|
||||
检查文件是否存在于OneDrive
|
||||
:param save_path: 文件路径
|
||||
:return: 文件是否存在
|
||||
"""
|
||||
return await asyncio.to_thread(self._file_exists, save_path)
|
||||
|
||||
|
||||
class OpenDALFileStorage(FileStorageInterface):
|
||||
def __init__(self):
|
||||
@@ -369,14 +777,71 @@ class OpenDALFileStorage(FileStorageInterface):
|
||||
try:
|
||||
filename = file_code.prefix + file_code.suffix
|
||||
content = await self.operator.read(await file_code.get_file_path())
|
||||
headers = {"Content-Disposition": f'attachment; filename="{filename}"'}
|
||||
headers = {
|
||||
"Content-Disposition": f'attachment; filename="{filename}"'}
|
||||
return Response(
|
||||
content, headers=headers, media_type="application/octet-stream"
|
||||
)
|
||||
except Exception as e:
|
||||
print(e, file=sys.stderr)
|
||||
logger.info(e)
|
||||
raise HTTPException(status_code=404, detail="文件已过期删除")
|
||||
|
||||
async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str):
|
||||
"""保存分片到 OpenDAL 存储"""
|
||||
chunk_path = str(Path(save_path).parent / "chunks" / upload_id / f"{chunk_index}.part")
|
||||
await self.operator.write(chunk_path, chunk_data)
|
||||
|
||||
async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]:
|
||||
"""合并 OpenDAL 存储上的分片文件"""
|
||||
file_sha256 = hashlib.sha256()
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
merged_data = io.BytesIO()
|
||||
|
||||
for i in range(chunk_info.total_chunks):
|
||||
chunk_path = f"{chunk_dir}/{i}.part"
|
||||
chunk_record = await UploadChunk.filter(upload_id=upload_id, chunk_index=i).first()
|
||||
if not chunk_record:
|
||||
raise ValueError(f"分片{i}记录不存在")
|
||||
|
||||
try:
|
||||
chunk_data = await self.operator.read(chunk_path)
|
||||
except Exception as e:
|
||||
raise ValueError(f"分片{i}文件不存在: {e}")
|
||||
|
||||
current_hash = hashlib.sha256(chunk_data).hexdigest()
|
||||
if current_hash != chunk_record.chunk_hash:
|
||||
raise ValueError(f"分片{i}哈希不匹配: 期望 {chunk_record.chunk_hash}, 实际 {current_hash}")
|
||||
|
||||
file_sha256.update(chunk_data)
|
||||
merged_data.write(chunk_data)
|
||||
|
||||
# 写入合并后的文件
|
||||
merged_data.seek(0)
|
||||
await self.operator.write(save_path, merged_data.getvalue())
|
||||
|
||||
return save_path, file_sha256.hexdigest()
|
||||
|
||||
async def clean_chunks(self, upload_id: str, save_path: str):
|
||||
"""清理 OpenDAL 存储上的临时分片文件"""
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
try:
|
||||
# OpenDAL 支持递归删除
|
||||
await self.operator.remove_all(chunk_dir)
|
||||
except Exception as e:
|
||||
logger.info(f"清理 OpenDAL 分片时出错: {e}")
|
||||
|
||||
async def file_exists(self, save_path: str) -> bool:
|
||||
"""
|
||||
检查文件是否存在于OpenDAL存储
|
||||
:param save_path: 文件路径
|
||||
:return: 文件是否存在
|
||||
"""
|
||||
try:
|
||||
await self.operator.stat(save_path)
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
class WebDAVFileStorage(FileStorageInterface):
|
||||
_instance: Optional["WebDAVFileStorage"] = None
|
||||
@@ -390,7 +855,7 @@ class WebDAVFileStorage(FileStorageInterface):
|
||||
self._initialized = True
|
||||
|
||||
def _build_url(self, path: str) -> str:
|
||||
encoded_path = quote(str(path).lstrip("/"))
|
||||
encoded_path = quote(str(path.replace("\\", "/").lstrip("/")).lstrip("/"))
|
||||
return f"{self.base_url}{encoded_path}"
|
||||
|
||||
async def _mkdir_p(self, directory_path: str):
|
||||
@@ -446,20 +911,23 @@ class WebDAVFileStorage(FileStorageInterface):
|
||||
|
||||
async def save_file(self, file: UploadFile, save_path: str):
|
||||
"""保存文件(自动创建目录)"""
|
||||
# 分离文件名和目录路径
|
||||
path_obj = Path(save_path)
|
||||
directory_path = str(path_obj.parent)
|
||||
# 提取原始文件名并进行清理
|
||||
filename = await sanitize_filename(path_obj.name)
|
||||
# 构建安全的保存路径
|
||||
safe_save_path = str(Path(directory_path) / filename)
|
||||
|
||||
try:
|
||||
# 先创建目录结构
|
||||
await self._mkdir_p(directory_path)
|
||||
|
||||
# 上传文件
|
||||
url = self._build_url(save_path)
|
||||
url = self._build_url(safe_save_path)
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
content = await file.read() # 注意:大文件需要分块读取
|
||||
content = await file.read()
|
||||
async with session.put(
|
||||
url, data=content, headers={"Content-Type": file.content_type}
|
||||
url, data=content, headers={
|
||||
"Content-Type": file.content_type}
|
||||
) as resp:
|
||||
if resp.status not in (200, 201, 204):
|
||||
content = await resp.text()
|
||||
@@ -468,13 +936,13 @@ class WebDAVFileStorage(FileStorageInterface):
|
||||
detail=f"文件上传失败: {content[:200]}",
|
||||
)
|
||||
except aiohttp.ClientError as e:
|
||||
raise HTTPException(status_code=503, detail=f"WebDAV连接异常: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=503, detail=f"WebDAV连接异常: {str(e)}")
|
||||
|
||||
async def delete_file(self, file_code: FileCodes):
|
||||
"""删除WebDAV文件及空目录"""
|
||||
file_path = await file_code.get_file_path()
|
||||
url = self._build_url(file_path)
|
||||
|
||||
try:
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
# 删除文件
|
||||
@@ -490,7 +958,8 @@ class WebDAVFileStorage(FileStorageInterface):
|
||||
await self._delete_empty_dirs(file_path, session)
|
||||
|
||||
except aiohttp.ClientError as e:
|
||||
raise HTTPException(status_code=503, detail=f"WebDAV连接异常: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=503, detail=f"WebDAV连接异常: {str(e)}")
|
||||
|
||||
async def get_file_url(self, file_code: FileCodes):
|
||||
return await get_file_url(file_code.code)
|
||||
@@ -500,12 +969,14 @@ class WebDAVFileStorage(FileStorageInterface):
|
||||
try:
|
||||
filename = file_code.prefix + file_code.suffix
|
||||
url = self._build_url(await file_code.get_file_path())
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
async with aiohttp.ClientSession(headers={
|
||||
"Authorization": f"Basic {base64.b64encode(f'{settings.webdav_username}:{settings.webdav_password}'.encode()).decode()}"
|
||||
}) as session:
|
||||
async with session.get(url) as resp:
|
||||
if resp.status != 200:
|
||||
raise HTTPException(
|
||||
status_code=resp.status,
|
||||
detail=f"文件获取失败: {await resp.text()}",
|
||||
detail=f"文件获取失败{resp.status}: {await resp.text()}",
|
||||
)
|
||||
# 读取内容到内存
|
||||
content = await resp.read()
|
||||
@@ -519,7 +990,122 @@ class WebDAVFileStorage(FileStorageInterface):
|
||||
},
|
||||
)
|
||||
except aiohttp.ClientError as e:
|
||||
raise HTTPException(status_code=503, detail=f"WebDAV连接异常: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=503, detail=f"WebDAV连接异常: {str(e)}")
|
||||
|
||||
async def save_chunk(self, upload_id: str, chunk_index: int, chunk_data: bytes, chunk_hash: str, save_path: str):
|
||||
"""保存分片到 WebDAV"""
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
chunk_path = f"{chunk_dir}/{chunk_index}.part"
|
||||
|
||||
# 先创建目录结构
|
||||
await self._mkdir_p(chunk_dir)
|
||||
|
||||
chunk_url = self._build_url(chunk_path)
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
async with session.put(chunk_url, data=chunk_data) as resp:
|
||||
if resp.status not in (200, 201, 204):
|
||||
content = await resp.text()
|
||||
raise HTTPException(
|
||||
status_code=resp.status,
|
||||
detail=f"分片上传失败: {content[:200]}"
|
||||
)
|
||||
|
||||
async def merge_chunks(self, upload_id: str, chunk_info: UploadChunk, save_path: str) -> tuple[str, str]:
|
||||
"""
|
||||
合并 WebDAV 上的分片文件
|
||||
由于大多数 WebDAV 服务器不支持 PATCH 追加,这里下载所有分片后合并上传
|
||||
"""
|
||||
file_sha256 = hashlib.sha256()
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
merged_data = io.BytesIO()
|
||||
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
# 按顺序读取并验证每个分片
|
||||
for i in range(chunk_info.total_chunks):
|
||||
chunk_path = f"{chunk_dir}/{i}.part"
|
||||
chunk_url = self._build_url(chunk_path)
|
||||
|
||||
# 获取分片记录
|
||||
chunk_record = await UploadChunk.filter(upload_id=upload_id, chunk_index=i).first()
|
||||
if not chunk_record:
|
||||
raise ValueError(f"分片{i}记录不存在")
|
||||
|
||||
# 下载分片数据
|
||||
async with session.get(chunk_url) as resp:
|
||||
if resp.status != 200:
|
||||
raise ValueError(f"分片{i}文件不存在或无法访问")
|
||||
chunk_data = await resp.read()
|
||||
|
||||
# 验证哈希
|
||||
current_hash = hashlib.sha256(chunk_data).hexdigest()
|
||||
if current_hash != chunk_record.chunk_hash:
|
||||
raise ValueError(f"分片{i}哈希不匹配: 期望 {chunk_record.chunk_hash}, 实际 {current_hash}")
|
||||
|
||||
file_sha256.update(chunk_data)
|
||||
merged_data.write(chunk_data)
|
||||
|
||||
# 确保目标目录存在
|
||||
output_dir = str(Path(save_path).parent)
|
||||
await self._mkdir_p(output_dir)
|
||||
|
||||
# 上传合并后的文件
|
||||
output_url = self._build_url(save_path)
|
||||
merged_data.seek(0)
|
||||
async with session.put(output_url, data=merged_data.getvalue()) as resp:
|
||||
if resp.status not in (200, 201, 204):
|
||||
content = await resp.text()
|
||||
raise HTTPException(
|
||||
status_code=resp.status,
|
||||
detail=f"合并文件上传失败: {content[:200]}"
|
||||
)
|
||||
|
||||
return save_path, file_sha256.hexdigest()
|
||||
|
||||
async def clean_chunks(self, upload_id: str, save_path: str):
|
||||
"""
|
||||
清理 WebDAV 上的临时分片文件
|
||||
:param upload_id: 上传会话ID
|
||||
:param save_path: 文件保存路径
|
||||
"""
|
||||
chunk_dir = str(Path(save_path).parent / "chunks" / upload_id)
|
||||
chunk_dir_url = self._build_url(chunk_dir)
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
try:
|
||||
# 检查分片目录是否存在
|
||||
async with session.request("PROPFIND", chunk_dir_url, headers={"Depth": "1"}) as resp:
|
||||
if resp.status == 207: # 207 表示 Multi-Status
|
||||
# 获取目录下的所有分片文件
|
||||
xml_data = await resp.text()
|
||||
file_paths = re.findall(
|
||||
r'<D:href>(.*?)</D:href>', xml_data)
|
||||
for file_path in file_paths:
|
||||
if file_path.endswith(".part"):
|
||||
# 删除分片文件
|
||||
file_url = self._build_url(file_path)
|
||||
async with session.delete(file_url) as delete_resp:
|
||||
if delete_resp.status not in (200, 204, 404):
|
||||
logger.info(f"删除分片文件失败: {file_path}")
|
||||
|
||||
# 删除分片目录
|
||||
async with session.delete(chunk_dir_url) as delete_resp:
|
||||
if delete_resp.status not in (200, 204, 404):
|
||||
logger.info(f"删除分片目录失败: {chunk_dir_url}")
|
||||
else:
|
||||
logger.info(f"分片目录不存在: {chunk_dir_url}")
|
||||
except Exception as e:
|
||||
logger.info(f"清理 WebDAV 分片时出错: {e}")
|
||||
|
||||
async def file_exists(self, save_path: str) -> bool:
|
||||
"""
|
||||
检查文件是否存在于WebDAV
|
||||
:param save_path: 文件路径
|
||||
:return: 文件是否存在
|
||||
"""
|
||||
url = self._build_url(save_path)
|
||||
async with aiohttp.ClientSession(auth=self.auth) as session:
|
||||
async with session.head(url) as resp:
|
||||
return resp.status == 200
|
||||
|
||||
|
||||
storages = {
|
||||
|
||||
+51
-5
@@ -3,12 +3,14 @@
|
||||
# @File : tasks.py
|
||||
# @Software: PyCharm
|
||||
import asyncio
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
|
||||
from tortoise.expressions import Q
|
||||
|
||||
from apps.base.models import FileCodes
|
||||
from apps.base.utils import ip_limit
|
||||
from apps.base.models import FileCodes, UploadChunk
|
||||
from apps.base.utils import ip_limit, get_chunk_file_path_name
|
||||
from core.settings import settings, data_root
|
||||
from core.storage import FileStorageInterface, storages
|
||||
from core.utils import get_now
|
||||
@@ -29,9 +31,53 @@ async def delete_expire_files():
|
||||
Q(expired_at__lt=await get_now()) | Q(expired_count=0)
|
||||
).all()
|
||||
for exp in expire_data:
|
||||
await file_storage.delete_file(exp)
|
||||
await exp.delete()
|
||||
try:
|
||||
await file_storage.delete_file(exp)
|
||||
except Exception as e:
|
||||
logging.error(f"删除过期文件失败 code={exp.code}: {e}")
|
||||
try:
|
||||
await exp.delete()
|
||||
except Exception as e:
|
||||
logging.error(f"删除记录失败 code={exp.code}: {e}")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
logging.error(e)
|
||||
finally:
|
||||
await asyncio.sleep(600)
|
||||
|
||||
|
||||
async def clean_incomplete_uploads():
|
||||
"""清理超时未完成的分片上传"""
|
||||
file_storage: FileStorageInterface = storages[settings.file_storage]()
|
||||
# 默认 24 小时未完成的上传视为过期
|
||||
expire_hours = getattr(settings, 'chunk_expire_hours', 24)
|
||||
while True:
|
||||
try:
|
||||
expire_time = datetime.datetime.now() - datetime.timedelta(hours=expire_hours)
|
||||
# 查找所有过期的上传会话(chunk_index=-1 的记录)
|
||||
expired_sessions = await UploadChunk.filter(
|
||||
chunk_index=-1,
|
||||
created_at__lt=expire_time
|
||||
).all()
|
||||
|
||||
for session in expired_sessions:
|
||||
try:
|
||||
# 获取分片存储路径
|
||||
_, _, _, _, save_path = await get_chunk_file_path_name(
|
||||
session.file_name, session.upload_id
|
||||
)
|
||||
# 清理存储中的临时文件
|
||||
await file_storage.clean_chunks(session.upload_id, save_path)
|
||||
except Exception as e:
|
||||
logging.error(f"清理分片文件失败 upload_id={session.upload_id}: {e}")
|
||||
|
||||
try:
|
||||
# 删除该会话的所有数据库记录
|
||||
await UploadChunk.filter(upload_id=session.upload_id).delete()
|
||||
logging.info(f"已清理过期上传会话 upload_id={session.upload_id}")
|
||||
except Exception as e:
|
||||
logging.error(f"删除分片记录失败 upload_id={session.upload_id}: {e}")
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"清理未完成上传任务异常: {e}")
|
||||
finally:
|
||||
await asyncio.sleep(3600) # 每小时执行一次
|
||||
+28
-3
@@ -4,9 +4,12 @@
|
||||
# @Software: PyCharm
|
||||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
import time
|
||||
|
||||
from core.settings import settings
|
||||
|
||||
|
||||
@@ -44,9 +47,7 @@ async def get_select_token(code: str):
|
||||
:return:
|
||||
"""
|
||||
token = settings.admin_token
|
||||
return hashlib.sha256(
|
||||
f"{code}{int(time.time() / 1000)}000{token}".encode()
|
||||
).hexdigest()
|
||||
return hashlib.sha256(f"{code}{int(time.time() / 1000)}000{token}".encode()).hexdigest()
|
||||
|
||||
|
||||
async def get_file_url(code: str):
|
||||
@@ -92,3 +93,27 @@ async def max_save_times_desc(max_save_seconds: int):
|
||||
desc_zh += gen_desc_zh(max_timedelta.seconds % 60, "秒")
|
||||
desc_en += gen_desc_en(max_timedelta.seconds % 60, "second")
|
||||
return desc_zh, desc_en
|
||||
|
||||
|
||||
async def sanitize_filename(filename: str) -> str:
|
||||
"""
|
||||
安全处理文件名:
|
||||
1. 剥离路径只保留文件名
|
||||
2. 替换非法字符
|
||||
3. 处理空文件名情况
|
||||
"""
|
||||
filename = os.path.basename(filename)
|
||||
illegal_chars = r'[\\/*?:"<>|\x00-\x1F]' # 包含控制字符
|
||||
# 替换非法字符为下划线
|
||||
cleaned = re.sub(illegal_chars, '_', filename)
|
||||
# 处理空格(可选替换为_)
|
||||
cleaned = cleaned.replace(' ', '_')
|
||||
# 处理连续下划线
|
||||
cleaned = re.sub(r'_+', '_', cleaned)
|
||||
# 处理首尾特殊字符
|
||||
cleaned = cleaned.strip('._')
|
||||
# 处理空文件名情况
|
||||
if not cleaned:
|
||||
cleaned = 'unnamed_file'
|
||||
# 长度限制(按需调整)
|
||||
return cleaned[:255]
|
||||
@@ -0,0 +1,12 @@
|
||||
version: "3"
|
||||
services:
|
||||
file-code-box:
|
||||
image: lanol/filecodebox:latest
|
||||
volumes:
|
||||
- fcb-data:/app/data:rw
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "12345:12345"
|
||||
volumes:
|
||||
fcb-data:
|
||||
external: false
|
||||
-275
@@ -1,275 +0,0 @@
|
||||
import {
|
||||
useMediaQuery
|
||||
} from "./chunk-KT7LHMJ2.js";
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
shallowRef,
|
||||
watch
|
||||
} from "./chunk-CQOUZRMK.js";
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/index.js
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/fonts.css";
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/without-fonts.js
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/vars.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/base.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/icons.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/utils.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/components/custom-block.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code-group.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/components/vp-doc.css";
|
||||
import "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/styles/components/vp-sponsor.css";
|
||||
import VPBadge from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
|
||||
import Layout from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/Layout.vue";
|
||||
import { default as default2 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
|
||||
import { default as default3 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPButton.vue";
|
||||
import { default as default4 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPDocAsideSponsors.vue";
|
||||
import { default as default5 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPFeatures.vue";
|
||||
import { default as default6 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPHomeContent.vue";
|
||||
import { default as default7 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPHomeFeatures.vue";
|
||||
import { default as default8 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPHomeHero.vue";
|
||||
import { default as default9 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPHomeSponsors.vue";
|
||||
import { default as default10 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPImage.vue";
|
||||
import { default as default11 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPLink.vue";
|
||||
import { default as default12 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPNavBarSearch.vue";
|
||||
import { default as default13 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPSocialLink.vue";
|
||||
import { default as default14 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPSocialLinks.vue";
|
||||
import { default as default15 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPSponsors.vue";
|
||||
import { default as default16 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPTeamMembers.vue";
|
||||
import { default as default17 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPTeamPage.vue";
|
||||
import { default as default18 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageSection.vue";
|
||||
import { default as default19 } from "/Users/lan/Project/Python/FileCodeBox/docs/node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageTitle.vue";
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js
|
||||
import { onContentUpdated } from "vitepress";
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/outline.js
|
||||
import { getScrollOffset } from "vitepress";
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/support/utils.js
|
||||
import { withBase } from "vitepress";
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/data.js
|
||||
import { useData as useData$ } from "vitepress";
|
||||
var useData = useData$;
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/support/utils.js
|
||||
function ensureStartingSlash(path) {
|
||||
return path.startsWith("/") ? path : `/${path}`;
|
||||
}
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/support/sidebar.js
|
||||
function getSidebar(_sidebar, path) {
|
||||
if (Array.isArray(_sidebar))
|
||||
return addBase(_sidebar);
|
||||
if (_sidebar == null)
|
||||
return [];
|
||||
path = ensureStartingSlash(path);
|
||||
const dir = Object.keys(_sidebar).sort((a, b) => {
|
||||
return b.split("/").length - a.split("/").length;
|
||||
}).find((dir2) => {
|
||||
return path.startsWith(ensureStartingSlash(dir2));
|
||||
});
|
||||
const sidebar = dir ? _sidebar[dir] : [];
|
||||
return Array.isArray(sidebar) ? addBase(sidebar) : addBase(sidebar.items, sidebar.base);
|
||||
}
|
||||
function getSidebarGroups(sidebar) {
|
||||
const groups = [];
|
||||
let lastGroupIndex = 0;
|
||||
for (const index in sidebar) {
|
||||
const item = sidebar[index];
|
||||
if (item.items) {
|
||||
lastGroupIndex = groups.push(item);
|
||||
continue;
|
||||
}
|
||||
if (!groups[lastGroupIndex]) {
|
||||
groups.push({ items: [] });
|
||||
}
|
||||
groups[lastGroupIndex].items.push(item);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
function addBase(items, _base) {
|
||||
return [...items].map((_item) => {
|
||||
const item = { ..._item };
|
||||
const base = item.base || _base;
|
||||
if (base && item.link)
|
||||
item.link = base + item.link;
|
||||
if (item.items)
|
||||
item.items = addBase(item.items, base);
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/sidebar.js
|
||||
function useSidebar() {
|
||||
const { frontmatter, page, theme: theme2 } = useData();
|
||||
const is960 = useMediaQuery("(min-width: 960px)");
|
||||
const isOpen = ref(false);
|
||||
const _sidebar = computed(() => {
|
||||
const sidebarConfig = theme2.value.sidebar;
|
||||
const relativePath = page.value.relativePath;
|
||||
return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : [];
|
||||
});
|
||||
const sidebar = ref(_sidebar.value);
|
||||
watch(_sidebar, (next, prev) => {
|
||||
if (JSON.stringify(next) !== JSON.stringify(prev))
|
||||
sidebar.value = _sidebar.value;
|
||||
});
|
||||
const hasSidebar = computed(() => {
|
||||
return frontmatter.value.sidebar !== false && sidebar.value.length > 0 && frontmatter.value.layout !== "home";
|
||||
});
|
||||
const leftAside = computed(() => {
|
||||
if (hasAside)
|
||||
return frontmatter.value.aside == null ? theme2.value.aside === "left" : frontmatter.value.aside === "left";
|
||||
return false;
|
||||
});
|
||||
const hasAside = computed(() => {
|
||||
if (frontmatter.value.layout === "home")
|
||||
return false;
|
||||
if (frontmatter.value.aside != null)
|
||||
return !!frontmatter.value.aside;
|
||||
return theme2.value.aside !== false;
|
||||
});
|
||||
const isSidebarEnabled = computed(() => hasSidebar.value && is960.value);
|
||||
const sidebarGroups = computed(() => {
|
||||
return hasSidebar.value ? getSidebarGroups(sidebar.value) : [];
|
||||
});
|
||||
function open() {
|
||||
isOpen.value = true;
|
||||
}
|
||||
function close() {
|
||||
isOpen.value = false;
|
||||
}
|
||||
function toggle() {
|
||||
isOpen.value ? close() : open();
|
||||
}
|
||||
return {
|
||||
isOpen,
|
||||
sidebar,
|
||||
sidebarGroups,
|
||||
hasSidebar,
|
||||
hasAside,
|
||||
leftAside,
|
||||
isSidebarEnabled,
|
||||
open,
|
||||
close,
|
||||
toggle
|
||||
};
|
||||
}
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/outline.js
|
||||
var ignoreRE = /\b(?:VPBadge|header-anchor|footnote-ref|ignore-header)\b/;
|
||||
var resolvedHeaders = [];
|
||||
function getHeaders(range) {
|
||||
const headers = [
|
||||
...document.querySelectorAll(".VPDoc :where(h1,h2,h3,h4,h5,h6)")
|
||||
].filter((el) => el.id && el.hasChildNodes()).map((el) => {
|
||||
const level = Number(el.tagName[1]);
|
||||
return {
|
||||
element: el,
|
||||
title: serializeHeader(el),
|
||||
link: "#" + el.id,
|
||||
level
|
||||
};
|
||||
});
|
||||
return resolveHeaders(headers, range);
|
||||
}
|
||||
function serializeHeader(h) {
|
||||
let ret = "";
|
||||
for (const node of h.childNodes) {
|
||||
if (node.nodeType === 1) {
|
||||
if (ignoreRE.test(node.className))
|
||||
continue;
|
||||
ret += node.textContent;
|
||||
} else if (node.nodeType === 3) {
|
||||
ret += node.textContent;
|
||||
}
|
||||
}
|
||||
return ret.trim();
|
||||
}
|
||||
function resolveHeaders(headers, range) {
|
||||
if (range === false) {
|
||||
return [];
|
||||
}
|
||||
const levelsRange = (typeof range === "object" && !Array.isArray(range) ? range.level : range) || 2;
|
||||
const [high, low] = typeof levelsRange === "number" ? [levelsRange, levelsRange] : levelsRange === "deep" ? [2, 6] : levelsRange;
|
||||
return buildTree(headers, high, low);
|
||||
}
|
||||
function buildTree(data, min, max) {
|
||||
resolvedHeaders.length = 0;
|
||||
const result = [];
|
||||
const stack = [];
|
||||
data.forEach((item) => {
|
||||
const node = { ...item, children: [] };
|
||||
let parent = stack[stack.length - 1];
|
||||
while (parent && parent.level >= node.level) {
|
||||
stack.pop();
|
||||
parent = stack[stack.length - 1];
|
||||
}
|
||||
if (node.element.classList.contains("ignore-header") || parent && "shouldIgnore" in parent) {
|
||||
stack.push({ level: node.level, shouldIgnore: true });
|
||||
return;
|
||||
}
|
||||
if (node.level > max || node.level < min)
|
||||
return;
|
||||
resolvedHeaders.push({ element: node.element, link: node.link });
|
||||
if (parent)
|
||||
parent.children.push(node);
|
||||
else
|
||||
result.push(node);
|
||||
stack.push(node);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js
|
||||
function useLocalNav() {
|
||||
const { theme: theme2, frontmatter } = useData();
|
||||
const headers = shallowRef([]);
|
||||
const hasLocalNav = computed(() => {
|
||||
return headers.value.length > 0;
|
||||
});
|
||||
onContentUpdated(() => {
|
||||
headers.value = getHeaders(frontmatter.value.outline ?? theme2.value.outline);
|
||||
});
|
||||
return {
|
||||
headers,
|
||||
hasLocalNav
|
||||
};
|
||||
}
|
||||
|
||||
// node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/without-fonts.js
|
||||
var theme = {
|
||||
Layout,
|
||||
enhanceApp: ({ app }) => {
|
||||
app.component("Badge", VPBadge);
|
||||
}
|
||||
};
|
||||
var without_fonts_default = theme;
|
||||
export {
|
||||
default2 as VPBadge,
|
||||
default3 as VPButton,
|
||||
default4 as VPDocAsideSponsors,
|
||||
default5 as VPFeatures,
|
||||
default6 as VPHomeContent,
|
||||
default7 as VPHomeFeatures,
|
||||
default8 as VPHomeHero,
|
||||
default9 as VPHomeSponsors,
|
||||
default10 as VPImage,
|
||||
default11 as VPLink,
|
||||
default12 as VPNavBarSearch,
|
||||
default13 as VPSocialLink,
|
||||
default14 as VPSocialLinks,
|
||||
default15 as VPSponsors,
|
||||
default16 as VPTeamMembers,
|
||||
default17 as VPTeamPage,
|
||||
default18 as VPTeamPageSection,
|
||||
default19 as VPTeamPageTitle,
|
||||
without_fonts_default as default,
|
||||
useLocalNav,
|
||||
useSidebar
|
||||
};
|
||||
//# sourceMappingURL=@theme_index.js.map
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/index.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/without-fonts.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/outline.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/support/utils.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/data.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/support/sidebar.js", "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/composables/sidebar.js"],
|
||||
"sourcesContent": ["import './styles/fonts.css';\nexport * from './without-fonts';\nexport { default as default } from './without-fonts';\n", "import './styles/vars.css';\nimport './styles/base.css';\nimport './styles/icons.css';\nimport './styles/utils.css';\nimport './styles/components/custom-block.css';\nimport './styles/components/vp-code.css';\nimport './styles/components/vp-code-group.css';\nimport './styles/components/vp-doc.css';\nimport './styles/components/vp-sponsor.css';\nimport VPBadge from './components/VPBadge.vue';\nimport Layout from './Layout.vue';\nexport { default as VPBadge } from './components/VPBadge.vue';\nexport { default as VPButton } from './components/VPButton.vue';\nexport { default as VPDocAsideSponsors } from './components/VPDocAsideSponsors.vue';\nexport { default as VPFeatures } from './components/VPFeatures.vue';\nexport { default as VPHomeContent } from './components/VPHomeContent.vue';\nexport { default as VPHomeFeatures } from './components/VPHomeFeatures.vue';\nexport { default as VPHomeHero } from './components/VPHomeHero.vue';\nexport { default as VPHomeSponsors } from './components/VPHomeSponsors.vue';\nexport { default as VPImage } from './components/VPImage.vue';\nexport { default as VPLink } from './components/VPLink.vue';\nexport { default as VPNavBarSearch } from './components/VPNavBarSearch.vue';\nexport { default as VPSocialLink } from './components/VPSocialLink.vue';\nexport { default as VPSocialLinks } from './components/VPSocialLinks.vue';\nexport { default as VPSponsors } from './components/VPSponsors.vue';\nexport { default as VPTeamMembers } from './components/VPTeamMembers.vue';\nexport { default as VPTeamPage } from './components/VPTeamPage.vue';\nexport { default as VPTeamPageSection } from './components/VPTeamPageSection.vue';\nexport { default as VPTeamPageTitle } from './components/VPTeamPageTitle.vue';\nexport { useLocalNav } from './composables/local-nav';\nexport { useSidebar } from './composables/sidebar';\nconst theme = {\n Layout,\n enhanceApp: ({ app }) => {\n app.component('Badge', VPBadge);\n }\n};\nexport default theme;\n", "import { onContentUpdated } from 'vitepress';\nimport { computed, shallowRef } from 'vue';\nimport { getHeaders } from '../composables/outline';\nimport { useData } from './data';\nexport function useLocalNav() {\n const { theme, frontmatter } = useData();\n const headers = shallowRef([]);\n const hasLocalNav = computed(() => {\n return headers.value.length > 0;\n });\n onContentUpdated(() => {\n headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline);\n });\n return {\n headers,\n hasLocalNav\n };\n}\n", "import { getScrollOffset } from 'vitepress';\nimport { onMounted, onUnmounted, onUpdated } from 'vue';\nimport { throttleAndDebounce } from '../support/utils';\nimport { useAside } from './aside';\nconst ignoreRE = /\\b(?:VPBadge|header-anchor|footnote-ref|ignore-header)\\b/;\n// cached list of anchor elements from resolveHeaders\nconst resolvedHeaders = [];\nexport function resolveTitle(theme) {\n return ((typeof theme.outline === 'object' &&\n !Array.isArray(theme.outline) &&\n theme.outline.label) ||\n theme.outlineTitle ||\n 'On this page');\n}\nexport function getHeaders(range) {\n const headers = [\n ...document.querySelectorAll('.VPDoc :where(h1,h2,h3,h4,h5,h6)')\n ]\n .filter((el) => el.id && el.hasChildNodes())\n .map((el) => {\n const level = Number(el.tagName[1]);\n return {\n element: el,\n title: serializeHeader(el),\n link: '#' + el.id,\n level\n };\n });\n return resolveHeaders(headers, range);\n}\nfunction serializeHeader(h) {\n let ret = '';\n for (const node of h.childNodes) {\n if (node.nodeType === 1) {\n if (ignoreRE.test(node.className))\n continue;\n ret += node.textContent;\n }\n else if (node.nodeType === 3) {\n ret += node.textContent;\n }\n }\n return ret.trim();\n}\nexport function resolveHeaders(headers, range) {\n if (range === false) {\n return [];\n }\n const levelsRange = (typeof range === 'object' && !Array.isArray(range)\n ? range.level\n : range) || 2;\n const [high, low] = typeof levelsRange === 'number'\n ? [levelsRange, levelsRange]\n : levelsRange === 'deep'\n ? [2, 6]\n : levelsRange;\n return buildTree(headers, high, low);\n}\nexport function useActiveAnchor(container, marker) {\n const { isAsideEnabled } = useAside();\n const onScroll = throttleAndDebounce(setActiveLink, 100);\n let prevActiveLink = null;\n onMounted(() => {\n requestAnimationFrame(setActiveLink);\n window.addEventListener('scroll', onScroll);\n });\n onUpdated(() => {\n // sidebar update means Line truncated
|
||||
"mappings": ";;;;;;;;;;;AAAA,OAAO;;;ACAP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,SAAoB,WAAXA,gBAA0B;AACnC,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,iBAA0B;AACnC,SAAoB,WAAXA,iBAAyB;AAClC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA6B;AACtC,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA6B;AACtC,SAAoB,WAAXA,iBAAoC;AAC7C,SAAoB,WAAXA,iBAAkC;;;AC5B3C,SAAS,wBAAwB;;;ACAjC,SAAS,uBAAuB;;;ACAhC,SAAS,gBAAgB;;;ACAzB,SAAS,WAAW,gBAAgB;AAC7B,IAAM,UAAU;;;ADgBhB,SAAS,oBAAoB,MAAM;AACtC,SAAO,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI,IAAI;AACjD;;;AEXO,SAAS,WAAW,UAAU,MAAM;AACvC,MAAI,MAAM,QAAQ,QAAQ;AACtB,WAAO,QAAQ,QAAQ;AAC3B,MAAI,YAAY;AACZ,WAAO,CAAC;AACZ,SAAO,oBAAoB,IAAI;AAC/B,QAAM,MAAM,OAAO,KAAK,QAAQ,EAC3B,KAAK,CAAC,GAAG,MAAM;AAChB,WAAO,EAAE,MAAM,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,EAAE;AAAA,EAC9C,CAAC,EACI,KAAK,CAACC,SAAQ;AAEf,WAAO,KAAK,WAAW,oBAAoBA,IAAG,CAAC;AAAA,EACnD,CAAC;AACD,QAAM,UAAU,MAAM,SAAS,GAAG,IAAI,CAAC;AACvC,SAAO,MAAM,QAAQ,OAAO,IACtB,QAAQ,OAAO,IACf,QAAQ,QAAQ,OAAO,QAAQ,IAAI;AAC7C;AAIO,SAAS,iBAAiB,SAAS;AACtC,QAAM,SAAS,CAAC;AAChB,MAAI,iBAAiB;AACrB,aAAW,SAAS,SAAS;AACzB,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,KAAK,OAAO;AACZ,uBAAiB,OAAO,KAAK,IAAI;AACjC;AAAA,IACJ;AACA,QAAI,CAAC,OAAO,cAAc,GAAG;AACzB,aAAO,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;AAAA,IAC7B;AACA,WAAO,cAAc,EAAE,MAAM,KAAK,IAAI;AAAA,EAC1C;AACA,SAAO;AACX;AAiCA,SAAS,QAAQ,OAAO,OAAO;AAC3B,SAAO,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,UAAU;AAC7B,UAAM,OAAO,EAAE,GAAG,MAAM;AACxB,UAAM,OAAO,KAAK,QAAQ;AAC1B,QAAI,QAAQ,KAAK;AACb,WAAK,OAAO,OAAO,KAAK;AAC5B,QAAI,KAAK;AACL,WAAK,QAAQ,QAAQ,KAAK,OAAO,IAAI;AACzC,WAAO;AAAA,EACX,CAAC;AACL;;;ACnFO,SAAS,aAAa;AACzB,QAAM,EAAE,aAAa,MAAM,OAAAC,OAAM,IAAI,QAAQ;AAC7C,QAAM,QAAQ,cAAc,oBAAoB;AAChD,QAAM,SAAS,IAAI,KAAK;AACxB,QAAM,WAAW,SAAS,MAAM;AAC5B,UAAM,gBAAgBA,OAAM,MAAM;AAClC,UAAM,eAAe,KAAK,MAAM;AAChC,WAAO,gBAAgB,WAAW,eAAe,YAAY,IAAI,CAAC;AAAA,EACtE,CAAC;AACD,QAAM,UAAU,IAAI,SAAS,KAAK;AAClC,QAAM,UAAU,CAAC,MAAM,SAAS;AAC5B,QAAI,KAAK,UAAU,IAAI,MAAM,KAAK,UAAU,IAAI;AAC5C,cAAQ,QAAQ,SAAS;AAAA,EACjC,CAAC;AACD,QAAM,aAAa,SAAS,MAAM;AAC9B,WAAQ,YAAY,MAAM,YAAY,SAClC,QAAQ,MAAM,SAAS,KACvB,YAAY,MAAM,WAAW;AAAA,EACrC,CAAC;AACD,QAAM,YAAY,SAAS,MAAM;AAC7B,QAAI;AACA,aAAO,YAAY,MAAM,SAAS,OAC5BA,OAAM,MAAM,UAAU,SACtB,YAAY,MAAM,UAAU;AACtC,WAAO;AAAA,EACX,CAAC;AACD,QAAM,WAAW,SAAS,MAAM;AAC5B,QAAI,YAAY,MAAM,WAAW;AAC7B,aAAO;AACX,QAAI,YAAY,MAAM,SAAS;AAC3B,aAAO,CAAC,CAAC,YAAY,MAAM;AAC/B,WAAOA,OAAM,MAAM,UAAU;AAAA,EACjC,CAAC;AACD,QAAM,mBAAmB,SAAS,MAAM,WAAW,SAAS,MAAM,KAAK;AACvE,QAAM,gBAAgB,SAAS,MAAM;AACjC,WAAO,WAAW,QAAQ,iBAAiB,QAAQ,KAAK,IAAI,CAAC;AAAA,EACjE,CAAC;AACD,WAAS,OAAO;AACZ,WAAO,QAAQ;AAAA,EACnB;AACA,WAAS,QAAQ;AACb,WAAO,QAAQ;AAAA,EACnB;AACA,WAAS,SAAS;AACd,WAAO,QAAQ,MAAM,IAAI,KAAK;AAAA,EAClC;AACA,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;;;AJ3DA,IAAM,WAAW;AAEjB,IAAM,kBAAkB,CAAC;AAQlB,SAAS,WAAW,OAAO;AAC9B,QAAM,UAAU;AAAA,IACZ,GAAG,SAAS,iBAAiB,kCAAkC;AAAA,EACnE,EACK,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,cAAc,CAAC,EAC1C,IAAI,CAAC,OAAO;AACb,UAAM,QAAQ,OAAO,GAAG,QAAQ,CAAC,CAAC;AAClC,WAAO;AAAA,MACH,SAAS;AAAA,MACT,OAAO,gBAAgB,EAAE;AAAA,MACzB,MAAM,MAAM,GAAG;AAAA,MACf;AAAA,IACJ;AAAA,EACJ,CAAC;AACD,SAAO,eAAe,SAAS,KAAK;AACxC;AACA,SAAS,gBAAgB,GAAG;AACxB,MAAI,MAAM;AACV,aAAW,QAAQ,EAAE,YAAY;AAC7B,QAAI,KAAK,aAAa,GAAG;AACrB,UAAI,SAAS,KAAK,KAAK,SAAS;AAC5B;AACJ,aAAO,KAAK;AAAA,IAChB,WACS,KAAK,aAAa,GAAG;AAC1B,aAAO,KAAK;AAAA,IAChB;AAAA,EACJ;AACA,SAAO,IAAI,KAAK;AACpB;AACO,SAAS,eAAe,SAAS,OAAO;AAC3C,MAAI,UAAU,OAAO;AACjB,WAAO,CAAC;AAAA,EACZ;AACA,QAAM,eAAe,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAChE,MAAM,QACN,UAAU;AAChB,QAAM,CAAC,MAAM,GAAG,IAAI,OAAO,gBAAgB,WACrC,CAAC,aAAa,WAAW,IACzB,gBAAgB,SACZ,CAAC,GAAG,CAAC,IACL;AACV,SAAO,UAAU,SAAS,MAAM,GAAG;AACvC;AA8FA,SAAS,UAAU,MAAM,KAAK,KAAK;AAC/B,kBAAgB,SAAS;AACzB,QAAM,SAAS,CAAC;AAChB,QAAM,QAAQ,CAAC;AACf,OAAK,QAAQ,CAAC,SAAS;AACnB,UAAM,OAAO,EAAE,GAAG,MAAM,UAAU,CAAC,EAAE;AACrC,QAAI,SAAS,MAAM,MAAM,SAAS,CAAC;AACnC,WAAO,UAAU,OAAO,SAAS,KAAK,OAAO;AACzC,YAAM,IAAI;AACV,eAAS,MAAM,MAAM,SAAS,CAAC;AAAA,IACnC;AACA,QAAI,KAAK,QAAQ,UAAU,SAAS,eAAe,KAC9C,UAAU,kBAAkB,QAAS;AACtC,YAAM,KAAK,EAAE,OAAO,KAAK,OAAO,cAAc,KAAK,CAAC;AACpD;AAAA,IACJ;AACA,QAAI,KAAK,QAAQ,OAAO,KAAK,QAAQ;AACjC;AACJ,oBAAgB,KAAK,EAAE,SAAS,KAAK,SAAS,MAAM,KAAK,KAAK,CAAC;AAC/D,QAAI;AACA,aAAO,SAAS,KAAK,IAAI;AAAA;AAEzB,aAAO,KAAK,IAAI;AACpB,UAAM,KAAK,IAAI;AAAA,EACnB,CAAC;AACD,SAAO;AACX;;;AD7KO,SAAS,cAAc;AAC1B,QAAM,EAAE,OAAAC,QAAO,YAAY,IAAI,QAAQ;AACvC,QAAM,UAAU,WAAW,CAAC,CAAC;AAC7B,QAAM,cAAc,SAAS,MAAM;AAC/B,WAAO,QAAQ,MAAM,SAAS;AAAA,EAClC,CAAC;AACD,mBAAiB,MAAM;AACnB,YAAQ,QAAQ,WAAW,YAAY,MAAM,WAAWA,OAAM,MAAM,OAAO;AAAA,EAC/E,CAAC;AACD,SAAO;AAAA,IACH;AAAA,IACA;AAAA,EACJ;AACJ;;;ADcA,IAAM,QAAQ;AAAA,EACV;AAAA,EACA,YAAY,CAAC,EAAE,IAAI,MAAM;AACrB,QAAI,UAAU,SAAS,OAAO;AAAA,EAClC;AACJ;AACA,IAAO,wBAAQ;",
|
||||
"names": ["default", "dir", "theme", "theme"]
|
||||
}
|
||||
+9
-15
@@ -1,49 +1,43 @@
|
||||
{
|
||||
"hash": "d07f6dee",
|
||||
"configHash": "dee2d3bc",
|
||||
"hash": "8f855eaf",
|
||||
"configHash": "1b3ca22f",
|
||||
"lockfileHash": "bd28b2c2",
|
||||
"browserHash": "b96651ac",
|
||||
"browserHash": "29e84937",
|
||||
"optimized": {
|
||||
"vue": {
|
||||
"src": "../../../node_modules/.pnpm/vue@3.5.13/node_modules/vue/dist/vue.runtime.esm-bundler.js",
|
||||
"file": "vue.js",
|
||||
"fileHash": "bc5c7f34",
|
||||
"fileHash": "3215885f",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vue/devtools-api": {
|
||||
"src": "../../../node_modules/.pnpm/@vue+devtools-api@7.7.1/node_modules/@vue/devtools-api/dist/index.js",
|
||||
"file": "vitepress___@vue_devtools-api.js",
|
||||
"fileHash": "00859881",
|
||||
"fileHash": "5a5f95ef",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vueuse/core": {
|
||||
"src": "../../../node_modules/.pnpm/@vueuse+core@12.5.0/node_modules/@vueuse/core/index.mjs",
|
||||
"file": "vitepress___@vueuse_core.js",
|
||||
"fileHash": "1c6da938",
|
||||
"fileHash": "0fbf66f0",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > @vueuse/integrations/useFocusTrap": {
|
||||
"src": "../../../node_modules/.pnpm/@vueuse+integrations@12.5.0_focus-trap@7.6.4/node_modules/@vueuse/integrations/useFocusTrap.mjs",
|
||||
"file": "vitepress___@vueuse_integrations_useFocusTrap.js",
|
||||
"fileHash": "11c08fcf",
|
||||
"fileHash": "91b03896",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > mark.js/src/vanilla.js": {
|
||||
"src": "../../../node_modules/.pnpm/mark.js@8.11.1/node_modules/mark.js/src/vanilla.js",
|
||||
"file": "vitepress___mark__js_src_vanilla__js.js",
|
||||
"fileHash": "b93dbfe7",
|
||||
"fileHash": "99e4f81c",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vitepress > minisearch": {
|
||||
"src": "../../../node_modules/.pnpm/minisearch@7.1.1/node_modules/minisearch/dist/es/index.js",
|
||||
"file": "vitepress___minisearch.js",
|
||||
"fileHash": "bfb6c3ac",
|
||||
"needsInterop": false
|
||||
},
|
||||
"@theme/index": {
|
||||
"src": "../../../node_modules/.pnpm/vitepress@1.6.3_@algolia+client-search@5.20.2_postcss@8.5.2_search-insights@2.17.3/node_modules/vitepress/dist/client/theme-default/index.js",
|
||||
"file": "@theme_index.js",
|
||||
"fileHash": "07512287",
|
||||
"fileHash": "cc176c9c",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -18,6 +18,7 @@ export default defineConfig({
|
||||
{ text: '首页', link: '/' },
|
||||
{ text: '指南', link: '/guide/getting-started' },
|
||||
{ text: 'API', link: '/api/' },
|
||||
{ text: '优秀案例', link: '/showcase' },
|
||||
{ text: 'Demo', link: 'https://share.lanol.cn' },
|
||||
{
|
||||
text: '了解更多',
|
||||
@@ -68,6 +69,14 @@ export default defineConfig({
|
||||
],
|
||||
},
|
||||
],
|
||||
'/showcase': [
|
||||
{
|
||||
text: '优秀案例',
|
||||
items: [
|
||||
{ text: '案例展示', link: '/showcase' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/vastsa/FileCodeBox' },
|
||||
@@ -96,6 +105,7 @@ export default defineConfig({
|
||||
{ text: 'Home', link: '/en/' },
|
||||
{ text: 'Guide', link: '/en/guide/getting-started' },
|
||||
{ text: 'API', link: '/en/api/' },
|
||||
{ text: 'Showcase', link: '/en/showcase' },
|
||||
{ text: 'Demo', link: 'https://share.lanol.cn' },
|
||||
{
|
||||
text: 'More',
|
||||
@@ -152,6 +162,14 @@ export default defineConfig({
|
||||
],
|
||||
},
|
||||
],
|
||||
'/en/showcase': [
|
||||
{
|
||||
text: 'Showcase',
|
||||
items: [
|
||||
{ text: 'Case Studies', link: '/en/showcase' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/vastsa/FileCodeBox' },
|
||||
|
||||
@@ -0,0 +1,473 @@
|
||||
|
||||
:root {
|
||||
/* --- 核心色板:清晨薄雾 (Teal -> Sky) --- */
|
||||
--vp-c-brand-1: #14b8a6; /* Teal 500 */
|
||||
--vp-c-brand-2: #0ea5e9; /* Sky 500 */
|
||||
--vp-c-brand-3: #0f766e; /* Teal 700 */
|
||||
--vp-c-brand-soft: rgba(20, 184, 166, 0.14);
|
||||
|
||||
/* --- 背景色:极简与通透 --- */
|
||||
--vp-c-bg: #ffffff;
|
||||
--vp-c-bg-alt: #f8fafc; /* Slate 50 */
|
||||
--vp-c-bg-elv: #ffffff;
|
||||
|
||||
/* --- 文字颜色:柔和的深灰,而非纯黑 --- */
|
||||
--vp-c-text-1: #334155; /* Slate 700 */
|
||||
--vp-c-text-2: #64748b; /* Slate 500 */
|
||||
--vp-c-text-3: #94a3b8; /* Slate 400 */
|
||||
|
||||
/* --- 边框与分隔 --- */
|
||||
--vp-c-border: #e2e8f0;
|
||||
--vp-c-divider: #f1f5f9;
|
||||
|
||||
/* --- 阴影:扩散柔光 --- */
|
||||
--vp-shadow-1: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
|
||||
--vp-shadow-2: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
|
||||
--vp-shadow-brand: 0 4px 14px 0 rgba(20, 184, 166, 0.3);
|
||||
|
||||
/* --- 布局参数 --- */
|
||||
--vp-nav-height: 64px;
|
||||
--vp-sidebar-width: 280px;
|
||||
--vp-radius-default: 12px;
|
||||
--vp-radius-small: 6px;
|
||||
}
|
||||
|
||||
/* * ==========================================
|
||||
* 暗黑模式重构 (Deep Ocean Theme)
|
||||
* ==========================================
|
||||
*/
|
||||
.dark {
|
||||
/* 背景:更深邃的蓝黑色,更有沉浸感 */
|
||||
--vp-c-bg: #020617; /* Slate 950 */
|
||||
--vp-c-bg-alt: #0f172a; /* Slate 900 */
|
||||
--vp-c-bg-elv: #1e293b; /* Slate 800 */
|
||||
|
||||
/* 文字:降低纯白刺眼感,提高舒适度 */
|
||||
--vp-c-text-1: #f8fafc; /* Slate 50 */
|
||||
--vp-c-text-2: #94a3b8; /* Slate 400 */
|
||||
--vp-c-text-3: #64748b; /* Slate 500 */
|
||||
|
||||
/* 边框:更细腻的深色线条 */
|
||||
--vp-c-border: #1e293b;
|
||||
--vp-c-divider: #0f172a;
|
||||
|
||||
/* 品牌色:调亮,产生荧光感 */
|
||||
--vp-c-brand-1: #2dd4bf; /* Teal 400 */
|
||||
--vp-c-brand-2: #38bdf8; /* Sky 400 */
|
||||
--vp-c-brand-3: #14b8a6; /* Teal 500 */
|
||||
--vp-c-brand-soft: rgba(45, 212, 191, 0.15); /* 淡淡的荧光底色 */
|
||||
|
||||
/* 阴影:暗色环境下的微光 */
|
||||
--vp-shadow-1: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
|
||||
--vp-shadow-2: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
|
||||
--vp-shadow-brand: 0 0 20px rgba(45, 212, 191, 0.3); /* 品牌色发光 */
|
||||
}
|
||||
|
||||
/* 全局基础设置 */
|
||||
body {
|
||||
font-family: 'Noto Sans SC', sans-serif;
|
||||
background-color: var(--vp-c-bg-alt);
|
||||
color: var(--vp-c-text-1);
|
||||
margin: 0;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
a { text-decoration: none; color: inherit; transition: color 0.2s; }
|
||||
|
||||
/* -------------------------------------------
|
||||
布局结构 (模拟 VitePress 布局)
|
||||
------------------------------------------- */
|
||||
.app-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* 1. 导航栏:毛玻璃 + 悬浮感 */
|
||||
.VPNavBar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: var(--vp-nav-height);
|
||||
background-color: rgba(255, 255, 255, 0.85); /* 稍微增加不透明度 */
|
||||
backdrop-filter: blur(20px) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
||||
border-bottom: 1px solid rgba(226, 232, 240, 0.6);
|
||||
z-index: 50;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.dark .VPNavBar {
|
||||
background-color: rgba(2, 6, 23, 0.85); /* 深色背景半透 */
|
||||
border-bottom: 1px solid rgba(30, 41, 59, 0.7);
|
||||
}
|
||||
|
||||
.nav-logo {
|
||||
font-weight: 700;
|
||||
font-size: 1.2rem;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.nav-link:hover {
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
.nav-link.active {
|
||||
color: var(--vp-c-brand-1);
|
||||
position: relative;
|
||||
}
|
||||
.nav-link.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -22px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: var(--vp-c-brand-1);
|
||||
border-radius: 2px 2px 0 0;
|
||||
box-shadow: 0 -2px 10px var(--vp-c-brand-1); /* 激活状态发光 */
|
||||
}
|
||||
|
||||
/* 2. 侧边栏:极简卡片式 */
|
||||
.VPSidebar {
|
||||
position: fixed;
|
||||
top: var(--vp-nav-height);
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: var(--vp-sidebar-width);
|
||||
background-color: var(--vp-c-bg); /* 实色背景 */
|
||||
border-right: 1px solid var(--vp-c-border);
|
||||
padding: 32px 24px;
|
||||
overflow-y: auto;
|
||||
transform: translateX(0);
|
||||
transition: transform 0.3s ease;
|
||||
z-index: 40;
|
||||
}
|
||||
.dark .VPSidebar {
|
||||
background-color: var(--vp-c-bg-alt); /* 侧边栏比内容区稍微亮一点点/或者暗一点 */
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.VPSidebar { transform: translateX(-100%); }
|
||||
.VPSidebar.open { transform: translateX(0); }
|
||||
}
|
||||
|
||||
.sidebar-group-title {
|
||||
font-weight: 700;
|
||||
color: var(--vp-c-text-1);
|
||||
margin-bottom: 12px;
|
||||
margin-top: 24px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.sidebar-group-title:first-child { margin-top: 0; }
|
||||
|
||||
.sidebar-link {
|
||||
display: block;
|
||||
padding: 8px 12px;
|
||||
margin: 4px 0;
|
||||
border-radius: var(--vp-radius-small);
|
||||
color: var(--vp-c-text-2);
|
||||
font-size: 0.95rem;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.sidebar-link:hover {
|
||||
background-color: var(--vp-c-bg-alt);
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
.dark .sidebar-link:hover {
|
||||
background-color: var(--vp-c-bg-elv);
|
||||
}
|
||||
|
||||
.sidebar-link.active {
|
||||
background-color: var(--vp-c-brand-soft);
|
||||
color: var(--vp-c-brand-3);
|
||||
font-weight: 600;
|
||||
}
|
||||
.dark .sidebar-link.active {
|
||||
color: var(--vp-c-brand-1);
|
||||
background-color: rgba(45, 212, 191, 0.1); /* 暗色模式下更通透 */
|
||||
box-shadow: inset 2px 0 0 0 var(--vp-c-brand-1); /* 左侧高亮条 */
|
||||
}
|
||||
|
||||
/* 3. 主内容区:居中与留白 */
|
||||
.VPContent {
|
||||
margin-top: var(--vp-nav-height);
|
||||
margin-left: var(--vp-sidebar-width);
|
||||
padding: 48px 64px;
|
||||
min-height: calc(100vh - var(--vp-nav-height));
|
||||
background-color: var(--vp-c-bg);
|
||||
transition: margin-left 0.3s ease;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.VPContent { margin-left: 0; padding: 32px 24px; }
|
||||
}
|
||||
|
||||
/* 内容排版 (Typography) */
|
||||
.vp-doc h1 {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 800;
|
||||
margin-bottom: 1.5rem;
|
||||
line-height: 1.2;
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
display: inline-block;
|
||||
/* 暗色模式下加一点文字阴影增强可读性 */
|
||||
filter: drop-shadow(0 0 2em rgba(20, 184, 166, 0.2));
|
||||
}
|
||||
.dark .vp-doc h1 {
|
||||
filter: drop-shadow(0 0 25px rgba(45, 212, 191, 0.2));
|
||||
}
|
||||
|
||||
.vp-doc h2 {
|
||||
font-size: 1.8rem;
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
padding-bottom: 0.5rem;
|
||||
border-bottom: 1px solid var(--vp-c-border);
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.vp-doc h3 {
|
||||
font-size: 1.4rem;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 0.8rem;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.vp-doc p {
|
||||
line-height: 1.8;
|
||||
margin-bottom: 1.2rem;
|
||||
color: var(--vp-c-text-2);
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
/* 代码块美化 */
|
||||
.vp-doc pre {
|
||||
background-color: #1e293b; /* Dark Slate */
|
||||
border-radius: var(--vp-radius-default);
|
||||
padding: 20px;
|
||||
overflow-x: auto;
|
||||
color: #f8fafc;
|
||||
margin: 24px 0;
|
||||
border: 1px solid rgba(0,0,0,0.1);
|
||||
box-shadow: var(--vp-shadow-1);
|
||||
}
|
||||
.dark .vp-doc pre {
|
||||
background-color: #0f172a; /* 更深一层的背景 */
|
||||
border: 1px solid #1e293b;
|
||||
}
|
||||
|
||||
.vp-doc code {
|
||||
font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.vp-doc p code {
|
||||
background-color: var(--vp-c-brand-soft);
|
||||
color: var(--vp-c-brand-3);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.dark .vp-doc p code {
|
||||
color: var(--vp-c-brand-1);
|
||||
background-color: rgba(45, 212, 191, 0.1);
|
||||
}
|
||||
|
||||
/* 引用块 (Blockquote) */
|
||||
.vp-doc blockquote {
|
||||
margin: 1.5rem 0;
|
||||
padding: 16px 24px;
|
||||
background-color: var(--vp-c-bg-alt);
|
||||
border-left: 4px solid var(--vp-c-brand-1);
|
||||
border-radius: 0 var(--vp-radius-default) var(--vp-radius-default) 0;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
.dark .vp-doc blockquote {
|
||||
background-color: rgba(30, 41, 59, 0.5);
|
||||
}
|
||||
|
||||
/* 按钮与卡片 (Features) */
|
||||
.vp-button {
|
||||
display: inline-block;
|
||||
padding: 0 24px;
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
border-radius: 24px; /* Pill shape */
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.vp-button.brand {
|
||||
background: linear-gradient(135deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
color: white;
|
||||
box-shadow: var(--vp-shadow-brand);
|
||||
}
|
||||
.dark .vp-button.brand {
|
||||
color: #020617; /* 暗色模式下按钮文字用深色,因为背景亮 */
|
||||
}
|
||||
|
||||
.vp-button.brand:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px -4px rgba(20, 184, 166, 0.5);
|
||||
}
|
||||
.dark .vp-button.brand:hover {
|
||||
box-shadow: 0 0 30px -4px rgba(45, 212, 191, 0.6); /* 发光增强 */
|
||||
}
|
||||
|
||||
.vp-button.alt {
|
||||
background-color: var(--vp-c-bg-alt);
|
||||
color: var(--vp-c-text-1);
|
||||
border: 1px solid var(--vp-c-border);
|
||||
}
|
||||
.dark .vp-button.alt {
|
||||
background-color: transparent;
|
||||
border-color: var(--vp-c-text-2);
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.vp-button.alt:hover {
|
||||
border-color: var(--vp-c-brand-1);
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
/* 工具类 */
|
||||
.theme-toggle {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 1.5rem;
|
||||
color: var(--vp-c-text-2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 8px;
|
||||
border-radius: 50%;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.theme-toggle:hover {
|
||||
background-color: var(--vp-c-bg-alt);
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
.dark .theme-toggle:hover {
|
||||
background-color: var(--vp-c-bg-elv);
|
||||
}
|
||||
|
||||
.mobile-menu-btn {
|
||||
display: none;
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.5rem;
|
||||
color: var(--vp-c-text-1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.mobile-menu-btn { display: block; }
|
||||
.nav-links { display: none; }
|
||||
}
|
||||
|
||||
/* 首页 Hero 样式模拟 */
|
||||
.hero-section {
|
||||
text-align: center;
|
||||
padding: 80px 20px;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.hero-title {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 900;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.hero-title span {
|
||||
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
.hero-desc {
|
||||
font-size: 1.5rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.hero-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Features Grid */
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 24px;
|
||||
margin-top: 64px;
|
||||
}
|
||||
.feature-card {
|
||||
background-color: var(--vp-c-bg-alt);
|
||||
padding: 24px;
|
||||
border-radius: var(--vp-radius-default);
|
||||
transition: transform 0.3s, box-shadow 0.3s;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.dark .feature-card {
|
||||
background-color: rgba(30, 41, 59, 0.3); /* 微微透明 */
|
||||
border: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
.feature-card:hover {
|
||||
background-color: var(--vp-c-bg);
|
||||
transform: translateY(-4px);
|
||||
box-shadow: var(--vp-shadow-2);
|
||||
border-color: var(--vp-c-brand-soft);
|
||||
}
|
||||
.dark .feature-card:hover {
|
||||
background-color: var(--vp-c-bg-elv);
|
||||
border-color: var(--vp-c-brand-1);
|
||||
box-shadow: 0 0 15px rgba(45, 212, 191, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 16px;
|
||||
color: var(--vp-c-brand-1);
|
||||
background-color: var(--vp-c-brand-soft);
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.feature-title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 8px;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
.feature-details {
|
||||
color: var(--vp-c-text-2);
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import './custom.css'
|
||||
|
||||
export default {
|
||||
...DefaultTheme,
|
||||
}
|
||||
@@ -0,0 +1,454 @@
|
||||
# 预签名上传 API 文档
|
||||
|
||||
## 概述
|
||||
|
||||
预签名上传功能提供统一的文件上传接口,根据后端存储类型自动选择最优上传方式:
|
||||
|
||||
- **S3 存储**: 返回预签名 URL,客户端直传 S3(减少服务器带宽压力)
|
||||
- **其他存储**: 返回代理上传 URL,通过服务器中转上传
|
||||
|
||||
## 上传流程
|
||||
|
||||
### 流程图
|
||||
|
||||
```
|
||||
┌─────────┐ 1. 初始化上传 ┌─────────┐
|
||||
│ 客户端 │ ──────────────────────▶ │ 服务器 │
|
||||
└─────────┘ └─────────┘
|
||||
│ │
|
||||
│◀─────── 返回 upload_url + mode ──┤
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────┐
|
||||
│ │ if mode == "direct" (S3存储) │
|
||||
│ │ 2a. PUT 文件到 upload_url (S3) │
|
||||
│ │ 3a. POST /confirm 确认上传 │
|
||||
│ │ │
|
||||
│ │ if mode == "proxy" (其他存储) │
|
||||
│ │ 2b. PUT 文件到 upload_url (服务器) │
|
||||
│ │ (自动返回分享码,无需确认) │
|
||||
│ └─────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
获取分享码
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API 端点
|
||||
|
||||
### 1. 初始化上传
|
||||
|
||||
初始化预签名上传会话,获取上传 URL 和模式。
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
POST /presign/upload/init
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**请求体**
|
||||
|
||||
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|
||||
| ------------ | ------- | ---- | ------ | --------------------------------------- |
|
||||
| file_name | string | ✅ | - | 文件名(含扩展名) |
|
||||
| file_size | integer | ✅ | - | 文件大小(字节) |
|
||||
| expire_value | integer | ❌ | 1 | 过期时间值 |
|
||||
| expire_style | string | ❌ | "day" | 过期类型:day/hour/minute/forever/count |
|
||||
|
||||
**请求示例**
|
||||
|
||||
```json
|
||||
{
|
||||
"file_name": "document.pdf",
|
||||
"file_size": 1048576,
|
||||
"expire_value": 7,
|
||||
"expire_style": "day"
|
||||
}
|
||||
```
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"upload_id": "a1b2c3d4e5f6...",
|
||||
"upload_url": "https://bucket.s3.amazonaws.com/path?X-Amz-Signature=...",
|
||||
"mode": "direct",
|
||||
"save_path": "share/data/2024/01/01/uuid/document.pdf",
|
||||
"expires_in": 900
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**响应字段说明**
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
| ---------- | ------- | ----------------------------------------------------- |
|
||||
| upload_id | string | 上传会话 ID,后续操作需要 |
|
||||
| upload_url | string | 上传目标 URL |
|
||||
| mode | string | 上传模式:`direct`(直传 S3)或 `proxy`(服务器代理) |
|
||||
| save_path | string | 文件存储路径 |
|
||||
| expires_in | integer | URL 有效期(秒),默认 900 秒(15 分钟) |
|
||||
|
||||
**错误响应**
|
||||
|
||||
| 状态码 | 说明 |
|
||||
| ------ | ------------------------------ |
|
||||
| 400 | 过期时间类型错误 |
|
||||
| 403 | 文件大小超过限制 / IP 频率限制 |
|
||||
|
||||
---
|
||||
|
||||
### 2a. 直传模式 - 上传文件到 S3
|
||||
|
||||
当 `mode == "direct"` 时,客户端直接将文件 PUT 到返回的预签名 URL。
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
PUT {upload_url}
|
||||
Content-Type: application/octet-stream
|
||||
|
||||
[文件二进制内容]
|
||||
```
|
||||
|
||||
**注意事项**
|
||||
|
||||
- 直接使用返回的 `upload_url`,不要修改
|
||||
- Content-Type 建议使用 `application/octet-stream`
|
||||
- 这是直接请求 S3,不经过服务器
|
||||
|
||||
**JavaScript 示例**
|
||||
|
||||
```javascript
|
||||
const response = await fetch(uploadUrl, {
|
||||
method: 'PUT',
|
||||
body: file,
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
},
|
||||
})
|
||||
|
||||
if (response.ok) {
|
||||
// 上传成功,调用确认接口
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2b. 代理模式 - 上传文件到服务器
|
||||
|
||||
当 `mode == "proxy"` 时,客户端将文件 PUT 到服务器代理端点。
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
PUT /presign/upload/proxy/{upload_id}
|
||||
Content-Type: multipart/form-data
|
||||
|
||||
file: [文件]
|
||||
```
|
||||
|
||||
**路径参数**
|
||||
|
||||
| 参数 | 说明 |
|
||||
| --------- | ------------------------- |
|
||||
| upload_id | 初始化时返回的上传会话 ID |
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456",
|
||||
"name": "document.pdf"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**注意**: 代理模式上传成功后直接返回分享码,无需调用确认接口。
|
||||
|
||||
**错误响应**
|
||||
|
||||
| 状态码 | 说明 |
|
||||
| ------ | --------------------------------------- |
|
||||
| 400 | 文件大小与声明不符 / 会话不支持代理上传 |
|
||||
| 404 | 上传会话不存在或已过期 |
|
||||
| 500 | 文件保存失败 |
|
||||
|
||||
---
|
||||
|
||||
### 3. 确认上传(仅直传模式)
|
||||
|
||||
直传模式下,客户端完成 S3 上传后调用此接口确认并获取分享码。
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
POST /presign/upload/confirm/{upload_id}
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**路径参数**
|
||||
|
||||
| 参数 | 说明 |
|
||||
| --------- | ------------------------- |
|
||||
| upload_id | 初始化时返回的上传会话 ID |
|
||||
|
||||
**请求体**
|
||||
|
||||
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|
||||
| ------------ | ------- | ---- | ------ | ---------- |
|
||||
| expire_value | integer | ❌ | 1 | 过期时间值 |
|
||||
| expire_style | string | ❌ | "day" | 过期类型 |
|
||||
|
||||
**请求示例**
|
||||
|
||||
```json
|
||||
{
|
||||
"expire_value": 7,
|
||||
"expire_style": "day"
|
||||
}
|
||||
```
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456",
|
||||
"name": "document.pdf"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**错误响应**
|
||||
|
||||
| 状态码 | 说明 |
|
||||
| ------ | --------------------------------------------- |
|
||||
| 400 | 会话不支持直传确认 |
|
||||
| 404 | 上传会话不存在或已过期 / 文件未上传或上传失败 |
|
||||
|
||||
---
|
||||
|
||||
### 4. 查询上传状态
|
||||
|
||||
查询上传会话的当前状态。
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
GET /presign/upload/status/{upload_id}
|
||||
```
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"upload_id": "a1b2c3d4e5f6...",
|
||||
"file_name": "document.pdf",
|
||||
"file_size": 1048576,
|
||||
"mode": "direct",
|
||||
"created_at": "2024-01-01T12:00:00",
|
||||
"expires_at": "2024-01-01T12:15:00",
|
||||
"is_expired": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**错误响应**
|
||||
|
||||
| 状态码 | 说明 |
|
||||
| ------ | -------------- |
|
||||
| 404 | 上传会话不存在 |
|
||||
|
||||
---
|
||||
|
||||
### 5. 取消上传
|
||||
|
||||
取消上传会话并清理相关资源。
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
DELETE /presign/upload/{upload_id}
|
||||
```
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"message": "上传会话已取消"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**错误响应**
|
||||
|
||||
| 状态码 | 说明 |
|
||||
| ------ | -------------- |
|
||||
| 404 | 上传会话不存在 |
|
||||
|
||||
---
|
||||
|
||||
## 前端集成示例
|
||||
|
||||
### 完整上传流程(JavaScript/TypeScript)
|
||||
|
||||
```typescript
|
||||
interface PresignInitResponse {
|
||||
upload_id: string
|
||||
upload_url: string
|
||||
mode: 'direct' | 'proxy'
|
||||
save_path: string
|
||||
expires_in: number
|
||||
}
|
||||
|
||||
interface UploadResult {
|
||||
code: string
|
||||
name: string
|
||||
}
|
||||
|
||||
async function uploadFile(
|
||||
file: File,
|
||||
expireValue: number = 1,
|
||||
expireStyle: string = 'day'
|
||||
): Promise<UploadResult> {
|
||||
// 1. 初始化上传
|
||||
const initResponse = await fetch('/presign/upload/init', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
file_name: file.name,
|
||||
file_size: file.size,
|
||||
expire_value: expireValue,
|
||||
expire_style: expireStyle,
|
||||
}),
|
||||
})
|
||||
|
||||
const initData = await initResponse.json()
|
||||
if (initData.code !== 200) {
|
||||
throw new Error(initData.detail)
|
||||
}
|
||||
|
||||
const { upload_id, upload_url, mode } = initData.detail as PresignInitResponse
|
||||
|
||||
// 2. 根据模式上传文件
|
||||
if (mode === 'direct') {
|
||||
// 直传模式:上传到S3
|
||||
const uploadResponse = await fetch(upload_url, {
|
||||
method: 'PUT',
|
||||
body: file,
|
||||
headers: { 'Content-Type': 'application/octet-stream' },
|
||||
})
|
||||
|
||||
if (!uploadResponse.ok) {
|
||||
throw new Error('S3上传失败')
|
||||
}
|
||||
|
||||
// 3. 确认上传
|
||||
const confirmResponse = await fetch(
|
||||
`/presign/upload/confirm/${upload_id}`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
expire_value: expireValue,
|
||||
expire_style: expireStyle,
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
const confirmData = await confirmResponse.json()
|
||||
if (confirmData.code !== 200) {
|
||||
throw new Error(confirmData.detail)
|
||||
}
|
||||
|
||||
return confirmData.detail
|
||||
} else {
|
||||
// 代理模式:上传到服务器
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
const uploadResponse = await fetch(upload_url, {
|
||||
method: 'PUT',
|
||||
body: formData,
|
||||
})
|
||||
|
||||
const uploadData = await uploadResponse.json()
|
||||
if (uploadData.code !== 200) {
|
||||
throw new Error(uploadData.detail)
|
||||
}
|
||||
|
||||
return uploadData.detail
|
||||
}
|
||||
}
|
||||
|
||||
// 使用示例
|
||||
const file = document.querySelector('input[type="file"]').files[0]
|
||||
const result = await uploadFile(file, 7, 'day')
|
||||
console.log('分享码:', result.code)
|
||||
```
|
||||
|
||||
### Vue 3 组件示例
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div>
|
||||
<input type="file" @change="handleFileSelect" />
|
||||
<button @click="upload" :disabled="!selectedFile || uploading">
|
||||
{{ uploading ? '上传中...' : '上传' }}
|
||||
</button>
|
||||
<div v-if="shareCode">分享码: {{ shareCode }}</div>
|
||||
<div v-if="error" class="error">{{ error }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
const selectedFile = ref<File | null>(null)
|
||||
const uploading = ref(false)
|
||||
const shareCode = ref('')
|
||||
const error = ref('')
|
||||
|
||||
function handleFileSelect(e: Event) {
|
||||
const input = e.target as HTMLInputElement
|
||||
selectedFile.value = input.files?.[0] || null
|
||||
}
|
||||
|
||||
async function upload() {
|
||||
if (!selectedFile.value) return
|
||||
|
||||
uploading.value = true
|
||||
error.value = ''
|
||||
|
||||
try {
|
||||
const result = await uploadFile(selectedFile.value)
|
||||
shareCode.value = result.code
|
||||
} catch (e) {
|
||||
error.value = e.message
|
||||
} finally {
|
||||
uploading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **会话有效期**: 上传会话默认 15 分钟后过期,请在有效期内完成上传
|
||||
2. **文件大小限制**: 受系统配置 `uploadSize` 限制
|
||||
3. **过期类型**: 支持 `day`、`hour`、`minute`、`forever`、`count`
|
||||
4. **CORS**: 直传模式下,S3 需要配置正确的 CORS 策略
|
||||
5. **重试机制**: 建议实现上传失败重试逻辑
|
||||
@@ -0,0 +1,207 @@
|
||||
# Configuration Guide
|
||||
|
||||
FileCodeBox provides rich configuration options that can be customized through the admin panel or by directly modifying the configuration. This document details all available configuration options.
|
||||
|
||||
## Configuration Methods
|
||||
|
||||
FileCodeBox supports two configuration methods:
|
||||
|
||||
1. **Admin Panel Configuration** (Recommended): Access `/admin` to enter the admin panel and modify settings on the settings page
|
||||
2. **Database Configuration**: Configuration is stored in the `data/filecodebox.db` database
|
||||
|
||||
::: tip Note
|
||||
On first startup, the system uses default configuration from `core/settings.py`. Modified configurations are saved to the database.
|
||||
:::
|
||||
|
||||
## Basic Settings
|
||||
|
||||
### Site Information
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `name` | string | `文件快递柜 - FileCodeBox` | Site name, displayed in page title and navigation bar |
|
||||
| `description` | string | `开箱即用的文件快传系统` | Site description, used for SEO |
|
||||
| `keywords` | string | `FileCodeBox, 文件快递柜...` | Site keywords, used for SEO |
|
||||
| `port` | int | `12345` | Service listening port |
|
||||
|
||||
### Notification Settings
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `notify_title` | string | `系统通知` | Notification title |
|
||||
| `notify_content` | string | Welcome message | Notification content, supports HTML |
|
||||
| `page_explain` | string | Legal disclaimer | Footer explanation text |
|
||||
| `robotsText` | string | `User-agent: *\nDisallow: /` | robots.txt content |
|
||||
|
||||
## Upload Settings
|
||||
|
||||
### File Upload Limits
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `openUpload` | int | `1` | Enable upload functionality (1=enabled, 0=disabled) |
|
||||
| `uploadSize` | int | `10485760` | Maximum single file upload size (bytes), default 10MB |
|
||||
| `enableChunk` | int | `0` | Enable chunked upload (1=enabled, 0=disabled) |
|
||||
|
||||
::: warning Note
|
||||
`uploadSize` is in bytes. 10MB = 10 * 1024 * 1024 = 10485760 bytes
|
||||
:::
|
||||
|
||||
### Upload Rate Limiting
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `uploadMinute` | int | `1` | Upload limit time window (minutes) |
|
||||
| `uploadCount` | int | `10` | Maximum uploads allowed within the time window |
|
||||
|
||||
Example: Default configuration allows up to 10 uploads per minute.
|
||||
|
||||
|
||||
### File Expiration Settings
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `expireStyle` | list | `["day","hour","minute","forever","count"]` | Available expiration methods |
|
||||
| `max_save_seconds` | int | `0` | Maximum file retention time (seconds), 0 means no limit |
|
||||
|
||||
Expiration methods explained:
|
||||
- `day` - Expire by days
|
||||
- `hour` - Expire by hours
|
||||
- `minute` - Expire by minutes
|
||||
- `forever` - Never expire
|
||||
- `count` - Expire by download count
|
||||
|
||||
## Theme Settings
|
||||
|
||||
### Theme Selection
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `themesSelect` | string | `themes/2024` | Currently active theme |
|
||||
| `themesChoices` | list | See below | Available themes list |
|
||||
|
||||
Default available themes:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "2023",
|
||||
"key": "themes/2023",
|
||||
"author": "Lan",
|
||||
"version": "1.0"
|
||||
},
|
||||
{
|
||||
"name": "2024",
|
||||
"key": "themes/2024",
|
||||
"author": "Lan",
|
||||
"version": "1.0"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Interface Style
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `opacity` | float | `0.9` | Interface opacity (0-1) |
|
||||
| `background` | string | `""` | Custom background image URL, empty uses default background |
|
||||
|
||||
## Admin Settings
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `admin_token` | string | `FileCodeBox2023` | Admin login password |
|
||||
| `showAdminAddr` | int | `0` | Show admin panel entry on homepage (1=show, 0=hide) |
|
||||
|
||||
::: danger Security Warning
|
||||
Always change the default `admin_token` in production environments! Using the default password poses serious security risks.
|
||||
:::
|
||||
|
||||
## Security Settings
|
||||
|
||||
### Error Rate Limiting
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `errorMinute` | int | `1` | Error limit time window (minutes) |
|
||||
| `errorCount` | int | `1` | Maximum errors allowed within the time window |
|
||||
|
||||
This setting prevents brute-force attacks on extraction codes.
|
||||
|
||||
## Storage Settings
|
||||
|
||||
### Storage Type
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `file_storage` | string | `local` | Storage backend type |
|
||||
| `storage_path` | string | `""` | Custom storage path |
|
||||
|
||||
Supported storage types:
|
||||
- `local` - Local storage
|
||||
- `s3` - S3-compatible storage (AWS S3, Aliyun OSS, MinIO, etc.)
|
||||
- `onedrive` - OneDrive storage
|
||||
- `webdav` - WebDAV storage
|
||||
- `opendal` - OpenDAL storage
|
||||
|
||||
For detailed storage configuration, see [Storage Configuration](/en/guide/storage).
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### Example 1: Small Personal Use
|
||||
|
||||
Suitable for personal or small team use with relaxed limits:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "My File Share",
|
||||
"uploadSize": 52428800, # 50MB
|
||||
"uploadMinute": 5, # 5 minutes
|
||||
"uploadCount": 20, # Max 20 uploads
|
||||
"expireStyle": ["day", "hour", "forever"],
|
||||
"admin_token": "your-secure-password",
|
||||
"showAdminAddr": 1
|
||||
}
|
||||
```
|
||||
|
||||
### Example 2: Public Service
|
||||
|
||||
Suitable for public services requiring stricter limits:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "Public File Box",
|
||||
"uploadSize": 10485760, # 10MB
|
||||
"uploadMinute": 1, # 1 minute
|
||||
"uploadCount": 5, # Max 5 uploads
|
||||
"errorMinute": 5, # 5 minutes
|
||||
"errorCount": 3, # Max 3 errors
|
||||
"expireStyle": ["hour", "minute", "count"],
|
||||
"max_save_seconds": 86400, # Max retention 1 day
|
||||
"admin_token": "very-secure-password-123",
|
||||
"showAdminAddr": 0
|
||||
}
|
||||
```
|
||||
|
||||
### Example 3: Enterprise Internal Use
|
||||
|
||||
Suitable for enterprise internal use with large file and chunked upload support:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "Enterprise File Transfer",
|
||||
"uploadSize": 1073741824, # 1GB
|
||||
"enableChunk": 1, # Enable chunked upload
|
||||
"uploadMinute": 10, # 10 minutes
|
||||
"uploadCount": 100, # Max 100 uploads
|
||||
"expireStyle": ["day", "forever"],
|
||||
"file_storage": "s3", # Use S3 storage
|
||||
"admin_token": "enterprise-secure-token",
|
||||
"showAdminAddr": 1
|
||||
}
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Storage Configuration](/en/guide/storage) - Learn how to configure different storage backends
|
||||
- [Security Settings](/en/guide/security) - Learn how to enhance system security
|
||||
- [File Sharing](/en/guide/share) - Learn about file sharing features
|
||||
@@ -0,0 +1,413 @@
|
||||
# Admin Panel
|
||||
|
||||
FileCodeBox provides a fully-featured admin panel that allows administrators to conveniently manage files, view system status, and modify configurations. This document introduces the various features and usage of the admin panel.
|
||||
|
||||
## Accessing the Admin Panel
|
||||
|
||||
### Login Method
|
||||
|
||||
The admin panel is located at the `/admin` path. Access method:
|
||||
|
||||
1. Visit `http://your-domain.com/admin` in your browser
|
||||
2. Enter the admin password (the value of the `admin_token` configuration)
|
||||
3. Click the login button
|
||||
|
||||
::: tip Tip
|
||||
The default admin password is `FileCodeBox2023`. Be sure to change this password in production environments. See [Security Settings](/en/guide/security) for details.
|
||||
:::
|
||||
|
||||
### Show Admin Entry
|
||||
|
||||
By default, the admin panel entry is not shown on the homepage. You can control whether to show it via configuration:
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `showAdminAddr` | int | `0` | Show admin entry on homepage (1=show, 0=hide) |
|
||||
|
||||
::: warning Security Recommendation
|
||||
For public services, it's recommended to keep `showAdminAddr` at `0` and access the admin panel directly via the `/admin` path to reduce the risk of malicious scanning.
|
||||
:::
|
||||
|
||||
### Authentication Mechanism
|
||||
|
||||
The admin panel uses JWT (JSON Web Token) for authentication:
|
||||
|
||||
1. After successful login, the server returns a Token containing admin identity
|
||||
2. Subsequent requests carry the Token via `Authorization: Bearer <token>` header
|
||||
3. Token is used to verify admin identity, ensuring only authorized users can access admin functions
|
||||
|
||||
## Dashboard
|
||||
|
||||
After logging in, you first see the dashboard page, which displays the overall system status.
|
||||
|
||||
### Statistics
|
||||
|
||||
The dashboard displays the following key metrics:
|
||||
|
||||
| Metric | Description |
|
||||
|--------|-------------|
|
||||
| **Total Files** (`totalFiles`) | Total number of files stored in the system |
|
||||
| **Storage Used** (`storageUsed`) | Total storage space occupied by all files (bytes) |
|
||||
| **System Uptime** (`sysUptime`) | Time when the system was first started |
|
||||
| **Yesterday's Uploads** (`yesterdayCount`) | Number of files uploaded yesterday |
|
||||
| **Yesterday's Upload Size** (`yesterdaySize`) | Total size of files uploaded yesterday (bytes) |
|
||||
| **Today's Uploads** (`todayCount`) | Number of files uploaded today so far |
|
||||
| **Today's Upload Size** (`todaySize`) | Total size of files uploaded today (bytes) |
|
||||
|
||||
### Metric Notes
|
||||
|
||||
- **Total Files**: Includes all unexpired files and text shares
|
||||
- **Storage Used**: Shows actual storage space occupied by files, excluding database and other system files
|
||||
- **Yesterday/Today Statistics**: Calculated based on file creation time, useful for understanding system usage trends
|
||||
|
||||
::: tip Tip
|
||||
Storage usage is displayed in bytes. For example, `10485760` represents approximately 10MB.
|
||||
:::
|
||||
|
||||
## File Management
|
||||
|
||||
### File List
|
||||
|
||||
The file management page displays all shared files in the system, supporting pagination and search.
|
||||
|
||||
**List information includes:**
|
||||
- File ID
|
||||
- Extraction code (code)
|
||||
- Filename prefix (prefix)
|
||||
- File extension (suffix)
|
||||
- File size
|
||||
- Creation time
|
||||
- Expiration time
|
||||
- Remaining download count
|
||||
|
||||
### Search Files
|
||||
|
||||
Use the search function to quickly find specific files:
|
||||
|
||||
1. Enter keywords in the search box
|
||||
2. System performs fuzzy matching based on filename prefix (prefix)
|
||||
3. Search results update in real-time
|
||||
|
||||
**Search examples:**
|
||||
- Enter `report` to find all files with "report" in the filename
|
||||
- Enter `.pdf` to find all PDF files (if the filename contains this string)
|
||||
|
||||
### Pagination
|
||||
|
||||
The file list supports paginated display:
|
||||
|
||||
| Parameter | Default | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `page` | `1` | Current page number |
|
||||
| `size` | `10` | Items per page |
|
||||
|
||||
|
||||
### Delete Files
|
||||
|
||||
Administrators can delete any file:
|
||||
|
||||
1. Find the file to delete in the file list
|
||||
2. Click the delete button
|
||||
3. Confirm the delete operation
|
||||
|
||||
::: danger Warning
|
||||
Delete operations are irreversible! Files will be permanently deleted from the storage backend, and database records will also be removed.
|
||||
:::
|
||||
|
||||
**Delete process:**
|
||||
1. System first deletes the actual file from the storage backend (local/S3/OneDrive, etc.)
|
||||
2. Then deletes the file record from the database
|
||||
3. After deletion, the corresponding extraction code becomes invalid
|
||||
|
||||
### Download Files
|
||||
|
||||
Administrators can directly download any file:
|
||||
|
||||
1. Find the target file in the file list
|
||||
2. Click the download button
|
||||
3. File will be downloaded via browser
|
||||
|
||||
For text shares, the system returns text content directly instead of downloading a file.
|
||||
|
||||
### Modify File Information
|
||||
|
||||
Administrators can modify some information of shared files:
|
||||
|
||||
| Modifiable Field | Description |
|
||||
|------------------|-------------|
|
||||
| `code` | Extraction code (must be unique, cannot duplicate other files) |
|
||||
| `prefix` | Filename prefix |
|
||||
| `suffix` | File extension |
|
||||
| `expired_at` | Expiration time |
|
||||
| `expired_count` | Remaining download count |
|
||||
|
||||
**Modify extraction code:**
|
||||
```
|
||||
Original code: abc123
|
||||
New code: myfile2024
|
||||
```
|
||||
|
||||
::: warning Note
|
||||
When modifying extraction codes, the system checks if the new code is already in use. If an identical extraction code exists, the modification will fail.
|
||||
:::
|
||||
|
||||
## Local File Management
|
||||
|
||||
In addition to managing shared files, the admin panel also provides local file management functionality for managing files in the `data/local` directory.
|
||||
|
||||
### View Local Files
|
||||
|
||||
The local file list displays all files in the `data/local` directory:
|
||||
|
||||
| Information | Description |
|
||||
|-------------|-------------|
|
||||
| Filename | Complete filename |
|
||||
| Creation Time | File creation time |
|
||||
| File Size | File size (bytes) |
|
||||
|
||||
### Share Local Files
|
||||
|
||||
You can quickly share local files:
|
||||
|
||||
1. Select the file to share in the local file list
|
||||
2. Set expiration method and value
|
||||
3. Click the share button
|
||||
4. System generates extraction code
|
||||
|
||||
**Share parameters:**
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `filename` | Filename to share |
|
||||
| `expire_style` | Expiration method (day/hour/minute/forever/count) |
|
||||
| `expire_value` | Expiration value (days/hours/minutes/download count) |
|
||||
|
||||
### Delete Local Files
|
||||
|
||||
You can delete files in the `data/local` directory:
|
||||
|
||||
1. Find the file to delete in the local file list
|
||||
2. Click the delete button
|
||||
3. Confirm deletion
|
||||
|
||||
::: tip Use Cases
|
||||
Local file management is useful for:
|
||||
- Sharing files after batch uploading to the server
|
||||
- Managing files uploaded to the server through other means
|
||||
- Cleaning up unnecessary local files
|
||||
:::
|
||||
|
||||
## System Settings
|
||||
|
||||
### View Configuration
|
||||
|
||||
On the system settings page, you can view the current values of all configuration items. Configuration items are grouped by category:
|
||||
|
||||
- Basic settings (site name, description, etc.)
|
||||
- Upload settings (file size limits, rate limits, etc.)
|
||||
- Storage settings (storage type, path, etc.)
|
||||
- Theme settings (theme selection, opacity, etc.)
|
||||
- Security settings (admin password, error limits, etc.)
|
||||
|
||||
### Modify Configuration
|
||||
|
||||
Administrators can modify most configurations through the admin panel:
|
||||
|
||||
1. Go to the system settings page
|
||||
2. Find the configuration item to modify
|
||||
3. Enter the new value
|
||||
4. Click the save button
|
||||
|
||||
**Modifiable configuration items:**
|
||||
|
||||
| Category | Example Settings |
|
||||
|----------|------------------|
|
||||
| Basic Settings | `name`, `description`, `keywords`, `notify_title`, `notify_content` |
|
||||
| Upload Settings | `uploadSize`, `uploadMinute`, `uploadCount`, `openUpload`, `enableChunk` |
|
||||
| Expiration Settings | `expireStyle`, `max_save_seconds` |
|
||||
| Theme Settings | `themesSelect`, `opacity`, `background` |
|
||||
| Security Settings | `admin_token`, `showAdminAddr`, `errorMinute`, `errorCount` |
|
||||
| Storage Settings | `file_storage`, `storage_path` and storage backend-specific configurations |
|
||||
|
||||
::: warning Note
|
||||
- `admin_token` (admin password) cannot be set to empty
|
||||
- `themesChoices` (theme list) cannot be modified through the admin panel
|
||||
- After modifying storage settings, existing files will not be automatically migrated
|
||||
:::
|
||||
|
||||
### Configuration Effect
|
||||
|
||||
Configuration changes take effect immediately without restarting the service. Configurations are saved in the database and persist after restart.
|
||||
|
||||
**Configuration storage location:**
|
||||
- Database: `data/filecodebox.db`
|
||||
- Table name: `keyvalue`
|
||||
- Key name: `settings`
|
||||
|
||||
## API Endpoints
|
||||
|
||||
All admin panel functions are implemented through REST APIs. Here are the main endpoints:
|
||||
|
||||
### Authentication Endpoint
|
||||
|
||||
**Login**
|
||||
```
|
||||
POST /admin/login
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"password": "your-admin-password"
|
||||
}
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"token": "eyJhbGciOiJIUzI1NiIs...",
|
||||
"token_type": "Bearer"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Dashboard Endpoint
|
||||
|
||||
**Get Statistics**
|
||||
```
|
||||
GET /admin/dashboard
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
### File Management Endpoints
|
||||
|
||||
**Get File List**
|
||||
```
|
||||
GET /admin/file/list?page=1&size=10&keyword=
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**Delete File**
|
||||
```
|
||||
DELETE /admin/file/delete
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id": 123
|
||||
}
|
||||
```
|
||||
|
||||
**Download File**
|
||||
```
|
||||
GET /admin/file/download?id=123
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**Modify File Information**
|
||||
```
|
||||
PATCH /admin/file/update
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id": 123,
|
||||
"code": "newcode",
|
||||
"expired_at": "2024-12-31T23:59:59"
|
||||
}
|
||||
```
|
||||
|
||||
### Local File Endpoints
|
||||
|
||||
**Get Local File List**
|
||||
```
|
||||
GET /admin/local/lists
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**Delete Local File**
|
||||
```
|
||||
DELETE /admin/local/delete
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"filename": "example.txt"
|
||||
}
|
||||
```
|
||||
|
||||
**Share Local File**
|
||||
```
|
||||
POST /admin/local/share
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"filename": "example.txt",
|
||||
"expire_style": "day",
|
||||
"expire_value": 7
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration Endpoints
|
||||
|
||||
**Get Configuration**
|
||||
```
|
||||
GET /admin/config/get
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**Update Configuration**
|
||||
```
|
||||
PATCH /admin/config/update
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"admin_token": "new-password",
|
||||
"uploadSize": 52428800
|
||||
}
|
||||
```
|
||||
|
||||
## Common Issues
|
||||
|
||||
### Forgot Admin Password
|
||||
|
||||
If you forgot the admin password, you can reset it through the following methods:
|
||||
|
||||
1. Stop the FileCodeBox service
|
||||
2. Open `data/filecodebox.db` using an SQLite tool
|
||||
3. Query the record with `key='settings'` in the `keyvalue` table
|
||||
4. Modify the `admin_token` value in the JSON
|
||||
5. Restart the service
|
||||
|
||||
```sql
|
||||
-- View current configuration
|
||||
SELECT * FROM keyvalue WHERE key = 'settings';
|
||||
|
||||
-- Or delete configuration to restore default password
|
||||
DELETE FROM keyvalue WHERE key = 'settings';
|
||||
```
|
||||
|
||||
### File Deletion Failed
|
||||
|
||||
If an error occurs when deleting files, possible reasons:
|
||||
|
||||
1. **Storage backend connection failed**: Check if storage configuration is correct
|
||||
2. **File no longer exists**: File may have been manually deleted
|
||||
3. **Insufficient permissions**: Check write permissions for storage directory
|
||||
|
||||
### Configuration Changes Not Taking Effect
|
||||
|
||||
If configuration changes don't take effect:
|
||||
|
||||
1. Check if you clicked the save button
|
||||
2. Refresh the page to see if configuration was saved
|
||||
3. Check browser console for error messages
|
||||
4. Confirm configuration value format is correct (e.g., don't enter strings for numeric types)
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Configuration Guide](/en/guide/configuration) - Learn detailed descriptions of all configuration options
|
||||
- [Security Settings](/en/guide/security) - Learn how to enhance system security
|
||||
- [Storage Configuration](/en/guide/storage) - Configure different storage backends
|
||||
@@ -0,0 +1,325 @@
|
||||
# Security Settings
|
||||
|
||||
FileCodeBox provides multiple layers of security mechanisms to protect your file sharing service. This document explains how to properly configure security options to ensure secure system operation.
|
||||
|
||||
## Admin Password
|
||||
|
||||
### Change Default Password
|
||||
|
||||
::: danger Important Security Warning
|
||||
FileCodeBox's default admin password is `FileCodeBox2023`. **You must change this password immediately in production environments!** Using the default password allows anyone to access your admin panel.
|
||||
:::
|
||||
|
||||
There are two ways to change the admin password:
|
||||
|
||||
**Method 1: Via Admin Panel (Recommended)**
|
||||
|
||||
1. Access `/admin` to enter the admin panel
|
||||
2. Log in with the current password
|
||||
3. Go to the "System Settings" page
|
||||
4. Find the `admin_token` configuration item
|
||||
5. Enter a new secure password and save
|
||||
|
||||
**Method 2: Via Database**
|
||||
|
||||
Configuration is stored in the `keyvalue` table of the `data/filecodebox.db` database. You can directly modify the `admin_token` value.
|
||||
|
||||
### Password Security Recommendations
|
||||
|
||||
- Use a strong password with at least 16 characters
|
||||
- Include uppercase and lowercase letters, numbers, and special characters
|
||||
- Avoid common words or personal information
|
||||
- Change password regularly
|
||||
|
||||
```python
|
||||
# Recommended password format example
|
||||
"admin_token": "Xk9#mP2$vL5@nQ8&wR3"
|
||||
```
|
||||
|
||||
### Hide Admin Entry
|
||||
|
||||
By default, the admin panel entry is hidden. You can control whether to show the admin entry on the homepage via the `showAdminAddr` configuration:
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `showAdminAddr` | int | `0` | Show admin entry (1=show, 0=hide) |
|
||||
|
||||
::: tip Recommendation
|
||||
For public services, it's recommended to keep `showAdminAddr` at `0` and access the admin panel directly via the `/admin` path.
|
||||
:::
|
||||
|
||||
## IP Rate Limiting
|
||||
|
||||
FileCodeBox has built-in IP-based rate limiting mechanisms to effectively prevent abuse and attacks.
|
||||
|
||||
### Upload Rate Limiting
|
||||
|
||||
Limit the number of uploads from a single IP within a specified time:
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `uploadMinute` | int | `1` | Upload limit time window (minutes) |
|
||||
| `uploadCount` | int | `10` | Maximum uploads allowed within the time window |
|
||||
|
||||
**How it works:**
|
||||
- System records upload requests from each IP
|
||||
- When an IP's upload count reaches `uploadCount` within `uploadMinute` minutes
|
||||
- Subsequent upload requests from that IP will be rejected with HTTP 423 error
|
||||
- Counter resets after the time window expires
|
||||
|
||||
**Configuration examples:**
|
||||
|
||||
```python
|
||||
# Relaxed configuration: Max 20 uploads in 5 minutes
|
||||
{
|
||||
"uploadMinute": 5,
|
||||
"uploadCount": 20
|
||||
}
|
||||
|
||||
# Strict configuration: Max 3 uploads in 1 minute
|
||||
{
|
||||
"uploadMinute": 1,
|
||||
"uploadCount": 3
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Error Rate Limiting
|
||||
|
||||
Limit the number of error attempts from a single IP to prevent brute-force attacks on extraction codes:
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `errorMinute` | int | `1` | Error limit time window (minutes) |
|
||||
| `errorCount` | int | `1` | Maximum errors allowed within the time window |
|
||||
|
||||
**How it works:**
|
||||
- When a user enters an incorrect extraction code, the system records the error count for that IP
|
||||
- When error count reaches `errorCount`, that IP will be temporarily locked
|
||||
- Lock duration is `errorMinute` minutes
|
||||
- During lockout, all extraction requests from that IP will be rejected
|
||||
|
||||
**Configuration example:**
|
||||
|
||||
```python
|
||||
# Anti-brute-force configuration: Max 3 errors in 5 minutes
|
||||
{
|
||||
"errorMinute": 5,
|
||||
"errorCount": 3
|
||||
}
|
||||
```
|
||||
|
||||
::: warning Note
|
||||
The default configuration `errorMinute=1, errorCount=1` is very strict, meaning you need to wait 1 minute after entering one incorrect extraction code before retrying. Adjust this configuration based on actual needs.
|
||||
:::
|
||||
|
||||
## Upload Restrictions
|
||||
|
||||
### File Size Limit
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `uploadSize` | int | `10485760` | Maximum single file upload size (bytes), default 10MB |
|
||||
| `openUpload` | int | `1` | Enable upload functionality (1=enabled, 0=disabled) |
|
||||
|
||||
**Common size conversions:**
|
||||
- 10MB = 10 * 1024 * 1024 = `10485760`
|
||||
- 50MB = 50 * 1024 * 1024 = `52428800`
|
||||
- 100MB = 100 * 1024 * 1024 = `104857600`
|
||||
- 1GB = 1024 * 1024 * 1024 = `1073741824`
|
||||
|
||||
### File Expiration Settings
|
||||
|
||||
Through file expiration mechanisms, you can automatically clean up expired files, reducing storage usage and security risks:
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `expireStyle` | list | `["day","hour","minute","forever","count"]` | Available expiration methods |
|
||||
| `max_save_seconds` | int | `0` | Maximum file retention time (seconds), 0 means no limit |
|
||||
|
||||
**Expiration methods explained:**
|
||||
- `day` - Expire by days
|
||||
- `hour` - Expire by hours
|
||||
- `minute` - Expire by minutes
|
||||
- `forever` - Never expire (requires alphanumeric extraction code)
|
||||
- `count` - Expire by download count
|
||||
|
||||
**Security recommendations:**
|
||||
|
||||
For public services, it's recommended to:
|
||||
1. Remove the `forever` option to avoid permanent file storage
|
||||
2. Set `max_save_seconds` to limit maximum retention time
|
||||
3. Prefer using `count` method for automatic deletion after download
|
||||
|
||||
```python
|
||||
# Recommended configuration for public services
|
||||
{
|
||||
"expireStyle": ["hour", "minute", "count"],
|
||||
"max_save_seconds": 86400 # Max retention 1 day
|
||||
}
|
||||
```
|
||||
|
||||
### Disable Upload Functionality
|
||||
|
||||
In some cases, you may need to temporarily disable upload functionality:
|
||||
|
||||
```python
|
||||
{
|
||||
"openUpload": 0 # Disable upload functionality
|
||||
}
|
||||
```
|
||||
|
||||
## Reverse Proxy Security Configuration
|
||||
|
||||
In production environments, Nginx or other reverse proxy servers are typically used. Here are security configuration recommendations:
|
||||
|
||||
### Nginx Configuration Example
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your-domain.com;
|
||||
|
||||
# Force HTTPS redirect
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name your-domain.com;
|
||||
|
||||
# SSL certificate configuration
|
||||
ssl_certificate /path/to/cert.pem;
|
||||
ssl_certificate_key /path/to/key.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# Limit request body size (match uploadSize configuration)
|
||||
client_max_body_size 100M;
|
||||
|
||||
# Pass real IP
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:12345;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Static resource caching
|
||||
location /assets {
|
||||
proxy_pass http://127.0.0.1:12345;
|
||||
proxy_cache_valid 200 7d;
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Key Security Configuration Notes
|
||||
|
||||
**1. Pass Real IP**
|
||||
|
||||
FileCodeBox's IP limiting functionality depends on obtaining the client's real IP. The system obtains IP in the following order:
|
||||
1. `X-Real-IP` request header
|
||||
2. `X-Forwarded-For` request header
|
||||
3. Direct client connection IP
|
||||
|
||||
Ensure the reverse proxy correctly sets these headers:
|
||||
|
||||
```nginx
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
```
|
||||
|
||||
**2. Request Body Size Limit**
|
||||
|
||||
Nginx's `client_max_body_size` should match or be slightly larger than FileCodeBox's `uploadSize` configuration:
|
||||
|
||||
```nginx
|
||||
client_max_body_size 100M; # Allow max 100MB uploads
|
||||
```
|
||||
|
||||
**3. HTTPS Encryption**
|
||||
|
||||
It's strongly recommended to enable HTTPS in production environments:
|
||||
- Protect uploaded file content
|
||||
- Protect admin login credentials
|
||||
- Prevent man-in-the-middle attacks
|
||||
|
||||
### Caddy Configuration Example
|
||||
|
||||
```nginx
|
||||
your-domain.com {
|
||||
reverse_proxy localhost:12345
|
||||
|
||||
header {
|
||||
X-Frame-Options "SAMEORIGIN"
|
||||
X-Content-Type-Options "nosniff"
|
||||
X-XSS-Protection "1; mode=block"
|
||||
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Security Checklist
|
||||
|
||||
Before deploying FileCodeBox, confirm the following security configurations:
|
||||
|
||||
- [ ] Changed default admin password `admin_token`
|
||||
- [ ] Hidden admin entry `showAdminAddr: 0`
|
||||
- [ ] Configured appropriate upload rate limiting
|
||||
- [ ] Configured error rate limiting to prevent brute-force attacks
|
||||
- [ ] Set reasonable file size limits
|
||||
- [ ] Configured file expiration policy
|
||||
- [ ] Enabled HTTPS encryption
|
||||
- [ ] Reverse proxy correctly passes real IP
|
||||
- [ ] Set security response headers
|
||||
|
||||
## Recommended Security Configurations
|
||||
|
||||
### Public Service Configuration
|
||||
|
||||
```python
|
||||
{
|
||||
"admin_token": "your-very-secure-password",
|
||||
"showAdminAddr": 0,
|
||||
"uploadSize": 10485760, # 10MB
|
||||
"uploadMinute": 1,
|
||||
"uploadCount": 5,
|
||||
"errorMinute": 5,
|
||||
"errorCount": 3,
|
||||
"expireStyle": ["hour", "minute", "count"],
|
||||
"max_save_seconds": 86400, # Max 1 day
|
||||
"openUpload": 1
|
||||
}
|
||||
```
|
||||
|
||||
### Internal Service Configuration
|
||||
|
||||
```python
|
||||
{
|
||||
"admin_token": "internal-secure-password",
|
||||
"showAdminAddr": 1,
|
||||
"uploadSize": 104857600, # 100MB
|
||||
"uploadMinute": 5,
|
||||
"uploadCount": 50,
|
||||
"errorMinute": 1,
|
||||
"errorCount": 5,
|
||||
"expireStyle": ["day", "hour", "forever"],
|
||||
"max_save_seconds": 0, # No limit
|
||||
"openUpload": 1
|
||||
}
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Configuration Guide](/en/guide/configuration) - Learn about all configuration options
|
||||
- [Storage Configuration](/en/guide/storage) - Configure secure storage backends
|
||||
- [File Sharing](/en/guide/share) - Learn about file sharing features
|
||||
@@ -0,0 +1,342 @@
|
||||
# File Sharing
|
||||
|
||||
FileCodeBox provides simple and easy-to-use file and text sharing functionality. Users can securely share and retrieve files using extraction codes.
|
||||
|
||||
## Sharing Methods
|
||||
|
||||
FileCodeBox supports two sharing methods:
|
||||
|
||||
1. **Text Sharing** - Share text content directly, suitable for code snippets, configuration files, etc.
|
||||
2. **File Sharing** - Upload files for sharing, supports various file formats
|
||||
|
||||
## Text Sharing
|
||||
|
||||
### How to Use
|
||||
|
||||
1. Select the "Text Share" tab on the homepage
|
||||
2. Enter or paste the content to share in the text box
|
||||
3. Select expiration method and time
|
||||
4. Click the "Share" button
|
||||
5. Get the extraction code
|
||||
|
||||
### Text Size Limit
|
||||
|
||||
::: warning Note
|
||||
The maximum content size for text sharing is **222KB** (227,328 bytes). If content exceeds this limit, it's recommended to use file sharing instead.
|
||||
:::
|
||||
|
||||
Text content size is calculated using UTF-8 encoding. Chinese characters typically occupy 3 bytes.
|
||||
|
||||
### API Endpoint
|
||||
|
||||
**POST** `/share/text/`
|
||||
|
||||
Request parameters:
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `text` | string | Yes | Text content to share |
|
||||
| `expire_value` | int | No | Expiration value, default 1 |
|
||||
| `expire_style` | string | No | Expiration method, default `day` |
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## File Sharing
|
||||
|
||||
### How to Use
|
||||
|
||||
1. Select the "File Share" tab on the homepage
|
||||
2. Click the upload area or drag files to the upload area
|
||||
3. Select expiration method and time
|
||||
4. Click the "Upload" button
|
||||
5. Get the extraction code
|
||||
|
||||
### File Size Limit
|
||||
|
||||
The default maximum single file upload size is **10MB**. Administrators can modify this limit via the `uploadSize` configuration.
|
||||
|
||||
::: tip Tip
|
||||
If you need to upload large files, contact the administrator to enable chunked upload functionality or adjust the `uploadSize` configuration.
|
||||
:::
|
||||
|
||||
### Supported Upload Methods
|
||||
|
||||
- **Click Upload** - Click the upload area to select files
|
||||
- **Drag Upload** - Drag files to the upload area
|
||||
- **Paste Upload** - Paste images from clipboard (supported by some themes)
|
||||
|
||||
### API Endpoint
|
||||
|
||||
**POST** `/share/file/`
|
||||
|
||||
Request parameters (multipart/form-data):
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `file` | file | Yes | File to upload |
|
||||
| `expire_value` | int | No | Expiration value, default 1 |
|
||||
| `expire_style` | string | No | Expiration method, default `day` |
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "654321",
|
||||
"name": "example.pdf"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Expiration Settings
|
||||
|
||||
FileCodeBox supports multiple flexible expiration methods:
|
||||
|
||||
| Expiration Method | Parameter Value | Description |
|
||||
|-------------------|-----------------|-------------|
|
||||
| By Days | `day` | File expires after specified days |
|
||||
| By Hours | `hour` | File expires after specified hours |
|
||||
| By Minutes | `minute` | File expires after specified minutes |
|
||||
| Never Expire | `forever` | File is permanently valid |
|
||||
| By Count | `count` | File expires after specified download count |
|
||||
|
||||
::: info Note
|
||||
- Administrators can control available expiration methods via the `expireStyle` configuration
|
||||
- Administrators can limit maximum file retention time via the `max_save_seconds` configuration
|
||||
:::
|
||||
|
||||
### Expiration Method Examples
|
||||
|
||||
```bash
|
||||
# File expires after 3 days
|
||||
expire_value=3, expire_style=day
|
||||
|
||||
# File expires after 12 hours
|
||||
expire_value=12, expire_style=hour
|
||||
|
||||
# File expires after 30 minutes
|
||||
expire_value=30, expire_style=minute
|
||||
|
||||
# File never expires
|
||||
expire_value=1, expire_style=forever
|
||||
|
||||
# File expires after 5 downloads
|
||||
expire_value=5, expire_style=count
|
||||
```
|
||||
|
||||
## Retrieving Files
|
||||
|
||||
### How to Use
|
||||
|
||||
1. Enter the extraction code in the "Retrieve File" area on the homepage
|
||||
2. Click the "Retrieve" button
|
||||
3. System displays file information (filename, size, etc.)
|
||||
4. Click the "Download" button to download the file, or view text content directly
|
||||
|
||||
### Extraction Code Notes
|
||||
|
||||
- Extraction codes are typically **6-digit numbers**
|
||||
- Files that never expire use **alphanumeric** extraction codes
|
||||
- Extraction codes are case-sensitive (for alphanumeric codes)
|
||||
|
||||
### API Endpoints
|
||||
|
||||
**Query File Information**
|
||||
|
||||
**POST** `/share/select/`
|
||||
|
||||
Request parameters:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "123456"
|
||||
}
|
||||
```
|
||||
|
||||
Response example (file):
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456",
|
||||
"name": "example.pdf",
|
||||
"size": 1048576,
|
||||
"text": "https://example.com/download/..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Response example (text):
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456",
|
||||
"name": "Text",
|
||||
"size": 1024,
|
||||
"text": "This is the shared text content..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Direct File Download**
|
||||
|
||||
**GET** `/share/select/?code=123456`
|
||||
|
||||
This endpoint returns file content directly, suitable for direct browser access.
|
||||
|
||||
## Chunked Upload (Large Files)
|
||||
|
||||
For large file uploads, FileCodeBox supports chunked upload functionality. This feature requires administrator enablement (`enableChunk=1`).
|
||||
|
||||
### Chunked Upload Flow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant C as Client
|
||||
participant S as Server
|
||||
|
||||
C->>S: 1. Initialize upload (POST /chunk/upload/init/)
|
||||
S-->>C: Return upload_id and chunk info
|
||||
|
||||
loop Each chunk
|
||||
C->>S: 2. Upload chunk (POST /chunk/upload/chunk/{upload_id}/{chunk_index})
|
||||
S-->>C: Return chunk hash
|
||||
end
|
||||
|
||||
C->>S: 3. Complete upload (POST /chunk/upload/complete/{upload_id})
|
||||
S-->>C: Return extraction code
|
||||
```
|
||||
|
||||
### 1. Initialize Upload
|
||||
|
||||
**POST** `/chunk/upload/init/`
|
||||
|
||||
Request parameters:
|
||||
|
||||
```json
|
||||
{
|
||||
"file_name": "large_file.zip",
|
||||
"file_size": 104857600,
|
||||
"chunk_size": 5242880,
|
||||
"file_hash": "sha256_hash_of_file"
|
||||
}
|
||||
```
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `file_name` | string | Yes | Filename |
|
||||
| `file_size` | int | Yes | Total file size (bytes) |
|
||||
| `chunk_size` | int | No | Chunk size, default 5MB |
|
||||
| `file_hash` | string | Yes | SHA256 hash of the file |
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"existed": false,
|
||||
"upload_id": "abc123def456",
|
||||
"chunk_size": 5242880,
|
||||
"total_chunks": 20,
|
||||
"uploaded_chunks": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Upload Chunk
|
||||
|
||||
**POST** `/chunk/upload/chunk/{upload_id}/{chunk_index}`
|
||||
|
||||
- `upload_id` - Upload session ID returned during initialization
|
||||
- `chunk_index` - Chunk index, starting from 0
|
||||
|
||||
Request body: Chunk file data (multipart/form-data)
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"chunk_hash": "sha256_hash_of_chunk"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Complete Upload
|
||||
|
||||
**POST** `/chunk/upload/complete/{upload_id}`
|
||||
|
||||
Request parameters:
|
||||
|
||||
```json
|
||||
{
|
||||
"expire_value": 1,
|
||||
"expire_style": "day"
|
||||
}
|
||||
```
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "789012",
|
||||
"name": "large_file.zip"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Resume Upload
|
||||
|
||||
Chunked upload supports resume functionality. If upload is interrupted:
|
||||
|
||||
1. Call the initialization endpoint again with the same `file_hash`
|
||||
2. Server returns `uploaded_chunks` list containing already uploaded chunk indices
|
||||
3. Client only needs to upload chunks not in the list
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Common Error Codes
|
||||
|
||||
| Error Code | Description | Solution |
|
||||
|------------|-------------|----------|
|
||||
| 403 | File size exceeds limit | Reduce file size or contact administrator to adjust limit |
|
||||
| 403 | Content too large | Text exceeds 222KB, use file sharing instead |
|
||||
| 403 | Upload rate limit | Wait a while before retrying |
|
||||
| 404 | File not found | Check if extraction code is correct |
|
||||
| 404 | File expired | File has expired or download count exhausted |
|
||||
|
||||
### Rate Limiting
|
||||
|
||||
To prevent abuse, the system has rate limits on upload and retrieval operations:
|
||||
|
||||
- **Upload limit**: Default max 10 uploads per minute
|
||||
- **Error limit**: Default max 1 error attempt per minute
|
||||
|
||||
::: tip Tip
|
||||
If you encounter rate limiting, wait for the limit time window to pass before retrying.
|
||||
:::
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Configuration Guide](/en/guide/configuration) - Learn how to configure sharing-related settings
|
||||
- [Storage Configuration](/en/guide/storage) - Learn about file storage methods
|
||||
- [Security Settings](/en/guide/security) - Learn about security-related configurations
|
||||
- [Admin Panel](/en/guide/management) - Learn how to manage shared files
|
||||
@@ -0,0 +1,395 @@
|
||||
# Storage Configuration
|
||||
|
||||
FileCodeBox supports multiple storage backends. You can choose the appropriate storage method based on your needs. This document details the configuration methods for various storage backends.
|
||||
|
||||
## Storage Types Overview
|
||||
|
||||
| Storage Type | Config Value | Description |
|
||||
|--------------|--------------|-------------|
|
||||
| Local Storage | `local` | Default storage method, files saved on local server |
|
||||
| S3-Compatible Storage | `s3` | Supports AWS S3, Aliyun OSS, MinIO, etc. |
|
||||
| OneDrive | `onedrive` | Microsoft OneDrive cloud storage (work/school accounts only) |
|
||||
| WebDAV | `webdav` | Storage services supporting WebDAV protocol |
|
||||
| OpenDAL | `opendal` | Integrate more storage services via OpenDAL |
|
||||
|
||||
## Local Storage
|
||||
|
||||
Local storage is the default storage method. Files are saved in the server's `data/` directory.
|
||||
|
||||
### Configuration Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `file_storage` | string | `local` | Storage type |
|
||||
| `storage_path` | string | `""` | Custom storage path (optional) |
|
||||
|
||||
### Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=local
|
||||
storage_path=
|
||||
```
|
||||
|
||||
### Notes
|
||||
|
||||
- Files are stored by default in `data/share/data/` directory
|
||||
- Subdirectories are automatically created by date: `year/month/day/fileID/`
|
||||
- In production, it's recommended to mount the `data/` directory to persistent storage
|
||||
|
||||
## S3-Compatible Storage
|
||||
|
||||
Supports all S3-compatible object storage services, including AWS S3, Aliyun OSS, MinIO, Tencent Cloud COS, etc.
|
||||
|
||||
### Configuration Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `file_storage` | string | - | Set to `s3` |
|
||||
| `s3_access_key_id` | string | `""` | Access Key ID |
|
||||
| `s3_secret_access_key` | string | `""` | Secret Access Key |
|
||||
| `s3_bucket_name` | string | `""` | Bucket name |
|
||||
| `s3_endpoint_url` | string | `""` | S3 endpoint URL |
|
||||
| `s3_region_name` | string | `auto` | Region name |
|
||||
| `s3_signature_version` | string | `s3v2` | Signature version (`s3v2` or `s3v4`) |
|
||||
| `s3_hostname` | string | `""` | S3 hostname (alternative) |
|
||||
| `s3_proxy` | int | `0` | Download through server proxy (1=yes, 0=no) |
|
||||
| `aws_session_token` | string | `""` | AWS session token (optional) |
|
||||
|
||||
|
||||
### AWS S3 Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=AKIAIOSFODNN7EXAMPLE
|
||||
s3_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
s3_bucket_name=my-filecodebox-bucket
|
||||
s3_endpoint_url=https://s3.amazonaws.com
|
||||
s3_region_name=us-east-1
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
### Aliyun OSS Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=YourAccessKeyId
|
||||
s3_secret_access_key=YourSecretAccessKey
|
||||
s3_bucket_name=bucket-name
|
||||
s3_endpoint_url=https://bucket-name.oss-cn-hangzhou.aliyuncs.com
|
||||
s3_region_name=oss-cn-hangzhou
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
::: tip Aliyun OSS Endpoint Format
|
||||
Endpoint URL format: `https://<bucket-name>.<region>.aliyuncs.com`
|
||||
|
||||
Common regions:
|
||||
- Hangzhou: `oss-cn-hangzhou`
|
||||
- Shanghai: `oss-cn-shanghai`
|
||||
- Beijing: `oss-cn-beijing`
|
||||
- Shenzhen: `oss-cn-shenzhen`
|
||||
:::
|
||||
|
||||
### MinIO Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=minioadmin
|
||||
s3_secret_access_key=minioadmin
|
||||
s3_bucket_name=filecodebox
|
||||
s3_endpoint_url=http://localhost:9000
|
||||
s3_region_name=us-east-1
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
::: warning MinIO Notes
|
||||
- `s3_endpoint_url` should be the MinIO API interface address
|
||||
- `s3_region_name` should match the `Server Location` in MinIO configuration
|
||||
- Ensure the bucket is created and has correct access permissions
|
||||
:::
|
||||
|
||||
### Tencent Cloud COS Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=YourSecretId
|
||||
s3_secret_access_key=YourSecretKey
|
||||
s3_bucket_name=bucket-name-1250000000
|
||||
s3_endpoint_url=https://cos.ap-guangzhou.myqcloud.com
|
||||
s3_region_name=ap-guangzhou
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
### Proxy Download
|
||||
|
||||
When `s3_proxy=1`, file downloads are proxied through the server instead of directly from S3. This is useful when:
|
||||
|
||||
- S3 bucket doesn't allow public access
|
||||
- Need to hide the actual storage address
|
||||
- Network environment restricts direct S3 access
|
||||
|
||||
## OneDrive Storage
|
||||
|
||||
OneDrive storage supports saving files to Microsoft OneDrive cloud storage.
|
||||
|
||||
::: warning Important Limitation
|
||||
OneDrive storage **only supports work or school accounts** and requires admin permissions to authorize the API. Personal accounts cannot use this feature.
|
||||
:::
|
||||
|
||||
### Configuration Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `file_storage` | string | - | Set to `onedrive` |
|
||||
| `onedrive_domain` | string | `""` | Azure AD domain |
|
||||
| `onedrive_client_id` | string | `""` | Application (client) ID |
|
||||
| `onedrive_username` | string | `""` | Account email |
|
||||
| `onedrive_password` | string | `""` | Account password |
|
||||
| `onedrive_root_path` | string | `filebox_storage` | Storage root directory in OneDrive |
|
||||
| `onedrive_proxy` | int | `0` | Download through server proxy |
|
||||
|
||||
### Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=onedrive
|
||||
onedrive_domain=contoso.onmicrosoft.com
|
||||
onedrive_client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
onedrive_username=user@contoso.onmicrosoft.com
|
||||
onedrive_password=your_password
|
||||
onedrive_root_path=filebox_storage
|
||||
```
|
||||
|
||||
### Azure App Registration Steps
|
||||
|
||||
To use OneDrive storage, you need to register an application in the Azure portal:
|
||||
|
||||
#### 1. Get Domain
|
||||
|
||||
Log in to [Azure Portal](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade), hover over your account in the top right corner, and the **Domain** shown in the popup is the `onedrive_domain` value.
|
||||
|
||||
#### 2. Register Application
|
||||
|
||||
1. Click **+ New registration** in the top left
|
||||
2. Enter application name (e.g., FileCodeBox)
|
||||
3. **Supported account types**: Select "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts"
|
||||
4. **Redirect URI**: Select `Web`, enter `http://localhost`
|
||||
5. Click **Register**
|
||||
|
||||
#### 3. Get Client ID
|
||||
|
||||
After registration, find the **Application (client) ID** in the **Essentials** section on the app overview page. This is the `onedrive_client_id` value.
|
||||
|
||||
#### 4. Configure Authentication
|
||||
|
||||
1. Select **Authentication** in the left menu
|
||||
2. Find **Allow public client flows**, select **Yes**
|
||||
3. Click **Save**
|
||||
|
||||
#### 5. Configure API Permissions
|
||||
|
||||
1. Select **API permissions** in the left menu
|
||||
2. Click **+ Add a permission**
|
||||
3. Select **Microsoft Graph** → **Delegated permissions**
|
||||
4. Check the following permissions:
|
||||
- `openid`
|
||||
- `Files.Read`
|
||||
- `Files.Read.All`
|
||||
- `Files.ReadWrite`
|
||||
- `Files.ReadWrite.All`
|
||||
- `User.Read`
|
||||
5. Click **Add permissions**
|
||||
6. Click **Grant admin consent for xxx**
|
||||
7. After confirmation, permission status should show **Granted**
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
Using OneDrive storage requires additional Python dependencies:
|
||||
|
||||
```bash
|
||||
pip install msal Office365-REST-Python-Client
|
||||
```
|
||||
|
||||
### Verify Configuration
|
||||
|
||||
You can use the following code to test if the configuration is correct:
|
||||
|
||||
```python
|
||||
import msal
|
||||
from office365.graph_client import GraphClient
|
||||
|
||||
domain = 'your_domain'
|
||||
client_id = 'your_client_id'
|
||||
username = 'your_username'
|
||||
password = 'your_password'
|
||||
|
||||
def acquire_token_pwd():
|
||||
authority_url = f'https://login.microsoftonline.com/{domain}'
|
||||
app = msal.PublicClientApplication(
|
||||
authority=authority_url,
|
||||
client_id=client_id
|
||||
)
|
||||
result = app.acquire_token_by_username_password(
|
||||
username=username,
|
||||
password=password,
|
||||
scopes=['https://graph.microsoft.com/.default']
|
||||
)
|
||||
return result
|
||||
|
||||
# Test connection
|
||||
client = GraphClient(acquire_token_pwd)
|
||||
me = client.me.get().execute_query()
|
||||
print(f"Login successful: {me.user_principal_name}")
|
||||
```
|
||||
|
||||
|
||||
## WebDAV Storage
|
||||
|
||||
WebDAV storage supports saving files to any service that supports the WebDAV protocol, such as Nextcloud, ownCloud, Nutstore, etc.
|
||||
|
||||
### Configuration Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `file_storage` | string | - | Set to `webdav` |
|
||||
| `webdav_url` | string | `""` | WebDAV server URL |
|
||||
| `webdav_username` | string | `""` | WebDAV username |
|
||||
| `webdav_password` | string | `""` | WebDAV password |
|
||||
| `webdav_root_path` | string | `filebox_storage` | Storage root directory in WebDAV |
|
||||
| `webdav_proxy` | int | `0` | Download through server proxy |
|
||||
|
||||
### Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=webdav
|
||||
webdav_url=https://dav.example.com/remote.php/dav/files/username/
|
||||
webdav_username=your_username
|
||||
webdav_password=your_password
|
||||
webdav_root_path=filebox_storage
|
||||
```
|
||||
|
||||
### Nextcloud Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=webdav
|
||||
webdav_url=https://your-nextcloud.com/remote.php/dav/files/username/
|
||||
webdav_username=your_username
|
||||
webdav_password=your_app_password
|
||||
webdav_root_path=FileCodeBox
|
||||
```
|
||||
|
||||
::: tip Nextcloud App Password
|
||||
It's recommended to create an app password in Nextcloud instead of using your main password:
|
||||
1. Log in to Nextcloud
|
||||
2. Go to **Settings** → **Security**
|
||||
3. Create a new app password in **Devices & sessions**
|
||||
:::
|
||||
|
||||
### Nutstore Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=webdav
|
||||
webdav_url=https://dav.jianguoyun.com/dav/
|
||||
webdav_username=your_email@example.com
|
||||
webdav_password=your_app_password
|
||||
webdav_root_path=FileCodeBox
|
||||
```
|
||||
|
||||
::: tip Nutstore App Password
|
||||
Nutstore requires an app password:
|
||||
1. Log in to Nutstore web version
|
||||
2. Go to **Account Info** → **Security Options**
|
||||
3. Add an app password
|
||||
:::
|
||||
|
||||
## OpenDAL Storage
|
||||
|
||||
OpenDAL is a unified data access layer that supports multiple storage services. Through OpenDAL, you can use Google Cloud Storage, Azure Blob Storage, and more.
|
||||
|
||||
### Configuration Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-----------|------|-------------|
|
||||
| `file_storage` | string | Set to `opendal` |
|
||||
| `opendal_scheme` | string | Storage service type (e.g., `gcs`, `azblob`) |
|
||||
| `opendal_<scheme>_<setting>` | string | Service-specific configuration parameters |
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
```bash
|
||||
pip install opendal
|
||||
```
|
||||
|
||||
### Google Cloud Storage Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=opendal
|
||||
opendal_scheme=gcs
|
||||
opendal_gcs_root=/filecodebox
|
||||
opendal_gcs_bucket=your-bucket-name
|
||||
opendal_gcs_credential=base64_encoded_credential
|
||||
```
|
||||
|
||||
### Azure Blob Storage Configuration Example
|
||||
|
||||
```bash
|
||||
file_storage=opendal
|
||||
opendal_scheme=azblob
|
||||
opendal_azblob_root=/filecodebox
|
||||
opendal_azblob_container=your-container
|
||||
opendal_azblob_account_name=your_account
|
||||
opendal_azblob_account_key=your_key
|
||||
```
|
||||
|
||||
### Supported Services
|
||||
|
||||
OpenDAL supports numerous storage services. For the complete list, see the [OpenDAL Official Documentation](https://opendal.apache.org/docs/rust/opendal/services/index.html).
|
||||
|
||||
Common services include:
|
||||
- `gcs` - Google Cloud Storage
|
||||
- `azblob` - Azure Blob Storage
|
||||
- `obs` - Huawei Cloud OBS
|
||||
- `oss` - Aliyun OSS (via OpenDAL)
|
||||
- `cos` - Tencent Cloud COS (via OpenDAL)
|
||||
- `hdfs` - Hadoop HDFS
|
||||
- `ftp` - FTP server
|
||||
- `sftp` - SFTP server
|
||||
|
||||
::: warning OpenDAL Notes
|
||||
1. Services integrated via OpenDAL download through server proxy, consuming both storage service and server bandwidth
|
||||
2. Compared to native S3/OneDrive support, OpenDAL may lack some debugging information
|
||||
3. OpenDAL is written in Rust with good performance
|
||||
:::
|
||||
|
||||
## Storage Selection Recommendations
|
||||
|
||||
| Scenario | Recommended Storage | Reason |
|
||||
|----------|---------------------|--------|
|
||||
| Personal/Small deployment | Local storage | Simple and easy, no extra configuration needed |
|
||||
| Enterprise intranet | MinIO + S3 | Self-hosted object storage, data control |
|
||||
| Public cloud deployment | Corresponding cloud provider S3 | Fast same-region access, low cost |
|
||||
| Existing OneDrive | OneDrive | Utilize existing resources |
|
||||
| Existing WebDAV | WebDAV | Good compatibility |
|
||||
| Special storage needs | OpenDAL | Supports more storage services |
|
||||
|
||||
## Common Issues
|
||||
|
||||
### S3 Upload Failure
|
||||
|
||||
1. Check if Access Key and Secret Key are correct
|
||||
2. Confirm bucket name and region configuration are correct
|
||||
3. Check bucket access permission settings
|
||||
4. Confirm signature version (`s3v2` or `s3v4`) matches service provider requirements
|
||||
|
||||
### OneDrive Authentication Failure
|
||||
|
||||
1. Confirm using a work/school account, not a personal account
|
||||
2. Check if Azure app has been granted admin consent
|
||||
3. Confirm API permissions are fully configured
|
||||
4. Verify username and password are correct
|
||||
|
||||
### WebDAV Connection Failure
|
||||
|
||||
1. Check if WebDAV URL format is correct
|
||||
2. Confirm username and password (or app password) are correct
|
||||
3. Check if server supports WebDAV protocol
|
||||
4. Confirm network connection is normal
|
||||
Whitespace-only changes.
@@ -0,0 +1,380 @@
|
||||
# File Upload
|
||||
|
||||
FileCodeBox provides multiple flexible file upload methods, supporting both regular upload and chunked upload to meet different scenario requirements.
|
||||
|
||||
## Upload Methods
|
||||
|
||||
FileCodeBox supports the following upload methods:
|
||||
|
||||
### Drag and Drop Upload
|
||||
|
||||
Drag files directly to the upload area to start uploading. This is the most convenient upload method.
|
||||
|
||||
1. Open the FileCodeBox homepage
|
||||
2. Drag files from your file manager to the upload area
|
||||
3. Release the mouse, file upload begins
|
||||
4. Get the extraction code after upload completes
|
||||
|
||||
::: tip Tip
|
||||
Drag and drop upload supports dragging multiple files simultaneously (depending on theme support).
|
||||
:::
|
||||
|
||||
### Click Upload
|
||||
|
||||
Click the upload area to select files through the system file picker.
|
||||
|
||||
1. Click the "Select File" button in the upload area
|
||||
2. Select the file to upload in the popup file picker
|
||||
3. File upload begins after confirming selection
|
||||
4. Get the extraction code after upload completes
|
||||
|
||||
### Paste Upload
|
||||
|
||||
Supports pasting images directly from clipboard for upload (supported by some themes).
|
||||
|
||||
1. Copy an image to clipboard (screenshot or copy image)
|
||||
2. Use `Ctrl+V` (Windows/Linux) or `Cmd+V` (macOS) to paste in the upload area
|
||||
3. Image upload starts automatically
|
||||
4. Get the extraction code after upload completes
|
||||
|
||||
::: warning Note
|
||||
Paste upload only supports image formats, not other file types. Specific support depends on the theme being used.
|
||||
:::
|
||||
|
||||
## File Size Limits
|
||||
|
||||
### Default Limits
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---------|---------|-------------|
|
||||
| `uploadSize` | 10MB | Maximum single file upload size |
|
||||
|
||||
### Modify Upload Limits
|
||||
|
||||
Administrators can modify upload size limits through the admin panel or configuration file:
|
||||
|
||||
```python
|
||||
# Set maximum upload size to 100MB
|
||||
uploadSize = 104857600 # 100 * 1024 * 1024
|
||||
```
|
||||
|
||||
::: info Note
|
||||
`uploadSize` is in bytes. Common conversions:
|
||||
- 10MB = 10485760
|
||||
- 50MB = 52428800
|
||||
- 100MB = 104857600
|
||||
- 500MB = 524288000
|
||||
- 1GB = 1073741824
|
||||
:::
|
||||
|
||||
### Exceeding Limit Handling
|
||||
|
||||
When an uploaded file exceeds the size limit, the system returns a 403 error:
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": "Size exceeds limit, maximum is 10.00 MB"
|
||||
}
|
||||
```
|
||||
|
||||
## Regular Upload API
|
||||
|
||||
### File Upload Endpoint
|
||||
|
||||
**POST** `/share/file/`
|
||||
|
||||
Content-Type: `multipart/form-data`
|
||||
|
||||
**Request parameters:**
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `file` | file | Yes | File to upload |
|
||||
| `expire_value` | int | No | Expiration value, default 1 |
|
||||
| `expire_style` | string | No | Expiration method, default `day` |
|
||||
|
||||
**Expiration method options:**
|
||||
|
||||
| Value | Description |
|
||||
|-------|-------------|
|
||||
| `day` | Expire by days |
|
||||
| `hour` | Expire by hours |
|
||||
| `minute` | Expire by minutes |
|
||||
| `forever` | Never expire |
|
||||
| `count` | Expire by download count |
|
||||
|
||||
**Response example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "654321",
|
||||
"name": "example.pdf"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**cURL example:**
|
||||
|
||||
```bash
|
||||
curl -X POST "http://localhost:12345/share/file/" \
|
||||
-F "file=@/path/to/file.pdf" \
|
||||
-F "expire_value=7" \
|
||||
-F "expire_style=day"
|
||||
```
|
||||
|
||||
|
||||
## Chunked Upload API
|
||||
|
||||
For large files, FileCodeBox supports chunked upload functionality. Chunked upload splits large files into multiple small chunks for separate uploading, supporting resume capability.
|
||||
|
||||
::: warning Prerequisite
|
||||
Chunked upload functionality requires administrator enablement: `enableChunk=1`
|
||||
:::
|
||||
|
||||
### Chunked Upload Flow
|
||||
|
||||
```
|
||||
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
||||
│ Initialize │ ──▶ │Upload Chunks│ ──▶ │ Complete │
|
||||
│ /init/ │ │ /chunk/ │ │ /complete/ │
|
||||
└─────────────┘ └─────────────┘ └─────────────┘
|
||||
│
|
||||
▼
|
||||
┌───────────┐
|
||||
│ Loop │
|
||||
│each chunk │
|
||||
└───────────┘
|
||||
```
|
||||
|
||||
### 1. Initialize Upload
|
||||
|
||||
**POST** `/chunk/upload/init/`
|
||||
|
||||
**Request parameters:**
|
||||
|
||||
```json
|
||||
{
|
||||
"file_name": "large_file.zip",
|
||||
"file_size": 104857600,
|
||||
"chunk_size": 5242880,
|
||||
"file_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
```
|
||||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| `file_name` | string | Yes | - | Filename |
|
||||
| `file_size` | int | Yes | - | Total file size (bytes) |
|
||||
| `chunk_size` | int | No | 5MB | Chunk size (bytes) |
|
||||
| `file_hash` | string | Yes | - | SHA256 hash of the file |
|
||||
|
||||
**Response example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"existed": false,
|
||||
"upload_id": "abc123def456789",
|
||||
"chunk_size": 5242880,
|
||||
"total_chunks": 20,
|
||||
"uploaded_chunks": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `existed` | Whether file already exists (instant upload) |
|
||||
| `upload_id` | Upload session ID |
|
||||
| `chunk_size` | Chunk size |
|
||||
| `total_chunks` | Total number of chunks |
|
||||
| `uploaded_chunks` | List of already uploaded chunk indices |
|
||||
|
||||
### 2. Upload Chunk
|
||||
|
||||
**POST** `/chunk/upload/chunk/{upload_id}/{chunk_index}`
|
||||
|
||||
**Path parameters:**
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `upload_id` | Upload session ID returned during initialization |
|
||||
| `chunk_index` | Chunk index, starting from 0 |
|
||||
|
||||
**Request body:**
|
||||
|
||||
Content-Type: `multipart/form-data`
|
||||
|
||||
| Parameter | Type | Description |
|
||||
|-----------|------|-------------|
|
||||
| `chunk` | file | Chunk data |
|
||||
|
||||
**Response example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"chunk_hash": "a1b2c3d4e5f6..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**cURL example:**
|
||||
|
||||
```bash
|
||||
# Upload first chunk (index 0)
|
||||
curl -X POST "http://localhost:12345/chunk/upload/chunk/abc123def456789/0" \
|
||||
-F "chunk=@/path/to/chunk_0"
|
||||
```
|
||||
|
||||
### 3. Complete Upload
|
||||
|
||||
**POST** `/chunk/upload/complete/{upload_id}`
|
||||
|
||||
**Path parameters:**
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `upload_id` | Upload session ID |
|
||||
|
||||
**Request parameters:**
|
||||
|
||||
```json
|
||||
{
|
||||
"expire_value": 7,
|
||||
"expire_style": "day"
|
||||
}
|
||||
```
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `expire_value` | int | Yes | Expiration value |
|
||||
| `expire_style` | string | Yes | Expiration method |
|
||||
|
||||
**Response example:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "789012",
|
||||
"name": "large_file.zip"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Resume Upload
|
||||
|
||||
Chunked upload supports resume functionality. When upload is interrupted:
|
||||
|
||||
1. Call the initialization endpoint again with the same `file_hash`
|
||||
2. Server returns `uploaded_chunks` list containing already uploaded chunk indices
|
||||
3. Client only needs to upload chunks not in the list
|
||||
4. Call the complete endpoint after all chunks are uploaded
|
||||
|
||||
**Example flow:**
|
||||
|
||||
```javascript
|
||||
// 1. Initialize upload
|
||||
const initResponse = await fetch('/chunk/upload/init/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
file_name: 'large_file.zip',
|
||||
file_size: fileSize,
|
||||
chunk_size: 5 * 1024 * 1024,
|
||||
file_hash: fileHash
|
||||
})
|
||||
});
|
||||
const { upload_id, uploaded_chunks, total_chunks } = await initResponse.json();
|
||||
|
||||
// 2. Upload incomplete chunks
|
||||
for (let i = 0; i < total_chunks; i++) {
|
||||
if (!uploaded_chunks.includes(i)) {
|
||||
const chunk = file.slice(i * chunkSize, (i + 1) * chunkSize);
|
||||
await fetch(`/chunk/upload/chunk/${upload_id}/${i}`, {
|
||||
method: 'POST',
|
||||
body: chunk
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Complete upload
|
||||
await fetch(`/chunk/upload/complete/${upload_id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
expire_value: 7,
|
||||
expire_style: 'day'
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Common Errors
|
||||
|
||||
| HTTP Status | Error Message | Cause | Solution |
|
||||
|-------------|---------------|-------|----------|
|
||||
| 403 | Size exceeds limit | File exceeds `uploadSize` limit | Reduce file size or contact administrator to adjust limit |
|
||||
| 403 | Upload rate limit | Exceeded IP upload rate limit | Wait for limit time window before retrying |
|
||||
| 400 | Invalid expiration type | `expire_style` value not in allowed list | Use a valid expiration method |
|
||||
| 404 | Upload session not found | `upload_id` invalid or expired | Re-initialize upload |
|
||||
| 400 | Invalid chunk index | `chunk_index` out of range | Check if chunk index is correct |
|
||||
| 400 | Incomplete chunks | Chunk count insufficient when completing upload | Ensure all chunks are uploaded |
|
||||
|
||||
### Rate Limiting
|
||||
|
||||
The system has rate limits on upload operations to prevent abuse:
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---------|---------|-------------|
|
||||
| `uploadMinute` | 1 | Limit time window (minutes) |
|
||||
| `uploadCount` | 10 | Maximum uploads within time window |
|
||||
|
||||
When rate limit is exceeded, you need to wait for the time window to pass before continuing uploads.
|
||||
|
||||
### Error Response Format
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": "Error message description"
|
||||
}
|
||||
```
|
||||
|
||||
## Upload Configuration
|
||||
|
||||
### Related Settings
|
||||
|
||||
| Setting | Type | Default | Description |
|
||||
|---------|------|---------|-------------|
|
||||
| `openUpload` | int | 1 | Enable upload (1=enabled, 0=disabled) |
|
||||
| `uploadSize` | int | 10485760 | Maximum upload size (bytes) |
|
||||
| `enableChunk` | int | 0 | Enable chunked upload (1=enabled, 0=disabled) |
|
||||
| `uploadMinute` | int | 1 | Upload rate limit time window (minutes) |
|
||||
| `uploadCount` | int | 10 | Maximum uploads within time window |
|
||||
| `expireStyle` | list | ["day","hour","minute","forever","count"] | Allowed expiration methods |
|
||||
|
||||
### Configuration Example
|
||||
|
||||
```python
|
||||
# Allow 100MB file uploads, enable chunked upload
|
||||
uploadSize = 104857600
|
||||
enableChunk = 1
|
||||
|
||||
# Relax upload rate limit: max 50 uploads per 5 minutes
|
||||
uploadMinute = 5
|
||||
uploadCount = 50
|
||||
|
||||
# Only allow expiration by days and count
|
||||
expireStyle = ["day", "count"]
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [File Sharing](/en/guide/share) - Learn the complete sharing process
|
||||
- [Configuration Guide](/en/guide/configuration) - Learn about all configuration options
|
||||
- [Storage Configuration](/en/guide/storage) - Learn about file storage methods
|
||||
- [Security Settings](/en/guide/security) - Learn about security-related configurations
|
||||
@@ -0,0 +1,127 @@
|
||||
# Showcase
|
||||
|
||||
Here are some excellent sites built with FileCodeBox. If you've deployed FileCodeBox, feel free to submit a PR to add your site here!
|
||||
|
||||
## Official Demo
|
||||
|
||||
<div class="showcase-grid">
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### 🌟 FileCodeBox Demo
|
||||
|
||||
- **URL**: [share.lanol.cn](https://share.lanol.cn)
|
||||
- **Description**: Official demo site with the latest features
|
||||
- **Highlights**: Stable, full-featured
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
## Community Sites
|
||||
|
||||
::: tip Submit Your Site
|
||||
If you've built your own file sharing service using FileCodeBox, you can submit it through:
|
||||
|
||||
1. Submit a PR on [GitHub](https://github.com/vastsa/FileCodeBox) to edit this page
|
||||
2. Open an [Issue](https://github.com/vastsa/FileCodeBox/issues) with your site info
|
||||
3. Join QQ Group 739673698 to contact the admin
|
||||
:::
|
||||
|
||||
<!--
|
||||
Submission format example:
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### Site Name
|
||||
|
||||
- **URL**: [example.com](https://example.com)
|
||||
- **Description**: Brief description of your site
|
||||
- **Highlights**: List your site's features
|
||||
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="showcase-grid">
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### QuWenJian
|
||||
|
||||
- **URL**: [www.quwenjian.cn/fby.html](https://www.quwenjian.cn/fby.html)
|
||||
- **Description**: QuWenJian - Unlimited storage, portable and limitless
|
||||
- **Highlights**: Free file transfer station
|
||||
- **Operator**: QuWenJian
|
||||
|
||||
</div>
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### Pandora Box
|
||||
|
||||
- **URL**: [pan.duo.la](https://pan.duo.la)
|
||||
- **Description**: Pandora Box
|
||||
- **Highlights**: Classic v1.6 version
|
||||
- **Operator**: WuXingQueXinYan
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
## Submission Requirements
|
||||
|
||||
To ensure quality, please make sure your site meets the following criteria:
|
||||
|
||||
1. **Stable**: Your site should be stable and accessible
|
||||
2. **Legal**: Content must be legal and compliant
|
||||
3. **Attribution**: We recommend keeping FileCodeBox attribution
|
||||
4. **HTTPS**: We recommend enabling HTTPS
|
||||
|
||||
## Submission Template
|
||||
|
||||
If you want to submit your site, please use the following format:
|
||||
|
||||
```markdown
|
||||
### Site Name
|
||||
|
||||
- **URL**: [domain](https://domain)
|
||||
- **Description**: One-line description of your site
|
||||
- **Highlights**: Special features or highlights
|
||||
- **Operator**: Optional, your name or organization
|
||||
```
|
||||
|
||||
<style>
|
||||
.showcase-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.showcase-item {
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.showcase-item:hover {
|
||||
border-color: var(--vp-c-brand);
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.showcase-item h3 {
|
||||
margin-top: 0;
|
||||
color: var(--vp-c-brand);
|
||||
}
|
||||
|
||||
.showcase-item ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.showcase-item li {
|
||||
margin: 8px 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,206 @@
|
||||
# 配置说明
|
||||
|
||||
FileCodeBox 提供了丰富的配置选项,可以通过管理面板或直接修改配置来自定义系统行为。本文档详细介绍所有可用的配置项。
|
||||
|
||||
## 配置方式
|
||||
|
||||
FileCodeBox 支持两种配置方式:
|
||||
|
||||
1. **管理面板配置**(推荐):访问 `/admin` 进入管理面板,在设置页面修改配置
|
||||
2. **数据库配置**:配置存储在 `data/filecodebox.db` 数据库中
|
||||
|
||||
::: tip 提示
|
||||
首次启动时,系统会使用 `core/settings.py` 中的默认配置。修改后的配置会保存到数据库中。
|
||||
:::
|
||||
|
||||
## 基础设置
|
||||
|
||||
### 站点信息
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `name` | string | `文件快递柜 - FileCodeBox` | 站点名称,显示在页面标题和导航栏 |
|
||||
| `description` | string | `开箱即用的文件快传系统` | 站点描述,用于 SEO |
|
||||
| `keywords` | string | `FileCodeBox, 文件快递柜...` | 站点关键词,用于 SEO |
|
||||
| `port` | int | `12345` | 服务监听端口 |
|
||||
|
||||
### 通知设置
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `notify_title` | string | `系统通知` | 通知标题 |
|
||||
| `notify_content` | string | 欢迎信息 | 通知内容,支持 HTML |
|
||||
| `page_explain` | string | 法律声明 | 页面底部说明文字 |
|
||||
| `robotsText` | string | `User-agent: *\nDisallow: /` | robots.txt 内容 |
|
||||
|
||||
## 上传设置
|
||||
|
||||
### 文件上传限制
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `openUpload` | int | `1` | 是否开启上传功能(1=开启,0=关闭) |
|
||||
| `uploadSize` | int | `10485760` | 单文件最大上传大小(字节),默认 10MB |
|
||||
| `enableChunk` | int | `0` | 是否启用分片上传(1=启用,0=禁用) |
|
||||
|
||||
::: warning 注意
|
||||
`uploadSize` 的单位是字节。10MB = 10 * 1024 * 1024 = 10485760 字节
|
||||
:::
|
||||
|
||||
### 上传频率限制
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `uploadMinute` | int | `1` | 上传限制的时间窗口(分钟) |
|
||||
| `uploadCount` | int | `10` | 在时间窗口内允许的最大上传次数 |
|
||||
|
||||
例如:默认配置表示每 1 分钟内最多允许上传 10 次。
|
||||
|
||||
### 文件过期设置
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `expireStyle` | list | `["day","hour","minute","forever","count"]` | 可选的过期方式 |
|
||||
| `max_save_seconds` | int | `0` | 文件最大保存时间(秒),0 表示不限制 |
|
||||
|
||||
过期方式说明:
|
||||
- `day` - 按天过期
|
||||
- `hour` - 按小时过期
|
||||
- `minute` - 按分钟过期
|
||||
- `forever` - 永不过期
|
||||
- `count` - 按下载次数过期
|
||||
|
||||
## 主题设置
|
||||
|
||||
### 主题选择
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `themesSelect` | string | `themes/2024` | 当前使用的主题 |
|
||||
| `themesChoices` | list | 见下方 | 可用主题列表 |
|
||||
|
||||
默认可用主题:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "2023",
|
||||
"key": "themes/2023",
|
||||
"author": "Lan",
|
||||
"version": "1.0"
|
||||
},
|
||||
{
|
||||
"name": "2024",
|
||||
"key": "themes/2024",
|
||||
"author": "Lan",
|
||||
"version": "1.0"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### 界面样式
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `opacity` | float | `0.9` | 界面透明度(0-1) |
|
||||
| `background` | string | `""` | 自定义背景图片 URL,为空则使用默认背景 |
|
||||
|
||||
## 管理员设置
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `admin_token` | string | `FileCodeBox2023` | 管理员登录密码 |
|
||||
| `showAdminAddr` | int | `0` | 是否在首页显示管理入口(1=显示,0=隐藏) |
|
||||
|
||||
::: danger 安全警告
|
||||
请务必在生产环境中修改默认的 `admin_token`!使用默认密码会导致严重的安全风险。
|
||||
:::
|
||||
|
||||
## 安全设置
|
||||
|
||||
### 错误次数限制
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `errorMinute` | int | `1` | 错误限制的时间窗口(分钟) |
|
||||
| `errorCount` | int | `1` | 在时间窗口内允许的最大错误次数 |
|
||||
|
||||
此设置用于防止暴力破解提取码。
|
||||
|
||||
## 存储设置
|
||||
|
||||
### 存储类型
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `file_storage` | string | `local` | 存储后端类型 |
|
||||
| `storage_path` | string | `""` | 自定义存储路径 |
|
||||
|
||||
支持的存储类型:
|
||||
- `local` - 本地存储
|
||||
- `s3` - S3 兼容存储(AWS S3、阿里云 OSS、MinIO 等)
|
||||
- `onedrive` - OneDrive 存储
|
||||
- `webdav` - WebDAV 存储
|
||||
- `opendal` - OpenDAL 存储
|
||||
|
||||
详细的存储配置请参考 [存储配置](/guide/storage)。
|
||||
|
||||
## 配置示例
|
||||
|
||||
### 示例 1:小型个人使用
|
||||
|
||||
适合个人或小团队使用,限制较宽松:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "我的文件分享",
|
||||
"uploadSize": 52428800, # 50MB
|
||||
"uploadMinute": 5, # 5分钟
|
||||
"uploadCount": 20, # 最多20次
|
||||
"expireStyle": ["day", "hour", "forever"],
|
||||
"admin_token": "your-secure-password",
|
||||
"showAdminAddr": 1
|
||||
}
|
||||
```
|
||||
|
||||
### 示例 2:公开服务
|
||||
|
||||
适合公开服务,需要更严格的限制:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "公共文件快递柜",
|
||||
"uploadSize": 10485760, # 10MB
|
||||
"uploadMinute": 1, # 1分钟
|
||||
"uploadCount": 5, # 最多5次
|
||||
"errorMinute": 5, # 5分钟
|
||||
"errorCount": 3, # 最多3次错误
|
||||
"expireStyle": ["hour", "minute", "count"],
|
||||
"max_save_seconds": 86400, # 最长保存1天
|
||||
"admin_token": "very-secure-password-123",
|
||||
"showAdminAddr": 0
|
||||
}
|
||||
```
|
||||
|
||||
### 示例 3:企业内部使用
|
||||
|
||||
适合企业内部使用,支持大文件和分片上传:
|
||||
|
||||
```python
|
||||
{
|
||||
"name": "企业文件中转站",
|
||||
"uploadSize": 1073741824, # 1GB
|
||||
"enableChunk": 1, # 启用分片上传
|
||||
"uploadMinute": 10, # 10分钟
|
||||
"uploadCount": 100, # 最多100次
|
||||
"expireStyle": ["day", "forever"],
|
||||
"file_storage": "s3", # 使用S3存储
|
||||
"admin_token": "enterprise-secure-token",
|
||||
"showAdminAddr": 1
|
||||
}
|
||||
```
|
||||
|
||||
## 下一步
|
||||
|
||||
- [存储配置](/guide/storage) - 了解如何配置不同的存储后端
|
||||
- [安全设置](/guide/security) - 了解如何增强系统安全性
|
||||
- [文件分享](/guide/share) - 了解文件分享功能
|
||||
@@ -0,0 +1,412 @@
|
||||
# 管理面板
|
||||
|
||||
FileCodeBox 提供了功能完善的管理面板,让管理员可以方便地管理文件、查看系统状态和修改配置。本文档介绍管理面板的各项功能和使用方法。
|
||||
|
||||
## 访问管理面板
|
||||
|
||||
### 登录方式
|
||||
|
||||
管理面板位于 `/admin` 路径。访问方式:
|
||||
|
||||
1. 在浏览器中访问 `http://your-domain.com/admin`
|
||||
2. 输入管理员密码(`admin_token` 配置项的值)
|
||||
3. 点击登录按钮
|
||||
|
||||
::: tip 提示
|
||||
默认管理员密码是 `FileCodeBox2023`。请务必在生产环境中修改此密码,详见 [安全设置](/guide/security)。
|
||||
:::
|
||||
|
||||
### 显示管理入口
|
||||
|
||||
默认情况下,首页不显示管理面板入口。您可以通过配置控制是否显示:
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `showAdminAddr` | int | `0` | 是否在首页显示管理入口(1=显示,0=隐藏) |
|
||||
|
||||
::: warning 安全建议
|
||||
在公开服务中,建议保持 `showAdminAddr` 为 `0`,通过直接访问 `/admin` 路径进入管理面板,减少被恶意扫描的风险。
|
||||
:::
|
||||
|
||||
### 认证机制
|
||||
|
||||
管理面板使用 JWT(JSON Web Token)进行身份认证:
|
||||
|
||||
1. 登录成功后,服务器返回一个包含管理员身份的 Token
|
||||
2. 后续请求通过 `Authorization: Bearer <token>` 头部携带 Token
|
||||
3. Token 用于验证管理员身份,确保只有授权用户可以访问管理功能
|
||||
|
||||
## 仪表盘
|
||||
|
||||
登录后首先看到的是仪表盘页面,展示系统的整体运行状态。
|
||||
|
||||
### 统计指标
|
||||
|
||||
仪表盘显示以下关键指标:
|
||||
|
||||
| 指标 | 说明 |
|
||||
|------|------|
|
||||
| **文件总数** (`totalFiles`) | 系统中存储的文件总数量 |
|
||||
| **存储使用量** (`storageUsed`) | 所有文件占用的总存储空间(字节) |
|
||||
| **系统运行时间** (`sysUptime`) | 系统首次启动的时间 |
|
||||
| **昨日上传数** (`yesterdayCount`) | 昨天一整天上传的文件数量 |
|
||||
| **昨日上传量** (`yesterdaySize`) | 昨天上传文件的总大小(字节) |
|
||||
| **今日上传数** (`todayCount`) | 今天到目前为止上传的文件数量 |
|
||||
| **今日上传量** (`todaySize`) | 今天上传文件的总大小(字节) |
|
||||
|
||||
### 指标说明
|
||||
|
||||
- **文件总数**:包括所有未过期的文件和文本分享
|
||||
- **存储使用量**:显示实际文件占用的存储空间,不包括数据库等系统文件
|
||||
- **昨日/今日统计**:基于文件创建时间计算,用于了解系统使用趋势
|
||||
|
||||
::: tip 提示
|
||||
存储使用量显示的是字节数。例如 `10485760` 表示约 10MB。
|
||||
:::
|
||||
|
||||
## 文件管理
|
||||
|
||||
### 文件列表
|
||||
|
||||
文件管理页面展示系统中所有已分享的文件,支持分页浏览和搜索。
|
||||
|
||||
**列表信息包括:**
|
||||
- 文件 ID
|
||||
- 提取码(code)
|
||||
- 文件名前缀(prefix)
|
||||
- 文件后缀(suffix)
|
||||
- 文件大小
|
||||
- 创建时间
|
||||
- 过期时间
|
||||
- 剩余下载次数
|
||||
|
||||
### 搜索文件
|
||||
|
||||
使用搜索功能可以快速找到特定文件:
|
||||
|
||||
1. 在搜索框中输入关键词
|
||||
2. 系统会根据文件名前缀(prefix)进行模糊匹配
|
||||
3. 搜索结果实时更新
|
||||
|
||||
**搜索示例:**
|
||||
- 输入 `report` 可以找到所有文件名包含 "report" 的文件
|
||||
- 输入 `.pdf` 可以找到所有 PDF 文件(如果文件名包含此字符串)
|
||||
|
||||
### 分页浏览
|
||||
|
||||
文件列表支持分页显示:
|
||||
|
||||
| 参数 | 默认值 | 说明 |
|
||||
|------|--------|------|
|
||||
| `page` | `1` | 当前页码 |
|
||||
| `size` | `10` | 每页显示数量 |
|
||||
|
||||
### 删除文件
|
||||
|
||||
管理员可以删除任意文件:
|
||||
|
||||
1. 在文件列表中找到要删除的文件
|
||||
2. 点击删除按钮
|
||||
3. 确认删除操作
|
||||
|
||||
::: danger 警告
|
||||
删除操作不可恢复!文件将从存储后端永久删除,同时删除数据库中的记录。
|
||||
:::
|
||||
|
||||
**删除流程:**
|
||||
1. 系统首先从存储后端(本地/S3/OneDrive 等)删除实际文件
|
||||
2. 然后从数据库中删除文件记录
|
||||
3. 删除后,对应的提取码将失效
|
||||
|
||||
### 下载文件
|
||||
|
||||
管理员可以直接下载任意文件:
|
||||
|
||||
1. 在文件列表中找到目标文件
|
||||
2. 点击下载按钮
|
||||
3. 文件将通过浏览器下载
|
||||
|
||||
对于文本分享,系统会直接返回文本内容而不是下载文件。
|
||||
|
||||
### 修改文件信息
|
||||
|
||||
管理员可以修改已分享文件的部分信息:
|
||||
|
||||
| 可修改字段 | 说明 |
|
||||
|------------|------|
|
||||
| `code` | 提取码(必须唯一,不能与其他文件重复) |
|
||||
| `prefix` | 文件名前缀 |
|
||||
| `suffix` | 文件后缀名 |
|
||||
| `expired_at` | 过期时间 |
|
||||
| `expired_count` | 剩余下载次数 |
|
||||
|
||||
**修改提取码:**
|
||||
```
|
||||
原提取码:abc123
|
||||
新提取码:myfile2024
|
||||
```
|
||||
|
||||
::: warning 注意
|
||||
修改提取码时,系统会检查新提取码是否已被使用。如果已存在相同的提取码,修改将失败。
|
||||
:::
|
||||
|
||||
## 本地文件管理
|
||||
|
||||
除了管理已分享的文件,管理面板还提供了本地文件管理功能,用于管理 `data/local` 目录中的文件。
|
||||
|
||||
### 查看本地文件
|
||||
|
||||
本地文件列表显示 `data/local` 目录中的所有文件:
|
||||
|
||||
| 信息 | 说明 |
|
||||
|------|------|
|
||||
| 文件名 | 文件的完整名称 |
|
||||
| 创建时间 | 文件的创建时间 |
|
||||
| 文件大小 | 文件大小(字节) |
|
||||
|
||||
### 分享本地文件
|
||||
|
||||
可以将本地文件快速分享:
|
||||
|
||||
1. 在本地文件列表中选择要分享的文件
|
||||
2. 设置过期方式和过期值
|
||||
3. 点击分享按钮
|
||||
4. 系统生成提取码
|
||||
|
||||
**分享参数:**
|
||||
|
||||
| 参数 | 说明 |
|
||||
|------|------|
|
||||
| `filename` | 要分享的文件名 |
|
||||
| `expire_style` | 过期方式(day/hour/minute/forever/count) |
|
||||
| `expire_value` | 过期值(天数/小时数/分钟数/下载次数) |
|
||||
|
||||
### 删除本地文件
|
||||
|
||||
可以删除 `data/local` 目录中的文件:
|
||||
|
||||
1. 在本地文件列表中找到要删除的文件
|
||||
2. 点击删除按钮
|
||||
3. 确认删除
|
||||
|
||||
::: tip 使用场景
|
||||
本地文件管理功能适用于:
|
||||
- 批量上传文件到服务器后进行分享
|
||||
- 管理通过其他方式上传到服务器的文件
|
||||
- 清理不需要的本地文件
|
||||
:::
|
||||
|
||||
## 系统设置
|
||||
|
||||
### 查看配置
|
||||
|
||||
在系统设置页面可以查看当前所有配置项的值。配置项按类别分组显示:
|
||||
|
||||
- 基础设置(站点名称、描述等)
|
||||
- 上传设置(文件大小限制、频率限制等)
|
||||
- 存储设置(存储类型、路径等)
|
||||
- 主题设置(主题选择、透明度等)
|
||||
- 安全设置(管理员密码、错误限制等)
|
||||
|
||||
### 修改配置
|
||||
|
||||
管理员可以通过管理面板修改大部分配置:
|
||||
|
||||
1. 进入系统设置页面
|
||||
2. 找到要修改的配置项
|
||||
3. 输入新的值
|
||||
4. 点击保存按钮
|
||||
|
||||
**可修改的配置项:**
|
||||
|
||||
| 类别 | 配置项示例 |
|
||||
|------|------------|
|
||||
| 基础设置 | `name`, `description`, `keywords`, `notify_title`, `notify_content` |
|
||||
| 上传设置 | `uploadSize`, `uploadMinute`, `uploadCount`, `openUpload`, `enableChunk` |
|
||||
| 过期设置 | `expireStyle`, `max_save_seconds` |
|
||||
| 主题设置 | `themesSelect`, `opacity`, `background` |
|
||||
| 安全设置 | `admin_token`, `showAdminAddr`, `errorMinute`, `errorCount` |
|
||||
| 存储设置 | `file_storage`, `storage_path` 及各存储后端的配置 |
|
||||
|
||||
::: warning 注意
|
||||
- `admin_token`(管理员密码)不能设置为空
|
||||
- `themesChoices`(主题列表)不可通过管理面板修改
|
||||
- 修改存储设置后,已有文件不会自动迁移
|
||||
:::
|
||||
|
||||
### 配置生效
|
||||
|
||||
配置修改后立即生效,无需重启服务。配置保存在数据库中,重启后仍然有效。
|
||||
|
||||
**配置存储位置:**
|
||||
- 数据库:`data/filecodebox.db`
|
||||
- 表名:`keyvalue`
|
||||
- 键名:`settings`
|
||||
|
||||
## API 接口
|
||||
|
||||
管理面板的所有功能都通过 REST API 实现,以下是主要接口:
|
||||
|
||||
### 认证接口
|
||||
|
||||
**登录**
|
||||
```
|
||||
POST /admin/login
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"password": "your-admin-password"
|
||||
}
|
||||
```
|
||||
|
||||
响应:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"token": "eyJhbGciOiJIUzI1NiIs...",
|
||||
"token_type": "Bearer"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 仪表盘接口
|
||||
|
||||
**获取统计数据**
|
||||
```
|
||||
GET /admin/dashboard
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
### 文件管理接口
|
||||
|
||||
**获取文件列表**
|
||||
```
|
||||
GET /admin/file/list?page=1&size=10&keyword=
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**删除文件**
|
||||
```
|
||||
DELETE /admin/file/delete
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id": 123
|
||||
}
|
||||
```
|
||||
|
||||
**下载文件**
|
||||
```
|
||||
GET /admin/file/download?id=123
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**修改文件信息**
|
||||
```
|
||||
PATCH /admin/file/update
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id": 123,
|
||||
"code": "newcode",
|
||||
"expired_at": "2024-12-31T23:59:59"
|
||||
}
|
||||
```
|
||||
|
||||
### 本地文件接口
|
||||
|
||||
**获取本地文件列表**
|
||||
```
|
||||
GET /admin/local/lists
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**删除本地文件**
|
||||
```
|
||||
DELETE /admin/local/delete
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"filename": "example.txt"
|
||||
}
|
||||
```
|
||||
|
||||
**分享本地文件**
|
||||
```
|
||||
POST /admin/local/share
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"filename": "example.txt",
|
||||
"expire_style": "day",
|
||||
"expire_value": 7
|
||||
}
|
||||
```
|
||||
|
||||
### 配置接口
|
||||
|
||||
**获取配置**
|
||||
```
|
||||
GET /admin/config/get
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
**更新配置**
|
||||
```
|
||||
PATCH /admin/config/update
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"admin_token": "new-password",
|
||||
"uploadSize": 52428800
|
||||
}
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 忘记管理员密码
|
||||
|
||||
如果忘记了管理员密码,可以通过以下方式重置:
|
||||
|
||||
1. 停止 FileCodeBox 服务
|
||||
2. 使用 SQLite 工具打开 `data/filecodebox.db`
|
||||
3. 查询 `keyvalue` 表中 `key='settings'` 的记录
|
||||
4. 修改 JSON 中的 `admin_token` 值
|
||||
5. 重启服务
|
||||
|
||||
```sql
|
||||
-- 查看当前配置
|
||||
SELECT * FROM keyvalue WHERE key = 'settings';
|
||||
|
||||
-- 或者删除配置,恢复默认密码
|
||||
DELETE FROM keyvalue WHERE key = 'settings';
|
||||
```
|
||||
|
||||
### 文件删除失败
|
||||
|
||||
如果删除文件时出现错误,可能的原因:
|
||||
|
||||
1. **存储后端连接失败**:检查存储配置是否正确
|
||||
2. **文件已不存在**:文件可能已被手动删除
|
||||
3. **权限不足**:检查存储目录的写入权限
|
||||
|
||||
### 配置修改不生效
|
||||
|
||||
如果修改配置后没有生效:
|
||||
|
||||
1. 检查是否点击了保存按钮
|
||||
2. 刷新页面查看配置是否已保存
|
||||
3. 检查浏览器控制台是否有错误信息
|
||||
4. 确认配置值的格式是否正确(如数字类型不要输入字符串)
|
||||
|
||||
## 下一步
|
||||
|
||||
- [配置说明](/guide/configuration) - 了解所有配置选项的详细说明
|
||||
- [安全设置](/guide/security) - 了解如何增强系统安全性
|
||||
- [存储配置](/guide/storage) - 配置不同的存储后端
|
||||
@@ -0,0 +1,324 @@
|
||||
# 安全设置
|
||||
|
||||
FileCodeBox 提供了多层安全机制来保护您的文件分享服务。本文档介绍如何正确配置安全选项,确保系统安全运行。
|
||||
|
||||
## 管理员密码
|
||||
|
||||
### 修改默认密码
|
||||
|
||||
::: danger 重要安全警告
|
||||
FileCodeBox 的默认管理员密码是 `FileCodeBox2023`。**在生产环境中必须立即修改此密码!**使用默认密码会导致任何人都可以访问您的管理面板。
|
||||
:::
|
||||
|
||||
修改管理员密码有两种方式:
|
||||
|
||||
**方式一:通过管理面板修改(推荐)**
|
||||
|
||||
1. 访问 `/admin` 进入管理面板
|
||||
2. 使用当前密码登录
|
||||
3. 进入「系统设置」页面
|
||||
4. 找到 `admin_token` 配置项
|
||||
5. 输入新的安全密码并保存
|
||||
|
||||
**方式二:通过数据库修改**
|
||||
|
||||
配置存储在 `data/filecodebox.db` 数据库的 `keyvalue` 表中,可以直接修改 `admin_token` 的值。
|
||||
|
||||
### 密码安全建议
|
||||
|
||||
- 使用至少 16 个字符的强密码
|
||||
- 包含大小写字母、数字和特殊字符
|
||||
- 避免使用常见词汇或个人信息
|
||||
- 定期更换密码
|
||||
|
||||
```python
|
||||
# 推荐的密码格式示例
|
||||
"admin_token": "Xk9#mP2$vL5@nQ8&wR3"
|
||||
```
|
||||
|
||||
### 隐藏管理入口
|
||||
|
||||
默认情况下,管理面板入口是隐藏的。您可以通过 `showAdminAddr` 配置控制是否在首页显示管理入口:
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `showAdminAddr` | int | `0` | 是否显示管理入口(1=显示,0=隐藏) |
|
||||
|
||||
::: tip 建议
|
||||
在公开服务中,建议保持 `showAdminAddr` 为 `0`,通过直接访问 `/admin` 路径进入管理面板。
|
||||
:::
|
||||
|
||||
## IP 速率限制
|
||||
|
||||
FileCodeBox 内置了基于 IP 的速率限制机制,可以有效防止滥用和攻击。
|
||||
|
||||
### 上传频率限制
|
||||
|
||||
限制单个 IP 在指定时间内的上传次数:
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `uploadMinute` | int | `1` | 上传限制的时间窗口(分钟) |
|
||||
| `uploadCount` | int | `10` | 在时间窗口内允许的最大上传次数 |
|
||||
|
||||
**工作原理:**
|
||||
- 系统记录每个 IP 的上传请求
|
||||
- 当某 IP 在 `uploadMinute` 分钟内的上传次数达到 `uploadCount` 时
|
||||
- 该 IP 的后续上传请求将被拒绝,返回 HTTP 423 错误
|
||||
- 等待时间窗口过期后,计数器重置
|
||||
|
||||
**配置示例:**
|
||||
|
||||
```python
|
||||
# 宽松配置:5分钟内最多上传20次
|
||||
{
|
||||
"uploadMinute": 5,
|
||||
"uploadCount": 20
|
||||
}
|
||||
|
||||
# 严格配置:1分钟内最多上传3次
|
||||
{
|
||||
"uploadMinute": 1,
|
||||
"uploadCount": 3
|
||||
}
|
||||
```
|
||||
|
||||
### 错误次数限制
|
||||
|
||||
限制单个 IP 的错误尝试次数,防止暴力破解提取码:
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `errorMinute` | int | `1` | 错误限制的时间窗口(分钟) |
|
||||
| `errorCount` | int | `1` | 在时间窗口内允许的最大错误次数 |
|
||||
|
||||
**工作原理:**
|
||||
- 当用户输入错误的提取码时,系统记录该 IP 的错误次数
|
||||
- 当错误次数达到 `errorCount` 时,该 IP 将被暂时锁定
|
||||
- 锁定时间为 `errorMinute` 分钟
|
||||
- 锁定期间,该 IP 的所有提取请求都将被拒绝
|
||||
|
||||
**配置示例:**
|
||||
|
||||
```python
|
||||
# 防暴力破解配置:5分钟内最多允许3次错误
|
||||
{
|
||||
"errorMinute": 5,
|
||||
"errorCount": 3
|
||||
}
|
||||
```
|
||||
|
||||
::: warning 注意
|
||||
默认配置 `errorMinute=1, errorCount=1` 非常严格,意味着输入一次错误的提取码后需要等待1分钟才能重试。根据实际需求调整此配置。
|
||||
:::
|
||||
|
||||
## 上传限制
|
||||
|
||||
### 文件大小限制
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `uploadSize` | int | `10485760` | 单文件最大上传大小(字节),默认 10MB |
|
||||
| `openUpload` | int | `1` | 是否开启上传功能(1=开启,0=关闭) |
|
||||
|
||||
**常用大小换算:**
|
||||
- 10MB = 10 * 1024 * 1024 = `10485760`
|
||||
- 50MB = 50 * 1024 * 1024 = `52428800`
|
||||
- 100MB = 100 * 1024 * 1024 = `104857600`
|
||||
- 1GB = 1024 * 1024 * 1024 = `1073741824`
|
||||
|
||||
### 文件过期设置
|
||||
|
||||
通过文件过期机制,可以自动清理过期文件,减少存储占用和安全风险:
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `expireStyle` | list | `["day","hour","minute","forever","count"]` | 可选的过期方式 |
|
||||
| `max_save_seconds` | int | `0` | 文件最大保存时间(秒),0 表示不限制 |
|
||||
|
||||
**过期方式说明:**
|
||||
- `day` - 按天数过期
|
||||
- `hour` - 按小时过期
|
||||
- `minute` - 按分钟过期
|
||||
- `forever` - 永不过期(需要字符串提取码)
|
||||
- `count` - 按下载次数过期
|
||||
|
||||
**安全建议:**
|
||||
|
||||
对于公开服务,建议:
|
||||
1. 移除 `forever` 选项,避免文件永久存储
|
||||
2. 设置 `max_save_seconds` 限制最长保存时间
|
||||
3. 优先使用 `count` 方式,下载后自动删除
|
||||
|
||||
```python
|
||||
# 公开服务推荐配置
|
||||
{
|
||||
"expireStyle": ["hour", "minute", "count"],
|
||||
"max_save_seconds": 86400 # 最长保存1天
|
||||
}
|
||||
```
|
||||
|
||||
### 关闭上传功能
|
||||
|
||||
在某些情况下,您可能需要临时关闭上传功能:
|
||||
|
||||
```python
|
||||
{
|
||||
"openUpload": 0 # 关闭上传功能
|
||||
}
|
||||
```
|
||||
|
||||
## 反向代理安全配置
|
||||
|
||||
在生产环境中,通常会使用 Nginx 或其他反向代理服务器。以下是安全配置建议:
|
||||
|
||||
### Nginx 配置示例
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your-domain.com;
|
||||
|
||||
# 强制 HTTPS 重定向
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name your-domain.com;
|
||||
|
||||
# SSL 证书配置
|
||||
ssl_certificate /path/to/cert.pem;
|
||||
ssl_certificate_key /path/to/key.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# 安全头部
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# 限制请求体大小(与 uploadSize 配置一致)
|
||||
client_max_body_size 100M;
|
||||
|
||||
# 传递真实 IP
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:12345;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# 静态资源缓存
|
||||
location /assets {
|
||||
proxy_pass http://127.0.0.1:12345;
|
||||
proxy_cache_valid 200 7d;
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 关键安全配置说明
|
||||
|
||||
**1. 传递真实 IP**
|
||||
|
||||
FileCodeBox 的 IP 限制功能依赖于获取客户端真实 IP。系统会按以下顺序获取 IP:
|
||||
1. `X-Real-IP` 请求头
|
||||
2. `X-Forwarded-For` 请求头
|
||||
3. 直接连接的客户端 IP
|
||||
|
||||
确保反向代理正确设置这些头部:
|
||||
|
||||
```nginx
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
```
|
||||
|
||||
**2. 请求体大小限制**
|
||||
|
||||
Nginx 的 `client_max_body_size` 应该与 FileCodeBox 的 `uploadSize` 配置一致或略大:
|
||||
|
||||
```nginx
|
||||
client_max_body_size 100M; # 允许上传最大 100MB
|
||||
```
|
||||
|
||||
**3. HTTPS 加密**
|
||||
|
||||
强烈建议在生产环境中启用 HTTPS:
|
||||
- 保护用户上传的文件内容
|
||||
- 保护管理员登录凭据
|
||||
- 防止中间人攻击
|
||||
|
||||
### Caddy 配置示例
|
||||
|
||||
```nginx
|
||||
your-domain.com {
|
||||
reverse_proxy localhost:12345
|
||||
|
||||
header {
|
||||
X-Frame-Options "SAMEORIGIN"
|
||||
X-Content-Type-Options "nosniff"
|
||||
X-XSS-Protection "1; mode=block"
|
||||
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 安全检查清单
|
||||
|
||||
部署 FileCodeBox 前,请确认以下安全配置:
|
||||
|
||||
- [ ] 已修改默认管理员密码 `admin_token`
|
||||
- [ ] 已隐藏管理入口 `showAdminAddr: 0`
|
||||
- [ ] 已配置合适的上传频率限制
|
||||
- [ ] 已配置错误次数限制防止暴力破解
|
||||
- [ ] 已设置合理的文件大小限制
|
||||
- [ ] 已配置文件过期策略
|
||||
- [ ] 已启用 HTTPS 加密
|
||||
- [ ] 反向代理已正确传递真实 IP
|
||||
- [ ] 已设置安全响应头部
|
||||
|
||||
## 推荐安全配置
|
||||
|
||||
### 公开服务配置
|
||||
|
||||
```python
|
||||
{
|
||||
"admin_token": "your-very-secure-password",
|
||||
"showAdminAddr": 0,
|
||||
"uploadSize": 10485760, # 10MB
|
||||
"uploadMinute": 1,
|
||||
"uploadCount": 5,
|
||||
"errorMinute": 5,
|
||||
"errorCount": 3,
|
||||
"expireStyle": ["hour", "minute", "count"],
|
||||
"max_save_seconds": 86400, # 最长1天
|
||||
"openUpload": 1
|
||||
}
|
||||
```
|
||||
|
||||
### 内部服务配置
|
||||
|
||||
```python
|
||||
{
|
||||
"admin_token": "internal-secure-password",
|
||||
"showAdminAddr": 1,
|
||||
"uploadSize": 104857600, # 100MB
|
||||
"uploadMinute": 5,
|
||||
"uploadCount": 50,
|
||||
"errorMinute": 1,
|
||||
"errorCount": 5,
|
||||
"expireStyle": ["day", "hour", "forever"],
|
||||
"max_save_seconds": 0, # 不限制
|
||||
"openUpload": 1
|
||||
}
|
||||
```
|
||||
|
||||
## 下一步
|
||||
|
||||
- [配置说明](/guide/configuration) - 了解所有配置选项
|
||||
- [存储配置](/guide/storage) - 配置安全的存储后端
|
||||
- [文件分享](/guide/share) - 了解文件分享功能
|
||||
@@ -0,0 +1,341 @@
|
||||
# 文件分享
|
||||
|
||||
FileCodeBox 提供了简单易用的文件和文本分享功能。用户可以通过提取码安全地分享和获取文件。
|
||||
|
||||
## 分享方式
|
||||
|
||||
FileCodeBox 支持两种分享方式:
|
||||
|
||||
1. **文本分享** - 直接分享文本内容,适合代码片段、配置文件等
|
||||
2. **文件分享** - 上传文件进行分享,支持各种文件格式
|
||||
|
||||
## 文本分享
|
||||
|
||||
### 使用方法
|
||||
|
||||
1. 在首页选择「文本分享」标签
|
||||
2. 在文本框中输入或粘贴要分享的内容
|
||||
3. 选择过期方式和时间
|
||||
4. 点击「分享」按钮
|
||||
5. 获取提取码
|
||||
|
||||
### 文本大小限制
|
||||
|
||||
::: warning 注意
|
||||
文本分享的最大内容大小为 **222KB**(227,328 字节)。如果内容超过此限制,建议使用文件分享方式。
|
||||
:::
|
||||
|
||||
文本内容大小按 UTF-8 编码计算,中文字符通常占用 3 个字节。
|
||||
|
||||
### API 接口
|
||||
|
||||
**POST** `/share/text/`
|
||||
|
||||
请求参数:
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `text` | string | 是 | 要分享的文本内容 |
|
||||
| `expire_value` | int | 否 | 过期数值,默认 1 |
|
||||
| `expire_style` | string | 否 | 过期方式,默认 `day` |
|
||||
|
||||
响应示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 文件分享
|
||||
|
||||
### 使用方法
|
||||
|
||||
1. 在首页选择「文件分享」标签
|
||||
2. 点击上传区域或拖拽文件到上传区域
|
||||
3. 选择过期方式和时间
|
||||
4. 点击「上传」按钮
|
||||
5. 获取提取码
|
||||
|
||||
### 文件大小限制
|
||||
|
||||
默认单文件最大上传大小为 **10MB**。管理员可以通过 `uploadSize` 配置项修改此限制。
|
||||
|
||||
::: tip 提示
|
||||
如果需要上传大文件,请联系管理员启用分片上传功能,或调整 `uploadSize` 配置。
|
||||
:::
|
||||
|
||||
### 支持的上传方式
|
||||
|
||||
- **点击上传** - 点击上传区域选择文件
|
||||
- **拖拽上传** - 将文件拖拽到上传区域
|
||||
- **粘贴上传** - 从剪贴板粘贴图片(部分主题支持)
|
||||
|
||||
### API 接口
|
||||
|
||||
**POST** `/share/file/`
|
||||
|
||||
请求参数(multipart/form-data):
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `file` | file | 是 | 要上传的文件 |
|
||||
| `expire_value` | int | 否 | 过期数值,默认 1 |
|
||||
| `expire_style` | string | 否 | 过期方式,默认 `day` |
|
||||
|
||||
响应示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "654321",
|
||||
"name": "example.pdf"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 过期设置
|
||||
|
||||
FileCodeBox 支持多种灵活的过期方式:
|
||||
|
||||
| 过期方式 | 参数值 | 说明 |
|
||||
|----------|--------|------|
|
||||
| 按天过期 | `day` | 文件在指定天数后过期 |
|
||||
| 按小时过期 | `hour` | 文件在指定小时后过期 |
|
||||
| 按分钟过期 | `minute` | 文件在指定分钟后过期 |
|
||||
| 永不过期 | `forever` | 文件永久有效 |
|
||||
| 按次数过期 | `count` | 文件在被下载指定次数后过期 |
|
||||
|
||||
::: info 说明
|
||||
- 管理员可以通过 `expireStyle` 配置项控制用户可选的过期方式
|
||||
- 管理员可以通过 `max_save_seconds` 配置项限制文件的最长保存时间
|
||||
:::
|
||||
|
||||
### 过期方式示例
|
||||
|
||||
```bash
|
||||
# 文件 3 天后过期
|
||||
expire_value=3, expire_style=day
|
||||
|
||||
# 文件 12 小时后过期
|
||||
expire_value=12, expire_style=hour
|
||||
|
||||
# 文件 30 分钟后过期
|
||||
expire_value=30, expire_style=minute
|
||||
|
||||
# 文件永不过期
|
||||
expire_value=1, expire_style=forever
|
||||
|
||||
# 文件被下载 5 次后过期
|
||||
expire_value=5, expire_style=count
|
||||
```
|
||||
|
||||
## 提取文件
|
||||
|
||||
### 使用方法
|
||||
|
||||
1. 在首页的「提取文件」区域输入提取码
|
||||
2. 点击「提取」按钮
|
||||
3. 系统会显示文件信息(文件名、大小等)
|
||||
4. 点击「下载」按钮下载文件,或直接查看文本内容
|
||||
|
||||
### 提取码说明
|
||||
|
||||
- 提取码通常为 **6 位数字**
|
||||
- 永不过期的文件使用 **字母数字混合** 的提取码
|
||||
- 提取码区分大小写(针对字母数字混合的情况)
|
||||
|
||||
### API 接口
|
||||
|
||||
**查询文件信息**
|
||||
|
||||
**POST** `/share/select/`
|
||||
|
||||
请求参数:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "123456"
|
||||
}
|
||||
```
|
||||
|
||||
响应示例(文件):
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456",
|
||||
"name": "example.pdf",
|
||||
"size": 1048576,
|
||||
"text": "https://example.com/download/..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
响应示例(文本):
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "123456",
|
||||
"name": "Text",
|
||||
"size": 1024,
|
||||
"text": "这是分享的文本内容..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**直接下载文件**
|
||||
|
||||
**GET** `/share/select/?code=123456`
|
||||
|
||||
此接口会直接返回文件内容,适合在浏览器中直接访问。
|
||||
|
||||
## 分片上传(大文件)
|
||||
|
||||
对于大文件上传,FileCodeBox 支持分片上传功能。此功能需要管理员启用(`enableChunk=1`)。
|
||||
|
||||
### 分片上传流程
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant C as 客户端
|
||||
participant S as 服务器
|
||||
|
||||
C->>S: 1. 初始化上传 (POST /chunk/upload/init/)
|
||||
S-->>C: 返回 upload_id 和分片信息
|
||||
|
||||
loop 每个分片
|
||||
C->>S: 2. 上传分片 (POST /chunk/upload/chunk/{upload_id}/{chunk_index})
|
||||
S-->>C: 返回分片哈希
|
||||
end
|
||||
|
||||
C->>S: 3. 完成上传 (POST /chunk/upload/complete/{upload_id})
|
||||
S-->>C: 返回提取码
|
||||
```
|
||||
|
||||
### 1. 初始化上传
|
||||
|
||||
**POST** `/chunk/upload/init/`
|
||||
|
||||
请求参数:
|
||||
|
||||
```json
|
||||
{
|
||||
"file_name": "large_file.zip",
|
||||
"file_size": 104857600,
|
||||
"chunk_size": 5242880,
|
||||
"file_hash": "sha256_hash_of_file"
|
||||
}
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `file_name` | string | 是 | 文件名 |
|
||||
| `file_size` | int | 是 | 文件总大小(字节) |
|
||||
| `chunk_size` | int | 否 | 分片大小,默认 5MB |
|
||||
| `file_hash` | string | 是 | 文件的 SHA256 哈希值 |
|
||||
|
||||
响应示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"existed": false,
|
||||
"upload_id": "abc123def456",
|
||||
"chunk_size": 5242880,
|
||||
"total_chunks": 20,
|
||||
"uploaded_chunks": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. 上传分片
|
||||
|
||||
**POST** `/chunk/upload/chunk/{upload_id}/{chunk_index}`
|
||||
|
||||
- `upload_id` - 初始化时返回的上传会话 ID
|
||||
- `chunk_index` - 分片索引,从 0 开始
|
||||
|
||||
请求体:分片文件数据(multipart/form-data)
|
||||
|
||||
响应示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"chunk_hash": "sha256_hash_of_chunk"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. 完成上传
|
||||
|
||||
**POST** `/chunk/upload/complete/{upload_id}`
|
||||
|
||||
请求参数:
|
||||
|
||||
```json
|
||||
{
|
||||
"expire_value": 1,
|
||||
"expire_style": "day"
|
||||
}
|
||||
```
|
||||
|
||||
响应示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "789012",
|
||||
"name": "large_file.zip"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 断点续传
|
||||
|
||||
分片上传支持断点续传。如果上传中断,可以:
|
||||
|
||||
1. 重新调用初始化接口,使用相同的 `file_hash`
|
||||
2. 服务器会返回已上传的分片列表 `uploaded_chunks`
|
||||
3. 客户端只需上传未完成的分片
|
||||
|
||||
## 错误处理
|
||||
|
||||
### 常见错误码
|
||||
|
||||
| 错误码 | 说明 | 解决方案 |
|
||||
|--------|------|----------|
|
||||
| 403 | 文件大小超过限制 | 减小文件大小或联系管理员调整限制 |
|
||||
| 403 | 内容过多 | 文本超过 222KB,请使用文件分享 |
|
||||
| 403 | 上传频率限制 | 等待一段时间后重试 |
|
||||
| 404 | 文件不存在 | 检查提取码是否正确 |
|
||||
| 404 | 文件已过期 | 文件已过期或下载次数已用完 |
|
||||
|
||||
### 频率限制
|
||||
|
||||
为防止滥用,系统对上传和提取操作有频率限制:
|
||||
|
||||
- **上传限制**:默认每分钟最多 10 次上传
|
||||
- **错误限制**:默认每分钟最多 1 次错误尝试
|
||||
|
||||
::: tip 提示
|
||||
如果遇到频率限制,请等待限制时间窗口过后再重试。
|
||||
:::
|
||||
|
||||
## 下一步
|
||||
|
||||
- [配置说明](/guide/configuration) - 了解如何配置分享相关设置
|
||||
- [存储配置](/guide/storage) - 了解文件存储方式
|
||||
- [安全设置](/guide/security) - 了解安全相关配置
|
||||
- [管理面板](/guide/management) - 了解如何管理分享的文件
|
||||
@@ -0,0 +1,395 @@
|
||||
# 存储配置
|
||||
|
||||
FileCodeBox 支持多种存储后端,您可以根据需求选择合适的存储方式。本文档将详细介绍各种存储后端的配置方法。
|
||||
|
||||
## 存储类型概览
|
||||
|
||||
| 存储类型 | 配置值 | 说明 |
|
||||
|---------|--------|------|
|
||||
| 本地存储 | `local` | 默认存储方式,文件保存在服务器本地 |
|
||||
| S3 兼容存储 | `s3` | 支持 AWS S3、阿里云 OSS、MinIO 等 |
|
||||
| OneDrive | `onedrive` | 微软 OneDrive 云存储(仅支持工作/学校账户) |
|
||||
| WebDAV | `webdav` | 支持 WebDAV 协议的存储服务 |
|
||||
| OpenDAL | `opendal` | 通过 OpenDAL 集成更多存储服务 |
|
||||
|
||||
## 本地存储
|
||||
|
||||
本地存储是默认的存储方式,文件将保存在服务器的 `data/` 目录下。
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数 | 类型 | 默认值 | 说明 |
|
||||
|------|------|--------|------|
|
||||
| `file_storage` | string | `local` | 存储类型 |
|
||||
| `storage_path` | string | `""` | 自定义存储路径(可选) |
|
||||
|
||||
### 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=local
|
||||
storage_path=
|
||||
```
|
||||
|
||||
### 说明
|
||||
|
||||
- 文件默认存储在 `data/share/data/` 目录下
|
||||
- 按日期自动创建子目录:`年/月/日/文件ID/`
|
||||
- 建议在生产环境中将 `data/` 目录挂载到持久化存储
|
||||
|
||||
## S3 兼容存储
|
||||
|
||||
支持所有 S3 兼容的对象存储服务,包括 AWS S3、阿里云 OSS、MinIO、腾讯云 COS 等。
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数 | 类型 | 默认值 | 说明 |
|
||||
|------|------|--------|------|
|
||||
| `file_storage` | string | - | 设置为 `s3` |
|
||||
| `s3_access_key_id` | string | `""` | Access Key ID |
|
||||
| `s3_secret_access_key` | string | `""` | Secret Access Key |
|
||||
| `s3_bucket_name` | string | `""` | 存储桶名称 |
|
||||
| `s3_endpoint_url` | string | `""` | S3 端点 URL |
|
||||
| `s3_region_name` | string | `auto` | 区域名称 |
|
||||
| `s3_signature_version` | string | `s3v2` | 签名版本(`s3v2` 或 `s3v4`) |
|
||||
| `s3_hostname` | string | `""` | S3 主机名(备用) |
|
||||
| `s3_proxy` | int | `0` | 是否通过服务器代理下载(1=是,0=否) |
|
||||
| `aws_session_token` | string | `""` | AWS 会话令牌(可选) |
|
||||
|
||||
### AWS S3 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=AKIAIOSFODNN7EXAMPLE
|
||||
s3_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
s3_bucket_name=my-filecodebox-bucket
|
||||
s3_endpoint_url=https://s3.amazonaws.com
|
||||
s3_region_name=us-east-1
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
### 阿里云 OSS 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=您的AccessKeyId
|
||||
s3_secret_access_key=您的SecretAccessKey
|
||||
s3_bucket_name=bucket-name
|
||||
s3_endpoint_url=https://bucket-name.oss-cn-hangzhou.aliyuncs.com
|
||||
s3_region_name=oss-cn-hangzhou
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
::: tip 阿里云 OSS 端点格式
|
||||
端点 URL 格式为:`https://<bucket-name>.<region>.aliyuncs.com`
|
||||
|
||||
常用区域:
|
||||
- 杭州:`oss-cn-hangzhou`
|
||||
- 上海:`oss-cn-shanghai`
|
||||
- 北京:`oss-cn-beijing`
|
||||
- 深圳:`oss-cn-shenzhen`
|
||||
:::
|
||||
|
||||
### MinIO 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=minioadmin
|
||||
s3_secret_access_key=minioadmin
|
||||
s3_bucket_name=filecodebox
|
||||
s3_endpoint_url=http://localhost:9000
|
||||
s3_region_name=us-east-1
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
::: warning MinIO 注意事项
|
||||
- `s3_endpoint_url` 填写 MinIO 的 API 接口地址
|
||||
- `s3_region_name` 根据 MinIO 配置中的 `Server Location` 设置
|
||||
- 确保存储桶已创建且有正确的访问权限
|
||||
:::
|
||||
|
||||
### 腾讯云 COS 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=s3
|
||||
s3_access_key_id=您的SecretId
|
||||
s3_secret_access_key=您的SecretKey
|
||||
s3_bucket_name=bucket-name-1250000000
|
||||
s3_endpoint_url=https://cos.ap-guangzhou.myqcloud.com
|
||||
s3_region_name=ap-guangzhou
|
||||
s3_signature_version=s3v4
|
||||
```
|
||||
|
||||
### 代理下载
|
||||
|
||||
当 `s3_proxy=1` 时,文件下载将通过服务器中转,而不是直接从 S3 下载。这在以下情况下有用:
|
||||
|
||||
- S3 存储桶不允许公开访问
|
||||
- 需要隐藏实际的存储地址
|
||||
- 网络环境限制直接访问 S3
|
||||
|
||||
|
||||
|
||||
## OneDrive 存储
|
||||
|
||||
OneDrive 存储支持将文件保存到微软 OneDrive 云存储。
|
||||
|
||||
::: warning 重要限制
|
||||
OneDrive 存储**仅支持工作或学校账户**,并且需要有管理员权限以授权 API。个人账户无法使用此功能。
|
||||
:::
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数 | 类型 | 默认值 | 说明 |
|
||||
|------|------|--------|------|
|
||||
| `file_storage` | string | - | 设置为 `onedrive` |
|
||||
| `onedrive_domain` | string | `""` | Azure AD 域名 |
|
||||
| `onedrive_client_id` | string | `""` | 应用程序(客户端)ID |
|
||||
| `onedrive_username` | string | `""` | 账户邮箱 |
|
||||
| `onedrive_password` | string | `""` | 账户密码 |
|
||||
| `onedrive_root_path` | string | `filebox_storage` | OneDrive 中的存储根目录 |
|
||||
| `onedrive_proxy` | int | `0` | 是否通过服务器代理下载 |
|
||||
|
||||
### 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=onedrive
|
||||
onedrive_domain=contoso.onmicrosoft.com
|
||||
onedrive_client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
onedrive_username=user@contoso.onmicrosoft.com
|
||||
onedrive_password=your_password
|
||||
onedrive_root_path=filebox_storage
|
||||
```
|
||||
|
||||
### Azure 应用注册步骤
|
||||
|
||||
要使用 OneDrive 存储,您需要在 Azure 门户中注册应用程序:
|
||||
|
||||
#### 1. 获取域名
|
||||
|
||||
登录 [Azure 门户](https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade),将鼠标置于右上角账号处,浮窗显示的**域**即为 `onedrive_domain` 的值。
|
||||
|
||||
#### 2. 注册应用
|
||||
|
||||
1. 点击左上角的 **+ 新注册**
|
||||
2. 输入应用名称(如:FileCodeBox)
|
||||
3. **受支持的帐户类型**:选择"任何组织目录(任何 Azure AD 目录 - 多租户)中的帐户和个人 Microsoft 帐户"
|
||||
4. **重定向 URI**:选择 `Web`,输入 `http://localhost`
|
||||
5. 点击**注册**
|
||||
|
||||
#### 3. 获取客户端 ID
|
||||
|
||||
注册完成后,在应用概述页面的**概要**中找到**应用程序(客户端)ID**,即为 `onedrive_client_id` 的值。
|
||||
|
||||
#### 4. 配置身份验证
|
||||
|
||||
1. 在左侧菜单选择**身份验证**
|
||||
2. 找到**允许公共客户端流**,选择**是**
|
||||
3. 点击**保存**
|
||||
|
||||
#### 5. 配置 API 权限
|
||||
|
||||
1. 在左侧菜单选择 **API 权限**
|
||||
2. 点击 **+ 添加权限**
|
||||
3. 选择 **Microsoft Graph** → **委托的权限**
|
||||
4. 勾选以下权限:
|
||||
- `openid`
|
||||
- `Files.Read`
|
||||
- `Files.Read.All`
|
||||
- `Files.ReadWrite`
|
||||
- `Files.ReadWrite.All`
|
||||
- `User.Read`
|
||||
5. 点击**添加权限**
|
||||
6. 点击**代表 xxx 授予管理员同意**
|
||||
7. 确认后,权限状态应显示为**已授予**
|
||||
|
||||
### 安装依赖
|
||||
|
||||
使用 OneDrive 存储需要安装额外的 Python 依赖:
|
||||
|
||||
```bash
|
||||
pip install msal Office365-REST-Python-Client
|
||||
```
|
||||
|
||||
### 验证配置
|
||||
|
||||
您可以使用以下代码测试配置是否正确:
|
||||
|
||||
```python
|
||||
import msal
|
||||
from office365.graph_client import GraphClient
|
||||
|
||||
domain = 'your_domain'
|
||||
client_id = 'your_client_id'
|
||||
username = 'your_username'
|
||||
password = 'your_password'
|
||||
|
||||
def acquire_token_pwd():
|
||||
authority_url = f'https://login.microsoftonline.com/{domain}'
|
||||
app = msal.PublicClientApplication(
|
||||
authority=authority_url,
|
||||
client_id=client_id
|
||||
)
|
||||
result = app.acquire_token_by_username_password(
|
||||
username=username,
|
||||
password=password,
|
||||
scopes=['https://graph.microsoft.com/.default']
|
||||
)
|
||||
return result
|
||||
|
||||
# 测试连接
|
||||
client = GraphClient(acquire_token_pwd)
|
||||
me = client.me.get().execute_query()
|
||||
print(f"登录成功:{me.user_principal_name}")
|
||||
```
|
||||
|
||||
## WebDAV 存储
|
||||
|
||||
WebDAV 存储支持将文件保存到任何支持 WebDAV 协议的服务,如 Nextcloud、ownCloud、坚果云等。
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数 | 类型 | 默认值 | 说明 |
|
||||
|------|------|--------|------|
|
||||
| `file_storage` | string | - | 设置为 `webdav` |
|
||||
| `webdav_url` | string | `""` | WebDAV 服务器 URL |
|
||||
| `webdav_username` | string | `""` | WebDAV 用户名 |
|
||||
| `webdav_password` | string | `""` | WebDAV 密码 |
|
||||
| `webdav_root_path` | string | `filebox_storage` | WebDAV 中的存储根目录 |
|
||||
| `webdav_proxy` | int | `0` | 是否通过服务器代理下载 |
|
||||
|
||||
### 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=webdav
|
||||
webdav_url=https://dav.example.com/remote.php/dav/files/username/
|
||||
webdav_username=your_username
|
||||
webdav_password=your_password
|
||||
webdav_root_path=filebox_storage
|
||||
```
|
||||
|
||||
### Nextcloud 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=webdav
|
||||
webdav_url=https://your-nextcloud.com/remote.php/dav/files/username/
|
||||
webdav_username=your_username
|
||||
webdav_password=your_app_password
|
||||
webdav_root_path=FileCodeBox
|
||||
```
|
||||
|
||||
::: tip Nextcloud 应用密码
|
||||
建议在 Nextcloud 中创建应用密码,而不是使用主密码:
|
||||
1. 登录 Nextcloud
|
||||
2. 进入**设置** → **安全**
|
||||
3. 在**设备与会话**中创建新的应用密码
|
||||
:::
|
||||
|
||||
### 坚果云配置示例
|
||||
|
||||
```bash
|
||||
file_storage=webdav
|
||||
webdav_url=https://dav.jianguoyun.com/dav/
|
||||
webdav_username=your_email@example.com
|
||||
webdav_password=your_app_password
|
||||
webdav_root_path=FileCodeBox
|
||||
```
|
||||
|
||||
::: tip 坚果云应用密码
|
||||
坚果云需要使用应用密码:
|
||||
1. 登录坚果云网页版
|
||||
2. 进入**账户信息** → **安全选项**
|
||||
3. 添加应用密码
|
||||
:::
|
||||
|
||||
## OpenDAL 存储
|
||||
|
||||
OpenDAL 是一个统一的数据访问层,支持多种存储服务。通过 OpenDAL,您可以使用 Google Cloud Storage、Azure Blob Storage 等更多存储服务。
|
||||
|
||||
### 配置参数
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `file_storage` | string | 设置为 `opendal` |
|
||||
| `opendal_scheme` | string | 存储服务类型(如 `gcs`、`azblob`) |
|
||||
| `opendal_<scheme>_<setting>` | string | 服务特定的配置参数 |
|
||||
|
||||
### 安装依赖
|
||||
|
||||
```bash
|
||||
pip install opendal
|
||||
```
|
||||
|
||||
### Google Cloud Storage 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=opendal
|
||||
opendal_scheme=gcs
|
||||
opendal_gcs_root=/filecodebox
|
||||
opendal_gcs_bucket=your-bucket-name
|
||||
opendal_gcs_credential=base64_encoded_credential
|
||||
```
|
||||
|
||||
### Azure Blob Storage 配置示例
|
||||
|
||||
```bash
|
||||
file_storage=opendal
|
||||
opendal_scheme=azblob
|
||||
opendal_azblob_root=/filecodebox
|
||||
opendal_azblob_container=your-container
|
||||
opendal_azblob_account_name=your_account
|
||||
opendal_azblob_account_key=your_key
|
||||
```
|
||||
|
||||
### 支持的服务
|
||||
|
||||
OpenDAL 支持众多存储服务,完整列表请参考 [OpenDAL 官方文档](https://opendal.apache.org/docs/rust/opendal/services/index.html)。
|
||||
|
||||
常用服务包括:
|
||||
- `gcs` - Google Cloud Storage
|
||||
- `azblob` - Azure Blob Storage
|
||||
- `obs` - 华为云 OBS
|
||||
- `oss` - 阿里云 OSS(通过 OpenDAL)
|
||||
- `cos` - 腾讯云 COS(通过 OpenDAL)
|
||||
- `hdfs` - Hadoop HDFS
|
||||
- `ftp` - FTP 服务器
|
||||
- `sftp` - SFTP 服务器
|
||||
|
||||
::: warning OpenDAL 注意事项
|
||||
1. 通过 OpenDAL 集成的服务均通过服务器中转下载,会同时消耗存储服务和服务器的流量
|
||||
2. 相比原生 S3/OneDrive 支持,OpenDAL 方式可能缺少一些调试信息
|
||||
3. OpenDAL 采用 Rust 编写,性能较好
|
||||
:::
|
||||
|
||||
## 存储选择建议
|
||||
|
||||
| 场景 | 推荐存储 | 原因 |
|
||||
|------|----------|------|
|
||||
| 个人/小型部署 | 本地存储 | 简单易用,无需额外配置 |
|
||||
| 企业内网 | MinIO + S3 | 自建对象存储,数据可控 |
|
||||
| 公有云部署 | 对应云厂商 S3 | 同区域访问快,成本低 |
|
||||
| 已有 OneDrive | OneDrive | 利用现有资源 |
|
||||
| 已有 WebDAV | WebDAV | 兼容性好 |
|
||||
| 特殊存储需求 | OpenDAL | 支持更多存储服务 |
|
||||
|
||||
## 常见问题
|
||||
|
||||
### S3 上传失败
|
||||
|
||||
1. 检查 Access Key 和 Secret Key 是否正确
|
||||
2. 确认存储桶名称和区域配置正确
|
||||
3. 检查存储桶的访问权限设置
|
||||
4. 确认签名版本(`s3v2` 或 `s3v4`)与服务商要求一致
|
||||
|
||||
### OneDrive 认证失败
|
||||
|
||||
1. 确认使用的是工作/学校账户,而非个人账户
|
||||
2. 检查 Azure 应用是否已授予管理员同意
|
||||
3. 确认 API 权限配置完整
|
||||
4. 验证用户名和密码是否正确
|
||||
|
||||
### WebDAV 连接失败
|
||||
|
||||
1. 检查 WebDAV URL 格式是否正确
|
||||
2. 确认用户名和密码(或应用密码)正确
|
||||
3. 检查服务器是否支持 WebDAV 协议
|
||||
4. 确认网络连接正常
|
||||
@@ -0,0 +1,379 @@
|
||||
# 文件上传
|
||||
|
||||
FileCodeBox 提供了多种灵活的文件上传方式,支持普通上传和分片上传,满足不同场景的需求。
|
||||
|
||||
## 上传方式
|
||||
|
||||
FileCodeBox 支持以下几种上传方式:
|
||||
|
||||
### 拖拽上传
|
||||
|
||||
将文件直接拖拽到上传区域即可开始上传。这是最便捷的上传方式。
|
||||
|
||||
1. 打开 FileCodeBox 首页
|
||||
2. 将文件从文件管理器拖拽到上传区域
|
||||
3. 松开鼠标,文件开始上传
|
||||
4. 上传完成后获取提取码
|
||||
|
||||
::: tip 提示
|
||||
拖拽上传支持同时拖拽多个文件(取决于主题支持)。
|
||||
:::
|
||||
|
||||
### 点击上传
|
||||
|
||||
点击上传区域,通过系统文件选择器选择文件。
|
||||
|
||||
1. 点击上传区域的「选择文件」按钮
|
||||
2. 在弹出的文件选择器中选择要上传的文件
|
||||
3. 确认选择后文件开始上传
|
||||
4. 上传完成后获取提取码
|
||||
|
||||
### 粘贴上传
|
||||
|
||||
支持从剪贴板直接粘贴图片进行上传(部分主题支持)。
|
||||
|
||||
1. 复制图片到剪贴板(截图或复制图片)
|
||||
2. 在上传区域使用 `Ctrl+V`(Windows/Linux)或 `Cmd+V`(macOS)粘贴
|
||||
3. 图片自动开始上传
|
||||
4. 上传完成后获取提取码
|
||||
|
||||
::: warning 注意
|
||||
粘贴上传仅支持图片格式,不支持其他文件类型。具体支持情况取决于所使用的主题。
|
||||
:::
|
||||
|
||||
## 文件大小限制
|
||||
|
||||
### 默认限制
|
||||
|
||||
| 配置项 | 默认值 | 说明 |
|
||||
|--------|--------|------|
|
||||
| `uploadSize` | 10MB | 单文件最大上传大小 |
|
||||
|
||||
### 修改上传限制
|
||||
|
||||
管理员可以通过管理面板或配置文件修改上传大小限制:
|
||||
|
||||
```python
|
||||
# 设置最大上传大小为 100MB
|
||||
uploadSize = 104857600 # 100 * 1024 * 1024
|
||||
```
|
||||
|
||||
::: info 说明
|
||||
`uploadSize` 的单位是字节。常用换算:
|
||||
- 10MB = 10485760
|
||||
- 50MB = 52428800
|
||||
- 100MB = 104857600
|
||||
- 500MB = 524288000
|
||||
- 1GB = 1073741824
|
||||
:::
|
||||
|
||||
### 超出限制的处理
|
||||
|
||||
当上传文件超过大小限制时,系统会返回 403 错误:
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": "大小超过限制,最大为10.00 MB"
|
||||
}
|
||||
```
|
||||
|
||||
## 普通上传 API
|
||||
|
||||
### 文件上传接口
|
||||
|
||||
**POST** `/share/file/`
|
||||
|
||||
Content-Type: `multipart/form-data`
|
||||
|
||||
**请求参数:**
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `file` | file | 是 | 要上传的文件 |
|
||||
| `expire_value` | int | 否 | 过期数值,默认 1 |
|
||||
| `expire_style` | string | 否 | 过期方式,默认 `day` |
|
||||
|
||||
**过期方式选项:**
|
||||
|
||||
| 值 | 说明 |
|
||||
|----|------|
|
||||
| `day` | 按天过期 |
|
||||
| `hour` | 按小时过期 |
|
||||
| `minute` | 按分钟过期 |
|
||||
| `forever` | 永不过期 |
|
||||
| `count` | 按下载次数过期 |
|
||||
|
||||
**响应示例:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "654321",
|
||||
"name": "example.pdf"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**cURL 示例:**
|
||||
|
||||
```bash
|
||||
curl -X POST "http://localhost:12345/share/file/" \
|
||||
-F "file=@/path/to/file.pdf" \
|
||||
-F "expire_value=7" \
|
||||
-F "expire_style=day"
|
||||
```
|
||||
|
||||
## 分片上传 API
|
||||
|
||||
对于大文件,FileCodeBox 支持分片上传功能。分片上传将大文件分割成多个小块分别上传,支持断点续传。
|
||||
|
||||
::: warning 前提条件
|
||||
分片上传功能需要管理员启用:`enableChunk=1`
|
||||
:::
|
||||
|
||||
### 分片上传流程
|
||||
|
||||
```
|
||||
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
||||
│ 初始化上传 │ ──▶ │ 上传分片 │ ──▶ │ 完成上传 │
|
||||
│ /init/ │ │ /chunk/ │ │ /complete/ │
|
||||
└─────────────┘ └─────────────┘ └─────────────┘
|
||||
│
|
||||
▼
|
||||
┌───────────┐
|
||||
│ 循环上传 │
|
||||
│ 每个分片 │
|
||||
└───────────┘
|
||||
```
|
||||
|
||||
### 1. 初始化上传
|
||||
|
||||
**POST** `/chunk/upload/init/`
|
||||
|
||||
**请求参数:**
|
||||
|
||||
```json
|
||||
{
|
||||
"file_name": "large_file.zip",
|
||||
"file_size": 104857600,
|
||||
"chunk_size": 5242880,
|
||||
"file_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
||||
|------|------|------|--------|------|
|
||||
| `file_name` | string | 是 | - | 文件名 |
|
||||
| `file_size` | int | 是 | - | 文件总大小(字节) |
|
||||
| `chunk_size` | int | 否 | 5MB | 分片大小(字节) |
|
||||
| `file_hash` | string | 是 | - | 文件的 SHA256 哈希值 |
|
||||
|
||||
**响应示例:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"existed": false,
|
||||
"upload_id": "abc123def456789",
|
||||
"chunk_size": 5242880,
|
||||
"total_chunks": 20,
|
||||
"uploaded_chunks": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| 字段 | 说明 |
|
||||
|------|------|
|
||||
| `existed` | 文件是否已存在(秒传) |
|
||||
| `upload_id` | 上传会话 ID |
|
||||
| `chunk_size` | 分片大小 |
|
||||
| `total_chunks` | 总分片数 |
|
||||
| `uploaded_chunks` | 已上传的分片索引列表 |
|
||||
|
||||
### 2. 上传分片
|
||||
|
||||
**POST** `/chunk/upload/chunk/{upload_id}/{chunk_index}`
|
||||
|
||||
**路径参数:**
|
||||
|
||||
| 参数 | 说明 |
|
||||
|------|------|
|
||||
| `upload_id` | 初始化时返回的上传会话 ID |
|
||||
| `chunk_index` | 分片索引,从 0 开始 |
|
||||
|
||||
**请求体:**
|
||||
|
||||
Content-Type: `multipart/form-data`
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `chunk` | file | 分片数据 |
|
||||
|
||||
**响应示例:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"chunk_hash": "a1b2c3d4e5f6..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**cURL 示例:**
|
||||
|
||||
```bash
|
||||
# 上传第一个分片(索引为 0)
|
||||
curl -X POST "http://localhost:12345/chunk/upload/chunk/abc123def456789/0" \
|
||||
-F "chunk=@/path/to/chunk_0"
|
||||
```
|
||||
|
||||
### 3. 完成上传
|
||||
|
||||
**POST** `/chunk/upload/complete/{upload_id}`
|
||||
|
||||
**路径参数:**
|
||||
|
||||
| 参数 | 说明 |
|
||||
|------|------|
|
||||
| `upload_id` | 上传会话 ID |
|
||||
|
||||
**请求参数:**
|
||||
|
||||
```json
|
||||
{
|
||||
"expire_value": 7,
|
||||
"expire_style": "day"
|
||||
}
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `expire_value` | int | 是 | 过期数值 |
|
||||
| `expire_style` | string | 是 | 过期方式 |
|
||||
|
||||
**响应示例:**
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"detail": {
|
||||
"code": "789012",
|
||||
"name": "large_file.zip"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 断点续传
|
||||
|
||||
分片上传支持断点续传。当上传中断后:
|
||||
|
||||
1. 使用相同的 `file_hash` 重新调用初始化接口
|
||||
2. 服务器返回 `uploaded_chunks` 列表,包含已上传的分片索引
|
||||
3. 客户端只需上传不在列表中的分片
|
||||
4. 所有分片上传完成后调用完成接口
|
||||
|
||||
**示例流程:**
|
||||
|
||||
```javascript
|
||||
// 1. 初始化上传
|
||||
const initResponse = await fetch('/chunk/upload/init/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
file_name: 'large_file.zip',
|
||||
file_size: fileSize,
|
||||
chunk_size: 5 * 1024 * 1024,
|
||||
file_hash: fileHash
|
||||
})
|
||||
});
|
||||
const { upload_id, uploaded_chunks, total_chunks } = await initResponse.json();
|
||||
|
||||
// 2. 上传未完成的分片
|
||||
for (let i = 0; i < total_chunks; i++) {
|
||||
if (!uploaded_chunks.includes(i)) {
|
||||
const chunk = file.slice(i * chunkSize, (i + 1) * chunkSize);
|
||||
await fetch(`/chunk/upload/chunk/${upload_id}/${i}`, {
|
||||
method: 'POST',
|
||||
body: chunk
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 完成上传
|
||||
await fetch(`/chunk/upload/complete/${upload_id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
expire_value: 7,
|
||||
expire_style: 'day'
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
## 错误处理
|
||||
|
||||
### 常见错误
|
||||
|
||||
| HTTP 状态码 | 错误信息 | 原因 | 解决方案 |
|
||||
|-------------|----------|------|----------|
|
||||
| 403 | 大小超过限制 | 文件超过 `uploadSize` 限制 | 减小文件大小或联系管理员调整限制 |
|
||||
| 403 | 上传频率限制 | 超过 IP 上传频率限制 | 等待限制时间窗口后重试 |
|
||||
| 400 | 过期时间类型错误 | `expire_style` 值不在允许列表中 | 使用有效的过期方式 |
|
||||
| 404 | 上传会话不存在 | `upload_id` 无效或已过期 | 重新初始化上传 |
|
||||
| 400 | 无效的分片索引 | `chunk_index` 超出范围 | 检查分片索引是否正确 |
|
||||
| 400 | 分片不完整 | 完成上传时分片数量不足 | 确保所有分片都已上传 |
|
||||
|
||||
### 频率限制
|
||||
|
||||
系统对上传操作有频率限制,防止滥用:
|
||||
|
||||
| 配置项 | 默认值 | 说明 |
|
||||
|--------|--------|------|
|
||||
| `uploadMinute` | 1 | 限制时间窗口(分钟) |
|
||||
| `uploadCount` | 10 | 时间窗口内最大上传次数 |
|
||||
|
||||
当超过频率限制时,需要等待时间窗口过后才能继续上传。
|
||||
|
||||
### 错误响应格式
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": "错误信息描述"
|
||||
}
|
||||
```
|
||||
|
||||
## 上传配置
|
||||
|
||||
### 相关配置项
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `openUpload` | int | 1 | 是否开放上传(1=开放,0=关闭) |
|
||||
| `uploadSize` | int | 10485760 | 最大上传大小(字节) |
|
||||
| `enableChunk` | int | 0 | 是否启用分片上传(1=启用,0=禁用) |
|
||||
| `uploadMinute` | int | 1 | 上传频率限制时间窗口(分钟) |
|
||||
| `uploadCount` | int | 10 | 时间窗口内最大上传次数 |
|
||||
| `expireStyle` | list | ["day","hour","minute","forever","count"] | 允许的过期方式 |
|
||||
|
||||
### 配置示例
|
||||
|
||||
```python
|
||||
# 允许上传 100MB 文件,启用分片上传
|
||||
uploadSize = 104857600
|
||||
enableChunk = 1
|
||||
|
||||
# 放宽上传频率限制:每 5 分钟最多 50 次
|
||||
uploadMinute = 5
|
||||
uploadCount = 50
|
||||
|
||||
# 只允许按天和按次数过期
|
||||
expireStyle = ["day", "count"]
|
||||
```
|
||||
|
||||
## 下一步
|
||||
|
||||
- [文件分享](/guide/share) - 了解完整的分享流程
|
||||
- [配置说明](/guide/configuration) - 了解所有配置选项
|
||||
- [存储配置](/guide/storage) - 了解文件存储方式
|
||||
- [安全设置](/guide/security) - 了解安全相关配置
|
||||
@@ -0,0 +1,127 @@
|
||||
# 优秀案例
|
||||
|
||||
这里收录了一些使用 FileCodeBox 搭建的优秀站点。如果你也部署了 FileCodeBox,欢迎提交 PR 将你的站点添加到这里!
|
||||
|
||||
## 官方演示站
|
||||
|
||||
<div class="showcase-grid">
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### 🌟 FileCodeBox Demo
|
||||
|
||||
- **网址**:[share.lanol.cn](https://share.lanol.cn)
|
||||
- **简介**:官方演示站点,体验最新功能
|
||||
- **特点**:稳定运行,功能完整
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
## 社区站点
|
||||
|
||||
::: tip 提交你的站点
|
||||
如果你使用 FileCodeBox 搭建了自己的文件分享服务,欢迎通过以下方式提交:
|
||||
|
||||
1. 在 [GitHub](https://github.com/vastsa/FileCodeBox) 提交 PR,编辑此页面
|
||||
2. 在 [Issues](https://github.com/vastsa/FileCodeBox/issues) 中提交你的站点信息
|
||||
3. 加入 QQ 群 739673698 联系管理员
|
||||
:::
|
||||
|
||||
<!--
|
||||
提交格式示例:
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### 站点名称
|
||||
|
||||
- **网址**:[example.com](https://example.com)
|
||||
- **简介**:简短描述你的站点
|
||||
- **特点**:列出站点特色
|
||||
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="showcase-grid">
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### 取文件
|
||||
|
||||
- **网址**:[www.quwenjian.cn/fby.html](https://www.quwenjian.cn/fby.html)
|
||||
- **简介**:取文件 - 存储无界,便携无限
|
||||
- **特点**:永久免费的文件中转站
|
||||
- **运营者**:取文件&取文件网盘
|
||||
|
||||
</div>
|
||||
|
||||
<div class="showcase-item">
|
||||
|
||||
### 潘多拉盒子
|
||||
|
||||
- **网址**:[pan.duo.la](https://pan.duo.la)
|
||||
- **简介**:潘多拉盒子
|
||||
- **特点**:经典1.6版本
|
||||
- **运营者**:五行缺心眼
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
## 提交要求
|
||||
|
||||
为了保证收录站点的质量,请确保你的站点满足以下条件:
|
||||
|
||||
1. **稳定运行**:站点需要稳定运行,能够正常访问
|
||||
2. **合法合规**:站点内容需要合法合规,不得包含违法违规内容
|
||||
3. **保留版权**:建议保留 FileCodeBox 的版权信息
|
||||
4. **HTTPS 支持**:建议启用 HTTPS 加密访问
|
||||
|
||||
## 案例展示模板
|
||||
|
||||
如果你想提交站点,请按照以下格式:
|
||||
|
||||
```markdown
|
||||
### 站点名称
|
||||
|
||||
- **网址**:[域名](https://域名)
|
||||
- **简介**:一句话描述站点用途
|
||||
- **特点**:站点的特色功能或亮点
|
||||
- **运营者**:可选,你的名字或组织
|
||||
```
|
||||
|
||||
<style>
|
||||
.showcase-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.showcase-item {
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.showcase-item:hover {
|
||||
border-color: var(--vp-c-brand);
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.showcase-item h3 {
|
||||
margin-top: 0;
|
||||
color: var(--vp-c-brand);
|
||||
}
|
||||
|
||||
.showcase-item ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.showcase-item li {
|
||||
margin: 8px 0;
|
||||
}
|
||||
</style>
|
||||
@@ -4,29 +4,29 @@
|
||||
# @Software: PyCharm
|
||||
import asyncio
|
||||
import time
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from tortoise import Tortoise
|
||||
from tortoise.contrib.fastapi import register_tortoise
|
||||
|
||||
from apps.admin.views import admin_api
|
||||
from apps.base.models import KeyValue
|
||||
from apps.base.utils import ip_limit
|
||||
from apps.base.views import share_api
|
||||
from apps.admin.views import admin_api
|
||||
from apps.base.views import share_api, chunk_api, presign_api
|
||||
from core.database import init_db
|
||||
from core.logger import logger
|
||||
from core.response import APIResponse
|
||||
from core.settings import data_root, settings, BASE_DIR, DEFAULT_CONFIG
|
||||
from core.tasks import delete_expire_files
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
from tortoise import Tortoise
|
||||
from core.tasks import delete_expire_files, clean_incomplete_uploads
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
logger.info("正在初始化应用...")
|
||||
# 初始化数据库
|
||||
await init_db()
|
||||
|
||||
@@ -40,14 +40,19 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
# 启动后台任务
|
||||
task = asyncio.create_task(delete_expire_files())
|
||||
chunk_cleanup_task = asyncio.create_task(clean_incomplete_uploads())
|
||||
logger.info("应用初始化完成")
|
||||
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
# 清理操作
|
||||
logger.info("正在关闭应用...")
|
||||
task.cancel()
|
||||
await asyncio.gather(task, return_exceptions=True)
|
||||
chunk_cleanup_task.cancel()
|
||||
await asyncio.gather(task, chunk_cleanup_task, return_exceptions=True)
|
||||
await Tortoise.close_connections()
|
||||
logger.info("应用已关闭")
|
||||
|
||||
|
||||
async def load_config():
|
||||
@@ -92,6 +97,8 @@ register_tortoise(
|
||||
)
|
||||
|
||||
app.include_router(share_api)
|
||||
app.include_router(chunk_api)
|
||||
app.include_router(presign_api)
|
||||
app.include_router(admin_api)
|
||||
|
||||
|
||||
@@ -128,10 +135,12 @@ async def get_config():
|
||||
"explain": settings.page_explain,
|
||||
"uploadSize": settings.uploadSize,
|
||||
"expireStyle": settings.expireStyle,
|
||||
"enableChunk": settings.enableChunk,
|
||||
"openUpload": settings.openUpload,
|
||||
"notify_title": settings.notify_title,
|
||||
"notify_content": settings.notify_content,
|
||||
"show_admin_address": settings.showAdminAddr,
|
||||
"max_save_seconds": settings.max_save_seconds,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -140,5 +149,5 @@ if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(
|
||||
app="main:app", host="0.0.0.0", port=settings.port, reload=False, workers=1
|
||||
app="main:app", host=settings.serverHost, port=settings.serverPort, reload=False, workers=settings.serverWorkers
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
import { request } from '@/utils/request'; // 假设这是你的请求函数
|
||||
import { ElMessage } from 'element-plus'; // Element Plus 的消息组件
|
||||
import { t } from '@/locales'; // 国际化函数
|
||||
import { saveFileByWebApi, saveFileByElementA } from '@/utils/file'; // 文件保存工具函数
|
||||
|
||||
const downloadFile = (id: number) => {
|
||||
request({
|
||||
url: '/admin/file/download',
|
||||
method: 'get',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
responseType: 'blob'
|
||||
}).then((response: any) => {
|
||||
const contentDisposition = response.headers?.['content-disposition'] || '';
|
||||
let filename = 'file';
|
||||
|
||||
try {
|
||||
// 先尝试获取 filename* 参数
|
||||
const filenameStarMatch = contentDisposition.match(/filename\*=UTF-8''([^;]*)/);
|
||||
if (filenameStarMatch) {
|
||||
filename = decodeURIComponent(filenameStarMatch[1]);
|
||||
} else {
|
||||
// 如果没有 filename*,则尝试获取普通 filename
|
||||
const filenameMatch = contentDisposition.match(/filename="([^"]*)"/) || contentDisposition.match(/filename=([^;]*)/);
|
||||
if (filenameMatch) {
|
||||
filename = filenameMatch[1];
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('解析文件名失败:', error);
|
||||
// 如果解析失败,使用默认文件名
|
||||
filename = `download_${id}`;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if (window.showSaveFilePicker) {
|
||||
saveFileByWebApi(response.data, filename).catch(() => {
|
||||
saveFileByElementA(response.data, filename).catch(() => {
|
||||
ElMessage.error(t('admin.fileView.download_fail'));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
saveFileByElementA(response.data, filename).catch(() => {
|
||||
ElMessage.error(t('admin.fileView.download_fail'));
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('下载文件失败:', error);
|
||||
ElMessage.error(t('admin.fileView.download_fail'));
|
||||
});
|
||||
};
|
||||
|
||||
export default downloadFile;
|
||||
@@ -19,14 +19,10 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
## 🚀 更新计划
|
||||
- [ ] 切片上传,同文件秒传,断点续传
|
||||
- [x] 适配子目录
|
||||
- [x] 用户登录重构
|
||||
- [x] webdav存储
|
||||
- [x] 存储支持自定义路径
|
||||
- [x] s3优化,不修改昵称为uuid,新建目录
|
||||
|
||||
- [ ] 2025年皮肤
|
||||
- [ ] 文件收集功能
|
||||
|
||||
## 📝 项目简介
|
||||
|
||||
@@ -34,13 +30,14 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
|
||||
|
||||
## 🖼️ 功能预览
|
||||
|
||||
别问前端源码怎么是js了,麻烦仔细看下面的内容
|
||||
<div align="center">
|
||||
<h3>
|
||||
<a href="https://github.com/vastsa/FileCodeBoxFronted" target="_blank">
|
||||
<img src="https://img.shields.io/badge/Frontend-FileCodeBoxFronted2024-blue?style=for-the-badge&logo=github" alt="前端仓库2024">
|
||||
<img src="https://img.shields.io/badge/Frontend-主题2024仓库-blue?style=for-the-badge&logo=github" alt="前端仓库2024">
|
||||
</a>
|
||||
<a href="https://github.com/vastsa/FileCodeBoxFronted2023" target="_blank">
|
||||
<img src="https://img.shields.io/badge/Frontend-FileCodeBoxFronted2023-blue?style=for-the-badge&logo=github" alt="前端仓库2023">
|
||||
<img src="https://img.shields.io/badge/Frontend-主题2023仓库-blue?style=for-the-badge&logo=github" alt="前端仓库2023">
|
||||
</a>
|
||||
|
||||
<a href="https://share.lanol.cn" target="_blank">
|
||||
@@ -50,6 +47,7 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
|
||||
</div>
|
||||
|
||||
### 新版界面
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -72,6 +70,7 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
|
||||
</div>
|
||||
|
||||
### 经典界面
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -146,6 +145,7 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
|
||||
- IP 限制上传次数
|
||||
- 错误次数限制
|
||||
- 文件过期机制
|
||||
|
||||
</td>
|
||||
<td align="center">
|
||||
<h4>🎫 提取码分享</h4>
|
||||
@@ -190,24 +190,58 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
|
||||
|
||||
### Docker 部署
|
||||
|
||||
#### Docker CLI
|
||||
|
||||
```bash
|
||||
docker run -d --restart=always -p 12345:12345 -v /opt/FileCodeBox/:/app/data --name filecodebox lanol/filecodebox:beta
|
||||
```
|
||||
|
||||
#### Docker Compose
|
||||
|
||||
```yml
|
||||
version: "3"
|
||||
services:
|
||||
file-code-box:
|
||||
image: lanol/filecodebox:latest
|
||||
volumes:
|
||||
- fcb-data:/app/data:rw
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "12345:12345"
|
||||
volumes:
|
||||
fcb-data:
|
||||
external: false
|
||||
```
|
||||
|
||||
### 配置反向代理(Nginx示例)
|
||||
|
||||
请注意,必须添加以下配置来确保正确处理客户端IP和代理请求:
|
||||
|
||||
```nginx
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr; # 设置真实客户端IP
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://localhost:12345;
|
||||
}
|
||||
```
|
||||
|
||||
### 手动部署
|
||||
|
||||
1. 克隆项目
|
||||
|
||||
```bash
|
||||
git clone https://github.com/vastsa/FileCodeBox.git
|
||||
```
|
||||
|
||||
2. 安装依赖
|
||||
|
||||
```bash
|
||||
cd FileCodeBox
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. 启动服务
|
||||
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
@@ -215,24 +249,28 @@ python main.py
|
||||
## 📖 使用说明
|
||||
|
||||
### 分享文件
|
||||
|
||||
1. 打开网页,点击"分享文件"
|
||||
2. 选择或拖拽文件
|
||||
3. 设置过期时间和次数
|
||||
4. 获取提取码
|
||||
|
||||
### 获取文件
|
||||
|
||||
1. 打开网页,输入提取码
|
||||
2. 点击获取
|
||||
3. 下载文件或查看文本
|
||||
|
||||
### 管理面板
|
||||
1. 访问 `/admin`
|
||||
2. 输入管理员密码
|
||||
|
||||
1. 访问 `/#/admin`
|
||||
2. 输入管理员密码 `FileCodeBox2023`
|
||||
3. 管理文件和配置
|
||||
|
||||
## 🛠 开发指南
|
||||
|
||||
### 项目结构
|
||||
|
||||
```
|
||||
FileCodeBox/
|
||||
├── apps/ # 应用代码
|
||||
@@ -244,18 +282,22 @@ FileCodeBox/
|
||||
```
|
||||
|
||||
### 开发环境
|
||||
|
||||
- Python 3.8+
|
||||
- Node.js 14+
|
||||
- Vue 3
|
||||
- FastAPI
|
||||
|
||||
### 本地开发
|
||||
|
||||
1. 后端开发
|
||||
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
2. 前端开发
|
||||
|
||||
```bash
|
||||
cd fcb-fronted
|
||||
npm install
|
||||
@@ -273,12 +315,15 @@ npm run dev
|
||||
## ❓ 常见问题
|
||||
|
||||
### Q: 如何修改上传大小限制?
|
||||
|
||||
A: 在管理面板中修改配置项 `uploadSize`
|
||||
|
||||
### Q: 如何配置存储引擎?
|
||||
|
||||
A: 在管理面板中选择存储引擎并配置相应参数
|
||||
|
||||
### Q: 如何备份数据?
|
||||
|
||||
A: 备份 `data` 目录即可
|
||||
|
||||
更多问题请访问 [Wiki](https://github.com/vastsa/FileCodeBox/wiki/常见问题)
|
||||
|
||||
+53
-2
@@ -21,7 +21,9 @@
|
||||
|
||||
## 📝 Introduction
|
||||
|
||||
FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It allows users to share text and files easily, where recipients only need a passcode to retrieve the files, just like picking up a package from a delivery locker.
|
||||
FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It allows users to share text and files
|
||||
easily, where recipients only need a passcode to retrieve the files, just like picking up a package from a delivery
|
||||
locker.
|
||||
|
||||
## 🖼️ Preview
|
||||
|
||||
@@ -41,6 +43,7 @@ FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It
|
||||
</div>
|
||||
|
||||
### New Interface
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -63,6 +66,7 @@ FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It
|
||||
</div>
|
||||
|
||||
### Classic Interface
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -137,6 +141,7 @@ Support text and various file types
|
||||
- IP upload limits
|
||||
- Error attempt limits
|
||||
- File expiration
|
||||
|
||||
</td>
|
||||
<td align="center">
|
||||
<h4>🎫 Passcode Sharing</h4>
|
||||
@@ -181,24 +186,58 @@ Command-line download
|
||||
|
||||
### Docker Deployment
|
||||
|
||||
#### Docker CLI
|
||||
|
||||
```bash
|
||||
docker run -d --restart=always -p 12345:12345 -v /opt/FileCodeBox/:/app/data --name filecodebox lanol/filecodebox:beta
|
||||
```
|
||||
|
||||
#### Docker Compose
|
||||
|
||||
```ymlfix
|
||||
version: "3"
|
||||
services:s
|
||||
file-code-box:
|
||||
image: lanol/filecodebox:latest
|
||||
volumes:
|
||||
- fcb-data:/app/data:rw
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "12345:12345"
|
||||
volumes:
|
||||
fcb-data:
|
||||
external: false
|
||||
```
|
||||
|
||||
### Configure reverse proxy (Nginx example)
|
||||
|
||||
Please note that the following configurations must be added to ensure proper handling of client IP and proxy requests:
|
||||
|
||||
```nginx
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr; #Set real client IP
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://localhost:12345 ;
|
||||
}
|
||||
```
|
||||
|
||||
### Manual Deployment
|
||||
|
||||
1. Clone the repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/vastsa/FileCodeBox.git
|
||||
```
|
||||
|
||||
2. Install dependencies
|
||||
|
||||
```bash
|
||||
cd FileCodeBox
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. Start the service
|
||||
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
@@ -206,17 +245,20 @@ python main.py
|
||||
## 📖 Usage Guide
|
||||
|
||||
### Share Files
|
||||
|
||||
1. Open the website, click "Share File"
|
||||
2. Select or drag files
|
||||
3. Set expiration time and count
|
||||
4. Get the passcode
|
||||
|
||||
### Retrieve Files
|
||||
|
||||
1. Open the website, enter passcode
|
||||
2. Click retrieve
|
||||
3. Download file or view text
|
||||
|
||||
### Admin Panel
|
||||
|
||||
1. Visit `/admin`
|
||||
2. Enter admin password
|
||||
3. Manage files and settings
|
||||
@@ -224,6 +266,7 @@ python main.py
|
||||
## 🛠 Development Guide
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
FileCodeBox/
|
||||
├── apps/ # Application code
|
||||
@@ -235,18 +278,22 @@ FileCodeBox/
|
||||
```
|
||||
|
||||
### Development Environment
|
||||
|
||||
- Python 3.8+
|
||||
- Node.js 14+
|
||||
- Vue 3
|
||||
- FastAPI
|
||||
|
||||
### Local Development
|
||||
|
||||
1. Backend development
|
||||
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
2. Frontend development
|
||||
|
||||
```bash
|
||||
cd fcb-fronted
|
||||
npm install
|
||||
@@ -264,12 +311,15 @@ npm run dev
|
||||
## ❓ FAQ
|
||||
|
||||
### Q: How to modify upload size limit?
|
||||
|
||||
A: Change `uploadSize` in admin panel
|
||||
|
||||
### Q: How to configure storage engine?
|
||||
|
||||
A: Select storage engine and configure parameters in admin panel
|
||||
|
||||
### Q: How to backup data?
|
||||
|
||||
A: Backup the `data` directory
|
||||
|
||||
For more questions, visit [Wiki](https://github.com/vastsa/FileCodeBox/wiki/常见问题)
|
||||
@@ -286,4 +336,5 @@ For more questions, visit [Wiki](https://github.com/vastsa/FileCodeBox/wiki/常
|
||||
|
||||
## 📜 Disclaimer
|
||||
|
||||
This project is open-source for learning purposes only. It should not be used for any illegal purposes. The author is not responsible for any consequences. Please retain the project address and copyright information when using it.
|
||||
This project is open-source for learning purposes only. It should not be used for any illegal purposes. The author is
|
||||
not responsible for any consequences. Please retain the project address and copyright information when using it.
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
aioboto3==11.2.0
|
||||
aiohttp==3.10.11
|
||||
aiofiles==24.1.0
|
||||
botocore==1.29.76
|
||||
fastapi==0.115.0
|
||||
pydantic==2.4.0
|
||||
uvicorn==0.23.2
|
||||
tortoise-orm==0.20.0
|
||||
python-multipart==0.0.20
|
||||
python-multipart==0.0.20
|
||||
@@ -1 +1 @@
|
||||
import{a as s,a8 as n,P as c,N as e,U as r,R as a,j as o,o as i}from"./index-5orz1M6_.js";const l={style:{"text-align":"center"}},u={style:{color:"#333"},href:"https://github.com/vastsa/FileCodeBox"},f=s({__name:"AboutView",setup(_){const{t}=n();return(m,p)=>(i(),c("main",l,[e("span",null,[r(a(o(t)("admin.about.source1"))+" ",1),e("em",null,[e("a",u,a(o(t)("admin.about.source2")),1)])])]))}});export{f as default};
|
||||
import{a as s,a8 as n,P as c,N as e,U as r,R as a,j as o,o as i}from"./index-CxMsK_Ni.js";const l={style:{"text-align":"center"}},u={style:{color:"#333"},href:"https://github.com/vastsa/FileCodeBox"},f=s({__name:"AboutView",setup(_){const{t}=n();return(m,p)=>(i(),c("main",l,[e("span",null,[r(a(o(t)("admin.about.source1"))+" ",1),e("em",null,[e("a",u,a(o(t)("admin.about.source2")),1)])])]))}});export{f as default};
|
||||
@@ -1 +1 @@
|
||||
import{k as ie,T as Ke,t as ce,E as Qe,b as Xe}from"./el-input-D_xPEeA2.js";import{E as Ye,a as Ze}from"./el-form-item-CzDqJHnU.js";import"./el-tooltip-l0sNRNKZ.js";import{E as Pe,C as Je}from"./el-popper-DxfKqvb2.js";import{u as et,a as tt}from"./index-CX7K5KgQ.js";import{_ as V,a as y,u as $,g as X,o as S,w,r as k,aC as Oe,aP as nt,j as h,T as Ne,l as ye,aG as at,c as f,P as A,h as D,n as Ie,ak as q,L as P,I as ue,aQ as ot,D as ve,b as Ce,i as de,s as x,aR as st,aS as lt,t as Ee,$ as re,p as _e,aT as Se,a0 as we,a1 as Be,z as I,W as Ae,G as Y,A as ze,C as ut,ab as pe,aU as $e,aV as ne,al as He,f as it,aW as rt,am as ke,d as me,aX as ct,m as dt,F as mt,aY as pt,M as Le,N as Me,aA as ft,U as ae,R as oe,aK as vt,a8 as ht,B as L,a9 as gt,ac as bt,af as _t,aF as Te}from"./index-5orz1M6_.js";import{f as Mt}from"./vnode-DkiIqzI4.js";import"./_baseClone-IT_4yc7W.js";const yt=y({name:"ElCollapseTransition"}),It=y({...yt,setup(e){const a=$("collapse-transition"),n=t=>{t.style.maxHeight="",t.style.overflow=t.dataset.oldOverflow,t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom},o={beforeEnter(t){t.dataset||(t.dataset={}),t.dataset.oldPaddingTop=t.style.paddingTop,t.dataset.oldPaddingBottom=t.style.paddingBottom,t.style.height&&(t.dataset.elExistsHeight=t.style.height),t.style.maxHeight=0,t.style.paddingTop=0,t.style.paddingBottom=0},enter(t){requestAnimationFrame(()=>{t.dataset.oldOverflow=t.style.overflow,t.dataset.elExistsHeight?t.style.maxHeight=t.dataset.elExistsHeight:t.scrollHeight!==0?t.style.maxHeight=`${t.scrollHeight}px`:t.style.maxHeight=0,t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom,t.style.overflow="hidden"})},afterEnter(t){t.style.maxHeight="",t.style.overflow=t.dataset.oldOverflow},enterCancelled(t){n(t)},beforeLeave(t){t.dataset||(t.dataset={}),t.dataset.oldPaddingTop=t.style.paddingTop,t.dataset.oldPaddingBottom=t.style.paddingBottom,t.dataset.oldOverflow=t.style.overflow,t.style.maxHeight=`${t.scrollHeight}px`,t.style.overflow="hidden"},leave(t){t.scrollHeight!==0&&(t.style.maxHeight=0,t.style.paddingTop=0,t.style.paddingBottom=0)},afterLeave(t){n(t)},leaveCancelled(t){n(t)}};return(t,v)=>(S(),X(Ne,Oe({name:h(a).b()},nt(o)),{default:w(()=>[k(t.$slots,"default")]),_:3},16,["name"]))}});var Ct=V(It,[["__file","collapse-transition.vue"]]);const Et=ye(Ct),St=y({name:"ElContainer"}),wt=y({...St,props:{direction:{type:String}},setup(e){const a=e,n=at(),o=$("container"),t=f(()=>a.direction==="vertical"?!0:a.direction==="horizontal"?!1:n&&n.default?n.default().some(d=>{const g=d.type.name;return g==="ElHeader"||g==="ElFooter"}):!1);return(v,d)=>(S(),A("section",{class:D([h(o).b(),h(o).is("vertical",h(t))])},[k(v.$slots,"default")],2))}});var xt=V(wt,[["__file","container.vue"]]);const $t=y({name:"ElAside"}),kt=y({...$t,props:{width:{type:String,default:null}},setup(e){const a=e,n=$("aside"),o=f(()=>a.width?n.cssVarBlock({width:a.width}):{});return(t,v)=>(S(),A("aside",{class:D(h(n).b()),style:Ie(h(o))},[k(t.$slots,"default")],6))}});var De=V(kt,[["__file","aside.vue"]]);const Tt=y({name:"ElFooter"}),Pt=y({...Tt,props:{height:{type:String,default:null}},setup(e){const a=e,n=$("footer"),o=f(()=>a.height?n.cssVarBlock({height:a.height}):{});return(t,v)=>(S(),A("footer",{class:D(h(n).b()),style:Ie(h(o))},[k(t.$slots,"default")],6))}});var Ve=V(Pt,[["__file","footer.vue"]]);const Ot=y({name:"ElHeader"}),Nt=y({...Ot,props:{height:{type:String,default:null}},setup(e){const a=e,n=$("header"),o=f(()=>a.height?n.cssVarBlock({height:a.height}):{});return(t,v)=>(S(),A("header",{class:D(h(n).b()),style:Ie(h(o))},[k(t.$slots,"default")],6))}});var Fe=V(Nt,[["__file","header.vue"]]);const Bt=y({name:"ElMain"}),At=y({...Bt,setup(e){const a=$("main");return(n,o)=>(S(),A("main",{class:D(h(a).b())},[k(n.$slots,"default")],2))}});var Re=V(At,[["__file","main.vue"]]);const zt=ye(xt,{Aside:De,Footer:Ve,Header:Fe,Main:Re});q(De);q(Ve);const Ht=q(Fe),Lt=q(Re);let Dt=class{constructor(a,n){this.parent=a,this.domNode=n,this.subIndex=0,this.subIndex=0,this.init()}init(){this.subMenuItems=this.domNode.querySelectorAll("li"),this.addListeners()}gotoSubIndex(a){a===this.subMenuItems.length?a=0:a<0&&(a=this.subMenuItems.length-1),this.subMenuItems[a].focus(),this.subIndex=a}addListeners(){const a=this.parent.domNode;Array.prototype.forEach.call(this.subMenuItems,n=>{n.addEventListener("keydown",o=>{let t=!1;switch(o.code){case P.down:{this.gotoSubIndex(this.subIndex+1),t=!0;break}case P.up:{this.gotoSubIndex(this.subIndex-1),t=!0;break}case P.tab:{ie(a,"mouseleave");break}case P.enter:case P.numpadEnter:case P.space:{t=!0,o.currentTarget.click();break}}return t&&(o.preventDefault(),o.stopPropagation()),!1})})}},Vt=class{constructor(a,n){this.domNode=a,this.submenu=null,this.submenu=null,this.init(n)}init(a){this.domNode.setAttribute("tabindex","0");const n=this.domNode.querySelector(`.${a}-menu`);n&&(this.submenu=new Dt(this,n)),this.addListeners()Line truncated
|
||||
import{k as ie,T as Ke,t as ce,E as Qe,b as Xe}from"./el-input-CNNwOXGP.js";import{E as Ye,a as Ze}from"./el-form-item-llYGp2SQ.js";import"./el-tooltip-l0sNRNKZ.js";import{E as Pe,C as Je}from"./el-popper-C96qJ_vz.js";import{u as et,a as tt}from"./index-CBpXPsVN.js";import{_ as V,a as y,u as $,g as X,o as S,w,r as k,aC as Oe,aP as nt,j as h,T as Ne,l as ye,aG as at,c as f,P as A,h as D,n as Ie,ak as q,L as P,I as ue,aQ as ot,D as ve,b as Ce,i as de,s as x,aR as st,aS as lt,t as Ee,$ as re,p as _e,aT as Se,a0 as we,a1 as Be,z as I,W as Ae,G as Y,A as ze,C as ut,ab as pe,aU as $e,aV as ne,al as He,f as it,aW as rt,am as ke,d as me,aX as ct,m as dt,F as mt,aY as pt,M as Le,N as Me,aA as ft,U as ae,R as oe,aK as vt,a8 as ht,B as L,a9 as gt,ac as bt,af as _t,aF as Te}from"./index-CxMsK_Ni.js";import{f as Mt}from"./vnode-Cc0RQjVK.js";import"./_baseClone-DD6IrDYX.js";const yt=y({name:"ElCollapseTransition"}),It=y({...yt,setup(e){const a=$("collapse-transition"),n=t=>{t.style.maxHeight="",t.style.overflow=t.dataset.oldOverflow,t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom},o={beforeEnter(t){t.dataset||(t.dataset={}),t.dataset.oldPaddingTop=t.style.paddingTop,t.dataset.oldPaddingBottom=t.style.paddingBottom,t.style.height&&(t.dataset.elExistsHeight=t.style.height),t.style.maxHeight=0,t.style.paddingTop=0,t.style.paddingBottom=0},enter(t){requestAnimationFrame(()=>{t.dataset.oldOverflow=t.style.overflow,t.dataset.elExistsHeight?t.style.maxHeight=t.dataset.elExistsHeight:t.scrollHeight!==0?t.style.maxHeight=`${t.scrollHeight}px`:t.style.maxHeight=0,t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom,t.style.overflow="hidden"})},afterEnter(t){t.style.maxHeight="",t.style.overflow=t.dataset.oldOverflow},enterCancelled(t){n(t)},beforeLeave(t){t.dataset||(t.dataset={}),t.dataset.oldPaddingTop=t.style.paddingTop,t.dataset.oldPaddingBottom=t.style.paddingBottom,t.dataset.oldOverflow=t.style.overflow,t.style.maxHeight=`${t.scrollHeight}px`,t.style.overflow="hidden"},leave(t){t.scrollHeight!==0&&(t.style.maxHeight=0,t.style.paddingTop=0,t.style.paddingBottom=0)},afterLeave(t){n(t)},leaveCancelled(t){n(t)}};return(t,v)=>(S(),X(Ne,Oe({name:h(a).b()},nt(o)),{default:w(()=>[k(t.$slots,"default")]),_:3},16,["name"]))}});var Ct=V(It,[["__file","collapse-transition.vue"]]);const Et=ye(Ct),St=y({name:"ElContainer"}),wt=y({...St,props:{direction:{type:String}},setup(e){const a=e,n=at(),o=$("container"),t=f(()=>a.direction==="vertical"?!0:a.direction==="horizontal"?!1:n&&n.default?n.default().some(d=>{const g=d.type.name;return g==="ElHeader"||g==="ElFooter"}):!1);return(v,d)=>(S(),A("section",{class:D([h(o).b(),h(o).is("vertical",h(t))])},[k(v.$slots,"default")],2))}});var xt=V(wt,[["__file","container.vue"]]);const $t=y({name:"ElAside"}),kt=y({...$t,props:{width:{type:String,default:null}},setup(e){const a=e,n=$("aside"),o=f(()=>a.width?n.cssVarBlock({width:a.width}):{});return(t,v)=>(S(),A("aside",{class:D(h(n).b()),style:Ie(h(o))},[k(t.$slots,"default")],6))}});var De=V(kt,[["__file","aside.vue"]]);const Tt=y({name:"ElFooter"}),Pt=y({...Tt,props:{height:{type:String,default:null}},setup(e){const a=e,n=$("footer"),o=f(()=>a.height?n.cssVarBlock({height:a.height}):{});return(t,v)=>(S(),A("footer",{class:D(h(n).b()),style:Ie(h(o))},[k(t.$slots,"default")],6))}});var Ve=V(Pt,[["__file","footer.vue"]]);const Ot=y({name:"ElHeader"}),Nt=y({...Ot,props:{height:{type:String,default:null}},setup(e){const a=e,n=$("header"),o=f(()=>a.height?n.cssVarBlock({height:a.height}):{});return(t,v)=>(S(),A("header",{class:D(h(n).b()),style:Ie(h(o))},[k(t.$slots,"default")],6))}});var Fe=V(Nt,[["__file","header.vue"]]);const Bt=y({name:"ElMain"}),At=y({...Bt,setup(e){const a=$("main");return(n,o)=>(S(),A("main",{class:D(h(a).b())},[k(n.$slots,"default")],2))}});var Re=V(At,[["__file","main.vue"]]);const zt=ye(xt,{Aside:De,Footer:Ve,Header:Fe,Main:Re});q(De);q(Ve);const Ht=q(Fe),Lt=q(Re);let Dt=class{constructor(a,n){this.parent=a,this.domNode=n,this.subIndex=0,this.subIndex=0,this.init()}init(){this.subMenuItems=this.domNode.querySelectorAll("li"),this.addListeners()}gotoSubIndex(a){a===this.subMenuItems.length?a=0:a<0&&(a=this.subMenuItems.length-1),this.subMenuItems[a].focus(),this.subIndex=a}addListeners(){const a=this.parent.domNode;Array.prototype.forEach.call(this.subMenuItems,n=>{n.addEventListener("keydown",o=>{let t=!1;switch(o.code){case P.down:{this.gotoSubIndex(this.subIndex+1),t=!0;break}case P.up:{this.gotoSubIndex(this.subIndex-1),t=!0;break}case P.tab:{ie(a,"mouseleave");break}case P.enter:case P.numpadEnter:case P.space:{t=!0,o.currentTarget.click();break}}return t&&(o.preventDefault(),o.stopPropagation()),!1})})}},Vt=class{constructor(a,n){this.domNode=a,this.submenu=null,this.submenu=null,this.init(n)}init(a){this.domNode.setAttribute("tabindex","0");const n=this.domNode.querySelector(`.${a}-menu`);n&&(this.submenu=new Dt(this,n)),this.addListeners()Line truncated
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{e as lg,a as cg,j as ug,b as dg}from"./el-input-D_xPEeA2.js";import{u as _g,a as mg}from"./index-CX7K5KgQ.js";import{b as bm,_ as hm,a as gn,aG as pg,c as St,s as pn,u as Tm,ao as gg,aH as Eg,g as Dt,o as Ne,w as ze,B as ot,T as fg,j as X,A as Sg,N as it,aC as bg,O as hg,P as rt,Q as Tn,h as bt,r as Yn,R as pt,W as Ol,as as Cm,C as Tg,l as Rm,d as ka,aI as Cg,aq as Rg,aJ as Ng,ar as yg,a2 as Og,G as _u,n as Bn,k as Ag,aK as Nm,t as mu,z as Ft,aL as ym,a0 as vg,ab as Cl,a8 as Ig,a9 as Om,U as mn,ac as pu,aF as Dg,aa as xg,aM as Mg,ad as wg,aN as Lg,aO as kg,ae as Pg}from"./index-5orz1M6_.js";import{e as Fg,f as Bg,g as Ug,E as Gg,h as Yg,d as qg}from"./config-C0oXmCul.js";import{E as zg}from"./el-tag-DsWzxe9q.js";var Hg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Al(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const Vg=bm({...Bg,direction:{type:String,default:"rtl",values:["ltr","rtl","ttb","btt"]},size:{type:[String,Number],default:"30%"},withHeader:{type:Boolean,default:!0},modalFade:{type:Boolean,default:!0},headerAriaLevel:{type:String,default:"2"}}),Wg=Fg,$g=gn({name:"ElDrawer",inheritAttrs:!1}),Kg=gn({...$g,props:Vg,emits:Wg,setup(t,{expose:e}){const a=t,o=pg();lg({scope:"el-drawer",from:"the title slot",replacement:"the header slot",version:"3.0.0",ref:"https://element-plus.org/en-US/component/drawer.html#slots"},St(()=>!!o.title));const c=pn(),s=pn(),d=Tm("drawer"),{t:u}=gg(),{afterEnter:_,afterLeave:p,beforeLeave:S,visible:h,rendered:y,titleId:O,bodyId:N,zIndex:w,onModalClick:L,onOpenAutoFocus:D,onCloseAutoFocus:U,onFocusoutPrevented:x,onCloseRequested:G,handleClose:F}=Ug(a,c),z=St(()=>a.direction==="rtl"||a.direction==="ltr"),$=St(()=>Eg(a.size));return e({handleClose:F,afterEnter:_,afterLeave:p}),(V,ee)=>(Ne(),Dt(X(ug),{to:V.appendTo,disabled:V.appendTo!=="body"?!1:!V.appendToBody},{default:ze(()=>[ot(fg,{name:X(d).b("fade"),onAfterEnter:X(_),onAfterLeave:X(p),onBeforeLeave:X(S),persisted:""},{default:ze(()=>[Sg(ot(X(Gg),{mask:V.modal,"overlay-class":V.modalClass,"z-index":X(w),onClick:X(L)},{default:ze(()=>[ot(X(cg),{loop:"",trapped:X(h),"focus-trap-el":c.value,"focus-start-el":s.value,onFocusAfterTrapped:X(D),onFocusAfterReleased:X(U),onFocusoutPrevented:X(x),onReleaseRequested:X(G)},{default:ze(()=>[it("div",bg({ref_key:"drawerRef",ref:c,"aria-modal":"true","aria-label":V.title||void 0,"aria-labelledby":V.title?void 0:X(O),"aria-describedby":X(N)},V.$attrs,{class:[X(d).b(),V.direction,X(h)&&"open"],style:X(z)?"width: "+X($):"height: "+X($),role:"dialog",onClick:hg(()=>{},["stop"])}),[it("span",{ref_key:"focusStartRef",ref:s,class:bt(X(d).e("sr-focus")),tabindex:"-1"},null,2),V.withHeader?(Ne(),rt("header",{key:0,class:bt([X(d).e("header"),V.headerClass])},[V.$slots.title?Yn(V.$slots,"title",{key:1},()=>[Tn(" DEPRECATED SLOT ")]):Yn(V.$slots,"header",{key:0,close:X(F),titleId:X(O),titleClass:X(d).e("title")},()=>[V.$slots.title?Tn("v-if",!0):(Ne(),rt("span",{key:0,id:X(O),role:"heading","aria-level":V.headerAriaLevel,class:bt(X(d).e("title"))},pt(V.title),11,["id","aria-level"]))]),V.showClose?(Ne(),rt("button",{key:2,"aria-label":X(u)("el.drawer.close"),class:bt(X(d).e("close-btn")),type:"button",onClick:X(F)},[ot(X(Ol),{class:bt(X(d).e("close"))},{default:ze(()=>[ot(X(Cm))]),_:1},8,["class"])],10,["aria-label","onClick"])):Tn("v-if",!0)],2)):Tn("v-if",!0),X(y)?(Ne(),rt("div",{key:1,id:X(N),class:bt([X(d).e("body"),V.bodyClass])},[Yn(V.$slots,"default")],10,["id"])):Tn("v-if",!0),V.$slots.footer?(Ne(),rt("div",{key:2,class:bt([X(d).e("footer"),V.footerClass])},[Yn(V.$slots,"footer")],2)):Tn("v-if",!0)],16,["aria-label","aria-labelledby","aria-describedby","onClick"])]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusoutPrevented","onReleaseRequested"])]),_:3},8,["mask","overlay-class","z-index","onClick"]),[[Tg,X(h)]])]),_:3},8,["name","onAfterEnter","onAfterLeave","onBeforeLeave"])]),_:3},8,["to","disabled"]))}});var Qg=hm(Kg,[["__file","drawer.vue"]]);const Xg=Rm(Qg),Zg=bm({type:{type:String,default:"line",values:["line","circle","dashboard"]},percentage:{type:Number,default:0,validator:t=>t>=0&&t<=100},status:{type:String,default:"",values:["","success","exception","warning"]},indeterminate:Boolean,duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:ka(String),default:"round"},textInside:Boolean,width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:ka([String,Array,Function]),default:""},striped:Boolean,stripedFlow:Boolean,format:{type:ka(Function),default:t=>`${t}%`}}),Jg=gn({name:"ElProgress"}),jg=gn({...Jg,props:Zg,setup(t){const e=t,a={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},o=Tm("progress"),c=St(()=>{const x={width:`${e.percentage}%`,animationDuration:`${e.duration}s`},G=U(e.percentage);return G.includes("gradient"Line truncated
|
||||
import{e as lg,a as cg,j as ug,b as dg}from"./el-input-CNNwOXGP.js";import{u as _g,a as mg}from"./index-CBpXPsVN.js";import{b as bm,_ as hm,a as gn,aG as pg,c as St,s as pn,u as Tm,ao as gg,aH as Eg,g as Dt,o as Ne,w as ze,B as ot,T as fg,j as X,A as Sg,N as it,aC as bg,O as hg,P as rt,Q as Tn,h as bt,r as Yn,R as pt,W as Ol,as as Cm,C as Tg,l as Rm,d as ka,aI as Cg,aq as Rg,aJ as Ng,ar as yg,a2 as Og,G as _u,n as Bn,k as Ag,aK as Nm,t as mu,z as Ft,aL as ym,a0 as vg,ab as Cl,a8 as Ig,a9 as Om,U as mn,ac as pu,aF as Dg,aa as xg,aM as Mg,ad as wg,aN as Lg,aO as kg,ae as Pg}from"./index-CxMsK_Ni.js";import{e as Fg,f as Bg,g as Ug,E as Gg,h as Yg,d as qg}from"./config-CZWWa62X.js";import{E as zg}from"./el-tag-5pOVEKUY.js";var Hg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Al(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const Vg=bm({...Bg,direction:{type:String,default:"rtl",values:["ltr","rtl","ttb","btt"]},size:{type:[String,Number],default:"30%"},withHeader:{type:Boolean,default:!0},modalFade:{type:Boolean,default:!0},headerAriaLevel:{type:String,default:"2"}}),Wg=Fg,$g=gn({name:"ElDrawer",inheritAttrs:!1}),Kg=gn({...$g,props:Vg,emits:Wg,setup(t,{expose:e}){const a=t,o=pg();lg({scope:"el-drawer",from:"the title slot",replacement:"the header slot",version:"3.0.0",ref:"https://element-plus.org/en-US/component/drawer.html#slots"},St(()=>!!o.title));const c=pn(),s=pn(),d=Tm("drawer"),{t:u}=gg(),{afterEnter:_,afterLeave:p,beforeLeave:S,visible:h,rendered:y,titleId:O,bodyId:N,zIndex:w,onModalClick:L,onOpenAutoFocus:D,onCloseAutoFocus:U,onFocusoutPrevented:x,onCloseRequested:G,handleClose:F}=Ug(a,c),z=St(()=>a.direction==="rtl"||a.direction==="ltr"),$=St(()=>Eg(a.size));return e({handleClose:F,afterEnter:_,afterLeave:p}),(V,ee)=>(Ne(),Dt(X(ug),{to:V.appendTo,disabled:V.appendTo!=="body"?!1:!V.appendToBody},{default:ze(()=>[ot(fg,{name:X(d).b("fade"),onAfterEnter:X(_),onAfterLeave:X(p),onBeforeLeave:X(S),persisted:""},{default:ze(()=>[Sg(ot(X(Gg),{mask:V.modal,"overlay-class":V.modalClass,"z-index":X(w),onClick:X(L)},{default:ze(()=>[ot(X(cg),{loop:"",trapped:X(h),"focus-trap-el":c.value,"focus-start-el":s.value,onFocusAfterTrapped:X(D),onFocusAfterReleased:X(U),onFocusoutPrevented:X(x),onReleaseRequested:X(G)},{default:ze(()=>[it("div",bg({ref_key:"drawerRef",ref:c,"aria-modal":"true","aria-label":V.title||void 0,"aria-labelledby":V.title?void 0:X(O),"aria-describedby":X(N)},V.$attrs,{class:[X(d).b(),V.direction,X(h)&&"open"],style:X(z)?"width: "+X($):"height: "+X($),role:"dialog",onClick:hg(()=>{},["stop"])}),[it("span",{ref_key:"focusStartRef",ref:s,class:bt(X(d).e("sr-focus")),tabindex:"-1"},null,2),V.withHeader?(Ne(),rt("header",{key:0,class:bt([X(d).e("header"),V.headerClass])},[V.$slots.title?Yn(V.$slots,"title",{key:1},()=>[Tn(" DEPRECATED SLOT ")]):Yn(V.$slots,"header",{key:0,close:X(F),titleId:X(O),titleClass:X(d).e("title")},()=>[V.$slots.title?Tn("v-if",!0):(Ne(),rt("span",{key:0,id:X(O),role:"heading","aria-level":V.headerAriaLevel,class:bt(X(d).e("title"))},pt(V.title),11,["id","aria-level"]))]),V.showClose?(Ne(),rt("button",{key:2,"aria-label":X(u)("el.drawer.close"),class:bt(X(d).e("close-btn")),type:"button",onClick:X(F)},[ot(X(Ol),{class:bt(X(d).e("close"))},{default:ze(()=>[ot(X(Cm))]),_:1},8,["class"])],10,["aria-label","onClick"])):Tn("v-if",!0)],2)):Tn("v-if",!0),X(y)?(Ne(),rt("div",{key:1,id:X(N),class:bt([X(d).e("body"),V.bodyClass])},[Yn(V.$slots,"default")],10,["id"])):Tn("v-if",!0),V.$slots.footer?(Ne(),rt("div",{key:2,class:bt([X(d).e("footer"),V.footerClass])},[Yn(V.$slots,"footer")],2)):Tn("v-if",!0)],16,["aria-label","aria-labelledby","aria-describedby","onClick"])]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusoutPrevented","onReleaseRequested"])]),_:3},8,["mask","overlay-class","z-index","onClick"]),[[Tg,X(h)]])]),_:3},8,["name","onAfterEnter","onAfterLeave","onBeforeLeave"])]),_:3},8,["to","disabled"]))}});var Qg=hm(Kg,[["__file","drawer.vue"]]);const Xg=Rm(Qg),Zg=bm({type:{type:String,default:"line",values:["line","circle","dashboard"]},percentage:{type:Number,default:0,validator:t=>t>=0&&t<=100},status:{type:String,default:"",values:["","success","exception","warning"]},indeterminate:Boolean,duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:ka(String),default:"round"},textInside:Boolean,width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:ka([String,Array,Function]),default:""},striped:Boolean,stripedFlow:Boolean,format:{type:ka(Function),default:t=>`${t}%`}}),Jg=gn({name:"ElProgress"}),jg=gn({...Jg,props:Zg,setup(t){const e=t,a={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},o=Tm("progress"),c=St(()=>{const x={width:`${e.percentage}%`,animationDuration:`${e.duration}s`},G=U(e.percentage);return G.includes("gradient"Line truncated
|
||||
M 50 50
|
||||
m 0 ${G?"":"-"}${x}
|
||||
a ${x} ${x} 0 1 1 0 ${G?"-":""}${x*2}
|
||||
@@ -1,4 +1,4 @@
|
||||
import{s as Nn,l as Ln,m as Pn,n as ll,p as Rn,f as yl,U as bt,d as Fn,g as At,i as Vt,c as Nt,h as Cl,e as st,q as Tn,E as zn,t as Mn,b as On}from"./el-input-D_xPEeA2.js";import"./el-tag-DsWzxe9q.js";import{b as _n,i as wl,a as $n,E as Wn,d as dt,c as Sl}from"./el-select-lHlEhHIn.js";import{i as yt,g as Bn,k as Hn,c as An,a as xl,b as Vn,d as In,e as Kn,f as Dn,h as jn,j as Un,S as qn,E as El,C as Gn}from"./el-popper-DxfKqvb2.js";import"./el-tooltip-l0sNRNKZ.js";import{b3 as It,b4 as Yn,b5 as kl,b6 as Nl,b7 as Xn,b8 as Qn,b9 as Lt,ba as Jn,bb as Zn,E as Ie,G as we,e as ce,ag as Fe,ah as Ct,i as he,c as R,a7 as Le,aT as de,$ as ie,F as _e,s as N,al as oe,ai as Be,f as Xe,bc as nl,_ as Pe,a as j,aG as Ll,u as se,g as re,o as z,w as ee,N as te,P as V,Q as ge,h as W,j as C,A as Oe,O as ft,J as Qe,bd as ht,r as Te,ab as Ke,U as He,R as J,k as wt,n as Ae,b as $e,d as Kt,p as Dt,x as Pl,l as jt,ak as Ut,aV as pt,ao as Me,W as et,q as Rl,m as Fl,B as U,ac as vt,aW as Ve,be as ea,bf as al,bg as ta,S as la,bh as na,z as B,aS as qt,bi as aa,a5 as Je,a2 as Ne,a4 as ol,bj as Tl,a3 as oa,bk as sl,M as ke,bl as zl,bm as sa,aR as ra,bn as Ml,a0 as tt,aL as ia,aD as Gt,aQ as qe,D as Ze,a6 as ua,I as gt,t as ca,bo as rl,aY as il,C as ul,a1 as Ol,Y as da,bp as fa,a8 as ha,af as St,aF as xt}from"./index-5orz1M6_.js";function pa(e,t){return Nn(Ln(e,t,Pn),e+"")}function va(e,t,l){if(!It(l))return!1;var n=typeof t;return(n=="number"?yt(l)&&Yn(t,l.length):n=="string"&&t in l)?kl(l[t],e):!1}function ga(e){return pa(function(t,l){var n=-1,o=l.length,s=o>1?l[o-1]:void 0,i=o>2?l[2]:void 0;for(s=e.length>3&&typeof s=="function"?(o--,s):void 0,i&&va(l[0],l[1],i)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var a=l[n];a&&e(t,a,n,s)}return t})}var ma="[object Object]",ba=Function.prototype,ya=Object.prototype,_l=ba.toString,Ca=ya.hasOwnProperty,wa=_l.call(Object);function Sa(e){if(!Nl(e)||Xn(e)!=ma)return!1;var t=Bn(e);if(t===null)return!0;var l=Ca.call(t,"constructor")&&t.constructor;return typeof l=="function"&&l instanceof l&&_l.call(l)==wa}function xa(e){return function(t,l,n){for(var o=-1,s=Object(t),i=n(t),a=i.length;a--;){var r=i[++o];if(l(s[r],r,s)===!1)break}return t}}var $l=xa();function Ea(e,t){return e&&$l(e,t,Hn)}function ka(e,t){return function(l,n){if(l==null)return l;if(!yt(l))return e(l,n);for(var o=l.length,s=-1,i=Object(l);++s<o&&n(i[s],s,i)!==!1;);return l}}var Na=ka(Ea);function Pt(e,t,l){(l!==void 0&&!kl(e[t],l)||l===void 0&&!(t in e))&&Qn(e,t,l)}function La(e){return Nl(e)&&yt(e)}function Rt(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Pa(e){return An(e,xl(e))}function Ra(e,t,l,n,o,s,i){var a=Rt(e,l),r=Rt(t,l),u=i.get(r);if(u){Pt(e,l,u);return}var d=s?s(a,r,l+"",e,t,i):void 0,f=d===void 0;if(f){var v=Lt(r),y=!v&&Vn(r),h=!v&&!y&&In(r);d=r,v||y||h?Lt(a)?d=a:La(a)?d=Kn(a):y?(f=!1,d=Dn(r,!0)):h?(f=!1,d=jn(r,!0)):d=[]:Sa(r)||ll(r)?(d=a,ll(a)?d=Pa(a):(!It(a)||Jn(a))&&(d=Un(r))):f=!1}f&&(i.set(r,d),o(d,r,n,s,i),i.delete(r)),Pt(e,l,d)}function Wl(e,t,l,n,o){e!==t&&$l(t,function(s,i){if(o||(o=new qn),It(s))Ra(e,t,i,l,Wl,n,o);else{var a=n?n(Rt(e,i),s,i+"",e,t,o):void 0;a===void 0&&(a=s),Pt(e,i,a)}},xl)}function Fa(e,t){var l=-1,n=yt(e)?Array(e.length):[];return Na(e,function(o,s,i){n[++l]=t(o,s,i)}),n}function Ta(e,t){var l=Lt(e)?Zn:Fa;return l(e,_n(t))}function za(e,t){return Rn(Ta(e,t))}function lt(e){return e===null}var Bl=ga(function(e,t,l){Wl(e,t,l)});const Ma=e=>Ie?window.requestAnimationFrame(e):setTimeout(e,16),Hl={modelValue:{type:[Number,String,Boolean],default:void 0},label:{type:[String,Boolean,Number,Object],default:void 0},value:{type:[String,Boolean,Number,Object],default:void 0},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:{type:String,default:void 0},trueValue:{type:[String,Number],default:void 0},falseValue:{type:[String,Number],default:void 0},trueLabel:{type:[String,Number],default:void 0},falseLabel:{type:[String,Number],default:void 0},id:{type:String,default:void 0},border:Boolean,size:Ct,tabindex:[String,Number],validateEvent:{type:Boolean,default:!0},...yl(["ariaControls"])},Al={[bt]:e=>we(e)||ce(e)||Fe(e),change:e=>we(e)||ce(e)||Fe(e)},Ue=Symbol("checkboxGroupContextKey"),Oa=({model:e,isChecked:t})=>{const l=he(Ue,void 0),n=R(()=>{var s,i;const a=(s=l==null?void 0:l.max)==null?void 0:s.value,r=(i=l==null?void 0:l.min)==null?void 0:i.value;return!Le(a)&&e.value.length>=a&&!t.value||!Le(r)&&e.value.length<=r&&t.value});return{isDisabled:Fn(R(()=>(l==null?void 0:l.disabled.value)||n.value)),isLimitDisabled:n}},_a=(e,{model:t,isLimitExceeded:l,hasOwnLabel:n,isDisabled:o,isLabeledByFormItem:s})=>{const i=he(Ue,void 0),{formItem:a}=At(),{emit:r}=de();function u(h){var b,w,S,P;return[!0,e.trueValue,e.trueLabel].includes(h)?(w=(b=e.trueValue)!=null?b:e.trueLabel)!=null?w:!0:(P=(S=e.falseValue)!=null?S:e.falseLabel)!=null?P:!1}function d(h,b){r("change",u(h),b)}function f(h){if(l.value)return;const b=h.target;r("change",u(b.checked),h)}async functionLine truncated
|
||||
import{s as Nn,l as Ln,m as Pn,n as ll,p as Rn,f as yl,U as bt,d as Fn,g as At,i as Vt,c as Nt,h as Cl,e as st,q as Tn,E as zn,t as Mn,b as On}from"./el-input-CNNwOXGP.js";import"./el-tag-5pOVEKUY.js";import{b as _n,i as wl,a as $n,E as Wn,d as dt,c as Sl}from"./el-select-LRJf3l5x.js";import{i as yt,g as Bn,k as Hn,c as An,a as xl,b as Vn,d as In,e as Kn,f as Dn,h as jn,j as Un,S as qn,E as El,C as Gn}from"./el-popper-C96qJ_vz.js";import"./el-tooltip-l0sNRNKZ.js";import{b3 as It,b4 as Yn,b5 as kl,b6 as Nl,b7 as Xn,b8 as Qn,b9 as Lt,ba as Jn,bb as Zn,E as Ie,G as we,e as ce,ag as Fe,ah as Ct,i as he,c as R,a7 as Le,aT as de,$ as ie,F as _e,s as N,al as oe,ai as Be,f as Xe,bc as nl,_ as Pe,a as j,aG as Ll,u as se,g as re,o as z,w as ee,N as te,P as V,Q as ge,h as W,j as C,A as Oe,O as ft,J as Qe,bd as ht,r as Te,ab as Ke,U as He,R as J,k as wt,n as Ae,b as $e,d as Kt,p as Dt,x as Pl,l as jt,ak as Ut,aV as pt,ao as Me,W as et,q as Rl,m as Fl,B as U,ac as vt,aW as Ve,be as ea,bf as al,bg as ta,S as la,bh as na,z as B,aS as qt,bi as aa,a5 as Je,a2 as Ne,a4 as ol,bj as Tl,a3 as oa,bk as sl,M as ke,bl as zl,bm as sa,aR as ra,bn as Ml,a0 as tt,aL as ia,aD as Gt,aQ as qe,D as Ze,a6 as ua,I as gt,t as ca,bo as rl,aY as il,C as ul,a1 as Ol,Y as da,bp as fa,a8 as ha,af as St,aF as xt}from"./index-CxMsK_Ni.js";function pa(e,t){return Nn(Ln(e,t,Pn),e+"")}function va(e,t,l){if(!It(l))return!1;var n=typeof t;return(n=="number"?yt(l)&&Yn(t,l.length):n=="string"&&t in l)?kl(l[t],e):!1}function ga(e){return pa(function(t,l){var n=-1,o=l.length,s=o>1?l[o-1]:void 0,i=o>2?l[2]:void 0;for(s=e.length>3&&typeof s=="function"?(o--,s):void 0,i&&va(l[0],l[1],i)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var a=l[n];a&&e(t,a,n,s)}return t})}var ma="[object Object]",ba=Function.prototype,ya=Object.prototype,_l=ba.toString,Ca=ya.hasOwnProperty,wa=_l.call(Object);function Sa(e){if(!Nl(e)||Xn(e)!=ma)return!1;var t=Bn(e);if(t===null)return!0;var l=Ca.call(t,"constructor")&&t.constructor;return typeof l=="function"&&l instanceof l&&_l.call(l)==wa}function xa(e){return function(t,l,n){for(var o=-1,s=Object(t),i=n(t),a=i.length;a--;){var r=i[++o];if(l(s[r],r,s)===!1)break}return t}}var $l=xa();function Ea(e,t){return e&&$l(e,t,Hn)}function ka(e,t){return function(l,n){if(l==null)return l;if(!yt(l))return e(l,n);for(var o=l.length,s=-1,i=Object(l);++s<o&&n(i[s],s,i)!==!1;);return l}}var Na=ka(Ea);function Pt(e,t,l){(l!==void 0&&!kl(e[t],l)||l===void 0&&!(t in e))&&Qn(e,t,l)}function La(e){return Nl(e)&&yt(e)}function Rt(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Pa(e){return An(e,xl(e))}function Ra(e,t,l,n,o,s,i){var a=Rt(e,l),r=Rt(t,l),u=i.get(r);if(u){Pt(e,l,u);return}var d=s?s(a,r,l+"",e,t,i):void 0,f=d===void 0;if(f){var v=Lt(r),y=!v&&Vn(r),h=!v&&!y&&In(r);d=r,v||y||h?Lt(a)?d=a:La(a)?d=Kn(a):y?(f=!1,d=Dn(r,!0)):h?(f=!1,d=jn(r,!0)):d=[]:Sa(r)||ll(r)?(d=a,ll(a)?d=Pa(a):(!It(a)||Jn(a))&&(d=Un(r))):f=!1}f&&(i.set(r,d),o(d,r,n,s,i),i.delete(r)),Pt(e,l,d)}function Wl(e,t,l,n,o){e!==t&&$l(t,function(s,i){if(o||(o=new qn),It(s))Ra(e,t,i,l,Wl,n,o);else{var a=n?n(Rt(e,i),s,i+"",e,t,o):void 0;a===void 0&&(a=s),Pt(e,i,a)}},xl)}function Fa(e,t){var l=-1,n=yt(e)?Array(e.length):[];return Na(e,function(o,s,i){n[++l]=t(o,s,i)}),n}function Ta(e,t){var l=Lt(e)?Zn:Fa;return l(e,_n(t))}function za(e,t){return Rn(Ta(e,t))}function lt(e){return e===null}var Bl=ga(function(e,t,l){Wl(e,t,l)});const Ma=e=>Ie?window.requestAnimationFrame(e):setTimeout(e,16),Hl={modelValue:{type:[Number,String,Boolean],default:void 0},label:{type:[String,Boolean,Number,Object],default:void 0},value:{type:[String,Boolean,Number,Object],default:void 0},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:{type:String,default:void 0},trueValue:{type:[String,Number],default:void 0},falseValue:{type:[String,Number],default:void 0},trueLabel:{type:[String,Number],default:void 0},falseLabel:{type:[String,Number],default:void 0},id:{type:String,default:void 0},border:Boolean,size:Ct,tabindex:[String,Number],validateEvent:{type:Boolean,default:!0},...yl(["ariaControls"])},Al={[bt]:e=>we(e)||ce(e)||Fe(e),change:e=>we(e)||ce(e)||Fe(e)},Ue=Symbol("checkboxGroupContextKey"),Oa=({model:e,isChecked:t})=>{const l=he(Ue,void 0),n=R(()=>{var s,i;const a=(s=l==null?void 0:l.max)==null?void 0:s.value,r=(i=l==null?void 0:l.min)==null?void 0:i.value;return!Le(a)&&e.value.length>=a&&!t.value||!Le(r)&&e.value.length<=r&&t.value});return{isDisabled:Fn(R(()=>(l==null?void 0:l.disabled.value)||n.value)),isLimitDisabled:n}},_a=(e,{model:t,isLimitExceeded:l,hasOwnLabel:n,isDisabled:o,isLabeledByFormItem:s})=>{const i=he(Ue,void 0),{formItem:a}=At(),{emit:r}=de();function u(h){var b,w,S,P;return[!0,e.trueValue,e.trueLabel].includes(h)?(w=(b=e.trueValue)!=null?b:e.trueLabel)!=null?w:!0:(P=(S=e.falseValue)!=null?S:e.falseLabel)!=null?P:!1}function d(h,b){r("change",u(h),b)}function f(h){if(l.value)return;const b=h.target;r("change",u(b.checked),h)}async functionLine truncated
|
||||
* Checks if an event is supported in the current execution environment.
|
||||
*
|
||||
* NOTE: This will not work correctly for non-generic events such as `change`,
|
||||
@@ -1 +1 @@
|
||||
import{o as he,E as Ae,a as We,b as Re,u as Ce}from"./el-input-D_xPEeA2.js";import{E as Xe,u as Ye,a as xe,b as Je,c as Qe,d as en}from"./config-C0oXmCul.js";import{b as Ve,m as H,d as U,_ as de,a as P,i as nn,c as k,u as _e,e as we,f as le,g as T,o as h,w as v,r as fe,n as se,h as p,j as E,k as j,l as Oe,p as tn,q as on,s as M,t as me,v as sn,x as Ne,y as Pe,z as q,A as G,B as m,C as te,T as ze,D as ae,E as je,F as O,G as Y,H as Z,I as Ee,J as an,K as ln,L as rn,M as z,N as $,O as Q,P as D,Q as _,R as V,S as ee,U as W,V as un,W as cn,X as ke,Y as Be,Z as $e,$ as ie,a0 as De,a1 as dn,a2 as ue,a3 as Fe,a4 as Ke,a5 as Se,a6 as Ie,a7 as fn,a8 as mn,a9 as vn,aa as pn,ab as gn,ac as bn,ad as yn,ae as hn,af as Cn}from"./index-5orz1M6_.js";import{u as wn,a as En,_ as kn}from"./CardTools.vue_vue_type_script_setup_true_lang-CMcmqUZX.js";import"./vnode-DkiIqzI4.js";import"./el-tag-DsWzxe9q.js";import"./index-CX7K5KgQ.js";const Bn=Ve({tag:{type:String,default:"div"},span:{type:Number,default:24},offset:{type:Number,default:0},pull:{type:Number,default:0},push:{type:Number,default:0},xs:{type:U([Number,Object]),default:()=>H({})},sm:{type:U([Number,Object]),default:()=>H({})},md:{type:U([Number,Object]),default:()=>H({})},lg:{type:U([Number,Object]),default:()=>H({})},xl:{type:U([Number,Object]),default:()=>H({})}}),He=Symbol("rowContextKey"),$n=P({name:"ElCol"}),Sn=P({...$n,props:Bn,setup(e){const n=e,{gutter:t}=nn(He,{gutter:k(()=>0)}),s=_e("col"),r=k(()=>{const l={};return t.value&&(l.paddingLeft=l.paddingRight=`${t.value/2}px`),l}),a=k(()=>{const l=[];return["span","offset","pull","push"].forEach(o=>{const g=n[o];we(g)&&(o==="span"?l.push(s.b(`${n[o]}`)):g>0&&l.push(s.b(`${o}-${n[o]}`)))}),["xs","sm","md","lg","xl"].forEach(o=>{we(n[o])?l.push(s.b(`${o}-${n[o]}`)):le(n[o])&&Object.entries(n[o]).forEach(([g,b])=>{l.push(g!=="span"?s.b(`${o}-${g}-${b}`):s.b(`${o}-${b}`))})}),t.value&&l.push(s.is("guttered")),[s.b(),l]});return(l,c)=>(h(),T(j(l.tag),{class:p(E(a)),style:se(E(r))},{default:v(()=>[fe(l.$slots,"default")]),_:3},8,["class","style"]))}});var In=de(Sn,[["__file","col.vue"]]);const Ln=Oe(In),Tn=["start","center","end","space-around","space-between","space-evenly"],Mn=["top","middle","bottom"],An=Ve({tag:{type:String,default:"div"},gutter:{type:Number,default:0},justify:{type:String,values:Tn,default:"start"},align:{type:String,values:Mn}}),Rn=P({name:"ElRow"}),Vn=P({...Rn,props:An,setup(e){const n=e,t=_e("row"),s=k(()=>n.gutter);tn(He,{gutter:s});const r=k(()=>{const l={};return n.gutter&&(l.marginRight=l.marginLeft=`-${n.gutter/2}px`),l}),a=k(()=>[t.b(),t.is(`justify-${n.justify}`,n.justify!=="start"),t.is(`align-${n.align}`,!!n.align)]);return(l,c)=>(h(),T(j(l.tag),{class:p(E(a)),style:se(E(r))},{default:v(()=>[fe(l.$slots,"default")]),_:3},8,["class","style"]))}});var _n=de(Vn,[["__file","row.vue"]]);const On=Oe(_n),Nn=e=>["",...on].includes(e);function Pn(e){let n;const t=M(!1),s=me({...e,originalPosition:"",originalOverflow:"",visible:!1});function r(i){s.text=i}function a(){const i=s.parent,f=b.ns;if(!i.vLoadingAddClassList){let u=i.getAttribute("loading-number");u=Number.parseInt(u)-1,u?i.setAttribute("loading-number",u.toString()):(ae(i,f.bm("parent","relative")),i.removeAttribute("loading-number")),ae(i,f.bm("parent","hidden"))}l(),g.unmount()}function l(){var i,f;(f=(i=b.$el)==null?void 0:i.parentNode)==null||f.removeChild(b.$el)}function c(){var i;e.beforeClose&&!e.beforeClose()||(t.value=!0,clearTimeout(n),n=setTimeout(y,400),s.visible=!1,(i=e.closed)==null||i.call(e))}function y(){if(!t.value)return;const i=s.parent;t.value=!1,i.vLoadingAddClassList=void 0,a()}const o=P({name:"ElLoading",setup(i,{expose:f}){const{ns:u,zIndex:C}=Pe("loading");return f({ns:u,zIndex:C}),()=>{const w=s.spinner||s.svg,B=q("svg",{class:"circular",viewBox:s.svgViewBox?s.svgViewBox:"0 0 50 50",...w?{innerHTML:w}:{}},[q("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})]),A=s.text?q("p",{class:u.b("text")},[s.text]):void 0;return q(ze,{name:u.b("fade"),onAfterLeave:y},{default:v(()=>[G(m("div",{style:{backgroundColor:s.background||""},class:[u.b("mask"),s.customClass,s.fullscreen?"is-fullscreen":""]},[q("div",{class:u.b("spinner")},[B,A])]),[[te,s.visible]])])})}}}),g=sn(o),b=g.mount(document.createElement("div"));return{...Ne(s),setText:r,removeElLoadingChild:l,close:c,handleAfterLeave:y,vm:b,get $el(){return b.$el}}}let ne;const zn=function(e={}){if(!je)return;const n=jn(e);if(n.fullscreen&&ne)return ne;const t=Pn({...n,closed:()=>{var r;(r=n.closed)==null||r.call(n),n.fullscreen&&(ne=void 0)}});Dn(n,n.parent,t),Le(n,n.parent,t),n.parent.vLoadingAddClassList=()=>Le(n,n.parent,t);let s=n.parent.getAttribute("loading-number");return s?s=`${Number.parseInt(s)+1}`:s="1",n.parent.setAttribute("loading-number",s),n.parent.appendChild(t.$el),O(()=>t.visible.value=n.visible),n.fullscreen&&(ne=t),t},jn=e=>{var n,t,s,r;let a;return Y(e.target)?a=(n=document.querySelector(e.target))!=null?n:document.body:a=e.target||docLine truncated
|
||||
import{o as he,E as Ae,a as We,b as Re,u as Ce}from"./el-input-CNNwOXGP.js";import{E as Xe,u as Ye,a as xe,b as Je,c as Qe,d as en}from"./config-CZWWa62X.js";import{b as Ve,m as H,d as U,_ as de,a as P,i as nn,c as k,u as _e,e as we,f as le,g as T,o as h,w as v,r as fe,n as se,h as p,j as E,k as j,l as Oe,p as tn,q as on,s as M,t as me,v as sn,x as Ne,y as Pe,z as q,A as G,B as m,C as te,T as ze,D as ae,E as je,F as O,G as Y,H as Z,I as Ee,J as an,K as ln,L as rn,M as z,N as $,O as Q,P as D,Q as _,R as V,S as ee,U as W,V as un,W as cn,X as ke,Y as Be,Z as $e,$ as ie,a0 as De,a1 as dn,a2 as ue,a3 as Fe,a4 as Ke,a5 as Se,a6 as Ie,a7 as fn,a8 as mn,a9 as vn,aa as pn,ab as gn,ac as bn,ad as yn,ae as hn,af as Cn}from"./index-CxMsK_Ni.js";import{u as wn,a as En,_ as kn}from"./CardTools.vue_vue_type_script_setup_true_lang-CdJKhv07.js";import"./vnode-Cc0RQjVK.js";import"./el-tag-5pOVEKUY.js";import"./index-CBpXPsVN.js";const Bn=Ve({tag:{type:String,default:"div"},span:{type:Number,default:24},offset:{type:Number,default:0},pull:{type:Number,default:0},push:{type:Number,default:0},xs:{type:U([Number,Object]),default:()=>H({})},sm:{type:U([Number,Object]),default:()=>H({})},md:{type:U([Number,Object]),default:()=>H({})},lg:{type:U([Number,Object]),default:()=>H({})},xl:{type:U([Number,Object]),default:()=>H({})}}),He=Symbol("rowContextKey"),$n=P({name:"ElCol"}),Sn=P({...$n,props:Bn,setup(e){const n=e,{gutter:t}=nn(He,{gutter:k(()=>0)}),s=_e("col"),r=k(()=>{const l={};return t.value&&(l.paddingLeft=l.paddingRight=`${t.value/2}px`),l}),a=k(()=>{const l=[];return["span","offset","pull","push"].forEach(o=>{const g=n[o];we(g)&&(o==="span"?l.push(s.b(`${n[o]}`)):g>0&&l.push(s.b(`${o}-${n[o]}`)))}),["xs","sm","md","lg","xl"].forEach(o=>{we(n[o])?l.push(s.b(`${o}-${n[o]}`)):le(n[o])&&Object.entries(n[o]).forEach(([g,b])=>{l.push(g!=="span"?s.b(`${o}-${g}-${b}`):s.b(`${o}-${b}`))})}),t.value&&l.push(s.is("guttered")),[s.b(),l]});return(l,c)=>(h(),T(j(l.tag),{class:p(E(a)),style:se(E(r))},{default:v(()=>[fe(l.$slots,"default")]),_:3},8,["class","style"]))}});var In=de(Sn,[["__file","col.vue"]]);const Ln=Oe(In),Tn=["start","center","end","space-around","space-between","space-evenly"],Mn=["top","middle","bottom"],An=Ve({tag:{type:String,default:"div"},gutter:{type:Number,default:0},justify:{type:String,values:Tn,default:"start"},align:{type:String,values:Mn}}),Rn=P({name:"ElRow"}),Vn=P({...Rn,props:An,setup(e){const n=e,t=_e("row"),s=k(()=>n.gutter);tn(He,{gutter:s});const r=k(()=>{const l={};return n.gutter&&(l.marginRight=l.marginLeft=`-${n.gutter/2}px`),l}),a=k(()=>[t.b(),t.is(`justify-${n.justify}`,n.justify!=="start"),t.is(`align-${n.align}`,!!n.align)]);return(l,c)=>(h(),T(j(l.tag),{class:p(E(a)),style:se(E(r))},{default:v(()=>[fe(l.$slots,"default")]),_:3},8,["class","style"]))}});var _n=de(Vn,[["__file","row.vue"]]);const On=Oe(_n),Nn=e=>["",...on].includes(e);function Pn(e){let n;const t=M(!1),s=me({...e,originalPosition:"",originalOverflow:"",visible:!1});function r(i){s.text=i}function a(){const i=s.parent,f=b.ns;if(!i.vLoadingAddClassList){let u=i.getAttribute("loading-number");u=Number.parseInt(u)-1,u?i.setAttribute("loading-number",u.toString()):(ae(i,f.bm("parent","relative")),i.removeAttribute("loading-number")),ae(i,f.bm("parent","hidden"))}l(),g.unmount()}function l(){var i,f;(f=(i=b.$el)==null?void 0:i.parentNode)==null||f.removeChild(b.$el)}function c(){var i;e.beforeClose&&!e.beforeClose()||(t.value=!0,clearTimeout(n),n=setTimeout(y,400),s.visible=!1,(i=e.closed)==null||i.call(e))}function y(){if(!t.value)return;const i=s.parent;t.value=!1,i.vLoadingAddClassList=void 0,a()}const o=P({name:"ElLoading",setup(i,{expose:f}){const{ns:u,zIndex:C}=Pe("loading");return f({ns:u,zIndex:C}),()=>{const w=s.spinner||s.svg,B=q("svg",{class:"circular",viewBox:s.svgViewBox?s.svgViewBox:"0 0 50 50",...w?{innerHTML:w}:{}},[q("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})]),A=s.text?q("p",{class:u.b("text")},[s.text]):void 0;return q(ze,{name:u.b("fade"),onAfterLeave:y},{default:v(()=>[G(m("div",{style:{backgroundColor:s.background||""},class:[u.b("mask"),s.customClass,s.fullscreen?"is-fullscreen":""]},[q("div",{class:u.b("spinner")},[B,A])]),[[te,s.visible]])])})}}}),g=sn(o),b=g.mount(document.createElement("div"));return{...Ne(s),setText:r,removeElLoadingChild:l,close:c,handleAfterLeave:y,vm:b,get $el(){return b.$el}}}let ne;const zn=function(e={}){if(!je)return;const n=jn(e);if(n.fullscreen&&ne)return ne;const t=Pn({...n,closed:()=>{var r;(r=n.closed)==null||r.call(n),n.fullscreen&&(ne=void 0)}});Dn(n,n.parent,t),Le(n,n.parent,t),n.parent.vLoadingAddClassList=()=>Le(n,n.parent,t);let s=n.parent.getAttribute("loading-number");return s?s=`${Number.parseInt(s)+1}`:s="1",n.parent.setAttribute("loading-number",s),n.parent.appendChild(t.$el),O(()=>t.visible.value=n.visible),n.fullscreen&&(ne=t),t},jn=e=>{var n,t,s,r;let a;return Y(e.target)?a=(n=document.querySelector(e.target))!=null?n:document.body:a=e.target||docLine truncated
|
||||
@@ -1 +1 @@
|
||||
import{u as q,E as H,b as Q}from"./el-input-D_xPEeA2.js";import{c as Z,h as A,d as J}from"./config-C0oXmCul.js";import{E as K,a as W}from"./el-form-item-CzDqJHnU.js";import"./el-tag-DsWzxe9q.js";import{E as X,a as Y}from"./el-select-lHlEhHIn.js";import"./el-popper-DxfKqvb2.js";import{_ as R,a as g,u as G,P as c,o as n,N as l,j as e,b as ee,ao as le,c as B,aH as te,Q as C,r as x,B as d,n as ae,h,R as m,l as oe,a8 as se,s as N,t as ne,g as V,ab as b,ac as F,w as i,af as $,U as k,aF as I}from"./index-5orz1M6_.js";import"./vnode-DkiIqzI4.js";import"./_baseClone-IT_4yc7W.js";const re=g({name:"ImgEmpty"}),ie=g({...re,setup(_){const t=G("empty"),r=q();return(p,u)=>(n(),c("svg",{viewBox:"0 0 79 86",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[l("defs",null,[l("linearGradient",{id:`linearGradient-1-${e(r)}`,x1:"38.8503086%",y1:"0%",x2:"61.1496914%",y2:"100%"},[l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-1")})`,offset:"0%"},null,8,["stop-color"]),l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-4")})`,offset:"100%"},null,8,["stop-color"])],8,["id"]),l("linearGradient",{id:`linearGradient-2-${e(r)}`,x1:"0%",y1:"9.5%",x2:"100%",y2:"90.5%"},[l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-1")})`,offset:"0%"},null,8,["stop-color"]),l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-6")})`,offset:"100%"},null,8,["stop-color"])],8,["id"]),l("rect",{id:`path-3-${e(r)}`,x:"0",y:"0",width:"17",height:"36"},null,8,["id"])]),l("g",{id:"Illustrations",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[l("g",{id:"B-type",transform:"translate(-1268.000000, -535.000000)"},[l("g",{id:"Group-2",transform:"translate(1268.000000, 535.000000)"},[l("path",{id:"Oval-Copy-2",d:"M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",fill:`var(${e(t).cssVarBlockName("fill-color-3")})`},null,8,["fill"]),l("polygon",{id:"Rectangle-Copy-14",fill:`var(${e(t).cssVarBlockName("fill-color-7")})`,transform:"translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",points:"13 58 53 58 42 45 2 45"},null,8,["fill"]),l("g",{id:"Group-Copy",transform:"translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"},[l("polygon",{id:"Rectangle-Copy-10",fill:`var(${e(t).cssVarBlockName("fill-color-7")})`,transform:"translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",points:"2.84078316e-14 3 18 3 23 7 5 7"},null,8,["fill"]),l("polygon",{id:"Rectangle-Copy-11",fill:`var(${e(t).cssVarBlockName("fill-color-5")})`,points:"-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"},null,8,["fill"]),l("rect",{id:"Rectangle-Copy-12",fill:`url(#linearGradient-1-${e(r)})`,transform:"translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",x:"38",y:"7",width:"17",height:"36"},null,8,["fill"]),l("polygon",{id:"Rectangle-Copy-13",fill:`var(${e(t).cssVarBlockName("fill-color-2")})`,transform:"translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",points:"24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"},null,8,["fill"])]),l("rect",{id:"Rectangle-Copy-15",fill:`url(#linearGradient-2-${e(r)})`,x:"13",y:"45",width:"40",height:"36"},null,8,["fill"]),l("g",{id:"Rectangle-Copy-17",transform:"translate(53.000000, 45.000000)"},[l("use",{id:"Mask",fill:`var(${e(t).cssVarBlockName("fill-color-8")})`,transform:"translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ","xlink:href":`#path-3-${e(r)}`},null,8,["fill","xlink:href"]),l("polygon",{id:"Rectangle-Copy",fill:`var(${e(t).cssVarBlockName("fill-color-9")})`,mask:`url(#mask-4-${e(r)})`,transform:"translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",points:"7 0 24 0 20 18 7 16.5"},null,8,["fill","mask"])]),l("polygon",{id:"Rectangle-Copy-18",fill:`var(${e(t).cssVarBlockName("fill-color-2")})`,transform:"translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",points:"62 45 79 45 70 58 53 58"},null,8,["fill"])])])])]))}});var ce=R(ie,[["__file","img-empty.vue"]]);const de=ee({image:{type:String,default:""},imageSize:Number,description:{type:String,default:""}}),pe=g({name:"ElEmpty"}),me=g({...pe,props:de,setup(_){const t=_,{t:r}=le(),p=G("empty"),u=B(()=>t.description||r("el.table.emptyText")),y=B(()=>({width:te(t.imageSize)}));return(a,w)=>(n(),c("div",{class:h(e(p).b())},[l("div",{class:h(e(p).e("image")),style:ae(e(y))},[a.image?(n(),c("img",{key:0,src:a.image,ondragstart:"return false"},null,8,["src"])):x(a.$slots,"image",{key:1},()=>[d(ce)])],6),l("div",{class:h(e(p).e("description"))},[a.$slots.description?x(a.$slots,"description",{key:0}):(n(),c("p",{key:1},m(e(u)),1))],2),a.$slots.default?(n(),c("div",{key:0,class:h(e(p).e("bottom"))},[x(a.$slots,"default")],2)Line truncated
|
||||
import{u as q,E as H,b as Q}from"./el-input-CNNwOXGP.js";import{c as Z,h as A,d as J}from"./config-CZWWa62X.js";import{E as K,a as W}from"./el-form-item-llYGp2SQ.js";import"./el-tag-5pOVEKUY.js";import{E as X,a as Y}from"./el-select-LRJf3l5x.js";import"./el-popper-C96qJ_vz.js";import{_ as R,a as g,u as G,P as c,o as n,N as l,j as e,b as ee,ao as le,c as B,aH as te,Q as C,r as x,B as d,n as ae,h,R as m,l as oe,a8 as se,s as N,t as ne,g as V,ab as b,ac as F,w as i,af as $,U as k,aF as I}from"./index-CxMsK_Ni.js";import"./vnode-Cc0RQjVK.js";import"./_baseClone-DD6IrDYX.js";const re=g({name:"ImgEmpty"}),ie=g({...re,setup(_){const t=G("empty"),r=q();return(p,u)=>(n(),c("svg",{viewBox:"0 0 79 86",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[l("defs",null,[l("linearGradient",{id:`linearGradient-1-${e(r)}`,x1:"38.8503086%",y1:"0%",x2:"61.1496914%",y2:"100%"},[l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-1")})`,offset:"0%"},null,8,["stop-color"]),l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-4")})`,offset:"100%"},null,8,["stop-color"])],8,["id"]),l("linearGradient",{id:`linearGradient-2-${e(r)}`,x1:"0%",y1:"9.5%",x2:"100%",y2:"90.5%"},[l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-1")})`,offset:"0%"},null,8,["stop-color"]),l("stop",{"stop-color":`var(${e(t).cssVarBlockName("fill-color-6")})`,offset:"100%"},null,8,["stop-color"])],8,["id"]),l("rect",{id:`path-3-${e(r)}`,x:"0",y:"0",width:"17",height:"36"},null,8,["id"])]),l("g",{id:"Illustrations",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[l("g",{id:"B-type",transform:"translate(-1268.000000, -535.000000)"},[l("g",{id:"Group-2",transform:"translate(1268.000000, 535.000000)"},[l("path",{id:"Oval-Copy-2",d:"M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",fill:`var(${e(t).cssVarBlockName("fill-color-3")})`},null,8,["fill"]),l("polygon",{id:"Rectangle-Copy-14",fill:`var(${e(t).cssVarBlockName("fill-color-7")})`,transform:"translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",points:"13 58 53 58 42 45 2 45"},null,8,["fill"]),l("g",{id:"Group-Copy",transform:"translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"},[l("polygon",{id:"Rectangle-Copy-10",fill:`var(${e(t).cssVarBlockName("fill-color-7")})`,transform:"translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",points:"2.84078316e-14 3 18 3 23 7 5 7"},null,8,["fill"]),l("polygon",{id:"Rectangle-Copy-11",fill:`var(${e(t).cssVarBlockName("fill-color-5")})`,points:"-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"},null,8,["fill"]),l("rect",{id:"Rectangle-Copy-12",fill:`url(#linearGradient-1-${e(r)})`,transform:"translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",x:"38",y:"7",width:"17",height:"36"},null,8,["fill"]),l("polygon",{id:"Rectangle-Copy-13",fill:`var(${e(t).cssVarBlockName("fill-color-2")})`,transform:"translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",points:"24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"},null,8,["fill"])]),l("rect",{id:"Rectangle-Copy-15",fill:`url(#linearGradient-2-${e(r)})`,x:"13",y:"45",width:"40",height:"36"},null,8,["fill"]),l("g",{id:"Rectangle-Copy-17",transform:"translate(53.000000, 45.000000)"},[l("use",{id:"Mask",fill:`var(${e(t).cssVarBlockName("fill-color-8")})`,transform:"translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ","xlink:href":`#path-3-${e(r)}`},null,8,["fill","xlink:href"]),l("polygon",{id:"Rectangle-Copy",fill:`var(${e(t).cssVarBlockName("fill-color-9")})`,mask:`url(#mask-4-${e(r)})`,transform:"translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",points:"7 0 24 0 20 18 7 16.5"},null,8,["fill","mask"])]),l("polygon",{id:"Rectangle-Copy-18",fill:`var(${e(t).cssVarBlockName("fill-color-2")})`,transform:"translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",points:"62 45 79 45 70 58 53 58"},null,8,["fill"])])])])]))}});var ce=R(ie,[["__file","img-empty.vue"]]);const de=ee({image:{type:String,default:""},imageSize:Number,description:{type:String,default:""}}),pe=g({name:"ElEmpty"}),me=g({...pe,props:de,setup(_){const t=_,{t:r}=le(),p=G("empty"),u=B(()=>t.description||r("el.table.emptyText")),y=B(()=>({width:te(t.imageSize)}));return(a,w)=>(n(),c("div",{class:h(e(p).b())},[l("div",{class:h(e(p).e("image")),style:ae(e(y))},[a.image?(n(),c("img",{key:0,src:a.image,ondragstart:"return false"},null,8,["src"])):x(a.$slots,"image",{key:1},()=>[d(ce)])],6),l("div",{class:h(e(p).e("description"))},[a.$slots.description?x(a.$slots,"description",{key:0}):(n(),c("p",{key:1},m(e(u)),1))],2),a.$slots.default?(n(),c("div",{key:0,class:h(e(p).e("bottom"))},[x(a.$slots,"default")],2)Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{C as Ze,U as ae,c as et,d as M,e as tt,f as at,u as st,g as ot,h as lt,i as be,t as se,E as _e,b as nt}from"./el-input-D_xPEeA2.js";import{c as oe,d as rt}from"./config-C0oXmCul.js";import"./el-tag-DsWzxe9q.js";import{i as it,E as ut,a as dt}from"./el-select-lHlEhHIn.js";import"./el-popper-DxfKqvb2.js";import{E as ct,u as Se,a as Ee,_ as pt}from"./CardTools.vue_vue_type_script_setup_true_lang-CMcmqUZX.js";import{G as ne,e as re,ag as ie,b as z,ah as ke,s as O,i as $e,c as P,ai as ue,_ as A,a as w,u as I,P as $,o as y,N as R,A as Ce,aj as Re,j as e,O as V,h as _,J as we,r as F,F as Fe,U as q,R as D,n as Ue,a0 as De,p as xe,t as ft,x as mt,$ as Y,ak as Pe,l as Be,al as Le,am as Ve,d as S,an as U,m as Z,ao as vt,g as B,w as E,ab as Te,ac as Oe,S as ze,Q as C,B as k,W as N,ap as yt,aq as gt,ar as ht,as as bt,at as _t,au as St,av as Et,aw as ee,ax as de,ay as kt,a2 as $t,az as Ct,a1 as Rt,aA as wt,aB as ce,aC as pe,a8 as le,aD as Ft,aE as Ut,aF as G,af as Ie}from"./index-5orz1M6_.js";import{b as Dt}from"./_baseClone-IT_4yc7W.js";import"./vnode-DkiIqzI4.js";import"./index-CX7K5KgQ.js";var xt=1,Pt=4;function fe(o){return Dt(o,xt|Pt)}const Ne=z({modelValue:{type:[String,Number,Boolean],default:void 0},size:ke,disabled:Boolean,label:{type:[String,Number,Boolean],default:void 0},value:{type:[String,Number,Boolean],default:void 0},name:{type:String,default:void 0}}),Bt=z({...Ne,border:Boolean}),Ae={[ae]:o=>ne(o)||re(o)||ie(o),[Ze]:o=>ne(o)||re(o)||ie(o)},je=Symbol("radioGroupKey"),Ge=(o,u)=>{const t=O(),l=$e(je,void 0),n=P(()=>!!l),d=P(()=>ue(o.value)?o.label:o.value),p=P({get(){return n.value?l.modelValue:o.modelValue},set(r){n.value?l.changeEvent(r):u&&u(ae,r),t.value.checked=o.modelValue===d.value}}),b=et(P(()=>l==null?void 0:l.size)),c=M(P(()=>l==null?void 0:l.disabled)),v=O(!1),g=P(()=>c.value||n.value&&p.value!==d.value?-1:0);return tt({from:"label act as value",replacement:"value",version:"3.0.0",scope:"el-radio",ref:"https://element-plus.org/en-US/component/radio.html"},P(()=>n.value&&ue(o.value))),{radioRef:t,isGroup:n,radioGroup:l,focus:v,size:b,disabled:c,tabIndex:g,modelValue:p,actualValue:d}},Lt=w({name:"ElRadio"}),Vt=w({...Lt,props:Bt,emits:Ae,setup(o,{emit:u}){const t=o,l=I("radio"),{radioRef:n,radioGroup:d,focus:p,size:b,disabled:c,modelValue:v,actualValue:g}=Ge(t,u);function r(){Fe(()=>u("change",v.value))}return(f,s)=>{var i;return y(),$("label",{class:_([e(l).b(),e(l).is("disabled",e(c)),e(l).is("focus",e(p)),e(l).is("bordered",f.border),e(l).is("checked",e(v)===e(g)),e(l).m(e(b))])},[R("span",{class:_([e(l).e("input"),e(l).is("disabled",e(c)),e(l).is("checked",e(v)===e(g))])},[Ce(R("input",{ref_key:"radioRef",ref:n,"onUpdate:modelValue":a=>we(v)?v.value=a:null,class:_(e(l).e("original")),value:e(g),name:f.name||((i=e(d))==null?void 0:i.name),disabled:e(c),checked:e(v)===e(g),type:"radio",onFocus:a=>p.value=!0,onBlur:a=>p.value=!1,onChange:r,onClick:V(()=>{},["stop"])},null,42,["onUpdate:modelValue","value","name","disabled","checked","onFocus","onBlur","onClick"]),[[Re,e(v)]]),R("span",{class:_(e(l).e("inner"))},null,2)],2),R("span",{class:_(e(l).e("label")),onKeydown:V(()=>{},["stop"])},[F(f.$slots,"default",{},()=>[q(D(f.label),1)])],42,["onKeydown"])],2)}}});var Tt=A(Vt,[["__file","radio.vue"]]);const Ot=z({...Ne}),zt=w({name:"ElRadioButton"}),It=w({...zt,props:Ot,setup(o){const u=o,t=I("radio"),{radioRef:l,focus:n,size:d,disabled:p,modelValue:b,radioGroup:c,actualValue:v}=Ge(u),g=P(()=>({backgroundColor:(c==null?void 0:c.fill)||"",borderColor:(c==null?void 0:c.fill)||"",boxShadow:c!=null&&c.fill?`-1px 0 0 0 ${c.fill}`:"",color:(c==null?void 0:c.textColor)||""}));return(r,f)=>{var s;return y(),$("label",{class:_([e(t).b("button"),e(t).is("active",e(b)===e(v)),e(t).is("disabled",e(p)),e(t).is("focus",e(n)),e(t).bm("button",e(d))])},[Ce(R("input",{ref_key:"radioRef",ref:l,"onUpdate:modelValue":i=>we(b)?b.value=i:null,class:_(e(t).be("button","original-radio")),value:e(v),type:"radio",name:r.name||((s=e(c))==null?void 0:s.name),disabled:e(p),onFocus:i=>n.value=!0,onBlur:i=>n.value=!1,onClick:V(()=>{},["stop"])},null,42,["onUpdate:modelValue","value","name","disabled","onFocus","onBlur","onClick"]),[[Re,e(b)]]),R("span",{class:_(e(t).be("button","inner")),style:Ue(e(b)===e(v)?e(g):{}),onKeydown:V(()=>{},["stop"])},[F(r.$slots,"default",{},()=>[q(D(r.label),1)])],46,["onKeydown"])],2)}}});var qe=A(It,[["__file","radio-button.vue"]]);const Nt=z({id:{type:String,default:void 0},size:ke,disabled:Boolean,modelValue:{type:[String,Number,Boolean],default:void 0},fill:{type:String,default:""},textColor:{type:String,default:""},name:{type:String,default:void 0},validateEvent:{type:Boolean,default:!0},...at(["ariaLabel"])}),At=Ae,jt=w({name:"ElRadioGroup"}),Gt=w({...jt,props:Nt,emits:At,setup(o,{emit:u}){const t=o,l=I("radio"),n=st(),d=O(),{formItem:p}=ot(),{inputId:b,isLabeledByFormItem:c}=lt(t,{formItemContext:p}),v=r=>{u(ae,r),Fe(()=>u("change",r))};De(()=>{const r=d.value.querySelectorAll("[type=rLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{C as Ze,U as ae,c as et,d as M,e as tt,f as at,u as st,g as ot,h as lt,i as be,t as se,E as _e,b as nt}from"./el-input-CNNwOXGP.js";import{c as oe,d as rt}from"./config-CZWWa62X.js";import"./el-tag-5pOVEKUY.js";import{i as it,E as ut,a as dt}from"./el-select-LRJf3l5x.js";import"./el-popper-C96qJ_vz.js";import{E as ct,u as Se,a as Ee,_ as pt}from"./CardTools.vue_vue_type_script_setup_true_lang-CdJKhv07.js";import{G as ne,e as re,ag as ie,b as z,ah as ke,s as O,i as $e,c as P,ai as ue,_ as A,a as w,u as I,P as $,o as y,N as R,A as Ce,aj as Re,j as e,O as V,h as _,J as we,r as D,F as De,U as q,R as U,n as Fe,a0 as Ue,p as xe,t as ft,x as mt,$ as Y,ak as Pe,l as Be,al as Le,am as Ve,d as S,an as F,m as Z,ao as vt,g as B,w as E,ab as Te,ac as Oe,S as ze,Q as C,B as k,W as N,ap as yt,aq as gt,ar as ht,as as bt,at as _t,au as St,av as Et,aw as ee,ax as de,ay as kt,a2 as $t,az as Ct,a1 as Rt,aA as wt,aB as ce,aC as pe,a8 as le,aD as Dt,aE as Ft,aF as G,af as Ie}from"./index-CxMsK_Ni.js";import{b as Ut}from"./_baseClone-DD6IrDYX.js";import"./vnode-Cc0RQjVK.js";import"./index-CBpXPsVN.js";var xt=1,Pt=4;function fe(o){return Ut(o,xt|Pt)}const Ne=z({modelValue:{type:[String,Number,Boolean],default:void 0},size:ke,disabled:Boolean,label:{type:[String,Number,Boolean],default:void 0},value:{type:[String,Number,Boolean],default:void 0},name:{type:String,default:void 0}}),Bt=z({...Ne,border:Boolean}),Ae={[ae]:o=>ne(o)||re(o)||ie(o),[Ze]:o=>ne(o)||re(o)||ie(o)},je=Symbol("radioGroupKey"),Ge=(o,u)=>{const t=O(),l=$e(je,void 0),r=P(()=>!!l),d=P(()=>ue(o.value)?o.label:o.value),p=P({get(){return r.value?l.modelValue:o.modelValue},set(i){r.value?l.changeEvent(i):u&&u(ae,i),t.value.checked=o.modelValue===d.value}}),b=et(P(()=>l==null?void 0:l.size)),c=M(P(()=>l==null?void 0:l.disabled)),v=O(!1),g=P(()=>c.value||r.value&&p.value!==d.value?-1:0);return tt({from:"label act as value",replacement:"value",version:"3.0.0",scope:"el-radio",ref:"https://element-plus.org/en-US/component/radio.html"},P(()=>r.value&&ue(o.value))),{radioRef:t,isGroup:r,radioGroup:l,focus:v,size:b,disabled:c,tabIndex:g,modelValue:p,actualValue:d}},Lt=w({name:"ElRadio"}),Vt=w({...Lt,props:Bt,emits:Ae,setup(o,{emit:u}){const t=o,l=I("radio"),{radioRef:r,radioGroup:d,focus:p,size:b,disabled:c,modelValue:v,actualValue:g}=Ge(t,u);function i(){De(()=>u("change",v.value))}return(f,s)=>{var n;return y(),$("label",{class:_([e(l).b(),e(l).is("disabled",e(c)),e(l).is("focus",e(p)),e(l).is("bordered",f.border),e(l).is("checked",e(v)===e(g)),e(l).m(e(b))])},[R("span",{class:_([e(l).e("input"),e(l).is("disabled",e(c)),e(l).is("checked",e(v)===e(g))])},[Ce(R("input",{ref_key:"radioRef",ref:r,"onUpdate:modelValue":a=>we(v)?v.value=a:null,class:_(e(l).e("original")),value:e(g),name:f.name||((n=e(d))==null?void 0:n.name),disabled:e(c),checked:e(v)===e(g),type:"radio",onFocus:a=>p.value=!0,onBlur:a=>p.value=!1,onChange:i,onClick:V(()=>{},["stop"])},null,42,["onUpdate:modelValue","value","name","disabled","checked","onFocus","onBlur","onClick"]),[[Re,e(v)]]),R("span",{class:_(e(l).e("inner"))},null,2)],2),R("span",{class:_(e(l).e("label")),onKeydown:V(()=>{},["stop"])},[D(f.$slots,"default",{},()=>[q(U(f.label),1)])],42,["onKeydown"])],2)}}});var Tt=A(Vt,[["__file","radio.vue"]]);const Ot=z({...Ne}),zt=w({name:"ElRadioButton"}),It=w({...zt,props:Ot,setup(o){const u=o,t=I("radio"),{radioRef:l,focus:r,size:d,disabled:p,modelValue:b,radioGroup:c,actualValue:v}=Ge(u),g=P(()=>({backgroundColor:(c==null?void 0:c.fill)||"",borderColor:(c==null?void 0:c.fill)||"",boxShadow:c!=null&&c.fill?`-1px 0 0 0 ${c.fill}`:"",color:(c==null?void 0:c.textColor)||""}));return(i,f)=>{var s;return y(),$("label",{class:_([e(t).b("button"),e(t).is("active",e(b)===e(v)),e(t).is("disabled",e(p)),e(t).is("focus",e(r)),e(t).bm("button",e(d))])},[Ce(R("input",{ref_key:"radioRef",ref:l,"onUpdate:modelValue":n=>we(b)?b.value=n:null,class:_(e(t).be("button","original-radio")),value:e(v),type:"radio",name:i.name||((s=e(c))==null?void 0:s.name),disabled:e(p),onFocus:n=>r.value=!0,onBlur:n=>r.value=!1,onClick:V(()=>{},["stop"])},null,42,["onUpdate:modelValue","value","name","disabled","onFocus","onBlur","onClick"]),[[Re,e(b)]]),R("span",{class:_(e(t).be("button","inner")),style:Fe(e(b)===e(v)?e(g):{}),onKeydown:V(()=>{},["stop"])},[D(i.$slots,"default",{},()=>[q(U(i.label),1)])],46,["onKeydown"])],2)}}});var qe=A(It,[["__file","radio-button.vue"]]);const Nt=z({id:{type:String,default:void 0},size:ke,disabled:Boolean,modelValue:{type:[String,Number,Boolean],default:void 0},fill:{type:String,default:""},textColor:{type:String,default:""},name:{type:String,default:void 0},validateEvent:{type:Boolean,default:!0},...at(["ariaLabel"])}),At=Ae,jt=w({name:"ElRadioGroup"}),Gt=w({...jt,props:Nt,emits:At,setup(o,{emit:u}){const t=o,l=I("radio"),r=st(),d=O(),{formItem:p}=ot(),{inputId:b,isLabeledByFormItem:c}=lt(t,{formItemContext:p}),v=i=>{u(ae,i),De(()=>u("change",i))};Ue(()=>{const i=d.value.querySelectorAll("[type=rLine truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{E as w,b as z}from"./el-input-D_xPEeA2.js";import{E as S,a as h}from"./el-form-item-CzDqJHnU.js";import"./el-tag-DsWzxe9q.js";import{E as A,a as C}from"./el-select-lHlEhHIn.js";import"./el-popper-DxfKqvb2.js";import{a as E,a8 as B,s as D,g as V,w as o,af as b,B as e,P as v,Q as N,j as s,ac as M,ab as T,N as i,U as f,R as m,aF as y,o as _}from"./index-5orz1M6_.js";import"./_baseClone-IT_4yc7W.js";const F={style:{display:"flex",height:"38px",width:"45%"}},I={style:{display:"flex",height:"38px","margin-left":"20px"}},K={style:{"margin-left":"0.4rem"}},O={style:{"margin-left":"0.4rem"}},j={style:{"margin-left":"0.4rem"}},q={key:0},L={style:{display:"flex",height:"38px"}},P={style:{"margin-right":"0.4rem"}},Q={style:{width:"200px","margin-left":"0.4rem"}},R={style:{display:"flex",height:"38px"}},G={style:{width:"3rem","margin-right":"0.4rem"}},H={style:{width:"200px","margin-left":"0.4rem"}},J={style:{display:"flex",height:"38px"}},W={style:{"margin-right":"0.4rem"}},X={style:{width:"200px","margin-left":"0.4rem"}},Y={style:{display:"flex",height:"38px"}},Z={style:{width:"3rem","margin-right":"0.4rem"}},$={style:{width:"200px","margin-left":"0.4rem"}},ue=E({__name:"SettingView",setup(c){const{t:n}=B(),l=D({name:"",description:"",file_storage:"",expireStyle:[],themesChoices:[],themesSelect:"",admin_token:"",robotsText:"",keywords:"",notify_title:"",notify_content:"",openUpload:1,uploadSize:1,uploadMinute:1,max_save_seconds:0,opacity:.9,s3_access_key_id:"",background:"",showAdminAddr:0,page_explain:"",s3_secret_access_key:"",aws_session_token:"",s3_signature_version:"",s3_region_name:"",s3_bucket_name:"",s3_endpoint_url:"",s3_hostname:"",uploadCount:1,errorMinute:1,errorCount:1});(()=>{b({url:"/admin/config/get",method:"get"}).then(p=>{l.value=p.detail})})();const x=()=>{b({url:"/admin/config/update",method:"patch",data:l.value}).then(p=>{p.code==200?y.success(n("admin.settings.saveSuccess")):y.error(p.message)})};return(p,a)=>{const u=w,d=h,r=C,g=A,U=z,k=S;return _(),V(k,null,{default:o(()=>[e(d,{size:"large",label:s(n)("admin.settings.name")},{default:o(()=>[e(u,{modelValue:l.value.name,"onUpdate:modelValue":a[0]||(a[0]=t=>l.value.name=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.description")},{default:o(()=>[e(u,{modelValue:l.value.description,"onUpdate:modelValue":a[1]||(a[1]=t=>l.value.description=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.keywords"),style:{"letter-spacing":"0.3rem"}},{default:o(()=>[e(u,{modelValue:l.value.keywords,"onUpdate:modelValue":a[2]||(a[2]=t=>l.value.keywords=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.themeSelect")},{default:o(()=>[e(g,{modelValue:l.value.themesSelect,"onUpdate:modelValue":a[3]||(a[3]=t=>l.value.themesSelect=t),style:{width:"100%"}},{default:o(()=>[(_(!0),v(T,null,M(l.value.themesChoices,t=>(_(),V(r,{label:t.name,value:t.key},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.notify_title")},{default:o(()=>[e(u,{modelValue:l.value.notify_title,"onUpdate:modelValue":a[4]||(a[4]=t=>l.value.notify_title=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.notify_content")},{default:o(()=>[e(u,{modelValue:l.value.notify_content,"onUpdate:modelValue":a[5]||(a[5]=t=>l.value.notify_content=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.background")},{default:o(()=>[i("span",F,[e(u,{modelValue:l.value.background,"onUpdate:modelValue":a[6]||(a[6]=t=>l.value.background=t),placeholder:"url"},null,8,["modelValue"])]),i("span",I,[a[29]||(a[29]=f(" Opacity: ")),e(u,{type:"number",modelValue:l.value.opacity,"onUpdate:modelValue":a[7]||(a[7]=t=>l.value.opacity=t)},null,8,["modelValue"])])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.showAdminAddr")},{default:o(()=>[e(g,{modelValue:l.value.showAdminAddr,"onUpdate:modelValue":a[8]||(a[8]=t=>l.value.showAdminAddr=t),style:{width:"80%"}},{default:o(()=>[e(r,{label:s(n)("admin.settings.showAdmin.open"),value:1},null,8,["label"]),e(r,{label:s(n)("admin.settings.showAdmin.close"),value:0},null,8,["label"])]),_:1},8,["modelValue"]),i("small",K,m(s(n)("admin.settings.showAdmin.note")),1)]),_:1},8,["label"]),e(d,{size:"large",label:"robots.Text"},{default:o(()=>[e(u,{type:"textarea",modelValue:l.value.robotsText,"onUpdate:modelValue":a[9]||(a[9]=t=>l.value.robotsText=t),placeholder:"explain"},null,8,["modelValue"])]),_:1}),e(d,{size:"large",label:s(n)("admin.settings.explain")},{default:o(()=>[e(u,{type:"textarea",modelValue:l.value.page_explain,"onUpdate:modelValue":a[10]||(a[10]=t=>l.value.page_explain=t),placeholder:"explain"},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.admin_token")},{default:o(()=>[e(u,{type:"password",modelValue:l.value.admin_token,"onUpdate:modelValuLine truncated
|
||||
import{E as w,b as z}from"./el-input-CNNwOXGP.js";import{E as S,a as h}from"./el-form-item-llYGp2SQ.js";import"./el-tag-5pOVEKUY.js";import{E as A,a as C}from"./el-select-LRJf3l5x.js";import"./el-popper-C96qJ_vz.js";import{a as E,a8 as B,s as D,g as V,w as o,af as b,B as e,P as v,Q as N,j as s,ac as M,ab as T,N as i,U as f,R as m,aF as y,o as _}from"./index-CxMsK_Ni.js";import"./_baseClone-DD6IrDYX.js";const F={style:{display:"flex",height:"38px",width:"45%"}},I={style:{display:"flex",height:"38px","margin-left":"20px"}},K={style:{"margin-left":"0.4rem"}},O={style:{"margin-left":"0.4rem"}},j={style:{"margin-left":"0.4rem"}},q={key:0},L={style:{display:"flex",height:"38px"}},P={style:{"margin-right":"0.4rem"}},Q={style:{width:"200px","margin-left":"0.4rem"}},R={style:{display:"flex",height:"38px"}},G={style:{width:"3rem","margin-right":"0.4rem"}},H={style:{width:"200px","margin-left":"0.4rem"}},J={style:{display:"flex",height:"38px"}},W={style:{"margin-right":"0.4rem"}},X={style:{width:"200px","margin-left":"0.4rem"}},Y={style:{display:"flex",height:"38px"}},Z={style:{width:"3rem","margin-right":"0.4rem"}},$={style:{width:"200px","margin-left":"0.4rem"}},ue=E({__name:"SettingView",setup(c){const{t:n}=B(),l=D({name:"",description:"",file_storage:"",expireStyle:[],themesChoices:[],themesSelect:"",admin_token:"",robotsText:"",keywords:"",notify_title:"",notify_content:"",openUpload:1,uploadSize:1,uploadMinute:1,max_save_seconds:0,opacity:.9,s3_access_key_id:"",background:"",showAdminAddr:0,page_explain:"",s3_secret_access_key:"",aws_session_token:"",s3_signature_version:"",s3_region_name:"",s3_bucket_name:"",s3_endpoint_url:"",s3_hostname:"",uploadCount:1,errorMinute:1,errorCount:1});(()=>{b({url:"/admin/config/get",method:"get"}).then(p=>{l.value=p.detail})})();const x=()=>{b({url:"/admin/config/update",method:"patch",data:l.value}).then(p=>{p.code==200?y.success(n("admin.settings.saveSuccess")):y.error(p.message)})};return(p,a)=>{const u=w,d=h,r=C,g=A,U=z,k=S;return _(),V(k,null,{default:o(()=>[e(d,{size:"large",label:s(n)("admin.settings.name")},{default:o(()=>[e(u,{modelValue:l.value.name,"onUpdate:modelValue":a[0]||(a[0]=t=>l.value.name=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.description")},{default:o(()=>[e(u,{modelValue:l.value.description,"onUpdate:modelValue":a[1]||(a[1]=t=>l.value.description=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.keywords"),style:{"letter-spacing":"0.3rem"}},{default:o(()=>[e(u,{modelValue:l.value.keywords,"onUpdate:modelValue":a[2]||(a[2]=t=>l.value.keywords=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.themeSelect")},{default:o(()=>[e(g,{modelValue:l.value.themesSelect,"onUpdate:modelValue":a[3]||(a[3]=t=>l.value.themesSelect=t),style:{width:"100%"}},{default:o(()=>[(_(!0),v(T,null,M(l.value.themesChoices,t=>(_(),V(r,{label:t.name,value:t.key},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.notify_title")},{default:o(()=>[e(u,{modelValue:l.value.notify_title,"onUpdate:modelValue":a[4]||(a[4]=t=>l.value.notify_title=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.notify_content")},{default:o(()=>[e(u,{modelValue:l.value.notify_content,"onUpdate:modelValue":a[5]||(a[5]=t=>l.value.notify_content=t)},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.background")},{default:o(()=>[i("span",F,[e(u,{modelValue:l.value.background,"onUpdate:modelValue":a[6]||(a[6]=t=>l.value.background=t),placeholder:"url"},null,8,["modelValue"])]),i("span",I,[a[29]||(a[29]=f(" Opacity: ")),e(u,{type:"number",modelValue:l.value.opacity,"onUpdate:modelValue":a[7]||(a[7]=t=>l.value.opacity=t)},null,8,["modelValue"])])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.showAdminAddr")},{default:o(()=>[e(g,{modelValue:l.value.showAdminAddr,"onUpdate:modelValue":a[8]||(a[8]=t=>l.value.showAdminAddr=t),style:{width:"80%"}},{default:o(()=>[e(r,{label:s(n)("admin.settings.showAdmin.open"),value:1},null,8,["label"]),e(r,{label:s(n)("admin.settings.showAdmin.close"),value:0},null,8,["label"])]),_:1},8,["modelValue"]),i("small",K,m(s(n)("admin.settings.showAdmin.note")),1)]),_:1},8,["label"]),e(d,{size:"large",label:"robots.Text"},{default:o(()=>[e(u,{type:"textarea",modelValue:l.value.robotsText,"onUpdate:modelValue":a[9]||(a[9]=t=>l.value.robotsText=t),placeholder:"explain"},null,8,["modelValue"])]),_:1}),e(d,{size:"large",label:s(n)("admin.settings.explain")},{default:o(()=>[e(u,{type:"textarea",modelValue:l.value.page_explain,"onUpdate:modelValue":a[10]||(a[10]=t=>l.value.page_explain=t),placeholder:"explain"},null,8,["modelValue"])]),_:1},8,["label"]),e(d,{size:"large",label:s(n)("admin.settings.admin_token")},{default:o(()=>[e(u,{type:"password",modelValue:l.value.admin_token,"onUpdate:modelValuLine truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{c as y,k as F,a as l,m as C,s as _,g as v,n as N,o as E,h as K,p as j,q as x,r as u,e as R,b as q,f as W,j as Y,S as H,t as J}from"./el-popper-DxfKqvb2.js";import{bv as $,b6 as B,b3 as Q,b9 as V,bw as X}from"./index-5orz1M6_.js";import{x as Z}from"./el-input-D_xPEeA2.js";function z(e,r){for(var n=-1,s=e==null?0:e.length;++n<s&&r(e[n],n,e)!==!1;);return e}function k(e,r){return e&&y(r,F(r),e)}function ee(e,r){return e&&y(r,l(r),e)}function re(e,r){return y(e,C(e),r)}var te=Object.getOwnPropertySymbols,L=te?function(e){for(var r=[];e;)Z(r,C(e)),e=v(e);return r}:_;function ne(e,r){return y(e,L(e),r)}function ae(e){return N(e,l,L)}var oe=Object.prototype,se=oe.hasOwnProperty;function ce(e){var r=e.length,n=new e.constructor(r);return r&&typeof e[0]=="string"&&se.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function ie(e,r){var n=r?E(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var be=/\w*$/;function fe(e){var r=new e.constructor(e.source,be.exec(e));return r.lastIndex=e.lastIndex,r}var w=$?$.prototype:void 0,O=w?w.valueOf:void 0;function ge(e){return O?Object(O.call(e)):{}}var ue="[object Boolean]",ye="[object Date]",Te="[object Map]",le="[object Number]",je="[object RegExp]",pe="[object Set]",Ae="[object String]",me="[object Symbol]",de="[object ArrayBuffer]",Se="[object DataView]",$e="[object Float32Array]",we="[object Float64Array]",Oe="[object Int8Array]",Ie="[object Int16Array]",he="[object Int32Array]",Fe="[object Uint8Array]",Ce="[object Uint8ClampedArray]",Ee="[object Uint16Array]",xe="[object Uint32Array]";function Be(e,r,n){var s=e.constructor;switch(r){case de:return E(e);case ue:case ye:return new s(+e);case Se:return ie(e,n);case $e:case we:case Oe:case Ie:case he:case Fe:case Ce:case Ee:case xe:return K(e,n);case Te:return new s;case le:case Ae:return new s(e);case je:return fe(e);case pe:return new s;case me:return ge(e)}}var Le="[object Map]";function Me(e){return B(e)&&j(e)==Le}var I=u&&u.isMap,Ue=I?x(I):Me,Pe="[object Set]";function De(e){return B(e)&&j(e)==Pe}var h=u&&u.isSet,Ge=h?x(h):De,_e=1,ve=2,Ne=4,M="[object Arguments]",Ke="[object Array]",Re="[object Boolean]",qe="[object Date]",We="[object Error]",U="[object Function]",Ye="[object GeneratorFunction]",He="[object Map]",Je="[object Number]",P="[object Object]",Qe="[object RegExp]",Ve="[object Set]",Xe="[object String]",Ze="[object Symbol]",ze="[object WeakMap]",ke="[object ArrayBuffer]",er="[object DataView]",rr="[object Float32Array]",tr="[object Float64Array]",nr="[object Int8Array]",ar="[object Int16Array]",or="[object Int32Array]",sr="[object Uint8Array]",cr="[object Uint8ClampedArray]",ir="[object Uint16Array]",br="[object Uint32Array]",t={};t[M]=t[Ke]=t[ke]=t[er]=t[Re]=t[qe]=t[rr]=t[tr]=t[nr]=t[ar]=t[or]=t[He]=t[Je]=t[P]=t[Qe]=t[Ve]=t[Xe]=t[Ze]=t[sr]=t[cr]=t[ir]=t[br]=!0;t[We]=t[U]=t[ze]=!1;function T(e,r,n,s,p,c){var a,f=r&_e,g=r&ve,D=r&Ne;if(a!==void 0)return a;if(!Q(e))return e;var A=V(e);if(A){if(a=ce(e),!f)return R(e,a)}else{var b=j(e),m=b==U||b==Ye;if(q(e))return W(e,f);if(b==P||b==M||m&&!p){if(a=g||m?{}:Y(e),!f)return g?ne(e,ee(a,e)):re(e,k(a,e))}else{if(!t[b])return p?e:{};a=Be(e,b,f)}}c||(c=new H);var d=c.get(e);if(d)return d;c.set(e,a),Ge(e)?e.forEach(function(o){a.add(T(o,r,n,o,e,c))}):Ue(e)&&e.forEach(function(o,i){a.set(i,T(o,r,n,i,e,c))});var G=D?g?ae:J:g?l:F,S=A?void 0:G(e);return z(S||e,function(o,i){S&&(i=o,o=e[i]),X(a,i,T(o,r,n,i,e,c))}),a}export{T as b};
|
||||
import{c as y,k as F,a as l,m as C,s as _,g as v,n as N,o as E,h as K,p as j,q as x,r as u,e as R,b as q,f as W,j as Y,S as H,t as J}from"./el-popper-C96qJ_vz.js";import{bv as $,b6 as B,b3 as Q,b9 as V,bw as X}from"./index-CxMsK_Ni.js";import{x as Z}from"./el-input-CNNwOXGP.js";function z(e,r){for(var n=-1,s=e==null?0:e.length;++n<s&&r(e[n],n,e)!==!1;);return e}function k(e,r){return e&&y(r,F(r),e)}function ee(e,r){return e&&y(r,l(r),e)}function re(e,r){return y(e,C(e),r)}var te=Object.getOwnPropertySymbols,L=te?function(e){for(var r=[];e;)Z(r,C(e)),e=v(e);return r}:_;function ne(e,r){return y(e,L(e),r)}function ae(e){return N(e,l,L)}var oe=Object.prototype,se=oe.hasOwnProperty;function ce(e){var r=e.length,n=new e.constructor(r);return r&&typeof e[0]=="string"&&se.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function ie(e,r){var n=r?E(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var be=/\w*$/;function fe(e){var r=new e.constructor(e.source,be.exec(e));return r.lastIndex=e.lastIndex,r}var w=$?$.prototype:void 0,O=w?w.valueOf:void 0;function ge(e){return O?Object(O.call(e)):{}}var ue="[object Boolean]",ye="[object Date]",Te="[object Map]",le="[object Number]",je="[object RegExp]",pe="[object Set]",Ae="[object String]",me="[object Symbol]",de="[object ArrayBuffer]",Se="[object DataView]",$e="[object Float32Array]",we="[object Float64Array]",Oe="[object Int8Array]",Ie="[object Int16Array]",he="[object Int32Array]",Fe="[object Uint8Array]",Ce="[object Uint8ClampedArray]",Ee="[object Uint16Array]",xe="[object Uint32Array]";function Be(e,r,n){var s=e.constructor;switch(r){case de:return E(e);case ue:case ye:return new s(+e);case Se:return ie(e,n);case $e:case we:case Oe:case Ie:case he:case Fe:case Ce:case Ee:case xe:return K(e,n);case Te:return new s;case le:case Ae:return new s(e);case je:return fe(e);case pe:return new s;case me:return ge(e)}}var Le="[object Map]";function Me(e){return B(e)&&j(e)==Le}var I=u&&u.isMap,Ue=I?x(I):Me,Pe="[object Set]";function De(e){return B(e)&&j(e)==Pe}var h=u&&u.isSet,Ge=h?x(h):De,_e=1,ve=2,Ne=4,M="[object Arguments]",Ke="[object Array]",Re="[object Boolean]",qe="[object Date]",We="[object Error]",U="[object Function]",Ye="[object GeneratorFunction]",He="[object Map]",Je="[object Number]",P="[object Object]",Qe="[object RegExp]",Ve="[object Set]",Xe="[object String]",Ze="[object Symbol]",ze="[object WeakMap]",ke="[object ArrayBuffer]",er="[object DataView]",rr="[object Float32Array]",tr="[object Float64Array]",nr="[object Int8Array]",ar="[object Int16Array]",or="[object Int32Array]",sr="[object Uint8Array]",cr="[object Uint8ClampedArray]",ir="[object Uint16Array]",br="[object Uint32Array]",t={};t[M]=t[Ke]=t[ke]=t[er]=t[Re]=t[qe]=t[rr]=t[tr]=t[nr]=t[ar]=t[or]=t[He]=t[Je]=t[P]=t[Qe]=t[Ve]=t[Xe]=t[Ze]=t[sr]=t[cr]=t[ir]=t[br]=!0;t[We]=t[U]=t[ze]=!1;function T(e,r,n,s,p,c){var a,f=r&_e,g=r&ve,D=r&Ne;if(a!==void 0)return a;if(!Q(e))return e;var A=V(e);if(A){if(a=ce(e),!f)return R(e,a)}else{var b=j(e),m=b==U||b==Ye;if(q(e))return W(e,f);if(b==P||b==M||m&&!p){if(a=g||m?{}:Y(e),!f)return g?ne(e,ee(a,e)):re(e,k(a,e))}else{if(!t[b])return p?e:{};a=Be(e,b,f)}}c||(c=new H);var d=c.get(e);if(d)return d;c.set(e,a),Ge(e)?e.forEach(function(o){a.add(T(o,r,n,o,e,c))}):Ue(e)&&e.forEach(function(o,i){a.set(i,T(o,r,n,i,e,c))});var G=D?g?ae:J:g?l:F,S=A?void 0:G(e);return z(S||e,function(o,i){S&&(i=o,o=e[i]),X(a,i,T(o,r,n,i,e,c))}),a}export{T as b};
|
||||
@@ -1 +1 @@
|
||||
import{b as X,d as j,a as F,u as K,P as Y,o as w,Q as W,N as U,h as g,j as o,r as b,U as oe,R as G,n as x,_ as ee,l as ne,an as q,B as V,z as me,aV as ye,a0 as re,aW as pe,a1 as ge,aH as Q,a2 as be,ao as he,i as se,c as T,w as S,g as Z,k as Ce,bq as we,W as Ee,ag as Se,J as ke,E as ie,aQ as te,$ as _,b2 as Te,I as Me,H as Be,D as Ie,aT as $e,br as De,s as k,bs as Le,bt as Pe,aU as ae,F as Ae,aG as Fe,T as Oe,A as Ne,aC as ze,aB as Ye,C as He,p as Re,aK as Ue}from"./index-5orz1M6_.js";import{P as J}from"./vnode-DkiIqzI4.js";import{F as Ve,U as de,t as je,u as le,r as We,e as Xe,a as Ke,j as qe}from"./el-input-D_xPEeA2.js";import{g as Je}from"./el-tag-DsWzxe9q.js";const Ge=X({header:{type:String,default:""},footer:{type:String,default:""},bodyStyle:{type:j([String,Object,Array]),default:""},bodyClass:String,shadow:{type:String,values:["always","hover","never"],default:"always"}}),Qe=F({name:"ElCard"}),Ze=F({...Qe,props:Ge,setup(e){const t=K("card");return(s,c)=>(w(),Y("div",{class:g([o(t).b(),o(t).is(`${s.shadow}-shadow`)])},[s.$slots.header||s.header?(w(),Y("div",{key:0,class:g(o(t).e("header"))},[b(s.$slots,"header",{},()=>[oe(G(s.header),1)])],2)):W("v-if",!0),U("div",{class:g([o(t).e("body"),s.bodyClass]),style:x(s.bodyStyle)},[b(s.$slots,"default")],6),s.$slots.footer||s.footer?(w(),Y("div",{key:1,class:g(o(t).e("footer"))},[b(s.$slots,"footer",{},()=>[oe(G(s.footer),1)])],2)):W("v-if",!0)],2))}});var _e=ee(Ze,[["__file","card.vue"]]);const Eo=ne(_e),ue=e=>{if(!e)return{onClick:q,onMousedown:q,onMouseup:q};let t=!1,s=!1;return{onClick:r=>{t&&s&&e(r),t=s=!1},onMousedown:r=>{t=r.target===r.currentTarget},onMouseup:r=>{s=r.target===r.currentTarget}}},xe=X({mask:{type:Boolean,default:!0},customMaskEvent:Boolean,overlayClass:{type:j([String,Array,Object])},zIndex:{type:j([String,Number])}}),eo={click:e=>e instanceof MouseEvent},oo="overlay";var so=F({name:"ElOverlay",props:xe,emits:eo,setup(e,{slots:t,emit:s}){const c=K(oo),l=n=>{s("click",n)},{onClick:d,onMousedown:r,onMouseup:f}=ue(e.customMaskEvent?void 0:l);return()=>e.mask?V("div",{class:[c.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:d,onMousedown:r,onMouseup:f},[b(t,"default")],J.STYLE|J.CLASS|J.PROPS,["onClick","onMouseup","onMousedown"]):me("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[b(t,"default")])}});const to=so,ce=Symbol("dialogInjectionKey"),fe=X({center:Boolean,alignCenter:Boolean,closeIcon:{type:ye},draggable:Boolean,overflow:Boolean,fullscreen:Boolean,headerClass:String,bodyClass:String,footerClass:String,showClose:{type:Boolean,default:!0},title:{type:String,default:""},ariaLevel:{type:String,default:"2"}}),ao={close:()=>!0},lo=(e,t,s,c)=>{let l={offsetX:0,offsetY:0};const d=u=>{const y=u.clientX,C=u.clientY,{offsetX:h,offsetY:v}=l,m=e.value.getBoundingClientRect(),E=m.left,i=m.top,O=m.width,M=m.height,H=document.documentElement.clientWidth,R=document.documentElement.clientHeight,N=-E+h,B=-i+v,I=H-E-O+h,$=R-i-M+v,D=a=>{let P=h+a.clientX-y,z=v+a.clientY-C;c!=null&&c.value||(P=Math.min(Math.max(P,N),I),z=Math.min(Math.max(z,B),$)),l={offsetX:P,offsetY:z},e.value&&(e.value.style.transform=`translate(${Q(P)}, ${Q(z)})`)},L=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L)};document.addEventListener("mousemove",D),document.addEventListener("mouseup",L)},r=()=>{t.value&&e.value&&t.value.addEventListener("mousedown",d)},f=()=>{t.value&&e.value&&t.value.removeEventListener("mousedown",d)},n=()=>{l={offsetX:0,offsetY:0},e.value&&(e.value.style.transform="none")};return re(()=>{pe(()=>{s.value?r():f()})}),ge(()=>{f()}),{resetPosition:n}},no=(...e)=>t=>{e.forEach(s=>{be(s)?s(t):s.value=t})},ro=F({name:"ElDialogContent"}),io=F({...ro,props:fe,emits:ao,setup(e,{expose:t}){const s=e,{t:c}=he(),{Close:l}=we,{dialogRef:d,headerRef:r,bodyId:f,ns:n,style:u}=se(ce),{focusTrapRef:y}=se(Ve),C=T(()=>[n.b(),n.is("fullscreen",s.fullscreen),n.is("draggable",s.draggable),n.is("align-center",s.alignCenter),{[n.m("center")]:s.center}]),h=no(y,d),v=T(()=>s.draggable),m=T(()=>s.overflow),{resetPosition:E}=lo(d,r,v,m);return t({resetPosition:E}),(i,O)=>(w(),Y("div",{ref:o(h),class:g(o(C)),style:x(o(u)),tabindex:"-1"},[U("header",{ref_key:"headerRef",ref:r,class:g([o(n).e("header"),i.headerClass,{"show-close":i.showClose}])},[b(i.$slots,"header",{},()=>[U("span",{role:"heading","aria-level":i.ariaLevel,class:g(o(n).e("title"))},G(i.title),11,["aria-level"])]),i.showClose?(w(),Y("button",{key:0,"aria-label":o(c)("el.dialog.close"),class:g(o(n).e("headerbtn")),type:"button",onClick:M=>i.$emit("close")},[V(o(Ee),{class:g(o(n).e("close"))},{default:S(()=>[(w(),Z(Ce(i.closeIcon||o(l))))]),_:1},8,["class"])],10,["aria-label","onClick"])):W("v-if",!0)],2),U("div",{id:o(f),class:g([o(n).e("body"),i.bodyClass])},[b(i.$slots,"default")],10,["id"]),i.$slots.footer?(w(),Y("footer",{key:0,class:g([o(n).e("footer"),i.footerClass])},[b(i.$slots,"footer")],2)):W("v-if"Line truncated
|
||||
import{b as X,d as j,a as F,u as K,P as Y,o as w,Q as W,N as U,h as g,j as o,r as b,U as oe,R as G,n as x,_ as ee,l as ne,an as q,B as V,z as me,aV as ye,a0 as re,aW as pe,a1 as ge,aH as Q,a2 as be,ao as he,i as se,c as T,w as S,g as Z,k as Ce,bq as we,W as Ee,ag as Se,J as ke,E as ie,aQ as te,$ as _,b2 as Te,I as Me,H as Be,D as Ie,aT as $e,br as De,s as k,bs as Le,bt as Pe,aU as ae,F as Ae,aG as Fe,T as Oe,A as Ne,aC as ze,aB as Ye,C as He,p as Re,aK as Ue}from"./index-CxMsK_Ni.js";import{P as J}from"./vnode-Cc0RQjVK.js";import{F as Ve,U as de,t as je,u as le,r as We,e as Xe,a as Ke,j as qe}from"./el-input-CNNwOXGP.js";import{g as Je}from"./el-tag-5pOVEKUY.js";const Ge=X({header:{type:String,default:""},footer:{type:String,default:""},bodyStyle:{type:j([String,Object,Array]),default:""},bodyClass:String,shadow:{type:String,values:["always","hover","never"],default:"always"}}),Qe=F({name:"ElCard"}),Ze=F({...Qe,props:Ge,setup(e){const t=K("card");return(s,c)=>(w(),Y("div",{class:g([o(t).b(),o(t).is(`${s.shadow}-shadow`)])},[s.$slots.header||s.header?(w(),Y("div",{key:0,class:g(o(t).e("header"))},[b(s.$slots,"header",{},()=>[oe(G(s.header),1)])],2)):W("v-if",!0),U("div",{class:g([o(t).e("body"),s.bodyClass]),style:x(s.bodyStyle)},[b(s.$slots,"default")],6),s.$slots.footer||s.footer?(w(),Y("div",{key:1,class:g(o(t).e("footer"))},[b(s.$slots,"footer",{},()=>[oe(G(s.footer),1)])],2)):W("v-if",!0)],2))}});var _e=ee(Ze,[["__file","card.vue"]]);const Eo=ne(_e),ue=e=>{if(!e)return{onClick:q,onMousedown:q,onMouseup:q};let t=!1,s=!1;return{onClick:r=>{t&&s&&e(r),t=s=!1},onMousedown:r=>{t=r.target===r.currentTarget},onMouseup:r=>{s=r.target===r.currentTarget}}},xe=X({mask:{type:Boolean,default:!0},customMaskEvent:Boolean,overlayClass:{type:j([String,Array,Object])},zIndex:{type:j([String,Number])}}),eo={click:e=>e instanceof MouseEvent},oo="overlay";var so=F({name:"ElOverlay",props:xe,emits:eo,setup(e,{slots:t,emit:s}){const c=K(oo),l=n=>{s("click",n)},{onClick:d,onMousedown:r,onMouseup:f}=ue(e.customMaskEvent?void 0:l);return()=>e.mask?V("div",{class:[c.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:d,onMousedown:r,onMouseup:f},[b(t,"default")],J.STYLE|J.CLASS|J.PROPS,["onClick","onMouseup","onMousedown"]):me("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[b(t,"default")])}});const to=so,ce=Symbol("dialogInjectionKey"),fe=X({center:Boolean,alignCenter:Boolean,closeIcon:{type:ye},draggable:Boolean,overflow:Boolean,fullscreen:Boolean,headerClass:String,bodyClass:String,footerClass:String,showClose:{type:Boolean,default:!0},title:{type:String,default:""},ariaLevel:{type:String,default:"2"}}),ao={close:()=>!0},lo=(e,t,s,c)=>{let l={offsetX:0,offsetY:0};const d=u=>{const y=u.clientX,C=u.clientY,{offsetX:h,offsetY:v}=l,m=e.value.getBoundingClientRect(),E=m.left,i=m.top,O=m.width,M=m.height,H=document.documentElement.clientWidth,R=document.documentElement.clientHeight,N=-E+h,B=-i+v,I=H-E-O+h,$=R-i-M+v,D=a=>{let P=h+a.clientX-y,z=v+a.clientY-C;c!=null&&c.value||(P=Math.min(Math.max(P,N),I),z=Math.min(Math.max(z,B),$)),l={offsetX:P,offsetY:z},e.value&&(e.value.style.transform=`translate(${Q(P)}, ${Q(z)})`)},L=()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L)};document.addEventListener("mousemove",D),document.addEventListener("mouseup",L)},r=()=>{t.value&&e.value&&t.value.addEventListener("mousedown",d)},f=()=>{t.value&&e.value&&t.value.removeEventListener("mousedown",d)},n=()=>{l={offsetX:0,offsetY:0},e.value&&(e.value.style.transform="none")};return re(()=>{pe(()=>{s.value?r():f()})}),ge(()=>{f()}),{resetPosition:n}},no=(...e)=>t=>{e.forEach(s=>{be(s)?s(t):s.value=t})},ro=F({name:"ElDialogContent"}),io=F({...ro,props:fe,emits:ao,setup(e,{expose:t}){const s=e,{t:c}=he(),{Close:l}=we,{dialogRef:d,headerRef:r,bodyId:f,ns:n,style:u}=se(ce),{focusTrapRef:y}=se(Ve),C=T(()=>[n.b(),n.is("fullscreen",s.fullscreen),n.is("draggable",s.draggable),n.is("align-center",s.alignCenter),{[n.m("center")]:s.center}]),h=no(y,d),v=T(()=>s.draggable),m=T(()=>s.overflow),{resetPosition:E}=lo(d,r,v,m);return t({resetPosition:E}),(i,O)=>(w(),Y("div",{ref:o(h),class:g(o(C)),style:x(o(u)),tabindex:"-1"},[U("header",{ref_key:"headerRef",ref:r,class:g([o(n).e("header"),i.headerClass,{"show-close":i.showClose}])},[b(i.$slots,"header",{},()=>[U("span",{role:"heading","aria-level":i.ariaLevel,class:g(o(n).e("title"))},G(i.title),11,["aria-level"])]),i.showClose?(w(),Y("button",{key:0,"aria-label":o(c)("el.dialog.close"),class:g(o(n).e("headerbtn")),type:"button",onClick:M=>i.$emit("close")},[V(o(Ee),{class:g(o(n).e("close"))},{default:S(()=>[(w(),Z(Ce(i.closeIcon||o(l))))]),_:1},8,["class"])],10,["aria-label","onClick"])):W("v-if",!0)],2),U("div",{id:o(f),class:g([o(n).e("body"),i.bodyClass])},[b(i.$slots,"default")],10,["id"]),i.$slots.footer?(w(),Y("footer",{key:0,class:g([o(n).e("footer"),i.footerClass])},[b(i.$slots,"footer")],2)):W("v-if"Line truncated
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as Ie,v as we,i as st,t as ot,w as ue,u as ft}from"./el-input-D_xPEeA2.js";import{al as Be,G as de,ag as Te,b as Fe,d as ce,q as Ce,s as I,c as O,_ as De,a as Y,u as qe,$ as te,p as ze,t as Ue,x as Ge,P as Je,o as pe,r as X,h as U,j as x,a2 as Ke,i as re,a0 as Ye,a1 as Ze,aL as lt,aY as ut,B as ne,ab as dt,F as He,aG as ct,bu as pt,aH as _e,bj as oe,N as Pe,w as fe,g as vt,Q as Ae,k as mt,n as Se,U as ht,R as je,av as gt,ak as yt,l as bt}from"./index-5orz1M6_.js";import{l as ve}from"./el-popper-DxfKqvb2.js";import{b as wt}from"./_baseClone-IT_4yc7W.js";var Ft=4;function Re(i){return wt(i,Ft)}const qt=Fe({size:{type:String,values:Ce},disabled:Boolean}),xt=Fe({...qt,model:Object,rules:{type:ce(Object)},labelPosition:{type:String,values:["left","right","top"],default:"right"},requireAsteriskPosition:{type:String,values:["left","right"],default:"left"},labelWidth:{type:[String,Number],default:""},labelSuffix:{type:String,default:""},inline:Boolean,inlineMessage:Boolean,statusIcon:Boolean,showMessage:{type:Boolean,default:!0},validateOnRuleChange:{type:Boolean,default:!0},hideRequiredAsterisk:Boolean,scrollToError:Boolean,scrollIntoViewOptions:{type:[Object,Boolean]}}),Ot={validate:(i,e,t)=>(Be(i)||de(i))&&Te(e)&&de(t)};function Et(){const i=I([]),e=O(()=>{if(!i.value.length)return"0";const s=Math.max(...i.value);return s?`${s}px`:""});function t(s){const a=i.value.indexOf(s);return a===-1&&e.value,a}function n(s,a){if(s&&a){const o=t(a);i.value.splice(o,1,s)}else s&&i.value.push(s)}function r(s){const a=t(s);a>-1&&i.value.splice(a,1)}return{autoLabelWidth:e,registerLabelWidth:n,deregisterLabelWidth:r}}const Q=(i,e)=>{const t=ve(e);return t.length>0?i.filter(n=>n.prop&&t.includes(n.prop)):i},_t="ElForm",Pt=Y({name:_t}),At=Y({...Pt,props:xt,emits:Ot,setup(i,{expose:e,emit:t}){const n=i,r=[],s=Ie(),a=qe("form"),o=O(()=>{const{labelPosition:f,inline:c}=n;return[a.b(),a.m(s.value||"default"),{[a.m(`label-${f}`)]:f,[a.m("inline")]:c}]}),u=f=>r.find(c=>c.prop===f),b=f=>{r.push(f)},v=f=>{f.prop&&r.splice(r.indexOf(f),1)},h=(f=[])=>{n.model&&Q(r,f).forEach(c=>c.resetField())},y=(f=[])=>{Q(r,f).forEach(c=>c.clearValidate())},E=O(()=>!!n.model),P=f=>{if(r.length===0)return[];const c=Q(r,f);return c.length?c:[]},d=async f=>l(void 0,f),g=async(f=[])=>{if(!E.value)return!1;const c=P(f);if(c.length===0)return!0;let q={};for(const w of c)try{await w.validate(""),w.validateState==="error"&&w.resetField()}catch(S){q={...q,...S}}return Object.keys(q).length===0?!0:Promise.reject(q)},l=async(f=[],c)=>{const q=!Ke(c);try{const w=await g(f);return w===!0&&await(c==null?void 0:c(w)),w}catch(w){if(w instanceof Error)throw w;const S=w;return n.scrollToError&&R(Object.keys(S)[0]),await(c==null?void 0:c(!1,S)),q&&Promise.reject(S)}},R=f=>{var c;const q=Q(r,f)[0];q&&((c=q.$el)==null||c.scrollIntoView(n.scrollIntoViewOptions))};return te(()=>n.rules,()=>{n.validateOnRuleChange&&d().catch(f=>st())},{deep:!0,flush:"post"}),ze(we,Ue({...Ge(n),emit:t,resetFields:h,clearValidate:y,validateField:l,getField:u,addField:b,removeField:v,...Et()})),e({validate:d,validateField:l,resetFields:h,clearValidate:y,scrollToField:R,fields:r}),(f,c)=>(pe(),Je("form",{class:U(x(o))},[X(f.$slots,"default")],2))}});var St=De(At,[["__file","form.vue"]]);function B(){return B=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},B.apply(this,arguments)}function jt(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,K(i,e)}function me(i){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(i)}function K(i,e){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},K(i,e)}function Rt(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ee(i,e,t){return Rt()?ee=Reflect.construct.bind():ee=function(r,s,a){var o=[null];o.push.apply(o,s);var u=Function.bind.apply(r,o),b=new u;return a&&K(b,a.prototype),b},ee.apply(null,arguments)}function Nt(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function he(i){var e=typeof Map=="function"?new Map:void 0;return he=function(n){if(n===null||!Nt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return ee(n,arguments,me(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),K(r,n)},he(i)}var Mt=/%[sdj%]/g,Vt=function(){};function ge(i){if(!i||!i.length)return null;var e={};return i.forEach(function(t){var n=t.field;e[n]=e[n]||[],e[n].push(t)}),e}function V(i){for(var e=arguments.leLine truncated
|
||||
import{c as Ie,v as we,i as st,t as ot,w as ue,u as ft}from"./el-input-CNNwOXGP.js";import{al as Be,G as de,ag as Te,b as Fe,d as ce,q as Ce,s as I,c as O,_ as De,a as Y,u as qe,$ as te,p as ze,t as Ue,x as Ge,P as Je,o as pe,r as X,h as U,j as x,a2 as Ke,i as re,a0 as Ye,a1 as Ze,aL as lt,aY as ut,B as ne,ab as dt,F as He,aG as ct,bu as pt,aH as _e,bj as oe,N as Pe,w as fe,g as vt,Q as Ae,k as mt,n as Se,U as ht,R as je,av as gt,ak as yt,l as bt}from"./index-CxMsK_Ni.js";import{l as ve}from"./el-popper-C96qJ_vz.js";import{b as wt}from"./_baseClone-DD6IrDYX.js";var Ft=4;function Re(i){return wt(i,Ft)}const qt=Fe({size:{type:String,values:Ce},disabled:Boolean}),xt=Fe({...qt,model:Object,rules:{type:ce(Object)},labelPosition:{type:String,values:["left","right","top"],default:"right"},requireAsteriskPosition:{type:String,values:["left","right"],default:"left"},labelWidth:{type:[String,Number],default:""},labelSuffix:{type:String,default:""},inline:Boolean,inlineMessage:Boolean,statusIcon:Boolean,showMessage:{type:Boolean,default:!0},validateOnRuleChange:{type:Boolean,default:!0},hideRequiredAsterisk:Boolean,scrollToError:Boolean,scrollIntoViewOptions:{type:[Object,Boolean]}}),Ot={validate:(i,e,t)=>(Be(i)||de(i))&&Te(e)&&de(t)};function Et(){const i=I([]),e=O(()=>{if(!i.value.length)return"0";const s=Math.max(...i.value);return s?`${s}px`:""});function t(s){const a=i.value.indexOf(s);return a===-1&&e.value,a}function n(s,a){if(s&&a){const o=t(a);i.value.splice(o,1,s)}else s&&i.value.push(s)}function r(s){const a=t(s);a>-1&&i.value.splice(a,1)}return{autoLabelWidth:e,registerLabelWidth:n,deregisterLabelWidth:r}}const Q=(i,e)=>{const t=ve(e);return t.length>0?i.filter(n=>n.prop&&t.includes(n.prop)):i},_t="ElForm",Pt=Y({name:_t}),At=Y({...Pt,props:xt,emits:Ot,setup(i,{expose:e,emit:t}){const n=i,r=[],s=Ie(),a=qe("form"),o=O(()=>{const{labelPosition:f,inline:c}=n;return[a.b(),a.m(s.value||"default"),{[a.m(`label-${f}`)]:f,[a.m("inline")]:c}]}),u=f=>r.find(c=>c.prop===f),b=f=>{r.push(f)},v=f=>{f.prop&&r.splice(r.indexOf(f),1)},h=(f=[])=>{n.model&&Q(r,f).forEach(c=>c.resetField())},y=(f=[])=>{Q(r,f).forEach(c=>c.clearValidate())},E=O(()=>!!n.model),P=f=>{if(r.length===0)return[];const c=Q(r,f);return c.length?c:[]},d=async f=>l(void 0,f),g=async(f=[])=>{if(!E.value)return!1;const c=P(f);if(c.length===0)return!0;let q={};for(const w of c)try{await w.validate(""),w.validateState==="error"&&w.resetField()}catch(S){q={...q,...S}}return Object.keys(q).length===0?!0:Promise.reject(q)},l=async(f=[],c)=>{const q=!Ke(c);try{const w=await g(f);return w===!0&&await(c==null?void 0:c(w)),w}catch(w){if(w instanceof Error)throw w;const S=w;return n.scrollToError&&R(Object.keys(S)[0]),await(c==null?void 0:c(!1,S)),q&&Promise.reject(S)}},R=f=>{var c;const q=Q(r,f)[0];q&&((c=q.$el)==null||c.scrollIntoView(n.scrollIntoViewOptions))};return te(()=>n.rules,()=>{n.validateOnRuleChange&&d().catch(f=>st())},{deep:!0,flush:"post"}),ze(we,Ue({...Ge(n),emit:t,resetFields:h,clearValidate:y,validateField:l,getField:u,addField:b,removeField:v,...Et()})),e({validate:d,validateField:l,resetFields:h,clearValidate:y,scrollToField:R,fields:r}),(f,c)=>(pe(),Je("form",{class:U(x(o))},[X(f.$slots,"default")],2))}});var St=De(At,[["__file","form.vue"]]);function B(){return B=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},B.apply(this,arguments)}function jt(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,K(i,e)}function me(i){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(i)}function K(i,e){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},K(i,e)}function Rt(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ee(i,e,t){return Rt()?ee=Reflect.construct.bind():ee=function(r,s,a){var o=[null];o.push.apply(o,s);var u=Function.bind.apply(r,o),b=new u;return a&&K(b,a.prototype),b},ee.apply(null,arguments)}function Nt(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function he(i){var e=typeof Map=="function"?new Map:void 0;return he=function(n){if(n===null||!Nt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return ee(n,arguments,me(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),K(r,n)},he(i)}var Mt=/%[sdj%]/g,Vt=function(){};function ge(i){if(!i||!i.length)return null;var e={};return i.forEach(function(t){var n=t.field;e[n]=e[n]||[],e[n].push(t)}),e}function V(i){for(var e=arguments.leLine truncated
|
||||
(?:
|
||||
(?:`+n+":){7}(?:"+n+`|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
||||
(?:`+n+":){6}(?:"+t+"|:"+n+`|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
||||
@@ -1 +1 @@
|
||||
import{bZ as it,b6 as _t,b7 as un,bv as ut,b9 as Mt,b_ as Rt,bA as ln,b4 as cn,bB as fn,b$ as dn,E as we,e as lt,b as Te,G as ye,m as pn,d as ue,aV as xe,ah as Nt,c as h,bT as vn,aT as Ie,bW as hn,c0 as bn,i as J,j as l,s as P,a0 as ce,$ as H,aA as ke,aD as gn,bh as mn,aw as Ee,bo as Me,a2 as ct,F as U,_ as fe,a as G,c1 as yn,aG as Bt,u as le,bF as En,c2 as Sn,c3 as wn,am as Ht,aY as xn,P as M,o as g,Q as x,ab as Se,N as te,h as k,r as N,g as F,w as D,k as Y,W as q,aC as Le,B as kn,aJ as Tn,O as In,an as Fn,R as pe,n as ft,f as dt,l as Ue,a1 as De,a6 as pt,L as Ot,p as Lt,c4 as Cn,bs as An,bR as Pn,Y as _n,t as Mn,ak as Rn}from"./index-5orz1M6_.js";function Nn(e){return e}function Bn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Hn=800,On=16,Ln=Date.now;function $n(e){var t=0,n=0;return function(){var a=Ln(),o=On-(a-n);if(n=a,o>0){if(++t>=Hn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Vn(e){return function(){return e}}var zn=it?function(e,t){return it(e,"toString",{configurable:!0,enumerable:!1,value:Vn(t),writable:!0})}:Nn,Un=$n(zn),vt=Math.max;function Dn(e,t,n){return t=vt(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,r=vt(a.length-t,0),s=Array(r);++o<r;)s[o]=a[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=a[o];return u[t]=n(s),Bn(e,this,u)}}var Kn=9007199254740991;function Gn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Kn}var Wn="[object Arguments]";function ht(e){return _t(e)&&un(e)==Wn}var $t=Object.prototype,jn=$t.hasOwnProperty,qn=$t.propertyIsEnumerable,Vt=ht(function(){return arguments}())?ht:function(e){return _t(e)&&jn.call(e,"callee")&&!qn.call(e,"callee")};function Yn(e,t){for(var n=-1,a=t.length,o=e.length;++n<a;)e[o+n]=t[n];return e}var bt=ut?ut.isConcatSpreadable:void 0;function Xn(e){return Mt(e)||Vt(e)||!!(bt&&e&&e[bt])}function Jn(e,t,n,a,o){var r=-1,s=e.length;for(n||(n=Xn),o||(o=[]);++r<s;){var u=e[r];n(u)?Yn(o,u):o[o.length]=u}return o}function Zn(e){var t=e==null?0:e.length;return t?Jn(e):[]}function Qn(e){return Un(Dn(e,void 0,Zn),e+"")}function ea(e,t){return e!=null&&t in Object(e)}function ta(e,t,n){t=Rt(t,e);for(var a=-1,o=t.length,r=!1;++a<o;){var s=ln(t[a]);if(!(r=e!=null&&n(e,s)))break;e=e[s]}return r||++a!=o?r:(o=e==null?0:e.length,!!o&&Gn(o)&&cn(s,o)&&(Mt(e)||Vt(e)))}function na(e,t){return e!=null&&ta(e,t,ea)}function So(e){return e===void 0}function aa(e,t,n){for(var a=-1,o=t.length,r={};++a<o;){var s=t[a],u=fn(e,s);n(u,s)&&dn(r,Rt(s,e),u)}return r}function oa(e,t){return aa(e,t,function(n,a){return na(e,a)})}var ra=Qn(function(e,t){return e==null?{}:oa(e,t)});class sa extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function wo(e,t){throw new sa(`[${e}] ${t}`)}function xo(e,t){}const $e="update:modelValue",ko="change",ia=()=>we&&/firefox/i.test(window.navigator.userAgent);let A;const ua={height:"0",visibility:"hidden",overflow:ia()?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},la=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function ca(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),a=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),o=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width"));return{contextStyle:la.map(s=>[s,t.getPropertyValue(s)]),paddingSize:a,borderSize:o,boxSizing:n}}function gt(e,t=1,n){var a;A||(A=document.createElement("textarea"),document.body.appendChild(A));const{paddingSize:o,borderSize:r,boxSizing:s,contextStyle:u}=ca(e);u.forEach(([b,m])=>A==null?void 0:A.style.setProperty(b,m)),Object.entries(ua).forEach(([b,m])=>A==null?void 0:A.style.setProperty(b,m,"important")),A.value=e.value||e.placeholder||"";let f=A.scrollHeight;const p={};s==="border-box"?f=f+r:s==="content-box"&&(f=f-o),A.value="";const d=A.scrollHeight-o;if(lt(t)){let b=d*t;s==="border-box"&&(b=b+o+r),f=Math.max(b,f),p.minHeight=`${b}px`}if(lt(n)){let b=d*n;s==="border-box"&&(b=b+o+r),f=Math.min(b,f)}return p.height=`${f}px`,(a=A.parentNode)==null||a.removeChild(A),A=void 0,p}const fa=Te({ariaLabel:String,ariaOrientation:{type:String,values:["horizontal","vertical","undefined"]},ariaControls:String}),da=e=>ra(fa,e),pa=Te({id:{type:String,default:void 0},size:Nt,disabled:Boolean,modelValue:{type:ue([String,Number,Object]),default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:ue([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:StriLine truncated
|
||||
import{bZ as it,b6 as _t,b7 as un,bv as ut,b9 as Mt,b_ as Rt,bA as ln,b4 as cn,bB as fn,b$ as dn,E as we,e as lt,b as Te,G as ye,m as pn,d as ue,aV as xe,ah as Nt,c as h,bT as vn,aT as Ie,bW as hn,c0 as bn,i as J,j as l,s as P,a0 as ce,$ as H,aA as ke,aD as gn,bh as mn,aw as Ee,bo as Me,a2 as ct,F as U,_ as fe,a as G,c1 as yn,aG as Bt,u as le,bF as En,c2 as Sn,c3 as wn,am as Ht,aY as xn,P as M,o as g,Q as x,ab as Se,N as te,h as k,r as N,g as F,w as D,k as Y,W as q,aC as Le,B as kn,aJ as Tn,O as In,an as Fn,R as pe,n as ft,f as dt,l as Ue,a1 as De,a6 as pt,L as Ot,p as Lt,c4 as Cn,bs as An,bR as Pn,Y as _n,t as Mn,ak as Rn}from"./index-CxMsK_Ni.js";function Nn(e){return e}function Bn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Hn=800,On=16,Ln=Date.now;function $n(e){var t=0,n=0;return function(){var a=Ln(),o=On-(a-n);if(n=a,o>0){if(++t>=Hn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Vn(e){return function(){return e}}var zn=it?function(e,t){return it(e,"toString",{configurable:!0,enumerable:!1,value:Vn(t),writable:!0})}:Nn,Un=$n(zn),vt=Math.max;function Dn(e,t,n){return t=vt(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,r=vt(a.length-t,0),s=Array(r);++o<r;)s[o]=a[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=a[o];return u[t]=n(s),Bn(e,this,u)}}var Kn=9007199254740991;function Gn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Kn}var Wn="[object Arguments]";function ht(e){return _t(e)&&un(e)==Wn}var $t=Object.prototype,jn=$t.hasOwnProperty,qn=$t.propertyIsEnumerable,Vt=ht(function(){return arguments}())?ht:function(e){return _t(e)&&jn.call(e,"callee")&&!qn.call(e,"callee")};function Yn(e,t){for(var n=-1,a=t.length,o=e.length;++n<a;)e[o+n]=t[n];return e}var bt=ut?ut.isConcatSpreadable:void 0;function Xn(e){return Mt(e)||Vt(e)||!!(bt&&e&&e[bt])}function Jn(e,t,n,a,o){var r=-1,s=e.length;for(n||(n=Xn),o||(o=[]);++r<s;){var u=e[r];n(u)?Yn(o,u):o[o.length]=u}return o}function Zn(e){var t=e==null?0:e.length;return t?Jn(e):[]}function Qn(e){return Un(Dn(e,void 0,Zn),e+"")}function ea(e,t){return e!=null&&t in Object(e)}function ta(e,t,n){t=Rt(t,e);for(var a=-1,o=t.length,r=!1;++a<o;){var s=ln(t[a]);if(!(r=e!=null&&n(e,s)))break;e=e[s]}return r||++a!=o?r:(o=e==null?0:e.length,!!o&&Gn(o)&&cn(s,o)&&(Mt(e)||Vt(e)))}function na(e,t){return e!=null&&ta(e,t,ea)}function So(e){return e===void 0}function aa(e,t,n){for(var a=-1,o=t.length,r={};++a<o;){var s=t[a],u=fn(e,s);n(u,s)&&dn(r,Rt(s,e),u)}return r}function oa(e,t){return aa(e,t,function(n,a){return na(e,a)})}var ra=Qn(function(e,t){return e==null?{}:oa(e,t)});class sa extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function wo(e,t){throw new sa(`[${e}] ${t}`)}function xo(e,t){}const $e="update:modelValue",ko="change",ia=()=>we&&/firefox/i.test(window.navigator.userAgent);let A;const ua={height:"0",visibility:"hidden",overflow:ia()?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},la=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function ca(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),a=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),o=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width"));return{contextStyle:la.map(s=>[s,t.getPropertyValue(s)]),paddingSize:a,borderSize:o,boxSizing:n}}function gt(e,t=1,n){var a;A||(A=document.createElement("textarea"),document.body.appendChild(A));const{paddingSize:o,borderSize:r,boxSizing:s,contextStyle:u}=ca(e);u.forEach(([b,m])=>A==null?void 0:A.style.setProperty(b,m)),Object.entries(ua).forEach(([b,m])=>A==null?void 0:A.style.setProperty(b,m,"important")),A.value=e.value||e.placeholder||"";let f=A.scrollHeight;const p={};s==="border-box"?f=f+r:s==="content-box"&&(f=f-o),A.value="";const d=A.scrollHeight-o;if(lt(t)){let b=d*t;s==="border-box"&&(b=b+o+r),f=Math.max(b,f),p.minHeight=`${b}px`}if(lt(n)){let b=d*n;s==="border-box"&&(b=b+o+r),f=Math.min(b,f)}return p.height=`${f}px`,(a=A.parentNode)==null||a.removeChild(A),A=void 0,p}const fa=Te({ariaLabel:String,ariaOrientation:{type:String,values:["horizontal","vertical","undefined"]},ariaControls:String}),da=e=>ra(fa,e),pa=Te({id:{type:String,default:void 0},size:Nt,disabled:Boolean,modelValue:{type:ue([String,Number,Object]),default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:ue([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:StriLine truncated
|
||||
@@ -1 +1 @@
|
||||
import{bL as Ye,bC as le,b3 as vn,b8 as ar,bw as sr,ba as ir,b6 as ur,b7 as pt,bM as lr,b4 as cr,b9 as dt,bN as vt,bO as Ve,by as fr,bP as Ae,b as ne,_ as ce,a as N,s as F,c as P,r as ue,p as Me,u as ke,i as fe,$ as L,a1 as $e,P as Ge,o as Z,n as pr,h as gn,j as f,d as _,an as at,A as mn,bQ as dr,f as vr,ab as gr,bR as mr,bp as hr,B as Be,a0 as Xe,a6 as me,g as be,Q as Ze,w as ee,aC as gt,bS as hn,am as bn,E as he,aw as br,bT as $t,br as yr,e as st,l as yn,bU as wr,L as rt,bV as wn,aT as Or,a2 as ze,ag as On,al as Tn,aA as Re,bn as Tr,bW as Er,T as Ar,C as Cr,bX as xr,a_ as Pr,bY as Rr,R as Sr}from"./index-5orz1M6_.js";import{B as En,n as jr,x as _r,D as Lt,f as An,r as Mr,w as Dt,a as Br,G as Ir,j as Fr,H as kr,u as $r}from"./el-input-D_xPEeA2.js";var it=Ye(le,"WeakMap"),Nt=Object.create,Lr=function(){function e(){}return function(t){if(!vn(t))return{};if(Nt)return Nt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function ti(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function ni(e,t,n,r){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=void 0;u===void 0&&(u=e[l]),o?ar(n,l,u):sr(n,l,u)}return n}function Cn(e){return e!=null&&En(e.length)&&!ir(e)}var Dr=Object.prototype;function mt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Dr;return e===n}function Nr(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Hr(){return!1}var xn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ht=xn&&typeof module=="object"&&module&&!module.nodeType&&module,Wr=Ht&&Ht.exports===xn,Wt=Wr?le.Buffer:void 0,Ur=Wt?Wt.isBuffer:void 0,zr=Ur||Hr,Kr="[object Arguments]",qr="[object Array]",Vr="[object Boolean]",Gr="[object Date]",Zr="[object Error]",Jr="[object Function]",Yr="[object Map]",Xr="[object Number]",Qr="[object Object]",eo="[object RegExp]",to="[object Set]",no="[object String]",ro="[object WeakMap]",oo="[object ArrayBuffer]",ao="[object DataView]",so="[object Float32Array]",io="[object Float64Array]",uo="[object Int8Array]",lo="[object Int16Array]",co="[object Int32Array]",fo="[object Uint8Array]",po="[object Uint8ClampedArray]",vo="[object Uint16Array]",go="[object Uint32Array]",R={};R[so]=R[io]=R[uo]=R[lo]=R[co]=R[fo]=R[po]=R[vo]=R[go]=!0;R[Kr]=R[qr]=R[oo]=R[Vr]=R[ao]=R[Gr]=R[Zr]=R[Jr]=R[Yr]=R[Xr]=R[Qr]=R[eo]=R[to]=R[no]=R[ro]=!1;function mo(e){return ur(e)&&En(e.length)&&!!R[pt(e)]}function ho(e){return function(t){return e(t)}}var Pn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=Pn&&typeof module=="object"&&module&&!module.nodeType&&module,bo=Se&&Se.exports===Pn,ot=bo&&lr.process,Ut=function(){try{var e=Se&&Se.require&&Se.require("util").types;return e||ot&&ot.binding&&ot.binding("util")}catch{}}(),zt=Ut&&Ut.isTypedArray,yo=zt?ho(zt):mo,wo=Object.prototype,Oo=wo.hasOwnProperty;function Rn(e,t){var n=dt(e),r=!n&&jr(e),o=!n&&!r&&zr(e),a=!n&&!r&&!o&&yo(e),s=n||r||o||a,l=s?Nr(e.length,String):[],u=l.length;for(var i in e)(t||Oo.call(e,i))&&!(s&&(i=="length"||o&&(i=="offset"||i=="parent")||a&&(i=="buffer"||i=="byteLength"||i=="byteOffset")||cr(i,u)))&&l.push(i);return l}function Sn(e,t){return function(n){return e(t(n))}}var To=Sn(Object.keys,Object),Eo=Object.prototype,Ao=Eo.hasOwnProperty;function Co(e){if(!mt(e))return To(e);var t=[];for(var n in Object(e))Ao.call(e,n)&&n!="constructor"&&t.push(n);return t}function xo(e){return Cn(e)?Rn(e):Co(e)}function Po(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Ro=Object.prototype,So=Ro.hasOwnProperty;function jo(e){if(!vn(e))return Po(e);var t=mt(e),n=[];for(var r in e)r=="constructor"&&(t||!So.call(e,r))||n.push(r);return n}function ri(e){return Cn(e)?Rn(e,!0):jo(e)}var _o=Sn(Object.getPrototypeOf,Object);function oi(){if(!arguments.length)return[];var e=arguments[0];return dt(e)?e:[e]}function Mo(){this.__data__=new vt,this.size=0}function Bo(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Io(e){return this.__data__.get(e)}function Fo(e){return this.__data__.has(e)}var ko=200;function $o(e,t){var n=this.__data__;if(n instanceof vt){var r=n.__data__;if(!Ve||r.length<ko-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fr(r)}return n.set(e,t),this.size=n.size,this}function Le(e){var t=this.__data__=new vt(e);this.size=t.size}Le.prototype.clear=Mo;Le.prototype.delete=Bo;Le.prototype.get=Io;Le.prototype.has=Fo;Le.prototype.set=$o;var jn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kt=jn&&typeof module=="object"&&module&&!module.nodeType&&module,Lo=Kt&&Kt.exports===jn,qt=Lo?le.Buffer:void 0,Vt=qt?qt.allocUnsafe:void 0;function ai(e,t){if(t)return e.slice();var n=e.length,r=Vt?Vt(n):new e.constructor(n);return e.copy(r),r}function Do(e,t){for(var n=-1,r=e==null?0:e.length,o=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[o++]=s)}return a}function No(){return[]}var Ho=Object.prototype,Wo=Ho.propertyIsEnumerable,Gt=Object.getOwnPropertySymbols,Uo=Gt?function(e){return e==null?[]:(e=Object(e),Do(Gt(eLine truncated
|
||||
import{bL as Ye,bC as le,b3 as vn,b8 as ar,bw as sr,ba as ir,b6 as ur,b7 as pt,bM as lr,b4 as cr,b9 as dt,bN as vt,bO as Ve,by as fr,bP as Ae,b as ne,_ as ce,a as N,s as F,c as P,r as ue,p as Me,u as ke,i as fe,$ as L,a1 as $e,P as Ge,o as Z,n as pr,h as gn,j as f,d as _,an as at,A as mn,bQ as dr,f as vr,ab as gr,bR as mr,bp as hr,B as Be,a0 as Xe,a6 as me,g as be,Q as Ze,w as ee,aC as gt,bS as hn,am as bn,E as he,aw as br,bT as $t,br as yr,e as st,l as yn,bU as wr,L as rt,bV as wn,aT as Or,a2 as ze,ag as On,al as Tn,aA as Re,bn as Tr,bW as Er,T as Ar,C as Cr,bX as xr,a_ as Pr,bY as Rr,R as Sr}from"./index-CxMsK_Ni.js";import{B as En,n as jr,x as _r,D as Lt,f as An,r as Mr,w as Dt,a as Br,G as Ir,j as Fr,H as kr,u as $r}from"./el-input-CNNwOXGP.js";var it=Ye(le,"WeakMap"),Nt=Object.create,Lr=function(){function e(){}return function(t){if(!vn(t))return{};if(Nt)return Nt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function ti(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function ni(e,t,n,r){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=void 0;u===void 0&&(u=e[l]),o?ar(n,l,u):sr(n,l,u)}return n}function Cn(e){return e!=null&&En(e.length)&&!ir(e)}var Dr=Object.prototype;function mt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Dr;return e===n}function Nr(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Hr(){return!1}var xn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ht=xn&&typeof module=="object"&&module&&!module.nodeType&&module,Wr=Ht&&Ht.exports===xn,Wt=Wr?le.Buffer:void 0,Ur=Wt?Wt.isBuffer:void 0,zr=Ur||Hr,Kr="[object Arguments]",qr="[object Array]",Vr="[object Boolean]",Gr="[object Date]",Zr="[object Error]",Jr="[object Function]",Yr="[object Map]",Xr="[object Number]",Qr="[object Object]",eo="[object RegExp]",to="[object Set]",no="[object String]",ro="[object WeakMap]",oo="[object ArrayBuffer]",ao="[object DataView]",so="[object Float32Array]",io="[object Float64Array]",uo="[object Int8Array]",lo="[object Int16Array]",co="[object Int32Array]",fo="[object Uint8Array]",po="[object Uint8ClampedArray]",vo="[object Uint16Array]",go="[object Uint32Array]",R={};R[so]=R[io]=R[uo]=R[lo]=R[co]=R[fo]=R[po]=R[vo]=R[go]=!0;R[Kr]=R[qr]=R[oo]=R[Vr]=R[ao]=R[Gr]=R[Zr]=R[Jr]=R[Yr]=R[Xr]=R[Qr]=R[eo]=R[to]=R[no]=R[ro]=!1;function mo(e){return ur(e)&&En(e.length)&&!!R[pt(e)]}function ho(e){return function(t){return e(t)}}var Pn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=Pn&&typeof module=="object"&&module&&!module.nodeType&&module,bo=Se&&Se.exports===Pn,ot=bo&&lr.process,Ut=function(){try{var e=Se&&Se.require&&Se.require("util").types;return e||ot&&ot.binding&&ot.binding("util")}catch{}}(),zt=Ut&&Ut.isTypedArray,yo=zt?ho(zt):mo,wo=Object.prototype,Oo=wo.hasOwnProperty;function Rn(e,t){var n=dt(e),r=!n&&jr(e),o=!n&&!r&&zr(e),a=!n&&!r&&!o&&yo(e),s=n||r||o||a,l=s?Nr(e.length,String):[],u=l.length;for(var i in e)(t||Oo.call(e,i))&&!(s&&(i=="length"||o&&(i=="offset"||i=="parent")||a&&(i=="buffer"||i=="byteLength"||i=="byteOffset")||cr(i,u)))&&l.push(i);return l}function Sn(e,t){return function(n){return e(t(n))}}var To=Sn(Object.keys,Object),Eo=Object.prototype,Ao=Eo.hasOwnProperty;function Co(e){if(!mt(e))return To(e);var t=[];for(var n in Object(e))Ao.call(e,n)&&n!="constructor"&&t.push(n);return t}function xo(e){return Cn(e)?Rn(e):Co(e)}function Po(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Ro=Object.prototype,So=Ro.hasOwnProperty;function jo(e){if(!vn(e))return Po(e);var t=mt(e),n=[];for(var r in e)r=="constructor"&&(t||!So.call(e,r))||n.push(r);return n}function ri(e){return Cn(e)?Rn(e,!0):jo(e)}var _o=Sn(Object.getPrototypeOf,Object);function oi(){if(!arguments.length)return[];var e=arguments[0];return dt(e)?e:[e]}function Mo(){this.__data__=new vt,this.size=0}function Bo(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Io(e){return this.__data__.get(e)}function Fo(e){return this.__data__.has(e)}var ko=200;function $o(e,t){var n=this.__data__;if(n instanceof vt){var r=n.__data__;if(!Ve||r.length<ko-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fr(r)}return n.set(e,t),this.size=n.size,this}function Le(e){var t=this.__data__=new vt(e);this.size=t.size}Le.prototype.clear=Mo;Le.prototype.delete=Bo;Le.prototype.get=Io;Le.prototype.has=Fo;Le.prototype.set=$o;var jn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kt=jn&&typeof module=="object"&&module&&!module.nodeType&&module,Lo=Kt&&Kt.exports===jn,qt=Lo?le.Buffer:void 0,Vt=qt?qt.allocUnsafe:void 0;function ai(e,t){if(t)return e.slice();var n=e.length,r=Vt?Vt(n):new e.constructor(n);return e.copy(r),r}function Do(e,t){for(var n=-1,r=e==null?0:e.length,o=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[o++]=s)}return a}function No(){return[]}var Ho=Object.prototype,Wo=Ho.propertyIsEnumerable,Gt=Object.getOwnPropertySymbols,Uo=Gt?function(e){return e==null?[]:(e=Object(e),Do(Gt(eLine truncated
|
||||
@@ -1 +1 @@
|
||||
import{bx as Dl,b3 as Ve,by as Bl,bv as pt,b5 as zl,b9 as Ue,b6 as vt,bz as Dt,bA as Bt,bk as te,bB as Nl,bC as Wl,b as Be,_ as se,a as Y,i as de,u as ae,s as E,c as y,a1 as zt,bo as qe,aA as mt,g as F,o as T,w as z,A as ce,N as P,h as C,j as k,n as ne,C as ze,T as Hl,E as Nt,P as $,B as q,ab as Qe,e as ue,d as ye,aH as gt,$ as X,p as Xe,t as fe,bD as kl,a0 as Ne,F as U,aL as Fl,Q as N,r as D,k as $e,f as le,aY as Z,l as Wt,aw as Kl,bc as Gl,aT as Ye,O as G,x as Je,R as Q,ao as Ul,bE as ql,al as j,bF as Ql,a7 as Le,bG as bt,aW as Xl,a2 as Se,L as Yl,ax as Jl,G as Zl,bH as _l,aR as jl,aV as ht,aJ as xl,ah as en,M as ee,bl as tn,ac as yt,U as St,S as he,bI as ln,bJ as nn,W as an,bK as sn,ak as Ht}from"./index-5orz1M6_.js";import{U as wt,t as Ot,p as Ct,b as Tt,S as Me,d as on,k as rn,l as _,u as un,v as cn,C as dn,E as fn}from"./el-popper-DxfKqvb2.js";import{y as pn,m as vn,t as mn,f as kt,u as Ft,z as gn,A as bn,g as hn,h as yn,c as Sn,U as re,C as Kt,i as wn}from"./el-input-D_xPEeA2.js";import{s as On,t as Et,E as Cn}from"./el-tag-DsWzxe9q.js";var Tn=/\s/;function En(e){for(var t=e.length;t--&&Tn.test(e.charAt(t)););return t}var In=/^\s+/;function Rn(e){return e&&e.slice(0,En(e)+1).replace(In,"")}var It=NaN,Ln=/^[-+]0x[0-9a-f]+$/i,An=/^0b[01]+$/i,$n=/^0o[0-7]+$/i,Mn=parseInt;function Rt(e){if(typeof e=="number")return e;if(Dl(e))return It;if(Ve(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ve(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Rn(e);var a=An.test(e);return a||$n.test(e)?Mn(e.slice(2),a?2:8):Ln.test(e)?It:+e}function Pn(e,t,a,s){e.length;for(var o=a+1;o--;)if(t(e[o],o,e))return o;return-1}var Vn="__lodash_hash_undefined__";function Dn(e){return this.__data__.set(e,Vn),this}function Bn(e){return this.__data__.has(e)}function De(e){var t=-1,a=e==null?0:e.length;for(this.__data__=new Bl;++t<a;)this.add(e[t])}De.prototype.add=De.prototype.push=Dn;De.prototype.has=Bn;function zn(e,t){for(var a=-1,s=e==null?0:e.length;++a<s;)if(t(e[a],a,e))return!0;return!1}function Nn(e,t){return e.has(t)}var Wn=1,Hn=2;function Gt(e,t,a,s,o,i){var l=a&Wn,f=e.length,c=t.length;if(f!=c&&!(l&&c>f))return!1;var v=i.get(e),d=i.get(t);if(v&&d)return v==t&&d==e;var u=-1,p=!0,m=a&Hn?new De:void 0;for(i.set(e,t),i.set(t,e);++u<f;){var g=e[u],b=t[u];if(s)var O=l?s(b,g,u,t,e,i):s(g,b,u,e,t,i);if(O!==void 0){if(O)continue;p=!1;break}if(m){if(!zn(t,function(R,L){if(!Nn(m,L)&&(g===R||o(g,R,a,s,i)))return m.push(L)})){p=!1;break}}else if(!(g===b||o(g,b,a,s,i))){p=!1;break}}return i.delete(e),i.delete(t),p}function kn(e){var t=-1,a=Array(e.size);return e.forEach(function(s,o){a[++t]=[o,s]}),a}function Fn(e){var t=-1,a=Array(e.size);return e.forEach(function(s){a[++t]=s}),a}var Kn=1,Gn=2,Un="[object Boolean]",qn="[object Date]",Qn="[object Error]",Xn="[object Map]",Yn="[object Number]",Jn="[object RegExp]",Zn="[object Set]",_n="[object String]",jn="[object Symbol]",xn="[object ArrayBuffer]",ea="[object DataView]",Lt=pt?pt.prototype:void 0,Ke=Lt?Lt.valueOf:void 0;function ta(e,t,a,s,o,i,l){switch(a){case ea:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case xn:return!(e.byteLength!=t.byteLength||!i(new wt(e),new wt(t)));case Un:case qn:case Yn:return zl(+e,+t);case Qn:return e.name==t.name&&e.message==t.message;case Jn:case _n:return e==t+"";case Xn:var f=kn;case Zn:var c=s&Kn;if(f||(f=Fn),e.size!=t.size&&!c)return!1;var v=l.get(e);if(v)return v==t;s|=Gn,l.set(e,t);var d=Gt(f(e),f(t),s,o,i,l);return l.delete(e),d;case jn:if(Ke)return Ke.call(e)==Ke.call(t)}return!1}var la=1,na=Object.prototype,aa=na.hasOwnProperty;function sa(e,t,a,s,o,i){var l=a&la,f=Ot(e),c=f.length,v=Ot(t),d=v.length;if(c!=d&&!l)return!1;for(var u=c;u--;){var p=f[u];if(!(l?p in t:aa.call(t,p)))return!1}var m=i.get(e),g=i.get(t);if(m&&g)return m==t&&g==e;var b=!0;i.set(e,t),i.set(t,e);for(var O=l;++u<c;){p=f[u];var R=e[p],L=t[p];if(s)var K=l?s(L,R,p,t,e,i):s(R,L,p,e,t,i);if(!(K===void 0?R===L||o(R,L,a,s,i):K)){b=!1;break}O||(O=p=="constructor")}if(b&&!O){var V=e.constructor,h=t.constructor;V!=h&&"constructor"in e&&"constructor"in t&&!(typeof V=="function"&&V instanceof V&&typeof h=="function"&&h instanceof h)&&(b=!1)}return i.delete(e),i.delete(t),b}var oa=1,At="[object Arguments]",$t="[object Array]",Ae="[object Object]",ia=Object.prototype,Mt=ia.hasOwnProperty;function ra(e,t,a,s,o,i){var l=Ue(e),f=Ue(t),c=l?$t:Ct(e),v=f?$t:Ct(t);c=c==At?Ae:c,v=v==At?Ae:v;var d=c==Ae,u=v==Ae,p=c==v;if(p&&Tt(e)){if(!Tt(t))return!1;l=!0,d=!1}if(p&&!d)return i||(i=new Me),l||on(e)?Gt(e,t,a,s,o,i):ta(e,t,c,a,s,o,i);if(!(a&oa)){var m=d&&Mt.call(e,"__wrapped__"),g=u&&Mt.call(t,"__wrapped__");if(m||g){var b=m?e.value():e,O=g?t.value():t;return i||(i=new Me),o(b,O,a,s,i)}}return p?(i||(i=new Me),sa(e,t,a,s,o,i)):!1}function We(e,t,a,s,o){return e===t?!0:e==null||t==null||!vt(e)&&!vt(t)?e!==e&&t!==t:ra(e,t,a,s,We,o)}var ua=1,ca=2;function da(e,t,a,s){var o=a.length,i=o;if(e==null)return!i;for(e=Object(e);o--;){var l=a[o];if(l[2]?l[1]Line truncated
|
||||
import{bx as Dl,b3 as Ve,by as Bl,bv as pt,b5 as zl,b9 as Ue,b6 as vt,bz as Dt,bA as Bt,bk as te,bB as Nl,bC as Wl,b as Be,_ as se,a as Y,i as de,u as ae,s as E,c as y,a1 as zt,bo as qe,aA as mt,g as F,o as T,w as z,A as ce,N as P,h as C,j as k,n as ne,C as ze,T as Hl,E as Nt,P as $,B as q,ab as Qe,e as ue,d as ye,aH as gt,$ as X,p as Xe,t as fe,bD as kl,a0 as Ne,F as U,aL as Fl,Q as N,r as D,k as $e,f as le,aY as Z,l as Wt,aw as Kl,bc as Gl,aT as Ye,O as G,x as Je,R as Q,ao as Ul,bE as ql,al as j,bF as Ql,a7 as Le,bG as bt,aW as Xl,a2 as Se,L as Yl,ax as Jl,G as Zl,bH as _l,aR as jl,aV as ht,aJ as xl,ah as en,M as ee,bl as tn,ac as yt,U as St,S as he,bI as ln,bJ as nn,W as an,bK as sn,ak as Ht}from"./index-CxMsK_Ni.js";import{U as wt,t as Ot,p as Ct,b as Tt,S as Me,d as on,k as rn,l as _,u as un,v as cn,C as dn,E as fn}from"./el-popper-C96qJ_vz.js";import{y as pn,m as vn,t as mn,f as kt,u as Ft,z as gn,A as bn,g as hn,h as yn,c as Sn,U as re,C as Kt,i as wn}from"./el-input-CNNwOXGP.js";import{s as On,t as Et,E as Cn}from"./el-tag-5pOVEKUY.js";var Tn=/\s/;function En(e){for(var t=e.length;t--&&Tn.test(e.charAt(t)););return t}var In=/^\s+/;function Rn(e){return e&&e.slice(0,En(e)+1).replace(In,"")}var It=NaN,Ln=/^[-+]0x[0-9a-f]+$/i,An=/^0b[01]+$/i,$n=/^0o[0-7]+$/i,Mn=parseInt;function Rt(e){if(typeof e=="number")return e;if(Dl(e))return It;if(Ve(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ve(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Rn(e);var a=An.test(e);return a||$n.test(e)?Mn(e.slice(2),a?2:8):Ln.test(e)?It:+e}function Pn(e,t,a,s){e.length;for(var o=a+1;o--;)if(t(e[o],o,e))return o;return-1}var Vn="__lodash_hash_undefined__";function Dn(e){return this.__data__.set(e,Vn),this}function Bn(e){return this.__data__.has(e)}function De(e){var t=-1,a=e==null?0:e.length;for(this.__data__=new Bl;++t<a;)this.add(e[t])}De.prototype.add=De.prototype.push=Dn;De.prototype.has=Bn;function zn(e,t){for(var a=-1,s=e==null?0:e.length;++a<s;)if(t(e[a],a,e))return!0;return!1}function Nn(e,t){return e.has(t)}var Wn=1,Hn=2;function Gt(e,t,a,s,o,i){var l=a&Wn,f=e.length,c=t.length;if(f!=c&&!(l&&c>f))return!1;var v=i.get(e),d=i.get(t);if(v&&d)return v==t&&d==e;var u=-1,p=!0,m=a&Hn?new De:void 0;for(i.set(e,t),i.set(t,e);++u<f;){var g=e[u],b=t[u];if(s)var O=l?s(b,g,u,t,e,i):s(g,b,u,e,t,i);if(O!==void 0){if(O)continue;p=!1;break}if(m){if(!zn(t,function(R,L){if(!Nn(m,L)&&(g===R||o(g,R,a,s,i)))return m.push(L)})){p=!1;break}}else if(!(g===b||o(g,b,a,s,i))){p=!1;break}}return i.delete(e),i.delete(t),p}function kn(e){var t=-1,a=Array(e.size);return e.forEach(function(s,o){a[++t]=[o,s]}),a}function Fn(e){var t=-1,a=Array(e.size);return e.forEach(function(s){a[++t]=s}),a}var Kn=1,Gn=2,Un="[object Boolean]",qn="[object Date]",Qn="[object Error]",Xn="[object Map]",Yn="[object Number]",Jn="[object RegExp]",Zn="[object Set]",_n="[object String]",jn="[object Symbol]",xn="[object ArrayBuffer]",ea="[object DataView]",Lt=pt?pt.prototype:void 0,Ke=Lt?Lt.valueOf:void 0;function ta(e,t,a,s,o,i,l){switch(a){case ea:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case xn:return!(e.byteLength!=t.byteLength||!i(new wt(e),new wt(t)));case Un:case qn:case Yn:return zl(+e,+t);case Qn:return e.name==t.name&&e.message==t.message;case Jn:case _n:return e==t+"";case Xn:var f=kn;case Zn:var c=s&Kn;if(f||(f=Fn),e.size!=t.size&&!c)return!1;var v=l.get(e);if(v)return v==t;s|=Gn,l.set(e,t);var d=Gt(f(e),f(t),s,o,i,l);return l.delete(e),d;case jn:if(Ke)return Ke.call(e)==Ke.call(t)}return!1}var la=1,na=Object.prototype,aa=na.hasOwnProperty;function sa(e,t,a,s,o,i){var l=a&la,f=Ot(e),c=f.length,v=Ot(t),d=v.length;if(c!=d&&!l)return!1;for(var u=c;u--;){var p=f[u];if(!(l?p in t:aa.call(t,p)))return!1}var m=i.get(e),g=i.get(t);if(m&&g)return m==t&&g==e;var b=!0;i.set(e,t),i.set(t,e);for(var O=l;++u<c;){p=f[u];var R=e[p],L=t[p];if(s)var K=l?s(L,R,p,t,e,i):s(R,L,p,e,t,i);if(!(K===void 0?R===L||o(R,L,a,s,i):K)){b=!1;break}O||(O=p=="constructor")}if(b&&!O){var V=e.constructor,h=t.constructor;V!=h&&"constructor"in e&&"constructor"in t&&!(typeof V=="function"&&V instanceof V&&typeof h=="function"&&h instanceof h)&&(b=!1)}return i.delete(e),i.delete(t),b}var oa=1,At="[object Arguments]",$t="[object Array]",Ae="[object Object]",ia=Object.prototype,Mt=ia.hasOwnProperty;function ra(e,t,a,s,o,i){var l=Ue(e),f=Ue(t),c=l?$t:Ct(e),v=f?$t:Ct(t);c=c==At?Ae:c,v=v==At?Ae:v;var d=c==Ae,u=v==Ae,p=c==v;if(p&&Tt(e)){if(!Tt(t))return!1;l=!0,d=!1}if(p&&!d)return i||(i=new Me),l||on(e)?Gt(e,t,a,s,o,i):ta(e,t,c,a,s,o,i);if(!(a&oa)){var m=d&&Mt.call(e,"__wrapped__"),g=u&&Mt.call(t,"__wrapped__");if(m||g){var b=m?e.value():e,O=g?t.value():t;return i||(i=new Me),o(b,O,a,s,i)}}return p?(i||(i=new Me),sa(e,t,a,s,o,i)):!1}function We(e,t,a,s,o){return e===t?!0:e==null||t==null||!vt(e)&&!vt(t)?e!==e&&t!==t:ra(e,t,a,s,We,o)}var ua=1,ca=2;function da(e,t,a,s){var o=a.length,i=o;if(e==null)return!i;for(e=Object(e);o--;){var l=a[o];if(l[2]?l[1]Line truncated
|
||||
@@ -1 +1 @@
|
||||
import{E,b as P,q as V,_ as W,a as N,u as M,c as $,P as H,g as v,o as m,N as y,Q as k,r as C,h as c,j as l,w as b,B as T,as as _,O as w,W as B,n as S,T as I,l as R}from"./index-5orz1M6_.js";import{c as j}from"./el-input-D_xPEeA2.js";let h;const G=s=>{var n;if(!E)return 0;if(h!==void 0)return h;const t=document.createElement("div");t.className=`${s}-scrollbar__wrap`,t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const a=t.offsetWidth;t.style.overflow="scroll";const e=document.createElement("div");e.style.width="100%",t.appendChild(e);const i=e.offsetWidth;return(n=t.parentNode)==null||n.removeChild(t),h=a-i,h};function J(s,n){if(!E)return;if(!n){s.scrollTop=0;return}const t=[];let a=n.offsetParent;for(;a!==null&&s!==a&&s.contains(a);)t.push(a),a=a.offsetParent;const e=n.offsetTop+t.reduce((g,o)=>g+o.offsetTop,0),i=e+n.offsetHeight,r=s.scrollTop,p=r+s.clientHeight;e<r?s.scrollTop=e:i>p&&(s.scrollTop=i-s.clientHeight)}const q=P({type:{type:String,values:["primary","success","info","warning","danger"],default:"primary"},closable:Boolean,disableTransitions:Boolean,hit:Boolean,color:String,size:{type:String,values:V},effect:{type:String,values:["dark","light","plain"],default:"light"},round:Boolean}),F={close:s=>s instanceof MouseEvent,click:s=>s instanceof MouseEvent},K=N({name:"ElTag"}),O=N({...K,props:q,emits:F,setup(s,{emit:n}){const t=s,a=j(),e=M("tag"),i=$(()=>{const{type:o,hit:u,effect:d,closable:f,round:z}=t;return[e.b(),e.is("closable",f),e.m(o||"primary"),e.m(a.value),e.m(d),e.is("hit",u),e.is("round",z)]}),r=o=>{n("close",o)},p=o=>{n("click",o)},g=o=>{var u,d,f;(f=(d=(u=o==null?void 0:o.component)==null?void 0:u.subTree)==null?void 0:d.component)!=null&&f.bum&&(o.component.subTree.component.bum=null)};return(o,u)=>o.disableTransitions?(m(),H("span",{key:0,class:c(l(i)),style:S({backgroundColor:o.color}),onClick:p},[y("span",{class:c(l(e).e("content"))},[C(o.$slots,"default")],2),o.closable?(m(),v(l(B),{key:0,class:c(l(e).e("close")),onClick:w(r,["stop"])},{default:b(()=>[T(l(_))]),_:1},8,["class","onClick"])):k("v-if",!0)],6)):(m(),v(I,{key:1,name:`${l(e).namespace.value}-zoom-in-center`,appear:"",onVnodeMounted:g},{default:b(()=>[y("span",{class:c(l(i)),style:S({backgroundColor:o.color}),onClick:p},[y("span",{class:c(l(e).e("content"))},[C(o.$slots,"default")],2),o.closable?(m(),v(l(B),{key:0,class:c(l(e).e("close")),onClick:w(r,["stop"])},{default:b(()=>[T(l(_))]),_:1},8,["class","onClick"])):k("v-if",!0)],6)]),_:3},8,["name"]))}});var Q=W(O,[["__file","tag.vue"]]);const L=R(Q);export{L as E,G as g,J as s,q as t};
|
||||
import{E,b as P,q as V,_ as W,a as N,u as M,c as $,P as H,g as v,o as m,N as y,Q as k,r as C,h as c,j as l,w as b,B as T,as as _,O as w,W as B,n as S,T as I,l as R}from"./index-CxMsK_Ni.js";import{c as j}from"./el-input-CNNwOXGP.js";let h;const G=s=>{var n;if(!E)return 0;if(h!==void 0)return h;const t=document.createElement("div");t.className=`${s}-scrollbar__wrap`,t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const a=t.offsetWidth;t.style.overflow="scroll";const e=document.createElement("div");e.style.width="100%",t.appendChild(e);const i=e.offsetWidth;return(n=t.parentNode)==null||n.removeChild(t),h=a-i,h};function J(s,n){if(!E)return;if(!n){s.scrollTop=0;return}const t=[];let a=n.offsetParent;for(;a!==null&&s!==a&&s.contains(a);)t.push(a),a=a.offsetParent;const e=n.offsetTop+t.reduce((g,o)=>g+o.offsetTop,0),i=e+n.offsetHeight,r=s.scrollTop,p=r+s.clientHeight;e<r?s.scrollTop=e:i>p&&(s.scrollTop=i-s.clientHeight)}const q=P({type:{type:String,values:["primary","success","info","warning","danger"],default:"primary"},closable:Boolean,disableTransitions:Boolean,hit:Boolean,color:String,size:{type:String,values:V},effect:{type:String,values:["dark","light","plain"],default:"light"},round:Boolean}),F={close:s=>s instanceof MouseEvent,click:s=>s instanceof MouseEvent},K=N({name:"ElTag"}),O=N({...K,props:q,emits:F,setup(s,{emit:n}){const t=s,a=j(),e=M("tag"),i=$(()=>{const{type:o,hit:u,effect:d,closable:f,round:z}=t;return[e.b(),e.is("closable",f),e.m(o||"primary"),e.m(a.value),e.m(d),e.is("hit",u),e.is("round",z)]}),r=o=>{n("close",o)},p=o=>{n("click",o)},g=o=>{var u,d,f;(f=(d=(u=o==null?void 0:o.component)==null?void 0:u.subTree)==null?void 0:d.component)!=null&&f.bum&&(o.component.subTree.component.bum=null)};return(o,u)=>o.disableTransitions?(m(),H("span",{key:0,class:c(l(i)),style:S({backgroundColor:o.color}),onClick:p},[y("span",{class:c(l(e).e("content"))},[C(o.$slots,"default")],2),o.closable?(m(),v(l(B),{key:0,class:c(l(e).e("close")),onClick:w(r,["stop"])},{default:b(()=>[T(l(_))]),_:1},8,["class","onClick"])):k("v-if",!0)],6)):(m(),v(I,{key:1,name:`${l(e).namespace.value}-zoom-in-center`,appear:"",onVnodeMounted:g},{default:b(()=>[y("span",{class:c(l(i)),style:S({backgroundColor:o.color}),onClick:p},[y("span",{class:c(l(e).e("content"))},[C(o.$slots,"default")],2),o.closable?(m(),v(l(B),{key:0,class:c(l(e).e("close")),onClick:w(r,["stop"])},{default:b(()=>[T(l(_))]),_:1},8,["class","onClick"])):k("v-if",!0)],6)]),_:3},8,["name"]))}});var Q=W(O,[["__file","tag.vue"]]);const L=R(Q);export{L as E,G as g,J as s,q as t};
|
||||
@@ -1 +1 @@
|
||||
import{J as q,s as _,aZ as b,aA as ee,a_ as $,a$ as te,a0 as H,F as G,$ as z,aT as P,b0 as K,i as ne,b1 as re,b2 as ae,c as A,aw as R,aW as oe,j as se}from"./index-5orz1M6_.js";function ie(e){return re()?(ae(e),!0):!1}const V=new WeakMap,ue=(...e)=>{var t;const n=e[0],r=(t=P())==null?void 0:t.proxy;if(r==null&&!K())throw new Error("injectLocal must be called in setup");return r&&V.has(r)&&n in V.get(r)?V.get(r)[n]:ne(...e)},le=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ce=Object.prototype.toString,fe=e=>ce.call(e)==="[object Object]",de=()=>{};function pe(e,t){function n(...r){return new Promise((s,u)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(s).catch(u)})}return n}const Q=e=>e();function me(e=Q,t={}){const{initialState:n="active"}=t,r=Z(n==="active");function s(){r.value=!1}function u(){r.value=!0}const l=(...a)=>{r.value&&e(...a)};return{isActive:$(r),pause:s,resume:u,eventFilter:l}}function I(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function he(e){return P()}function J(e){return Array.isArray(e)?e:[e]}function Z(...e){if(e.length!==1)return ee(...e);const t=e[0];return typeof t=="function"?$(te(()=>({get:t,set:de}))):_(t)}function ve(e,t,n={}){const{eventFilter:r=Q,...s}=n;return z(e,pe(r,t),s)}function ye(e,t,n={}){const{eventFilter:r,initialState:s="active",...u}=n,{eventFilter:l,pause:a,resume:i,isActive:c}=me(r,{initialState:s});return{stop:ve(e,t,{...u,eventFilter:l}),pause:a,resume:i,isActive:c}}function U(e,t=!0,n){he()?H(e,n):t?e():G(e)}function Fe(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,s=q(e),u=_(e);function l(a){if(arguments.length)return u.value=a,u.value;{const i=b(n);return u.value=u.value===i?b(r):i,u.value}}return s?l:[u,l]}function ge(e,t,n){return z(e,t,{...n,immediate:!0})}const D=le?window:void 0;function X(e){var t;const n=b(e);return(t=n==null?void 0:n.$el)!=null?t:n}function x(...e){const t=[],n=()=>{t.forEach(a=>a()),t.length=0},r=(a,i,c,m)=>(a.addEventListener(i,c,m),()=>a.removeEventListener(i,c,m)),s=A(()=>{const a=J(b(e[0])).filter(i=>i!=null);return a.every(i=>typeof i!="string")?a:void 0}),u=ge(()=>{var a,i;return[(i=(a=s.value)==null?void 0:a.map(c=>X(c)))!=null?i:[D].filter(c=>c!=null),J(b(s.value?e[1]:e[0])),J(se(s.value?e[2]:e[1])),b(s.value?e[3]:e[2])]},([a,i,c,m])=>{if(n(),!(a!=null&&a.length)||!(i!=null&&i.length)||!(c!=null&&c.length))return;const v=fe(m)?{...m}:m;t.push(...a.flatMap(k=>i.flatMap(y=>c.map(d=>r(k,y,d,v)))))},{flush:"post"}),l=()=>{u(),n()};return ie(n),l}function we(){const e=R(!1),t=P();return t&&H(()=>{e.value=!0},t),e}function Se(e){const t=we();return A(()=>(t.value,!!e()))}const be=Symbol("vueuse-ssr-width");function ke(){const e=K()?ue(be,null):null;return typeof e=="number"?e:void 0}function Ce(e,t={}){const{window:n=D,ssrWidth:r=ke()}=t,s=Se(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function"),u=_(typeof r=="number"),l=R(),a=R(!1),i=c=>{a.value=c.matches};return oe(()=>{if(u.value){u.value=!s.value;const c=b(e).split(",");a.value=c.some(m=>{const v=m.includes("not all"),k=m.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),y=m.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let d=!!(k||y);return k&&d&&(d=r>=I(k[1])),y&&d&&(d=r<=I(y[1])),v?!d:d});return}s.value&&(l.value=n.matchMedia(b(e)),a.value=l.value.matches)}),x(l,"change",i,{passive:!0}),A(()=>a.value)}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__",Ae=Me();function Me(){return L in F||(F[L]=F[L]||{}),F[L]}function Y(e,t){return Ae[e]||t}function Te(e){return Ce("(prefers-color-scheme: dark)",e)}function Oe(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const We={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},B="vueuse-storage";function Ee(e,t,n,r={}){var s;const{flush:u="pre",deep:l=!0,listenToStorageChanges:a=!0,writeDefaults:i=!0,mergeDefaults:c=!1,shallow:m,window:v=D,eventFilter:k,onError:y=o=>{console.error(o)},initOnMounted:d}=r,g=(m?R:_)(typeof t=="function"?t():t),w=A(()=>b(e));if(!n)try{n=Y("getDefaultStorage",()=>{var o;return(o=D)==null?void 0:o.localStorage})()}catch(o){y(o)}if(!n)return g;const S=b(t),E=Oe(S),T=(s=r.serializer)!=null?s:We[E],{pause:h,resume:M}=ye(g,()=>W(g.value),{flush:u,deep:l,eventFilter:k});z(w,()=>C(),{flush:u}),v&&a&&U(()=>{n instanceLine truncated
|
||||
import{J as q,s as _,aZ as b,aA as ee,a_ as $,a$ as te,a0 as H,F as G,$ as z,aT as P,b0 as K,i as ne,b1 as re,b2 as ae,c as A,aw as R,aW as oe,j as se}from"./index-CxMsK_Ni.js";function ie(e){return re()?(ae(e),!0):!1}const V=new WeakMap,ue=(...e)=>{var t;const n=e[0],r=(t=P())==null?void 0:t.proxy;if(r==null&&!K())throw new Error("injectLocal must be called in setup");return r&&V.has(r)&&n in V.get(r)?V.get(r)[n]:ne(...e)},le=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ce=Object.prototype.toString,fe=e=>ce.call(e)==="[object Object]",de=()=>{};function pe(e,t){function n(...r){return new Promise((s,u)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(s).catch(u)})}return n}const Q=e=>e();function me(e=Q,t={}){const{initialState:n="active"}=t,r=Z(n==="active");function s(){r.value=!1}function u(){r.value=!0}const l=(...a)=>{r.value&&e(...a)};return{isActive:$(r),pause:s,resume:u,eventFilter:l}}function I(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function he(e){return P()}function J(e){return Array.isArray(e)?e:[e]}function Z(...e){if(e.length!==1)return ee(...e);const t=e[0];return typeof t=="function"?$(te(()=>({get:t,set:de}))):_(t)}function ve(e,t,n={}){const{eventFilter:r=Q,...s}=n;return z(e,pe(r,t),s)}function ye(e,t,n={}){const{eventFilter:r,initialState:s="active",...u}=n,{eventFilter:l,pause:a,resume:i,isActive:c}=me(r,{initialState:s});return{stop:ve(e,t,{...u,eventFilter:l}),pause:a,resume:i,isActive:c}}function U(e,t=!0,n){he()?H(e,n):t?e():G(e)}function Fe(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,s=q(e),u=_(e);function l(a){if(arguments.length)return u.value=a,u.value;{const i=b(n);return u.value=u.value===i?b(r):i,u.value}}return s?l:[u,l]}function ge(e,t,n){return z(e,t,{...n,immediate:!0})}const D=le?window:void 0;function X(e){var t;const n=b(e);return(t=n==null?void 0:n.$el)!=null?t:n}function x(...e){const t=[],n=()=>{t.forEach(a=>a()),t.length=0},r=(a,i,c,m)=>(a.addEventListener(i,c,m),()=>a.removeEventListener(i,c,m)),s=A(()=>{const a=J(b(e[0])).filter(i=>i!=null);return a.every(i=>typeof i!="string")?a:void 0}),u=ge(()=>{var a,i;return[(i=(a=s.value)==null?void 0:a.map(c=>X(c)))!=null?i:[D].filter(c=>c!=null),J(b(s.value?e[1]:e[0])),J(se(s.value?e[2]:e[1])),b(s.value?e[3]:e[2])]},([a,i,c,m])=>{if(n(),!(a!=null&&a.length)||!(i!=null&&i.length)||!(c!=null&&c.length))return;const v=fe(m)?{...m}:m;t.push(...a.flatMap(k=>i.flatMap(y=>c.map(d=>r(k,y,d,v)))))},{flush:"post"}),l=()=>{u(),n()};return ie(n),l}function we(){const e=R(!1),t=P();return t&&H(()=>{e.value=!0},t),e}function Se(e){const t=we();return A(()=>(t.value,!!e()))}const be=Symbol("vueuse-ssr-width");function ke(){const e=K()?ue(be,null):null;return typeof e=="number"?e:void 0}function Ce(e,t={}){const{window:n=D,ssrWidth:r=ke()}=t,s=Se(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function"),u=_(typeof r=="number"),l=R(),a=R(!1),i=c=>{a.value=c.matches};return oe(()=>{if(u.value){u.value=!s.value;const c=b(e).split(",");a.value=c.some(m=>{const v=m.includes("not all"),k=m.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),y=m.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let d=!!(k||y);return k&&d&&(d=r>=I(k[1])),y&&d&&(d=r<=I(y[1])),v?!d:d});return}s.value&&(l.value=n.matchMedia(b(e)),a.value=l.value.matches)}),x(l,"change",i,{passive:!0}),A(()=>a.value)}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__",Ae=Me();function Me(){return L in F||(F[L]=F[L]||{}),F[L]}function Y(e,t){return Ae[e]||t}function Te(e){return Ce("(prefers-color-scheme: dark)",e)}function Oe(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const We={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},B="vueuse-storage";function Ee(e,t,n,r={}){var s;const{flush:u="pre",deep:l=!0,listenToStorageChanges:a=!0,writeDefaults:i=!0,mergeDefaults:c=!1,shallow:m,window:v=D,eventFilter:k,onError:y=o=>{console.error(o)},initOnMounted:d}=r,g=(m?R:_)(typeof t=="function"?t():t),w=A(()=>b(e));if(!n)try{n=Y("getDefaultStorage",()=>{var o;return(o=D)==null?void 0:o.localStorage})()}catch(o){y(o)}if(!n)return g;const S=b(t),E=Oe(S),T=(s=r.serializer)!=null?s:We[E],{pause:h,resume:M}=ye(g,()=>W(g.value),{flush:u,deep:l,eventFilter:k});z(w,()=>C(),{flush:u}),v&&a&&U(()=>{n instanceLine truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomeView-CBSLOGzV.js","assets/el-input-D_xPEeA2.js","assets/el-input-CR4hgTr-.css","assets/config-C0oXmCul.js","assets/vnode-DkiIqzI4.js","assets/el-tag-DsWzxe9q.js","assets/el-tag-DljBBxJR.css","assets/config-DYaq6EHK.css","assets/CardTools.vue_vue_type_script_setup_true_lang-CMcmqUZX.js","assets/index-CX7K5KgQ.js","assets/CardTools-BeU-pM3r.css","assets/HomeView-Bj3zqJSZ.css","assets/SendView-DHX4GqXj.js","assets/el-select-lHlEhHIn.js","assets/el-popper-DxfKqvb2.js","assets/el-popper-DG5wR-qi.css","assets/el-select-BpOyN384.css","assets/_baseClone-IT_4yc7W.js","assets/SendView-BKoCrLal.css","assets/AdminView-CBxY_FuP.js","assets/el-form-item-CzDqJHnU.js","assets/el-form-item-CKZiX9BY.css","assets/el-tooltip-l0sNRNKZ.js","assets/AdminView-BC_-34Xk.css","assets/FileView-DxNq42uF.js","assets/FileView-TIfHKQHQ.css","assets/SettingView-BUSSfxsJ.js","assets/SettingView-Ba6-Wyi6.css","assets/LocalView-DPsby8ey.js","assets/LocalView-Bi6sx1Wt.css"])))=>i.map(i=>d[i]);
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomeView-DxH6ZVhr.js","assets/el-input-CNNwOXGP.js","assets/el-input-CR4hgTr-.css","assets/config-CZWWa62X.js","assets/vnode-Cc0RQjVK.js","assets/el-tag-5pOVEKUY.js","assets/el-tag-DljBBxJR.css","assets/config-DYaq6EHK.css","assets/CardTools.vue_vue_type_script_setup_true_lang-CdJKhv07.js","assets/index-CBpXPsVN.js","assets/CardTools-BeU-pM3r.css","assets/HomeView-Bj3zqJSZ.css","assets/SendView-DvkC6_VH.js","assets/el-select-LRJf3l5x.js","assets/el-popper-C96qJ_vz.js","assets/el-popper-DG5wR-qi.css","assets/el-select-BpOyN384.css","assets/_baseClone-DD6IrDYX.js","assets/SendView-BKoCrLal.css","assets/AdminView-BfUHrcUB.js","assets/el-form-item-llYGp2SQ.js","assets/el-form-item-CKZiX9BY.css","assets/el-tooltip-l0sNRNKZ.js","assets/AdminView-BC_-34Xk.css","assets/FileView-DVCieedT.js","assets/FileView-TIfHKQHQ.css","assets/SettingView-C0CG5ugf.js","assets/SettingView-Ba6-Wyi6.css","assets/LocalView-Co9a5QvS.js","assets/LocalView-Bi6sx1Wt.css"])))=>i.map(i=>d[i]);
|
||||
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
|
||||
* @vue/shared v3.5.13
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
@@ -28,7 +28,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomeView-CBSLOG
|
||||
* vue-router v4.5.0
|
||||
* (c) 2024 Eduardo San Martin Morote
|
||||
* @license MIT
|
||||
*/const qn=typeof document<"u";function Rd(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Zv(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Rd(e.default)}const ve=Object.assign;function Ko(e,t){const n={};for(const r in t){const s=t[r];n[r]=At(s)?s.map(e):e(s)}return n}const Rr=()=>{},At=Array.isArray,Md=/#/g,e1=/&/g,t1=/\//g,n1=/=/g,r1=/\?/g,kd=/\+/g,s1=/%5B/g,o1=/%5D/g,Fd=/%5E/g,i1=/%60/g,Dd=/%7B/g,a1=/%7C/g,$d=/%7D/g,l1=/%20/g;function ma(e){return encodeURI(""+e).replace(a1,"|").replace(s1,"[").replace(o1,"]")}function c1(e){return ma(e).replace(Dd,"{").replace($d,"}").replace(Fd,"^")}function Ei(e){return ma(e).replace(kd,"%2B").replace(l1,"+").replace(Md,"%23").replace(e1,"%26").replace(i1,"`").replace(Dd,"{").replace($d,"}").replace(Fd,"^")}function u1(e){return Ei(e).replace(n1,"%3D")}function f1(e){return ma(e).replace(Md,"%23").replace(r1,"%3F")}function d1(e){return e==null?"":f1(e).replace(t1,"%2F")}function zr(e){try{return decodeURIComponent(""+e)}catch{}return""+e}const p1=/\/$/,m1=e=>e.replace(p1,"");function zo(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(r=t.slice(0,l),o=t.slice(l+1,a>-1?a:t.length),s=e(o)),a>-1&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=y1(r??t,n),{fullPath:r+(o&&"?")+o+i,path:r,query:s,hash:zr(i)}}function h1(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Jl(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function _1(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&ar(t.matched[r],n.matched[s])&&Ud(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ar(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ud(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!g1(e[n],t[n]))return!1;return!0}function g1(e,t){return At(e)?Xl(e,t):At(t)?Xl(t,e):e===t}function Xl(e,t){return At(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function y1(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const Zt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var Gr;(function(e){e.pop="pop",e.push="push"})(Gr||(Gr={}));var Mr;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Mr||(Mr={}));function v1(e){if(!e)if(qn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),m1(e)}const b1=/^[^#]+#/;function E1(e,t){return e.replace(b1,"#")+t}function w1(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const bo=()=>({left:window.scrollX,top:window.scrollY});function S1(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=w1(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ql(e,t){return(history.state?history.state.position-t:-1)+e}const wi=new Map;function C1(e,t){wi.set(e,t)}function T1(e){const t=wi.get(e);return wi.delete(e),t}let O1=()=>location.protocol+"//"+location.host;function Bd(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let a=s.includes(e.slice(o))?e.slice(o).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),Jl(l,"")}return Jl(n,e)+r+s}function L1(e,t,n,r){let s=[],o=[],i=null;const a=({state:d})=>{const m=Bd(e,location),E=n.value,y=t.value;let S=0;if(d){if(n.value=m,t.value=d,i&&i===E){i=null;return}S=y?d.position-y.position:0}else r(m);s.forEach(C=>{C(n.value,E,{delta:S,type:Gr.pop,direction:S?S>0?Mr.forward:Mr.back:Mr.unknown})})};function l(){i=n.value}function c(d){s.push(d);const m=()=>{const E=s.indexOf(d);E>-1&&s.splice(E,1)};return o.push(m),m}function u(){const{history:d}=window;d.state&&d.replaceState(ve({},d.state,{scroll:bo()}),"")}function f(){for(const d of o)d();o=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:f}}function Zl(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?bo():null}}function N1(e){const{history:t,location:n}=window,r={value:Bd(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scLine truncated
|
||||
*/const qn=typeof document<"u";function Rd(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Zv(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Rd(e.default)}const ve=Object.assign;function Ko(e,t){const n={};for(const r in t){const s=t[r];n[r]=At(s)?s.map(e):e(s)}return n}const Rr=()=>{},At=Array.isArray,Md=/#/g,e1=/&/g,t1=/\//g,n1=/=/g,r1=/\?/g,kd=/\+/g,s1=/%5B/g,o1=/%5D/g,Fd=/%5E/g,i1=/%60/g,Dd=/%7B/g,a1=/%7C/g,$d=/%7D/g,l1=/%20/g;function ma(e){return encodeURI(""+e).replace(a1,"|").replace(s1,"[").replace(o1,"]")}function c1(e){return ma(e).replace(Dd,"{").replace($d,"}").replace(Fd,"^")}function Ei(e){return ma(e).replace(kd,"%2B").replace(l1,"+").replace(Md,"%23").replace(e1,"%26").replace(i1,"`").replace(Dd,"{").replace($d,"}").replace(Fd,"^")}function u1(e){return Ei(e).replace(n1,"%3D")}function f1(e){return ma(e).replace(Md,"%23").replace(r1,"%3F")}function d1(e){return e==null?"":f1(e).replace(t1,"%2F")}function zr(e){try{return decodeURIComponent(""+e)}catch{}return""+e}const p1=/\/$/,m1=e=>e.replace(p1,"");function zo(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(r=t.slice(0,l),o=t.slice(l+1,a>-1?a:t.length),s=e(o)),a>-1&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=y1(r??t,n),{fullPath:r+(o&&"?")+o+i,path:r,query:s,hash:zr(i)}}function h1(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Jl(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function _1(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&ar(t.matched[r],n.matched[s])&&Ud(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ar(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ud(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!g1(e[n],t[n]))return!1;return!0}function g1(e,t){return At(e)?Xl(e,t):At(t)?Xl(t,e):e===t}function Xl(e,t){return At(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function y1(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const Zt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var Gr;(function(e){e.pop="pop",e.push="push"})(Gr||(Gr={}));var Mr;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Mr||(Mr={}));function v1(e){if(!e)if(qn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),m1(e)}const b1=/^[^#]+#/;function E1(e,t){return e.replace(b1,"#")+t}function w1(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const bo=()=>({left:window.scrollX,top:window.scrollY});function S1(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=w1(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ql(e,t){return(history.state?history.state.position-t:-1)+e}const wi=new Map;function C1(e,t){wi.set(e,t)}function T1(e){const t=wi.get(e);return wi.delete(e),t}let O1=()=>location.protocol+"//"+location.host;function Bd(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let a=s.includes(e.slice(o))?e.slice(o).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),Jl(l,"")}return Jl(n,e)+r+s}function L1(e,t,n,r){let s=[],o=[],i=null;const a=({state:d})=>{const m=Bd(e,location),E=n.value,y=t.value;let S=0;if(d){if(n.value=m,t.value=d,i&&i===E){i=null;return}S=y?d.position-y.position:0}else r(m);s.forEach(C=>{C(n.value,E,{delta:S,type:Gr.pop,direction:S?S>0?Mr.forward:Mr.back:Mr.unknown})})};function l(){i=n.value}function c(d){s.push(d);const m=()=>{const E=s.indexOf(d);E>-1&&s.splice(E,1)};return o.push(m),m}function u(){const{history:d}=window;d.state&&d.replaceState(ve({},d.state,{scroll:bo()}),"")}function f(){for(const d of o)d();o=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:f}}function Zl(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?bo():null}}function N1(e){const{history:t,location:n}=window,r={value:Bd(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scLine truncated
|
||||
* shared v9.14.2
|
||||
* (c) 2024 kazuya kawaguchi
|
||||
* Released under the MIT License.
|
||||
@@ -1 +1 @@
|
||||
import{al as S,a3 as N}from"./index-5orz1M6_.js";var o=(E=>(E[E.TEXT=1]="TEXT",E[E.CLASS=2]="CLASS",E[E.STYLE=4]="STYLE",E[E.PROPS=8]="PROPS",E[E.FULL_PROPS=16]="FULL_PROPS",E[E.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",E[E.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",E[E.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",E[E.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",E[E.NEED_PATCH=512]="NEED_PATCH",E[E.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",E[E.HOISTED=-1]="HOISTED",E[E.BAIL=-2]="BAIL",E))(o||{});const A=E=>{const _=S(E)?E:[E],e=[];return _.forEach(T=>{var r;S(T)?e.push(...A(T)):N(T)&&((r=T.component)!=null&&r.subTree)?e.push(T,...A(T.component.subTree)):N(T)&&S(T.children)?e.push(...A(T.children)):e.push(T)}),e};export{o as P,A as f};
|
||||
import{al as S,a3 as N}from"./index-CxMsK_Ni.js";var o=(E=>(E[E.TEXT=1]="TEXT",E[E.CLASS=2]="CLASS",E[E.STYLE=4]="STYLE",E[E.PROPS=8]="PROPS",E[E.FULL_PROPS=16]="FULL_PROPS",E[E.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",E[E.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",E[E.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",E[E.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",E[E.NEED_PATCH=512]="NEED_PATCH",E[E.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",E[E.HOISTED=-1]="HOISTED",E[E.BAIL=-2]="BAIL",E))(o||{});const A=E=>{const _=S(E)?E:[E],e=[];return _.forEach(T=>{var r;S(T)?e.push(...A(T)):N(T)&&((r=T.component)!=null&&r.subTree)?e.push(T,...A(T.component.subTree)):N(T)&&S(T.children)?e.push(...A(T.children)):e.push(T)}),e};export{o as P,A as f};
|
||||
@@ -8,7 +8,7 @@
|
||||
<meta name="keywords" content="{{keywords}}" />
|
||||
<meta name="generator" content="FileCodeBox2.1" />
|
||||
<title>{{title}}</title>
|
||||
<script type="module" crossorigin src="/assets/index-5orz1M6_.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-CxMsK_Ni.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-4qqIFT66.css">
|
||||
</head>
|
||||
<body style="background: url('{{background}}') no-repeat center center fixed;background-size: cover;">
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.switch{position:relative;display:inline-block;width:60px;height:34px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;inset:0;background-color:#e5e7eb;transition:.4s}.dark .slider{background-color:#4b5563}input:checked+.slider{background-color:#4f46e5}.dark input:checked+.slider{background-color:#4f46e5}.slider:before{position:absolute;content:"";height:26px;width:26px;left:4px;bottom:4px;background-color:#fff;transition:.4s}.dark .slider:before{background-color:#e5e7eb}.slider.round{border-radius:34px}.slider.round:before{border-radius:50%}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin-slow{animation:spin 8s linear infinite}.transition-colors{transition-property:background-color,border-color,color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.custom-scrollbar::-webkit-scrollbar{width:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background-color:#cbd5e0;border-radius:3px}:global(.dark) .custom-scrollbar::-webkit-scrollbar-thumb{background-color:#4a5568}
|
||||
@@ -1 +0,0 @@
|
||||
.switch{position:relative;display:inline-block;width:60px;height:34px}.switch input{opacity:0;width:0;height:0}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#e5e7eb;transition:.4s}.dark .slider{background-color:#4b5563}input:checked+.slider{background-color:#4f46e5}.dark input:checked+.slider{background-color:#4f46e5}.slider:before{position:absolute;content:"";height:26px;width:26px;left:4px;bottom:4px;background-color:#fff;transition:.4s}.dark .slider:before{background-color:#e5e7eb}.slider.round{border-radius:34px}.slider.round:before{border-radius:50%}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin-slow{animation:spin 8s linear infinite}.transition-colors{transition-property:background-color,border-color,color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.custom-scrollbar::-webkit-scrollbar{width:8px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background-color:#cbd5e0;border-radius:4px}:is():hover{background-color:#a0aec0}.custom-scrollbar :deep(.dark &::-webkit-scrollbar-thumb){background-color:#4a5568}.custom-scrollbar :deep(.dark &::-webkit-scrollbar-thumb):hover{background-color:#2d3748}.space-y-6{margin-bottom:5rem}
|
||||
@@ -0,0 +1 @@
|
||||
import{c as l,d as _,u as M,r as m,f as p,R as C,a as b,o as h,b as t,n as o,e,i as z,l as i,I as D,t as f,X as L,y as B,D as j,G as E,k as F,E as I,m as N}from"./index-DaP6hnmm.js";import{B as R}from"./box-C2OkK29z.js";const S=l("cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);const V=l("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const Z=l("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const q=l("menu",[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]]),A={class:"flex items-center"},$={class:"rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow"},G={class:"flex-1 overflow-y-auto custom-scrollbar"},H={class:"p-4 space-y-2"},O=["onClick"],T={class:"flex-1 flex flex-col h-full"},U={class:"flex items-center justify-between h-16 px-4"},P=_({__name:"AdminLayout",setup(W){const d=D(),{t:n}=M(),a=z("isDarkMode"),x=[{id:"Dashboard",name:n("admin.dashboard.title"),icon:Z,redirect:"/admin/dashboard"},{id:"FileManage",name:n("admin.fileManage.title"),icon:V,redirect:"/admin/files"},{id:"Settings",name:n("admin.settings.title"),icon:S,redirect:"/admin/settings"}],r=m(!0),g=()=>{r.value=!r.value},c=()=>{window.innerWidth>=1024?r.value=!0:r.value=!1};p(()=>{c(),window.addEventListener("resize",c)}),C(()=>{window.removeEventListener("resize",c)});const k=m({page:1,size:10,total:0}),v=async()=>{try{k.value.total=85}catch(u){console.error("加载文件列表失败:",u)}};return p(()=>{v()}),(u,y)=>{const w=E("router-view");return h(),b("div",{class:o(["h-screen flex flex-col lg:flex-row transition-colors duration-300",[e(a)?"bg-gray-900":"bg-gray-50"]])},[t("aside",{class:o(["fixed inset-y-0 border-transparent left-0 z-50 w-64 transform transition-all duration-300 ease-in-out lg:relative lg:translate-x-0 border-r flex flex-col h-full lg:h-screen",[e(a)?"bg-gray-800 bg-opacity-90 backdrop-filter backdrop-blur-xl ":"bg-white ",{"-translate-x-full":!r.value}]])},[t("div",{class:o(["flex items-center justify-between h-16 px-4 border-b",[e(a)?"border-gray-700":"border-gray-200"]])},[t("div",A,[t("div",$,[t("div",{class:o(["rounded-full p-1",[e(a)?"bg-gray-800":"bg-white"]])},[i(e(R),{class:o(["w-6 h-6",[e(a)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])],2)]),t("h1",{onClick:y[0]||(y[0]=s=>e(d).push("/")),class:o(["ml-2 text-xl font-semibold cursor-pointer",[e(a)?"text-white":"text-gray-800"]])},f(e(n)("common.appName")),3)]),t("button",{onClick:g,class:"lg:hidden"},[i(e(L),{class:o(["w-6 h-6",[e(a)?"text-gray-400":"text-gray-600"]])},null,8,["class"])])],2),t("nav",G,[t("ul",H,[(h(),b(B,null,j(x,s=>t("li",{key:s.id},[t("a",{onClick:X=>e(d).push(s.redirect),class:o(["flex items-center p-2 rounded-lg transition-colors duration-200",[e(d).currentRoute.value.name===s.id?e(a)?"bg-indigo-900 text-indigo-400":"bg-indigo-100 text-indigo-600":e(a)?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-100"]])},[(h(),F(N(s.icon),{class:"w-5 h-5 mr-3"})),I(" "+f(s.name),1)],10,O)])),64))])])],2),t("div",T,[t("header",{class:o(["shadow-md border-b transition-colors duration-300 h-16",[e(a)?"bg-gray-800 border-gray-700":"bg-white border-gray-200"]])},[t("div",U,[t("button",{onClick:g,class:"lg:hidden"},[i(e(q),{class:o(["w-6 h-6",[e(a)?"text-gray-400":"text-gray-600"]])},null,8,["class"])])])],2),t("main",{class:o(["overflow-y-auto transition-colors duration-300 custom-scrollbar",[e(a)?"bg-gray-900":"bg-gray-50"]])},[i(w)],2)])],2)}}});export{P as default};
|
||||
@@ -1,21 +0,0 @@
|
||||
import{c as i,d as k,r as h,o as u,I as v,a as d,b as x,e as t,n as o,g as e,i as n,X as w,F as _,p as M,A as C,x as z,z as L,J as B,K as D,q as F,t as I}from"./index-EADe6V-l.js";import{B as j}from"./box-brjUM9cP.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const S=i("CogIcon",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const V=i("FolderIcon",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const q=i("LayoutDashboardIcon",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const A=i("MenuIcon",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),E={class:"flex items-center"},N={class:"rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow"},R={class:"flex-1 overflow-y-auto"},Z={class:"p-4 space-y-2"},H=["onClick"],J={class:"flex-1 flex flex-col min-h-screen"},K={class:"flex items-center justify-between h-16 px-4"},$=k({__name:"AdminLayout",setup(O){const c=C(),a=z("isDarkMode"),p=[{id:"Dashboard",name:"仪表盘",icon:q,redirect:"/admin/dashboard"},{id:"FileManage",name:"文件管理",icon:V,redirect:"/admin/files"},{id:"Settings",name:"系统设置",icon:S,redirect:"/admin/settings"}],s=h(!0),y=()=>{s.value=!s.value},l=()=>{window.innerWidth>=1024?s.value=!0:s.value=!1};u(()=>{l(),window.addEventListener("resize",l)}),v(()=>{window.removeEventListener("resize",l)});const m=h({page:1,size:10,total:0}),b=async()=>{try{m.value.total=85}catch(g){console.error("加载文件列表失败:",g)}};return u(()=>{b()}),(g,T)=>{const f=L("router-view");return d(),x("div",{class:o(["min-h-screen flex flex-col lg:flex-row transition-colors duration-300",[e(a)?"bg-gray-900":"bg-gray-50"]])},[t("aside",{class:o(["fixed inset-y-0 left-0 z-50 w-64 transform transition-all duration-300 ease-in-out lg:relative lg:translate-x-0 border-r",[e(a)?"bg-gray-800 bg-opacity-90 backdrop-filter backdrop-blur-xl border-gray-700":"bg-white border-gray-200",{"-translate-x-full":!s.value}]])},[t("div",{class:o(["flex items-center justify-between h-16 px-4 border-b",[e(a)?"border-gray-700":"border-gray-200"]])},[t("div",E,[t("div",N,[t("div",{class:o(["rounded-full p-1",[e(a)?"bg-gray-800":"bg-white"]])},[n(e(j),{class:o(["w-6 h-6",[e(a)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])],2)]),t("h1",{class:o(["ml-2 text-xl font-semibold",[e(a)?"text-white":"text-gray-800"]])}," FileCodeBox ",2)]),t("button",{onClick:y,class:"lg:hidden"},[n(e(w),{class:o(["w-6 h-6",[e(a)?"text-gray-400":"text-gray-600"]])},null,8,["class"])])],2),t("nav",R,[t("ul",Z,[(d(),x(_,null,M(p,r=>t("li",{key:r.id},[t("a",{onClick:U=>e(c).push(r.redirect),class:o(["flex items-center p-2 rounded-lg transition-colors duration-200",[e(c).currentRoute.value.name===r.id?e(a)?"bg-indigo-900 text-indigo-400":"bg-indigo-100 text-indigo-600":e(a)?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-100"]])},[(d(),B(D(r.icon),{class:"w-5 h-5 mr-3"})),F(" "+I(r.name),1)],10,H)])),64))])])],2),t("div",J,[t("header",{class:o(["shadow-md border-b transition-colors duration-300",[e(a)?"bg-gray-800 border-gray-700":"bg-white border-gray-200"]])},[t("div",K,[t("button",{onClick:y,class:"lg:hidden"},[n(e(A),{class:o(["w-6 h-6",[e(a)?"text-gray-400":"text-gray-600"]])},null,8,["class"])])])],2),t("main",{class:o(["flex-1 p-6 overflow-y-auto transition-colors duration-300",[e(a)?"bg-gray-900":"bg-gray-50"]])},[n(f)],2)])],2)}}});export{$ as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{c as _,d as S,g as x,a as M,o as v,n as d,e as t,i as k,b as s,t as r,k as w,m as D,K as F,u as U,S as B,f as z,l as g,v as m,E as C,V as $}from"./index-DaP6hnmm.js";import{F as T}from"./file-C928Lhos.js";import{H as V}from"./hard-drive-B6XHFjlY.js";const H=_("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const N=_("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),j={class:"flex items-center justify-between"},b=S({__name:"StatCard",props:{title:{},value:{},icon:{},iconColor:{},descriptionType:{default:"neutral"}},setup(f){const l=f,e=k("isDarkMode"),a=x(()=>({indigo:e?"bg-indigo-900":"bg-indigo-100",purple:e?"bg-purple-900":"bg-purple-100",green:e?"bg-green-900":"bg-green-100",blue:e?"bg-blue-900":"bg-blue-100"})[l.iconColor]),h=x(()=>({indigo:e?"text-indigo-400":"text-indigo-600",purple:e?"text-purple-400":"text-purple-600",green:e?"text-green-400":"text-green-600",blue:e?"text-blue-400":"text-blue-600"})[l.iconColor]),p=x(()=>({success:e?"text-green-400":"text-green-600",error:e?"text-red-400":"text-red-600",neutral:e?"text-gray-400":"text-gray-600"})[l.descriptionType]);return(i,o)=>(v(),M("div",{class:d(["p-6 rounded-lg shadow-md transition-colors duration-300",[t(e)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[s("div",j,[s("div",null,[s("p",{class:d(["text-sm",[t(e)?"text-gray-400":"text-gray-600"]])},r(i.title),3),s("h3",{class:d(["text-2xl font-bold mt-1",[t(e)?"text-white":"text-gray-800"]])},r(i.value),3)]),s("div",{class:d(["p-3 rounded-full",a.value])},[(v(),w(D(i.icon),{class:d(["w-6 h-6",h.value])},null,8,["class"]))],2)]),s("p",{class:d(["text-sm mt-2",p.value])},[F(i.$slots,"description")],2)],2))}}),I={class:"p-6 overflow-y-auto custom-scrollbar"},L={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8"},A={class:"ml-2"},E={class:"ml-2"},K={class:"text-sm mt-1"},J=S({__name:"DashboardView",setup(f){const l=k("isDarkMode"),{t:e}=U(),a=B({totalFiles:0,storageUsed:0,yesterdayCount:0,todayCount:0,yesterdaySize:0,todaySize:0,sysUptime:0}),h=o=>{const c=new Date().getTime()-o,u=Math.floor(c/(1440*60*1e3)),y=Math.floor(c%(1440*60*1e3)/(3600*1e3));return`${u}天${y}小时`},p=o=>{const n=parseInt(o)/1024,c=n/1024,u=c/1024,y=u/1024;return y>1?`${y.toFixed(2)}TB`:u>1?`${u.toFixed(2)}GB`:c>1?`${c.toFixed(2)}MB`:n>1?`${n.toFixed(2)}KB`:`${o}B`},i=async()=>{const o=await $.getDashboard();o.detail&&(a.totalFiles=o.detail.totalFiles,a.storageUsed=p(o.detail.storageUsed.toString()),a.yesterdaySize=p(o.detail.yesterdaySize.toString()),a.todaySize=p(o.detail.todaySize.toString()),a.yesterdayCount=o.detail.yesterdayCount,a.todayCount=o.detail.todayCount,a.sysUptime=h(Number(o.detail.sysUptime)))};return z(()=>{i()}),(o,n)=>(v(),M("div",I,[s("h2",{class:d(["text-2xl font-bold mb-6",[t(l)?"text-white":"text-gray-800"]])},r(t(e)("admin.dashboard.title")),3),s("div",L,[g(b,{title:t(e)("admin.dashboard.totalFiles"),value:a.totalFiles,icon:t(T),"icon-color":"indigo","description-type":"success"},{description:m(()=>[s("span",null,r(t(e)("admin.dashboard.yesterday"))+":"+r(a.yesterdayCount),1),s("span",A,r(t(e)("admin.dashboard.today"))+":"+r(a.todayCount),1)]),_:1},8,["title","value","icon"]),g(b,{title:t(e)("admin.dashboard.storageSpace"),value:a.storageUsed,icon:t(V),"icon-color":"purple","description-type":"success"},{description:m(()=>[s("span",null,r(t(e)("admin.dashboard.yesterday"))+":"+r(a.yesterdaySize),1),s("span",E,r(t(e)("admin.dashboard.today"))+":"+r(a.todaySize),1)]),_:1},8,["title","value","icon"]),g(b,{title:t(e)("admin.dashboard.activeUsers"),value:"25",icon:t(N),"icon-color":"green","description-type":"error"},{description:m(()=>[s("span",null,r(t(e)("admin.dashboard.weeklyChange")),1)]),_:1},8,["title","icon"]),g(b,{title:t(e)("admin.dashboard.systemStatus"),value:t(e)("admin.dashboard.normal"),icon:t(H),"icon-color":"blue","description-type":"neutral"},{description:m(()=>[C(r(t(e)("admin.dashboard.serverUptime"))+": "+r(a.sysUptime),1)]),_:1},8,["title","value","icon"])]),s("div",{class:d(["mt-auto text-center py-4",[t(l)?"text-gray-400":"text-gray-600"]])},[n[1]||(n[1]=s("p",{class:"text-sm"}," 版本 v2.2.1 更新时间:2025-09-04 ",-1)),s("p",K,[C(" © "+r(new Date().getFullYear())+" ",1),n[0]||(n[0]=s("a",{href:"https://github.com/vastsa/FileCodeBox"},"FileCodeBox",-1))])],2)]))}});export{J as default};
|
||||
@@ -1,21 +0,0 @@
|
||||
import{c as g,d as v,H as w,o as _,a as p,b as u,e as t,n as a,g as e,t as i,i as y,F as k,p as U,x as F,y as M,J as C,K as z}from"./index-EADe6V-l.js";import{F as m}from"./file-CTH8PUKS.js";import{H as D,T as S}from"./trash-COYxyedR.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const B=g("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const H=g("UploadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const $=g("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const I=g("UsersIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),j={class:"p-6 h-screen overflow-y-auto custom-scrollbar"},A={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8"},L={class:"flex items-center justify-between"},T={class:"flex items-center justify-between"},V={class:"flex items-center justify-between"},K={class:"flex items-center justify-between"},N={class:"p-6"},q={class:"space-y-4"},E={class:"flex-shrink-0"},G={class:"flex-1"},R=v({__name:"DashboardView",setup(J){const s=F("isDarkMode"),o=w({totalFiles:0,storageUsed:0,yesterdayCount:0,todayCount:0,yesterdaySize:0,todaySize:0,sysUptime:0}),h=[{icon:H,description:'张三上传了文件 "项目计划.pdf"',time:"10分钟前"},{icon:$,description:"新用户李四加入了系统",time:"30分钟前"},{icon:S,description:'王五删除了文件 "旧文档.doc"',time:"1小时前"},{icon:m,description:"系统自动备份完成",time:"2小时前"}],b=l=>{const r=new Date().getTime()-l,d=Math.floor(r/(24*60*60*1e3)),c=Math.floor(r%(24*60*60*1e3)/(60*60*1e3));return`${d}天${c}小时`},x=l=>{const n=parseInt(l)/1024,r=n/1024,d=r/1024,c=d/1024;return c>1?`${c.toFixed(2)}TB`:d>1?`${d.toFixed(2)}GB`:r>1?`${r.toFixed(2)}MB`:n>1?`${n.toFixed(2)}KB`:`${l}B`},f=async()=>{const l=await M.get("/admin/dashboard");o.totalFiles=l.detail.totalFiles,o.storageUsed=x(l.detail.storageUsed),o.yesterdaySize=x(l.detail.yesterdaySize),o.todaySize=x(l.detail.todaySize),o.yesterdayCount=l.detail.yesterdayCount,o.todayCount=l.detail.todayCount,o.sysUptime=b(l.detail.sysUptime)};return _(()=>{f()}),(l,n)=>(p(),u("div",j,[t("h2",{class:a(["text-2xl font-bold mb-6",[e(s)?"text-white":"text-gray-800"]])}," 仪表盘 ",2),t("div",A,[t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",L,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 总文件数 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])},i(o.totalFiles),3)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-indigo-900":"bg-indigo-100"]])},[y(e(m),{class:a(["w-6 h-6",[e(s)?"text-indigo-400":"text-indigo-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-green-400":"text-green-600"]])},[t("span",{class:a([e(s)?"text-gray-400":"text-gray-600"])},"昨天:",2),t("span",null,i(o.yesterdayCount),1),t("span",{class:a(["ml-2",[e(s)?"text-gray-400":"text-gray-600"]])},"今天:",2),t("span",null,i(o.todayCount),1)],2)],2),t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",T,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 存储空间 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])},i(o.storageUsed),3)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-purple-900":"bg-purple-100"]])},[y(e(D),{class:a(["w-6 h-6",[e(s)?"text-purple-400":"text-purple-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-green-400":"text-green-600"]])},[t("span",{class:a([e(s)?"text-gray-400":"text-gray-600"])},"昨天:",2),t("span",null,i(o.yesterdaySize),1),t("span",{class:a(["ml-2",[e(s)?"text-gray-400":"text-gray-600"]])},"今天:",2),t("span",null,i(o.todaySize),1)],2)],2),t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",V,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 活跃用户 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])}," 25 ",2)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-green-900":"bg-green-100"]])},[y(e(I),{class:a(["w-6 h-6",[e(s)?"text-green-400":"text-green-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-red-400":"text-red-600"]])},[n[0]||(n[0]=t("span",null,"↓ 5% ",-1)),t("span",{class:a([e(s)?"text-gray-400":"text-gray-600"])},"较上周",2)],2)],2),t("div",{class:a(["p-6 rounded-lg shadow-md transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",K,[t("div",null,[t("p",{class:a(["text-sm",[e(s)?"text-gray-400":"text-gray-600"]])}," 系统状态 ",2),t("h3",{class:a(["text-2xl font-bold mt-1",[e(s)?"text-white":"text-gray-800"]])}," 正常 ",2)]),t("div",{class:a(["p-3 rounded-full",[e(s)?"bg-blue-900":"bg-blue-100"]])},[y(e(B),{class:a(["w-6 h-6",[e(s)?"text-blue-400":"text-blue-600"]])},null,8,["class"])],2)]),t("p",{class:a(["text-sm mt-2",[e(s)?"text-gray-400":"text-gray-600"]])}," 服务器运行时间: "+i(o.sysUptime),3)],2)]),t("div",{class:a(["rounded-lg shadow-md overflow-hidden transition-colors duration-300",[e(s)?"bg-gray-800 bg-opacity-70":"Line truncated
|
||||
@@ -1,6 +0,0 @@
|
||||
import{c as B,d as T,u as q,r as _,f as k,a as c,b as g,e as t,n as o,g as a,l as P,v as A,i as m,q as H,F as v,p as w,t as d,x as I,y as S}from"./index-EADe6V-l.js";import{F as L}from"./file-CTH8PUKS.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const M=B("SearchIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),E={class:"p-6 h-screen overflow-y-auto custom-scrollbar"},U={class:"mb-6 flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between"},Y={class:"flex flex-1 gap-4"},G={class:"relative flex-1"},J={class:"flex gap-4"},K={class:"overflow-x-auto"},O={class:"px-6 py-4 whitespace-nowrap"},Q={class:"flex items-center"},R={class:"px-6 py-4 whitespace-nowrap"},W={class:"flex items-center"},X={class:"px-6 py-4 whitespace-nowrap"},Z={class:"px-6 py-4 whitespace-nowrap"},N={class:"px-6 py-4 whitespace-nowrap"},tt={class:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium"},et=["onClick"],at={class:"flex items-center space-x-2"},st=["disabled"],rt={class:"flex items-center space-x-1"},ot=["onClick"],lt=["disabled"],ct=T({__name:"FileManageView",setup(nt){const C=q();function $(n){const l=new Date(n),e=l.getFullYear(),i=(l.getMonth()+1).toString().padStart(2,"0"),x=l.getDate().toString().padStart(2,"0"),h=l.getHours().toString().padStart(2,"0"),y=l.getMinutes().toString().padStart(2,"0"),j=l.getSeconds().toString().padStart(2,"0");return`${e}-${i}-${x} ${h}:${y}:${j}`}const r=I("isDarkMode"),f=_([]),F=["取件码","名称","大小","描述","过期时间","操作"],s=_({page:1,size:10,total:0,keyword:""}),D=async n=>{try{await S({url:"/admin/file/delete",method:"delete",data:{id:n}}),await p()}catch(l){console.error("删除失败:",l)}},p=async()=>{try{const n=await S({url:"/admin/file/list",method:"get",params:s.value});f.value=n.detail.data,s.value.total=n.detail.total,C.showAlert("加载成功","success")}catch(n){console.error("加载文件列表失败:",n)}},b=async n=>{n<1||n>u.value||(s.value.page=n,await p())};p();const u=k(()=>Math.ceil(s.value.total/s.value.size)),z=k(()=>{const n=s.value.page,l=u.value,e=2;let i=[];i.push(1);let x=Math.max(2,n-e),h=Math.min(l-1,n+e);x>2&&i.push("...");for(let y=x;y<=h;y++)i.push(y);return h<l-1&&i.push("..."),l>1&&i.push(l),i}),V=async()=>{s.value.page=1,await p()};return(n,l)=>(c(),g("div",E,[t("h2",{class:o(["text-2xl font-bold mb-6",[a(r)?"text-white":"text-gray-800"]])}," 文件管理 ",2),t("div",U,[t("div",Y,[t("div",G,[P(t("input",{type:"text","onUpdate:modelValue":l[0]||(l[0]=e=>s.value.keyword=e),class:o([[a(r)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-400"],"w-full pl-10 pr-4 py-2 rounded-lg border focus:ring-2 focus:ring-indigo-500 focus:border-transparent"]),placeholder:"搜索文件..."},null,2),[[A,s.value.keyword]]),m(a(M),{class:o(["absolute left-3 top-2.5 w-5 h-5",[a(r)?"text-gray-400":"text-gray-500"]])},null,8,["class"])])]),t("div",J,[t("button",{onClick:V,class:"flex items-center px-4 py-2 rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 transition-colors duration-200"},[m(a(M),{class:"w-5 h-5 mr-2"}),l[3]||(l[3]=H(" 搜索 "))])])]),t("div",{class:o(["rounded-lg shadow-md overflow-hidden transition-colors duration-300",[a(r)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[t("div",{class:o(["px-6 py-4 border-b",[a(r)?"border-gray-700":"border-gray-200"]])},[t("h3",{class:o(["text-lg font-medium",[a(r)?"text-white":"text-gray-800"]])}," 所有文件 ",2)],2),t("div",K,[t("table",{class:o(["min-w-full divide-y",[a(r)?"divide-gray-700":"divide-gray-200"]])},[t("thead",{class:o([a(r)?"bg-gray-900":"bg-gray-100"])},[t("tr",null,[(c(),g(v,null,w(F,e=>t("th",{key:e,class:o(["px-6 py-3 text-left text-xs font-medium uppercase tracking-wider",[a(r)?"text-gray-400":"text-gray-500"]])},d(e),3)),64))])],2),t("tbody",{class:o([a(r)?"bg-gray-800 divide-y divide-gray-700":"bg-white divide-y divide-gray-200"])},[(c(!0),g(v,null,w(f.value,e=>(c(),g("tr",{key:e.id},[t("td",O,[t("div",Q,[t("span",{class:o(["font-medium",[a(r)?"text-white":"text-gray-900"]])},d(e.code),3)])]),t("td",R,[t("div",W,[m(a(L),{class:o(["w-5 h-5 mr-2",[a(r)?"text-indigo-400":"text-indigo-500"]])},null,8,["class"]),t("span",{class:o(["font-medium",[a(r)?"text-white":"text-gray-900"]])},d(e.prefix),3)])]),t("td",X,[t("span",{class:o([a(r)?"text-gray-400":"text-gray-500"])},d(Math.round(e.size/1024/1024*100)/100)+"MB ",3)]),t("td",Z,[t("span",{class:o([a(r)?"text-gray-400":"text-gray-500"])},d(e.text),3)]),t("td",N,[t("span",{class:o([a(r)?"text-gray-400":"text-gray-500"])},d(e.expired_at?$(e.expired_at):"永久"),3)]),t("td",tt,[t("button",{onClick:i=>D(e.id),class:o(["transition-colors duration-200",[a(r)?"text-red-400 hover:text-red-300":"text-red-600 hover:text-red-900"]])}," 删除 ",10,et)])]))),128))],2)],2)])],2),t("div",{class:o(["mt-4 flex items-center justify-between px-6 py-3 border-t",[a(r)?"border-gray-700":"border-gray-200"]])},[t("div",{class:o(["flex items-center text-sm",[a(r)?"text-gray-400":"text-gray-500"]])}," 显示第 "+d((s.value.page-1)*s.value.size+1)+" 到 "+d(Math.min(s.value.page*s.value.size,s.value.total))+" 条,共 "+d(s.value.total)+" 条 ",3),t("Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{c as P,d as E,a as x,o as y,n as o,e as t,i as U,b as e,K as H,t as s,y as F,D as A,g as j,l as c,E as b,u as te,r as _,p as oe,j as V,x as k,z as M,W as ae,v as q,Y as L}from"./index-DaP6hnmm.js";import{C as ie}from"./copy-bjFRgEY8.js";import{F as se}from"./file-C928Lhos.js";import{E as re,T as ne}from"./trash-JuhqIjo3.js";const C=P("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const le=P("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const de=P("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const ge=P("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const I=P("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const K=P("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),ce={class:"overflow-x-auto"},ue=E({__name:"DataTable",props:{title:{},headers:{}},setup(T){const h=U("isDarkMode");return(i,a)=>(y(),x("div",{class:o(["rounded-lg shadow-sm overflow-hidden transition-all duration-300",[t(h)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[e("div",{class:o(["px-6 py-4 border-b",[t(h)?"border-gray-700":"border-gray-200"]])},[e("h3",{class:o(["text-lg font-medium",[t(h)?"text-white":"text-gray-800"]])},s(i.title),3)],2),e("div",ce,[e("table",{class:o(["min-w-full divide-y",[t(h)?"divide-gray-700":"divide-gray-200"]])},[e("thead",{class:o([t(h)?"bg-gray-900/50":"bg-gray-50"])},[e("tr",null,[(y(!0),x(F,null,A(i.headers,v=>(y(),x("th",{key:v,class:o(["px-6 py-3.5 text-left text-xs font-medium uppercase tracking-wider",[t(h)?"text-gray-400":"text-gray-500"]])},s(v),3))),128))])],2),e("tbody",{class:o([t(h)?"bg-gray-800/50 divide-y divide-gray-700":"bg-white divide-y divide-gray-200"])},[H(i.$slots,"body")],2)],2)]),H(i.$slots,"footer")],2))}}),pe={class:"flex items-center space-x-2"},xe=["disabled"],ye={class:"flex items-center space-x-1"},he=["onClick"],fe=["disabled"],me=E({__name:"DataPagination",props:{currentPage:{},pageSize:{},total:{}},emits:["page-change"],setup(T){const h=T,i=U("isDarkMode"),a=j(()=>Math.ceil(h.total/h.pageSize)),v=j(()=>{const d=h.currentPage,p=a.value,g=2,f=[];f.push(1);const u=Math.max(2,d-g),w=Math.min(p-1,d+g);u>2&&f.push("...");for(let m=u;m<=w;m++)f.push(m);return w<p-1&&f.push("..."),p>1&&f.push(p),f});return(d,p)=>(y(),x("div",{class:o(["mt-4 flex items-center justify-between px-6 py-4 border-t",[t(i)?"border-gray-700":"border-gray-200"]])},[e("div",{class:o(["flex items-center text-sm",[t(i)?"text-gray-400":"text-gray-500"]])}," 显示第 "+s((d.currentPage-1)*d.pageSize+1)+" 到 "+s(Math.min(d.currentPage*d.pageSize,d.total))+" 条,共 "+s(d.total)+" 条 ",3),e("div",pe,[e("button",{onClick:p[0]||(p[0]=g=>d.$emit("page-change",d.currentPage-1)),disabled:d.currentPage===1,class:o(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[t(i)?d.currentPage===1?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-gray-300 hover:bg-gray-700":d.currentPage===1?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])},[c(t(de),{class:"w-4 h-4"}),p[2]||(p[2]=b(" 上一页 ",-1))],10,xe),e("div",ye,[(y(!0),x(F,null,A(v.value,g=>(y(),x(F,{key:g},[g!=="..."?(y(),x("button",{key:0,onClick:f=>d.$emit("page-change",g),class:o(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[d.currentPage===g?"bg-indigo-600 text-white":t(i)?"bg-gray-800 text-gray-300 hover:bg-gray-700":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])},s(g),11,he)):(y(),x("span",{key:1,class:o(["px-2",[t(i)?"text-gray-400":"text-gray-500"]])}," ... ",2))],64))),128))]),e("button",{onClick:p[1]||(p[1]=g=>d.$emit("page-change",d.currentPage+1)),disabled:d.currentPage>=a.value,class:o(["inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200",[t(i)?d.currentPage>=a.value?"bg-gray-800 text-gray-600 cursor-not-allowed":"bg-gray-800 text-gray-300 hover:bg-gray-700":d.currentPage>=a.value?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-100 text-gray-700 hover:bg-gray-200"]])},[p[3]||(p[3]=b(" 下一页 ",-1)),c(t(le),{class:"w-4 h-4"})],10,fe)])],2))}}),be={class:"p-6 overflow-y-auto custom-scrollbar"},ve={class:"mb-8"},we={class:"flex flex-1 gap-4 w-full sm:w-auto"},_e={class:"relative flex-1"},ke=["placeholder"],Me={class:"px-6 py-4 whitespace-nowrap"},Ce={class:"flex items-center"},Pe={class:"px-6 py-4"},$e={class:"flex items-center group relative"},Se=["title"],ze={class:"absolute left-0 -top-2 -translate-y-full opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none"},Fe={class:"bg-gray-900 text-white Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
.animate-modal-scale{animation:modal-scale .3s ease-out}@keyframes modal-scale{0%{transform:scale(.95);opacity:0}to{transform:scale(1);opacity:1}}input:focus{transform:scale(1.002)}
|
||||
@@ -1 +0,0 @@
|
||||
import{G as y,r as u,d as b,u as v,a as w,b as x,e,n as l,g as o,i as h,h as k,l as S,v as A,q as V,t as D,x as B,A as P,y as _,_ as j}from"./index-EADe6V-l.js";import{B as M}from"./box-brjUM9cP.js";const z=y("adminData",()=>{const d=u(localStorage.getItem("adminPassword")||"");function n(a){d.value=a,localStorage.setItem("token",a)}return{adminPassword:d,updateAdminPwd:n}}),I={class:"mx-auto h-16 w-16 relative"},L={class:"rounded-md shadow-sm -space-y-px"},N=["disabled"],T=b({__name:"LoginView",setup(d){const n=v(),a=u(""),i=u(!1),s=B("isDarkMode"),c=z(),p=()=>{let r=!0;return a.value?a.value.length<6&&(n.showAlert("密码长度至少为6位","error"),r=!1):(n.showAlert("无效的密码","error"),r=!1),r},m=P(),f=async()=>{if(p()){_.post("/admin/login",{password:a.value}).then(r=>{c.updateAdminPwd(r.detail.token),m.push("/admin")}).catch(r=>{n.showAlert(r.response.data.detail,"error")}),i.value=!0;try{await new Promise(r=>setTimeout(r,2e3))}catch{}finally{i.value=!1}}};return(r,t)=>(w(),x("div",{class:l(["min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8 transition-colors duration-200 relative overflow-hidden",o(s)?"bg-gray-900":"bg-gray-50"])},[t[6]||(t[6]=e("div",{class:"absolute inset-0 z-0"},[e("div",{class:"cyber-grid"}),e("div",{class:"floating-particles"})],-1)),e("div",{class:l(["max-w-md w-full space-y-8 backdrop-blur-lg bg-opacity-20 p-8 rounded-xl border border-opacity-20",[o(s)?"bg-gray-800 border-gray-600":"bg-white/70 border-gray-200"]])},[e("div",null,[e("div",I,[t[1]||(t[1]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 rounded-full animate-spin-slow"},null,-1)),t[2]||(t[2]=e("div",{class:"absolute -inset-2 bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 rounded-full opacity-50 blur-md animate-pulse"},null,-1)),e("div",{class:l(["absolute inset-1 rounded-full flex items-center justify-center",o(s)?"bg-gray-800":"bg-white"])},[h(o(M),{class:l(["h-8 w-8",o(s)?"text-cyan-400":"text-cyan-600"])},null,8,["class"])],2)]),e("h2",{class:l(["mt-6 text-center text-3xl font-extrabold",o(s)?"text-white":"text-gray-900"])}," 登录 ",2)]),e("form",{class:"mt-8 space-y-6",onSubmit:k(f,["prevent"])},[t[5]||(t[5]=e("input",{type:"hidden",name:"remember",value:"true"},null,-1)),e("div",L,[e("div",null,[t[3]||(t[3]=e("label",{for:"password",class:"sr-only"},"密码",-1)),S(e("input",{id:"password",name:"password",type:"password",autocomplete:"current-password",required:"","onUpdate:modelValue":t[0]||(t[0]=g=>a.value=g),class:l(["appearance-none rounded-t-md relative block w-full px-4 py-3 border transition-all duration-200 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 focus:z-10 sm:text-sm backdrop-blur-sm",o(s)?"bg-gray-800/50 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"bg-white/50 border-gray-300 text-gray-900 hover:border-gray-400"]),placeholder:"密码"},null,2),[[A,a.value]])])]),e("div",null,[e("button",{type:"submit",class:l(["group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-md text-white transition-all duration-300 transform hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 shadow-lg hover:shadow-cyan-500/50",o(s)?"bg-gradient-to-r from-cyan-500 to-purple-500 hover:from-cyan-600 hover:to-purple-600":"bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-700 hover:to-purple-700",i.value?"opacity-75 cursor-not-allowed":""]),disabled:i.value},[t[4]||(t[4]=e("span",{class:"absolute left-0 inset-y-0 flex items-center pl-3"},null,-1)),V(" "+D(i.value?"登录中...":"登录"),1)],10,N)])],32)],2)],2))}}),E=j(T,[["__scopeId","data-v-66eb7914"]]);export{E as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{Q as y,r as c,a0 as u,g as b,d as w,p as x,a as h,o as S,b as e,n as d,e as i,i as A,l as k,h as I,x as D,z as N,E as T,t as _,a1 as E,I as M,_ as O}from"./index-DaP6hnmm.js";import{B as V}from"./box-C2OkK29z.js";const j=y("admin",()=>{const p=c(localStorage.getItem(u.ADMIN_PASSWORD)||""),s=c(localStorage.getItem(u.TOKEN)||""),a=c(!1),l=c(null),n=b(()=>a.value&&!!s.value),f=o=>{p.value=o,localStorage.setItem(u.ADMIN_PASSWORD,o)},g=o=>{s.value=o,localStorage.setItem(u.TOKEN,o)},m=o=>{l.value=o,a.value=!0,g(o.token)};return{adminPassword:p,token:s,isLoggedIn:a,userInfo:l,isAuthenticated:n,updateAdminPassword:f,setToken:g,setUserInfo:m,login:o=>{m(o)},logout:()=>{p.value="",s.value="",a.value=!1,l.value=null,localStorage.removeItem(u.ADMIN_PASSWORD),localStorage.removeItem(u.TOKEN)},initAuth:()=>{const o=localStorage.getItem(u.TOKEN);o&&(s.value=o,a.value=!0)}}}),B=j,K={class:"mx-auto h-16 w-16 relative"},P={class:"rounded-md shadow-sm -space-y-px"},R=["disabled"],z=w({__name:"LoginView",setup(p){const s=x(),a=c(""),l=c(!1),n=A("isDarkMode"),f=B(),g=()=>{let r=!0;return a.value?a.value.length<6&&(s.showAlert("密码长度至少为6位","error"),r=!1):(s.showAlert("无效的密码","error"),r=!1),r},m=M(),v=async()=>{if(g()){l.value=!0;try{const r=await E.login(a.value);r.detail?.token?(f.setToken(r.detail.token),m.push("/admin")):s.showAlert("登录失败:未获取到有效令牌","error")}catch(r){const t=r&&typeof r=="object"&&"response"in r&&r.response?.data?.detail||"登录失败";s.showAlert(t,"error")}finally{l.value=!1}}};return(r,t)=>(S(),h("div",{class:d(["min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8 transition-colors duration-200 relative overflow-hidden",i(n)?"bg-gray-900":"bg-gray-50"])},[t[6]||(t[6]=e("div",{class:"absolute inset-0 z-0"},[e("div",{class:"cyber-grid"}),e("div",{class:"floating-particles"})],-1)),e("div",{class:d(["max-w-md w-full space-y-8 backdrop-blur-lg bg-opacity-20 p-8 rounded-xl border border-opacity-20",[i(n)?"bg-gray-800 border-gray-600":"bg-white/70 border-gray-200"]])},[e("div",null,[e("div",K,[t[1]||(t[1]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 rounded-full animate-spin-slow"},null,-1)),t[2]||(t[2]=e("div",{class:"absolute -inset-2 bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 rounded-full opacity-50 blur-md animate-pulse"},null,-1)),e("div",{class:d(["absolute inset-1 rounded-full flex items-center justify-center",i(n)?"bg-gray-800":"bg-white"])},[k(i(V),{class:d(["h-8 w-8",i(n)?"text-cyan-400":"text-cyan-600"])},null,8,["class"])],2)]),e("h2",{class:d(["mt-6 text-center text-3xl font-extrabold",i(n)?"text-white":"text-gray-900"])}," 登录 ",2)]),e("form",{class:"mt-8 space-y-6",onSubmit:I(v,["prevent"])},[t[5]||(t[5]=e("input",{type:"hidden",name:"remember",value:"true"},null,-1)),e("div",P,[e("div",null,[t[3]||(t[3]=e("label",{for:"password",class:"sr-only"},"密码",-1)),D(e("input",{id:"password",name:"password",type:"password",autocomplete:"current-password",required:"","onUpdate:modelValue":t[0]||(t[0]=o=>a.value=o),class:d(["appearance-none rounded-t-md relative block w-full px-4 py-3 border transition-all duration-200 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 focus:z-10 sm:text-sm backdrop-blur-sm",i(n)?"bg-gray-800/50 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"bg-white/50 border-gray-300 text-gray-900 hover:border-gray-400"]),placeholder:"密码"},null,2),[[N,a.value]])])]),e("div",null,[e("button",{type:"submit",class:d(["group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-md text-white transition-all duration-300 transform hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 shadow-lg hover:shadow-cyan-500/50",i(n)?"bg-gradient-to-r from-cyan-500 to-purple-500 hover:from-cyan-600 hover:to-purple-600":"bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-700 hover:to-purple-700",l.value?"opacity-75 cursor-not-allowed":""]),disabled:l.value},[t[4]||(t[4]=e("span",{class:"absolute left-0 inset-y-0 flex items-center pl-3"},null,-1)),T(" "+_(l.value?"登录中...":"登录"),1)],10,R)])],32)],2)],2))}}),C=O(z,[["__scopeId","data-v-894571a2"]]);export{C as default};
|
||||
@@ -0,0 +1 @@
|
||||
@keyframes spin-894571a2{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin-slow[data-v-894571a2]{animation:spin-894571a2 8s linear infinite}.fade-enter-active[data-v-894571a2],.fade-leave-active[data-v-894571a2]{transition:opacity .3s ease}.fade-enter-from[data-v-894571a2],.fade-leave-to[data-v-894571a2]{opacity:0}input[data-v-894571a2]:focus{box-shadow:0 0 15px #6366f14d}button[data-v-894571a2]:active:not(:disabled){transform:scale(.98)}.cyber-grid[data-v-894571a2]{background-image:linear-gradient(transparent 95%,#6366f11a 50%),linear-gradient(90deg,transparent 95%,rgba(99,102,241,.1) 50%);background-size:30px 30px;width:100%;height:100%;position:absolute;opacity:.5}.floating-particles[data-v-894571a2]{position:absolute;width:100%;height:100%;background:radial-gradient(circle at center,transparent 0%,transparent 100%);filter:url(#gooey)}.floating-particles[data-v-894571a2]:before,.floating-particles[data-v-894571a2]:after{content:"";position:absolute;width:100%;height:100%;background-image:radial-gradient(circle at center,rgba(99,102,241,.1) 0%,transparent 50%);animation:float-894571a2 20s infinite linear}.floating-particles[data-v-894571a2]:after{animation-delay:-10s;opacity:.5}@keyframes float-894571a2{0%{transform:translate(0) scale(1)}50%{transform:translate(50px,50px) scale(1.5)}to{transform:translate(0) scale(1)}}button[data-v-894571a2]:hover:not(:disabled){box-shadow:0 0 25px #6366f180}.fade-enter-active[data-v-894571a2],.fade-leave-active[data-v-894571a2]{transition:all .5s cubic-bezier(.4,0,.2,1)}
|
||||
@@ -1 +0,0 @@
|
||||
@keyframes spin-66eb7914{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin-slow[data-v-66eb7914]{animation:spin-66eb7914 8s linear infinite}.fade-enter-active[data-v-66eb7914],.fade-leave-active[data-v-66eb7914]{transition:opacity .3s ease}.fade-enter-from[data-v-66eb7914],.fade-leave-to[data-v-66eb7914]{opacity:0}input[data-v-66eb7914]:focus{box-shadow:0 0 15px #6366f14d}button[data-v-66eb7914]:active:not(:disabled){transform:scale(.98)}.cyber-grid[data-v-66eb7914]{background-image:linear-gradient(transparent 95%,#6366f11a 50%),linear-gradient(90deg,transparent 95%,rgba(99,102,241,.1) 50%);background-size:30px 30px;width:100%;height:100%;position:absolute;opacity:.5}.floating-particles[data-v-66eb7914]{position:absolute;width:100%;height:100%;background:radial-gradient(circle at center,transparent 0%,transparent 100%);filter:url(#gooey)}.floating-particles[data-v-66eb7914]:before,.floating-particles[data-v-66eb7914]:after{content:"";position:absolute;width:100%;height:100%;background-image:radial-gradient(circle at center,rgba(99,102,241,.1) 0%,transparent 50%);animation:float-66eb7914 20s infinite linear}.floating-particles[data-v-66eb7914]:after{animation-delay:-10s;opacity:.5}@keyframes float-66eb7914{0%{transform:translate(0) scale(1)}50%{transform:translate(50px,50px) scale(1.5)}to{transform:translate(0) scale(1)}}button[data-v-66eb7914]:hover:not(:disabled){box-shadow:0 0 25px #6366f180}.fade-enter-active[data-v-66eb7914],.fade-leave-active[data-v-66eb7914]{transition:all .5s cubic-bezier(.4,0,.2,1)}
|
||||
@@ -0,0 +1 @@
|
||||
@keyframes spin-slow-2a18d8c8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin-slow[data-v-2a18d8c8]{animation:spin-slow-2a18d8c8 3s linear infinite}
|
||||
@@ -0,0 +1 @@
|
||||
import{c as J,d as G,N,r as R,O as Z,f as ne,y as oe,Q as ie,g as B,U as x,p as se,a as le,o as ue,b as H,l as ce,e as X,n as de,i as fe,t as he,_ as ve}from"./index-DaP6hnmm.js";import{B as ge}from"./box-C2OkK29z.js";const xe=J("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);const He=J("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var D=function(){return D=Object.assign||function(c){for(var u,l=1,f=arguments.length;l<f;l++){u=arguments[l];for(var v in u)Object.prototype.hasOwnProperty.call(u,v)&&(c[v]=u[v])}return c},D.apply(this,arguments)};var F;(function(o){var c=(function(){function a(e,t,r,n){if(this.version=e,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],e<a.MIN_VERSION||e>a.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;for(var s=[],i=0;i<this.size;i++)s.push(!1);for(var i=0;i<this.size;i++)this.modules.push(s.slice()),this.isFunction.push(s.slice());this.drawFunctionPatterns();var h=this.addEccAndInterleave(r);if(this.drawCodewords(h),n==-1)for(var p=1e9,i=0;i<8;i++){this.applyMask(i),this.drawFormatBits(i);var M=this.getPenaltyScore();M<p&&(n=i,p=M),this.applyMask(i)}f(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}return a.encodeText=function(e,t){var r=o.QrSegment.makeSegments(e);return a.encodeSegments(r,t)},a.encodeBinary=function(e,t){var r=o.QrSegment.makeBytes(e);return a.encodeSegments([r],t)},a.encodeSegments=function(e,t,r,n,s,i){if(r===void 0&&(r=1),n===void 0&&(n=40),s===void 0&&(s=-1),i===void 0&&(i=!0),!(a.MIN_VERSION<=r&&r<=n&&n<=a.MAX_VERSION)||s<-1||s>7)throw new RangeError("Invalid value");var h,p;for(h=r;;h++){var M=a.getNumDataCodewords(h,t)*8,w=v.getTotalBits(e,h);if(w<=M){p=w;break}if(h>=n)throw new RangeError("Data too long")}for(var C=0,S=[a.Ecc.MEDIUM,a.Ecc.QUARTILE,a.Ecc.HIGH];C<S.length;C++){var m=S[C];i&&p<=a.getNumDataCodewords(h,m)*8&&(t=m)}for(var g=[],E=0,P=e;E<P.length;E++){var y=P[E];u(y.mode.modeBits,4,g),u(y.numChars,y.mode.numCharCountBits(h),g);for(var b=0,A=y.getData();b<A.length;b++){var O=A[b];g.push(O)}}f(g.length==p);var L=a.getNumDataCodewords(h,t)*8;f(g.length<=L),u(0,Math.min(4,L-g.length),g),u(0,(8-g.length%8)%8,g),f(g.length%8==0);for(var I=236;g.length<L;I^=253)u(I,8,g);for(var T=[];T.length*8<g.length;)T.push(0);return g.forEach(function(k,Q){return T[Q>>>3]|=k<<7-(Q&7)}),new a(h,t,T,s)},a.prototype.getModule=function(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]},a.prototype.getModules=function(){return this.modules},a.prototype.drawFunctionPatterns=function(){for(var e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var t=this.getAlignmentPatternPositions(),r=t.length,e=0;e<r;e++)for(var n=0;n<r;n++)e==0&&n==0||e==0&&n==r-1||e==r-1&&n==0||this.drawAlignmentPattern(t[e],t[n]);this.drawFormatBits(0),this.drawVersion()},a.prototype.drawFormatBits=function(e){for(var t=this.errorCorrectionLevel.formatBits<<3|e,r=t,n=0;n<10;n++)r=r<<1^(r>>>9)*1335;var s=(t<<10|r)^21522;f(s>>>15==0);for(var n=0;n<=5;n++)this.setFunctionModule(8,n,l(s,n));this.setFunctionModule(8,7,l(s,6)),this.setFunctionModule(8,8,l(s,7)),this.setFunctionModule(7,8,l(s,8));for(var n=9;n<15;n++)this.setFunctionModule(14-n,8,l(s,n));for(var n=0;n<8;n++)this.setFunctionModule(this.size-1-n,8,l(s,n));for(var n=8;n<15;n++)this.setFunctionModule(8,this.size-15+n,l(s,n));this.setFunctionModule(8,this.size-8,!0)},a.prototype.drawVersion=function(){if(!(this.version<7)){for(var e=this.version,t=0;t<12;t++)e=e<<1^(e>>>11)*7973;var r=this.version<<12|e;f(r>>>18==0);for(var t=0;t<18;t++){var n=l(r,t),s=this.size-11+t%3,i=Math.floor(t/3);this.setFunctionModule(s,i,n),this.setFunctionModule(i,s,n)}}},a.prototype.drawFinderPattern=function(e,t){for(var r=-4;r<=4;r++)for(var n=-4;n<=4;n++){var s=Math.max(Math.abs(n),Math.abs(r)),i=e+n,h=t+r;0<=i&&i<this.size&&0<=h&&h<this.size&&this.setFunctionModule(i,h,s!=2&&s!=4)}},a.prototype.drawAlignmentPattern=function(e,t){for(var r=-2;r<=2;r++)for(var n=-2;n<=2;n++)this.setFunctionModule(e+n,t+r,Math.max(Math.abs(n),Math.abs(r))!=1)},a.prototype.setFunctionModule=function(e,t,r){this.modules[t][e]=r,this.isFunction[t][e]=!0},a.prototype.addEccAndInterleave=function(e){var t=this.version,r=this.errorCorrectionLevel;if(e.length!=a.getNumDataCodewords(t,r))tLine truncated
|
||||
@@ -1,66 +0,0 @@
|
||||
var De=Object.defineProperty;var Pe=(d,e,t)=>e in d?De(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var v=(d,e,t)=>Pe(d,typeof e!="symbol"?e+"":e,t);import{c as _e,_ as Fe,u as Ze,B as Oe,r as D,o as Ue,w as Qe,f as He,b as L,e as p,n as b,g as f,i as $,t as j,h as Ne,l as Ve,v as Ge,k as ee,j as Q,q as Z,T as le,C as We,z as Xe,a as C,X as xe,s as Ke,F as Je,p as Ye,A as et,x as tt,y as nt}from"./index-EADe6V-l.js";import{c as H,u as st,S as it,C as rt,a as ot,Q as lt,E as at}from"./fileData-B92rnDh4.js";import{B as ct}from"./box-brjUM9cP.js";import{F as ke}from"./file-CTH8PUKS.js";import{H as ut,T as pt}from"./trash-COYxyedR.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ht=_e("ArrowRightIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const be=_e("DownloadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);var Re={exports:{}};(function(d,e){(function(t,n){n()})(H,function(){function t(c,l){return typeof l>"u"?l={autoBom:!1}:typeof l!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),l={autoBom:!l}),l.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function n(c,l,u){var h=new XMLHttpRequest;h.open("GET",c),h.responseType="blob",h.onload=function(){a(h.response,l,u)},h.onerror=function(){console.error("could not download file")},h.send()}function s(c){var l=new XMLHttpRequest;l.open("HEAD",c,!1);try{l.send()}catch{}return 200<=l.status&&299>=l.status}function i(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var l=document.createEvent("MouseEvents");l.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(l)}}var r=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof H=="object"&&H.global===H?H:void 0,o=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=r.saveAs||(typeof window!="object"||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(c,l,u){var h=r.URL||r.webkitURL,g=document.createElement("a");l=l||c.name||"download",g.download=l,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?i(g):s(g.href)?n(c,l,u):i(g,g.target="_blank")):(g.href=h.createObjectURL(c),setTimeout(function(){h.revokeObjectURL(g.href)},4e4),setTimeout(function(){i(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,l,u){if(l=l||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,u),l);else if(s(c))n(c,l,u);else{var h=document.createElement("a");h.href=c,h.target="_blank",setTimeout(function(){i(h)})}}:function(c,l,u,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof c=="string")return n(c,l,u);var g=c.type==="application/octet-stream",w=/constructor/i.test(r.HTMLElement)||r.safari,R=/CriOS\/[\d]+/.test(navigator.userAgent);if((R||g&&w||o)&&typeof FileReader<"u"){var T=new FileReader;T.onloadend=function(){var E=T.result;E=R?E:E.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=E:location=E,h=null},T.readAsDataURL(c)}else{var B=r.URL||r.webkitURL,M=B.createObjectURL(c);h?h.location=M:location.href=M,h=null,setTimeout(function(){B.revokeObjectURL(M)},4e4)}});r.saveAs=a.saveAs=a,d.exports=a})})(Re);var dt=Re.exports;function ce(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let F=ce();function Te(d){F=d}const ze=/[&<>"']/,ft=new RegExp(ze.source,"g"),Se=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,gt=new RegExp(Se.source,"g"),xt={"&":"&","<":"<",">":">",'"':""","'":"'"},we=d=>xt[d];function z(d,e){if(e){if(ze.test(d))return d.replace(ft,we)}else if(Se.test(d))return d.replace(gt,we);return d}const kt=/(^|[^\[])\^/g;function y(d,e){let t=typeof d=="string"?d:d.source;e=e||"";const n={replace:(s,i)=>{let r=typeof i=="string"?i:i.source;return r=r.replace(kt,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}function me(d){try{d=encodeURI(d).replace(/%25/g,"%")}catch{return null}return d}const G={exec:()=>null};function ye(d,e){const t=d.replace(/\|/g,(i,r,o)=>{let a=!1,c=r;for(;--c>=0&&o[c]==="\\";)a=!a;return a?"|":" |"}),n=t.split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function N(d,e,t){const n=d.length;if(n===0)return"";let s=0;for(;s<n;){const i=d.charAt(n-s-1);if(i===e&&!t)s++;else if(i!==e&&t)s++;else break}return d.slice(0,n-s)}function bt(d,e){if(d.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<d.length;n++)if(d[n]==="\\")n++;else if(d[n]===e[0])t++;else if(d[n]===e[1]&&(t--,t<0))return n;return-1}function ve(d,e,t,n){const s=e.href,i=e.title?z(e.title):null,r=d[1].replace(/\\([\[\]])/g,"$1");if(d[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:t,href:s,title:i,text:r,tokens:n.inlineTokens(r)};return n.state.inLink=!1,o}return{type:"image",raw:t,href:s,title:i,text:z(r)}}function wt(d,e){const t=d.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
||||
`).map(s=>{const i=s.match(/^\s+/);if(i===null)return s;const[r]=i;return r.length>=n.length?s.slice(n.length):s}).join(`
|
||||
`)}class ne{constructor(e){v(this,"options");v(this,"rules");v(this,"lexer");this.options=e||F}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:N(n,`
|
||||
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=wt(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const s=N(n,"#");(this.options.pedantic||!s||/ $/.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:N(t[0],`
|
||||
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=N(t[0],`
|
||||
`).split(`
|
||||
`),s="",i="";const r=[];for(;n.length>0;){let o=!1;const a=[];let c;for(c=0;c<n.length;c++)if(/^ {0,3}>/.test(n[c]))a.push(n[c]),o=!0;else if(!o)a.push(n[c]);else break;n=n.slice(c);const l=a.join(`
|
||||
`),u=l.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
||||
$1`).replace(/^ {0,3}>[ \t]?/gm,"");s=s?`${s}
|
||||
${l}`:l,i=i?`${i}
|
||||
${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,r,!0),this.lexer.state.top=h,n.length===0)break;const g=r[r.length-1];if((g==null?void 0:g.type)==="code")break;if((g==null?void 0:g.type)==="blockquote"){const w=g,R=w.raw+`
|
||||
`+n.join(`
|
||||
`),T=this.blockquote(R);r[r.length-1]=T,s=s.substring(0,s.length-w.raw.length)+T.raw,i=i.substring(0,i.length-w.text.length)+T.text;break}else if((g==null?void 0:g.type)==="list"){const w=g,R=w.raw+`
|
||||
`+n.join(`
|
||||
`),T=this.list(R);r[r.length-1]=T,s=s.substring(0,s.length-g.raw.length)+T.raw,i=i.substring(0,i.length-w.raw.length)+T.raw,n=R.substring(r[r.length-1].raw.length).split(`
|
||||
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let o=!1;for(;e;){let a=!1,c="",l="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let u=t[2].split(`
|
||||
`,1)[0].replace(/^\t+/,B=>" ".repeat(3*B.length)),h=e.split(`
|
||||
`,1)[0],g=!u.trim(),w=0;if(this.options.pedantic?(w=2,l=u.trimStart()):g?w=t[1].length+1:(w=t[2].search(/[^ ]/),w=w>4?1:w,l=u.slice(w),w+=t[1].length),g&&/^[ \t]*$/.test(h)&&(c+=h+`
|
||||
`,e=e.substring(h.length+1),a=!0),!a){const B=new RegExp(`^ {0,${Math.min(3,w-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),M=new RegExp(`^ {0,${Math.min(3,w-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),E=new RegExp(`^ {0,${Math.min(3,w-1)}}(?:\`\`\`|~~~)`),O=new RegExp(`^ {0,${Math.min(3,w-1)}}#`),oe=new RegExp(`^ {0,${Math.min(3,w-1)}}<[a-z].*>`,"i");for(;e;){const U=e.split(`
|
||||
`,1)[0];let q;if(h=U,this.options.pedantic?(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),q=h):q=h.replace(/\t/g," "),E.test(h)||O.test(h)||oe.test(h)||B.test(h)||M.test(h))break;if(q.search(/[^ ]/)>=w||!h.trim())l+=`
|
||||
`+q.slice(w);else{if(g||u.replace(/\t/g," ").search(/[^ ]/)>=4||E.test(u)||O.test(u)||M.test(u))break;l+=`
|
||||
`+h}!g&&!h.trim()&&(g=!0),c+=U+`
|
||||
`,e=e.substring(U.length+1),u=q.slice(w)}}i.loose||(o?i.loose=!0:/\n[ \t]*\n[ \t]*$/.test(c)&&(o=!0));let R=null,T;this.options.gfm&&(R=/^\[[ xX]\] /.exec(l),R&&(T=R[0]!=="[ ] ",l=l.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:c,task:!!R,checked:T,loose:!1,text:l,tokens:[]}),i.raw+=c}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let a=0;a<i.items.length;a++)if(this.lexer.state.top=!1,i.items[a].tokens=this.lexer.blockTokens(i.items[a].text,[]),!i.loose){const c=i.items[a].tokens.filter(u=>u.type==="space"),l=c.length>0&&c.some(u=>/\n.*\n/.test(u.raw));i.loose=l}if(i.loose)for(let a=0;a<i.items.length;a++)i.items[a].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),s=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=ye(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
||||
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const o of s)/^ *-+: *$/.test(o)?r.align.push("right"):/^ *:-+: *$/.test(o)?r.align.push("center"):/^ *:-+ *$/.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<n.length;o++)r.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:r.align[o]});for(const o of i)r.rows.push(ye(o,r.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[c]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
||||
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:z(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const r=N(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{const r=bt(t[2],"()");if(r>-1){const a=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);r&&(s=r[1],i=r[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(this.options.pedantic&&!/>$/.test(n)?s=s.slice(1):s=s.slice(1,-1)),ve(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(/\s+/g," "),i=t[s.toLowerCase()];if(!i){const r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return ve(n,i,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const r=[...s[0]].length-1;let o,a,c=r,l=0;const u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(s=u.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(a=[...o].length,s[3]||s[4]){c+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c+l);const h=[...s[0]][0].length,g=e.slice(0,r+s.index+h+a);if(Math.min(r,a)%2){const R=g.slice(1,-1);return{type:"em",raw:g,text:R,tokens:this.lexer.inlineTokens(R)}}const w=g.slice(2,-2);return{type:"strong",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const s=/[^ ]/.test(n),i=/^ /.test(n)&&/ $/.test(n);return s&&i&&(n=n.substring(1,n.length-1)),n=z(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=z(t[1]),s="mailto:"+n):(n=z(t[1]),s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let s,i;if(t[2]==="@")s=z(t[0]),i="mailto:"+s;else{let r;do r=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(r!==t[0]);s=z(t[0]),t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=z(t[0]),{type:"text",raw:t[0],text:n}}}}const mt=/^(?:[ \t]*(?:\n|$))+/,yt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,vt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,X=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$t=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ae=/(?:[*+-]|\d{1,9}[.)])/,Ee=y(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ae).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ue=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_t=/^[^\n]+/,pe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Rt=y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Tt=y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ae).getRegex(),re="address|article|aside|base|basefont|blockquote|body|captLine truncated
|
||||
]`).replace("lheading",Ee).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Le=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,It=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ce=/^( {2,}|\\)\n(?!\s*$)/,Lt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,K="\\p{P}\\p{S}",Ct=y(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,K).getRegex(),Bt=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Mt=y(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,K).getRegex(),jt=y("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,K).getRegex(),qt=y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,K).getRegex(),Dt=y(/\\([punct])/,"gu").replace(/punct/g,K).getRegex(),Pt=y(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ft=y(he).replace("(?:-->|$)","-->").getRegex(),Zt=y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ft).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),se=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ot=y(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",se).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Be=y(/^!?\[(label)\]\[(ref)\]/).replace("label",se).replace("ref",pe).getRegex(),Me=y(/^!?\[(ref)\](?:\[\])?/).replace("ref",pe).getRegex(),Ut=y("reflink|nolink(?!\\()","g").replace("reflink",Be).replace("nolink",Me).getRegex(),fe={_backpedal:G,anyPunctuation:Dt,autolink:Pt,blockSkip:Bt,br:Ce,code:It,del:G,emStrongLDelim:Mt,emStrongRDelimAst:jt,emStrongRDelimUnd:qt,escape:Le,link:Ot,nolink:Me,punctuation:Ct,reflink:Be,reflinkSearch:Ut,tag:Zt,text:Lt,url:G},Qt={...fe,link:y(/^!?\[(label)\]\((.*?)\)/).replace("label",se).getRegex(),reflink:y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se).getRegex()},ae={...fe,escape:y(Le).replace("])","~|])").getRegex(),url:y(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ht={...ae,br:y(Ce).replace("{2,}","*").getRegex(),text:y(ae.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},te={normal:de,gfm:At,pedantic:Et},V={normal:fe,gfm:ae,breaks:Ht,pedantic:Qt};class S{constructor(e){v(this,"tokens");v(this,"options");v(this,"state");v(this,"tokenizer");v(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||F,this.options.tokenizer=this.options.tokenizer||new ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:te.normal,inline:V.normal};this.options.pedantic?(t.block=te.pedantic,t.inline=V.pedantic):this.options.gfm&&(t.block=te.gfm,this.options.breaks?t.inline=V.breaks:t.inline=V.gfm),this.tokenizer.rules=t}static get rules(){return{block:te,inline:V}}static lex(e,t){return new S(t).lex(e)}static lexInline(e,t){return new S(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
||||
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.options.pedantic&&(e=e.replace(/\t/g," ").replace(/^ +$/gm,""));let s,i,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))){if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length),s.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
||||
`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
||||
`+s.raw,i.text+=`
|
||||
`+s.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
||||
`+s.raw,i.text+=`
|
||||
`+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const a=e.slice(1);let c;this.options.extensions.startBlock.forEach(l=>{c=l.call({lexer:this},a),typeof c=="number"&&c>=0&&(o=Math.min(o,c))}),o<1/0&&o>=0&&(r=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){i=t[t.length-1],n&&(i==null?void 0:i.type)==="paragraph"?(i.raw+=`
|
||||
`+s.raw,i.text+=`
|
||||
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
||||
`+s.raw,i.text+=`
|
||||
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,i,r=e,o,a,c;if(this.tokens.links){const l=Object.keys(this.tokens.links);if(l.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(c=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(l=>(n=l.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,r,c)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let l=1/0;const u=e.slice(1);let h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},u),typeof h=="number"&&h>=0&&(l=Math.min(l,h))}),l<1/0&&l>=0&&(i=e.substring(0,l+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(c=n.raw.slice(-1)),a=!0,s=t[t.length-1],s&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return t}}class ie{constructor(e){v(this,"options");v(this,"parser");this.options=e||F}space(e){return""}code({text:e,lang:t,escaped:n}){var r;const s=(r=(t||"").match(/^\S*/))==null?void 0:r[0],i=e.replace(/\n$/,"")+`
|
||||
`;return s?'<pre><code class="language-'+z(s)+'">'+(n?i:z(i,!0))+`</code></pre>
|
||||
`:"<pre><code>"+(n?i:z(i,!0))+`</code></pre>
|
||||
`}blockquote({tokens:e}){return`<blockquote>
|
||||
${this.parser.parse(e)}</blockquote>
|
||||
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
||||
`}hr(e){return`<hr>
|
||||
`}list(e){const t=e.ordered,n=e.start;let s="";for(let o=0;o<e.items.length;o++){const a=e.items[o];s+=this.listitem(a)}const i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
||||
`+s+"</"+i+`>
|
||||
`}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
||||
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
||||
`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let s="";for(let i=0;i<e.rows.length;i++){const r=e.rows[i];n="";for(let o=0;o<r.length;o++)n+=this.tablecell(r[o]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
||||
<thead>
|
||||
`+t+`</thead>
|
||||
`+s+`</table>
|
||||
`}tablerow({text:e}){return`<tr>
|
||||
${e}</tr>
|
||||
`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
||||
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),i=me(e);if(i===null)return s;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+s+"</a>",r}image({href:e,title:t,text:n}){const s=me(e);if(s===null)return n;e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class ge{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class A{constructor(e){v(this,"options");v(this,"renderer");v(this,"textRenderer");this.options=e||F,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ge}static parse(e,t){return new A(t).parse(e)}static parseInline(e,t){return new A(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=a||"";continue}}const r=i;switch(r.type){case"space":{n+=this.renderer.space(r);continue}case"hr":{n+=this.renderer.hr(r);continue}case"heading":{n+=this.renderer.heading(r);continue}case"code":{n+=this.renderer.code(r);continue}case"table":{n+=this.renderer.table(r);continue}case"blockquote":{n+=this.renderer.blockquote(r);continue}case"list":{n+=this.renderer.list(r);continue}case"html":{n+=this.renderer.html(r);continue}case"paragraph":{n+=this.renderer.paragraph(r);continue}case"text":{let o=r,a=this.renderer.text(o);for(;s+1<e.length&&e[s+1].type==="text";)o=e[++s],a+=`
|
||||
`+this.renderer.text(o);t?n+=this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a}]}):n+=a;continue}default:{const o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}const r=i;switch(r.type){case"escape":{n+=t.text(r);break}case"html":{n+=t.html(r);break}case"link":{n+=t.link(r);break}case"image":{n+=t.image(r);break}case"strong":{n+=t.strong(r);break}case"em":{n+=t.em(r);break}case"codespan":{n+=t.codespan(r);break}case"br":{n+=t.br(r);break}case"del":{n+=t.del(r);break}case"text":{n+=t.text(r);break}default:{const o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}}class W{constructor(e){v(this,"options");v(this,"block");this.options=e||F}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?S.lex:S.lexInline}provideParser(){return this.block?A.parse:A.parseInline}}v(W,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Nt{constructor(...e){v(this,"defaults",ce());v(this,"options",this.setOptions);v(this,"parse",this.parseMarkdown(!0));v(this,"parseInline",this.parseMarkdown(!1));v(this,"Parser",A);v(this,"Renderer",ie);v(this,"TextRenderer",ge);v(this,"Lexer",S);v(this,"Tokenizer",ne);v(this,"Hooks",W);this.use(...e)}walkTokens(e,t){var s,i;let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const o=r;for(const a of o.header)n=n.concat(this.walkTokens(a.tokens,t));for(const a of o.rows)for(const c of a)n=n.concat(this.walkTokens(c.tokens,t));break}case"list":{const o=r;n=n.concat(this.walkTokens(o.items,t));break}default:{const o=r;(i=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const c=o[a].flat(1/0);n=n.concat(this.walkTokens(c,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const r=t.renderers[i.name];r?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[i.level];r?r.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){const i=this.defaults.renderer||new ie(this.defaults);for(const r in n.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const o=r,a=n.renderer[o],c=i[o];i[o]=(...l)=>{let u=a.apply(i,l);return u===!1&&(u=c.apply(i,l)),u||""}}s.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new ne(this.defaults);for(const r in n.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const o=r,a=n.tokenizer[o],c=i[o];i[o]=(...l)=>{let u=a.apply(i,l);return u===!1&&(u=c.apply(i,l)),u}}s.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new W;for(const r in n.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const o=r,a=n.hooks[o],c=i[o];W.passThroughHooks.has(r)?i[o]=l=>{if(this.defaults.async)return Promise.resolve(a.call(i,l)).then(h=>c.call(i,h));const u=a.call(i,l);return c.call(i,u)}:i[o]=(...l)=>{let u=a.apply(i,l);return u===!1&&(u=c.apply(i,l)),u}}s.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return S.lex(e,t??this.defaults)}parser(e,t){return A.parse(e,t??this.defaults)}parseMarkdown(e){return(n,s)=>{const i={...s},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. RemovLine truncated
|
||||
Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+z(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}}const P=new Nt;function m(d,e){return P.parse(d,e)}m.options=m.setOptions=function(d){return P.setOptions(d),m.defaults=P.defaults,Te(m.defaults),m};m.getDefaults=ce;m.defaults=F;m.use=function(...d){return P.use(...d),m.defaults=P.defaults,Te(m.defaults),m};m.walkTokens=function(d,e){return P.walkTokens(d,e)};m.parseInline=P.parseInline;m.Parser=A;m.parser=A.parse;m.Renderer=ie;m.TextRenderer=ge;m.Lexer=S;m.lexer=S.lex;m.Tokenizer=ne;m.Hooks=W;m.parse=m;m.options;m.setOptions;m.use;m.walkTokens;m.parseInline;A.parse;S.lex;const Vt={class:"min-h-screen flex items-center justify-center p-4 overflow-hidden transition-colors duration-300"},Gt={class:"w-full max-w-md relative z-10"},Wt={class:"p-8"},Xt={class:"flex justify-center mb-8"},Kt={class:"rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow"},Jt={class:"rounded-full bg-gray-900 p-2"},Yt={class:"mb-6 relative"},en={class:"relative"},tn=["readonly"],nn={key:0,class:"absolute inset-y-0 right-0 flex items-center pr-3"},sn=["disabled"],rn={class:"flex items-center justify-center relative z-10"},on={class:"mt-6 text-center"},ln={class:"flex-grow overflow-y-auto p-6"},an={class:"flex-shrink-0 mr-4"},cn={class:"flex-grow min-w-0 mr-4"},un={class:"flex-shrink-0 flex space-x-2"},pn=["onClick"],hn=["onClick"],dn=["onClick"],fn={key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},gn={class:"space-y-4"},xn={class:"flex items-center"},kn={class:"flex items-center"},bn={class:"flex items-center"},wn={class:"flex items-center"},mn={key:0,class:"ml-2"},yn={key:1},vn=["href"],$n={class:"mt-6 flex flex-col items-center"},_n={class:"bg-white p-2 rounded-lg shadow-md"},Rn={key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},Tn={class:"flex justify-between items-center mb-4"},zn=["innerHTML"],Sn={__name:"RetrievewFileView",setup(d){const e=Ze(),t=window.location.origin,n=et(),s=tt("isDarkMode"),i=st(),{receiveData:r}=Oe(i),o=D(""),a=D({readonly:!1,loading:!1}),c=D(!1),l=D(""),u=D(null),h=D(!1),g=We(),w=r,R=JSON.parse(localStorage.getItem("config")||"{}");Ue(()=>{const k=g.query.code;k&&(o.value=k)}),Qe(o,k=>{k.length===5&&T()});const T=async()=>{if(o.value.length!==5){e.showAlert("请输入5位取件码","error");return}a.value.readonly=!0,a.value.loading=!0;try{const k=await nt.post("/share/select/",{code:o.value});if(k.code===200)if(k.detail){const x=k.detail.text.startsWith("/share/download")||k.detail.name!=="Text",I={id:Date.now(),code:k.detail.code,filename:k.detail.name,size:B(k.detail.size),downloadUrl:x?k.detail.text:null,content:x?null:k.detail.text,date:new Date().toLocaleString()};let _=!0;i.receiveData.forEach(Y=>{if(Y.code===I.code){_=!1;return}}),_&&i.addReceiveData(I),x?h.value=!0:(J.value=!0,u.value=I),e.showAlert("文件获取成功","success")}else e.showAlert("无效的取件码","error");else e.showAlert(k.detail||"获取文件失败","error")}catch(k){console.error("取件失败:",k),e.showAlert("取件失败,请稍后重试","error")}finally{a.value.readonly=!1,a.value.loading=!1,o.value=""}},B=k=>{if(k===0)return"0 Bytes";const x=1024,I=["Bytes","KB","MB","GB","TB"],_=Math.floor(Math.log(k)/Math.log(x));return parseFloat((k/Math.pow(x,_)).toFixed(2))+" "+I[_]},M=k=>{u.value=k},E=k=>{const x=w.value.findIndex(I=>I.id===k);x!==-1&&i.deleteReceiveData(x)},O=()=>{h.value=!h.value},oe=()=>{n.push("/send")},U=k=>k.downloadUrl?`${t}${k.downloadUrl}`:`${t}?code=${k.code}`,q=k=>{if(console.log(k),k.downloadUrl)window.open(`${k.downloadUrl.startsWith("http")?"":t}${k.downloadUrl}`,"_blank");else if(k.content){const x=new Blob([k.content],{type:"text/plain;charset=utf-8"});dt.saveAs(x,`${k.filename}.txt`)}},J=D(!1),je=He(()=>u.value&&u.value.content?m(u.value.content):""),qe=()=>{J.value=!0};return(k,x)=>{const I=Xe("router-link");return C(),L("div",Vt,[p("div",Gt,[p("div",{class:b(["rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300",[f(s)?"bg-gray-800 bg-opacity-50 backdrop-filter backdrop-blur-xl border-gray-700":"bg-white border-gray-200"]])},[p("div",Wt,[p("div",Xt,[p("div",Kt,[p("div",Jt,[$(f(ct),{class:"w-8 h-8 text-white"})])])]),p("h2",{onClick:oe,class:b(["text-3xl cursor-pointer font-extrabold text-center mb-6",[f(s)?"text-transparent bg-clip-text bg-gradient-to-r from-indigo-300 via-purple-300 to-pink-300":"text-indigo-600"]])},j(f(R).name),3),p("form",{onSubmit:Ne(T,["prevent"])},[p("div",Yt,[p("label",{for:"code",class:b(["block text-sm font-medium mb-2",[f(s)?"text-gray-300":"text-gray-800"]])},"取件码",2),p("div",en,[Ve(p("input",{id:"code","onUpdate:modelValue":x[0]||(x[0]=_=>o.value=_),type:"text",class:b(["w-full px-4 py-3 rounded-lg placeholder-gray-400 focus:outline-none focus:ring-2 focusLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
.w-97-100[data-v-8f0be1b0]{width:calc(100% - 1rem)}.drawer-enter-active[data-v-9c6698ec],.drawer-leave-active[data-v-9c6698ec]{transition:transform .3s ease}.drawer-enter-from[data-v-9c6698ec],.drawer-leave-to[data-v-9c6698ec]{transform:translate(100%)}@media(min-width:640px){.sm\:w-120[data-v-9c6698ec]{width:30rem}}.fade-enter-active[data-v-5c3436d6],.fade-leave-active[data-v-5c3436d6]{transition:opacity .3s ease}.fade-enter-from[data-v-5c3436d6],.fade-leave-to[data-v-5c3436d6]{opacity:0}.list-enter-active[data-v-31facf40],.list-leave-active[data-v-31facf40]{transition:all .3s ease}.list-enter-from[data-v-31facf40],.list-leave-to[data-v-31facf40]{opacity:0;transform:translate(30px)}.list-move[data-v-31facf40]{transition:transform .3s ease}.fade-enter-active[data-v-eb3f9cc8],.fade-leave-active[data-v-eb3f9cc8]{transition:opacity .3s ease}.fade-enter-from[data-v-eb3f9cc8],.fade-leave-to[data-v-eb3f9cc8]{opacity:0}.custom-scrollbar[data-v-eb3f9cc8]{scrollbar-width:thin;scrollbar-color:rgba(156,163,175,.3) rgba(243,244,246,.5)}.custom-scrollbar[data-v-eb3f9cc8]::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar[data-v-eb3f9cc8]::-webkit-scrollbar-track{background:#f3f4f680;border-radius:3px}.custom-scrollbar[data-v-eb3f9cc8]::-webkit-scrollbar-thumb{background-color:#9ca3af80;border-radius:3px;-webkit-transition:background-color .3s;transition:background-color .3s}.custom-scrollbar[data-v-eb3f9cc8]::-webkit-scrollbar-thumb:hover{background-color:#9ca3afb3}[data-v-eb3f9cc8] [class*=dark] .custom-scrollbar{scrollbar-color:rgba(75,85,99,.5) rgba(31,41,55,.5)}[data-v-eb3f9cc8] [class*=dark] .custom-scrollbar::-webkit-scrollbar-track{background:#1f293780}[data-v-eb3f9cc8] [class*=dark] .custom-scrollbar::-webkit-scrollbar-thumb{background-color:#4b556380}[data-v-eb3f9cc8] [class*=dark] .custom-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#4b5563b3}.custom-scrollbar[data-v-eb3f9cc8]{background:inherit}.break-words[data-v-eb3f9cc8]{word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.overflow-wrap-anywhere[data-v-eb3f9cc8]{overflow-wrap:anywhere}[data-v-eb3f9cc8] .prose{text-align:left;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}[data-v-eb3f9cc8] .prose h1,[data-v-eb3f9cc8] .prose h2,[data-v-eb3f9cc8] .prose h3,[data-v-eb3f9cc8] .prose h4,[data-v-eb3f9cc8] .prose h5,[data-v-eb3f9cc8] .prose h6{color:#4f46e5;word-wrap:break-word;overflow-wrap:break-word}[data-v-eb3f9cc8] .prose p,[data-v-eb3f9cc8] .prose div,[data-v-eb3f9cc8] .prose span,[data-v-eb3f9cc8] .prose code,[data-v-eb3f9cc8] .prose pre{word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}[data-v-eb3f9cc8] .prose pre{white-space:pre-wrap;overflow-x:auto}[data-v-eb3f9cc8] .prose code{white-space:pre-wrap}@media(prefers-color-scheme:dark){[data-v-eb3f9cc8] .prose h1,[data-v-eb3f9cc8] .prose h2,[data-v-eb3f9cc8] .prose h3,[data-v-eb3f9cc8] .prose h4,[data-v-eb3f9cc8] .prose h5,[data-v-eb3f9cc8] .prose h6{color:#818cf8}}@keyframes blob-a89ba9bf{0%,to{transform:translate(0) scale(1)}25%{transform:translate(20px,-50px) scale(1.1)}50%{transform:translate(-20px,20px) scale(.9)}75%{transform:translate(50px,50px) scale(1.05)}}.animate-spin-slow[data-v-a89ba9bf]{animation:spin-a89ba9bf 8s linear infinite}@keyframes spin-a89ba9bf{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.w-97-100[data-v-a89ba9bf]{width:97%}[data-v-a89ba9bf] .prose{text-align:left;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}[data-v-a89ba9bf] .prose h1,[data-v-a89ba9bf] .prose h2,[data-v-a89ba9bf] .prose h3,[data-v-a89ba9bf] .prose h4,[data-v-a89ba9bf] .prose h5,[data-v-a89ba9bf] .prose h6{color:#4f46e5;word-wrap:break-word;overflow-wrap:break-word}[data-v-a89ba9bf] .prose p,[data-v-a89ba9bf] .prose div,[data-v-a89ba9bf] .prose span,[data-v-a89ba9bf] .prose code,[data-v-a89ba9bf] .prose pre{word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}[data-v-a89ba9bf] .prose pre{white-space:pre-wrap;overflow-x:auto}[data-v-a89ba9bf] .prose code{white-space:pre-wrap}@media(prefers-color-scheme:dark){[data-v-a89ba9bf] .prose h1,[data-v-a89ba9bf] .prose h2,[data-v-a89ba9bf] .prose h3,[data-v-a89ba9bf] .prose h4,[data-v-a89ba9bf] .prose h5,[data-v-a89ba9bf] .prose h6{color:#818cf8}}@media(min-width:640px){.sm\:w-120[data-v-a89ba9bf]{width:30rem}}.custom-scrollbar[data-v-a89ba9bf]{scrollbar-width:thin;scrollbar-color:rgba(156,163,175,.3) rgba(243,244,246,.5)}.custom-scrollbar[data-v-a89ba9bf]::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar[data-v-a89ba9bf]::-webkit-scrollbar-track{background:#f3f4f680;border-radius:3px}.custom-scrollbar[data-v-a89ba9bf]::-webkit-scrollbar-thumb{background-color:#9ca3af80;border-radius:3px;-webkit-transition:background-color .3s;transition:background-color .3s}.custom-scrollbar[data-v-a89ba9bf]::-webkit-scrollbar-thumb:hover{background-color:#9ca3afb3}[data-v-a89ba9bf] [class*=dark] .custom-scrollbar{scrollbar-color:rgba(75,85,99,.5) rgba(31,41,55,.5)}[Line truncated
|
||||
@@ -0,0 +1,61 @@
|
||||
import{c as Pt,d as be,u as We,r as K,w as Dt,a as W,o as P,h as zt,b,n as T,e as d,i as xe,t as R,x as cr,j as ge,z as ur,l as L,_ as Re,G as pr,v as Le,E as me,k as Ut,T as Ft,K as hr,X as Nn,H as dr,y as fr,D as gr,p as mr,L as kr,f as br,M as xr,I as wr,J as yr}from"./index-DaP6hnmm.js";import{S as _r,C as Tr,Q as vr,u as Ar,P as Er,d as Sr}from"./PageHeader-Dda1k_N5.js";import{F as Pn}from"./file-C928Lhos.js";import{H as Rr}from"./hard-drive-B6XHFjlY.js";import{E as Lr,T as Cr}from"./trash-JuhqIjo3.js";import{C as Dr}from"./copy-bjFRgEY8.js";import"./box-C2OkK29z.js";const Ir=Pt("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const $r=Pt("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);const zn=Pt("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),Mr={class:"mb-6 relative"},Or={class:"relative"},Nr=["placeholder","readonly"],Pr={key:0,class:"absolute inset-y-0 right-0 flex items-center pr-3"},zr=["disabled"],Ur={class:"flex items-center justify-center relative z-10"},Fr=be({__name:"RetrieveForm",props:{inputStatus:{},error:{type:Boolean}},emits:["submit","update:code"],setup(r,{expose:e,emit:t}){const{t:s}=We(),n=t,l=xe("isDarkMode"),i=K(""),a=K(!1),u=K();return Dt(i,c=>{n("update:code",c)}),e({focus:()=>u.value?.focus()}),(c,h)=>(P(),W("form",{onSubmit:h[3]||(h[3]=zt(m=>c.$emit("submit"),["prevent"]))},[b("div",Mr,[b("label",{for:"code",class:T(["block text-sm font-medium mb-2",[d(l)?"text-gray-300":"text-gray-800"]])},R(d(s)("retrieve.codeInput.label")),3),b("div",Or,[cr(b("input",{id:"code","onUpdate:modelValue":h[0]||(h[0]=m=>i.value=m),type:"text",ref_key:"codeInput",ref:u,class:T(["w-full px-4 py-3 rounded-lg placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition duration-300 pr-10",[d(l)?"bg-gray-700 bg-opacity-50":"bg-gray-100",{"ring-2 ring-red-500":c.error},d(l)?"text-gray-300":"text-gray-800"]]),placeholder:d(s)("retrieve.codeInput.placeholder"),required:"",readonly:c.inputStatus.readonly,maxlength:"5",onFocus:h[1]||(h[1]=m=>a.value=!0),onBlur:h[2]||(h[2]=m=>a.value=!1)},null,42,Nr),[[ur,i.value]]),c.inputStatus.loading?(P(),W("div",Pr,[...h[4]||(h[4]=[b("span",{class:"animate-spin rounded-full h-5 w-5 border-b-2 border-indigo-500"},null,-1)])])):ge("",!0)]),b("div",{class:T(["absolute -bottom-0.5 left-2 h-0.5 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 transition-all duration-300 ease-in-out",{"w-97-100":a.value,"w-0":!a.value}])},null,2)]),b("button",{type:"submit",class:"w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white font-bold py-3 px-4 rounded-lg hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition duration-300 transform hover:scale-105 hover:shadow-lg relative overflow-hidden group",disabled:c.inputStatus.loading},[b("span",Ur,[b("span",null,R(c.inputStatus.loading?d(s)("common.loading"):d(s)("retrieve.submit")),1),L(d(Ir),{class:"w-5 h-5 ml-2 transition-transform duration-300 transform group-hover:translate-x-1"})]),h[5]||(h[5]=b("span",{class:"absolute top-0 left-0 w-full h-full bg-gradient-to-r from-pink-500 via-purple-500 to-indigo-500 opacity-0 group-hover:opacity-100 transition-opacity duration-300"},null,-1))],8,zr)],32))}}),Br=Re(Fr,[["__scopeId","data-v-8f0be1b0"]]),Hr={key:0,class:"mb-6 text-center"},Gr=be({__name:"PageFooter",props:{linkText:{},linkTo:{},drawerText:{}},emits:["toggle-drawer"],setup(r){const{t:e}=We(),t=xe("isDarkMode");return(s,n)=>{const l=pr("router-link");return P(),W("div",null,[s.linkText&&s.linkTo?(P(),W("div",Hr,[L(l,{to:s.linkTo,class:"text-indigo-400 hover:text-indigo-300 transition duration-300"},{default:Le(()=>[me(R(s.linkText),1)]),_:1},8,["to"])])):ge("",!0),b("div",{class:T(["px-8 py-4 bg-opacity-50 flex justify-between items-center",[d(t)?"bg-gray-800":"bg-gray-100"]])},[b("span",{class:T(["text-sm flex items-center",[d(t)?"text-gray-300":"text-gray-800"]])},[L(d(_r),{class:"w-4 h-4 mr-1 text-green-400"}),me(" "+R(d(e)("send.secureEncryption")),1)],2),b("button",{onClick:n[0]||(n[0]=i=>s.$emit("toggle-drawer")),class:T(["text-sm hover:text-indigo-300 transition duration-300 flex items-center",[d(t)?"text-indigo-400":"text-indigo-600"]])},[me(R(s.drawerText)+" ",1),L(d(Tr),{class:"w-4 h-4 ml-1"})],2)],2)])}}}),Wr=be({__name:"SideDrawer",props:{visible:{type:Boolean},title:{}},emits:["close"],setup(r){const e=xe("isDarkMode");return(t,s)=>(P(),Ut(Ft,{name:"drawer"},{default:Le(()=>[t.visible?(P(),W("div",{key:0,class:T(["fixed inset-y-0 right-0 w-full sm:w-120 bg-opacity-70 backdrop-filter backdrop-blur-xl shadow-2xl z-50 overflow-hidden flex flex-col",[d(e)?"bg-gray-900":"bg-whiteLine truncated
|
||||
]`).replace("lheading",Bn).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},zs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Us=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gn=/^( {2,}|\\)\n(?!\s*$)/,Fs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ut=/[\p{P}\p{S}]/u,Zt=/[\s\p{P}\p{S}]/u,Wn=/[^\s\p{P}\p{S}]/u,Bs=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Zt).getRegex(),qn=/(?!~)[\p{P}\p{S}]/u,Hs=/(?!~)[\s\p{P}\p{S}]/u,Gs=/(?:[^\s\p{P}\p{S}]|~)/u,Ws=/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,jn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qs=A(jn,"u").replace(/punct/g,ut).getRegex(),js=A(jn,"u").replace(/punct/g,qn).getRegex(),Zn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zs=A(Zn,"gu").replace(/notPunctSpace/g,Wn).replace(/punctSpace/g,Zt).replace(/punct/g,ut).getRegex(),Xs=A(Zn,"gu").replace(/notPunctSpace/g,Gs).replace(/punctSpace/g,Hs).replace(/punct/g,qn).getRegex(),Ys=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Wn).replace(/punctSpace/g,Zt).replace(/punct/g,ut).getRegex(),Vs=A(/\\(punct)/,"gu").replace(/punct/g,ut).getRegex(),Qs=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ks=A(qt).replace("(?:-->|$)","-->").getRegex(),Js=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ks).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ot=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,ei=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ot).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xn=A(/^!?\[(label)\]\[(ref)\]/).replace("label",ot).replace("ref",Wt).getRegex(),Yn=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",Wt).getRegex(),ti=A("reflink|nolink(?!\\()","g").replace("reflink",Xn).replace("nolink",Yn).getRegex(),Xt={_backpedal:Ge,anyPunctuation:Vs,autolink:Qs,blockSkip:Ws,br:Gn,code:Us,del:Ge,emStrongLDelim:qs,emStrongRDelimAst:Zs,emStrongRDelimUnd:Ys,escape:zs,link:ei,nolink:Yn,punctuation:Bs,reflink:Xn,reflinkSearch:ti,tag:Js,text:Fs,url:Ge},ni={...Xt,link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",ot).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ot).getRegex()},It={...Xt,emStrongRDelimAst:Xs,emStrongLDelim:js,url:A(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ri={...It,br:A(Gn).replace("{2,}","*").getRegex(),text:A(It.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},et={normal:jt,gfm:Ns,pedantic:Ps},Ne={normal:Xt,gfm:It,breaks:ri,pedantic:ni},si={"&":"&","<":"<",">":">",'"':""","'":"'"},Tn=r=>si[r];function re(r,e){if(e){if(q.escapeTest.test(r))return r.replace(q.escapeReplace,Tn)}else if(q.escapeTestNoEncode.test(r))return r.replace(q.escapeReplaceNoEncode,Tn);return r}function vn(r){try{r=encodeURI(r).replace(q.percentDecode,"%")}catch{return null}return r}function An(r,e){let t=r.replace(q.findPipe,(l,i,a)=>{let u=!1,c=i;for(;--c>=0&&a[c]==="\\";)u=!u;return u?"|":" |"}),s=t.split(q.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(q.slashPipe,"|");return s}function Pe(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s&&r.charAt(s-n-1)===e;)n++;return r.slice(0,s-n)}function ii(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return Line truncated
|
||||
`).map(l=>{let i=l.match(t.other.beginningSpace);if(i===null)return l;let[a]=i;return a.length>=n.length?l.slice(n.length):l}).join(`
|
||||
`)}var lt=class{options;rules;lexer;constructor(r){this.options=r||we}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Pe(t,`
|
||||
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=oi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=Pe(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:Pe(e[0],`
|
||||
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=Pe(e[0],`
|
||||
`).split(`
|
||||
`),s="",n="",l=[];for(;t.length>0;){let i=!1,a=[],u;for(u=0;u<t.length;u++)if(this.rules.other.blockquoteStart.test(t[u]))a.push(t[u]),i=!0;else if(!i)a.push(t[u]);else break;t=t.slice(u);let c=a.join(`
|
||||
`),h=c.replace(this.rules.other.blockquoteSetextReplace,`
|
||||
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
||||
${c}`:c,n=n?`${n}
|
||||
${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,l,!0),this.lexer.state.top=m,t.length===0)break;let f=l.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let y=f,v=y.raw+`
|
||||
`+t.join(`
|
||||
`),$=this.blockquote(v);l[l.length-1]=$,s=s.substring(0,s.length-y.raw.length)+$.raw,n=n.substring(0,n.length-y.text.length)+$.text;break}else if(f?.type==="list"){let y=f,v=y.raw+`
|
||||
`+t.join(`
|
||||
`),$=this.list(v);l[l.length-1]=$,s=s.substring(0,s.length-f.raw.length)+$.raw,n=n.substring(0,n.length-y.raw.length)+$.raw,t=v.substring(l.at(-1).raw.length).split(`
|
||||
`);continue}}return{type:"blockquote",raw:s,tokens:l,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,n={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let l=this.rules.other.listItemRegex(t),i=!1;for(;r;){let u=!1,c="",h="";if(!(e=l.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let m=e[2].split(`
|
||||
`,1)[0].replace(this.rules.other.listReplaceTabs,J=>" ".repeat(3*J.length)),f=r.split(`
|
||||
`,1)[0],y=!m.trim(),v=0;if(this.options.pedantic?(v=2,h=m.trimStart()):y?v=e[1].length+1:(v=e[2].search(this.rules.other.nonSpaceChar),v=v>4?1:v,h=m.slice(v),v+=e[1].length),y&&this.rules.other.blankLine.test(f)&&(c+=f+`
|
||||
`,r=r.substring(f.length+1),u=!0),!u){let J=this.rules.other.nextBulletRegex(v),ee=this.rules.other.hrRegex(v),U=this.rules.other.fencesBeginRegex(v),D=this.rules.other.headingBeginRegex(v),se=this.rules.other.htmlBeginRegex(v);for(;r;){let ie=r.split(`
|
||||
`,1)[0],te;if(f=ie,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),te=f):te=f.replace(this.rules.other.tabCharGlobal," "),U.test(f)||D.test(f)||se.test(f)||J.test(f)||ee.test(f))break;if(te.search(this.rules.other.nonSpaceChar)>=v||!f.trim())h+=`
|
||||
`+te.slice(v);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||U.test(m)||D.test(m)||ee.test(m))break;h+=`
|
||||
`+f}!y&&!f.trim()&&(y=!0),c+=ie+`
|
||||
`,r=r.substring(ie.length+1),m=te.slice(v)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(i=!0));let $=null,V;this.options.gfm&&($=this.rules.other.listIsTask.exec(h),$&&(V=$[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:c,task:!!$,checked:V,loose:!1,text:h,tokens:[]}),n.raw+=c}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let u=0;u<n.items.length;u++)if(this.lexer.state.top=!1,n.items[u].tokens=this.lexer.blockTokens(n.items[u].text,[]),!n.loose){let c=n.items[u].tokens.filter(m=>m.type==="space"),h=c.length>0&&c.some(m=>this.rules.other.anyLine.test(m.raw));n.loose=h}if(n.loose)for(let u=0;u<n.items.length;u++)n.items[u].loose=!0;return n}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=An(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
||||
`):[],l={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let i of s)this.rules.other.tableAlignRight.test(i)?l.align.push("right"):this.rules.other.tableAlignCenter.test(i)?l.align.push("center"):this.rules.other.tableAlignLeft.test(i)?l.align.push("left"):l.align.push(null);for(let i=0;i<t.length;i++)l.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:l.align[i]});for(let i of n)l.rows.push(An(i,l.header.length).map((a,u)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:l.align[u]})));return l}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
||||
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let l=Pe(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{let l=ii(e[2],"()");if(l===-2)return;if(l>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(s);l&&(s=l[1],n=l[3])}else n=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),En(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return En(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||s[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,l,i,a=n,u=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*r.length+n);(s=c.exec(e))!=null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(i=[...l].length,s[3]||s[4]){a+=i;continue}else if((s[5]||s[6])&&n%3&&!((n+i)%3)){u+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+u);let h=[...s[0]][0].length,m=r.slice(0,n+s.index+h+i);if(Math.min(n,i)%2){let y=m.slice(1,-1);return{type:"em",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}let f=m.slice(2,-2);return{type:"strong",raw:m,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){let e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},pe=class $t{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||we,this.options.tokenizer=this.options.tokenizer||new lt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:q,block:et.normal,inline:Ne.normal};this.options.pedantic?(t.block=et.pedantic,t.inline=Ne.pedantic):this.options.gfm&&(t.block=et.gfm,this.options.breaks?t.inline=Ne.breaks:t.inline=Ne.gfm),this.tokenizer.rules=t}static get rules(){return{block:et,inline:Ne}}static lex(e,t){return new $t(t).lex(e)}static lexInline(e,t){return new $t(t).inlineTokens(e)}lex(e){e=e.replace(q.carriageReturn,`
|
||||
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){for(this.options.pedantic&&(e=e.replace(q.tabCharGlobal," ").replace(q.spaceLine,""));e;){let n;if(this.options.extensions?.block?.some(i=>(n=i.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let i=t.at(-1);n.raw.length===1&&i!==void 0?i.raw+=`
|
||||
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
||||
`)?"":`
|
||||
`)+n.raw,i.text+=`
|
||||
`+n.text,this.inlineQueue.at(-1).src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
||||
`)?"":`
|
||||
`)+n.raw,i.text+=`
|
||||
`+n.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let l=e;if(this.options.extensions?.startBlock){let i=1/0,a=e.slice(1),u;this.options.extensions.startBlock.forEach(c=>{u=c.call({lexer:this},a),typeof u=="number"&&u>=0&&(i=Math.min(i,u))}),i<1/0&&i>=0&&(l=e.substring(0,i+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){let i=t.at(-1);s&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
|
||||
`)?"":`
|
||||
`)+n.raw,i.text+=`
|
||||
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(n),s=l.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
||||
`)?"":`
|
||||
`)+n.raw,i.text+=`
|
||||
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(n);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s=e,n=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let l=!1,i="";for(;e;){l||(i=""),l=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,i)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let u=e;if(this.options.extensions?.startInline){let c=1/0,h=e.slice(1),m;this.options.extensions.startInline.forEach(f=>{m=f.call({lexer:this},h),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),c<1/0&&c>=0&&(u=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(u)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),l=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},at=class{options;parser;constructor(r){this.options=r||we}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(q.notSpaceStart)?.[0],n=r.replace(q.endingNewline,"")+`
|
||||
`;return s?'<pre><code class="language-'+re(s)+'">'+(t?n:re(n,!0))+`</code></pre>
|
||||
`:"<pre><code>"+(t?n:re(n,!0))+`</code></pre>
|
||||
`}blockquote({tokens:r}){return`<blockquote>
|
||||
${this.parser.parse(r)}</blockquote>
|
||||
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
||||
`}hr(r){return`<hr>
|
||||
`}list(r){let e=r.ordered,t=r.start,s="";for(let i=0;i<r.items.length;i++){let a=r.items[i];s+=this.listitem(a)}let n=e?"ol":"ul",l=e&&t!==1?' start="'+t+'"':"";return"<"+n+l+`>
|
||||
`+s+"</"+n+`>
|
||||
`}listitem(r){let e="";if(r.task){let t=this.checkbox({checked:!!r.checked});r.loose?r.tokens[0]?.type==="paragraph"?(r.tokens[0].text=t+" "+r.tokens[0].text,r.tokens[0].tokens&&r.tokens[0].tokens.length>0&&r.tokens[0].tokens[0].type==="text"&&(r.tokens[0].tokens[0].text=t+" "+re(r.tokens[0].tokens[0].text),r.tokens[0].tokens[0].escaped=!0)):r.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):e+=t+" "}return e+=this.parser.parse(r.tokens,!!r.loose),`<li>${e}</li>
|
||||
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
||||
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let l=r.rows[n];t="";for(let i=0;i<l.length;i++)t+=this.tablecell(l[i]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
||||
<thead>
|
||||
`+e+`</thead>
|
||||
`+s+`</table>
|
||||
`}tablerow({text:r}){return`<tr>
|
||||
${r}</tr>
|
||||
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
||||
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${re(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=vn(r);if(n===null)return s;r=n;let l='<a href="'+r+'"';return e&&(l+=' title="'+re(e)+'"'),l+=">"+s+"</a>",l}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=vn(r);if(n===null)return re(t);r=n;let l=`<img src="${r}" alt="${t}"`;return e&&(l+=` title="${re(e)}"`),l+=">",l}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:re(r.text)}},Yt=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}},he=class Mt{options;renderer;textRenderer;constructor(e){this.options=e||we,this.options.renderer=this.options.renderer||new at,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Yt}static parse(e,t){return new Mt(t).parse(e)}static parseInline(e,t){return new Mt(t).parseInline(e)}parse(e,t=!0){let s="";for(let n=0;n<e.length;n++){let l=e[n];if(this.options.extensions?.renderers?.[l.type]){let a=l,u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){s+=u||"";continue}}let i=l;switch(i.type){case"space":{s+=this.renderer.space(i);continue}case"hr":{s+=this.renderer.hr(i);continue}case"heading":{s+=this.renderer.heading(i);continue}case"code":{s+=this.renderer.code(i);continue}case"table":{s+=this.renderer.table(i);continue}case"blockquote":{s+=this.renderer.blockquote(i);continue}case"list":{s+=this.renderer.list(i);continue}case"html":{s+=this.renderer.html(i);continue}case"def":{s+=this.renderer.def(i);continue}case"paragraph":{s+=this.renderer.paragraph(i);continue}case"text":{let a=i,u=this.renderer.text(a);for(;n+1<e.length&&e[n+1].type==="text";)a=e[++n],u+=`
|
||||
`+this.renderer.text(a);t?s+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):s+=u;continue}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}parseInline(e,t=this.renderer){let s="";for(let n=0;n<e.length;n++){let l=e[n];if(this.options.extensions?.renderers?.[l.type]){let a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){s+=a||"";continue}}let i=l;switch(i.type){case"escape":{s+=t.text(i);break}case"html":{s+=t.html(i);break}case"link":{s+=t.link(i);break}case"image":{s+=t.image(i);break}case"strong":{s+=t.strong(i);break}case"em":{s+=t.em(i);break}case"codespan":{s+=t.codespan(i);break}case"br":{s+=t.br(i);break}case"del":{s+=t.del(i);break}case"text":{s+=t.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}},st=class{options;block;constructor(r){this.options=r||we}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?pe.lex:pe.lexInline}provideParser(){return this.block?he.parse:he.parseInline}},li=class{defaults=Bt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=he;Renderer=at;TextRenderer=Yt;Lexer=pe;Tokenizer=lt;Hooks=st;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let n=s;for(let l of n.header)t=t.concat(this.walkTokens(l.tokens,e));for(let l of n.rows)for(let i of l)t=t.concat(this.walkTokens(i.tokens,e));break}case"list":{let n=s;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(l=>{let i=n[l].flat(1/0);t=t.concat(this.walkTokens(i,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let l=e.renderers[n.name];l?e.renderers[n.name]=function(...i){let a=n.renderer.apply(this,i);return a===!1&&(a=l.apply(this,i)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=e[n.level];l?l.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new at(this.defaults);for(let l in t.renderer){if(!(l in n))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let i=l,a=t.renderer[i],u=n[i];n[i]=(...c)=>{let h=a.apply(n,c);return h===!1&&(h=u.apply(n,c)),h||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new lt(this.defaults);for(let l in t.tokenizer){if(!(l in n))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let i=l,a=t.tokenizer[i],u=n[i];n[i]=(...c)=>{let h=a.apply(n,c);return h===!1&&(h=u.apply(n,c)),h}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new st;for(let l in t.hooks){if(!(l in n))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let i=l,a=t.hooks[i],u=n[i];st.passThroughHooks.has(l)?n[i]=c=>{if(this.defaults.async)return Promise.resolve(a.call(n,c)).then(m=>u.call(n,m));let h=a.call(n,c);return u.call(n,h)}:n[i]=(...c)=>{let h=a.apply(n,c);return h===!1&&(h=u.apply(n,c)),h}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,l=t.walkTokens;s.walkTokens=function(i){let a=[];return a.push(l.call(this,i)),n&&(a=a.concat(n.call(this,i))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return pe.lex(r,e??this.defaults)}parser(r,e){return he.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},l=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return l(new Error("marked(): input parameter is of type "+ObjecLine truncated
|
||||
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+re(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},ke=new li;function E(r,e){return ke.parse(r,e)}E.options=E.setOptions=function(r){return ke.setOptions(r),E.defaults=ke.defaults,Un(E.defaults),E};E.getDefaults=Bt;E.defaults=we;E.use=function(...r){return ke.use(...r),E.defaults=ke.defaults,Un(E.defaults),E};E.walkTokens=function(r,e){return ke.walkTokens(r,e)};E.parseInline=ke.parseInline;E.Parser=he;E.parser=he.parse;E.Renderer=at;E.TextRenderer=Yt;E.Lexer=pe;E.lexer=pe.lex;E.Tokenizer=lt;E.Hooks=st;E.parse=E;E.options;E.setOptions;E.use;E.walkTokens;E.parseInline;he.parse;pe.lex;const{entries:Vn,setPrototypeOf:Sn,isFrozen:ai,getPrototypeOf:ci,getOwnPropertyDescriptor:ui}=Object;let{freeze:j,seal:Y,create:Qn}=Object,{apply:Ot,construct:Nt}=typeof Reflect<"u"&&Reflect;j||(j=function(e){return e});Y||(Y=function(e){return e});Ot||(Ot=function(e,t,s){return e.apply(t,s)});Nt||(Nt=function(e,t){return new e(...t)});const tt=Z(Array.prototype.forEach),pi=Z(Array.prototype.lastIndexOf),Rn=Z(Array.prototype.pop),ze=Z(Array.prototype.push),hi=Z(Array.prototype.splice),it=Z(String.prototype.toLowerCase),Et=Z(String.prototype.toString),Ln=Z(String.prototype.match),Ue=Z(String.prototype.replace),di=Z(String.prototype.indexOf),fi=Z(String.prototype.trim),Q=Z(Object.prototype.hasOwnProperty),G=Z(RegExp.prototype.test),Fe=gi(TypeError);function Z(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];return Ot(r,e,s)}}function gi(r){return function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return Nt(r,t)}}function w(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:it;Sn&&Sn(r,null);let s=e.length;for(;s--;){let n=e[s];if(typeof n=="string"){const l=t(n);l!==n&&(ai(e)||(e[s]=l),n=l)}r[n]=!0}return r}function mi(r){for(let e=0;e<r.length;e++)Q(r,e)||(r[e]=null);return r}function ue(r){const e=Qn(null);for(const[t,s]of Vn(r))Q(r,t)&&(Array.isArray(s)?e[t]=mi(s):s&&typeof s=="object"&&s.constructor===Object?e[t]=ue(s):e[t]=s);return e}function Be(r,e){for(;r!==null;){const s=ui(r,e);if(s){if(s.get)return Z(s.get);if(typeof s.value=="function")return Z(s.value)}r=ci(r)}function t(){return null}return t}const Cn=j(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),St=j(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Rt=j(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ki=j(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Lt=j(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),bi=j(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Dn=j(["#text"]),In=j(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","cLine truncated
|
||||
`+X),ye&&tt([de,Ce,x],ce=>{X=Ue(X,ce," ")}),D&&Xe?D.createHTML(X):X},e.setConfig=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Tt(k),kt=!0},e.clearConfig=function(){Ee=null,kt=!1},e.isValidAttribute=function(k,o,p){Ee||Tt({});const g=N(k),S=N(o);return mn(g,S,p)},e.addHook=function(k,o){typeof o=="function"&&ze(I[k],o)},e.removeHook=function(k,o){if(o!==void 0){const p=pi(I[k],o);return p===-1?void 0:hi(I[k],p,1)[0]}return Rn(I[k])},e.removeHooks=function(k){I[k]=[]},e.removeAllHooks=function(){I=On()},e}var Li=er();const Ci={class:"min-h-screen flex items-center justify-center p-4 overflow-hidden transition-colors duration-300"},Di={class:"w-full max-w-md relative z-10"},Ii={class:"p-8"},$i=be({__name:"RetrievewFileView",setup(r){const{t:e}=We(),t=mr(),s=window.location.origin,n=wr(),l=xe("isDarkMode"),i=Ar(),{receiveData:a}=kr(i),u=K(""),c=K({readonly:!1,loading:!1}),h=K(""),m=K(null),f=K(!1),y=xr(),v=a,$=JSON.parse(localStorage.getItem("config")||"{}"),V=K(null);br(()=>{V.value&&V.value.focus();const x=y.query.code;x&&typeof x=="string"&&(u.value=x)}),Dt(u,x=>{x.length===5&&U()});const J=x=>x.downloadUrl?x.downloadUrl.startsWith("http")?x.downloadUrl:`${s}${x.downloadUrl}`:"",ee=async()=>{m.value&&m.value.content&&await Sr(m.value.content,{successMsg:e("fileRecord.contentCopied"),errorMsg:e("fileRecord.copyFailed")})},U=async()=>{if(u.value.length!==5){t.showAlert(e("retrieve.messages.invalidCode"),"error");return}c.value.readonly=!0,c.value.loading=!0;try{const x=await yr.post("/share/select/",{code:u.value}),_=x.data||x;if(_&&_.code===200)if(_.detail){const H=_.detail.text.startsWith("/share/download")||_.detail.name!=="Text",oe={id:Date.now(),code:_.detail.code,filename:_.detail.name,size:D(_.detail.size),downloadUrl:H?_.detail.text:null,content:H?null:_.detail.text,date:new Date().toLocaleString()};let De=!0;i.receiveData.forEach(ft=>{ft.code===oe.code&&(De=!1)}),De&&i.addReceiveData(oe),H?m.value=oe:(m.value=oe,I.value=!0),t.showAlert(e("retrieve.messages.retrieveSuccess"),"success")}else t.showAlert(e("retrieve.messages.invalidCodeError"),"error");else t.showAlert(e("retrieve.messages.retrieveFailure")+_.detail,"error")}catch(x){console.error("Retrieve failed:",x);const _=x,H=_?.response?.data?.detail||_?.message||e("retrieve.messages.unknownError");t.showAlert(e("retrieve.messages.networkError")+H,"error")}finally{c.value.readonly=!1,c.value.loading=!1,u.value=""}},D=x=>{if(x===0)return"0 "+e("fileSize.bytes");const _=1024,H=[e("fileSize.bytes"),e("fileSize.kb"),e("fileSize.mb"),e("fileSize.gb"),e("fileSize.tb")],oe=Math.floor(Math.log(x)/Math.log(_));return parseFloat((x/Math.pow(_,oe)).toFixed(2))+" "+H[oe]},se=x=>{m.value=x},ie=x=>{const _=v.value.findIndex(H=>H.id===x);_!==-1&&i.deleteReceiveData(_)},te=()=>{f.value=!f.value},pt=()=>{n.push("/send")},ht=x=>x.downloadUrl?`${s}${x.downloadUrl}`:`${s}?code=${x.code}`,dt=x=>{if(x.downloadUrl)window.open(`${x.downloadUrl.startsWith("http")?"":s}${x.downloadUrl}`,"_blank");else if(x.content){const _=new Blob([x.content],{type:"text/plain;charset=utf-8"});As.saveAs(_,`${x.filename}.txt`)}},I=K(!1),de=K("");Dt(()=>m.value?.content,async x=>{if(x)try{const _=await E(x);de.value=Li.sanitize(_,{ALLOWED_TAGS:["p","br","strong","em","u","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","a","img"],ALLOWED_ATTR:["href","src","alt","title","class"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|xxx):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})}catch(_){console.error("Markdown 渲染失败:",_),de.value=x}else de.value=""},{immediate:!0});const Ce=()=>{I.value=!0};return(x,_)=>(P(),W("div",Ci,[b("div",Di,[b("div",{class:T(["rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300",[d(l)?"bg-gray-800 bg-opacity-50 backdrop-filter backdrop-blur-xl border-gray-700":"bg-white border-gray-200"]])},[b("div",Ii,[L(Er,{title:d($).name,onTitleClick:pt},null,8,["title"]),L(Br,{"input-status":c.value,error:!!h.value,onSubmit:U,"onUpdate:code":_[0]||(_[0]=H=>u.value=H),ref:"retrieveFormRef"},null,8,["input-status","error"])]),L(Gr,{"link-text":x.$t("retrieve.needSendFile"),"link-to":"/send","drawer-text":x.$t("retrieve.recordsDrawer"),onToggleDrawer:te},null,8,["link-text","drawer-text"])],2)]),L(qr,{visible:f.value,title:x.$t("retrieve.recordsDrawer"),onClose:te},{default:Le(()=>[L(ms,{records:d(v),onViewDetails:se,onDownloadRecord:dt,onDeleteRecord:ie},null,8,["records"])]),_:1},8,["visible","title"]),L(ls,{visible:!!m.value,record:m.value,onClose:_[1]||(_[1]=H=>m.value=null),onShowContentPreview:Ce,"get-download-url":J,"get-qr-code-value":ht},null,8,["visible","record"]),L(_s,{visible:I.value,"rendered-content":de.value,onClose:_[2]||(_[2]=H=>I.value=!1),onCopyContent:ee},null,8,["visible","rendered-content"])]))}}),Bi=Re($i,[["__scopeId","data-v-a89ba9bf"]]);export{Bi as default};
|
||||
@@ -1 +0,0 @@
|
||||
@keyframes blob-f8bcace2{0%,to{transform:translate(0) scale(1)}25%{transform:translate(20px,-50px) scale(1.1)}50%{transform:translate(-20px,20px) scale(.9)}75%{transform:translate(50px,50px) scale(1.05)}}.animate-blob-1[data-v-f8bcace2]{animation:blob-f8bcace2 25s infinite}.animate-blob-2[data-v-f8bcace2]{animation:blob-f8bcace2 30s infinite}.animate-blob-3[data-v-f8bcace2]{animation:blob-f8bcace2 35s infinite}.animate-blob-4[data-v-f8bcace2]{animation:blob-f8bcace2 40s infinite}.animate-spin-slow[data-v-f8bcace2]{animation:spin-f8bcace2 8s linear infinite}@keyframes spin-f8bcace2{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-enter-active[data-v-f8bcace2],.fade-leave-active[data-v-f8bcace2]{transition:opacity .3s ease}.fade-enter-from[data-v-f8bcace2],.fade-leave-to[data-v-f8bcace2]{opacity:0}.list-enter-active[data-v-f8bcace2],.list-leave-active[data-v-f8bcace2]{transition:all .5s ease}.list-enter-from[data-v-f8bcace2],.list-leave-to[data-v-f8bcace2]{opacity:0;transform:translate(30px)}.drawer-enter-active[data-v-f8bcace2],.drawer-leave-active[data-v-f8bcace2]{transition:transform .3s ease}.drawer-enter-from[data-v-f8bcace2],.drawer-leave-to[data-v-f8bcace2]{transform:translate(100%)}.w-97-100[data-v-f8bcace2]{width:97%}[data-v-f8bcace2] .prose{text-align:left}[data-v-f8bcace2] .prose h1,[data-v-f8bcace2] .prose h2,[data-v-f8bcace2] .prose h3,[data-v-f8bcace2] .prose h4,[data-v-f8bcace2] .prose h5,[data-v-f8bcace2] .prose h6{color:#4f46e5}@media (prefers-color-scheme: dark){[data-v-f8bcace2] .prose h1,[data-v-f8bcace2] .prose h2,[data-v-f8bcace2] .prose h3,[data-v-f8bcace2] .prose h4,[data-v-f8bcace2] .prose h5,[data-v-f8bcace2] .prose h6{color:#818cf8}}@media (min-width: 640px){.sm\:w-120[data-v-f8bcace2]{width:30rem}}
|
||||
@@ -1,21 +0,0 @@
|
||||
import{c as W,d as oe,r as P,o as ne,w as he,a as F,b as D,e as a,_ as se,u as ae,f as ge,n as f,g as i,t as U,h as Q,i as M,j as E,k as N,l as J,v as X,T as K,m as pe,F as Y,p as Z,q as V,X as ye,s as ve,x as be,y as ee,z as xe,A as me}from"./index-EADe6V-l.js";import{g as we,u as _e,S as Ce,C as Ae,a as Me,Q as Se,E as Be}from"./fileData-B92rnDh4.js";import{F as te}from"./file-CTH8PUKS.js";import{H as Ie,T as Te}from"./trash-COYxyedR.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ue=W("ClipboardCopyIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Fe=W("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const De=W("CloudUploadIcon",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ze=W("SendIcon",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),Pe=oe({__name:"BorderProgressBar",props:{progress:{}},setup(S){const k=S,T=P(null),u=P(null);let d=null;const C=()=>{if(!d||!u.value||!T.value)return;const v=T.value.clientWidth,x=T.value.clientHeight;u.value.width=v,u.value.height=x;const p=4,c=8;d.lineWidth=p;const A=d.createLinearGradient(0,0,v,x);A.addColorStop(0,"#4f46e5"),A.addColorStop(.5,"#7c3aed"),A.addColorStop(1,"#db2777"),d.strokeStyle="rgba(229, 231, 235, 0.2)",w(d,p/2,p/2,v-p,x-p,c),d.stroke();const I=((v+x)*2-8*c+2*Math.PI*c)*k.progress/100;d.strokeStyle=A,d.lineCap="round",d.lineJoin="round",d.beginPath();let y=I;const m=p/2,h=v-p,s=x-p;if(y>0){const n=Math.min(h-2*c,y);d.moveTo(c+m,m),d.lineTo(n+c+m,m),y-=n}if(y>0){const n=Math.min(Math.PI/2,y/c);d.arc(h-c+m,c+m,c,-Math.PI/2,n-Math.PI/2,!1),y-=n*c}if(y>0){const n=Math.min(s-2*c,y);d.lineTo(h+m,n+c+m),y-=n}if(y>0){const n=Math.min(Math.PI/2,y/c);d.arc(h-c+m,s-c+m,c,0,n,!1),y-=n*c}if(y>0){const n=Math.min(h-2*c,y);d.lineTo(h-n-c+m,s+m),y-=n}if(y>0){const n=Math.min(Math.PI/2,y/c);d.arc(c+m,s-c+m,c,Math.PI/2,Math.PI/2+n,!1),y-=n*c}if(y>0){const n=Math.min(s-2*c,y);d.lineTo(m,s-n-c+m),y-=n}if(y>0){const n=Math.min(Math.PI/2,y/c);d.arc(c+m,c+m,c,Math.PI,Math.PI+n,!1)}d.stroke()};function w(v,x,p,c,A,_){v.beginPath(),v.moveTo(x+_,p),v.lineTo(x+c-_,p),v.arcTo(x+c,p,x+c,p+_,_),v.lineTo(x+c,p+A-_),v.arcTo(x+c,p+A,x+c-_,p+A,_),v.lineTo(x+_,p+A),v.arcTo(x,p+A,x,p+A-_,_),v.lineTo(x,p+_),v.arcTo(x,p,x+_,p,_),v.closePath()}return ne(()=>{u.value&&(d=u.value.getContext("2d"),C())}),he(()=>k.progress,C),(v,x)=>(F(),D("div",{class:"border-progress-container",ref_key:"container",ref:T},[a("canvas",{ref_key:"canvas",ref:u,class:"border-progress-canvas"},null,512)],512))}}),ke=se(Pe,[["__scopeId","data-v-2fbf5085"]]);var ie={exports:{}};(function(S,k){(function(T){S.exports=T()})(function(T){var u=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function d(s,n){var t=s[0],e=s[1],o=s[2],r=s[3];t+=(e&o|~e&r)+n[0]-680876936|0,t=(t<<7|t>>>25)+e|0,r+=(t&e|~t&o)+n[1]-389564586|0,r=(r<<12|r>>>20)+t|0,o+=(r&t|~r&e)+n[2]+606105819|0,o=(o<<17|o>>>15)+r|0,e+=(o&r|~o&t)+n[3]-1044525330|0,e=(e<<22|e>>>10)+o|0,t+=(e&o|~e&r)+n[4]-176418897|0,t=(t<<7|t>>>25)+e|0,r+=(t&e|~t&o)+n[5]+1200080426|0,r=(r<<12|r>>>20)+t|0,o+=(r&t|~r&e)+n[6]-1473231341|0,o=(o<<17|o>>>15)+r|0,e+=(o&r|~o&t)+n[7]-45705983|0,e=(e<<22|e>>>10)+o|0,t+=(e&o|~e&r)+n[8]+1770035416|0,t=(t<<7|t>>>25)+e|0,r+=(t&e|~t&o)+n[9]-1958414417|0,r=(r<<12|r>>>20)+t|0,o+=(r&t|~r&e)+n[10]-42063|0,o=(o<<17|o>>>15)+r|0,e+=(o&r|~o&t)+n[11]-1990404162|0,e=(e<<22|e>>>10)+o|0,t+=(e&o|~e&r)+n[12]+1804603682|0,t=(t<<7|t>>>25)+e|0,r+=(t&e|~t&o)+n[13]-40341101|0,r=(r<<12|r>>>20)+t|0,o+=(r&t|~r&e)+n[14]-1502002290|0,o=(o<<17|o>>>15)+r|0,e+=(o&r|~o&t)+n[15]+1236535329|0,e=(e<<22|e>>>10)+o|0,t+=(e&r|o&~r)+n[1]-165796510|0,t=(t<<5|t>>>27)+e|0,r+=(t&o|e&~o)+n[6]-1069501632|0,r=(r<<9|r>>>23)+t|0,o+=(r&e|t&~e)+n[11]+643717713|0,o=(o<<14|o>>>18)+r|0,e+=(o&t|r&~t)+n[0]-373897302|0,e=(e<<20|e>>>12)+o|0,t+=(e&r|o&~r)+n[5]-701558691|0,t=(t<<5|t>>>27)+e|0,r+=(t&o|e&~o)+n[10]+38016083|0,r=(r<<9|r>>>23)+t|0,o+=(r&e|t&~e)+n[15]-660478335|0,o=(o<<14|o>>>18)+r|0,e+=(o&t|r&~t)+n[4]-405537848|0,e=(e<<20|e>>>12)+o|0,t+=(e&r|o&~r)+n[9]+568446438|0,t=(t<<5|t>>>27)+e|0,r+=(t&o|e&~o)+n[14]-1019803690|0,r=(r<<9|r>>>23)+t|0,o+=(r&e|t&~e)+n[3]-187363961|0,o=(o<<14|o>>>18)+r|0,e+=(o&t|r&~t)+n[8]+1163531501|0,e=(e<<20|e>>>12)+o|0,t+=(e&r|o&~r)+n[13]-1444681467|0,t=(t<<5|t>>>27)+e|0,r+=(t&o|e&~o)+n[2]-51403784|0,r=(r<<9|r>>>23)+t|0,o+=(r&e|t&~e)+n[7]+1735328473|0,o=(o<<14|o>>>18)+r|0,e+=(o&t|r&~t)+n[12]-1926607734|0,e=(e<<20|e>>>12)+o|0,t+=(e^o^r)+n[5]-378558|0,t=(t<<4|t>>>28)+e|0,r+=(t^e^o)+n[8]-2022574463|0,r=(r<<11|r>>>21)+t|0,o+=(r^t^e)+n[11]+1839030562|0,o=(o<<16|o>>>16)+r|0,e+=(o^r^t)+n[14]-35309556|0,e=(e<<23|e>>>9)+o|0,t+=(e^o^r)+n[1]-1530992060|0,t=(t<<4|t>>>28)+e|0,r+=(t^e^o)+n[4]+1272893353|0,r=(r<<11|r>>>21)+t|0,o+=(r^t^e)+n[7]-155497632|0,o=(o<<16|o>>>16)+r|0,e+=(o^r^t)+n[10]-1094730640|0,e=(e<<23|e>>>9)+o|0,t+=(e^o^r)+n[13]+681279174|0,t=(t<<4|t>>>28)+e|0,r+=(t^e^o)+n[0]-358537222|0,r=(r<<11|r>>>21)+t|0,o+=(r^t^e)+n[3]-722521979|0,o=(o<<16|o>>>16)+r|0,e+=(o^r^t)+n[6]+76029189|0,e=(e<<23|e>>>9)+o|0,t+=(e^o^r)+n[9]-640364487|0,t=(t<<4|t>>>28)+e|0,r+=(t^e^o)+n[12]-421815835|0,r=(r<<11|r>>>21)+t|0,o+=(r^t^e)+n[15]+530742520|0,o=(o<<16|o>>>16)+r|0,e+=(o^r^t)+n[2]-995338651|0,e=(e<<23|e>>>9)+o|0,t+=(o^(e|~r))+n[0]-198630844|0,t=(t<<6|t>>>26)+e|0,r+=(e^(t|~o))+n[7]+1126891415|0,r=(r<<10|r>>>22)+t|0,o+=(t^(r|~e))+n[14]-1416354905|0,o=(o<<15|o>>>17)+r|0,e+=(r^(o|~t))+n[5]-57434055|0,e=(e<<21|e>>>11)+o|0,t+=(o^(e|~r))+n[12]+1700485571|0,t=(t<<6|t>>>26)+e|0,r+=(e^(t|~o))+n[3]-1894986606|0,r=(r<<10|r>>>22)+t|0,o+=(t^(r|~e))+n[10]-1051523|0,o=(o<<15|o>>>17)+r|0,eLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
.border-progress-container[data-v-2fbf5085]{position:relative;width:100%;height:100%}.border-progress-canvas[data-v-2fbf5085]{position:absolute;top:0;left:0;width:100%;height:100%;transition:all .3s ease}.custom-scrollbar[data-v-bebdfe92]{scrollbar-width:thin;scrollbar-color:rgba(156,163,175,.3) rgba(243,244,246,.5)}.custom-scrollbar[data-v-bebdfe92]::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar[data-v-bebdfe92]::-webkit-scrollbar-track{background:#f3f4f680;border-radius:3px}.custom-scrollbar[data-v-bebdfe92]::-webkit-scrollbar-thumb{background-color:#9ca3af80;border-radius:3px;-webkit-transition:background-color .3s;transition:background-color .3s}.custom-scrollbar[data-v-bebdfe92]::-webkit-scrollbar-thumb:hover{background-color:#9ca3afb3}[data-v-bebdfe92] [class*=dark] .custom-scrollbar{scrollbar-color:rgba(75,85,99,.5) rgba(31,41,55,.5)}[data-v-bebdfe92] [class*=dark] .custom-scrollbar::-webkit-scrollbar-track{background:#1f293780}[data-v-bebdfe92] [class*=dark] .custom-scrollbar::-webkit-scrollbar-thumb{background-color:#4b556380}[data-v-bebdfe92] [class*=dark] .custom-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#4b5563b3}.fade-enter-active[data-v-832d304e],.fade-leave-active[data-v-832d304e]{transition:opacity .3s ease,transform .3s ease}.fade-enter-from[data-v-832d304e],.fade-leave-to[data-v-832d304e]{opacity:0;transform:translateY(10px)}@media(min-width:640px){.sm\:w-120[data-v-832d304e]{width:30rem}}.fade-enter-to[data-v-832d304e],.fade-leave-from[data-v-832d304e]{opacity:1;transform:translateY(0)}.drawer-enter-active[data-v-832d304e],.drawer-leave-active[data-v-832d304e]{transition:transform .3s ease}.drawer-enter-from[data-v-832d304e],.drawer-leave-to[data-v-832d304e]{transform:translate(100%)}.list-enter-active[data-v-832d304e],.list-leave-active[data-v-832d304e]{transition:all .5s ease}.list-enter-from[data-v-832d304e],.list-leave-to[data-v-832d304e]{opacity:0;transform:translate(30px)}select option[data-v-832d304e]{padding:8px;margin:4px;border-radius:6px}select option[data-v-832d304e]:checked{background:linear-gradient(to right,#6366f180,#a855f780)!important;color:#fff!important}.dark select option[data-v-832d304e]:checked{background:linear-gradient(to right,#6366f1b3,#a855f7b3)!important}select option[data-v-832d304e]:hover{background-color:#6366f11a}.dark select option[data-v-832d304e]:hover{background-color:#6366f133}.custom-scrollbar[data-v-832d304e]{scrollbar-width:thin;scrollbar-color:rgba(156,163,175,.4) rgba(243,244,246,.3)}.custom-scrollbar[data-v-832d304e]::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-track{background:#f3f4f64d;border-radius:6px;margin:4px}.custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-thumb{background:linear-gradient(135deg,#6366f199,#a855f799);border-radius:6px;border:1px solid rgba(255,255,255,.2);-webkit-transition:all .3s ease;transition:all .3s ease}.custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-thumb:hover{background:linear-gradient(135deg,#6366f1cc,#a855f7cc);transform:scale(1.1)}.custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-corner{background:transparent}.dark .custom-scrollbar[data-v-832d304e]{scrollbar-color:rgba(75,85,99,.6) rgba(31,41,55,.4)}.dark .custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-track{background:#1f293766}.dark .custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-thumb{background:linear-gradient(135deg,#6366f1b3,#a855f7b3);border:1px solid rgba(255,255,255,.1)}.dark .custom-scrollbar[data-v-832d304e]::-webkit-scrollbar-thumb:hover{background:linear-gradient(135deg,#6366f1e6,#a855f7e6)}
|
||||
@@ -0,0 +1 @@
|
||||
import{c as X,d as ae,u as oe,a as U,o as F,b as r,n,e as t,i as ne,t as M,r as P,f as Fe,w as Xe,_ as ge,g as E,C as Ze,h as se,j as K,k as We,l as S,m as Je,p as Ee,q as ee,P as J,s as Ke,F as we,v as te,T as ie,x as ke,y as de,z as Qe,A as Ye,B as Se,D as _e,E as ce,G as et,X as Ce,H as tt,I as rt,J as re}from"./index-DaP6hnmm.js";import{u as st,P as at,S as Me,C as ot,c as nt,a as lt,Q as it,b as ue}from"./PageHeader-Dda1k_N5.js";import{F as Ie}from"./file-C928Lhos.js";import{E as dt,T as ct}from"./trash-JuhqIjo3.js";import"./box-C2OkK29z.js";const ut=X("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const pe=X("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);const pt=X("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const gt=X("cloud-upload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const ht=X("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);const ft=X("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const vt=X("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),Te=A=>A>=1024*1024*1024?Math.round(A/(1024*1024*1024))+"GB":A>=1024*1024?Math.round(A/(1024*1024))+"MB":Math.round(A/1024)+"KB",mt={class:"flex justify-center space-x-4 mb-6"},yt=ae({__name:"SendTypeSelector",props:{selectedType:{}},emits:["update:selectedType"],setup(A,{emit:y}){const{t:I}=oe(),s=y,f=ne("isDarkMode"),p=_=>{s("update:selectedType",_)};return(_,h)=>(F(),U("div",mt,[r("button",{type:"button",onClick:h[0]||(h[0]=d=>p("file")),class:n(["px-4 py-2 rounded-lg transition-colors duration-300",_.selectedType==="file"?"bg-indigo-600 text-white":t(f)?"bg-gray-700 text-gray-300 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"])},M(t(I)("nav.sendFile")),3),r("button",{type:"button",onClick:h[1]||(h[1]=d=>p("text")),class:n(["px-4 py-2 rounded-lg transition-colors duration-300",_.selectedType==="text"?"bg-indigo-600 text-white":t(f)?"bg-gray-700 text-gray-300 hover:bg-gray-600":"bg-gray-200 text-gray-700 hover:bg-gray-300"])},M(t(I)("send.sendText")),3)]))}}),xt=ae({__name:"BorderProgressBar",props:{progress:{}},setup(A){const y=A,I=P(null),s=P(null);let f=null;const p=()=>{if(!f||!s.value||!I.value)return;const h=I.value.clientWidth,d=I.value.clientHeight;s.value.width=h,s.value.height=d;const c=4,o=8;f.lineWidth=c;const T=f.createLinearGradient(0,0,h,d);T.addColorStop(0,"#4f46e5"),T.addColorStop(.5,"#7c3aed"),T.addColorStop(1,"#db2777"),f.strokeStyle="rgba(229, 231, 235, 0.2)",_(f,c/2,c/2,h-c,d-c,o),f.stroke();const u=((h+d)*2-8*o+2*Math.PI*o)*y.progress/100;f.strokeStyle=T,f.lineCap="round",f.lineJoin="round",f.beginPath();let g=u;const C=c/2,$=h-c,V=d-c;if(g>0){const b=Math.min($-2*o,g);f.moveTo(o+C,C),f.lineTo(b+o+C,C),g-=b}if(g>0){const b=Math.min(Math.PI/2,g/o);f.arc($-o+C,o+C,o,-Math.PI/2,b-Math.PI/2,!1),g-=b*o}if(g>0){const b=Math.min(V-2*o,g);f.lineTo($+C,b+o+C),g-=b}if(g>0){const b=Math.min(Math.PI/2,g/o);f.arc($-o+C,V-o+C,o,0,b,!1),g-=b*o}if(g>0){const b=Math.min($-2*o,g);f.lineTo($-b-o+C,V+C),g-=b}if(g>0){const b=Math.min(Math.PI/2,g/o);f.arc(o+C,V-o+C,o,Math.PI/2,Math.PI/2+b,!1),g-=b*o}if(g>0){const b=Math.min(V-2*o,g);f.lineTo(C,V-b-o+C),g-=b}if(g>0){const b=Math.min(Math.PI/2,g/o);f.arc(o+C,o+C,o,Math.PI,Math.PI+b,!1)}f.stroke()};function _(h,d,c,o,T,x){h.beginPath(),h.moveTo(d+x,c),h.lineTo(d+o-x,c),h.arcTo(d+o,c,d+o,c+x,x),h.lineTo(d+o,c+T-x),h.arcTo(d+o,c+T,d+o-x,c+T,x),h.lineTo(d+x,c+T),h.arcTo(d,c+T,d,c+T-x,x),h.lineTo(d,c+x),h.arcTo(d,c,d+x,c,x),h.closePath()}return Fe(()=>{s.value&&(f=s.value.getContext("2d"),p())}),Xe(()=>y.progress,p),(h,d)=>(F(),U("div",{class:"border-progress-container",ref_key:"container",ref:I},[r("canvas",{ref_key:"canvas",ref:s,class:"border-progress-canvas"},null,512)],512))}}),bt=ge(xt,[["__scopeId","data-v-2fbf5085"]]),wt=["accept","disabled"],kt={key:0,class:"absolute inset-0 w-full h-full"},St={class:"block truncate"},_t={key:1,class:"mt-3 w-full"},Ct=ae({__name:"FileUploadArea",props:{selectedFile:{default:null},progress:{default:0},placeholder:{default:""},Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
.border-progress-container[data-v-2fbf5085]{position:relative;width:100%;height:100%}.border-progress-canvas[data-v-2fbf5085]{position:absolute;top:0;left:0;width:100%;height:100%;transition:all .3s ease}.fade-enter-active[data-v-3a0327b0],.fade-leave-active[data-v-3a0327b0]{transition:opacity .3s ease,transform .3s ease}.fade-enter-from[data-v-3a0327b0],.fade-leave-to[data-v-3a0327b0]{opacity:0;transform:translateY(10px)}@media (min-width: 640px){.sm\:w-120[data-v-3a0327b0]{width:30rem}}.fade-enter-to[data-v-3a0327b0],.fade-leave-from[data-v-3a0327b0]{opacity:1;transform:translateY(0)}.drawer-enter-active[data-v-3a0327b0],.drawer-leave-active[data-v-3a0327b0]{transition:transform .3s ease}.drawer-enter-from[data-v-3a0327b0],.drawer-leave-to[data-v-3a0327b0]{transform:translate(100%)}.list-enter-active[data-v-3a0327b0],.list-leave-active[data-v-3a0327b0]{transition:all .5s ease}.list-enter-from[data-v-3a0327b0],.list-leave-to[data-v-3a0327b0]{opacity:0;transform:translate(30px)}
|
||||
@@ -1 +0,0 @@
|
||||
import{d as B,r as m,u as M,a as p,b,e,n as t,g as s,l as n,v as d,m as x,F as f,p as w,k as _,t as v,x as F,y as k,L as A}from"./index-EADe6V-l.js";const z={class:"p-6 h-screen overflow-y-auto custom-scrollbar"},E={class:"space-y-4"},T={class:"grid grid-cols-1 gap-6"},W={class:"space-y-2"},K={class:"space-y-2"},I={class:"space-y-2"},j={class:"relative"},G={class:"space-y-2"},L={class:"space-y-2"},N=["value"],R={class:"space-y-2"},P={class:"grid grid-cols-1 gap-6 mt-8"},$={class:"space-y-2"},H={class:"space-y-2"},q={class:"space-y-4"},J={class:"space-y-2"},O={class:"space-y-4"},Q={class:"space-y-2"},X={key:0,class:"space-y-4"},Y={class:"space-y-2"},Z={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee={class:"space-y-2"},oe={class:"space-y-2"},re={key:1,class:"space-y-4"},te={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ae={class:"space-y-2"},se={class:"space-y-2"},le={class:"space-y-2"},ne={class:"space-y-2"},de={class:"space-y-2"},ie={class:"space-y-2"},ue={class:"space-y-2"},ge={class:"space-y-2"},ce={class:"flex items-center"},ye=["aria-checked"],pe={class:"mt-8"},be={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ve={class:"space-y-2"},me={class:"flex items-center space-x-2"},xe={class:"space-y-2"},he={class:"flex items-center space-x-2"},fe={class:"space-y-2"},we={class:"flex items-center space-x-2"},_e={class:"space-y-2"},ke={class:"flex flex-wrap gap-3"},Ue=["value"],Se={class:"space-y-2"},Ve={class:"flex items-center space-x-2"},De={class:"space-y-2"},Ce={class:"flex items-center"},Be=["aria-checked"],Me={class:"mt-8"},Fe={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Ae={class:"space-y-2"},ze={class:"flex items-center space-x-2"},Ee={class:"space-y-2"},Te={class:"flex items-center space-x-2"},Ie=B({__name:"SystemSettingsView",setup(We){const a=F("isDarkMode"),l=m({name:"",description:"",file_storage:"",webdav_url:"",webdav_username:"",webdav_password:"",themesChoices:[],expireStyle:[],admin_token:"",robotsText:"",keywords:"",notify_title:"",storage_path:"",notify_content:"",openUpload:1,uploadSize:1,uploadMinute:1,max_save_seconds:0,opacity:.9,s3_access_key_id:"",background:"",showAdminAddr:0,page_explain:"",s3_secret_access_key:"",aws_session_token:"",s3_signature_version:"",s3_region_name:"",s3_bucket_name:"",s3_endpoint_url:"",s3_hostname:"",uploadCount:1,errorMinute:1,errorCount:1,s3_proxy:0,themesSelect:""}),c=m(1),y=m("MB"),u=m(1),g=m("天"),U=(i,o)=>i*{秒:1,分:60,时:3600,天:86400}[o],S=()=>{k({url:"/admin/config/get",method:"get"}).then(i=>{l.value=i.detail;let o=l.value.uploadSize;o>=1024*1024*1024?(c.value=Math.round(o/(1024*1024*1024)),y.value="GB"):o>=1024*1024?(c.value=Math.round(o/(1024*1024)),y.value="MB"):(c.value=Math.round(o/1024),y.value="KB");let r=l.value.max_save_seconds;r===0?(u.value=7,g.value="天"):r%86400===0&&r>=86400?(u.value=r/86400,g.value="天"):r%3600===0&&r>=3600?(u.value=r/3600,g.value="时"):r%60===0&&r>=60?(u.value=r/60,g.value="分"):(u.value=r,g.value="秒")})},h=M(),V=(i,o)=>i*{KB:1024,MB:1048576,GB:1073741824}[o],D=()=>{const i={...l.value};i.uploadSize=V(c.value,y.value),u.value===0?i.max_save_seconds=7*86400:i.max_save_seconds=U(u.value,g.value),k({url:"/admin/config/update",method:"patch",data:i}).then(o=>{o.code==200?h.showAlert("保存成功","success"):h.showAlert(o.message,"error")})};return S(),(i,o)=>(p(),b("div",z,[e("h2",{class:t(["text-2xl font-bold mb-6",[s(a)?"text-white":"text-gray-800"]])}," 系统设置 ",2),e("div",{class:t(["space-y-6 rounded-lg shadow-md p-6",[s(a)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[e("section",E,[e("h3",{class:t(["text-lg font-medium mb-4",[s(a)?"text-white":"text-gray-800"]])}," 基本设置 ",2),e("div",T,[e("div",W,[e("label",{class:t(["block text-sm font-medium",[s(a)?"text-gray-300":"text-gray-700"]])}," 网站名称 ",2),n(e("input",{type:"text","onUpdate:modelValue":o[0]||(o[0]=r=>l.value.name=r),class:t(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(a)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[d,l.value.name]])]),e("div",K,[e("label",{class:t(["block text-sm font-medium",[s(a)?"text-gray-300":"text-gray-700"]])}," 网站描述 ",2),n(e("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=r=>l.value.description=r),class:t(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[s(a)?"bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500":"border-gray-300 hover:border-gray-400 placeholder-gray-500"]])},null,2),[[d,l.value.description]])]),e("div",I,[e("label",{class:t(["block text-sm font-medium",[s(a)?"text-gray-300":"text-gray-700"]])}," 管理员密码 ",2),e("div",j,[n(e("input",{type:"password","onUpdate:modelValue":o[2]||(o[2]=r=Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{d as B,u as F,r as h,p as z,a as m,o as b,b as e,t as l,e as o,n as s,i as A,x as d,z as g,A as x,y as w,D as k,j as _,Z as U,$ as P}from"./index-DaP6hnmm.js";const T={class:"p-6 h-screen overflow-y-auto custom-scrollbar"},E={class:"space-y-4"},N={class:"grid grid-cols-1 gap-6"},L={class:"space-y-2"},I={class:"space-y-2"},$={class:"space-y-2"},j={class:"relative"},K=["placeholder"],G={class:"text-xs"},W={class:"space-y-2"},R={class:"space-y-2"},H=["value"],Z={class:"space-y-2"},q={class:"grid grid-cols-1 gap-6 mt-8"},J={class:"space-y-2"},O={class:"space-y-2"},Q={class:"space-y-4"},X={class:"space-y-2"},Y=["placeholder"],ee={class:"space-y-4"},oe={class:"space-y-2"},te={value:"local"},re={value:"s3"},ae={value:"webdav"},se={key:0,class:"space-y-2"},ne={class:"flex items-center"},ie=["aria-checked"],le={key:1,class:"space-y-4"},de={class:"space-y-2"},ge=["placeholder"],ue={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ce={class:"space-y-2"},ye=["placeholder"],me={class:"space-y-2"},be=["placeholder"],pe={key:2,class:"space-y-4"},ve={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},he={class:"space-y-2"},xe={class:"space-y-2"},fe={class:"space-y-2"},_e={class:"space-y-2"},we={class:"space-y-2"},ke=["placeholder"],Ue={class:"space-y-2"},Ce={value:"s3v2"},Se={value:"s3v4"},Ve={class:"space-y-2"},De={class:"space-y-2"},Me={class:"flex items-center"},Be=["aria-checked"],Fe={class:"space-y-2"},ze={class:"flex items-center"},Ae=["aria-checked"],Pe={class:"mt-8"},Te={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Ee={class:"space-y-2"},Ne={class:"flex items-center space-x-2"},Le={class:"space-y-2"},Ie={class:"flex items-center space-x-2"},$e={class:"space-y-2"},je={class:"flex items-center space-x-2"},Ke={value:"KB"},Ge={value:"MB"},We={value:"GB"},Re={class:"space-y-2"},He={class:"flex flex-wrap gap-3"},Ze=["value"],qe={class:"space-y-2"},Je={class:"flex items-center space-x-2"},Oe={value:"秒"},Qe={value:"分"},Xe={value:"时"},Ye={value:"天"},eo={class:"space-y-2"},oo={class:"flex items-center"},to=["aria-checked"],ro={class:"mt-8"},ao={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},so={class:"space-y-2"},no={class:"flex items-center space-x-2"},io={class:"space-y-2"},lo={class:"flex items-center space-x-2"},go={class:"flex justify-end mt-8"},yo=B({__name:"SystemSettingsView",setup(uo){const n=A("isDarkMode"),{t:i}=F(),t=h({name:"",description:"",file_storage:"",webdav_url:"",webdav_username:"",webdav_password:"",themesChoices:[],expireStyle:[],admin_token:"",robotsText:"",keywords:"",notify_title:"",storage_path:"",notify_content:"",openUpload:1,uploadSize:1,enableChunk:0,uploadMinute:1,max_save_seconds:0,opacity:.9,s3_access_key_id:"",background:"",showAdminAddr:0,page_explain:"",s3_secret_access_key:"",aws_session_token:"",s3_signature_version:"",s3_region_name:"",s3_bucket_name:"",s3_endpoint_url:"",s3_hostname:"",uploadCount:1,errorMinute:1,errorCount:1,s3_proxy:0,themesSelect:""}),p=h(1),v=h("MB"),c=h(1),y=h("天"),C=(u,a)=>u*{秒:1,分:60,时:3600,天:86400}[a],f=z(),S=async()=>{try{const u=await U.getConfig();if(u.code===200&&u.detail){t.value=u.detail;const a=t.value.uploadSize;a>=1024*1024*1024?(p.value=Math.round(a/(1024*1024*1024)),v.value="GB"):a>=1024*1024?(p.value=Math.round(a/(1024*1024)),v.value="MB"):(p.value=Math.round(a/1024),v.value="KB");const r=t.value.max_save_seconds;r===0?(c.value=7,y.value="天"):r%86400===0&&r>=86400?(c.value=r/86400,y.value="天"):r%3600===0&&r>=3600?(c.value=r/3600,y.value="时"):r%60===0&&r>=60?(c.value=r/60,y.value="分"):(c.value=r,y.value="秒")}}catch(u){const a=u instanceof Error?u.message:i("manage.systemSettings.getConfigFailed");f.showAlert(a,"error"),console.error("Failed to get system config:",u)}},V=(u,a)=>u*{KB:1024,MB:1048576,GB:1073741824}[a],D=()=>{const u={...t.value};u.uploadSize=V(p.value,v.value),c.value===0?u.max_save_seconds=7*86400:u.max_save_seconds=C(c.value,y.value),U.updateConfig(u).then(a=>{a.code==200?f.showAlert(i("manage.systemSettings.saveSuccess"),"success"):f.showAlert(a.message||i("manage.systemSettings.saveFailed"),"error")}).catch(a=>{const r=a instanceof Error?a.message:i("manage.systemSettings.saveFailed");f.showAlert(r,"error")})};return S(),(u,a)=>(b(),m("div",T,[e("h2",{class:s(["text-2xl font-bold mb-6",[o(n)?"text-white":"text-gray-800"]])},l(o(i)("admin.settings.title")),3),e("div",{class:s(["space-y-6 rounded-lg shadow-md p-6",[o(n)?"bg-gray-800 bg-opacity-70":"bg-white"]])},[e("section",E,[e("h3",{class:s(["text-lg font-medium mb-4",[o(n)?"text-white":"text-gray-800"]])},l(o(i)("admin.settings.basicSettings")),3),e("div",N,[e("div",L,[e("label",{class:s(["block text-sm font-medium",[o(n)?"text-gray-300":"text-gray-700"]])},l(o(i)("admin.settings.siteName")),3),d(e("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=r=>t.value.name=r),class:s(["w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none",[o(n)?"bgLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{c as a}from"./index-DaP6hnmm.js";const e=a("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);export{e as B};
|
||||
@@ -1,6 +0,0 @@
|
||||
import{c as a}from"./index-EADe6V-l.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const o=a("BoxIcon",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);export{o as B};
|
||||
@@ -0,0 +1 @@
|
||||
import{c}from"./index-DaP6hnmm.js";const t=c("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);export{t as C};
|
||||
@@ -0,0 +1 @@
|
||||
import{c as a}from"./index-DaP6hnmm.js";const t=a("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);export{t as F};
|
||||
@@ -1,6 +0,0 @@
|
||||
import{c as a}from"./index-EADe6V-l.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const t=a("FileIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);export{t as F};
|
||||
@@ -1,26 +0,0 @@
|
||||
import{c as D,d as _,D as I,r as k,E as U,o as W,G as $,H as Q}from"./index-EADe6V-l.js";/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const x=D("CalendarIcon",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ee=D("ClipboardListIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const te=D("EyeIcon",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
||||
* @license lucide-vue-next v0.445.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const re=D("ShieldCheckIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/*!
|
||||
* qrcode.vue v3.4.1
|
||||
* A Vue.js component to generate QRCode.
|
||||
* © 2017-2023 @scopewu(https://github.com/scopewu)
|
||||
* MIT License.
|
||||
*/var b=function(){return b=Object.assign||function(f){for(var l,u=1,c=arguments.length;u<c;u++){l=arguments[u];for(var d in l)Object.prototype.hasOwnProperty.call(l,d)&&(f[d]=l[d])}return f},b.apply(this,arguments)};var N;(function(s){var f=function(){function n(e,t,r,a){if(this.version=e,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],e<n.MIN_VERSION||e>n.MAX_VERSION)throw new RangeError("Version value out of range");if(a<-1||a>7)throw new RangeError("Mask value out of range");this.size=e*4+17;for(var o=[],i=0;i<this.size;i++)o.push(!1);for(var i=0;i<this.size;i++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();var h=this.addEccAndInterleave(r);if(this.drawCodewords(h),a==-1)for(var v=1e9,i=0;i<8;i++){this.applyMask(i),this.drawFormatBits(i);var E=this.getPenaltyScore();E<v&&(a=i,v=E),this.applyMask(i)}c(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}return n.encodeText=function(e,t){var r=s.QrSegment.makeSegments(e);return n.encodeSegments(r,t)},n.encodeBinary=function(e,t){var r=s.QrSegment.makeBytes(e);return n.encodeSegments([r],t)},n.encodeSegments=function(e,t,r,a,o,i){if(r===void 0&&(r=1),a===void 0&&(a=40),o===void 0&&(o=-1),i===void 0&&(i=!0),!(n.MIN_VERSION<=r&&r<=a&&a<=n.MAX_VERSION)||o<-1||o>7)throw new RangeError("Invalid value");var h,v;for(h=r;;h++){var E=n.getNumDataCodewords(h,t)*8,m=d.getTotalBits(e,h);if(m<=E){v=m;break}if(h>=a)throw new RangeError("Data too long")}for(var p=0,C=[n.Ecc.MEDIUM,n.Ecc.QUARTILE,n.Ecc.HIGH];p<C.length;p++){var M=C[p];i&&v<=n.getNumDataCodewords(h,M)*8&&(t=M)}for(var g=[],w=0,S=e;w<S.length;w++){var R=S[w];l(R.mode.modeBits,4,g),l(R.numChars,R.mode.numCharCountBits(h),g);for(var P=0,y=R.getData();P<y.length;P++){var K=y[P];g.push(K)}}c(g.length==v);var O=n.getNumDataCodewords(h,t)*8;c(g.length<=O),l(0,Math.min(4,O-g.length),g),l(0,(8-g.length%8)%8,g),c(g.length%8==0);for(var T=236;g.length<O;T^=253)l(T,8,g);for(var z=[];z.length*8<g.length;)z.push(0);return g.forEach(function(J,F){return z[F>>>3]|=J<<7-(F&7)}),new n(h,t,z,o)},n.prototype.getModule=function(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]},n.prototype.getModules=function(){return this.modules},n.prototype.drawFunctionPatterns=function(){for(var e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var t=this.getAlignmentPatternPositions(),r=t.length,e=0;e<r;e++)for(var a=0;a<r;a++)e==0&&a==0||e==0&&a==r-1||e==r-1&&a==0||this.drawAlignmentPattern(t[e],t[a]);this.drawFormatBits(0),this.drawVersion()},n.prototype.drawFormatBits=function(e){for(var t=this.errorCorrectionLevel.formatBits<<3|e,r=t,a=0;a<10;a++)r=r<<1^(r>>>9)*1335;var o=(t<<10|r)^21522;c(o>>>15==0);for(var a=0;a<=5;a++)this.setFunctionModule(8,a,u(o,a));this.setFunctionModule(8,7,u(o,6)),this.setFunctionModule(8,8,u(o,7)),this.setFunctionModule(7,8,u(o,8));for(var a=9;a<15;a++)this.setFunctionModule(14-a,8,u(o,a));for(var a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,u(o,a));for(var a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,u(o,a));this.setFunctionModule(8,this.size-8,!0)},n.prototype.drawVersion=function(){if(!(this.version<7)){for(var e=this.version,t=0;t<12;t++)e=e<<1^(e>>>11)*7973;var r=this.version<<12|e;c(r>>>18==0);for(var t=0;t<18;t++){var a=u(r,t),o=this.size-11+t%3,i=Math.floor(t/3);this.setFunctionModule(o,i,a),this.setFunctionModule(i,o,a)}}},n.prototype.drawFinderPattern=function(e,t){for(var r=-4;r<=4;r++)for(var a=-4;a<=4;a++){var o=Math.max(Math.abs(a),Math.abs(r)),i=e+a,h=t+r;0<=i&&i<this.size&&0<=h&&h<this.size&&this.setFunctionModule(i,h,o!=2&&o!=4)}},n.prototype.drawAlignmentPattern=function(e,t){for(var r=-2;r<=2;r++)for(var a=-2;a<=2;a++)this.setFunctionModule(e+a,t+r,Math.max(Math.abs(a),Math.abs(r))!=1)},n.prototype.setFunctionModule=function(e,t,r){this.modules[t][e]=r,this.isFunction[t][e]=!0},n.prototype.addEccAndInterleave=function(e){var t=this.version,r=this.errorCorrectionLevel;if(e.length!=n.getNumDataCodewords(t,r))throw new RangeError("Invalid argument");for(var a=n.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][t],o=n.ECC_CODEWORDS_PER_BLOCK[r.ordinal][t],i=Math.floor(n.getNumRawDataModules(t)/8),h=a-i%a,v=Math.floor(i/a),E=[],m=n.reedSolomonComputeDivisor(o),p=0,C=0;p<a;p++){var M=e.slice(C,C+v-o+(p<h?0:1));C+=M.length;var g=n.reedSolomonComputeRemainder(M,m);p<h&&M.push(0),E.push(M.concat(g))}for(var w=[],S=function(R){E.forEach(function(P,y){(R!=v-o||y>=h)&&w.push(P[R])})},p=0;p<E[0].length;p++)S(p);return c(w.length==i),w},n.prototype.drawCodewords=function(e){if(e.length!=Math.floor(n.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var t=0,r=this.size-1;r>=1;r-=2){r==6&&(r=5);for(var a=0;a<this.size;a++)for(var o=0;o<2;o++){var i=r-o,h=(r+1&2)==0,v=h?this.size-1-a:a;!this.isFunction[v][i]&&t<e.lengLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{c as e}from"./index-DaP6hnmm.js";const a=e("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);export{a as H};
|
||||
@@ -0,0 +1 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}.\!container{width:100%!important}.container{width:100%}@media (min-width: 640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width: 768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width: 1024px)Line truncated
|
||||
Loaded 100 of 105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user