Skip to content

Commit 7d94e5f

Browse files
authored
Remove sourceURL dependency in redirect logic
1 parent 0c10af5 commit 7d94e5f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

sourceRedirect.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>ProStore Redirect</title>
7+
<script>
8+
// Function to read URL parameters
9+
function getQueryParam(param) {
10+
const urlParams = new URLSearchParams(window.location.search);
11+
return urlParams.get(param);
12+
}
13+
14+
// Redirect immediately
15+
window.addEventListener('DOMContentLoaded', () => {
16+
const appName = getQueryParam('app'); // e.g. altstore
17+
18+
if(appName) {
19+
// Construct the custom URL scheme
20+
const redirectURL = `${appName}://source?url=${encodeURIComponent("https://prostore-ios.github.io/apps.json")}`;
21+
window.location.href = redirectURL;
22+
} else {
23+
// Fallback if parameters are missing
24+
document.body.innerHTML = "<h1>Missing app parameter!</h1>";
25+
}
26+
});
27+
</script>
28+
</head>
29+
<body>
30+
<p>Redirecting… If nothing happens, <a id="manual-link">click here</a>.</p>
31+
<script>
32+
const manualLink = document.getElementById('manual-link');
33+
const urlParams = new URLSearchParams(window.location.search);
34+
const appName = urlParams.get('app');
35+
if(appName) {
36+
manualLink.href = `${appName}://source?url=${encodeURIComponent("https://prostore-ios.github.io/apps.json")}`;
37+
}
38+
</script>
39+
</body>
40+
</html>

0 commit comments

Comments
 (0)