Skip to content

Commit 22a9c96

Browse files
committed
Remake desktop
Optimize lots of details
1 parent 0901390 commit 22a9c96

Some content is hidden

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

81 files changed

+5059
-2028
lines changed

.github/workflows/build.yaml

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,69 @@ on:
66
- 'v*'
77

88
jobs:
9+
changelog:
10+
runs-on: ubuntu-latest
11+
if: ${{ !contains(github.ref, '+') }}
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Generate
19+
run: |
20+
tags=($(git tag --merged $(git rev-parse HEAD) --sort=-creatordate))
21+
preTag=$(grep -oP '^## \K.*' CHANGELOG.md | head -n 1)
22+
currentTag=""
23+
for ((i = 0; i <= ${#tags[@]}; i++)); do
24+
if (( i < ${#tags[@]} )); then
25+
tag=${tags[$i]}
26+
else
27+
tag=""
28+
fi
29+
if [ -n "$currentTag" ]; then
30+
if [ "$(echo -e "$currentTag\n$preTag" | sort -V | head -n 1)" == "$currentTag" ]; then
31+
break
32+
fi
33+
fi
34+
if [ -n "$currentTag" ]; then
35+
echo "## $currentTag" >> NEW_CHANGELOG.md
36+
echo "" >> NEW_CHANGELOG.md
37+
if [ -n "$tag" ]; then
38+
git log --pretty=format:"%B" "$tag..$currentTag" | awk 'NF {print "- " $0} !NF {print ""}' >> NEW_CHANGELOG.md
39+
else
40+
git log --pretty=format:"%B" "$currentTag" | awk 'NF {print "- " $0} !NF {print ""}' >> NEW_CHANGELOG.md
41+
fi
42+
echo "" >> NEW_CHANGELOG.md
43+
fi
44+
currentTag=$tag
45+
done
46+
cat CHANGELOG.md >> NEW_CHANGELOG.md
47+
cat NEW_CHANGELOG.md > CHANGELOG.md
48+
49+
- name: Commit
50+
run: |
51+
git add CHANGELOG.md
52+
if ! git diff --cached --quiet; then
53+
echo "Commit pushing"
54+
git config --local user.email "[email protected]"
55+
git config --local user.name "chen08209"
56+
git commit -m "Update changelog"
57+
git push
58+
if [ $? -eq 0 ]; then
59+
echo "Push succeeded"
60+
else
61+
echo "Push failed"
62+
exit 1
63+
fi
64+
fi
65+
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
969
build:
70+
needs: [ changelog ]
71+
if: always()
1072
runs-on: ${{ matrix.os }}
1173
strategy:
1274
matrix:
@@ -27,25 +89,6 @@ jobs:
2789
arch: arm64
2890

2991
steps:
30-
- name: Setup Mingw64
31-
if: startsWith(matrix.platform,'windows')
32-
uses: msys2/setup-msys2@v2
33-
with:
34-
msystem: mingw64
35-
install: mingw-w64-x86_64-gcc
36-
update: true
37-
38-
- name: Set Mingw64 Env
39-
if: startsWith(matrix.platform,'windows')
40-
run: |
41-
echo "${{ runner.temp }}\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
42-
43-
- name: Check Matrix
44-
run: |
45-
echo "Running on ${{ matrix.os }}"
46-
echo "Arch: ${{ runner.arch }}"
47-
gcc --version
48-
4992
- name: Checkout
5093
uses: actions/checkout@v4
5194
with:
@@ -103,7 +146,6 @@ jobs:
103146
path: ./dist
104147
overwrite: true
105148

106-
107149
upload:
108150
permissions: write-all
109151
needs: [ build ]

.github/workflows/change.yaml

Lines changed: 0 additions & 66 deletions
This file was deleted.

core/Clash.Meta

core/action.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
)
6+
7+
const (
8+
messageMethod Method = "message"
9+
initClashMethod Method = "initClash"
10+
getIsInitMethod Method = "getIsInit"
11+
forceGcMethod Method = "forceGc"
12+
shutdownMethod Method = "shutdown"
13+
validateConfigMethod Method = "validateConfig"
14+
updateConfigMethod Method = "updateConfig"
15+
getProxiesMethod Method = "getProxies"
16+
changeProxyMethod Method = "changeProxy"
17+
getTrafficMethod Method = "getTraffic"
18+
getTotalTrafficMethod Method = "getTotalTraffic"
19+
resetTrafficMethod Method = "resetTraffic"
20+
asyncTestDelayMethod Method = "asyncTestDelay"
21+
getConnectionsMethod Method = "getConnections"
22+
closeConnectionsMethod Method = "closeConnections"
23+
closeConnectionMethod Method = "closeConnection"
24+
getExternalProvidersMethod Method = "getExternalProviders"
25+
getExternalProviderMethod Method = "getExternalProvider"
26+
updateGeoDataMethod Method = "updateGeoData"
27+
updateExternalProviderMethod Method = "updateExternalProvider"
28+
sideLoadExternalProviderMethod Method = "sideLoadExternalProvider"
29+
startLogMethod Method = "startLog"
30+
stopLogMethod Method = "stopLog"
31+
startListenerMethod Method = "startListener"
32+
stopListenerMethod Method = "stopListener"
33+
)
34+
35+
type Method string
36+
37+
type Action struct {
38+
Id string `json:"id"`
39+
Method Method `json:"method"`
40+
Data interface{} `json:"data"`
41+
}
42+
43+
func (action Action) Json() ([]byte, error) {
44+
data, err := json.Marshal(action)
45+
return data, err
46+
}
47+
48+
func (action Action) callback(data interface{}) bool {
49+
if conn == nil {
50+
return false
51+
}
52+
sendAction := Action{
53+
Id: action.Id,
54+
Method: action.Method,
55+
Data: data,
56+
}
57+
res, err := sendAction.Json()
58+
if err != nil {
59+
return false
60+
}
61+
_, err = conn.Write(append(res, []byte("\n")...))
62+
if err != nil {
63+
return false
64+
}
65+
return true
66+
}

0 commit comments

Comments
 (0)