diff --git a/.gitignore b/.gitignore index fbe0a11..b003858 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ dist/ -working.env \ No newline at end of file +working.env +certs/*.pem \ No newline at end of file diff --git a/certs/mkcert-v1.4.4-windows-amd64.exe b/certs/mkcert-v1.4.4-windows-amd64.exe new file mode 100644 index 0000000..c9cde49 Binary files /dev/null and b/certs/mkcert-v1.4.4-windows-amd64.exe differ diff --git a/certs/trs.cirno.biz.crt b/certs/trs.cirno.biz.crt deleted file mode 100644 index 7fdffc2..0000000 --- a/certs/trs.cirno.biz.crt +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEhDCCA2ygAwIBAgIUNrwBOA2VrLhOgGjmgQAEVzVj9ucwDQYJKoZIhvcNAQEL -BQAwaTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkZha2UgU3RhdGUxFjAUBgNVBAcM -DUZha2UgTG9jYWxpdHkxFTATBgNVBAoMDEZha2UgQ29tcGFueTEWMBQGA1UEAwwN -dHJzLmNpcm5vLmJpejAeFw0yMTA4MjMwNjEyNDlaFw0yMzExMjYwNjEyNDlaMGkx -CzAJBgNVBAYTAlVTMRMwEQYDVQQIDApGYWtlIFN0YXRlMRYwFAYDVQQHDA1GYWtl -IExvY2FsaXR5MRUwEwYDVQQKDAxGYWtlIENvbXBhbnkxFjAUBgNVBAMMDXRycy5j -aXJuby5iaXowggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vWAlyQjm -rpZcJy1M9oTIK+aOdmW3zq5hZr/XTvzgDH0sJCvwKY77SfOeoWjsYPmTfjhQ90vc -h56rLcJRN6E5YJYAjlGrJUYLb6jH2GaHpamgimhDe5d2F/2Qqls/PAy/uT9lZd/r -bN7Msi0labqOn23tU5qSOiTd/VoZLuIjavbptjx+7pbiyuUXm/ZdjVZPjBsEPH4c -lIv/a3K0CjWpVO+EFIChuugCR6DPn//JflxV0xZAEPtV0KxhTv7XmYyASfkxSRsv -UVOt2b638XTjL4oJqea7swy36TWOgnUajmQK5spmNKfAKj3jMrVx8SzQb/DYWfpX -ToE5GQj5wG4tAgMBAAGjggEiMIIBHjCBkAYDVR0jBIGIMIGFoW2kazBpMQswCQYD -VQQGEwJVUzETMBEGA1UECAwKRmFrZSBTdGF0ZTEWMBQGA1UEBwwNRmFrZSBMb2Nh -bGl0eTEVMBMGA1UECgwMRmFrZSBDb21wYW55MRYwFAYDVQQDDA10cnMuY2lybm8u -Yml6ghQlamrokAvLz4VYSiPKiCZoa4MogjAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE -8DAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEF -BQcDBDA+BgNVHREENzA1gglsb2NhbGhvc3SCCTEyNy4wLjAuMYIDOjoxgglsb2Nh -bC5kZXaCDXRycy5jaXJuby5iaXowDQYJKoZIhvcNAQELBQADggEBAHA6W/4tSwEi -LtmdSu4lSZBNNckR/lJMGTHsgYcgSxEUAjTvR0Tdcqh8bp4ILoDDGzJXLAiRCUEa -0CaxJi0QpJVv81pIoqfF1TKBtNcuG/GFw8rKtUjLWwNBhLKFRxL/R9l9UbYl4ST2 -wtRXDQNe1mPq9onRtn1gNZ+fnF+NoJyK6dvdah6WI9I/mmi/p2sAYn6eYDD/UESs -zZ5U+J8aJWNOnHzM7ibIOp9xMJje9Ox5MIXQbodPjN5iH4iShTEHphnkvpYffmXk -ZgTnCg1JPeGbWNwRfBx7RT+BgihYaKoIc1M2j50Y6a5+A2NJF3J3DMsE+NqYU+QV -Vi2ShD2o9ZM= ------END CERTIFICATE----- diff --git a/certs/trs.cirno.biz.key b/certs/trs.cirno.biz.key deleted file mode 100644 index 1b6e4a7..0000000 --- a/certs/trs.cirno.biz.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAt71gJckI5q6WXCctTPaEyCvmjnZlt86uYWa/10784Ax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eLQAYjOY7Lz7cWMpSf/tl3 -NhF1GtybuRAvvIh+0qfMfAOmpzENmB2xV9paGPB7casO005atr7u25iHUY7qvRaq -b4KH6LQTZ8SaAy70HSwLSpcCgYEApGkhbVNiVrqM7IqaNw6dCyqteqpXZcRnFWDs -6xyV62u47kACmNARGj4tZs2Yul08dO1zEawIeowtH0DYmw97g5chHta7yoQIg+EN -H5U34YgzQOAy98tUnYxh9fxaNdYfWc3AJEjSkYujYkg7NZ9VECYab9q4PCUePqV/ -M68EDLsCgYEAw9rYU97p52b/wwcG0E7/tzFql5V4aJP5Hko+E8eC+W8/dpXRfHlC -yTi4Z+llPrnsZXZ2gQB1zNV31tCF/i9HGCV4H40N80eNT/d96s2WiHm7BGdxpdDZ -ru95++Kpo4mJROgU5k7w/jeEaqsimHOzYYosem5NIgCjCy3LsffYRl0= ------END RSA PRIVATE KEY----- diff --git a/certs/trs.cirno.bizCA.pem b/certs/trs.cirno.bizCA.pem deleted file mode 100644 index 6649244..0000000 --- a/certs/trs.cirno.bizCA.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDWTCCAkECFCVqauiQC8vPhVhKI8qIJmhrgyiCMA0GCSqGSIb3DQEBCwUAMGkx -CzAJBgNVBAYTAlVTMRMwEQYDVQQIDApGYWtlIFN0YXRlMRYwFAYDVQQHDA1GYWtl -IExvY2FsaXR5MRUwEwYDVQQKDAxGYWtlIENvbXBhbnkxFjAUBgNVBAMMDXRycy5j -aXJuby5iaXowHhcNMjEwODIzMDYxMjQzWhcNMjMxMTI2MDYxMjQzWjBpMQswCQYD -VQQGEwJVUzETMBEGA1UECAwKRmFrZSBTdGF0ZTEWMBQGA1UEBwwNRmFrZSBMb2Nh -bGl0eTEVMBMGA1UECgwMRmFrZSBDb21wYW55MRYwFAYDVQQDDA10cnMuY2lybm8u -Yml6MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1+Pwn6OKhIZ6tqHa -iXUbx5u8LczZQKhpK00A+diP0/Z6fywwf3dsi3PauFeKEzqqc+cucJwZWLiH0tre -3q4ovmA7eaBIhLqGh6o+4CKxaip+/wkRTnFobMGXqzHl2p6cKxQ2FONMBwQzVrBb -ngJcLvLode4v/BC6JXZ2yXu+4JGe8uoHV5idFTv59M+Z0k6wWIrpiY9H0y7g+p0Y -XRudmIL1AedoivbH6RNMrqTr6S3Qap40fwRt7Uw8Wuh5Uk8S5Akx4k/z+D2wnu5e -nrBHejR0WzhqzGRbhI8jNwc9Ds1EQSsAKyI2jh6r31FyiCHKKZ1IC8U7KrMluCDX -yDmiLQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQCky7W6bE7/GsGMWSldUtsASCLG -RBH9Fcq6dg+LCPmcxHA2moVvQFIiN7km3aY2MBbQO5OFtgSXp2y7NI2bjJEEGCzY -s4UT+Nr13d67Hykn30RCKnkC0qbkVovU/lJFN5he2ZSS75bFJd8X+6dv9YTqae7m -buoOSLF4ktcobEP005IMnx1/uJfq/KwrhaILcrwH1pHI4m0+3VLnZuDAC/60ACjN -0BCDIluVKvbwhPpWP8KzqjWx0WSylqhfcg8z2g87LAP/jxc/WbMefOKKuFluDhXv -6B6hp/lECi9d6al8dBZqhA6eePM5OV+SayerdugPIGuFamaVrwsu5AFnP16/ ------END CERTIFICATE----- diff --git a/readme.md b/readme.md index 56b80d7..8a4a69e 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,7 @@ ```bash npm install # 安装依赖 ``` + 请到此处 [Release](https://github.com/symant233/MTool_Cracker/releases/tag/v1.0.0) 下载老版本的 Mtool 存档 `MTool_A10U13.7z` 或 `MTool_A10_Fix5.7z`。 ### 配置 @@ -29,9 +30,16 @@ npm install # 安装依赖 127.0.0.1 trs.cirno.biz ``` -- 替换文件 `example.env` 内的 `APPID` 和 `KEY` 为你申请的应用信息, [百度翻译开放平台](https://fanyi-api.baidu.com/manage/developer)能找到. 替换后保存, 重命名此文件为 `working.env`. / 使用**腾讯翻译**则为 `TENCENTID` 和 `TENCENTKEY`(强烈建议用腾讯翻译,开通[机器翻译](https://console.cloud.tencent.com/tmt)后到[API密钥管理](https://console.cloud.tencent.com/cam/capi)查看`SecretId`和`SecretKey`). +- 替换文件 `example.env` 内的 `APPID` 和 `KEY` 为你申请的应用信息, [百度翻译开放平台](https://fanyi-api.baidu.com/manage/developer)能找到. 替换后保存, 重命名此文件为 `working.env`. / 使用**腾讯翻译**则为 `TENCENTID` 和 `TENCENTKEY`(强烈建议用腾讯翻译,开通[机器翻译](https://console.cloud.tencent.com/tmt)后到[API 密钥管理](https://console.cloud.tencent.com/cam/capi)查看`SecretId`和`SecretKey`). + +- 证书:进入 `certs` 文件夹,该文件夹下有一个 `mkcert-v1.4.4-xxx.exe`,如果你运行不了或者怕病毒,可以去 https://github.com/FiloSottile/mkcert/releases 下载一个。在此文件夹打开命令行(Shift+右键,打开 Powershell),然后运行下面的命令: + +```bash +mkcert-v1.4.4-windows-amd64.exe trs.cirno.biz +mkcert-v1.4.4-windows-amd64.exe -install +``` -- 安装 `certs/trs.cirno.biz.crt` 到 `个人` (双击打开->安装证书->存储位置:当前用户->将所有的证书都放入下列存储:个人->完成). 你也可以用[此项目](https://github.com/kingkool68/generate-ssl-certs-for-local-development)自己生成. +> 命令会在文件夹中生成 `trs.cirno.biz.pem` 和 `trs.cirno.biz-key.pem`,代码中已经正确引用该文件名。另外在 `-install` 时会弹窗,点确定即可,这是为了 windows 能信任该证书。 ### 运行服务 @@ -41,8 +49,6 @@ npm start # 先配置好再运行服务 服务启动完成打开工具 `nw.exe`. -首次使用此项目时, 由于使用了自签证书, 请求会失败 (更新那里会显示 Failed to fetch). 在工具里右键空白处点击检查, 在 `Console` 标签页会显示红色的报错, 点链接, 选显示更多继续访问. 之后只要不再换证书就不会再请求失败了. - --- ### 副作用 diff --git a/src/index.js b/src/index.js index 8c58b99..62dbd71 100644 --- a/src/index.js +++ b/src/index.js @@ -12,8 +12,8 @@ const app = new Koa(); const router = new Router(); const options = { - key: fs.readFileSync("certs/trs.cirno.biz.key").toString(), - cert: fs.readFileSync("certs/trs.cirno.biz.crt").toString(), + key: fs.readFileSync("certs/trs.cirno.biz-key.pem").toString(), + cert: fs.readFileSync("certs/trs.cirno.biz.pem").toString(), }; app.use(logger());