Skip to content

Commit 69fe31a

Browse files
authored
Fix redirect URL construction and error messages
1 parent 7d94e5f commit 69fe31a

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

sourceRedirect.html

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,23 @@
1313

1414
// Redirect immediately
1515
window.addEventListener('DOMContentLoaded', () => {
16-
const appName = getQueryParam('app'); // e.g. altstore
16+
const appName = getQueryParam('app'); // e.g., altstore
17+
const path = getQueryParam('path'); // e.g., source
1718

18-
if(appName) {
19-
// Construct the custom URL scheme
20-
const redirectURL = `${appName}://source?url=${encodeURIComponent("https://prostore-ios.github.io/apps.json")}`;
19+
if(appName && path) {
20+
const redirectURL = `${appName}://${path}=${encodeURIComponent("https://prostore-ios.github.io/apps.json")}`;
21+
// Redirect
2122
window.location.href = redirectURL;
23+
24+
// Update manual link as fallback
25+
document.body.innerHTML = `<p>Redirecting to <strong>${redirectURL}</strong>… If nothing happens, <a href="${redirectURL}">click here</a>.</p>`;
2226
} else {
23-
// Fallback if parameters are missing
24-
document.body.innerHTML = "<h1>Missing app parameter!</h1>";
27+
document.body.innerHTML = "<h1>Missing app or path parameter!</h1>";
2528
}
2629
});
2730
</script>
2831
</head>
2932
<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>
33+
<p>Redirecting…<br>If nothing happens, <a id="manual-link">click here</a>.</p>
3934
</body>
4035
</html>

0 commit comments

Comments
 (0)