Skip to content

Commit

Permalink
在未提供语言参数时自动根据系统语言确定显示语言
Browse files Browse the repository at this point in the history
  • Loading branch information
kagurazakayashi committed Nov 19, 2023
1 parent ac610f6 commit 33de9c5
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 102 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM alpine:latest
WORKDIR /root
COPY ./MqttClientTestTool_v1.5.1_Linux64 ./mqttclienttesttool
COPY ./MqttClientTestTool_v1.5.3_Linux64 ./mqttclienttesttool
RUN chmod +x ./mqttclienttesttool
ENTRYPOINT ["./mqttclienttesttool"]
6 changes: 0 additions & 6 deletions OneKeyStartCHS.bat

This file was deleted.

21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

This tool can help you test the stability of your device's MQTT connection.

- version: `1.5.1`
- version: `1.5.3`
- golang version: `1.21`

## Function
Expand Down Expand Up @@ -119,9 +119,11 @@ acl:
'#': 3
```
### macOS Config
### Use in macOS
### Add startup parameters in macOS system
Before running this `.app` program directly, make sure that `Terminal.app` is in an exited state.

#### Add startup parameters in macOS system

1. Open the `.dmg` file of the corresponding platform in Release, find the `.app` file inside, and copy it to the `Applications` folder.
2. Right click on the `.app` file and select `Show Package Contents`.
Expand Down Expand Up @@ -160,7 +162,7 @@ Copyright (c) 2022 [神楽坂雅詩](https://github.com/KagurazakaYashi)@[Tongdy

这个工具可以帮助您测试设备的 MQTT 连接的稳定性。

- 版本: `1.5.1`
- 版本: `1.5.3`
- golang 版本: `1.21.5`

## 功能
Expand Down Expand Up @@ -273,7 +275,13 @@ acl:
'#': 3
```

### macOS 系统中添加启动参数
### 在 macOS 中使用

在直接运行该 `.app` 程序之前,请确保 `终端.app` 处于退出状态。

#### 添加启动参数

在直接运行该 `.app` 程序之前,请确保 `终端.app` 处于退出状态。

1. 打开 Release 中的相应平台的 `.dmg` 文件,找到里面的 `.app` 文件,将其复制到 `应用程序` 文件夹.
2. 右键点击改 `.app` 文件,选择 `显示包内容` 。
Expand All @@ -283,8 +291,7 @@ acl:

### Windows 系统中使用中文交互模式

- 可以将 `InteractiveModeCHS.bat` 和 exe 放在一起,双击启动中文交互模式,无需关心命令行参数书写。
- 可以将 `OneKeyStartCHS.bat` 和 exe 放在一起,双击直接一键启动中文版。
可以将 `InteractiveModeCHS.bat` 和 exe 放在一起,双击启动中文交互模式,无需关心命令行参数书写。

## 编译

