mirror of
https://github.com/AlistGo/alist.git
synced 2025-11-25 03:15:10 +08:00
fix(Mediatrack): Add support for X-Device-Fingerprint header (#9354)
Introduce a `DeviceFingerprint` field to the request metadata. This field is used to conditionally set the `X-Device-Fingerprint` HTTP header in outgoing requests if its value is not empty.
This commit is contained in:
@@ -9,8 +9,9 @@ type Addition struct {
|
||||
AccessToken string `json:"access_token" required:"true"`
|
||||
ProjectID string `json:"project_id"`
|
||||
driver.RootID
|
||||
OrderBy string `json:"order_by" type:"select" options:"updated_at,title,size" default:"title"`
|
||||
OrderDesc bool `json:"order_desc"`
|
||||
OrderBy string `json:"order_by" type:"select" options:"updated_at,title,size" default:"title"`
|
||||
OrderDesc bool `json:"order_desc"`
|
||||
DeviceFingerprint string `json:"device_fingerprint" required:"true"`
|
||||
}
|
||||
|
||||
var config = driver.Config{
|
||||
|
||||
@@ -17,6 +17,9 @@ import (
|
||||
func (d *MediaTrack) request(url string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
|
||||
req := base.RestyClient.R()
|
||||
req.SetHeader("Authorization", "Bearer "+d.AccessToken)
|
||||
if d.DeviceFingerprint != "" {
|
||||
req.SetHeader("X-Device-Fingerprint", d.DeviceFingerprint)
|
||||
}
|
||||
if callback != nil {
|
||||
callback(req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user