mirror of
https://github.com/driftywinds/driftywinds.github.io.git
synced 2025-12-19 11:03:32 +00:00
Better HTTP URL validation
This commit is contained in:
14
js/main.js
14
js/main.js
@@ -1,9 +1,13 @@
|
||||
(function () {
|
||||
// If no source or source is not a URL
|
||||
if (!urlSearchParams.has('source') || !sourceURL.match(urlRegex))
|
||||
window.location.replace("index.html");
|
||||
insertAddToAltStoreBanner();
|
||||
})()
|
||||
// If no source
|
||||
if (!urlSearchParams.has('source'))
|
||||
search();
|
||||
// If source is not a valid HTTP URL
|
||||
else if (!isValidHTTPURL(sourceURL)) {
|
||||
alert("Invalid HTTP URL.");
|
||||
search();
|
||||
} else insertAddToAltStoreBanner();
|
||||
})();
|
||||
|
||||
fetch(sourceURL, {
|
||||
cache: "force-cache"
|
||||
|
||||
Reference in New Issue
Block a user