[#2855] [WebUI] Unable to add UDP trackers

This commit is contained in:
Calum Lind 2016-07-19 11:46:53 +01:00
parent 5f92810f76
commit d38b8fc45c
1 changed files with 15 additions and 6 deletions

View File

@ -31,6 +31,15 @@
*/ */
Ext.ns('Deluge'); Ext.ns('Deluge');
// Custom VType validator for tracker urls
var trackerUrlTest = /(((^https?)|(^udp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
Ext.apply(Ext.form.VTypes, {
trackerUrl: function(val, field) {
return trackerUrlTest.test(val);
},
trackerUrlText: 'Not a valid tracker url'
});
/** /**
* @class Deluge.AddTrackerWindow * @class Deluge.AddTrackerWindow
* @extends Ext.Window * @extends Ext.Window
@ -76,7 +85,7 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, {
var cleaned = []; var cleaned = [];
Ext.each(trackers, function(tracker) { Ext.each(trackers, function(tracker) {
if (Ext.form.VTypes.url(tracker)) { if (Ext.form.VTypes.trackerUrl(tracker)) {
cleaned.push(tracker); cleaned.push(tracker);
} }
}, this); }, this);