mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 09:12:58 +01:00
✏️ Check if state is changed before saving it
This commit is contained in:
parent
61ddd73a8c
commit
ee25207856
@ -29,8 +29,16 @@ function getStatus() {
|
||||
}
|
||||
|
||||
function setStatus(state) {
|
||||
if (fs.existsSync(statusPath)) {
|
||||
let old_state_str = fs.readFileSync(statusPath).toString();
|
||||
if(old_state_str !== JSON.stringify(state)){
|
||||
fs.writeFileSync(statusPath, JSON.stringify(state));
|
||||
}
|
||||
}else{
|
||||
fs.writeFileSync(statusPath, JSON.stringify(state));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.init = init;
|
||||
exports.getStatus = getStatus;
|
||||
|
Loading…
Reference in New Issue
Block a user