mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-10-10 13:03:09 +08:00
791a27e2ac
* feat(driver/bunny_storage): add Bunny Storage driver Add Bunny Storage API support with optional CDN links and token signing. Cover CDN mount path handling, token signing, and proxy/cache behavior with unit tests. * replace RootFolderPath with driver.RootPath in Addition struct * fix(driver/bunny_storage): parse fractional Bunny timestamps * fix(bunny_storage): correct CDN token signing - Decode URL paths without treating literal plus signs as spaces. - Reject duplicate query parameters and cover both cases with regression tests. Co-authored-by: Codex <267193182+codex@users.noreply.github.com> --------- Co-authored-by: j2rong4cn <j2rong@qq.com> Co-authored-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package bunny_storage
|
|
|
|
import (
|
|
"github.com/OpenListTeam/OpenList/v4/internal/driver"
|
|
"github.com/OpenListTeam/OpenList/v4/internal/op"
|
|
)
|
|
|
|
type Addition struct {
|
|
driver.RootPath
|
|
StorageZoneName string `json:"storage_zone_name" required:"true"`
|
|
AccessKey string `json:"access_key" required:"true"`
|
|
Endpoint string `json:"endpoint" required:"true" default:"storage.bunnycdn.com"`
|
|
CDNBaseURL string `json:"cdn_base_url"`
|
|
CDNTokenKey string `json:"cdn_token_key"`
|
|
CDNTokenMethod string `json:"cdn_token_method" type:"select" options:"sha256,hmac_sha256" default:"sha256"`
|
|
CDNTokenIncludeIP bool `json:"cdn_token_include_ip" default:"false"`
|
|
SignURLExpire int `json:"sign_url_expire" type:"number" default:"4"`
|
|
Placeholder string `json:"placeholder" default:".openlist"`
|
|
}
|
|
|
|
var config = driver.Config{
|
|
Name: "Bunny Storage",
|
|
LocalSort: true,
|
|
DefaultRoot: "/",
|
|
CheckStatus: true,
|
|
}
|
|
|
|
func init() {
|
|
op.RegisterDriver(func() driver.Driver {
|
|
return &BunnyStorage{}
|
|
})
|
|
}
|