diff --git a/package.json b/package.json index 019478e..08eec4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dns-host", - "version": "1.0.0", + "version": "1.0.1", "description": "伪域名解析", "main": "src/main.js", "scripts": { diff --git a/src/js/app.js b/src/js/app.js index 90f9fb6..1a6fb17 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -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) }, diff --git a/src/tools/init.js b/src/tools/init.js index 77531dc..5531533 100644 --- a/src/tools/init.js +++ b/src/tools/init.js @@ -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