Skip to content

Commit

Permalink
Merge pull request #14 from jumpserver/dev
Browse files Browse the repository at this point in the history
优化打包
  • Loading branch information
Halo1236 authored Aug 30, 2023
2 parents b02527b + f1a9194 commit fbabead
Show file tree
Hide file tree
Showing 36 changed files with 171 additions and 189 deletions.
Binary file removed Darwin/applet.icns
Binary file not shown.
Binary file removed Darwin/main.scpt
Binary file not shown.
34 changes: 0 additions & 34 deletions Linux/install.sh

This file was deleted.

23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Jumpserve Clients

JumpServer 客户端,目前仅 支持 RDP SSH的本地拉起。
JumpServer 客户端,支持本地本地客户端拉起。
## 概览

### Win
![windows](static/windows.png)

### Mac
![macos](static/macos.png)

## 安装

Expand All @@ -10,7 +17,7 @@ JumpServer 客户端,目前仅 支持 RDP SSH的本地拉起。

### Win

下载Win安装包,双击JumpServer.msi 文件(需要等待10几秒钟)。
下载Win安装包,双击JumpServer.exe 文件(需要等待10几秒钟)。

## 卸载

Expand All @@ -22,20 +29,10 @@ JumpServer 客户端,目前仅 支持 RDP SSH的本地拉起。

移除JumpServer.app。

## 测试

rdp url link: jms:
//eyJmaWxlbmFtZSI6ICJmZW5ncWlhbmctMTA0XHU4ZDQ0XHU0ZWE3LWp1bXBzZXJ2ZXIiLCAicHJvdG9jb2wiOiAicmRwIiwgInVzZXJuYW1lIjogImZlbmdxaWFuZyIsICJjb25maWciOiAiZnVsbCBhZGRyZXNzOnM6MTI3LjAuMC4xOjMzODlcbnVzZXJuYW1lOnM6ZmVuZ3FpYW5nfFBLV3lvVWdtRXJESlM5dmtnRkllQU9DdFhEVkJrZ3RpRmFsYVxudXNlIG11bHRpbW9uOmk6MFxuc2Vzc2lvbiBicHA6aTozMlxuYXVkaW9tb2RlOmk6MlxuZGlzYWJsZSB3YWxscGFwZXI6aTowXG5kaXNhYmxlIGZ1bGwgd2luZG93IGRyYWc6aTowXG5kaXNhYmxlIG1lbnUgYW5pbXM6aTowXG5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QxMjMxMjMuZml0MmNsb3VkLmNvbSAtUCAzMzA2MCBteXNxbDovLzE3Mi4xNi4xMC4xMTA6MzMwNyJ9

## 打包

