Skip to content

Commit 5c4cdb9

Browse files
authored
refactor: migrate to tauri (#63)
refactor: migrate to tauri from electron tasks: - [x] migrate HTTP API to tauri - [x] implement HTTP proxy in tauri env - [x] implement HTTP disable ssl in tauri env - [x] migrate store API to tauri - [x] migrate openai API to tauri - [x] implement openai proxy - [x] implement openai stream mode - [x] migrate shortcuts - [x] migrate app menus - [!] implement encrypted data smooth migration - [!] Implement new encryption solution - [x] implement pipeline for tauri - [x] implement windows codesign & macos codesign - [x] migrate app logo - [x] updater cleanups: - [x] clean up electron code - [x] clean up electron-related unused dependencies - [ ] TBC... Refs: #123 --------- Signed-off-by: seven <[email protected]>
1 parent 112dcf9 commit 5c4cdb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+11024
-12050
lines changed

.eslintignore

-3
This file was deleted.

.eslintrc.cjs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
es2022: true,
5+
},
6+
extends: [
7+
'plugin:vue/base',
8+
'eslint:recommended',
9+
'plugin:vue/vue3-recommended',
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:prettier/recommended',
12+
'./.eslintrc-auto-import.json',
13+
],
14+
parser: 'vue-eslint-parser',
15+
parserOptions: {
16+
parser: '@typescript-eslint/parser',
17+
ecmaVersion: 'latest',
18+
sourceType: 'module',
19+
},
20+
plugins: ['@typescript-eslint', 'prettier', 'eslint-plugin-vue'],
21+
rules: {
22+
'prettier/prettier': 'error',
23+
'vue/multi-word-component-names': 'off',
24+
'arrow-parens': [2, 'as-needed'],
25+
'arrow-spacing': [
26+
2,
27+
{
28+
before: true,
29+
after: true,
30+
},
31+
],
32+
'key-spacing': [
33+
2,
34+
{
35+
beforeColon: false,
36+
afterColon: true,
37+
},
38+
],
39+
'no-var': 'error',
40+
'no-console': 'error',
41+
'no-debugger': process.env === 'development' ? 'warn' : 'error',
42+
},
43+
ignorePatterns: ['dist','src-tauri'],
44+
};

.eslintrc.json

-21
This file was deleted.

.github/workflows/node.yml

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Node.js CI
2+
run-name: ${{ github.event.head_commit.message }}
23

34
on:
4-
push:
5-
branches: [master]
65
pull_request:
76
branches: [master]
87

@@ -24,27 +23,31 @@ jobs:
2423
steps:
2524
- name: Github checkout
2625
uses: actions/checkout@v4
27-
- name: Install rpm
28-
run: sudo apt-get install -y rpm
26+
- name: install Rust stable
27+
uses: dtolnay/rust-toolchain@stable
2928
if: matrix.os == 'ubuntu-latest'
3029
- name: Use Node.js ${{ matrix.node-version }}
31-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
3231
with:
3332
node-version: ${{ matrix.node-version }}
3433
cache: 'npm'
35-
- uses: actions/setup-python@v4
36-
with:
37-
python-version: '3.10'
38-
- run: npm ci
34+
- name: install dependencies (ubuntu only)
35+
if: matrix.os == 'ubuntu-latest'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
39+
- name: install frontend dependencies
40+
run: npm ci --legacy-peer-deps
3941
- run: npm run lint:check
4042
- run: npm audit --audit-level=critical
4143
- run: npm run test:ci
4244
- name: Upload coverage reports to Codecov
4345
uses: codecov/codecov-action@v3
4446
env:
4547
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
46-
- run: npm run package
47-
- name: Build Electron app
48-
shell: bash
49-
run: ./scripts/make-distributions.sh
50-
48+
- run: npm run build
49+
- uses: tauri-apps/tauri-action@v0
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
includeRelease: false

.github/workflows/release.yml

