Skip to content

Commit

Permalink
Merge pull request #33 from jumpserver/pr@dev@feat_i18n
Browse files Browse the repository at this point in the history
Pr@dev@feat i18n
  • Loading branch information
Halo1236 authored Dec 1, 2023
2 parents 65fba53 + a4fc357 commit bcecb4e
Show file tree
Hide file tree
Showing 23 changed files with 497 additions and 101 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# build.yml

name: Auto Build

on:
workflow_dispatch:
push:
branches:
- master
- release-test



env:
ELECTRON_OUTPUT_PATH: interface/dist_electron
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}


jobs:
release:
name: build and release electron app
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11, windows-latest]

steps:
- name: Check out git repository
uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version: 1.18

- name: build go client
run: make build-client
working-directory: go-client

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Install system deps
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils
- name: Yarn install
run: |
yarn
yarn global add xvfb-maybe
- name: Build & release app
run: |
yarn build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XCODE_APP_TEAM_ID: ${{ secrets.XCODE_APP_TEAM_ID }}
XCODE_APP_LOADER_EMAIL: ${{ secrets.XCODE_APP_LOADER_EMAIL }}
XCODE_APP_LOADER_PASSWORD: ${{ secrets.XCODE_APP_LOADER_PASSWORD }}
BUILD_CERTIFICATE_BASE64: ${{ secrets.CSC_LINK }}
P12_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Jumpserve Clients
# Jumpserve Client

JumpServer 客户端,支持本地本地客户端拉起。
## 概览
Expand Down
58 changes: 58 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Jumpserve Client

JumpServer client, supports local client pull up.

## Overview

![windows](static/windows.png)


## Install

### Mac

Download the Mac installation package, install JumpServer.dmg and put JumpServer.app into Applications. Double-click to open JumpServer.app to complete the custom protocol.


### Win

Download the Win installation package and double-click the JumpServer installation package file (you need to wait for 10 seconds).


### Linux

Download the Linux installation package, double-click the Deb installation package file, and open the installation package manager to install it. Or install it using the command

```
sudo dpkg -i <package_file>
```


## uninstall

### Windows

Just uninstall the control panel directly.


### Mac

Remove JumpServer.app.


### Linux

Click to open Software Manager to uninstall. Or use the command to uninstall

```
sudo dpkg --purge <package_file>
```


## package

- [packaging scheme](https://github.com/jumpserver/apps/blob/master/README_PACK.md)
10 changes: 5 additions & 5 deletions go-client/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"download_url": "内置",
"type": "windows",
"path": "mstsc.exe",
"arg_format": "",
"arg_format": "{file}",
"match_first": [],
"is_internal": true,
"is_default": true,
Expand Down Expand Up @@ -169,7 +169,7 @@
"download_url": "https://github.com/FuckDoctors/rdm-builder/releases/download/2022.5.1/resp-2022.5.1.exe",
"type": "databases",
"path": "",
"arg_format": "--settings-dir {config_file}",
"arg_format": "--settings-dir*{config_file}",
"match_first": [],
"is_internal": false,
"is_default": false,
Expand Down Expand Up @@ -242,7 +242,7 @@
"download_url": "内置",
"type": "windows",
"path": "/Applications/Microsoft Remote Desktop.app",
"arg_format": "",
"arg_format": "{file}",
"match_first": [],
"is_internal": true,
"is_default": true,
Expand Down Expand Up @@ -346,7 +346,7 @@
"download_url": "https://remmina.org/how-to-install-remmina/-内置",
"type": "windows",
"path": "remmina",
"arg_format": "",
"arg_format": "{file}",
"match_first": [],
"is_internal": true,
"is_default": false,
Expand All @@ -362,7 +362,7 @@
"download_url": "https://github.com/FreeRDP/FreeRDP-内置",
"type": "windows",
"path": "xfreerdp",
"arg_format": "",
"arg_format": "{file} /cert-ignore",
"match_first": [],
"is_internal": true,
"is_default": false,
Expand Down
3 changes: 2 additions & 1 deletion go-client/pkg/awaken/awaken_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func awakenRDPCommand(filePath string, cfg *config.AppConfig) *exec.Cmd {
if appItem == nil {
return nil
}
cmd := exec.Command(appItem.Name, filePath)
args := strings.Replace(appItem.ArgFormat, "{file}", filePath, 1)
cmd := exec.Command(appItem.Name, strings.Split(args, " ")...)
return cmd
}

Expand Down
10 changes: 8 additions & 2 deletions go-client/pkg/awaken/awaken_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func handleDB(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
ss := make(map[string]string)
ss["host"] = r.Host
ss["port"] = strconv.Itoa(r.Port)
ss["name"] = r.Name
ss["name"] = r.getName()
ss["auth"] = r.Token.ID + "@" + r.Value
ss["ssh_agent_path"] = ""
ss["ssh_password"] = ""
Expand All @@ -131,7 +131,13 @@ func handleDB(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
connectMap["config_file"] = currentPath
}
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 handleCommand(r *Rouse, cfg *config.AppConfig) *exec.Cmd {
Expand Down
3 changes: 2 additions & 1 deletion interface/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jumpserver-client",
"author": "Fit2Cloud Technology Co., Ltd.; <[email protected]>",
"version": "v2.0.3",
"version": "v2.1.0",
"homepage": "https://jumpserver.org",
"private": true,
"scripts": {
Expand All @@ -22,6 +22,7 @@
"element-plus": "^2.3.0",
"fs-extra": "^11.1.1",
"vue": "^3.2.13",
"vue-i18n": "^9.6.5",
"vue-router": "^4.1.6"
},
"devDependencies": {
Expand Down
9 changes: 7 additions & 2 deletions interface/src/background.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {app, BrowserWindow, ipcMain, protocol} from "electron";
import {app, shell, BrowserWindow, ipcMain, protocol} from "electron";
import {createProtocol} from "vue-cli-plugin-electron-builder/lib";
import installExtension, {VUEJS3_DEVTOOLS} from "electron-devtools-installer";
import path from 'path'
Expand Down Expand Up @@ -37,7 +37,12 @@ async function createWindow() {
},
});

if (process.env.WEBPACK_DEV_SERVER_URL) {
mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url)
return { action: "deny" }
});