- [Win Mac打包方法](https://github.com/jumpserver/apps/blob/master/README_PACK.md)
- [打包方法](https://github.com/jumpserver/apps/blob/master/README_PACK.md)

## 参考

Expand Down
100 changes: 28 additions & 72 deletions README_PACK.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,28 @@
## Pack

### Mac

- 双击打开JumpServer.scpt文件。

- 点击 文件 -->
导出(导出为应用程序)<img src="https://github.com/jumpserver/apps/blob/master/static/img/mac-app.png" alt="app" style="zoom:50%;" />

- 当前目录上会生成一个JumpServer.app 应用程序。(打开JumpServer.app包 前往 Contents --> Resources 去更换applet.icns图标)。

- 打开JumpServer.app包 将JumpServer.py放入包中(下个版本JumpServer.py 将转换为golang语言编写 打包成二进制文件)

- 前往JumpServer.app包 --> Contents 修改Info.plist文件,添加代码如下:

```
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Jms</string>
<key>CFBundleURLSchemes</key>
<array>
<string>jms</string>
</array>
</dict>
</array>
```

- 选择Mac自带的磁盘工具 选择文件 --> 新建映像 --> 空白映像
存储。<img src="https://github.com/jumpserver/apps/blob/master/static/img/%E7%A9%BA%E7%99%BD%E6%98%A0%E5%83%8F.png" alt="空白映像" style="zoom:50%;" />

- 打开映盘文件
将app文件及Applications的快捷方式放入(可修改背景)。<img src="https://github.com/jumpserver/apps/blob/master/static/img/%E6%89%93%E5%8C%85dmg.png" alt="打包dmg" style="zoom:50%;" />

- 推出磁盘映像。

- 最后通过磁盘工具 选择 映像 --> 转换 --> 选取文件后 --> 映像格式选压缩 --> 点击转换。(完成)

### Windows

- 打包JumpServer.py成exe文件(具体查找Python Pyinstaller模块用法)。

```python
'''
pip install pyinstaller tinyaes
'''
pyinstaller -F -w --key=*** --clean CloudRouse.py
```

- 下载并安装Advanced Installer Windows软件安装程序制作工具。

- 打开advanced
installer软件<img src="https://github.com/jumpserver/apps/blob/master/static/img/win1.png" alt="win1" style="zoom:50%;" />

- 选中Product
Details<img src="https://github.com/jumpserver/apps/blob/master/static/img/win2.png" alt="win2" style="zoom:50%;" />

- 选中Files and Folders-->选中Application Folder-->右击,选择Add Folder-->
选中所需要打包的目录<img src="https://github.com/jumpserver/apps/blob/master/static/img/win3.png" alt="win3" style="zoom:50%;" />

- 添加注册表等信息:选中Registry --> 选中HKEY_CLASSES_ROOT --> 右击,选择 New key --> 添加对应的key
value<img src="https://github.com/jumpserver/apps/blob/master/static/img/win4.png" alt="win4" style="zoom:50%;" />

- 双击build<img src="https://github.com/jumpserver/apps/blob/master/static/img/win5.png" alt="win5" style="zoom:50%;" />

- Win目录下的JMS.aip 为Windows打包的配置文件(可直接用打包工具打开进行打包)

### Linux

- [打包.run文件](http://qchenmo.com/typecho/build/index.php/2021/12/08/56.html)

# 打包步骤
## 拉起程序打包
```
cd go-client
make
```
![make](static/make.png)

## 用户界面 electron 打包
```
cd interface
```

#### Mac
```
npm run build:mac
```

#### Windows
```
npm run build:mac
```

#### Linux
```
npm run build:mac
```
13 changes: 0 additions & 13 deletions Windows/install.reg

This file was deleted.

5 changes: 0 additions & 5 deletions Windows/uninstall.reg

This file was deleted.

3 changes: 2 additions & 1 deletion go-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ build-client:
GOARCH=arm64 GOOS=linux $(CLIENTBUILD) -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/linux-arm64/client $(SSHCSRCFILE)

cp -R $(BUILDDIR)/* $(BASEPATH)/../interface/bin/
cp $(BASEPATH)/config.json $(BASEPATH)/../interface/bin/
cp $(BASEPATH)/config.json $(BASEPATH)/../interface/bin/
cp $(BASEPATH)/putty.exe $(BASEPATH)/../interface/bin/windows/
36 changes: 35 additions & 1 deletion go-client/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"ssh",
"telnet"
],
"comment": "PuTTY是一个Telnet、SSH、rlogin纯TCP以及串行阜连线软件",
"comment": "PuTTY是一个Telnet、SSH、rlogin、纯TCP以及串行接口连接软件",
"download_url": "内置",
"type": "linux",
"path": "putty.exe",
Expand Down Expand Up @@ -52,6 +52,23 @@
"is_internal": false,
"is_default": false,
"is_set": false
},
{
"name": "mobaxterm",
"display_name": "MobaXterm",
"protocol": [
"ssh",
"telnet"
],
"comment": "MobaXterm是一款功能丰富的远程计算机管理工具,其包括了SSH客户端、FTP客户端、远程桌面等。",
"download_url": "https://mobaxterm.mobatek.net/download-home-edition.html",
"type": "linux",
"path": "",
"arg_format": "-newtab * sshpass -p{value} ssh -o StrictHostKeyChecking=no {username}@{host} -p{port}",
"match_first": [],
"is_internal": false,
"is_default": false,
"is_set": false
}
],
"remotedesktop": [
Expand Down Expand Up @@ -177,6 +194,23 @@
"is_internal": true,
"is_default": true,
"is_set": true
},
{
"name": "securecrt",
"display_name": "SecureCRT",
"protocol": [
"ssh",
"telnet"
],
"comment": "SecureCRT是VanDyke Software所开发销售的一个SSH、Telnet客户端和虚拟终端软件。\n\n!!!手动下载安装,点击保存启用!!!",
"download_url": "https://www.vandyke.com/cgi-bin/releases.php?product=securecrt",
"type": "linux",
"path": "/Applications/SecureCRT.app/Contents/MacOS/SecureCRT",
"arg_format": "/N {name} /T /SSH2 /ACCEPTHOSTKEYS /p {port} /password {value} /L {username} {host}",
"match_first": [],
"is_internal": false,
"is_default": false,
"is_set": false
}
],
"remotedesktop": [
Expand Down
3 changes: 2 additions & 1 deletion go-client/pkg/awaken/awaken.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"regexp"
"strings"
)

/*{
Expand Down Expand Up @@ -76,7 +77,7 @@ func (r *Rouse) getUserName() string {

func (r *Rouse) getName() string {
name, _ := url.QueryUnescape(r.Name)
return name
return strings.Replace(name, " ", "", -1)
}

func removeCurRdpFile() {
Expand Down
2 changes: 1 addition & 1 deletion go-client/pkg/awaken/awaken_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func awakenDBCommand(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
case "oracle":
argFormat = "sqlplus {username}/{value}@{host}:{port}/{dbname}"
case "postgresql":
argFormat = "psql user={username} password={value} host={host} dbname={dbname} port={port}"
argFormat = "psql 'user={username} password={value} host={host} dbname={dbname} port={port}'"
case "mysql", "mariadb":
argFormat = "mysql -u {username} -p{value} -h {host} -P {port} {dbname}"
}
Expand Down
2 changes: 1 addition & 1 deletion go-client/pkg/awaken/awaken_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func awakenDBCommand(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
case "oracle":
argFormat = "sqlplus {username}/{value}@{host}:{port}/{dbname}"
case "postgresql":
argFormat = "psql user={username} password={value} host={host} dbname={dbname} port={port}"
argFormat = "psql 'user={username} password={value} host={host} dbname={dbname} port={port}'"
case "mysql", "mariadb":
argFormat = "mysql -u {username} -p{value} -h {host} -P {port} {dbname}"
}
Expand Down
12 changes: 9 additions & 3 deletions go-client/pkg/awaken/awaken_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,21 @@ func handleSSH(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
}

connectMap := map[string]string{
"name": r.Name,
"name": r.getName(),
"protocol": r.Protocol,
"username": r.getUserName(),
"value": r.Value,
"host": r.Host,
"port": strconv.Itoa(r.Port),
}
commands := getCommandFromArgs(connectMap, appItem.ArgFormat)
return exec.Command(appPath, strings.Split(commands, " ")...)
if strings.Contains(commands, "*") {
commands := strings.Split(commands, "*")
return exec.Command(appPath, commands...)
} else {
commands := strings.Split(commands, " ")
return exec.Command(appPath, commands...)
}
}

func handleDB(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
Expand All @@ -87,7 +93,7 @@ func handleDB(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
appPath := appItem.Path

connectMap := map[string]string{
"name": r.Name,
"name": r.getName(),
"protocol": r.Protocol,
"username": r.getUserName(),
"value": r.Value,
Expand Down
Binary file added go-client/putty.exe
Binary file not shown.
36 changes: 36 additions & 0 deletions interface/build/sign/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { notarize } = require("@electron/notarize")

const {
XCODE_APP_LOADER_EMAIL, // 你的apple Id
XCODE_APP_LOADER_PASSWORD, // 准备工作中生成的app专用密码,注意不能用apple Id的密码
XCODE_APP_TEAM_ID, // Team ID
} = process.env

async function main(context) {
const { electronPlatformName, appOutDir } = context

if (
electronPlatformName !== "darwin" ||
!XCODE_APP_LOADER_EMAIL ||
!XCODE_APP_LOADER_PASSWORD ||
!XCODE_APP_TEAM_ID
) {
console.log("Skipping Apple notarization.")
return;
}

console.log("Starting Apple notarization.")
const appName = context.packager.appInfo.productFilename;

await notarize({
appBundleId: "com.jumpserver.client", // 将com.example.app替换为你自己项目的id
appPath: `${appOutDir}/${appName}.app`,
teamId: XCODE_APP_TEAM_ID,
appleId: XCODE_APP_LOADER_EMAIL,
appleIdPassword: XCODE_APP_LOADER_PASSWORD,
})

console.log("Finished Apple notarization.")
}

exports.default = main;
15 changes: 15 additions & 0 deletions interface/build/win/installer.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!macro customHeader
RequestExecutionLevel admin
!macroend

!macro customInstall
WriteRegStr HKCR "jms" "" "URL:jms"
WriteRegStr HKCR "jms" "URL Protocol" ""
WriteRegStr HKCR "jms\shell" "" ""
WriteRegStr HKCR "jms\shell\open" "" ""
WriteRegStr HKCR "jms\shell\open\command" "" '$INSTDIR\resources\bin\windows\JumpServerClient.exe "%1"'
!macroend

!macro customUnInstall
DeleteRegKey HKCR "jms"
!macroend
Loading

0 comments on commit fbabead

Please sign in to comment.