Skip to content

Commit

Permalink
Bug fixes, minor release
Browse files Browse the repository at this point in the history
Fixed Windows bug preventing Tamper from running on Windows
  • Loading branch information
dutzi committed Oct 19, 2014
1 parent 499b7cd commit 033f9e9
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 31 deletions.
2 changes: 1 addition & 1 deletion chrome-extension/app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_appName__",
"version": "0.23",
"version": "0.24.1",
"manifest_version": 2,
"description": "__MSG_appDescription__",
"icons": {
Expand Down
2 changes: 1 addition & 1 deletion chrome-extension/app/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
class="rules-list-item sidebar-list-item"
ng-class="{selected: selectedRuleIndex == $index}">
<div class="sidebar-list-item-checkbox">
<input type="checkbox" ng-model="rule.isEnabled" ng-change="onToggleRuleEnabled(rule)">
<input type="checkbox" ng-model="rule.isEnabled">
</div>
<div class="sidebar-list-item-data" ng-click="onRuleListItemClick($index)">
<div class="sidebar-list-item-title">{{ rule.url | getFilename }}</div>
Expand Down
31 changes: 6 additions & 25 deletions chrome-extension/app/scripts/controllers/PanelCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService', 'MimeTypesService', 'focus',
function ($scope, $filter, $window, ProxyService, MimeTypesService, focus) {

$scope.proxyStates = {
PROXY_NOT_CONNECTED: 'not connected',
PROXY_COULD_NOT_START_PORT_ERROR: 'could not start port error',
PROXY_COULD_NOT_START_LIBS_ERROR: 'could not start libs error',
PROXY_STARTED: 'proxy started',
PROXY_CONNECTED: 'proxy connected',
PROXY_DISCONNECTED: 'proxy disconnected'
};
$scope.proxyStates = ProxyService.proxyStates;

function onBgMessage(message) {
switch (message.method) {
Expand Down Expand Up @@ -42,13 +35,6 @@ module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService',

$scope.onDeleteRuleClick = function (rule) {
$scope.proxyRules.splice($scope.proxyRules.indexOf(rule), 1);
// localStorage.setItem('rules', JSON.stringify($scope.proxyRules));
// ProxyService.updateRules($scope.proxyRules);
};

$scope.onToggleRuleEnabled = function (rule) {
// localStorage.setItem('rules', JSON.stringify($scope.proxyRules));
// ProxyService.updateRules($scope.proxyRules);
};

$scope.onRuleListItemClick = function (index) {
Expand Down Expand Up @@ -98,9 +84,9 @@ module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService',
if (ruleExists) {
ProxyService.openFile(rule.cachedFilename);
} else {
request.status = 'loading';
request.isLoading = true;
request.requestEvent.getContent(function (content, encoding) {
request.status = 'loaded';
request.isLoading = false;

if (content === null) { return; }

Expand Down Expand Up @@ -137,8 +123,6 @@ module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService',
cachedFilename: response.cachedFilename,
isEnabled: true
});
// localStorage.setItem('rules', JSON.stringify($scope.proxyRules));
// ProxyService.updateRules($scope.proxyRules);
$scope.$digest();
});
});
Expand All @@ -155,9 +139,6 @@ module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService',
break;
}
}

// localStorage.setItem('rules', JSON.stringify($scope.proxyRules));
// ProxyService.updateRules($scope.proxyRules);
};

function onRequestFinished(e) {
Expand Down Expand Up @@ -266,7 +247,7 @@ module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService',

$scope.testEditorCommandLine = function () {
ProxyService.openTestFile();
}
};

$scope.$watch('settings', function(value) {
if (!value) { return; }
Expand All @@ -282,8 +263,8 @@ module.controller('PanelCtrl', ['$scope', '$filter', '$window', 'ProxyService',

$scope.onBodyKeyDown = function(e) {
if (e.shiftKey && e.keyCode === 191) {
if (document.activeElement.tagName.toLowerCase() !== 'input'
&& document.activeElement.tagName.toLowerCase() !== 'textarea') {
if (document.activeElement.tagName.toLowerCase() !== 'input' &&
document.activeElement.tagName.toLowerCase() !== 'textarea') {
$scope.showSettings();
}
} else if ((e.metaKey || e.ctrlKey) && e.keyCode === 70) {
Expand Down
8 changes: 8 additions & 0 deletions chrome-extension/app/scripts/services/ProxyService.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ module.factory('ProxyService', ['$q', function ($q) {

return {
bgPort: bgPort,
proxyStates: {
PROXY_NOT_CONNECTED: 'not connected',
PROXY_COULD_NOT_START_PORT_ERROR: 'could not start port error',
PROXY_COULD_NOT_START_LIBS_ERROR: 'could not start libs error',
PROXY_STARTED: 'proxy started',
PROXY_CONNECTED: 'proxy connected',
PROXY_DISCONNECTED: 'proxy disconnected'
},
cacheResponse: function (filename, content) {
return postMessage({
method: 'cache-response',
Expand Down
5 changes: 3 additions & 2 deletions mitmproxy-extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def run(self):

if sys.platform == 'win32':
nativeMessagingManifest['path'] = 'tamper.bat'
subprocess.call(['reg', 'add', 'HKEY_CURRENT_USER\\SOFTWARE\\Google\\Chrome\\NativeMessagingHosts\\com.dutzi.tamper', '/d', 'C:\\Users\\dutzi\\tamper-manifest.json', '/f'])
manifestFilename = expanduser('~\\tamper-manifest.json')
batchFilename = expanduser('~\\tamper.bat')

subprocess.call(['reg', 'add', 'HKEY_CURRENT_USER\\SOFTWARE\\Google\\Chrome\\NativeMessagingHosts\\com.dutzi.tamper', '/d', manifestFilename, '/f'])

manifestFile = open(manifestFilename, 'w')
json.dump(nativeMessagingManifest, manifestFile, sort_keys=True, indent=4)
manifestFile.close()
Expand Down Expand Up @@ -63,7 +64,7 @@ def run(self):
install_requires = ['gevent-websocket>=0.9.3'],
scripts = ['tamper/tamper.py'],
data_files = [
('tamper-files', ['cert/index.html', 'cert/mitmproxy.css', 'testfile.txt'])
('tamper-files', ['cert/index.html', 'cert/mitmproxy.css', 'cert/testfile.txt'])
],
license = 'MIT License',
url = 'http://dutzi.github.com/tamper',
Expand Down
Binary file modified mitmproxy-extension/tamper/__init__.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion mitmproxy-extension/tamper/tamper.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def read_thread_func(queue):

if (message['method'] == 'hello'):
send_message(json.dumps({'method': 'hello'}))
send_message(json.dumps({'method': 'version', 'version': '0.23'}))
send_message(json.dumps({'method': 'version', 'version': '0.24.1'}))

elif (message['method'] == 'update-rules'):
while len(urlsToProxy):
Expand Down
2 changes: 1 addition & 1 deletion mitmproxy-extension/tamper/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IVERSION = (0, 23)
IVERSION = (0, 24, 1)
VERSION = ".".join(str(i) for i in IVERSION)
NAME = "tamper"
NAMEVERSION = NAME + " " + VERSION
Binary file modified mitmproxy-extension/tamper/version.pyc
Binary file not shown.

0 comments on commit 033f9e9

Please sign in to comment.