Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #80

Merged
merged 2 commits into from
Oct 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions build/src/src/calls/getParams.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
const db = require('../db');

async function getParams() {
const result = {
ip: db.get('ip').value(),
name: db.get('name').value(),
};
const staticIp = db.get('staticIp').value();
const domain = db.get('domain').value();
if (staticIp) {
result.staticIp = staticIp;
} else {
result.domain = domain;
}
return {
result: {
ip: db.get('ip').value(),
name: db.get('name').value(),
staticIp: db.get('staticIp').value(),
domain: db.get('domain').value(),
},
result,
};
}

Expand Down
2 changes: 1 addition & 1 deletion build/src/src/calls/setStaticIp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function setStaticIp({staticIp}) {
} else if (oldStaticIp && !staticIp) {
message = `Disabled static IP`;
// If the staticIp is being disabled but there is no keypair: register to dyndns
if (!db.get('keypair').value()) {
if (!db.get('registeredToDyndns').value()) {
await dyndnsClient.updateIp();
message += `, and registered to dyndns: ${db.get('domain').value()}`;
}
Expand Down
1 change: 1 addition & 0 deletions build/src/src/dyndnsClient/updateIp.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function updateIp() {
})
.then((domain) => {
db.set('domain', domain).write();
db.set('registeredToDyndns', true).write();
})
.catch((err) => {
logs.error(`httpGetRequest error: ${err.stack || err.message}`);
Expand Down