From 02138220fd7a738c4323c919c703491f820d558b Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Fri, 10 Mar 2017 08:11:40 -0800 Subject: [PATCH] allow setting a proxy in sublime-settings file --- WakaTime.py | 4 +++- WakaTime.sublime-settings | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/WakaTime.py b/WakaTime.py index b9d4ec1..0dac9e3 100644 --- a/WakaTime.py +++ b/WakaTime.py @@ -190,7 +190,6 @@ def create_config_file(): with open(configFile, 'w') as fh: fh.write("[settings]\n") fh.write("debug = false\n") - fh.write("hidefilenames = false\n") except IOError: pass @@ -483,6 +482,7 @@ class SendHeartbeatsThread(threading.Thread): self.api_key = SETTINGS.get('api_key', '') self.ignore = SETTINGS.get('ignore', []) self.hidefilenames = SETTINGS.get('hidefilenames') + self.proxy = SETTINGS.get('proxy') self.heartbeat = heartbeat self.has_extra_heartbeats = False @@ -543,6 +543,8 @@ class SendHeartbeatsThread(threading.Thread): cmd.append('--verbose') if self.hidefilenames: cmd.append('--hidefilenames') + if self.proxy: + cmd.extend(['--proxy', self.proxy]) if self.has_extra_heartbeats: cmd.append('--extra-heartbeats') stdin = PIPE diff --git a/WakaTime.sublime-settings b/WakaTime.sublime-settings index 7987f6a..22b5ebc 100644 --- a/WakaTime.sublime-settings +++ b/WakaTime.sublime-settings @@ -7,13 +7,16 @@ // Set this in your User specific WakaTime.sublime-settings file. "api_key": "", + // Debug mode. Set to true for verbose logging. Defaults to false. + "debug": false, + + // Proxy with format https://user:pass@host:port or socks5://user:pass@host:port or domain\\user:pass. + "proxy": "", + // Ignore files; Files (including absolute paths) that match one of these // POSIX regular expressions will not be logged. "ignore": ["^/tmp/", "^/etc/", "^/var/", "COMMIT_EDITMSG$", "PULLREQ_EDITMSG$", "MERGE_MSG$", "TAG_EDITMSG$"], - // Debug mode. Set to true for verbose logging. Defaults to false. - "debug": false, - // Status bar message. Set to false to hide status bar message. // Defaults to true. "status_bar_message": true, @@ -21,6 +24,6 @@ // Status bar message format. "status_bar_message_fmt": "WakaTime {status} %I:%M %p", - // Hide filenames + // Obfuscate file paths when sending to API. Your dashboard will no longer display coding activity per file. "hidefilenames": false }