修复新增域名报错

old
宇天 2019-12-03 18:33:31 +08:00
parent 6423ce7fd8
commit 7636afaf05
3 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "dns-host",
"version": "1.0.0",
"version": "1.0.1",
"description": "伪域名解析",
"main": "src/main.js",
"scripts": {

View File

@ -37,7 +37,6 @@ Anot({
watch: {},
methods: {
addRecord() {
log('---')
if (this.curr) {
this.records.unshift({
record: '',
@ -61,9 +60,11 @@ Anot({
})
.then(val => {
this.domains.push(val)
dict[val] = []
if (!this.curr) {
this.toggleDomain(val)
}
this.save()
})
.catch(Anot.noop)
},

View File

@ -43,7 +43,6 @@ ipcMain.on('dns-host', (ev, conn) => {
case 'set':
clearTimeout(timer)
timer = setTimeout(() => {
fs.echo(JSON.stringify(conn.data), HOST_FILE)
var txt = ''
for (let k in conn.data) {
for (let it of conn.data[k]) {
@ -57,6 +56,7 @@ ipcMain.on('dns-host', (ev, conn) => {
}
txt += '\n\n'
}
fs.echo(JSON.stringify(conn.data), HOST_FILE)
fs.echo(txt, '/etc/hosts')
}, 1000)
break