mirror of
https://github.com/AlistGo/alist.git
synced 2026-01-03 13:49:04 +08:00
- Adjusts driver addition metadata to accept LinkExpiry and DirectLinkExpiry options for caching and API expiry control (drivers/gofile/meta.go:10). - Applies the new options when building file links, setting optional local cache expiration (drivers/gofile/driver.go:101) and sending an expireTime to the direct-link API (drivers/gofile/util.go:202). - Logs Gofile API error payloads and validates the structured error response before returning it (drivers/gofile/util.go:141). - Adds the required imports and returns the configured model.Link instance (drivers/gofile/driver.go:6).
29 lines
865 B
Go
29 lines
865 B
Go
package gofile
|
|
|
|
import (
|
|
"github.com/alist-org/alist/v3/internal/driver"
|
|
"github.com/alist-org/alist/v3/internal/op"
|
|
)
|
|
|
|
type Addition struct {
|
|
driver.RootID
|
|
APIToken string `json:"api_token" required:"true" help:"Get your API token from your Gofile profile page"`
|
|
LinkExpiry int `json:"link_expiry" type:"number" default:"30" help:"Direct link cache duration in days. Set to 0 to disable caching"`
|
|
DirectLinkExpiry int `json:"direct_link_expiry" type:"number" default:"0" help:"Direct link expiration time in hours on Gofile server. Set to 0 for no expiration"`
|
|
}
|
|
|
|
var config = driver.Config{
|
|
Name: "Gofile",
|
|
DefaultRoot: "",
|
|
LocalSort: false,
|
|
OnlyProxy: false,
|
|
NoCache: false,
|
|
NoUpload: false,
|
|
}
|
|
|
|
func init() {
|
|
op.RegisterDriver(func() driver.Driver {
|
|
return &Gofile{}
|
|
})
|
|
}
|