From 7636afaf0585d72e5ab57c9ea9e6a3d96659e103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Tue, 3 Dec 2019 18:33:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/js/app.js | 3 ++- src/tools/init.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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