ugh, making this work with mimes is annoying
This commit is contained in:
		
							
								
								
									
										13
									
								
								sx-open
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								sx-open
									
									
									
									
									
								
							| @@ -41,18 +41,15 @@ main() { | ||||
| 	target="$1" | ||||
| 	[[ "$target" ]] || { usage; exit; } | ||||
|  | ||||
| 	if [[ "$target" =~ ${cfg_uri_regex} ]]; then | ||||
| 		handle_uri "$target" | ||||
| 	elif [[ -e "$target" ]]; then | ||||
| 	handle_uri "$target" || { | ||||
| 		[[ "$target" =~ file://.+ ]] && { target="${target##*file://}"; } | ||||
|  | ||||
| 		[[ -e "$target" ]] && { | ||||
| 			[[ "$target" =~ ^/.* ]] || { target="${PWD}/${target}"; } | ||||
|  | ||||
| 		handle_uri "file://${target}" || { | ||||
| 			handle_mime "$target" | ||||
| 		} | ||||
| 	else | ||||
| 		echo "$target is not a uri nor is it an existing file. Bailing." | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	} | ||||
|  | ||||
| 	[[ "$?" -gt 0 ]] && { echo "No handlers found for $target"; } | ||||
|  | ||||
|   | ||||
| @@ -3,8 +3,8 @@ | ||||
|  | ||||
| uri_handlers=( | ||||
| 	["steam"]='^steam://.+' | ||||
| 	["browser"]='.+' | ||||
| 	["javaws"]='^file:///.+?kvm.+?\.cgi$' | ||||
| 	["browser"]='^http(s)://.+' | ||||
| ) | ||||
|  | ||||
| mime_handlers=( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user