Skip to content

Commit 62377b3

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents d18749a + 795a18b commit 62377b3

138 files changed

Lines changed: 3345 additions & 1183 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/00-bug_report_zh.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: 请确认以下事项
1515
description: |
16-
您必须确认、同意并勾选以下内容,否则您的问题一定会被直接关闭。
16+
您必须阅读并检查以下内容,否则您的问题一定会被直接关闭。
1717
或者您可以去[讨论区](https://github.com/OpenListTeam/OpenList/discussions)。
1818
options:
1919
- label: |
@@ -34,6 +34,8 @@ body:
3434
我认为此问题必须由`OpenList`处理,而非第三方。
3535
- label: |
3636
我已确认这个问题在最新版本中没有被修复。
37+
- label: |
38+
我没有阅读这个清单,只是闭眼选中了所有的复选框,请关闭这个 Issue
3739
3840
- type: input
3941
id: version

.github/ISSUE_TEMPLATE/01-bug_report_en.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: Please confirm the following
1515
description: |
16-
You must confirm, agree, and check all the following, otherwise your issue will definitely be closed directly.
16+
You must read and check all the following, otherwise your issue will definitely be closed directly.
1717
Or you can go to the [discussions](https://github.com/OpenListTeam/OpenList/discussions).
1818
options:
1919
- label: |
@@ -34,6 +34,8 @@ body:
3434
I believe this issue must be handled by `OpenList` and not by a third party.
3535
- label: |
3636
I confirm this issue is not fixed in the latest version.
37+
- label: |
38+
I have not read these checkboxes and therefore I just ticked them all, Please close this issue
3739
3840
- type: input
3941
id: version

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
Provide a general summary of your changes in the Title above.
33
The PR title must start with `feat(): `, `docs(): `, `fix(): `, `style(): `, or `refactor(): `, `chore(): `. For example: `feat(component): add new feature`.
44
If it spans multiple components, use the main component as the prefix and enumerate in the title, describe in the body.
5+
For breaking changes, add `!` after the type, e.g., `feat(component)!: breaking change`.
56
-->
67
<!--
78
在上方标题中提供您更改的总体摘要。
89
PR 标题需以 `feat(): `, `docs(): `, `fix(): `, `style(): `, `refactor(): `, `chore(): ` 其中之一开头,例如:`feat(component): 新增功能`。
910
如果跨多个组件,请使用主要组件作为前缀,并在标题中枚举、描述中说明。
11+
如果是破坏性变更,请在类型后添加 `!`,例如 `feat(component)!: 破坏性变更`。
1012
-->
1113

1214
## Description / 描述

.github/workflows/issue_pr_comment.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
script: |
2222
const issueBody = context.payload.issue.body || "";
23-
const unchecked = /- \[ \] /.test(issueBody);
23+
const unchecked = /- \[ \] (?!我没有阅读这个清单|I have not read these checkboxes)/.test(issueBody);
2424
let comment = "感谢您联系OpenList。我们会尽快回复您。\n";
2525
comment += "Thanks for contacting OpenList. We will reply to you as soon as possible.\n\n";
2626
if (unchecked) {
@@ -47,12 +47,14 @@ jobs:
4747
with:
4848
script: |
4949
const title = context.payload.pull_request.title || "";
50-
const ok = /^(feat|docs|fix|style|refactor|chore)\(.+?\): /i.test(title);
50+
const ok = /^(feat|docs|fix|style|refactor|chore)\(.+?\)!?: /i.test(title);
5151
if (!ok) {
5252
let comment = "⚠️ PR 标题需以 `feat(): `, `docs(): `, `fix(): `, `style(): `, `refactor(): `, `chore(): ` 其中之一开头,例如:`feat(component): 新增功能`。\n";
5353
comment += "⚠️ The PR title must start with `feat(): `, `docs(): `, `fix(): `, `style(): `, or `refactor(): `, `chore(): `. For example: `feat(component): add new feature`.\n\n";
5454
comment += "如果跨多个组件,请使用主要组件作为前缀,并在标题中枚举、描述中说明。\n";
5555
comment += "If it spans multiple components, use the main component as the prefix and enumerate in the title, describe in the body.\n\n";
56+
comment += "如果是破坏性变更,请在类型后添加 `!`,例如 `feat(component)!: 破坏性变更`。\n";
57+
comment += "For breaking changes, add `!` after the type, e.g., `feat(component)!: breaking change`.\n\n";
5658
await github.rest.issues.createComment({
5759
...context.repo,
5860
issue_number: context.issue.number,

SECURITY.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Only the latest stable release receives security patches. We strongly recommend always keeping OpenList up to date.
6+
7+
| Version | Supported |
8+
| -------------------- | ------------------ |
9+
| Latest stable (v4.x) | :white_check_mark: |
10+
| Older versions | :x: |
11+
12+
## Reporting a Vulnerability
13+
14+
**Please do NOT report security vulnerabilities through public GitHub Issues.**
15+
16+
If you discover a security vulnerability in OpenList, please report it responsibly by using one of the following channels:
17+
18+
- **GitHub Private Security Advisory** (preferred): [Submit here](https://github.com/OpenListTeam/OpenList/security/advisories/new)
19+
- **Telegram**: Contact a maintainer privately via [@OpenListTeam](https://t.me/OpenListTeam)
20+
21+
When reporting, please include as much of the following as possible:
22+
23+
- A description of the vulnerability and its potential impact
24+
- The affected version(s)
25+
- Step-by-step instructions to reproduce the issue
26+
- Any proof-of-concept code or screenshots (if applicable)
27+
- Suggested mitigation or fix (optional but appreciated)
28+
29+
## Security Best Practices for Users
30+
31+
To keep your OpenList instance secure:
32+
33+
- Always update to the latest release.
34+
- Use a strong, unique admin password and change it after first login.
35+
- Enable HTTPS (TLS) for your deployment — do **not** expose OpenList over plain HTTP on the public internet.
36+
- Limit exposed ports using a reverse proxy (e.g., Nginx, Caddy).
37+
- Set up access controls and avoid enabling guest access unless necessary.
38+
- Regularly review mounted storage permissions and revoke unused API tokens.
39+
- When using Docker, avoid running the container as root if possible.
40+
41+
## Acknowledgments
42+
43+
We sincerely thank all security researchers and community members who responsibly disclose vulnerabilities and help make OpenList safer for everyone.
44+
45+
---
46+
47+
# 安全政策
48+
49+
## 支持的版本
50+
51+
我们仅对最新稳定版本提供安全补丁。强烈建议始终保持 OpenList 为最新版本。
52+
53+
| 版本 | 是否支持 |
54+
| ------------------ | ------------------ |
55+
| 最新稳定版(v4.x) | :white_check_mark: |
56+
| 旧版本 | :x: |
57+
58+
## 报告漏洞
59+
60+
**请勿通过公开的 GitHub Issues 报告安全漏洞。**
61+
62+
如果您在 OpenList 中发现安全漏洞,请通过以下渠道之一负责任地进行报告:
63+
64+
- **GitHub 私密安全公告**(推荐):[点击提交](https://github.com/OpenListTeam/OpenList/security/advisories/new)
65+
- **Telegram**:通过 [@OpenListTeam](https://t.me/OpenListTeam) 私信联系维护者
66+
67+
报告时,请尽量提供以下信息:
68+
69+
- 漏洞描述及其潜在影响
70+
- 受影响的版本
71+
- 复现问题的详细步骤
72+
- 概念验证代码或截图(如有)
73+
- 建议的缓解措施或修复方案(可选,但非常欢迎)
74+
75+
## 用户安全最佳实践
76+
77+
为保障您的 OpenList 实例安全:
78+
79+
- 始终更新至最新版本。
80+
- 使用强且唯一的管理员密码,并在首次登录后立即修改。
81+
- 为您的部署启用 HTTPS(TLS)—— **请勿**在公网上以明文 HTTP 方式暴露 OpenList。
82+
- 使用反向代理(如 Nginx、Caddy)限制对外暴露的端口。
83+
- 配置访问控制,非必要情况下不要开启访客访问。
84+
- 定期检查已挂载存储的权限,并撤销未使用的 API 令牌。
85+
- 使用 Docker 部署时,尽可能避免以 root 用户运行容器。
86+
87+
## 致谢
88+
89+
我们衷心感谢所有负责任地披露漏洞、帮助 OpenList 变得更加安全的安全研究人员和社区成员。

cmd/lang.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99
"io"
1010
"os"
11-
"reflect"
1211
"strings"
1312

1413
_ "github.com/OpenListTeam/OpenList/v4/drivers"
@@ -69,15 +68,33 @@ func writeFile(name string, data interface{}) {
6968
log.Errorf("failed to unmarshal json: %+v", err)
7069
return
7170
}
72-
if reflect.DeepEqual(oldData, newData) {
71+
if mergeJson(newData, oldData) {
7372
log.Infof("%s.json no changed, skip", name)
7473
} else {
7574
log.Infof("%s.json changed, update file", name)
7675
//log.Infof("old: %+v\nnew:%+v", oldData, data)
77-
utils.WriteJsonToFile(fmt.Sprintf("lang/%s.json", name), newData, true)
76+
utils.WriteJsonToFile(fmt.Sprintf("lang/%s.json", name), oldData, true)
7877
}
7978
}
8079

80+
func mergeJson(source, target map[string]interface{}) bool {
81+
equal := true
82+
for k, v := range source {
83+
tgtV, tgtOk := target[k]
84+
if !tgtOk {
85+
equal = false
86+
target[k] = v
87+
} else {
88+
srcMap, srcIsMap := v.(map[string]interface{})
89+
tgtMap, tgtIsMap := tgtV.(map[string]interface{})
90+
if srcIsMap && tgtIsMap {
91+
equal = mergeJson(srcMap, tgtMap) && equal
92+
}
93+
}
94+
}
95+
return equal
96+
}
97+
8198
func generateDriversJson() {
8299
drivers := make(Drivers)
83100
drivers["drivers"] = make(KV[interface{}])

drivers/115/driver.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ func (d *Pan115) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
6868
return nil, err
6969
}
7070
userAgent := args.Header.Get("User-Agent")
71-
downloadInfo, err := d.
72-
DownloadWithUA(file.(*FileObj).PickCode, userAgent)
71+
downloadInfo, err := d.client.DownloadWithUA(file.(*FileObj).PickCode, userAgent)
7372
if err != nil {
7473
return nil, err
7574
}
@@ -252,8 +251,8 @@ func (d *Pan115) GetDetails(ctx context.Context) (*model.StorageDetails, error)
252251
}
253252
return &model.StorageDetails{
254253
DiskUsage: model.DiskUsage{
255-
TotalSpace: uint64(info.SpaceInfo.AllTotal.Size),
256-
FreeSpace: uint64(info.SpaceInfo.AllRemain.Size),
254+
TotalSpace: info.SpaceInfo.AllTotal.Size,
255+
UsedSpace: info.SpaceInfo.AllUse.Size,
257256
},
258257
}, nil
259258
}

drivers/115/types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ func (f *FileObj) GetHash() utils.HashInfo {
2222
return utils.NewHashInfo(utils.SHA1, f.Sha1)
2323
}
2424

25+
func (f *FileObj) Thumb() string {
26+
return f.ThumbURL
27+
}
28+
2529
type UploadResult struct {
2630
driver.BasicResp
2731
Data struct {

drivers/115/util.go

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"encoding/json"
1010
"fmt"
1111
"io"
12-
"net/http"
1312
"net/url"
1413
"strconv"
1514
"strings"
@@ -22,11 +21,9 @@ import (
2221
"github.com/OpenListTeam/OpenList/v4/internal/model"
2322
"github.com/OpenListTeam/OpenList/v4/pkg/http_range"
2423
"github.com/OpenListTeam/OpenList/v4/pkg/utils"
25-
"github.com/aliyun/aliyun-oss-go-sdk/oss"
26-
2724
cipher "github.com/SheltonZhu/115driver/pkg/crypto/ec115"
28-
crypto "github.com/SheltonZhu/115driver/pkg/crypto/m115"
2925
driver115 "github.com/SheltonZhu/115driver/pkg/driver"
26+
"github.com/aliyun/aliyun-oss-go-sdk/oss"
3027
"github.com/pkg/errors"
3128
)
3229

@@ -108,60 +105,6 @@ func (d *Pan115) getUA() string {
108105
return fmt.Sprintf("Mozilla/5.0 115Browser/%s", appVer)
109106
}
110107

111-
func (d *Pan115) DownloadWithUA(pickCode, ua string) (*driver115.DownloadInfo, error) {
112-
key := crypto.GenerateKey()
113-
result := driver115.DownloadResp{}
114-
params, err := utils.Json.Marshal(map[string]string{"pick_code": pickCode})
115-
if err != nil {
116-
return nil, err
117-
}
118-
119-
data := crypto.Encode(params, key)
120-
121-
bodyReader := strings.NewReader(url.Values{"data": []string{data}}.Encode())
122-
reqUrl := fmt.Sprintf("%s?t=%s", driver115.AndroidApiDownloadGetUrl, driver115.Now().String())
123-
req, _ := http.NewRequest(http.MethodPost, reqUrl, bodyReader)
124-
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
125-
req.Header.Set("Cookie", d.Cookie)
126-
req.Header.Set("User-Agent", ua)
127-
128-
resp, err := d.client.Client.GetClient().Do(req)
129-
if err != nil {
130-
return nil, err
131-
}
132-
defer resp.Body.Close()
133-
134-
body, err := io.ReadAll(resp.Body)
135-
if err != nil {
136-
return nil, err
137-
}
138-
if err := utils.Json.Unmarshal(body, &result); err != nil {
139-
return nil, err
140-
}
141-
142-
if err = result.Err(string(body)); err != nil {
143-
return nil, err
144-
}
145-
146-
b, err := crypto.Decode(string(result.EncodedData), key)
147-
if err != nil {
148-
return nil, err
149-
}
150-
151-
downloadInfo := struct {
152-
Url string `json:"url"`
153-
}{}
154-
if err := utils.Json.Unmarshal(b, &downloadInfo); err != nil {
155-
return nil, err
156-
}
157-
158-
info := &driver115.DownloadInfo{}
159-
info.PickCode = pickCode
160-
info.Header = resp.Request.Header
161-
info.Url.Url = downloadInfo.Url
162-
return info, nil
163-
}
164-
165108
func (c *Pan115) GenerateToken(fileID, preID, timeStamp, fileSize, signKey, signVal string) string {
166109
userID := strconv.FormatInt(c.client.UserID, 10)
167110
userIDMd5 := md5.Sum([]byte(userID))
@@ -309,7 +252,8 @@ func (c *Pan115) UploadByOSS(ctx context.Context, params *driver115.UploadOSSPar
309252

310253
// UploadByMultipart upload by mutipart blocks
311254
func (d *Pan115) UploadByMultipart(ctx context.Context, params *driver115.UploadOSSParams, fileSize int64, s model.FileStreamer,
312-
dirID string, up driver.UpdateProgress, opts ...driver115.UploadMultipartOption) (*UploadResult, error) {
255+
dirID string, up driver.UpdateProgress, opts ...driver115.UploadMultipartOption,
256+
) (*UploadResult, error) {
313257
var (
314258
chunks []oss.FileChunk
315259
parts []oss.UploadPart

drivers/115_open/driver.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (d *Open115) Rename(ctx context.Context, srcObj model.Obj, newName string)
176176
}
177177
_, err := d.client.UpdateFile(ctx, &sdk.UpdateFileReq{
178178
FileID: srcObj.GetID(),
179-
FileNma: newName,
179+
FileName: newName,
180180
})
181181
if err != nil {
182182
return nil, err
@@ -331,18 +331,18 @@ func (d *Open115) GetDetails(ctx context.Context) (*model.StorageDetails, error)
331331
if err != nil {
332332
return nil, err
333333
}
334-
total, err := userInfo.RtSpaceInfo.AllTotal.Size.Int64()
334+
total, err := ParseInt64(userInfo.RtSpaceInfo.AllTotal.Size)
335335
if err != nil {
336336
return nil, err
337337
}
338-
free, err := userInfo.RtSpaceInfo.AllRemain.Size.Int64()
338+
used, err := ParseInt64(userInfo.RtSpaceInfo.AllUse.Size)
339339
if err != nil {
340340
return nil, err
341341
}
342342
return &model.StorageDetails{
343343
DiskUsage: model.DiskUsage{
344-
TotalSpace: uint64(total),
345-
FreeSpace: uint64(free),
344+
TotalSpace: total,
345+
UsedSpace: used,
346346
},
347347
}, nil
348348
}

0 commit comments

Comments
 (0)