Add tracker validation for uploaded torrent
This commit is contained in:
		@@ -98,6 +98,14 @@ body {
 | 
			
		||||
	content: "*:";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.has-error {
 | 
			
		||||
	color: #a94442;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.has-success {
 | 
			
		||||
	color: #3c763d;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.detectedFiles {
 | 
			
		||||
	max-height: 300px;
 | 
			
		||||
	overflow: auto;
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,6 @@ function getOrCreate(root, foldername, displayname, type) {
 | 
			
		||||
			content.hidden = true
 | 
			
		||||
			element.appendChild(content)
 | 
			
		||||
		}
 | 
			
		||||
		foobar = root
 | 
			
		||||
		root = root.querySelector(".content")
 | 
			
		||||
		root.appendChild(element)
 | 
			
		||||
		return element
 | 
			
		||||
@@ -210,12 +209,20 @@ function validateForm() {
 | 
			
		||||
	subcategory = document.querySelector("#subcategory")
 | 
			
		||||
	torrentname = document.querySelector(".torrent-form .name input")
 | 
			
		||||
	description = document.querySelector(".torrent-form .description textarea")
 | 
			
		||||
	tracker = document.querySelector(".trackerGroup .detectedTracker").parentElement
 | 
			
		||||
 | 
			
		||||
	file_label = document.querySelector(".torrent-form .file")
 | 
			
		||||
	category_label = document.querySelector(".torrent-form .category")
 | 
			
		||||
	name_label =  document.querySelector(".torrent-form .name")
 | 
			
		||||
	description_label = document.querySelector(".torrent-form .description")
 | 
			
		||||
 | 
			
		||||
	if(validtracker.indexOf(torrentObject.announce) < 0) {
 | 
			
		||||
		valid = false
 | 
			
		||||
		setError(tracker)
 | 
			
		||||
	} else {
 | 
			
		||||
		setSuccess(tracker)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(file.value.length <= 0) {
 | 
			
		||||
		valid = false
 | 
			
		||||
		setError(file_label)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user