Fix wrong URL

This commit is contained in:
foxster-mp4
2023-04-30 11:15:07 -07:00
parent a94b34225d
commit 2456da796d
4 changed files with 6 additions and 155 deletions

View File

@@ -1,52 +0,0 @@
#main {
padding-top: 2rem;
}
#main #title {
margin-bottom: 0.35rem;
padding: 0 1rem;
}
#main input {
width: 95%;
font-size: 1em;
padding: 0.5rem 0.8rem;
margin-bottom: 1rem;
border: none;
border-radius: 10px;
background-color: rgba(0, 0, 0, 0.07);
}
.suggestion {
padding: 1rem 1rem 1rem 0;
margin-left: 1rem;
font-size: 1.1rem;
border-bottom: 0.1px solid var(--color-separator);
}
.suggestion .bi {
margin-right: 4px;
}
@media (hover:hover) {
.suggestion:hover {
opacity: 0.75;
}
}
@media (prefers-color-scheme: dark) {
#main input {
background-color: rgba(255, 255, 255, 0.07);
color: white;
}
.suggestion {
border-bottom: 0.1px solid var(--color-separator-dark) !important;
}
}
#main .textfield {
display: flex;
align-items: center;
justify-content: center;
padding: 0 1rem;
}

View File

@@ -1,46 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/shared.css">
<link rel="stylesheet" href="css/uibanner.css">
</head>
<body class="loading">
<div id="loading">
<img src="img/loading.gif" alt="loading">
<p>Loading</p>
</div>
<!-- Add to AltStore banner -->
<div id="top"></div>
<div id="main">
<p>Now viewing</p>
<div class="header">
<h1 id="title">altsource-v2</h1>
<a href="index.html"><i class="bi bi-pencil-square"></i></a>
</div>
<div id="news" class="section">
<div class="header">
<h2>News</h2>
<a href="index.html">View All</a>
</div>
<div id="news-items"></div>
</div>
<div id="apps" class="section">
<div class="header">
<h2>Featured Apps</h2>
<a href="index.html">View All Apps</a>
</div>
</div>
<div id="about" class="section">
<div class="header">
<h2>About</h2>
</div>
</div>
</div>
<script src="js/shared.js"></script>
<script src="js/home.js"></script>
<script src="js/main.js"></script>
</body>
</html>

View File

@@ -1,56 +0,0 @@
function main(json) {
// Set "View All News" link
document.querySelector("#news a").href = `news.html?source=${sourceURL}`;
// Set "View All Apps" link
document.querySelector("#apps a").href = `apps.html?source=${sourceURL}`;
// Set tab title
document.title = json.name;
// Set page title
document.getElementById("title").innerText = json.name;
//
// News
if (json.news && json.news.length >= 1) {
// Sort news in decending order of date (latest first)
json.news.sort((a, b) => // If b < a
(new Date(b.date)).valueOf() - (new Date(a.date)).valueOf());
if (json.news.length == 1) {
document.getElementById("news-items").insertAdjacentHTML("beforeend", newsItemHTML(json.news[0], true));
document.getElementById("news-items").classList.add("one");
} else for (let i = 0; i < 5 && i < json.news.length; i++)
document.getElementById("news-items").insertAdjacentHTML("beforeend", newsItemHTML(json.news[i], true));
} else document.getElementById("news").remove();
// Sort apps in descending order of version date
json.apps.sort((a, b) => (new Date(b.versionDate)).valueOf() - (new Date(a.versionDate)).valueOf());
//
// Featured apps
let count = 1;
json.apps.forEach(app => {
// Max: 3 featured apps if not specified
if (count > 3) return;
// Ignore beta apps
if (app.beta) return;
// If there are featured apps, ignore non-featured apps
if (json.featuredApps && !json.featuredApps.includes(app.bundleIdentifier)) return;
document.getElementById("apps").insertAdjacentHTML("beforeend", appHeaderHTML(app));
count++;
});
//
// About
var description = formatString(json.description);
if (description) document.getElementById("about").insertAdjacentHTML("beforeend", `
<div class="item">
<p>${description}</p>
</div>
`);
else document.getElementById("about").remove();
}

View File

@@ -1,5 +1,10 @@
(function main() {
const success = url => window.location.replace(`${window.location.host}?source=${url}`);
const success = url => {
const host = window.location.host;
var path = window.location.pathname.split("/")[1];
path = path?.trim === "" ? "" : `/${path}`;
window.location.replace(`${host}${path}?source=${url}`
)};
// If valid source provided
if (urlSearchParams.has('source') && isValidHTTPURL(sourceURL))