File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ import (
7
7
8
8
type Addition struct {
9
9
Paths string `json:"paths" required:"true" type:"text"`
10
- ProtectSameName bool `json:"protect_same_name" default:"true" required:"false" help:"Protects same-name files from Delete or Rename"`
11
10
SiteUrl string `json:"siteUrl" type:"text" required:"false" help:"The prefix URL of the strm file"`
12
11
FilterFileTypes string `json:"filterFileTypes" type:"text" default:"strm" required:"false" help:"Supports suffix name of strm file"`
12
+ UseSign bool `json:"signPath" default:"true" required:"true" help:"sign the path in the strm file"`
13
+ EncodePath bool `json:"encodePath" default:"true" required:"true" help:"encode the path in the strm file"`
13
14
}
14
15
15
16
var config = driver.Config {
@@ -24,6 +25,11 @@ var config = driver.Config{
24
25
25
26
func init () {
26
27
op .RegisterDriver (func () driver.Driver {
27
- return & Strm {}
28
+ return & Strm {
29
+ Addition : Addition {
30
+ UseSign : true ,
31
+ EncodePath : true ,
32
+ },
33
+ }
28
34
})
29
35
}
Original file line number Diff line number Diff line change @@ -133,8 +133,16 @@ func (d *Strm) getLink(ctx context.Context, path string) string {
133
133
} else {
134
134
apiUrl = common .GetApiUrl (ctx )
135
135
}
136
+
137
+ if d .EncodePath {
138
+ path = utils .EncodePath (path , true )
139
+ }
140
+ if ! d .UseSign {
141
+ return fmt .Sprintf ("%s/d%s" , apiUrl , path )
142
+ }
143
+
136
144
return fmt .Sprintf ("%s/d%s?sign=%s" ,
137
145
apiUrl ,
138
- utils . EncodePath ( path , true ) ,
146
+ path ,
139
147
sign .Sign (path ))
140
148
}
You can’t perform that action at this time.
0 commit comments