Skip to content

Commit 4a71e6a

Browse files
fix bug
1 parent 5e5b0c3 commit 4a71e6a

File tree

17 files changed

+178
-61
lines changed

17 files changed

+178
-61
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* text=auto
22
*.toml text eol=lf
33
*.svg text eol=lf
4+
*.py text eol=crlf

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and Release Tauri App
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 触发条件:当推送符合 v* 模式的标签时触发
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest] # 定义构建的平台
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3 # 检出代码
18+
19+
- name: Set up Rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
override: true # 设置 Rust 工具链
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: '16' # 安装 Node.js
29+
30+
- name: Install Tauri CLI
31+
run: npm install -g @tauri-apps/cli # 安装 Tauri CLI
32+
33+
- name: Build Tauri App
34+
run: cargo tauri build # 构建 Tauri 应用
35+
36+
- name: Sign Tauri App
37+
env:
38+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} # 使用秘密环境变量存储的私钥
39+
run: |
40+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
41+
tauri signer sign -p <(echo "$TAURI_PRIVATE_KEY") -f src-tauri/target/release/bundle/msi/*.msi
42+
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
43+
tauri signer sign -p <(echo "$TAURI_PRIVATE_KEY") -f src-tauri/target/release/bundle/appimage/*.AppImage
44+
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
45+
tauri signer sign -p <(echo "$TAURI_PRIVATE_KEY") -f src-tauri/target/release/bundle/dmg/*.dmg
46+
fi # 对不同平台的构建产物进行签名
47+
48+
- name: Create Release
49+
id: create_release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用秘密环境变量存储的 GitHub token
53+
with:
54+
tag_name: ${{ github.ref }} # 使用推送的标签名作为 Release 名称
55+
release_name: Release ${{ github.ref }}
56+
draft: false
57+
prerelease: false # 创建 GitHub Release
58+
59+
- name: Upload Release Assets
60+
uses: actions/upload-release-asset@v1
61+
with:
62+
upload_url: ${{ steps.create_release.outputs.upload_url }} # 使用创建的 Release 的上传 URL
63+
asset_path: |
64+
src-tauri/target/release/bundle/msi/*.msi
65+
src-tauri/target/release/bundle/msi/*.sig
66+
src-tauri/target/release/bundle/appimage/*.AppImage
67+
src-tauri/target/release/bundle/appimage/*.sig
68+
src-tauri/target/release/bundle/dmg/*.dmg
69+
src-tauri/target/release/bundle/dmg/*.sig # 上传不同平台的构建产物
70+
asset_name: |
71+
$(basename src-tauri/target/release/bundle/msi/*.msi)
72+
$(basename src-tauri/target/release/bundle/msi/*.sig)
73+
$(basename src-tauri/target/release/bundle/appimage/*.AppImage)
74+
$(basename src-tauri/target/release/bundle/appimage/*.sig)
75+
$(basename src-tauri/target/release/bundle/dmg/*.dmg)
76+
$(basename src-tauri/target/release/bundle/dmg/*.sig) # 指定上传的文件名
77+
asset_content_type: application/octet-stream # 设置文件类型

guide.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@ Tzcode
2727
├── .Tzocde
2828
│   └── ...
2929

30+
update json web:
31+
"https://gist.githubusercontent.com/zhangzijie-pro/3614b79c71445345354a89c4396c23b0/raw/387fe2e0497e5410cddb227c36c33c759d92e176/lastest.json"
32+
33+
3034
example release:
3135
/zhangzijie-pro/Tiks/releases/download/1.0.0/tiks -> /usrname/productname/releases/download/{target-os}/{version}/app(linux binary or window exe)

latest.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"version": "v0.1.0",
3-
"notes": "Test version",
4-
"pub_date": "2024-06-26T19:25:57Z",
5-
"platforms": {
6-
"darwin-x86_64": {
7-
"signature": "Content of app.tar.gz.sig",
8-
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-x86_64.app.tar.gz"
9-
},
10-
"darwin-aarch64": {
11-
"signature": "Content of app.tar.gz.sig",
12-
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-aarch64.app.tar.gz"
13-
},
14-
"linux-x86_64": {
15-
"signature": "Content of app.AppImage.tar.gz.sig",
16-
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-amd64.AppImage.tar.gz"
17-
},
18-
"windows-x86_64": {
19-
"signature": "Content of app-setup.nsis.sig or app.msi.sig, depending on the chosen format",
20-
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-x64-setup.nsis.zip"
21-
}
2+
"version": "v0.1.0",
3+
"notes": "Test version",
4+
"pub_date": "2024-06-26T19:25:57Z",
5+
"platforms": {
6+
"darwin-x86_64": {
7+
"signature": "Content of app.tar.gz.sig",
8+
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-x86_64.app.tar.gz"
9+
},
10+
"darwin-aarch64": {
11+
"signature": "Content of app.tar.gz.sig",
12+
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-aarch64.app.tar.gz"
13+
},
14+
"linux-x86_64": {
15+
"signature": "Content of app.AppImage.tar.gz.sig",
16+
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-amd64.AppImage.tar.gz"
17+
},
18+
"windows-x86_64": {
19+
"signature": "Content of app-setup.nsis.sig or app.msi.sig, depending on the chosen format",
20+
"url": "https://https://github.com/zhangzijie-pro/Tzcode/releases/download/v1.0.0/app-x64-setup.nsis.zip"
2221
}
23-
}
22+
}
23+
}

py/server.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ def update_space_color():
8989
write_json(space_color_path, data)
9090
return jsonify(data)
9191

92+
@app.route('/workspace/swap', methods=['POST'])
93+
def swap_workspace():
94+
index1 = int(request.json.get('index1'))
95+
index2 = int(request.json.get('index2'))
96+
data = read_json(workspace_path)
97+
try:
98+
data['workspace'][index1], data['workspace'][index2] = data['workspace'][index2], data['workspace'][index1]
99+
except IndexError:
100+
return jsonify({"error": "Invalid index"}), 400
101+
write_json(workspace_path, data)
102+
return jsonify(data)
92103

93104
if __name__ == '__main__':
94-
app.run(host='127.0.0.1', port=5000)
105+
app.run(host='127.0.0.1', port=5000)

space/workspace.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"workspace": [
3-
"C:\\Users\\lenovo\\Desktop\\rust"
43
]
54
}

src-tauri/src/page/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub mod new_window{
1717
.decorations(false)
1818
.inner_size(800.0, 600.0)
1919
.visible(true)
20+
.center()
2021
.build()
2122
.expect("Failed to build window");
2223
}
@@ -34,6 +35,7 @@ pub mod new_window{
3435
.decorations(true)
3536
.inner_size(300.0, 250.0)
3637
.visible(true)
38+
.center()
3739
.build()
3840
.expect("Failed to build window");
3941
}

src-tauri/tauri.conf.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"providerShortName": null,
6161
"signingIdentity": null
6262
},
63-
"resources": ["../py","../sh","../space"],
63+
"resources": ["../py","../sh","../space","../tiks_command"],
6464
"shortDescription": "",
6565
"targets": "all",
6666
"windows": {
@@ -76,7 +76,6 @@
7676
"active": true,
7777
"dialog": true,
7878
"endpoints": [
79-
"https://github.com/zhangzijie-pro/Tzcode/blob/main/latest.json"
8079
],
8180
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDEzQ0IyM0U2QzVERUQxNgpSV1FXN1Yxc1BySThBYkdnTCtBeUNGVTN5Kytna0xQTjVpcVFZeUM4THFEdEZsSmhPMnpWcVZ5ZQo=",
8281
"windows": {

ui/css/dir.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@
6666
margin: 10px;
6767
}
6868

69-
.sidebar {
70-
display: flex;
71-
flex-direction: row;
72-
}
69+
7370

7471
.left-file img {
7572
margin-bottom: 20px; /* Space between SVGs */

ui/css/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ body ,html{
2727
padding: 10px;
2828
overflow-y: auto;
2929
display: flex;
30-
flex-direction: column;
30+
flex-direction: row;
3131
}
3232

3333
.main-content {
@@ -64,7 +64,7 @@ li {
6464
padding: 5px;
6565
}
6666

67-
.top-section,.bottom-section,.sidebar{
67+
.top-section,.bottom-section{
6868
overflow-y: scroll;
6969
}
7070

0 commit comments

Comments
 (0)