diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b059a20b0d9..b800c768db4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -2,9 +2,9 @@ name: build
on:
push:
- branches: [ 'main' ]
+ branches: ["main"]
pull_request:
- branches: [ 'main' ]
+ branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest]
- go-version: [ '1.21' ]
+ go-version: ["1.21"]
name: Build
runs-on: ${{ matrix.platform }}
steps:
@@ -27,6 +27,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
+ - name: Check Space
+ run: |
+ df -h
+
- uses: benjlevesque/short-sha@v3.0
id: short-sha
@@ -44,5 +48,5 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
- name: alist_${{ env.SHA }}
- path: dist
\ No newline at end of file
+ name: sweet-cloud_${{ env.SHA }}
+ path: dist
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6ef38566143..1194ff10136 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,6 +30,15 @@ jobs:
with:
fetch-depth: 0
+ - name: 释放磁盘空间
+ uses: jlumbroso/free-disk-space@main
+ with:
+ swap-storage: true
+
+ - name: Check Space
+ run: |
+ df -h
+
- name: Install dependencies
run: |
sudo snap install zig --classic --beta
@@ -46,30 +55,3 @@ jobs:
with:
files: build/compress/*
prerelease: false
-
- release_desktop:
- needs: release
- name: Release desktop
- runs-on: ubuntu-latest
- steps:
- - name: Checkout repo
- uses: actions/checkout@v4
- with:
- repository: alist-org/desktop-release
- ref: main
- persist-credentials: false
- fetch-depth: 0
-
- - name: Add tag
- run: |
- git config --local user.email "bot@nn.ci"
- git config --local user.name "IlaBot"
- version=$(wget -qO- -t1 -T2 "https://api.github.com/repos/alist-org/alist/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
- git tag -a $version -m "release $version"
-
- - name: Push tags
- uses: ad-m/github-push-action@master
- with:
- github_token: ${{ secrets.MY_TOKEN }}
- branch: main
- repository: alist-org/desktop-release
\ No newline at end of file
diff --git a/.github/workflows/release_android.yml b/.github/workflows/release_android.yml
index 7e071cbe2ff..bcfffd60e59 100644
--- a/.github/workflows/release_android.yml
+++ b/.github/workflows/release_android.yml
@@ -24,6 +24,10 @@ jobs:
with:
fetch-depth: 0
+ - name: Check Space
+ run: |
+ df -h
+
- name: Build
run: |
bash build.sh release android
diff --git a/.github/workflows/release_docker.yml b/.github/workflows/release_docker.yml
index a2dd2dd72d8..3b85b871c83 100644
--- a/.github/workflows/release_docker.yml
+++ b/.github/workflows/release_docker.yml
@@ -3,7 +3,7 @@ name: release_docker
on:
push:
tags:
- - 'v*'
+ - '*'
jobs:
release_docker:
@@ -12,17 +12,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
+
+ - name: Check Space
+ run: |
+ df -h
- uses: actions/setup-go@v5
with:
- go-version: 'stable'
+ go-version: "stable"
- name: Cache Musl
id: cache-musl
uses: actions/cache@v4
with:
path: build/musl-libs
- key: docker-musl-libs-v2
+ key: docker-musl-libs
- name: Download Musl Library
if: steps.cache-musl.outputs.cache-hit != 'true'
@@ -35,7 +39,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
- images: xhofe/alist
+ images: leolitaly/sweet-cloud
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -46,7 +50,7 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v3
with:
- username: xhofe
+ username: leolitaly
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
@@ -58,51 +62,4 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
-
- - name: Docker meta with ffmpeg
- id: meta-ffmpeg
- uses: docker/metadata-action@v5
- with:
- images: xhofe/alist
- flavor: |
- latest=true
- suffix=-ffmpeg,onlatest=true
-
- - name: Build and push with ffmpeg
- id: docker_build_ffmpeg
- uses: docker/build-push-action@v6
- with:
- context: .
- file: Dockerfile.ci
- push: true
- tags: ${{ steps.meta-ffmpeg.outputs.tags }}
- labels: ${{ steps.meta-ffmpeg.outputs.labels }}
- build-args: INSTALL_FFMPEG=true
- platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
-
- release_docker_with_aria2:
- needs: release_docker
- name: Release docker with aria2
- runs-on: ubuntu-latest
- steps:
- - name: Checkout repo
- uses: actions/checkout@v4
- with:
- repository: alist-org/with_aria2
- ref: main
- persist-credentials: false
- fetch-depth: 0
-
- - name: Add tag
- run: |
- git config --local user.email "bot@nn.ci"
- git config --local user.name "IlaBot"
- git tag -a ${{ github.ref_name }} -m "release ${{ github.ref_name }}"
-
- - name: Push tags
- uses: ad-m/github-push-action@master
- with:
- github_token: ${{ secrets.MY_TOKEN }}
- branch: main
- repository: alist-org/with_aria2
+ platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x
diff --git a/.github/workflows/release_freebsd.yml b/.github/workflows/release_freebsd.yml
index 70dcecb10f9..b6684a1858c 100644
--- a/.github/workflows/release_freebsd.yml
+++ b/.github/workflows/release_freebsd.yml
@@ -23,6 +23,10 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
+
+ - name: Check Space
+ run: |
+ df -h
- name: Build
run: |
diff --git a/.github/workflows/release_linux_musl.yml b/.github/workflows/release_linux_musl.yml
index bb5291a9ac2..2bd516ccbf6 100644
--- a/.github/workflows/release_linux_musl.yml
+++ b/.github/workflows/release_linux_musl.yml
@@ -24,6 +24,10 @@ jobs:
with:
fetch-depth: 0
+ - name: Check Space
+ run: |
+ df -h
+
- name: Build
run: |
bash build.sh release linux_musl
diff --git a/.github/workflows/release_linux_musl_arm.yml b/.github/workflows/release_linux_musl_arm.yml
index 0e8a9618a76..04eb83b18cc 100644
--- a/.github/workflows/release_linux_musl_arm.yml
+++ b/.github/workflows/release_linux_musl_arm.yml
@@ -23,6 +23,10 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
+
+ - name: Check Space
+ run: |
+ df -h
- name: Build
run: |
diff --git a/README.md b/README.md
index bed2eadf160..0cc557810a1 100644
--- a/README.md
+++ b/README.md
@@ -1,141 +1,21 @@
-
-
-
🗂️A file list program that supports multiple storages, powered by Gin and Solidjs.
-
-
-
+## 个性魔改美化定制版
----
+功能详情请看更新日志。
-English | [中文](./README_cn.md)| [日本語](./README_ja.md) | [Contributing](./CONTRIBUTING.md) | [CODE_OF_CONDUCT](./CODE_OF_CONDUCT.md)
+## Docker
-## Features
+docker pull leolitaly/sweet-cloud:latest
-- [x] Multiple storages
- - [x] Local storage
- - [x] [Aliyundrive](https://www.alipan.com/)
- - [x] OneDrive / Sharepoint ([global](https://www.office.com/), [cn](https://portal.partner.microsoftonline.cn),de,us)
- - [x] [189cloud](https://cloud.189.cn) (Personal, Family)
- - [x] [GoogleDrive](https://drive.google.com/)
- - [x] [123pan](https://www.123pan.com/)
- - [x] FTP / SFTP
- - [x] [PikPak](https://www.mypikpak.com/)
- - [x] [S3](https://aws.amazon.com/s3/)
- - [x] [Seafile](https://seafile.com/)
- - [x] [UPYUN Storage Service](https://www.upyun.com/products/file-storage)
- - [x] WebDav(Support OneDrive/SharePoint without API)
- - [x] Teambition([China](https://www.teambition.com/ ),[International](https://us.teambition.com/ ))
- - [x] [Mediatrack](https://www.mediatrack.cn/)
- - [x] [139yun](https://yun.139.com/) (Personal, Family)
- - [x] [YandexDisk](https://disk.yandex.com/)
- - [x] [BaiduNetdisk](http://pan.baidu.com/)
- - [x] [Terabox](https://www.terabox.com/main)
- - [x] [UC](https://drive.uc.cn)
- - [x] [Quark](https://pan.quark.cn)
- - [x] [Thunder](https://pan.xunlei.com)
- - [x] [Lanzou](https://www.lanzou.com/)
- - [x] [ILanzou](https://www.ilanzou.com/)
- - [x] [Aliyundrive share](https://www.alipan.com/)
- - [x] [Google photo](https://photos.google.com/)
- - [x] [Mega.nz](https://mega.nz)
- - [x] [Baidu photo](https://photo.baidu.com/)
- - [x] SMB
- - [x] [115](https://115.com/)
- - [X] Cloudreve
- - [x] [Dropbox](https://www.dropbox.com/)
- - [x] [FeijiPan](https://www.feijipan.com/)
- - [x] [dogecloud](https://www.dogecloud.com/product/oss)
-- [x] Easy to deploy and out-of-the-box
-- [x] File preview (PDF, markdown, code, plain text, ...)
-- [x] Image preview in gallery mode
-- [x] Video and audio preview, support lyrics and subtitles
-- [x] Office documents preview (docx, pptx, xlsx, ...)
-- [x] `README.md` preview rendering
-- [x] File permalink copy and direct file download
-- [x] Dark mode
-- [x] I18n
-- [x] Protected routes (password protection and authentication)
-- [x] WebDav (see https://alist.nn.ci/guide/webdav.html for details)
-- [x] [Docker Deploy](https://hub.docker.com/r/xhofe/alist)
-- [x] Cloudflare Workers proxy
-- [x] File/Folder package download
-- [x] Web upload(Can allow visitors to upload), delete, mkdir, rename, move and copy
-- [x] Offline download
-- [x] Copy files between two storage
-- [x] Multi-thread downloading acceleration for single-thread download/stream
+预览图
-## Document
-
-
-
-## Demo
-
-
-
-## Discussion
-
-Please go to our [discussion forum](https://github.com/alist-org/alist/discussions) for general questions, **issues are for bug reports and feature requests only.**
-
-## Sponsor
-
-AList is an open-source software, if you happen to like this project and want me to keep going, please consider sponsoring me or providing a single donation! Thanks for all the love and support:
-https://alist.nn.ci/guide/sponsor.html
-
-### Special sponsors
-
-- [VidHub](https://apps.apple.com/app/apple-store/id1659622164?pt=118612019&ct=alist&mt=8) - An elegant cloud video player within the Apple ecosystem. Support for iPhone, iPad, Mac, and Apple TV.
-- [亚洲云](https://www.asiayun.com/aff/QQCOOQKZ) - 高防服务器|服务器租用|福州高防|广东电信|香港服务器|美国服务器|海外服务器 - 国内靠谱的企业级云计算服务提供商 (sponsored Chinese API server)
-- [找资源](http://zhaoziyuan2.cc/) - 阿里云盘资源搜索引擎
-
-## Contributors
-
-Thanks goes to these wonderful people:
-
-[![Contributors](http://contrib.nn.ci/api?repo=alist-org/alist&repo=alist-org/alist-web&repo=alist-org/docs)](https://github.com/alist-org/alist/graphs/contributors)
-
-## License
-
-The `AList` is open-source software licensed under the AGPL-3.0 license.
-
-## Disclaimer
-- This program is a free and open source project. It is designed to share files on the network disk, which is convenient for downloading and learning Golang. Please abide by relevant laws and regulations when using it, and do not abuse it;
-- This program is implemented by calling the official sdk/interface, without destroying the official interface behavior;
-- This program only does 302 redirect/traffic forwarding, and does not intercept, store, or tamper with any user data;
-- Before using this program, you should understand and bear the corresponding risks, including but not limited to account ban, download speed limit, etc., which is none of this program's business;
-- If there is any infringement, please contact me by [email](mailto:i@nn.ci), and it will be dealt with in time.
-
----
-
-> [@Blog](https://nn.ci/) · [@GitHub](https://github.com/alist-org) · [@TelegramGroup](https://t.me/alist_chat) · [@Discord](https://discord.gg/F4ymsH4xv2)
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.sh b/build.sh
index a87eabf4f81..9eba0c6ee28 100644
--- a/build.sh
+++ b/build.sh
@@ -27,7 +27,7 @@ ldflags="\
"
FetchWebDev() {
- curl -L https://codeload.github.com/alist-org/web-dist/tar.gz/refs/heads/dev -o web-dist-dev.tar.gz
+ curl -L https://codeload.github.com/li-peifeng/Sweet-Cloud-Dist/tar.gz/refs/heads/dev -o web-dist-dev.tar.gz
tar -zxvf web-dist-dev.tar.gz
rm -rf public/dist
mv -f web-dist-dev/dist public
@@ -35,7 +35,7 @@ FetchWebDev() {
}
FetchWebRelease() {
- curl -L https://github.com/alist-org/alist-web/releases/latest/download/dist.tar.gz -o dist.tar.gz
+ curl -L https://github.com/li-peifeng/Sweet-Cloud-Web/releases/latest/download/dist.tar.gz -o dist.tar.gz
tar -zxvf dist.tar.gz
rm -rf public/dist
mv -f dist public
diff --git a/docker-compose.yml b/docker-compose.yml
index 05e9f8d790f..4e33d3bc520 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,16 +1,16 @@
-version: '3.3'
+version: "3.3"
services:
alist:
restart: always
volumes:
- - '/etc/alist:/opt/alist/data'
+ - "/etc/sweet-cloud:/opt/alist/data"
ports:
- - '5244:5244'
- - '5245:5245'
+ - "5244:5244"
+ - "5245:5245"
environment:
- PUID=0
- PGID=0
- UMASK=022
- TZ=UTC
container_name: alist
- image: 'xhofe/alist:latest'
+ image: "leolitaly/sweet-cloud:latest"
diff --git a/internal/fs/copy.go b/internal/fs/copy.go
index d4ad452b169..0df9a0b7c95 100644
--- a/internal/fs/copy.go
+++ b/internal/fs/copy.go
@@ -29,7 +29,7 @@ type CopyTask struct {
}
func (t *CopyTask) GetName() string {
- return fmt.Sprintf("copy [%s](%s) to [%s](%s)", t.SrcStorageMp, t.SrcObjPath, t.DstStorageMp, t.DstDirPath)
+ return fmt.Sprintf("复制 [%s](%s) 到 [%s](%s)", t.SrcStorageMp, t.SrcObjPath, t.DstStorageMp, t.DstDirPath)
}
func (t *CopyTask) GetStatus() string {
@@ -45,7 +45,7 @@ func (t *CopyTask) Run() error {
t.dstStorage, err = op.GetStorageByMountPath(t.DstStorageMp)
}
if err != nil {
- return errors.WithMessage(err, "failed get storage")
+ return errors.WithMessage(err, "无法获取存储")
}
return copyBetween2Storages(t, t.srcStorage, t.dstStorage, t.SrcObjPath, t.DstDirPath)
}
@@ -57,11 +57,11 @@ var CopyTaskManager *tache.Manager[*CopyTask]
func _copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool) (task.TaskInfoWithCreator, error) {
srcStorage, srcObjActualPath, err := op.GetStorageAndActualPath(srcObjPath)
if err != nil {
- return nil, errors.WithMessage(err, "failed get src storage")
+ return nil, errors.WithMessage(err, "获取源存储失败")
}
dstStorage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
if err != nil {
- return nil, errors.WithMessage(err, "failed get dst storage")
+ return nil, errors.WithMessage(err, "获取目标存储失败")
}
// copy if in the same storage, just call driver.Copy
if srcStorage.GetStorage() == dstStorage.GetStorage() {
@@ -70,7 +70,7 @@ func _copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool
if ctx.Value(conf.NoTaskKey) != nil {
srcObj, err := op.Get(ctx, srcStorage, srcObjActualPath)
if err != nil {
- return nil, errors.WithMessagef(err, "failed get src [%s] file", srcObjPath)
+ return nil, errors.WithMessagef(err, "源文件 [%s] 获取失败", srcObjPath)
}
if !srcObj.IsDir() {
// copy file directly
@@ -78,7 +78,7 @@ func _copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool
Header: http.Header{},
})
if err != nil {
- return nil, errors.WithMessagef(err, "failed get [%s] link", srcObjPath)
+ return nil, errors.WithMessagef(err, "链接 [%s] 获取失败", srcObjPath)
}
fs := stream.FileStream{
Obj: srcObj,
@@ -87,7 +87,7 @@ func _copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool
// any link provided is seekable
ss, err := stream.NewSeekableStream(fs, link)
if err != nil {
- return nil, errors.WithMessagef(err, "failed get [%s] stream", srcObjPath)
+ return nil, errors.WithMessagef(err, "流媒体 [%s] 获取失败", srcObjPath)
}
return nil, op.Put(ctx, dstStorage, dstDirActualPath, ss, nil, false)
}
@@ -110,16 +110,16 @@ func _copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool
}
func copyBetween2Storages(t *CopyTask, srcStorage, dstStorage driver.Driver, srcObjPath, dstDirPath string) error {
- t.Status = "getting src object"
+ t.Status = "获取源对象"
srcObj, err := op.Get(t.Ctx(), srcStorage, srcObjPath)
if err != nil {
- return errors.WithMessagef(err, "failed get src [%s] file", srcObjPath)
+ return errors.WithMessagef(err, "源文件 [%s] 获取失败", srcObjPath)
}
if srcObj.IsDir() {
t.Status = "src object is dir, listing objs"
objs, err := op.List(t.Ctx(), srcStorage, srcObjPath, model.ListArgs{})
if err != nil {
- return errors.WithMessagef(err, "failed list src [%s] objs", srcObjPath)
+ return errors.WithMessagef(err, "源对象 [%s] 获取失败", srcObjPath)
}
for _, obj := range objs {
if utils.IsCanceled(t.Ctx()) {
@@ -139,7 +139,7 @@ func copyBetween2Storages(t *CopyTask, srcStorage, dstStorage driver.Driver, src
DstStorageMp: dstStorage.GetStorage().MountPath,
})
}
- t.Status = "src object is dir, added all copy tasks of objs"
+ t.Status = "源对象为文件夹, 已添加了所有对象的复制任务"
return nil
}
return copyFileBetween2Storages(t, srcStorage, dstStorage, srcObjPath, dstDirPath)
@@ -148,13 +148,13 @@ func copyBetween2Storages(t *CopyTask, srcStorage, dstStorage driver.Driver, src
func copyFileBetween2Storages(tsk *CopyTask, srcStorage, dstStorage driver.Driver, srcFilePath, dstDirPath string) error {
srcFile, err := op.Get(tsk.Ctx(), srcStorage, srcFilePath)
if err != nil {
- return errors.WithMessagef(err, "failed get src [%s] file", srcFilePath)
+ return errors.WithMessagef(err, "源文件 [%s] 获取失败", srcFilePath)
}
link, _, err := op.Link(tsk.Ctx(), srcStorage, srcFilePath, model.LinkArgs{
Header: http.Header{},
})
if err != nil {
- return errors.WithMessagef(err, "failed get [%s] link", srcFilePath)
+ return errors.WithMessagef(err, "链接 [%s] 获取失败", srcFilePath)
}
fs := stream.FileStream{
Obj: srcFile,
@@ -163,7 +163,7 @@ func copyFileBetween2Storages(tsk *CopyTask, srcStorage, dstStorage driver.Drive
// any link provided is seekable
ss, err := stream.NewSeekableStream(fs, link)
if err != nil {
- return errors.WithMessagef(err, "failed get [%s] stream", srcFilePath)
+ return errors.WithMessagef(err, "流媒体 [%s] 获取失败", srcFilePath)
}
return op.Put(tsk.Ctx(), dstStorage, dstDirPath, ss, tsk.SetProgress, true)
}
diff --git a/internal/fs/get.go b/internal/fs/get.go
index 17c202b7412..a200af0ed26 100644
--- a/internal/fs/get.go
+++ b/internal/fs/get.go
@@ -33,7 +33,7 @@ func get(ctx context.Context, path string) (model.Obj, error) {
IsFolder: true,
}, nil
}
- return nil, errors.WithMessage(err, "failed get storage")
+ return nil, errors.WithMessage(err, "存储获取失败")
}
return op.Get(ctx, storage, actualPath)
}
diff --git a/internal/fs/link.go b/internal/fs/link.go
index 3dfd7e5a35e..9cb6a1ee4eb 100644
--- a/internal/fs/link.go
+++ b/internal/fs/link.go
@@ -14,11 +14,11 @@ import (
func link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error) {
storage, actualPath, err := op.GetStorageAndActualPath(path)
if err != nil {
- return nil, nil, errors.WithMessage(err, "failed get storage")
+ return nil, nil, errors.WithMessage(err, "存储获取失败")
}
l, obj, err := op.Link(ctx, storage, actualPath, args)
if err != nil {
- return nil, nil, errors.WithMessage(err, "failed link")
+ return nil, nil, errors.WithMessage(err, "链接失败")
}
if l.URL != "" && !strings.HasPrefix(l.URL, "http://") && !strings.HasPrefix(l.URL, "https://") {
if c, ok := ctx.(*gin.Context); ok {
diff --git a/internal/fs/list.go b/internal/fs/list.go
index d4f59cb829f..b4b76629931 100644
--- a/internal/fs/list.go
+++ b/internal/fs/list.go
@@ -17,7 +17,7 @@ func list(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error)
virtualFiles := op.GetStorageVirtualFilesByPath(path)
storage, actualPath, err := op.GetStorageAndActualPath(path)
if err != nil && len(virtualFiles) == 0 {
- return nil, errors.WithMessage(err, "failed get storage")
+ return nil, errors.WithMessage(err, "存储获取失败")
}
var _objs []model.Obj
@@ -31,7 +31,7 @@ func list(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error)
log.Errorf("fs/list: %+v", err)
}
if len(virtualFiles) == 0 {
- return nil, errors.WithMessage(err, "failed get objs")
+ return nil, errors.WithMessage(err, "对象获取失败")
}
}
}
diff --git a/internal/fs/other.go b/internal/fs/other.go
index 85b7b1d17bf..71abe7bb2cc 100644
--- a/internal/fs/other.go
+++ b/internal/fs/other.go
@@ -12,7 +12,7 @@ import (
func makeDir(ctx context.Context, path string, lazyCache ...bool) error {
storage, actualPath, err := op.GetStorageAndActualPath(path)
if err != nil {
- return errors.WithMessage(err, "failed get storage")
+ return errors.WithMessage(err, "存储获取失败")
}
return op.MakeDir(ctx, storage, actualPath, lazyCache...)
}
@@ -20,11 +20,11 @@ func makeDir(ctx context.Context, path string, lazyCache ...bool) error {
func move(ctx context.Context, srcPath, dstDirPath string, lazyCache ...bool) error {
srcStorage, srcActualPath, err := op.GetStorageAndActualPath(srcPath)
if err != nil {
- return errors.WithMessage(err, "failed get src storage")
+ return errors.WithMessage(err, "源存储获取失败")
}
dstStorage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
if err != nil {
- return errors.WithMessage(err, "failed get dst storage")
+ return errors.WithMessage(err, "目标存储获取失败")
}
if srcStorage.GetStorage() != dstStorage.GetStorage() {
return errors.WithStack(errs.MoveBetweenTwoStorages)
@@ -35,7 +35,7 @@ func move(ctx context.Context, srcPath, dstDirPath string, lazyCache ...bool) er
func rename(ctx context.Context, srcPath, dstName string, lazyCache ...bool) error {
storage, srcActualPath, err := op.GetStorageAndActualPath(srcPath)
if err != nil {
- return errors.WithMessage(err, "failed get storage")
+ return errors.WithMessage(err, "存储获取失败")
}
return op.Rename(ctx, storage, srcActualPath, dstName, lazyCache...)
}
@@ -43,7 +43,7 @@ func rename(ctx context.Context, srcPath, dstName string, lazyCache ...bool) err
func remove(ctx context.Context, path string) error {
storage, actualPath, err := op.GetStorageAndActualPath(path)
if err != nil {
- return errors.WithMessage(err, "failed get storage")
+ return errors.WithMessage(err, "存储获取失败")
}
return op.Remove(ctx, storage, actualPath)
}
@@ -51,7 +51,7 @@ func remove(ctx context.Context, path string) error {
func other(ctx context.Context, args model.FsOtherArgs) (interface{}, error) {
storage, actualPath, err := op.GetStorageAndActualPath(args.Path)
if err != nil {
- return nil, errors.WithMessage(err, "failed get storage")
+ return nil, errors.WithMessage(err, "存储获取失败")
}
args.Path = actualPath
return op.Other(ctx, storage, args)
diff --git a/internal/fs/put.go b/internal/fs/put.go
index 23197f5ba54..22ac2212fa0 100644
--- a/internal/fs/put.go
+++ b/internal/fs/put.go
@@ -20,11 +20,11 @@ type UploadTask struct {
}
func (t *UploadTask) GetName() string {
- return fmt.Sprintf("upload %s to [%s](%s)", t.file.GetName(), t.storage.GetStorage().MountPath, t.dstDirActualPath)
+ return fmt.Sprintf("上传 %s 到 [%s](%s)", t.file.GetName(), t.storage.GetStorage().MountPath, t.dstDirActualPath)
}
func (t *UploadTask) GetStatus() string {
- return "uploading"
+ return "上传中..."
}
func (t *UploadTask) Run() error {
@@ -37,7 +37,7 @@ var UploadTaskManager *tache.Manager[*UploadTask]
func putAsTask(ctx context.Context, dstDirPath string, file model.FileStreamer) (task.TaskInfoWithCreator, error) {
storage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
if err != nil {
- return nil, errors.WithMessage(err, "failed get storage")
+ return nil, errors.WithMessage(err, "存储获取失败")
}
if storage.Config().NoUpload {
return nil, errors.WithStack(errs.UploadNotSupported)
@@ -45,7 +45,7 @@ func putAsTask(ctx context.Context, dstDirPath string, file model.FileStreamer)
if file.NeedStore() {
_, err := file.CacheFullInTempFile()
if err != nil {
- return nil, errors.Wrapf(err, "failed to create temp file")
+ return nil, errors.Wrapf(err, "临时文件创建失败")
}
//file.SetReader(tempFile)
//file.SetTmpFile(tempFile)
@@ -67,7 +67,7 @@ func putAsTask(ctx context.Context, dstDirPath string, file model.FileStreamer)
func putDirectly(ctx context.Context, dstDirPath string, file model.FileStreamer, lazyCache ...bool) error {
storage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
if err != nil {
- return errors.WithMessage(err, "failed get storage")
+ return errors.WithMessage(err, "存储获取失败")
}
if storage.Config().NoUpload {
return errors.WithStack(errs.UploadNotSupported)
diff --git a/server/common/auth.go b/server/common/auth.go
index 0de718cf9e8..0ef497a0987 100644
--- a/server/common/auth.go
+++ b/server/common/auth.go
@@ -43,25 +43,25 @@ func ParseToken(tokenString string) (*UserClaims, error) {
return SecretKey, nil
})
if IsTokenInvalidated(tokenString) {
- return nil, errors.New("token is invalidated")
+ return nil, errors.New("令牌已失效")
}
if err != nil {
if ve, ok := err.(*jwt.ValidationError); ok {
if ve.Errors&jwt.ValidationErrorMalformed != 0 {
- return nil, errors.New("that's not even a token")
+ return nil, errors.New("这不是一个令牌")
} else if ve.Errors&jwt.ValidationErrorExpired != 0 {
- return nil, errors.New("token is expired")
+ return nil, errors.New("令牌已过期")
} else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 {
- return nil, errors.New("token not active yet")
+ return nil, errors.New("令牌尚未激活")
} else {
- return nil, errors.New("couldn't handle this token")
+ return nil, errors.New("无法处理此令牌")
}
}
}
if claims, ok := token.Claims.(*UserClaims); ok && token.Valid {
return claims, nil
}
- return nil, errors.New("couldn't handle this token")
+ return nil, errors.New("无法处理此令牌")
}
func InvalidateToken(tokenString string) error {
diff --git a/server/middlewares/auth.go b/server/middlewares/auth.go
index d65d1ad648a..a63749c9776 100644
--- a/server/middlewares/auth.go
+++ b/server/middlewares/auth.go
@@ -36,7 +36,7 @@ func Auth(c *gin.Context) {
return
}
if guest.Disabled {
- common.ErrorStrResp(c, "Guest user is disabled, login please", 401)
+ common.ErrorStrResp(c, "游客账户已禁用,请登录!", 401)
c.Abort()
return
}
@@ -59,12 +59,12 @@ func Auth(c *gin.Context) {
}
// validate password timestamp
if userClaims.PwdTS != user.PwdTS {
- common.ErrorStrResp(c, "Password has been changed, login please", 401)
+ common.ErrorStrResp(c, "密码已更改,请重新登录!", 401)
c.Abort()
return
}
if user.Disabled {
- common.ErrorStrResp(c, "Current user is disabled, replace please", 401)
+ common.ErrorStrResp(c, "当前账户已停用", 401)
c.Abort()
return
}
@@ -113,12 +113,12 @@ func Authn(c *gin.Context) {
}
// validate password timestamp
if userClaims.PwdTS != user.PwdTS {
- common.ErrorStrResp(c, "Password has been changed, login please", 401)
+ common.ErrorStrResp(c, "密码已更改,请重新登录!", 401)
c.Abort()
return
}
if user.Disabled {
- common.ErrorStrResp(c, "Current user is disabled, replace please", 401)
+ common.ErrorStrResp(c, "当前账户已停用", 401)
c.Abort()
return
}
@@ -130,7 +130,7 @@ func Authn(c *gin.Context) {
func AuthNotGuest(c *gin.Context) {
user := c.MustGet("user").(*model.User)
if user.IsGuest() {
- common.ErrorStrResp(c, "You are a guest", 403)
+ common.ErrorStrResp(c, "您当前为游客哦", 403)
c.Abort()
} else {
c.Next()
@@ -140,7 +140,7 @@ func AuthNotGuest(c *gin.Context) {
func AuthAdmin(c *gin.Context) {
user := c.MustGet("user").(*model.User)
if !user.IsAdmin() {
- common.ErrorStrResp(c, "You are not an admin", 403)
+ common.ErrorStrResp(c, "您不是管理员哦", 403)
c.Abort()
} else {
c.Next()