+84-56
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,81 @@
11
name: distributions release
2-
2+
run-name: ${{ github.event.head_commit.message }}
33
on:
44
push:
55
branches: [ master ]
6-
76
concurrency:
87
group: ${{ github.workflow }}-${{ github.ref }}
98
cancel-in-progress: true
109

1110
jobs:
1211
pre-release:
1312
strategy:
13+
fail-fast: false
1414
matrix:
15-
os: [ macos-latest, ubuntu-latest, windows-latest ]
15+
os: [ macos-latest, windows-latest, ubuntu-latest ]
16+
include:
17+
- os: 'macos-latest'
18+
args: '--target universal-apple-darwin'
19+
target: 'aarch64-apple-darwin,x86_64-apple-darwin'
20+
- os: 'windows-latest'
21+
args: '--target aarch64-pc-windows-msvc'
22+
target: 'aarch64-pc-windows-msvc'
23+
aarch64: true
24+
- os: 'windows-latest'
25+
args: '--target x86_64-pc-windows-msvc'
26+
target: 'x86_64-pc-windows-msvc'
27+
x86_64: true
28+
- os: 'ubuntu-latest'
29+
args: '--target aarch64-unknown-linux-gnu'
30+
target: 'aarch64-unknown-linux-gnu'
31+
aarch64: true
32+
- os: 'ubuntu-latest'
33+
args: '--target x86_64-unknown-linux-gnu'
34+
target: 'x86_64-unknown-linux-gnu'
35+
x86_64: true
1636
node-version: [ 20.x ]
1737
runs-on: ${{ matrix.os }}
1838

1939
steps:
2040
- name: Github checkout
2141
uses: actions/checkout@v4
22-
- name: Install rpm
23-
run: sudo apt-get install -y rpm
24-
if: matrix.os == 'ubuntu-latest'
25-
- name: Use Node.js ${{ matrix.node-version }}
42+
- name: install Rust stable
43+
uses: dtolnay/rust-toolchain@stable
44+
with:
45+
targets: ${{ matrix.target }}
46+
- name: Use Node.js 20.x
2647
uses: actions/setup-node@v4
2748
with:
2849
node-version: ${{ matrix.node-version }}
2950
cache: 'npm'
30-
- uses: actions/setup-python@v4
31-
with:
32-
python-version: '3.10'
33-
- name: Setup .NET Core SDK
34-
if: matrix.os == 'windows-latest'
35-
uses: actions/setup-dotnet@v2
36-
with:
37-
dotnet-version: 6.0.x
38-
- run: npm ci
39-
- run: npm run package
40-
- name: Build app
41-
shell: bash
42-
run: ./scripts/make-distributions.sh
51+
- name: install dependencies (ubuntu only)
52+
if: matrix.os == 'ubuntu-latest'
53+
run: |
54+
sudo apt-get update
55+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf pkg-config libssl-dev gcc-aarch64-linux-gnu
56+
- name: install frontend dependencies
57+
run: npm ci --legacy-peer-deps
58+
- run: npm run lint:check
59+
- run: npm audit --audit-level=critical
60+
- run: npm run test:ci
61+
- name: Upload coverage reports to Codecov
62+
uses: codecov/codecov-action@v3
63+
env:
64+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
65+
- run: npm run build
66+
- name: Build Distribution Binaries
67+
uses: tauri-apps/tauri-action@v0
4368
env:
44-
APPLE_ID: ${{ secrets.APPLE_ID }}
45-
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
46-
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
PKG_CONFIG_ALLOW_CROSS: 1
71+
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
72+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
73+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
74+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
75+
with:
76+
args: ${{ matrix.args }}
4777

