From ffc35d8573b4fda6d96a2a301227ededc833abe1 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:06:50 +0800 Subject: [PATCH 1/9] =?UTF-8?q?:bug:=20=E5=86=85=E6=A0=B8=E5=8F=82?= =?UTF-8?q?=E6=95=B0=20`--resident`=20=E5=92=8C=20`--readonly`=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=A7=A3=E6=9E=90=E9=97=AE=E9=A2=98=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/6345?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 4 ++-- kernel/util/working.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index a3fc75b09..e095d36c1 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -538,18 +538,18 @@ const initKernel = (initData) => { return } - let cmd = `ui version [${appVer}], booting kernel [${kernelPath} --wd=${appDir}]` const cmds = ['--wd', appDir] cmds.push('--resident', 'false') if (isDevEnv) { cmds.push('--mode', 'dev') + cmds.push('--port', '6806') } if (initData) { const initDatas = initData.split('-') cmds.push('--workspace', initDatas[0]) cmds.push('--lang', initDatas[1]) - cmd = `ui version [${appVer}], booting kernel [${kernelPath} --wd=${appDir} --workspace=${initDatas[0]} --lang=${initDatas[1]}]` } + let cmd = `ui version [${appVer}], booting kernel [${kernelPath} ${cmds.join(' ')}]` writeLog(cmd) const cp = require('child_process') const kernelProcess = cp.spawn(kernelPath, diff --git a/kernel/util/working.go b/kernel/util/working.go index 9f188a9b8..220eb1674 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -61,8 +61,8 @@ func Boot() { servePath := flag.String("servePath", "", "obsoleted https://github.com/siyuan-note/siyuan/issues/4647") _ = servePath port := flag.String("port", "0", "port of the HTTP server") - resident := flag.Bool("resident", true, "resident memory even if no active session") - readOnly := flag.Bool("readonly", false, "read-only mode") + resident := flag.String("resident", "true", "resident memory even if no active session") + readOnly := flag.String("readonly", "false", "read-only mode") accessAuthCode := flag.String("accessAuthCode", "", "access auth code") ssl := flag.Bool("ssl", false, "for https and wss") lang := flag.String("lang", "", "zh_CN/zh_CHT/en_US/fr_FR/es_ES") @@ -76,12 +76,12 @@ func Boot() { Lang = *lang } Mode = *mode - Resident = *resident + Resident, _ = strconv.ParseBool(*resident) ServerPort = *port if isRunningInDockerContainer() || "dev" == Mode { ServerPort = "6806" } - ReadOnly = *readOnly + ReadOnly, _ = strconv.ParseBool(*readOnly) AccessAuthCode = *accessAuthCode Container = ContainerStd if isRunningInDockerContainer() { From 2832c40687afb2bfa9f751f021fdc84d1e6fc4e0 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:15:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 101 +++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index e095d36c1..442af3d80 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -551,55 +551,59 @@ const initKernel = (initData) => { } let cmd = `ui version [${appVer}], booting kernel [${kernelPath} ${cmds.join(' ')}]` writeLog(cmd) - const cp = require('child_process') - const kernelProcess = cp.spawn(kernelPath, - cmds, { - detached: false, // 桌面端内核进程不再以游离模式拉起 https://github.com/siyuan-note/siyuan/issues/6336 - stdio: 'ignore', - }, - ) - writeLog('booted kernel process [pid=' + kernelProcess.pid + ']') + let kernelProcessPid = "" + if (!isDevEnv) { + const cp = require('child_process') + const kernelProcess = cp.spawn(kernelPath, + cmds, { + detached: false, // 桌面端内核进程不再以游离模式拉起 https://github.com/siyuan-note/siyuan/issues/6336 + stdio: 'ignore', + }, + ) + kernelProcessPid = kernelProcess.pid + writeLog('booted kernel process [pid=' + kernelProcessPid + ']') - kernelProcess.on('close', (code) => { - if (0 !== code) { - writeLog(`kernel exited with code [${code}]`) - switch (code) { - case 20: - showErrorWindow('⚠️ 数据库被锁定 The database is locked', - `
数据库文件正在被其他程序锁定。如果你使用了第三方同步盘,请在思源运行期间关闭同步。
The database file is being locked by another program. If you use a third-party sync disk, please turn off sync while SiYuan is running.
`) - break - case 21: - showErrorWindow('⚠️ ' + kernelPort + ' 端口不可用 The port ' + kernelPort + ' is unavailable', - '
思源需要监听 ' + kernelPort + ' 端口,请确保该端口可用且不是其他程序的保留端口。可尝试使用管理员运行命令:' + - '
net stop winnat\nnetsh interface ipv4 add excludedportrange protocol=tcp startport=' + kernelPort + ' numberofports=1\nnet start winnat
' + - '
SiYuan needs to listen to port ' + kernelPort + ', please make sure this port is available, and not a reserved port by other software. Try running the command as an administrator: ' + - '
net stop winnat\nnetsh interface ipv4 add excludedportrange protocol=tcp startport=' + kernelPort + ' numberofports=1\nnet start winnat
') - break - case 22: - showErrorWindow( - '⚠️ 创建配置目录失败 Failed to create config directory', - `
思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。
SiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.
`) - break - case 23: - showErrorWindow( - '⚠️ 无法读写块树文件 Failed to access blocktree file', - `
块树文件正在被其他程序锁定或者已经损坏,请删除 工作空间/temp/ 文件夹后重启
The block tree file is being locked by another program or is corrupted, please delete the workspace/temp/ folder and restart.
`) - break - case 0: - case 1: // Fatal error - break - default: - showErrorWindow( - '⚠️ 内核因未知原因退出 The kernel exited for unknown reasons', - `
思源内核因未知原因退出 [code=${code}],请尝试重启操作系统后再启动思源。如果该问题依然发生,请检查杀毒软件是否阻止思源内核启动。
+ kernelProcess.on('close', (code) => { + if (0 !== code) { + writeLog(`kernel exited with code [${code}]`) + switch (code) { + case 20: + showErrorWindow('⚠️ 数据库被锁定 The database is locked', + `
数据库文件正在被其他程序锁定。如果你使用了第三方同步盘,请在思源运行期间关闭同步。
The database file is being locked by another program. If you use a third-party sync disk, please turn off sync while SiYuan is running.
`) + break + case 21: + showErrorWindow('⚠️ ' + kernelPort + ' 端口不可用 The port ' + kernelPort + ' is unavailable', + '
思源需要监听 ' + kernelPort + ' 端口,请确保该端口可用且不是其他程序的保留端口。可尝试使用管理员运行命令:' + + '
net stop winnat\nnetsh interface ipv4 add excludedportrange protocol=tcp startport=' + kernelPort + ' numberofports=1\nnet start winnat
' + + '
SiYuan needs to listen to port ' + kernelPort + ', please make sure this port is available, and not a reserved port by other software. Try running the command as an administrator: ' + + '
net stop winnat\nnetsh interface ipv4 add excludedportrange protocol=tcp startport=' + kernelPort + ' numberofports=1\nnet start winnat
') + break + case 22: + showErrorWindow( + '⚠️ 创建配置目录失败 Failed to create config directory', + `
思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。
SiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.
`) + break + case 23: + showErrorWindow( + '⚠️ 无法读写块树文件 Failed to access blocktree file', + `
块树文件正在被其他程序锁定或者已经损坏,请删除 工作空间/temp/ 文件夹后重启
The block tree file is being locked by another program or is corrupted, please delete the workspace/temp/ folder and restart.
`) + break + case 0: + case 1: // Fatal error + break + default: + showErrorWindow( + '⚠️ 内核因未知原因退出 The kernel exited for unknown reasons', + `
思源内核因未知原因退出 [code=${code}],请尝试重启操作系统后再启动思源。如果该问题依然发生,请检查杀毒软件是否阻止思源内核启动。
SiYuan Kernel exited for unknown reasons [code=${code}], please try to reboot your operating system and then start SiYuan again. If occurs this problem still, please check your anti-virus software whether kill the SiYuan Kernel.
`) - break - } + break + } - bootWindow.destroy() - resolve(false) - } - }) + bootWindow.destroy() + resolve(false) + } + }) + } const sleep = (ms) => { return new Promise(resolve => setTimeout(resolve, ms)) @@ -616,7 +620,7 @@ const initKernel = (initData) => { while (!gotPort) { try { const portJSON = JSON.parse(fs.readFileSync(portJSONPath, 'utf8')) - const ret = portJSON[kernelProcess.pid.toString()] + const ret = portJSON[kernelProcessPid] if (ret) { gotPort = true return ret @@ -627,7 +631,7 @@ const initKernel = (initData) => { } finally { count++ if (64 < count) { - writeLog('get kernel port failed [pid=' + kernelProcess.pid + ']') + writeLog('get kernel port failed [pid=' + kernelProcessPid + ']') bootWindow.destroy() resolve(false) } @@ -812,6 +816,7 @@ app.on('before-quit', (event) => { }) const {powerMonitor} = require('electron') +const cp = require("child_process"); powerMonitor.on('suspend', () => { writeLog('system suspend') From 668a845be0b7e67c738e4f5715b0762d51215e9b Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:19:42 +0800 Subject: [PATCH 3/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index 442af3d80..7777ff20c 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -630,7 +630,7 @@ const initKernel = (initData) => { await sleep(100) } finally { count++ - if (64 < count) { + if (32 < count) { writeLog('get kernel port failed [pid=' + kernelProcessPid + ']') bootWindow.destroy() resolve(false) @@ -656,10 +656,10 @@ const initKernel = (initData) => { bootWindow.show() } catch (e) { writeLog('get kernel version failed: ' + e.message) - await sleep(200) + await sleep(100) } finally { count++ - if (64 < count) { + if (14 < count) { writeLog('get kernel ver failed') bootWindow.destroy() resolve(false) From c61ba7b2d73be79169b272c1c988c118c111722b Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:19:56 +0800 Subject: [PATCH 4/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/electron/main.js b/app/electron/main.js index 7777ff20c..71413c534 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -630,7 +630,7 @@ const initKernel = (initData) => { await sleep(100) } finally { count++ - if (32 < count) { + if (64 < count) { writeLog('get kernel port failed [pid=' + kernelProcessPid + ']') bootWindow.destroy() resolve(false) From 2766ea6b9770c64ea7be5828103dd51b7623b80a Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:45:17 +0800 Subject: [PATCH 5/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/system.go | 2 +- kernel/conf/system.go | 3 ++- kernel/model/conf.go | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/api/system.go b/kernel/api/system.go index d3035d6ca..a3cb09908 100644 --- a/kernel/api/system.go +++ b/kernel/api/system.go @@ -295,7 +295,7 @@ func setFixedPort(c *gin.Context) { } fixedPort := arg["fixedPort"].(bool) - model.Conf.FixedPort = fixedPort + model.Conf.System.FixedPort = fixedPort model.Conf.Save() util.PushMsg(model.Conf.Language(42), 1000*15) diff --git a/kernel/conf/system.go b/kernel/conf/system.go index 1a6dc85e9..08808ba0e 100644 --- a/kernel/conf/system.go +++ b/kernel/conf/system.go @@ -34,7 +34,8 @@ type System struct { ConfDir string `json:"confDir"` DataDir string `json:"dataDir"` - NetworkServe bool `json:"networkServe"` + NetworkServe bool `json:"networkServe"` // 是否开启网络伺服 + FixedPort bool `json:"fixedPort"` // 是否使用固定端口 6806 NetworkProxy *NetworkProxy `json:"networkProxy"` UploadErrLog bool `json:"uploadErrLog"` diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 49109d524..bcf7f8580 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -60,7 +60,6 @@ type AppConf struct { User *conf.User `json:"-"` // 社区用户内存结构,不持久化 Account *conf.Account `json:"account"` // 帐号配置 ReadOnly bool `json:"readonly"` // 是否是以只读模式运行 - FixedPort bool `json:"fixedPort"` // 是否使用固定端口 6806 LocalIPs []string `json:"localIPs"` // 本地 IP 列表 AccessAuthCode string `json:"accessAuthCode"` // 访问授权码 System *conf.System `json:"system"` // 系统配置 @@ -273,7 +272,7 @@ func InitConf() { } if util.ContainerStd != util.Container { - Conf.FixedPort = true + Conf.System.FixedPort = true } Conf.LocalIPs = util.GetLocalIPs() From 1ffdde034c445578f7300d0fb8bb698e5eb99501 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:53:46 +0800 Subject: [PATCH 6/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/conf.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/model/conf.go b/kernel/model/conf.go index bcf7f8580..054406d8b 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -274,6 +274,9 @@ func InitConf() { if util.ContainerStd != util.Container { Conf.System.FixedPort = true } + if Conf.System.FixedPort { + util.ServerPort = "6806" + } Conf.LocalIPs = util.GetLocalIPs() From efb6a2801dca933309bbb43371024c627dc421d8 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 11:55:42 +0800 Subject: [PATCH 7/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/conf.go | 2 +- kernel/util/working.go | 4 +++- kernel/util/working_mobile.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 054406d8b..f652a94ec 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -275,7 +275,7 @@ func InitConf() { Conf.System.FixedPort = true } if Conf.System.FixedPort { - util.ServerPort = "6806" + util.ServerPort = util.FixedPort } Conf.LocalIPs = util.GetLocalIPs() diff --git a/kernel/util/working.go b/kernel/util/working.go index 220eb1674..7fef00fd1 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -79,7 +79,7 @@ func Boot() { Resident, _ = strconv.ParseBool(*resident) ServerPort = *port if isRunningInDockerContainer() || "dev" == Mode { - ServerPort = "6806" + ServerPort = FixedPort } ReadOnly, _ = strconv.ParseBool(*readOnly) AccessAuthCode = *accessAuthCode @@ -291,6 +291,8 @@ const ( ContainerDocker = "docker" // Docker 容器端 ContainerAndroid = "android" // Android 端 ContainerIOS = "ios" // iOS 端 + + FixedPort = "6806" // 固定端口 ) func initPathDir() { diff --git a/kernel/util/working_mobile.go b/kernel/util/working_mobile.go index 82ae0c789..0f98a2dc4 100644 --- a/kernel/util/working_mobile.go +++ b/kernel/util/working_mobile.go @@ -61,7 +61,7 @@ func BootMobile(container, appDir, workspaceDir, nativeLibDir, privateDataDir, l ThemesPath = filepath.Join(AppearancePath, "themes") IconsPath = filepath.Join(AppearancePath, "icons") Resident = true - ServerPort = "6806" + ServerPort = FixedPort Container = container UserAgent = UserAgent + " " + Container httpclient.SetUserAgent(UserAgent) From 13602b8aedd99d61d4764768380a8a14093e7b9c Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 12:03:14 +0800 Subject: [PATCH 8/9] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E8=BF=9B=E7=A8=8B=E4=BD=BF=E7=94=A8=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=AB=AF=E5=8F=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/4952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/util/working.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/util/working.go b/kernel/util/working.go index 7fef00fd1..ee8f97437 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -78,15 +78,15 @@ func Boot() { Mode = *mode Resident, _ = strconv.ParseBool(*resident) ServerPort = *port - if isRunningInDockerContainer() || "dev" == Mode { - ServerPort = FixedPort - } ReadOnly, _ = strconv.ParseBool(*readOnly) AccessAuthCode = *accessAuthCode Container = ContainerStd if isRunningInDockerContainer() { Container = ContainerDocker } + if ContainerStd != Container || "dev" == Mode { + ServerPort = FixedPort + } msStoreFilePath := filepath.Join(WorkingDir, "ms-store") ISMicrosoftStore = gulu.File.IsExist(msStoreFilePath) From fb688ff3643ce6082f5c60138cad6dce41020265 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 25 Oct 2022 12:20:10 +0800 Subject: [PATCH 9/9] =?UTF-8?q?:art:=20=E6=9F=90=E4=BA=9B=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E4=B8=8A=E4=B8=8B=E8=BD=BD=E8=B5=84=E6=BA=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8E=E6=89=93=E5=BC=80=E6=98=AF=20zip=20Fix=20htt?= =?UTF-8?q?ps://github.com/siyuan-note/siyuan/issues/6347?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/util/working.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/util/working.go b/kernel/util/working.go index ee8f97437..f5dba1705 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -335,6 +335,17 @@ func initMime() { mime.AddExtensionType(".js", "application/x-javascript") mime.AddExtensionType(".json", "application/json") mime.AddExtensionType(".html", "text/html") + + // 某些系统上下载资源文件后打开是 zip + // https://github.com/siyuan-note/siyuan/issues/6347 + mime.AddExtensionType(".doc", "application/msword") + mime.AddExtensionType(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document") + mime.AddExtensionType(".xls", "application/vnd.ms-excel") + mime.AddExtensionType(".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + mime.AddExtensionType(".dwg", "image/x-dwg") + mime.AddExtensionType(".dxf", "image/x-dxf") + mime.AddExtensionType(".dwf", "drawing/x-dwf") + mime.AddExtensionType(".pdf", "application/pdf") } func KillByPort(port string) {