@@ -79,9 +79,9 @@ func (pf PushFormat) Format(args []*PushPair) string {
79
79
ss = append (ss , kv )
80
80
}
81
81
msgReplaced := strings .Replace (
82
- string (pf ),
83
- res .PushFormatMsgLocator ,
84
- strings .Join (ss , `\n` ),
82
+ string (pf ),
83
+ res .PushFormatMsgLocator ,
84
+ strings .Join (ss , `\n` ),
85
85
1 ,
86
86
)
87
87
nameReplaced := strings .Replace (
@@ -107,17 +107,18 @@ type PushIface interface {
107
107
108
108
type PushIfaceIOS struct {
109
109
Token string `json:"token"`
110
- Title string `json:"title"`
110
+ Title PushFormat `json:"title"`
111
111
Content PushFormat `json:"content"`
112
112
BodyRegex string `json:"body_regex"`
113
113
Code int `json:"code"`
114
114
}
115
115
116
116
func (p PushIfaceIOS ) push (args []* PushPair ) error {
117
117
content := p .Content .Format (args )
118
+ title := p .Title .Format (args )
118
119
body := map [string ]string {
119
120
"token" : p .Token ,
120
- "title" : p . Title ,
121
+ "title" : title ,
121
122
"content" : content ,
122
123
}
123
124
bodyBytes , err := json .Marshal (body )
@@ -185,15 +186,21 @@ func (p PushIfaceWebhook) push(args []*PushPair) error {
185
186
186
187
type PushIfaceServerChan struct {
187
188
SCKey string `json:"sckey"`
188
- Title string `json:"title"`
189
+ Title PushFormat `json:"title"`
189
190
Desp PushFormat `json:"desp"`
190
191
BodyRegex string `json:"body_regex"`
191
192
Code int `json:"code"`
192
193
}
193
194
194
195
func (p PushIfaceServerChan ) push (args []* PushPair ) error {
195
196
desp := p .Desp .Format (args )
196
- url := fmt .Sprintf ("https://sctapi.ftqq.com/%s.send?title=%s&desp=%s" , p .SCKey , p .Title , desp )
197
+ title := p .Title .Format (args )
198
+ url := fmt .Sprintf (
199
+ "https://sctapi.ftqq.com/%s.send?title=%s&desp=%s" ,
200
+ p .SCKey ,
201
+ title ,
202
+ desp ,
203
+ )
197
204
resp , code , err := http .Do ("GET" , url , nil , nil )
198
205
if err != nil {
199
206
return err
0 commit comments