mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Version now compares to latest pypi release
This commit is contained in:
parent
905c6e8e02
commit
8cf39adc91
@ -7,7 +7,7 @@ author = {
|
||||
"email":"maloja@krateng.dev",
|
||||
"github": "krateng"
|
||||
}
|
||||
version = 2,1
|
||||
version = 2,1,1
|
||||
versionstr = ".".join(str(n) for n in version)
|
||||
|
||||
|
||||
|
@ -10,9 +10,20 @@
|
||||
<pyhp include="common/header.html" />
|
||||
|
||||
<script>
|
||||
neo.xhttprequest("https://maloja.krateng.ch/api/serverinfo",{},"GET",json=true).then((response)=>{
|
||||
|
||||
function versioncompare(a,b) {
|
||||
for (var pos=0;pos<3;pos++) {
|
||||
var v1 = parseInt(a[pos]) || 0;
|
||||
var v2 = parseInt(b[pos]) || 0;
|
||||
if (v1 > v2) { return 1;}
|
||||
if (v1 < v2) { return -1;}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
neo.xhttprequest("https://pypi.org/pypi/malojaserver/json",{},"GET",json=true).then((response)=>{
|
||||
result = JSON.parse(response.responseText);
|
||||
latestvers = result.version;
|
||||
latestvers = result.info.version.split(".");
|
||||
|
||||
neo.xhttprequest("/api/serverinfo",{},"GET",json=true).then((response)=>{
|
||||
|
||||
@ -22,7 +33,7 @@
|
||||
document.getElementById("latestversion").innerHTML = latestvers.join(".");
|
||||
document.getElementById("currentversion").innerHTML = thisvers.join(".");
|
||||
|
||||
if (latestvers <= thisvers) {
|
||||
if (versioncompare(latestvers,thisvers) <= 0) {
|
||||
document.getElementById("currentversion").style.color = "green";
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user