Skip to content

Commit

Permalink
chore: added warning on ip fetch error
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlancehu committed Feb 19, 2023
1 parent 8dc1ca8 commit 86eb666
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
pip3 install pyinstaller
pip3 install requests
pip3 install tencentcloud-sdk-python
pip3 install pillow
- name: Build
run: |
python3 -m PyInstaller main.py -F -i icon.ico
Expand All @@ -35,7 +36,7 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v3.1.2
with:
name: qcip-${{ github.event.inputs.version }}-linux-x86_64
name: qcip-${{ github.event.inputs.version }}-linux-x64
path: dist/*
Windows:
runs-on: windows-2022
Expand All @@ -55,14 +56,13 @@ jobs:
pip3 install pillow
- name: Build
run: |
mv upx/upx.exe upx.exe
python3 -m PyInstaller main.py -F -i icon.ico
python3 -m PyInstaller main.py -F -i icon.ico --upx-dir upx
mv dist/main.exe dist/qcip.exe
mv config.json dist/config.json
- name: Upload
uses: actions/upload-artifact@v3.1.2
with:
name: qcip-${{ github.event.inputs.version }}-windows-x86_64
name: qcip-${{ github.event.inputs.version }}-windows-x64
path: dist/*
MacOS:
runs-on: macos-12
Expand All @@ -79,6 +79,7 @@ jobs:
pip3 install pyinstaller
pip3 install requests
pip3 install tencentcloud-sdk-python
pip3 install pillow
- name: Build
run: |
python3 -m PyInstaller main.py -F -i icon.ico
Expand All @@ -87,5 +88,5 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v3.1.2
with:
name: qcip-${{ github.event.inputs.version }}-macos-x86_64
name: qcip-${{ github.event.inputs.version }}-macos-x64
path: dist/*
28 changes: 24 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,26 @@
# Get IP
if 'GetIPAPI' in config:
if config['GetIPAPI'] == "LanceAPI":
ip = requests.get('https://get.lance.fun/ip/').text
try:
ip = requests.get('https://get.lance.fun/ip/').text
except Exception as e:
print('This api may not work anymore, please replace it and try again')
print('Detail: ' + str(e))
exit()
elif config['GetIPAPI'] == "IPIP":
ip = requests.get('http://myip.ipip.net/').text.split(' ')[1][3:]
try:
ip = json.loads(requests.get('https://myip.ipip.net/ip').text)['ip']
except Exception as e:
print('This api may not work anymore, please replace it and try again')
print('Detail: ' + str(e))
exit()
else:
ip = requests.get('https://get.lance.fun/ip/').text
try:
ip = requests.get('https://get.lance.fun/ip/').text
except Exception as e:
print('This api may not work anymore, please replace it and try again')
print('Detail: ' + str(e))
exit()
# Check Secret
if 'SecretId' not in config and 'SecretKey' not in config:
print('Both SecretId and SecretKey not found')
Expand Down Expand Up @@ -96,7 +111,9 @@
except TencentCloudSDKException as err:
print(err)
exit()

except Exception as e:
print('Unknown error: ' + str(e))
exit()

# Modify Firewall Rules
for a in range(0, len(resp)):
Expand Down Expand Up @@ -130,5 +147,8 @@
except TencentCloudSDKException as err:
print(err)
exit()
except Exception as e:
print('Unknown error: ' + str(e))
exit()
elif needupdate == False:
print("IP相同 无需更新")

0 comments on commit 86eb666

Please sign in to comment.