mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-25 18:43:00 +01:00
🔨 Switch to partial backup #33
This commit is contained in:
parent
310ecf1c17
commit
9c08147b00
@ -89,6 +89,20 @@ function getAddonList() {
|
||||
});
|
||||
}
|
||||
|
||||
function getAddonToBackup(){
|
||||
return new Promise((resolve, reject) => {
|
||||
let excluded_addon = settingsTools.getSettings().exclude_addon;
|
||||
getAddonList().then((all_addon)=>{
|
||||
let slugs = [];
|
||||
for(let i in all_addon){
|
||||
if(!excluded_addon.includes(all_addon[i].slug))
|
||||
slugs.push(all_addon[i].slug)
|
||||
}
|
||||
resolve(slugs)
|
||||
}).catch(()=>reject());
|
||||
});
|
||||
}
|
||||
|
||||
function getFolderList(){
|
||||
return [
|
||||
{
|
||||
@ -115,6 +129,16 @@ function getFolderList(){
|
||||
]
|
||||
}
|
||||
|
||||
function getFolderToBackup(){
|
||||
let excluded_folder = settingsTools.getSettings().exclude_folder;
|
||||
let all_folder = getFolderList()
|
||||
let slugs = [];
|
||||
for(let i in all_folder){
|
||||
if(!excluded_folder.includes(all_folder[i].slug))
|
||||
slugs.push(all_folder[i].slug)
|
||||
}
|
||||
return slugs;
|
||||
}
|
||||
|
||||
function getSnapshots() {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -254,14 +278,20 @@ function createNewBackup(name) {
|
||||
statusTools.setStatus(status);
|
||||
logger.info("Creating new snapshot...");
|
||||
let token = process.env.HASSIO_TOKEN;
|
||||
getAddonToBackup().then((addons)=>{
|
||||
let folders = getFolderToBackup();
|
||||
let option = {
|
||||
headers: { "X-HASSIO-KEY": token },
|
||||
responseType: "json",
|
||||
timeout: create_snap_timeout,
|
||||
json: { name: name },
|
||||
json: {
|
||||
name: name,
|
||||
addons: addons,
|
||||
folders: folders
|
||||
},
|
||||
};
|
||||
|
||||
got.post(`http://hassio/snapshots/new/full`, option)
|
||||
got.post(`http://hassio/snapshots/new/partial`, option)
|
||||
.then((result) => {
|
||||
logger.info(`Snapshot created with id ${result.body.data.slug}`);
|
||||
resolve(result.body.data.slug);
|
||||
@ -274,6 +304,9 @@ function createNewBackup(name) {
|
||||
logger.error(status.message);
|
||||
reject(status.message);
|
||||
});
|
||||
|
||||
}).catch(reject);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@
|
||||
M.Dropdown.init(drops, { constrainWidth: false, coverTrigger: false, alignment: 'right', onOpenStart: () => $('#setting-trigger').addClass('active'), onCloseEnd: () => $('#setting-trigger').removeClass('active') });
|
||||
|
||||
setInterval(update_status, 500);
|
||||
setInterval(updateLocalSnaps, 2000);
|
||||
setInterval(updateLocalSnaps, 5000);
|
||||
listeners();
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user