File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,20 @@ $(document).ready(() => {
7979 let psTimeout ;
8080 let psInterval = 5000 ;
8181
82+ function checkUpdate ( ) {
83+ $ . getJSON ( `update_check.cgi?cmd=versions&sid=${ sid } ` , ( current , success ) => {
84+ $ . get ( `update_check.cgi?sid=${ sid } ` , ( available , success ) => {
85+ if ( current . redmatic !== $ . trim ( available ) ) {
86+ $ ( '#update-link' ) . html ( `<a href="https://github.com/rdmtc/RedMatic/releases/latest" target="_blank">download version ${ available } </a>` ) ;
87+ $ ( '#update-notify' ) . show ( ) ;
88+ }
89+ } ) ;
90+ } ) ;
91+
92+ }
93+
94+ checkUpdate ( ) ;
95+
8296 function pkg ( ) {
8397 let packages ;
8498 $ . get ( `pkg.cgi?sid=${ sid } &cmd=repo` , data => {
Original file line number Diff line number Diff line change 4646
4747 < div class ="tab-content " id ="myTabContent ">
4848 < div class ="tab-pane fade show " id ="configuration " role ="tabpanel " aria-labelledby ="configuration-tab ">
49+
50+ < div id ="update-notify " class ="card mb-4 " style ="border-color: orange; display: none; ">
51+ < div class ="card-body ">
52+ RedMatic update available: < span id ="update-link "> </ span >
53+ </ div >
54+ </ div >
55+
4956 < div class ="card mb-4 ">
57+
5058 < div class ="card-body ">
5159 < a id ="link-red " role ="button " class ="btn btn-sm btn-outline-info " target ="_blank " href ="/addons/red/ "> < i class ="fa fa-external-link-alt "> </ i > Node-RED</ a >
5260 < a id ="link-ui " role ="button " class ="btn btn-sm btn-outline-info mr-3 " target ="_blank " href ="/addons/red/ui/ "> < i class ="fa fa-external-link-alt "> </ i > Dashboard</ a >
Original file line number Diff line number Diff line change @@ -13,11 +13,15 @@ catch {
1313 }
1414}
1515
16- puts -nonewline " Content-Type: text/html; charset=utf-8\r\n\r\n "
1716
1817if { [info exists cmd ] && $cmd == " download" } {
18+ puts -nonewline " Content-Type: text/html; charset=utf-8\r\n\r\n "
1919 puts " <html><head><meta http-equiv='refresh' content='0; url=$downloadURL ' /></head></html>"
20+ } elseif { [info exists cmd ] && $cmd == " versions" } {
21+ puts -nonewline " Content-Type: application/json; charset=utf-8\r\n\r\n "
22+ puts [ exec /usr/local/addons/redmatic/bin/redmaticVersions ]
2023} else {
24+ puts -nonewline " Content-Type: text/html; charset=utf-8\r\n\r\n "
2125 catch {
2226 [regexp "tag_name\" : \" v(\[ 0-9\] +\.\[ 0-9\] +\.\[ 0-9\] +(-\[ a-zA-Z\] +.\[ 0-9\] +)?)" [ exec /usr/bin/env wget -qO- --no-check-certificate $checkURL ] dummy newversion]
2327 }
You can’t perform that action at this time.
0 commit comments