This commit is contained in:
maaa 2024-03-09 15:19:52 +01:00
parent b3af057ae0
commit bd3a41b6ae
2 changed files with 62 additions and 34 deletions

View File

@ -18,7 +18,10 @@
<a href="about.html">About</a>
</div>
</div>-->
<noscript><p style="width: 100%; background-color: #fffaa0; margin: 0; height: 30px;">This page might require JavaScript to work properly</h1></noscript>
<noscript>
<p style="width: 100%; background-color: #fffaa0; margin: 0; height: 30px;">This page might require JavaScript
to work properly</h1>
</noscript>
<br>
<div class="introductionDiv">
<h1 class="w700">burgerstore</h1>
@ -26,10 +29,15 @@
</div>
<div id="appGrid" class="appGrid">
<a class="featuredApp" src="/"><img></a>
<h3>iOS apps</h3>
<a href="https://altstore.io/">AltStore</a> is required in order to install apps</p>
</div>
<script src="static/js/main.js"></script>
<div id="iOSAppInfo" class="hidden">
<h3>Featured apps for your device</h3>
<a href="https://altstore.io/">AltStore</a> is required in order to install apps on iOS</p>
</div>
<div id="unknownAppInfo" class="hidden">
<h3>No apps are available for your device</h3>
<p>Supported operating systems include: Linux and iOS</p>
</div>
<script src="static/js/main.js"></script>
</body>

View File

@ -1,4 +1,6 @@
let appGrid = document.getElementById("appGrid")
let iOSAppInfo = document.getElementById("iOSAppInfo")
let unknownAppInfo = document.getElementById("unknownAppInfo")
async function getStore(link) {
const response = await fetch(link);
@ -6,34 +8,52 @@ async function getStore(link) {
return data
}
getStore("repo/store.json").then((data) => {
console.log(data["title"])
console.log(data["apps"])
for (index in data["apps"]) {
let application = data["apps"][index]
// check if on iOS or iPadOS
if (navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPad")) {
// UI stuff
let appDiv = document.createElement("div")
appDiv.classList.add("app")
appGrid.append(appDiv)
let appImage = document.createElement("img")
appImage.src = application["iconURL"]
appDiv.append(appImage)
let appTitle = document.createElement("p")
appTitle.classList.add("title")
appTitle.innerText = application["name"]
appDiv.append(appTitle)
let appInfo = document.createElement("p")
appInfo.classList.add("w300")
appInfo.innerText = application["developerName"] + " | " + application["subtitle"]
appDiv.append(appInfo)
let appButton = document.createElement("button")
appButton.innerText = "Get"
appDiv.append(appButton)
// get iOS version
if (navigator.userAgent.split(" ")[5] == "like") {
let iOSVersion = navigator.userAgent.split(" ")[4].replaceAll("_", ".")
} else {
let iOSVersion = navigator.userAgent.split(" ")[5].replaceAll("_", ".")
}
//console.log(data)
});
// show iOS app info
iOSAppInfo.classList.remove("hidden")
// Load AltStore repository
getStore("repo/store.json").then((data) => {
console.log(data["title"])
console.log(data["apps"])
for (index in data["apps"]) {
let application = data["apps"][index]
// UI stuff
let appDiv = document.createElement("div")
appDiv.classList.add("app")
appGrid.append(appDiv)
let appImage = document.createElement("img")
appImage.src = application["iconURL"]
appDiv.append(appImage)
let appTitle = document.createElement("p")
appTitle.classList.add("title")
appTitle.innerText = application["name"]
appDiv.append(appTitle)
let appInfo = document.createElement("p")
appInfo.classList.add("w300")
appInfo.innerText = application["developerName"] + " | " + application["subtitle"]
appDiv.append(appInfo)
let appButton = document.createElement("button")
appButton.innerText = "Get"
appDiv.append(appButton)
}
});
}
// Unknown device
else {
unknownAppInfo.classList.remove("hidden")
}