Skip to content

Commit

Permalink
Add garmin_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm committed Nov 30, 2024
1 parent ddff205 commit e74cd51
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/pyinstaller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ jobs:
- run: pyinstaller get_profile.spec
- run: pyinstaller strava_auth.spec
- run: pyinstaller upload_activity.spec
- run: pyinstaller garmin_auth.spec

- uses: vimtor/action-zip@v1
- uses: vimtor/action-zip@v1.2
with:
files: dist configure_client.bat disable_zoffline.bat resources
dest: zoffline-helper.zip

- uses: WebFreak001/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
- uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/oldnapalm/zoffline-helper/releases/169846138/assets{?name,label}
release_id: 169846138
Expand Down
30 changes: 30 additions & 0 deletions garmin_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python

import os
import sys
import getpass
import garth

if getattr(sys, 'frozen', False):
# If we're running as a py installer bundle
SCRIPT_DIR = os.path.dirname(sys.executable)
else:
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))

domain = input("Garmin domain [garmin.com]: ") or 'garmin.com'
username = input("Username (e-mail): ")
if not sys.stdin.isatty(): # This terminal cannot support input without displaying text
print(f'*WARNING* The current shell ({os.name}) cannot support hidden text entry.')
print(f'Your password entry WILL BE VISIBLE.')
print(f'If you are running a bash shell under windows, try executing this program via winpty:')
print(f'>winpty python {sys.argv[0]}')
password = input("Password (will be shown): ")
else:
password = getpass.getpass("Password: ")

garth.configure(domain=domain)
try:
garth.login(username, password)
garth.save('%s/garth' % SCRIPT_DIR)
except Exception as e:
print(e)
40 changes: 40 additions & 0 deletions garmin_auth.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- mode: python -*-

block_cipher = None

import sys
sys.modules['FixTk'] = None

a = Analysis(['garmin_auth.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='garmin_auth',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=['python3.dll', '_uuid.pyd', 'api-ms-win-*.dll'],
runtime_tmpdir=None,
console=True)

import subprocess
subprocess.call(['C:\\Program Files (x86)\\Windows Kits\\10\\App Certification Kit\\signtool.exe', 'sign',
'/f', 'ssl\\cert-zwift-com.p12', '/fd', 'sha1',
'/t', 'http://timestamp.digicert.com',
'dist\\garmin_auth.exe'])
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
protobuf==4.21.12
stravalib==1.1.0
garth
pyinstaller

0 comments on commit e74cd51

Please sign in to comment.