Skip to content

Commit 72875d8

Browse files
committed
update main.js
1 parent 9d79e8e commit 72875d8

2 files changed

Lines changed: 24 additions & 29 deletions

File tree

www/cgi-bin/pw.cgi

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ case "$task" in
203203

204204
echo "Status: 400 Bad Request"
205205
echo ""
206-
echo "{\"output\":\"Invalid token!\""
206+
echo "{\"output\":\"Invalid token!\"}"
207207
exit 1
208208

209209
fi
@@ -250,7 +250,7 @@ case "$task" in
250250

251251
echo "Status: 400 Bad Request"
252252
echo ""
253-
echo "{\"output\":\"Invalid token!\""
253+
echo "{\"output\":\"Invalid token!\"}"
254254
exit 1
255255

256256
fi
@@ -273,7 +273,7 @@ case "$task" in
273273

274274
echo "Status: 400 Bad Request"
275275
echo ""
276-
echo "{\"output\":\"Invalid token!\""
276+
echo "{\"output\":\"Invalid token!\"}"
277277
exit 1
278278

279279
fi
@@ -329,7 +329,7 @@ case "$task" in
329329

330330
echo "Status: 400 Bad Request"
331331
echo ""
332-
echo "{\"output\":\"Invalid token!\""
332+
echo "{\"output\":\"Invalid token!\"}"
333333
exit 1
334334

335335
fi
@@ -348,7 +348,7 @@ case "$task" in
348348

349349
echo "Status: 400 Bad Request"
350350
echo ""
351-
echo "{\"output\":\"Invalid token!\""
351+
echo "{\"output\":\"Invalid token!\"}"
352352
exit 1
353353

354354
fi
@@ -370,13 +370,18 @@ case "$task" in
370370
"remove")
371371

372372
if ! [ "$token" = "$stoken" ]; then
373-
rm -f /usr/bin/pppwn
374-
rm -rf /root/*
375-
rm -rf /www/pppwn
376-
rm -f /www/pppwn.html
377-
rm -f /www/cgi-bin/pw.cgi
378-
echo "{\"output\":\"Uninstalled!\"}"
373+
echo "Status: 400 Bad Request"
374+
echo ""
375+
echo "{\"output\":\"Invalid token!\"}"
376+
exit 1
379377
fi
378+
379+
rm -f /usr/bin/pppwn
380+
rm -rf /root/*
381+
rm -rf /www/pppwn
382+
rm -f /www/pppwn.html
383+
rm -f /www/cgi-bin/pw.cgi
384+
echo "{\"output\":\"Uninstalled!\"}"
380385

381386
;;
382387
"connect")
@@ -385,7 +390,7 @@ case "$task" in
385390

386391
echo "Status: 400 Bad Request"
387392
echo ""
388-
echo "{\"output\":\"Invalid token!\""
393+
echo "{\"output\":\"Invalid token!\"}"
389394
exit 1
390395

391396
fi
@@ -411,7 +416,7 @@ case "$task" in
411416

412417
echo "Status: 400 Bad Request"
413418
echo ""
414-
echo "{\"output\":\"Invalid token!\""
419+
echo "{\"output\":\"Invalid token!\"}"
415420
exit 1
416421

417422
fi

www/pppwn/main.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,8 @@ var appView = Backbone.View.extend({
137137
}).then(function(){
138138
document.cookie = 'token=; path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
139139
$.modal.close();
140-
}).catch(function(error){
141-
$.modal.close();
142-
$.modal(function(modal){
143-
modal.content(self.templates.msg({message: err.responseText}));
144-
});
140+
}).catch(function(err){
141+
$.modal.content(self.templates.msg({message: err.responseJSON.output}));
145142
});
146143

147144
},
@@ -169,10 +166,7 @@ var appView = Backbone.View.extend({
169166
$.modal.close();
170167
});
171168
}).catch(function(err){
172-
$.modal.close();
173-
$.modal(function(modal){
174-
modal.content(self.templates.msg({message: err.responseText}));
175-
});
169+
$.modal.content(self.templates.msg({message: err.responseJSON.output}));
176170
});
177171

178172
},
@@ -190,13 +184,10 @@ var appView = Backbone.View.extend({
190184
task:'remove',
191185
token:this.webToken
192186
}
193-
}).then(function(){
194-
location.assign('/');
187+
}).then(function(res){
188+
location.assign("/");
195189
}).catch(function(err){
196-
$.modal.close();
197-
$.modal(function(modal){
198-
modal.content(self.templates.msg({message: err.responseText}));
199-
});
190+
$.modal.content(self.templates.msg({message: err.responseJSON.output}));
200191
});
201192

202193
},
@@ -259,7 +250,6 @@ var appView = Backbone.View.extend({
259250
}
260251

261252
res.catch(function(err) {
262-
$.modal.close();
263253
$.modal(function(modal){
264254
modal.content(self.templates.msg({message: err.responseJSON.output}));
265255
});

0 commit comments

Comments
 (0)