forked from inulute/perplexity-ai-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitial.html
66 lines (56 loc) · 2.77 KB
/
initial.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Varela Round' rel='stylesheet'>
<link rel="stylesheet" href="./external.css">
</head>
<body>
<div id="content">
<div id="logo"></div>
<h2>Choose an AI to Navigate</h2>
<div class="button-container">
<a href="https://perplexity.ai/search" class="button">Perplexity AI Search</a>
<a href="https://labs.perplexity.ai" class="button" id="chatButton">Perplexity AI Chat</a>
</div>
<p id="versionDisplay">Current Version: Checking...</p>
</div>
<footer>
Made with ❤️ by <a href="https://github.com/inulute" class="footerinu">inulute</a>
</footer>
<script>
function compareVersions(v1, v2) {
const parts1 = v1.split('.').map(Number);
const parts2 = v2.split('.').map(Number);
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
const part1 = parts1[i] || 0;
const part2 = parts2[i] || 0;
if (part1 > part2) return 1;
if (part1 < part2) return -1;
}
return 0;
}
async function checkForUpdates() {
try {
const currentVersion = await fetch('crrtver.inu').then(response => response.text());
const response = await fetch('https://raw.githubusercontent.com/inulute/perplexity-ai-app/main/package.json');
const { version: latestVersion } = await response.json();
const versionDisplay = document.getElementById("versionDisplay");
if (compareVersions(latestVersion, currentVersion) === 1) {
versionDisplay.innerHTML = `<a href="https://github.com/inulute/perplexity-ai-app/releases/latest" target="_blank" class="update-available">Update Available! Click here to download the latest version (${latestVersion}).</a>`;
} else {
versionDisplay.innerHTML = `<a href="https://donate.inulute.vercel.app" target="_blank" class="update-not-available">Please support us by donating.</a>`;
}
} catch (error) {
console.error("Error fetching version file:", error);
document.getElementById("versionDisplay").innerText = "Error checking for updates.";
}
}
document.getElementById("chatButton").addEventListener("click", checkForUpdates);
document.addEventListener("DOMContentLoaded", function () {
checkForUpdates(); // Check for updates on page load
});
</script>
</body>
</html>