update
This commit is contained in:
@@ -125,6 +125,12 @@
|
||||
|
||||
<div id="alert_container"></div>
|
||||
|
||||
<h5 class="mt-4">Set RTC</h5>
|
||||
|
||||
<button type="submit" class="btn btn-primary mb-1" onclick="set_RTC_withNTP()">WiFi (NTP) </button>
|
||||
<button type="submit" class="btn btn-primary mb-1" onclick="set_RTC_withBrowser()">Browser time </button>
|
||||
<button type="submit" class="btn btn-primary mb-1" onclick="set_RTC_with4G()" disabled>4G (NTP) </button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -240,7 +246,7 @@ window.onload = function() {
|
||||
if (typeof timeDiff === "number") {
|
||||
if (timeDiff >= 0 && timeDiff <= 10) {
|
||||
alertContainer.innerHTML = `
|
||||
<div class="alert alert-primary" role="alert">
|
||||
<div class="alert alert-success" role="alert">
|
||||
RTC and system time are in sync (Difference: ${timeDiff} sec).
|
||||
</div>`;
|
||||
} else if (timeDiff > 10) {
|
||||
@@ -295,24 +301,76 @@ function update_config(param, value){
|
||||
function updateGitPull(){
|
||||
console.log("Updating device (git pull)");
|
||||
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=git_pull',
|
||||
method: 'GET', // Use GET or POST depending on your needs
|
||||
dataType: 'text', // Specify that you expect a JSON response
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=git_pull',
|
||||
method: 'GET', // Use GET or POST depending on your needs
|
||||
dataType: 'text', // Specify that you expect a JSON response
|
||||
|
||||
success: function(response) {
|
||||
// Handle success response if needed
|
||||
console.log(response);
|
||||
alert(response);
|
||||
// Reload the page after the device update
|
||||
location.reload(); // This will reload the page
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function set_RTC_withNTP(){
|
||||
console.log("Set RTC module with WIFI (NTP server)");
|
||||
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=set_RTC_withNTP',
|
||||
method: 'GET', // Use GET or POST depending on your needs
|
||||
dataType: 'text', // Specify that you expect a JSON response
|
||||
|
||||
success: function(response) {
|
||||
// Handle success response if needed
|
||||
console.log(response);
|
||||
alert(response);
|
||||
// Reload the page after the device update
|
||||
location.reload(); // This will reload the page
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function set_RTC_withBrowser(){
|
||||
console.log("Set RTC module with browser time");
|
||||
const browserTime = new Date(); // Get the current time in the browser
|
||||
const formattedTime = browserTime.toISOString(); // Convert to ISO string (UTC)
|
||||
console.log(formattedTime);
|
||||
|
||||
$.ajax({
|
||||
url: `launcher.php?type=set_RTC_withBrowser&time=${encodeURIComponent(formattedTime)}`,
|
||||
method: 'GET', // Use GET or POST depending on your needs
|
||||
dataType: 'text', // Specify that you expect a JSON response
|
||||
|
||||
success: function(response) {
|
||||
// Handle success response if needed
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
alert("RTC successfully updated!");
|
||||
} else {
|
||||
alert(`Error: ${response.message}`);
|
||||
} // Reload the page after the device update
|
||||
location.reload(); // This will reload the page
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
success: function(response) {
|
||||
// Handle success response if needed
|
||||
console.log(response);
|
||||
alert(response);
|
||||
// Reload the page after the device update
|
||||
location.reload(); // This will reload the page
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user