|
66 | 66 | <script>
|
67 | 67 | var log="";
|
68 | 68 | $.getJSON('../services/settings/releaseTagName').done(function (data){
|
69 |
| - var currentfirmwarerevision=data; |
70 |
| - $.getJSON('https://api.github.com/repos/Photocentric3D/Photonic3D/releases/latest').done(function (remotedata){ |
71 |
| - var remotefirmwarerevision=remotedata.tag_name; |
72 |
| - log="Local firmware version:\n "+currentfirmwarerevision+"\n"; |
73 |
| - log+="Server firmware version:\n "+remotefirmwarerevision+"\n\n"; |
74 |
| - var localFloat = currentfirmwarerevision.replace("Photocentric-","").replace("photocentric-",""); |
75 |
| - var remoteFloat = remotefirmwarerevision.replace("Photocentric-","").replace("photocentric-",""); |
76 |
| - if ((parseFloat(localFloat)) < (parseFloat(remoteFloat))){ |
77 |
| - log+="Your firmware needs an update. Restart the printer, and we will automatically update the printer"; |
78 |
| - window.location.href=("error.html?type=info&errorname=Firmware Update Available&errordetails=There is a new firmware update available. Please restart your printer when it is convenient to do so, and we will install it automatically"); |
79 |
| - |
80 |
| - } |
81 |
| - else { |
82 |
| - log+="Your firmware is up-to-date!"; |
| 69 | + var currentsoftwarerevision=data; |
| 70 | + $.getJSON('../services/settings/printerProfileRepo').done(function (data) { |
| 71 | + var repo = data; |
| 72 | + $.getJSON('https://api.github.com/repos/'+repo+'/releases/latest').done(function (remotedata){ |
| 73 | + var remotesoftwarerevision = remotedata.tag_name; |
| 74 | + log="Current Printer software version:\n "+currentsoftwarerevision+"\n"; |
| 75 | + log+="Server software version:\n "+remotesoftwarerevision+"\n\n"; |
| 76 | + if (remotesoftwarerevision != currentsoftwarerevision){ |
| 77 | + log+="Your printer software is different than the latest version. Restart the printer, and we will automatically update the printer"; |
| 78 | + window.location.href=("error.html?type=info&errorname=Printer Software Update Available&errordetails=There is a new software update available. Please restart your printer when it is convenient to do so, and we will install it automatically"); |
| 79 | + } else { |
| 80 | + log+="Your printer software is up-to-date!"; |
83 | 81 | }
|
84 | 82 | document.getElementById("log").innerHTML=log;
|
85 |
| - }) |
86 |
| - .fail(function (){ |
87 |
| - document.getElementById("log").innerHTML="Could not access remote server to fetch remote firmware version.\n\nPlease try again later"; |
| 83 | + }) .fail(function (){ |
| 84 | + document.getElementById("log").innerHTML="Could not access remote server to fetch remote printer software version.\n\nPlease try again later"; |
88 | 85 | });
|
89 | 86 | });
|
| 87 | + }); |
90 | 88 | </script>
|
91 | 89 | <div class="screen">
|
92 | 90 | <div class="main">
|
|
0 commit comments