Skip to content

Commit e90303c

Browse files
authored
Merge branch 'main' into chunk_upload
2 parents 6c32b69 + e97f0a2 commit e90303c

File tree

34 files changed

+2438
-209
lines changed

34 files changed

+2438
-209
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!--
2+
Provide a general summary of your changes in the Title above.
3+
The PR title must start with `feat(): `, `docs(): `, `fix(): `, `style(): `, or `refactor(): `, `chore(): `. For example: `feat(component): add new feature`.
4+
If it spans multiple components, use the main component as the prefix and enumerate in the title, describe in the body.
5+
-->
6+
<!--
7+
在上方标题中提供您更改的总体摘要。
8+
PR 标题需以 `feat(): `, `docs(): `, `fix(): `, `style(): `, `refactor(): `, `chore(): ` 其中之一开头,例如:`feat(component): 新增功能`。
9+
如果跨多个组件,请使用主要组件作为前缀,并在标题中枚举、描述中说明。
10+
-->
11+
12+
## Description / 描述
13+
14+
<!-- Describe your changes in detail -->
15+
<!-- 详细描述您的更改 -->
16+
17+
## Motivation and Context / 背景
18+
19+
<!-- Why is this change required? What problem does it solve? -->
20+
<!-- 为什么需要此更改?它解决了什么问题? -->
21+
22+
<!-- If it fixes an open issue, please link to the issue here. -->
23+
<!-- 如果修复了一个打开的issue,请在此处链接到该issue -->
24+
25+
Closes #XXXX
26+
27+
<!-- or -->
28+
<!-- 或者 -->
29+
30+
Relates to #XXXX
31+
32+
## How Has This Been Tested? / 测试
33+
34+
<!-- Please describe in detail how you tested your changes. -->
35+
<!-- 请详细描述您如何测试更改 -->
36+
37+
## Checklist / 检查清单
38+
39+
<!-- Go over all the following points, and put an `x` in all the boxes that apply. -->
40+
<!-- 检查以下所有要点,并在所有适用的框中打`x` -->
41+
42+
<!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
43+
<!-- 如果您对其中任何一项不确定,请不要犹豫提问。我们会帮助您! -->
44+
45+
- [ ] I have read the [CONTRIBUTING](https://github.com/OpenListTeam/OpenList/blob/main/CONTRIBUTING.md) document.
46+
我已阅读 [CONTRIBUTING](https://github.com/OpenListTeam/OpenList/blob/main/CONTRIBUTING.md) 文档。
47+
- [ ] I have formatted my code with `go fmt` or [prettier](https://prettier.io/).
48+
我已使用 `go fmt`[prettier](https://prettier.io/) 格式化提交的代码。
49+
- [ ] I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
50+
我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
51+
- [ ] I have requested review from relevant code authors using the "Request review" feature when applicable.
52+
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
53+
- [ ] I have updated the repository accordingly (If it’s needed).
54+
我已相应更新了相关仓库(若适用)。
55+
- [ ] [OpenList-Frontend](https://github.com/OpenListTeam/OpenList-Frontend) #XXXX
56+
- [ ] [OpenList-Docs](https://github.com/OpenListTeam/OpenList-Docs) #XXXX

CONTRIBUTING.md

Lines changed: 33 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,106 +2,76 @@
22

33
## Setup your machine
44

5-
`OpenList` is written in [Go](https://golang.org/) and [React](https://reactjs.org/).
5+
`OpenList` is written in [Go](https://golang.org/) and [SolidJS](https://www.solidjs.com/).
66

77
Prerequisites:
88

99
- [git](https://git-scm.com)
10-
- [Go 1.20+](https://golang.org/doc/install)
10+
- [Go 1.24+](https://golang.org/doc/install)
1111
- [gcc](https://gcc.gnu.org/)
1212
- [nodejs](https://nodejs.org/)
1313

14-
Clone `OpenList` and `OpenList-Frontend` anywhere:
14+
## Cloning a fork
15+
16+
Fork and clone `OpenList` and `OpenList-Frontend` anywhere:
1517

1618
```shell
17-
$ git clone https://github.com/OpenListTeam/OpenList.git
18-
$ git clone --recurse-submodules https://github.com/OpenListTeam/OpenList-Frontend.git
19+
$ git clone https://github.com/<your-username>/OpenList.git
20+
$ git clone --recurse-submodules https://github.com/<your-username>/OpenList-Frontend.git
21+
```
22+
23+
## Creating a branch
24+
25+
Create a new branch from the `main` branch, with an appropriate name.
26+
27+
```shell
28+
$ git checkout -b <branch-name>
1929
```
20-
You should switch to the `main` branch for development.
2130

2231
## Preview your change
32+
2333
### backend
34+
2435
```shell
2536
$ go run main.go
2637
```
38+
2739
### frontend
40+
2841
```shell
2942
$ pnpm dev
3043
```
3144

3245
## Add a new driver
46+
3347
Copy `drivers/template` folder and rename it, and follow the comments in it.
3448

3549
## Create a commit
3650

3751
Commit messages should be well formatted, and to make that "standardized".
3852

39-
### Commit Message Format
40-
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
41-
format that includes a **type**, a **scope** and a **subject**:
42-
43-
```
44-
<type>(<scope>): <subject>
45-
<BLANK LINE>
46-
<body>
47-
<BLANK LINE>
48-
<footer>
49-
```
53+
Submit your pull request. For PR titles, follow [Conventional Commits](https://www.conventionalcommits.org).
5054

51-
The **header** is mandatory and the **scope** of the header is optional.
55+
https://github.com/OpenListTeam/OpenList/issues/376
5256

53-
Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier
54-
to read on GitHub as well as in various git tools.
57+
It's suggested to sign your commits. See: [How to sign commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
5558

56-
### Revert
57-
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header
58-
of the reverted commit.
59-
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit
60-
being reverted.
61-
62-
### Type
63-
Must be one of the following:
64-
65-
* **feat**: A new feature
66-
* **fix**: A bug fix
67-
* **docs**: Documentation only changes
68-
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
69-
semi-colons, etc)
70-
* **refactor**: A code change that neither fixes a bug nor adds a feature
71-
* **perf**: A code change that improves performance
72-
* **test**: Adding missing or correcting existing tests
73-
* **build**: Affects project builds or dependency modifications
74-
* **revert**: Restore the previous commit
75-
* **ci**: Continuous integration of related file modifications
76-
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
77-
generation
78-
* **release**: Release a new version
59+
## Submit a pull request
7960

80-
### Scope
81-
The scope could be anything specifying place of the commit change. For example `$location`,
82-
`$browser`, `$compile`, `$rootScope`, `ngHref`, `ngClick`, `ngView`, etc...
61+
Please make sure your code has been formatted with `go fmt` or [prettier](https://prettier.io/) before submitting.
8362

84-
You can use `*` when the change affects more than a single scope.
63+
Push your branch to your `openlist` fork and open a pull request against the `main` branch.
8564

86-
### Subject
87-
The subject contains succinct description of the change:
65+
## Merge your pull request
8866

89-
* use the imperative, present tense: "change" not "changed" nor "changes"
90-
* don't capitalize first letter
91-
* no dot (.) at the end
67+
Your pull request will be merged after review. Please wait for the maintainer to merge your pull request after review.
9268

93-
### Body
94-
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
95-
The body should include the motivation for the change and contrast this with previous behavior.
69+
At least 1 approving review is required by reviewers with write access. You can also request a review from maintainers.
9670

97-
### Footer
98-
The footer should contain any information about **Breaking Changes** and is also the place to
99-
[reference GitHub issues that this commit closes](https://help.github.com/articles/closing-issues-via-commit-messages/).
71+
## Delete your branch
10072

101-
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
102-
The rest of the commit message is then used for this.
73+
(Optional) After your pull request is merged, you can delete your branch.
10374

104-
## Submit a pull request
75+
---
10576

106-
Push your branch to your `openlist` fork and open a pull request against the
107-
`main` branch.
77+
Thank you for your contribution! Let's make OpenList better together!

drivers/115/appver.go

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,60 @@
11
package _115
22

33
import (
4+
"errors"
45
"github.com/OpenListTeam/OpenList/v4/drivers/base"
6+
"github.com/OpenListTeam/OpenList/v4/pkg/utils"
57
driver115 "github.com/SheltonZhu/115driver/pkg/driver"
68
log "github.com/sirupsen/logrus"
79
)
810

911
var (
1012
md5Salt = "Qclm8MGWUv59TnrR0XPg"
11-
appVer = "27.0.5.7"
13+
appVer = "35.6.0.3"
1214
)
1315

14-
func (d *Pan115) getAppVersion() ([]driver115.AppVersion, error) {
15-
result := driver115.VersionResp{}
16-
resp, err := base.RestyClient.R().Get(driver115.ApiGetVersion)
17-
18-
err = driver115.CheckErr(err, &result, resp)
16+
func (d *Pan115) getAppVersion() (string, error) {
17+
result := VersionResp{}
18+
res, err := base.RestyClient.R().Get(driver115.ApiGetVersion)
1919
if err != nil {
20-
return nil, err
20+
return "", err
2121
}
22-
23-
return result.Data.GetAppVersions(), nil
22+
err = utils.Json.Unmarshal(res.Body(), &result)
23+
if err != nil {
24+
return "", err
25+
}
26+
if len(result.Error) > 0 {
27+
return "", errors.New(result.Error)
28+
}
29+
return result.Data.Win.Version, nil
2430
}
2531

2632
func (d *Pan115) getAppVer() string {
27-
// todo add some cache?
28-
vers, err := d.getAppVersion()
33+
ver, err := d.getAppVersion()
2934
if err != nil {
3035
log.Warnf("[115] get app version failed: %v", err)
3136
return appVer
3237
}
33-
for _, ver := range vers {
34-
if ver.AppName == "win" {
35-
return ver.Version
36-
}
38+
if len(ver) > 0 {
39+
return ver
3740
}
3841
return appVer
3942
}
4043

4144
func (d *Pan115) initAppVer() {
4245
appVer = d.getAppVer()
46+
log.Debugf("use app version: %v", appVer)
47+
}
48+
49+
type VersionResp struct {
50+
Error string `json:"error,omitempty"`
51+
Data Versions `json:"data"`
52+
}
53+
54+
type Versions struct {
55+
Win Version `json:"win"`
56+
}
57+
58+
type Version struct {
59+
Version string `json:"version_code"`
4360
}

drivers/123_open/driver.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
type Open123 struct {
2222
model.Storage
2323
Addition
24+
UID uint64
2425
}
2526

2627
func (d *Open123) Config() driver.Config {
@@ -94,15 +95,15 @@ func (d *Open123) Link(ctx context.Context, file model.Obj, args model.LinkArgs)
9495
}, nil
9596
}
9697

97-
u, err := d.getUserInfo()
98+
uid, err := d.getUID()
9899
if err != nil {
99100
return nil, err
100101
}
101102

102103
duration := time.Duration(d.DirectLinkValidDuration) * time.Minute
103104

104105
newURL, err := d.SignURL(res.Data.URL, d.DirectLinkPrivateKey,
105-
u.Data.UID, duration)
106+
uid, duration)
106107
if err != nil {
107108
return nil, err
108109
}

drivers/123_open/meta.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Addition struct {
2424
UploadThread int `json:"UploadThread" type:"number" default:"3" help:"the threads of upload"`
2525

2626
// 使用直链
27-
DirectLink bool `json:"DirectLink" type:"boolean" default:"false" required:"false" help:"use direct link when download file"`
27+
DirectLink bool `json:"DirectLink" type:"bool" default:"false" required:"false" help:"use direct link when download file"`
2828
DirectLinkPrivateKey string `json:"DirectLinkPrivateKey" required:"false" help:"private key for direct link, if URL authentication is enabled"`
2929
DirectLinkValidDuration int64 `json:"DirectLinkValidDuration" type:"number" default:"30" required:"false" help:"minutes, if URL authentication is enabled"`
3030

drivers/123_open/types.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,19 @@ type RefreshTokenResp struct {
128128
type UserInfoResp struct {
129129
BaseResp
130130
Data struct {
131-
UID uint64 `json:"uid"`
132-
Username string `json:"username"`
133-
DisplayName string `json:"displayName"`
134-
HeadImage string `json:"headImage"`
135-
Passport string `json:"passport"`
136-
Mail string `json:"mail"`
137-
SpaceUsed int64 `json:"spaceUsed"`
138-
SpacePermanent int64 `json:"spacePermanent"`
139-
SpaceTemp int64 `json:"spaceTemp"`
140-
SpaceTempExpr string `json:"spaceTempExpr"`
141-
Vip bool `json:"vip"`
142-
DirectTraffic int64 `json:"directTraffic"`
143-
IsHideUID bool `json:"isHideUID"`
131+
UID uint64 `json:"uid"`
132+
// Username string `json:"username"`
133+
// DisplayName string `json:"displayName"`
134+
// HeadImage string `json:"headImage"`
135+
// Passport string `json:"passport"`
136+
// Mail string `json:"mail"`
137+
// SpaceUsed int64 `json:"spaceUsed"`
138+
// SpacePermanent int64 `json:"spacePermanent"`
139+
// SpaceTemp int64 `json:"spaceTemp"`
140+
// SpaceTempExpr int64 `json:"spaceTempExpr"`
141+
// Vip bool `json:"vip"`
142+
// DirectTraffic int64 `json:"directTraffic"`
143+
// IsHideUID bool `json:"isHideUID"`
144144
} `json:"data"`
145145
}
146146

0 commit comments

Comments
 (0)