if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
await mainWindow.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
// if (!process.env.IS_TEST) mainWindow.webContents.openDevTools()
Expand Down
17 changes: 17 additions & 0 deletions interface/src/i18n/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createI18n } from 'vue-i18n'
import messages from './langs'


const browserLang = navigator.systemLanguage || navigator.language
let lang = browserLang || 'zh'
lang = localStorage.getItem('lang') || lang.slice(0, 2)
const i18n = createI18n({
locale: lang,
legacy: false,
fallbackLocale: 'en',
silentFallbackWarn: true,
silentTranslationWarn: true,
messages
})

export default i18n
43 changes: 43 additions & 0 deletions interface/src/i18n/langs/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"Common": {
"JumpServerClient": "JumpServerClient",
"AppDesc": "Introduction",
"DownloadUrl":"Download Link",
"AppPath": "Application Path",
"Priority": "Priority Matching",
"ProtocolPlaceholder": "Please select the database protocol that matches first",
"ProtocolValidate": "Protocol cannot be empty",
"PathValidate": "Path cannot be empty",
"PathPlaceholder": "Please select the database tool launcher path",
"DefaultApp": "Default Application",
"Configured": "Configured",
"NotConfigured": "Not Configured",
"OracleOCI": "The client needs to use OCI version 21.0 and above to connect to the Oracle."
},
"Dialog": {
"Save&Default": "Save And Default",
"Cancel": "Cancel",
"Save":"Save"
},
"Router": {
"Terminal": "Terminal",
"RemoteDesktop": "Remote Desktop",
"FileTransfer": "File Transfer",
"Database": "Database",
"AboutUs": "About Us",
"Language": "Language"
},
"AboutUs": {
"Author": "Author",
"Version": "Version",
"Copyright": "Copyright",
"AllRightsReserved": "All Rights Reserved",
"OfficialWebsite": "Official Website",
"OnlineDocumentation": "Online Documentation",
"CommunityForum": "Community Forum",
"AboutUs": "About Us"
},
"Language": {
"ChooseLanguage": "Choose Language"
}
}
15 changes: 15 additions & 0 deletions interface/src/i18n/langs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import zhLocale from "element-plus/lib/locale/lang/zh-cn";
import enLocale from "element-plus/lib/locale/lang/en";
import zh from './zh.json'
import en from './en.json'

export default {
zh: {
...zhLocale,
...zh
},
en: {
...enLocale,
...en
}
}
43 changes: 43 additions & 0 deletions interface/src/i18n/langs/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"Common": {
"JumpServerClient": "JumpServer客户端",
"AppDesc": "应用说明",
"DownloadUrl":"下载地址",
"AppPath": "应用路径",
"Priority": "优先匹配",
"ProtocolPlaceholder": "请选择优先匹配的数据库协议",
"ProtocolValidate": "协议不能为空",
"PathValidate": "路径不能为空",
"PathPlaceholder": "请选择数据库工具启动程序路径",
"DefaultApp": "默认应用",
"Configured": "已配置",
"NotConfigured": "未配置",
"OracleOCI": "本地客户端连 Oracle 数据库需要使用 21.0 及以上版本 OCI"
},
"Dialog": {
"Save&Default": "保存且默认",
"Cancel": "关闭",
"Save":"保存"
},
"Router": {
"Terminal": "远程终端",
"RemoteDesktop": "远程桌面",
"FileTransfer": "文件传输",
"Database": "数据库",
"AboutUs": "关于我们",
"Language": "语言设置"
},
"AboutUs": {
"Author": "作者",
"Version": "版本",
"Copyright": "版权公告",
"AllRightsReserved": "版权所有",
"OfficialWebsite": "产品官网",
"OnlineDocumentation": "在线文档",
"CommunityForum": "社区论坛",
"AboutUs": "关于我们"
},
"Language": {
"ChooseLanguage": "选择语言"
}
}
2 changes: 2 additions & 0 deletions interface/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './renderer/assets/fonts/font-awesome.min.css';
import i18n from './i18n/i18n'

const app = createApp(App)

app.use(i18n)
app.use(ElementUI)
app.use(router)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
Expand Down
Loading

0 comments on commit bcecb4e

Please sign in to comment.