48-
- name: Sign files with Trusted Signing
78+
- name: Sign Binaries with Trusted Signing
4979
if: matrix.os == 'windows-latest'
5080
uses: azure/[email protected]
5181
with:
@@ -55,66 +85,64 @@ jobs:
5585
endpoint: https://eus.codesigning.azure.net/
5686
trusted-signing-account-name: geek-fun
5787
certificate-profile-name: geek-fun
58-
files-folder: ${{ github.workspace }}\out\make
88+
files-folder: ${{ github.workspace }}\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\
5989
files-folder-depth: 7
6090
files-folder-filter: exe
6191
file-digest: SHA256
6292
timestamp-rfc3161: http://timestamp.acs.microsoft.com
6393
timestamp-digest: SHA256
64-
- name: Upload artifacts
94+
- name: Upload Distribution Binaries
6595
uses: actions/upload-artifact@v4
6696
with:
6797
name: artifacts-${{ matrix.os }}
68-
path: out/make/*
98+
path: |
99+
${{ github.workspace }}/src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg
100+
${{ github.workspace }}/src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
101+
${{ github.workspace }}/src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage
102+
${{ github.workspace }}\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\*.exe
103+
69104
release:
70105
needs: pre-release
71106
runs-on: ubuntu-latest
72107
steps:
73108
- name: Github checkout
74109
uses: actions/checkout@v4
75-
- name: Use Node.js 20.x
76-
uses: actions/setup-node@v4
110+
- name: Download Distribution Binaries
111+
uses: actions/download-artifact@v4
77112
with:
78-
node-version: 20.x
79-
cache: 'npm'
113+
path: artifacts
114+
merge-multiple: true
80115
- name: Generate changelog
81116
uses: jaywcjlove/changelog-generator@main
82117
id: changelog
83118
with:
84119
token: ${{ secrets.GITHUB_TOKEN }}
85-
- name: Download artifacts
86-
uses: actions/download-artifact@v4
87-
with:
88-
path: out/make/
89-
merge-multiple: true
90-
- name: Build Release
120+
- name: Tag Release
91121
uses: jaywcjlove/create-tag-action@main
92122
id: tag_release
93123
with:
94124
prerelease: true
95125
token: ${{ secrets.GITHUB_TOKEN }}
126+
127+
- name: Release App
128+
uses: softprops/action-gh-release@v2
129+
if: steps.tag_release.outputs.successful
130+
with:
131+
tag_name: ${{ steps.tag_release.outputs.version }}
132+
name: ${{ steps.tag_release.outputs.version }}
96133
body: |
97134
${{ steps.changelog.outputs.compareurl }}
98135
99136
${{ steps.changelog.outputs.changelog }}
100-
- name: Release App to GitHub
101-
uses: "marvinpinto/action-automatic-releases@latest"
137+
files: ${{ github.workspace }}/artifacts/**/*
138+
139+
- name: Distribute Binaries to R2
102140
if: steps.tag_release.outputs.successful
141+
uses: ryand56/r2-upload-action@master
103142
with:
104-
prerelease: false
105-
automatic_release_tag: ${{ steps.tag_release.outputs.version }}
106-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
107-
files: |
108-
LICENSE
109-
out/make/**/*.{dmg,rpm,deb,Setup.exe}
110-
111-
# - name: Distribute artifacts to R2
112-
# uses: ryand56/r2-upload-action@master
113-
# if: steps.tag_release.outputs.successful
114-
# with:
115-
# r2-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
116-
# r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
117-
# r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
118-
# r2-bucket: ${{ secrets.CLOUDFLARE_ARTIFACTS_R2 }}
119-
# source-dir: out/make/
120-
# destination-dir: dockit
143+
r2-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
144+
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
145+
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
146+
r2-bucket: ${{ secrets.CLOUDFLARE_ARTIFACTS_R2 }}
147+
source-dir: ${{ github.workspace }}/artifacts/
148+
destination-dir: dockit

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,18 @@ data/
9494
/.idea/
9595
/dist/
9696
/.vscode/
97+
# Logs
98+
node_modules
99+
dist
100+
dist-ssr
101+
*.local
102+
103+
# Editor directories and files
104+
.vscode/*
105+
!.vscode/extensions.json
106+
.idea
107+
*.suo
108+
*.ntvs*
109+
*.njsproj
110+
*.sln
111+
*.sw?

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.16.0
1+
v20.15.0

app-icon.png

176 KB
Loading

0 commit comments

Comments
 (0)