mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 09:12:58 +01:00
✏️ Remove fallback token
This commit is contained in:
parent
fc62958513
commit
859ed047ee
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-config-google": "^0.14.0"
|
"eslint-config-google": "^0.14.0",
|
||||||
|
"nodemon": "^2.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,11 @@ const {promisify} = require('util');
|
|||||||
const pipeline = promisify(stream.pipeline);
|
const pipeline = promisify(stream.pipeline);
|
||||||
const got = require ('got');
|
const got = require ('got');
|
||||||
|
|
||||||
// !!! FOR DEV PURPOSE ONLY !!!
|
|
||||||
//put token here for dev (ssh port tunelling 'sudo ssh -L 80:hassio:80 root@`hassoi_ip`' + put 127.0.0.1 hassio into host)
|
|
||||||
const fallbackToken = "cf199dd47c09839e8310955246e664c767a05c27f5f03078f3a15b04509c8869321a79eecbe5e8101635a7420c2ba06787823f7d5be4b502"
|
|
||||||
|
|
||||||
|
|
||||||
function getSnapshots() {
|
function getSnapshots() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let token = process.env.HASSIO_TOKEN;
|
let token = process.env.HASSIO_TOKEN;
|
||||||
if (token == null) {
|
|
||||||
token = fallbackToken
|
|
||||||
}
|
|
||||||
let status = statusTools.getStatus();
|
let status = statusTools.getStatus();
|
||||||
let option = {
|
let option = {
|
||||||
headers: { 'X-HASSIO-KEY': token },
|
headers: { 'X-HASSIO-KEY': token },
|
||||||
@ -56,9 +50,6 @@ function downloadSnapshot(id) {
|
|||||||
let tmp_file = `./temp/${id}.tar`
|
let tmp_file = `./temp/${id}.tar`
|
||||||
let stream = fs.createWriteStream(tmp_file);
|
let stream = fs.createWriteStream(tmp_file);
|
||||||
let token = process.env.HASSIO_TOKEN;
|
let token = process.env.HASSIO_TOKEN;
|
||||||
if (token == null) {
|
|
||||||
token = fallbackToken
|
|
||||||
}
|
|
||||||
let status = statusTools.getStatus();
|
let status = statusTools.getStatus();
|
||||||
checkSnap(id).then(() => {
|
checkSnap(id).then(() => {
|
||||||
status.status = "download";
|
status.status = "download";
|
||||||
@ -111,9 +102,6 @@ function downloadSnapshot(id) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
checkSnap(id).then(() => {
|
checkSnap(id).then(() => {
|
||||||
let token = process.env.HASSIO_TOKEN;
|
let token = process.env.HASSIO_TOKEN;
|
||||||
if (token == null) {
|
|
||||||
token = fallbackToken
|
|
||||||
}
|
|
||||||
|
|
||||||
let option = {
|
let option = {
|
||||||
headers: { 'X-HASSIO-KEY': token },
|
headers: { 'X-HASSIO-KEY': token },
|
||||||
@ -137,9 +125,6 @@ function downloadSnapshot(id) {
|
|||||||
function checkSnap(id) {
|
function checkSnap(id) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let token = process.env.HASSIO_TOKEN;
|
let token = process.env.HASSIO_TOKEN;
|
||||||
if (token == null) {
|
|
||||||
token = fallbackToken
|
|
||||||
}
|
|
||||||
let option = {
|
let option = {
|
||||||
headers: { 'X-HASSIO-KEY': token },
|
headers: { 'X-HASSIO-KEY': token },
|
||||||
responseType: 'json'
|
responseType: 'json'
|
||||||
@ -166,9 +151,6 @@ function downloadSnapshot(id) {
|
|||||||
statusTools.setStatus(status);
|
statusTools.setStatus(status);
|
||||||
logger.info("Creating new snapshot...")
|
logger.info("Creating new snapshot...")
|
||||||
let token = process.env.HASSIO_TOKEN;
|
let token = process.env.HASSIO_TOKEN;
|
||||||
if (token == null) {
|
|
||||||
token = fallbackToken
|
|
||||||
}
|
|
||||||
let option = {
|
let option = {
|
||||||
headers: { 'X-HASSIO-KEY': token },
|
headers: { 'X-HASSIO-KEY': token },
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
@ -197,7 +179,7 @@ function downloadSnapshot(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clean() {
|
function clean() {
|
||||||
let limit = settingsTools.getSettings().auto_clean_backup_keep;
|
let limit = settingsTools.getSettings().auto_clean_local_keep;
|
||||||
if (limit == null)
|
if (limit == null)
|
||||||
limit = 5;
|
limit = 5;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user