Expand Down
154 changes: 77 additions & 77 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
SET NAME=MqttClientTestTool
SET NAMEV=%NAME%_v1.5.1_
MD bin
DEL /Q bin\*
COPY InteractiveMode*.bat bin\
COPY OneKeyStart*.bat bin\
COPY README.md bin\
SET CGO_ENABLED=0
SET GOARCH=amd64
go generate
SET GOOS=windows
go build -o bin\%NAMEV%Windows64.exe .
DEL /Q *.syso
SET GOOS=linux
go build -o bin\%NAMEV%Linux64 .
COPY "macOS\mqttclienttesttool\AppIcon.xcassets\AppIcon.appiconset\MQTT client test tool.png" bin\icon.png
COPY mqttclienttesttool.desktop bin\
SET GOOS=darwin
MD bin\%NAMEV%macOSI64.app
MD bin\%NAMEV%macOSI64.app\Contents
MD bin\%NAMEV%macOSI64.app\Contents\MacOS
MD bin\%NAMEV%macOSI64.app\Contents\Resources
COPY Info.plist bin\%NAMEV%macOSI64.app\Contents\
COPY icon.icns bin\%NAMEV%macOSI64.app\Contents\Resources\
go build -o bin\%NAMEV%macOSI64.app\Contents\MacOS\%NAME%_macOS64 .
SET GOARCH=arm64
MD bin\%NAMEV%macOSM64.app
MD bin\%NAMEV%macOSM64.app\Contents
MD bin\%NAMEV%macOSM64.app\Contents\MacOS
MD bin\%NAMEV%macOSM64.app\Contents\Resources
COPY Info.plist bin\%NAMEV%macOSM64.app\Contents\
COPY icon.icns bin\%NAMEV%macOSM64.app\Contents\Resources\
go build -o bin\%NAMEV%macOSM64.app\Contents\MacOS\%NAME%_macOS64 .
SET GOOS=windows
go build -o bin\%NAMEV%WindowsARM64.exe .
DEL /Q *.syso
SET GOARCH=386
go generate
SET GOOS=windows
go build -o bin\%NAMEV%Windows32.exe .
DEL /Q *.syso
SET GOOS=linux
go build -o bin\%NAMEV%Linux32 .
@REM xz -z -e -9 -T 0 -v bin/*
cd bin
dir /b *Windows32*.exe InteractiveMode*.bat OneKeyStart*.bat README.md >l.txt
MAKECAB /F l.txt /D compressiontype=lzx /D compressionmemory=21 /D maxdisksize=1024000000
MOVE disk1\1.cab %NAMEV%Windows32.cab
dir /b *Windows64*.exe InteractiveMode*.bat OneKeyStart*.bat README.md >l.txt
MAKECAB /F l.txt /D compressiontype=lzx /D compressionmemory=21 /D maxdisksize=1024000000
MOVE disk1\1.cab %NAMEV%Windows64.cab
dir /b *WindowsARM64*.exe InteractiveMode*.bat OneKeyStart*.bat README.md >l.txt
MAKECAB /F l.txt /D compressiontype=lzx /D compressionmemory=21 /D maxdisksize=1024000000
MOVE disk1\1.cab %NAMEV%WindowsARM64.cab
RD disk1
7z a -mx9 -tzip %NAMEV%Linux32.zip %NAMEV%Linux32* README.md icon.png mqttclienttesttool.desktop
7z a -mx9 -tzip %NAMEV%Linux64.zip %NAMEV%Linux64* README.md icon.png mqttclienttesttool.desktop
7z a -mx9 -tzip %NAMEV%macOSI64.zip %NAMEV%macOSI64.app README.md
7z a -mx9 -tzip %NAMEV%macOSM64.zip %NAMEV%macOSM64.app README.md
RD /S /Q %NAMEV%macOSI64.app
RD /S /Q %NAMEV%macOSM64.app
DEL /Q *32
DEL /Q *64
DEL /Q *.exe
DEL /Q *.bat
DEL /Q *.md
DEL /Q *.icns
DEL /Q *.txt
DEL /Q *.png
DEL /Q *.desktop
DEL /Q setup.*
cd ..
SET NAME=
SET NAMEV=
SET CGO_ENABLED=
SET GOARCH=
SET GOOS=
SET NAME=MqttClientTestTool
SET NAMEV=%NAME%_v1.5.3_
MD bin
DEL /Q bin\*
COPY InteractiveMode*.bat bin\
COPY OneKeyStart*.bat bin\
COPY README.md bin\
SET CGO_ENABLED=0
SET GOARCH=amd64
go generate
SET GOOS=windows
go build -o bin\%NAMEV%Windows64.exe .
DEL /Q *.syso
SET GOOS=linux
go build -o bin\%NAMEV%Linux64 .
COPY "macOS\mqttclienttesttool\AppIcon.xcassets\AppIcon.appiconset\MQTT client test tool.png" bin\icon.png
COPY mqttclienttesttool.desktop bin\
SET GOOS=darwin
MD bin\%NAMEV%macOSI64.app
MD bin\%NAMEV%macOSI64.app\Contents
MD bin\%NAMEV%macOSI64.app\Contents\MacOS
MD bin\%NAMEV%macOSI64.app\Contents\Resources
COPY Info.plist bin\%NAMEV%macOSI64.app\Contents\
COPY icon.icns bin\%NAMEV%macOSI64.app\Contents\Resources\
go build -o bin\%NAMEV%macOSI64.app\Contents\MacOS\%NAME%_macOS64 .
SET GOARCH=arm64
MD bin\%NAMEV%macOSM64.app
MD bin\%NAMEV%macOSM64.app\Contents
MD bin\%NAMEV%macOSM64.app\Contents\MacOS
MD bin\%NAMEV%macOSM64.app\Contents\Resources
COPY Info.plist bin\%NAMEV%macOSM64.app\Contents\
COPY icon.icns bin\%NAMEV%macOSM64.app\Contents\Resources\
go build -o bin\%NAMEV%macOSM64.app\Contents\MacOS\%NAME%_macOS64 .
SET GOOS=windows
go build -o bin\%NAMEV%WindowsARM64.exe .
DEL /Q *.syso
SET GOARCH=386
go generate
SET GOOS=windows
go build -o bin\%NAMEV%Windows32.exe .
DEL /Q *.syso
SET GOOS=linux
go build -o bin\%NAMEV%Linux32 .
@REM xz -z -e -9 -T 0 -v bin/*
cd bin
dir /b *Windows32*.exe InteractiveMode*.bat README.md >l.txt
MAKECAB /F l.txt /D compressiontype=lzx /D compressionmemory=21 /D maxdisksize=1024000000
MOVE disk1\1.cab %NAMEV%Windows32.cab
dir /b *Windows64*.exe InteractiveMode*.bat README.md >l.txt
MAKECAB /F l.txt /D compressiontype=lzx /D compressionmemory=21 /D maxdisksize=1024000000
MOVE disk1\1.cab %NAMEV%Windows64.cab
dir /b *WindowsARM64*.exe InteractiveMode*.bat README.md >l.txt
MAKECAB /F l.txt /D compressiontype=lzx /D compressionmemory=21 /D maxdisksize=1024000000
MOVE disk1\1.cab %NAMEV%WindowsARM64.cab
RD disk1
7z a -mx9 -tzip %NAMEV%Linux32.zip %NAMEV%Linux32* README.md icon.png mqttclienttesttool.desktop
7z a -mx9 -tzip %NAMEV%Linux64.zip %NAMEV%Linux64* README.md icon.png mqttclienttesttool.desktop
7z a -mx9 -tzip %NAMEV%macOSI64.zip %NAMEV%macOSI64.app README.md
7z a -mx9 -tzip %NAMEV%macOSM64.zip %NAMEV%macOSM64.app README.md
RD /S /Q %NAMEV%macOSI64.app
RD /S /Q %NAMEV%macOSM64.app
DEL /Q *32
DEL /Q *64
DEL /Q *.exe
DEL /Q *.bat
DEL /Q *.md
DEL /Q *.icns
DEL /Q *.txt
DEL /Q *.png
DEL /Q *.desktop
DEL /Q setup.*
cd ..
SET NAME=
SET NAMEV=
SET CGO_ENABLED=
SET GOARCH=
SET GOOS=
2 changes: 1 addition & 1 deletion docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unzip MqttClientTestTool_v1.5.1_Linux64.zip
unzip MqttClientTestTool_v1.5.3_Linux64.zip
docker stop mqttclienttesttool
docker rm mqttclienttesttool
docker rmi mqttclienttesttool
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
)

require (
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
golang.org/x/sys v0.15.0 // indirect
)
Expand Down
4 changes: 2 additions & 2 deletions macOS/mqttclienttesttool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.3;
PRODUCT_BUNDLE_IDENTIFIER = com.tongdy.mqttclienttesttool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -331,7 +331,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.3;
PRODUCT_BUNDLE_IDENTIFIER = com.tongdy.mqttclienttesttool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"strings"
"syscall"

"github.com/cloudfoundry/jibber_jabber"
mqtt "github.com/mochi-mqtt/server/v2"
"github.com/mochi-mqtt/server/v2/hooks/auth"
"github.com/mochi-mqtt/server/v2/listeners"
Expand Down Expand Up @@ -120,6 +121,15 @@ func main() {
flag.StringVar(&certKey, "ck", "", "Server key file path")
flag.StringVar(&certPassword, "cp", "", "Server key file password")
flag.Parse()
if language == "auto" {
language = "en"
syslang, _ := jibber_jabber.DetectIETF()
if len(syslang) > 0 {
if strings.Contains(syslang, "zh") {
language = "cn"
}
}
}
logPrint("I", lang("TITLE")+" v"+version+" for "+runtime.GOOS+" (KagurazakaYashi@Tongdy, 2023)")
logPrint("I", lang("HELP")+" https://github.com/tongdysoft/mqtt-test-server")
// 初始化设置
Expand Down
2 changes: 1 addition & 1 deletion mqttclienttesttool.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Comment=Mqtt Client Test Tool
Comment[zh_CN]=这个工具可以帮助您测试设备的 MQTT 连接的稳定性。
Comment[zh_TW]=這個工具可以幫助您測試裝置的 MQTT 連線的穩定性。
Icon=icon.png
Exec=MqttClientTestTool_v1.5.1_Linux64
Exec=MqttClientTestTool_v1.5.3_Linux64
Terminal=true
Categories=Application;Network;
Keywords=mqtt;
2 changes: 1 addition & 1 deletion mqtttestclient.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=MQTT Client Test Tool
After=network.target

[Service]
ExecStart=/root/MqttClientTestTool_v1.5.1_Linux64
ExecStart=/root/MqttClientTestTool_v1.5.3_Linux64
WorkingDirectory=/root/
Restart=always
User=root
Expand Down
12 changes: 6 additions & 6 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"FixedFileInfo": {
"FileVersion": {
"Major": 1,
"Minor": 3,
"Patch": 2,
"Minor": 5,
"Patch": 3,
"Build": 0
},
"ProductVersion": {
"Major": 1,
"Minor": 3,
"Patch": 2,
"Minor": 5,
"Patch": 3,
"Build": 0
},
"FileFlagsMask": "3f",
Expand All @@ -22,14 +22,14 @@
"Comments": "This tool can help you test the stability of your device's MQTT connection.",
"CompanyName": "Tongdy",
"FileDescription": "This tool can help you test the stability of your device's MQTT connection.",
"FileVersion": "1.5.1.0",
"FileVersion": "1.5.3.0",
"InternalName": "mqtt-test-server",
"LegalCopyright": "2022, Kagurazaka Yashi.",
"LegalTrademarks": "Tongdy",
"OriginalFilename": "main.exe",
"PrivateBuild": "",
"ProductName": "MQTT client test tool",
"ProductVersion": "1.5.1.0",
"ProductVersion": "1.5.3.0",
"SpecialBuild": ""
},
"VarFileInfo": {
Expand Down

0 comments on commit 33de9c5

Please sign in to comment.