Skip to content

Commit

Permalink
Merging into one (#31)
Browse files Browse the repository at this point in the history
* Fix permissions of file in clash_cfg_dir. Add updating provider with api. And fix some bug.

* fixup! Fix permissions of file in clash_cfg_dir. Add updating provider with api. And fix some bug.

* fixup! Fix permissions of file in clash_cfg_dir. Add updating provider with api. And fix some bug.

* fixup! Fix permissions of file in clash_cfg_dir. Add updating provider with api. And fix some bug.

* Remove the code in Windows platform

* Comment the `update_profiles_with_api` and remove `build-windows` from workflow.

* fixup! Comment the `update_profiles_with_api` and remove `build-windows` from workflow.

* Do not delete the original message of popup_msg beforehand. Delete some unnecessary files.

* Restart clashtui after fixing files permissinos. Profile created by template, use different proxy-provider path.

* Update workflow file.

* Update templates

* fixup! Update templates

* Update README.md

* Update PKGBUILD

* Add profile_update_interval_fg

* Fix the order of proxy-providers generated by crt_yaml_with_template

* Update basic_clash_config.yaml

* Add ToDo of updating profile.

* fixup! Add ToDo of updating profile.

* fixup! Add ToDo of updating profile.

* Update README

* fixup! Update README

* fixup! Update README

fixup! Update README

* fixup! Update README

* Replace with 127.0.0.1 if ip of external-controller is `0.0.0.0`.

* fixup! Replace with 127.0.0.1 if ip of external-controller is `0.0.0.0`.

* Don't save the clash config each exit. Perfect the execution of system cmd.

* Update README.md

* Update clashtui_demo

* Save clashtui data to `data.yaml` not `config.yaml`. `edit_cmd` and `open_dir_cmd` are optional.

* Update cargo include and exclude

* Update PKGBUILD

* Restore `is_user` of config. And change it to `clash_srv_is_user`.

* Restore `edit_cmd` and `open_dir_cmd`.

* Change cargo.toml version to v0.2.1

* Add Ideas.md

* Update Ideas.md

* Update example templates

* github workflow add building clashtui-linux-arm64

* fixup! github workflow add building clashtui-linux-arm64

* fixup! github workflow add building clashtui-linux-arm64

* Update clashtui dependence versions

* Update Cargo.lock

* Fix bug: alway download files with proxy.

* refresh state real-time, auto-enable proxy

* refresh state after service options

* fix user mode service's status check

* do some rename and replace unwarp with expect

* ci: fix target dir

* fix import on windows

* try add more log

* fix PortableMode

* Add building debug version

* Update README

* Use new foramt of version

* Fix the refresh about StartClashSrvService

* fixup! Add building debug version

* Update build_release.yml

* Update template

* Add `timeout` config item and default config values.

* Update build_release.yml

* Extend the timeout of request.

* Update build_release.yml

* Update cargo pkg version

* Update profile templates

* fixup! Update template

* fixup! Update template

* check https://www.gstatic.com/generate_204 for connectivity

* Only display domain of url in update window

* fixup! Only display domain of url in update window

* Add Profile Info

* fixup! check https://www.gstatic.com/generate_204 for connectivity

* Add my config

* fixup! Add my config

* Add geodata and clashconfig to Profile Info

* fixup! Add geodata and clashconfig to Profile Info

* fixup! Add geodata and clashconfig to Profile Info

* fixup! Add geodata and clashconfig to Profile Info

* fixup! Add my config

* fixup! Add geodata and clashconfig to Profile Info

* Remove Ideas.md

* Add `no proxy provider` option

* Update version of build.rs

* fixup! Add `no proxy provider` option

* fixup! Add `no proxy provider` option

* modify backend

* read env var (stored in PROXY_ENVAR) to enable proxy

* Only display domain of url in update window

thanks to JohanChane

* do not overwrite profile if update failed

* load timeout from cfg
DO NOT REMOVE DEFAULT

* fix tui function

* init fix and revert

* rm unused

---------

Co-authored-by: JohanChane <[email protected]>
  • Loading branch information
Jackhr-arch and JohanChane authored Jun 27, 2024
1 parent a04e6e6 commit 25dccf2
Show file tree
Hide file tree
Showing 61 changed files with 2,258 additions and 1,309 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build Release

on:
push:
paths:
- 'clashtui/**'
- '.github/workflows/build_release.yml'

env:
CARGO_TERM_COLOR: always

jobs:
build-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: goto-bus-stop/setup-zig@v2

- name: Set up Mihomo
run: |
wget --output-document mihomo.gz https://github.com/MetaCubeX/mihomo/releases/download/v1.18.0/mihomo-linux-amd64-v1.18.0.gz
gunzip mihomo.gz
chmod +x mihomo
nohup ./mihomo -d Example -f Example/basic_clash_config.yaml &
- name: Cache Target
uses: actions/cache@v4
with:
path: |
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashtui && cargo fetch

- name: Run tests
run: cd clashtui && cargo test --all

- name: Build
run: |
cd clashtui
cargo build --locked
cargo build --release --locked
- name: Build linux arm64
run: |
rustup target add aarch64-unknown-linux-gnu
cd clashtui
cargo install cargo-zigbuild
cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --locked
cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --release --locked
- name: Build Version
run: |
cd clashtui && cargo run --release -- -v >> version.txt
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/debug/clashtui ./artifacts/clashtui-amd64-debug
mv ./clashtui/target/release/clashtui ./artifacts/clashtui-amd64
mv ./clashtui/target/aarch64-unknown-linux-gnu/debug/clashtui ./artifacts/clashtui-arm64-debug
mv ./clashtui/target/aarch64-unknown-linux-gnu/release/clashtui ./artifacts/clashtui-arm64
mv ./clashtui/version.txt ./artifacts/version.txt
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: Linux_Build
path: artifacts
retention-days: 5

release:
runs-on: ubuntu-latest

needs: [build-linux]

if: startsWith(github.ref, 'refs/tags/')

permissions:
contents: write

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts

- name: Get version
run: |
cd ./artifacts
echo CLASHTUI_VERSION="$(cat version.txt)" >> $GITHUB_ENV
- name: Archive Release
run: |
gzip -c ./artifacts/clashtui-amd64 > clashtui-linux-amd64-${{ env.CLASHTUI_VERSION }}.gz
gzip -c ./artifacts/clashtui-arm64 > clashtui-linux-arm64-${{ env.CLASHTUI_VERSION }}.gz
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
prerelease: true
files: |
clashtui-linux-amd64-${{ env.CLASHTUI_VERSION }}.gz
clashtui-linux-arm64-${{ env.CLASHTUI_VERSION }}.gz
20 changes: 10 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
nohup ./mihomo -d Example -f Example/basic_clash_config.yaml &
- name: Download Dependencies
run: cd clashctl && cargo fetch
run: cd clashtui && cargo fetch

- name: Build
run: cd clashctl && cargo build --verbose
run: cd clashtui && cargo build --verbose

- name: Run tests
run: cd clashctl && cargo test --all --verbose
run: cd clashtui && cargo test --all --verbose

- name: Build Version
run: cd clashctl && cargo r -- -v
run: cd clashtui && cargo r -- -v

- name: Pre Upload
run: |
mkdir artifacts
mv ./clashctl/target/debug/clashctl ./artifacts/clashctl.debug
mv ./clashtui/target/debug/clashtui ./artifacts/clashtui.debug
- name: upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -57,21 +57,21 @@ jobs:
mihomo-windows-amd64.exe -d Example -f Example/basic_clash_config.yaml &
- name: Download Dependencies
run: cd clashctl && cargo fetch
run: cd clashtui && cargo fetch

- name: Build
run: cd clashctl && cargo build --verbose && cargo build --release
run: cd clashtui && cargo build --verbose && cargo build --release

# - name: Run tests
# run: cd clashctl && cargo test --all --verbose
# run: cd clashtui && cargo test --all --verbose

- name: Build Version
run: cd clashctl && cargo r -- -v
run: cd clashtui && cargo r -- -v

- name: Pre Upload
run: |
mkdir artifacts
mv ./clashctl/target/debug/clashctl.exe ./artifacts/clashctl.debug.exe
mv ./clashtui/target/debug/clashtui.exe ./artifacts/clashtui.debug.exe
- name: upload artifacts
uses: actions/upload-artifact@v4
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ jobs:
uses: actions/cache@v4
with:
path: |
./clashctl/target
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashctl/Cargo.lock') }}
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashctl/Cargo.lock') }}
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashctl && cargo fetch
run: cd clashtui && cargo fetch

- name: Run tests
run: cd clashctl && cargo test --all --verbose
run: cd clashtui && cargo test --all --verbose

- name: Build
run: cd clashctl && cargo build --all-features --verbose --locked && cargo build --all-features --release --locked
run: cd clashtui && cargo build --all-features --verbose --locked && cargo build --all-features --release --locked

- name: Build Version
run: cd clashctl && cargo r --all-features -- -V
run: cd clashtui && cargo r --all-features -- -V

- name: Pre Upload
run: |
mkdir artifacts
mv ./clashctl/target/release/clashctl ./artifacts/clashctl.release
mv ./clashctl/target/debug/clashctl ./artifacts/clashctl.debug
mv ./clashtui/target/release/clashtui ./artifacts/clashtui.release
mv ./clashtui/target/debug/clashtui ./artifacts/clashtui.debug
- name: upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -76,33 +76,33 @@ jobs:
uses: actions/cache@v4
with:
path: |
./clashctl/target
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashctl/Cargo.lock') }}
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashctl/Cargo.lock') }}
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashctl && cargo fetch
run: cd clashtui && cargo fetch

- name: Check
run: cd clashctl && cargo check --all-features --verbose
run: cd clashtui && cargo check --all-features --verbose

# - name: Run tests
# run: cd clashctl && cargo test --all --verbose
# run: cd clashtui && cargo test --all --verbose

- name: Build
run: cd clashctl && cargo build --all-features --verbose && cargo build --all-features --release
run: cd clashtui && cargo build --all-features --verbose && cargo build --all-features --release

- name: Build Version
run: cd clashctl && cargo r --all-features -- -V
run: cd clashtui && cargo r --all-features -- -V

- name: Pre Upload
run: |
mkdir artifacts
mv ./clashctl/target/release/clashctl.exe ./artifacts/clashctl.release.exe
mv ./clashctl/target/debug/clashctl.exe ./artifacts/clashctl.debug.exe
mv ./clashtui/target/release/clashtui.exe ./artifacts/clashtui.release.exe
mv ./clashtui/target/debug/clashtui.exe ./artifacts/clashtui.debug.exe
- name: upload artifacts
uses: actions/upload-artifact@v4
Expand Down
Binary file added Assets/clashtui_demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 30 additions & 47 deletions assets/clashtui_demo.tape → Assets/clashtui_demo.tape
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@
# Where should we write the GIF?
Output demo.gif

# Set up a 1200x600 terminal with 46px font.
# Set up a 1200x600 terminal with 42px font.
Set FontSize 20
Set Width 1200
Set Height 1000
Set Height 800

Type "./target/release/clashtui"
Sleep 500ms
# ## Start clashtui
Type "clashtui"
Sleep 1s
Enter
Sleep 1s

Set TypingSpeed 1s

# ## Close Welcome
Escape

# ## Help
Set TypingSpeed 1s
Type "?"
Type "jjjj"
Escape
Expand All @@ -27,71 +24,57 @@ Type "i"
Set TypingSpeed 300ms
Type "sub"
Tab
Type "the url"
Escape
Type "https://example.com"
Enter

Set TypingSpeed 1s

Enter
# scroll list
Type "j"
Enter
Sleep 2s
Type "k"
Sleep 2s

# Select and update the profile
Enter
Sleep 5s
Type "u"
Sleep 10s
Escape
Type "P"
Sleep 1s
Escape
Type "L"
Sleep 1s
Escape

# Preview the profile
#Type "v"
#Sleep 2s
#Escape

# Generate profile with Template
Type "t"
Sleep 1s
Enter
Sleep 1s
Escape
Sleep 1s
Type "p"
Enter
Sleep 6s
Escape
Sleep 1s
Type "D"
Sleep 1s
Type "y"
Sleep 1s

Type "P"
Sleep 2s
Escape
# Delete profile
Type "d"
Sleep 2s
Type "y"
Sleep 1s

# ## ClashSrvCtl
Set TypingSpeed 300ms
Type "2"
Type "jjjj"
Enter
Type "j"
Enter

# ## Config
Tab
Enter
Type "the path to clash config dir"
Enter
Sleep 1s
Enter
Escape

# ## Global
Type "H"
Sleep 500ms
# Show log
Type "L"
Sleep 2s
Escape

# ## Exit And Rerun
Type "Q"
# ## Exit
Type "q"
Sleep 1s
Type "./target/release/clashtui"
Sleep 500ms
Escape
Loading

0 comments on commit 25dccf2

Please sign in to comment.