Skip to content

Commit

Permalink
Merge branch 'main' of flomesh-io.github.com:flomesh-io/ztm
Browse files Browse the repository at this point in the history
  • Loading branch information
pajama-coder committed Jul 25, 2024
2 parents 7dd5fdf + 3e4b7cc commit 8a613b7
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 38 deletions.
16 changes: 8 additions & 8 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"ios-build": "vite build --emptyOutDir --outDir ../agent/gui && tauri ios build",
"hub": "../bin/ztm run hub --listen 127.0.0.1:8888 --names 127.0.0.1:8888",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
"build-ztm-macos-x64": "../build.sh && cp -f ../bin/ztm ../gui/src-tauri/bin/cli-x86_64-apple-darwin",
"build-ztm-macos": "../build.sh && cp -f ../bin/ztm ../gui/src-tauri/bin/cli-aarch64-apple-darwin",
"build-ztm-windows": "../build.cmd && copy ../bin/ztm.exe '../gui/src-tauri/bin/cli-x86_64-pc-windows-msvc.exe'",
"build-ztm-linux": "../build.sh && cp -f ../bin/ztm ../gui/src-tauri/bin/cli-x86_64-unknown-linux-gnu",
"build-ztm-macos-x64": "../build.sh && cp -f ../bin/ztm ../gui/src-tauri/bin/ztmctl-x86_64-apple-darwin",
"build-ztm-macos": "../build.sh && cp -f ../bin/ztm ../gui/src-tauri/bin/ztmctl-aarch64-apple-darwin",
"build-ztm-windows": "../build.cmd && copy ../bin/ztm.exe '../gui/src-tauri/bin/ztmctl-x86_64-pc-windows-msvc.exe'",
"build-ztm-linux": "../build.sh && cp -f ../bin/ztm ../gui/src-tauri/bin/ztmctl-x86_64-unknown-linux-gnu",
"build-ztm-android": "BUILD_ZTM_SHARED=1 ../build.sh && cp -f ../usr/local/lib/libztm.so ./src-android/app/src/main/assets/libztm.so && cp -f ../usr/local/lib/libc++_shared.so ./src-android/app/src/main/assets/libc++_shared.so",
"download-ztm-macos-x64": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos.ap-beijing.myqcloud.com/repo/pipy-nightly/x86_64/binary/pipy-nightly-202404011409-macos-x86_64.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/bin/pipy ../src-tauri/bin/cli-x86_64-apple-darwin",
"download-ztm-macos": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos.ap-beijing.myqcloud.com/repo/pipy-nightly/aarch64/binary/pipy-nightly-202404011409-macos-aarch64.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/bin/pipy ../src-tauri/bin/cli-aarch64-apple-darwin",
"download-ztm-windows": "mkdir -p download && cd download && curl -o pipy.zip https://pipy-oss-1255617643.cos.accelerate.myqcloud.com/repo/pipy-repo-nightly/win32/binary/pipy-repo-nightly-202404011409-win32-x86_64.zip && unzip pipy.zip && copy pipy.exe ../src-tauri/bin/cli-x86_64-pc-windows-msvc.exe",
"download-ztm-linux": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos-website.ap-beijing.myqcloud.com/repo/pipy-nightly/x86_64/binary/pipy-nightly-202404011409-generic_linux-x86_64.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/bin/pipy ../src-tauri/bin/cli-x86_64-unknown-linux-gnu",
"download-ztm-macos-x64": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos.ap-beijing.myqcloud.com/repo/pipy-nightly/x86_64/binary/pipy-nightly-202404011409-macos-x86_64.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/bin/pipy ../src-tauri/bin/ztmctl-x86_64-apple-darwin",
"download-ztm-macos": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos.ap-beijing.myqcloud.com/repo/pipy-nightly/aarch64/binary/pipy-nightly-202404011409-macos-aarch64.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/bin/pipy ../src-tauri/bin/ztmctl-aarch64-apple-darwin",
"download-ztm-windows": "mkdir -p download && cd download && curl -o pipy.zip https://pipy-oss-1255617643.cos.accelerate.myqcloud.com/repo/pipy-repo-nightly/win32/binary/pipy-repo-nightly-202404011409-win32-x86_64.zip && unzip pipy.zip && copy pipy.exe ../src-tauri/bin/ztmctl-x86_64-pc-windows-msvc.exe",
"download-ztm-linux": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos-website.ap-beijing.myqcloud.com/repo/pipy-nightly/x86_64/binary/pipy-nightly-202404011409-generic_linux-x86_64.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/bin/pipy ../src-tauri/bin/ztmctl-x86_64-unknown-linux-gnu",
"download-ztm-android": "mkdir -p download && cd download && curl -o pipy.tar.gz https://pipy-oss-1255617643.cos.ap-beijing.myqcloud.com/repo/ztm/arm64-v8a/library/libztm.tar.gz && tar -xzf pipy.tar.gz && cp -f ./usr/local/lib/libztm.so ../src-android/app/src/main/assets/libztm.so && cp -f ./usr/local/lib/libc++_shared.so ../src-android/app/src/main/assets/libc++_shared.so"
},
"dependencies": {
Expand Down
17 changes: 6 additions & 11 deletions gui/src-tauri/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
# macOS aarch64
pipy-aarch64-apple-darwin
ztm-aarch64-apple-darwin
ztmctl-aarch64-apple-darwin

# macOS x86
pipy-x86_64-apple-darwin
cli-x86_64-apple-darwin
ztmctl-x86_64-apple-darwin

# Windows
pipy-x86_64-pc-windows-msvc.exe
cli-x86_64-pc-windows-msvc.exe
ztmctl-x86_64-pc-windows-msvc.exe

# Linux
pipy-x86_64-unknown-linux-gnu
cli-x86_64-unknown-linux-gnu
ztmctl-x86_64-unknown-linux-gnu

# Android
pipy-aarch64-linux-android
cli-aarch64-linux-android
cli-armv7-linux-androideabi
ztmctl-aarch64-linux-android
ztmctl-armv7-linux-androideabi
2 changes: 1 addition & 1 deletion gui/src-tauri/capabilities/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"identifier": "shell:allow-spawn",
"allow": [
{
"name": "bin/cli",
"name": "bin/ztmctl",
"args": [
{
"validator": ".+"
Expand Down
2 changes: 1 addition & 1 deletion gui/src-tauri/capabilities/windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"identifier": "shell:allow-spawn",
"allow": [
{
"name": "bin/cli",
"name": "bin/ztmctl",
"args": [
{
"validator": ".+"
Expand Down
2 changes: 1 addition & 1 deletion gui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"active": true,
"targets": "all",
"resources": [],
"externalBin": ["bin/cli"],
"externalBin": ["bin/ztmctl"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand Down
2 changes: 1 addition & 1 deletion gui/src-tauri/tauri.ios.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"active": true,
"targets": "all",
"resources": [],
"externalBin": ["bin/cli"],
"externalBin": ["bin/ztmctl"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand Down
2 changes: 1 addition & 1 deletion gui/src-tauri/tauri.windows.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"active": true,
"targets": "all",
"resources": [],
"externalBin": ["bin/cli"],
"externalBin": ["bin/ztmctl"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand Down
4 changes: 2 additions & 2 deletions gui/src/service/ShellService.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class ShellService {
store.commit('account/setPlatform', pm);
console.log("takePipyVersion");
if(pm != "android" && false){
let command = await Command.sidecar("bin/cli", ['version','--json','','','','']);
let command = await Command.sidecar("bin/ztmctl", ['version','--json','','','','']);
await command.spawn();
command.stdout.on('data', line => {
console.log(line)
Expand Down Expand Up @@ -88,7 +88,7 @@ export default class ShellService {
];
await this.pausePipy(port);
console.log(`[starting pipy:${args}]`);
const command = Command.sidecar("bin/cli", args);
const command = Command.sidecar("bin/ztmctl", args);
command.on('close', data => {
console.log("[close]");
console.log(data);
Expand Down
18 changes: 9 additions & 9 deletions gui/src/utils/app-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import BrowserComponent from '@/views/apps/core/Browser.vue';
import SettingComponent from '@/views/apps/core/Setting.vue';

const apps = [{
name: "setting",
},{
name: "ZTMGui",
label: "ZTM Gui",
url:'/#/mesh/list',
width:1280,
height:860,
icon: consoleIcon,
},{
name: "setting",
},{
name: "ZTMCli",
label: "ZTM Cli",
url:'/#/app/term',
width:455,
height:455,
icon: terminal,
},{
// name: "ZTMCli",
// label: "ZTM Cli",
// url:'/#/app/term',
// width:455,
// height:455,
// icon: terminal,
// },{
name: "ZTMLog",
label: "ZTM Log",
url:'/#/app/term',
Expand Down
14 changes: 11 additions & 3 deletions gui/src/views/apps/core/TermContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<div style="top: 0;position: fixed;bottom: 0;left: 0;right: 0;background: rgba(50, 4, 40, 1);">
<Terminal
style="height: 100%;"
welcomeMessage="Welcome to ztm cli"
welcomeMessage="Welcome to ztmctl"
prompt="ztm $"
aria-label="ztm cli"
aria-label="ztmctl"
/>
</div>
</template>
Expand Down Expand Up @@ -37,14 +37,22 @@ const commandHandler = (text) => {
}
const commandHandlerCore = async (args) => {
console.log(args)
let command = await Command.sidecar("bin/cli", args);
let command = await Command.sidecar("bin/ztmctl", args);
await command.spawn();
let rst = ""
command.stdout.on('data', line => {
console.log(line)
rst += line;
TerminalService.emit('response', rst);
});
command.stderr.on('data', line => {
console.log("[stderr]");
console.log(line);
});
command.on('error', error => {
console.log("[error]");
console.log(error);
});
}
</script>

0 comments on commit 8a613b7

Please sign in to comment.