mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
update notification
This commit is contained in:
parent
364b6c64f5
commit
db522bf82c
@ -248,5 +248,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Download notification -->
|
||||
<div id="downloadNotif" onclick="openLatestDownload()">
|
||||
<img src="icons/alert.svg" />
|
||||
<span id="updateNotifText">
|
||||
A new update is available! Newest version:
|
||||
</span><span id="newestVersion"></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -57,6 +57,37 @@ async function proxyIsInstalled() {
|
||||
return false
|
||||
}
|
||||
|
||||
async function checkForUpdates() {
|
||||
const url = 'https://api.github.com/repos/Grasscutters/GrassClipper/releases/latest'
|
||||
|
||||
const { data } = await axios.get(url)
|
||||
const latest = data.tag_name
|
||||
|
||||
return latest
|
||||
}
|
||||
|
||||
async function displayUpdate(version) {
|
||||
const latest = await checkForUpdates()
|
||||
const versionDisplay = document.querySelector('#newestVersion')
|
||||
const notif = document.querySelector('#downloadNotif')
|
||||
|
||||
//if (latest === `v${NL_APPVERSION}`) return
|
||||
|
||||
versionDisplay.innerText = latest
|
||||
|
||||
notif.classList.add('displayed')
|
||||
|
||||
setTimeout(() => {
|
||||
notif.classList.remove('displayed')
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
async function openLatestDownload() {
|
||||
const downloadLink = 'https://github.com/Grasscutters/GrassClipper/releases/latest/'
|
||||
|
||||
Neutralino.os.open(downloadLink)
|
||||
}
|
||||
|
||||
async function openGameFolder() {
|
||||
const config = await getCfg()
|
||||
const folder = config.gameexe.match(/.*\\/g, '')[0]
|
||||
|
@ -7,6 +7,10 @@ body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.darken {
|
||||
filter: brightness(0.6);
|
||||
}
|
||||
@ -535,4 +539,43 @@ body {
|
||||
|
||||
#serverInput img:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#downloadNotif {
|
||||
z-index: 99;
|
||||
position: absolute;
|
||||
|
||||
color: #fff;
|
||||
background: #141414;
|
||||
border: 1px solid #ccc;
|
||||
|
||||
padding: 1em;
|
||||
top: 80%;
|
||||
left: 110%;
|
||||
width: 20%;
|
||||
border-radius: 5px;
|
||||
|
||||
text-align: center;
|
||||
|
||||
transition: left 0.4s ease-in-out;
|
||||
}
|
||||
|
||||
#downloadNotif:hover {
|
||||
cursor: pointer;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
#downloadNotif img {
|
||||
height: 20px;
|
||||
vertical-align: middle;
|
||||
margin-right: 4px;
|
||||
filter: invert(100%) sepia(100%) saturate(0%) hue-rotate(16deg) brightness(103%) contrast(101%);
|
||||
}
|
||||
|
||||
#downloadNotif.displayed {
|
||||
left: 70%;
|
||||
}
|
||||
|
||||
#newestVersion {
|
||||
font-weight: bold;
|
||||
}
|
Loading…
Reference in New Issue
Block a user