mirror of
https://github.com/AlistGo/alist.git
synced 2025-12-19 11:00:06 +08:00
Introduces the ability to sign generated URLs for enhanced security and access control. This feature is activated by configuring a `PrivateKey`, `UID`, and `ValidDuration` in the driver settings. If a private key is provided, the driver will sign the output URLs, making them time-limited based on the `ValidDuration`. The `ValidDuration` defaults to 30 minutes if not specified. The core signing logic is encapsulated in the new `sign.go` file. The `driver.go` file integrates this signing process before returning the final URL.
37 lines
914 B
Go
37 lines
914 B
Go
package _123Open
|
|
|
|
import (
|
|
"github.com/alist-org/alist/v3/internal/driver"
|
|
"github.com/alist-org/alist/v3/internal/op"
|
|
)
|
|
|
|
type Addition struct {
|
|
driver.RootID
|
|
|
|
ClientID string `json:"client_id" required:"true" label:"Client ID"`
|
|
ClientSecret string `json:"client_secret" required:"true" label:"Client Secret"`
|
|
PrivateKey string `json:"private_key"`
|
|
UID uint64 `json:"uid" type:"number"`
|
|
ValidDuration int64 `json:"valid_duration" type:"number" default:"30" help:"minutes"`
|
|
}
|
|
|
|
var config = driver.Config{
|
|
Name: "123 Open",
|
|
LocalSort: false,
|
|
OnlyLocal: false,
|
|
OnlyProxy: false,
|
|
NoCache: false,
|
|
NoUpload: false,
|
|
NeedMs: false,
|
|
DefaultRoot: "0",
|
|
CheckStatus: false,
|
|
Alert: "",
|
|
NoOverwriteUpload: false,
|
|
}
|
|
|
|
func init() {
|
|
op.RegisterDriver(func() driver.Driver {
|
|
return &Open123{}
|
|
})
|
|
}
|