Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
3alisaki authored Aug 6, 2020
1 parent 2d3892d commit 246b1ef
Show file tree
Hide file tree
Showing 19 changed files with 850 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# HTTP-Listener

Listen to all HTTP, HTTPS, and AJAX requests.

This is an extension of Google Chrome and Opera lets you listen to all HTTP, HTTPS, and AJAX requests.

You can use it to check how websites and APIs work and view all browser requests.

# ScreenShot
![ScreenShot](https://github.com/alisaki20/HTTP-Listener/blob/master/screenshot.png?raw=true)

# Installation
1. Open the Extension Management page by navigating to chrome://extensions.
2. The Extension Management page can also be opened by clicking on the Chrome menu, hovering over More Tools then selecting Extensions.
3. Enable Developer Mode by clicking the toggle switch next to Developer mode.
4. Click the LOAD UNPACKED button and select the extension directory.

# License
MIT License
39 changes: 39 additions & 0 deletions _locales/ar/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"extensionName": {
"message": "HTTP Listener",
"description": "Title of the extension"
},
"extensionDescription": {
"message": "استمع إلى جميع طلبات HTTP و HTTPS و AJAX"
},
"dir": {
"message": "rtl"
},
"filterByUrl": {
"message": "تصفية حسب Url"
},
"start": {
"message": "ابدأ"
},
"stop": {
"message": "توقف"
},
"clear": {
"message": "نظف"
},
"type": {
"message": "نوع"
},
"method": {
"message": "طريقة"
},
"url": {
"message": "رابط"
},
"runButton": {
"message": "تشغیل"
},
"closeButton": {
"message": "إغلاق"
}
}
39 changes: 39 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"extensionName": {
"message": "HTTP Listener",
"description": "Title of the extension"
},
"extensionDescription": {
"message": "Listen to all HTTP, HTTPS, and AJAX requests"
},
"dir": {
"message": "ltr"
},
"filterByUrl": {
"message": "Filter By Url"
},
"start": {
"message": "Start"
},
"stop": {
"message": "Stop"
},
"clear": {
"message": "Clear"
},
"type": {
"message": "Type"
},
"method": {
"message": "Method"
},
"url": {
"message": "Url"
},
"runButton": {
"message": "Run"
},
"closeButton": {
"message": "Close"
}
}
39 changes: 39 additions & 0 deletions _locales/fa/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"extensionName": {
"message": "HTTP Listener",
"description": "Title of the extension"
},
"extensionDescription": {
"message": "گوش دادن به تمام درخواست های HTTP ، HTTPS و AJAX "
},
"dir": {
"message": "rtl"
},
"filterByUrl": {
"message": "فیلتر بر اساس آدرس"
},
"start": {
"message": "شروع"
},
"stop": {
"message": "توقف"
},
"clear": {
"message": "تمیز کردن"
},
"type": {
"message": "نوع"
},
"method": {
"message": "روش"
},
"url": {
"message": "پیوند"
},
"runButton": {
"message": "اجرا کن"
},
"closeButton": {
"message": "بستن"
}
}
110 changes: 110 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
'use strict';

function onAddRequest() {
this.listeners = [];
this.addListener = (callback) => {
if (typeof callback !== 'function') {
console.error(`The listener callback must be a function, the given type is ${typeof callback}`);
} else {
this.listeners.push(callback);
};
};
this.removeListener = (callback) => {
this.listeners = this.listeners.filter(listener => {
return listener != callback
});
};
this.dispatch = (details) => {
this.listeners.forEach((listener) => {
listener(details);
});
};
};

function onClearAllRequest() {
this.listeners = [];
this.addListener = (callback) => {
if (typeof callback !== 'function') {
console.error(`The listener callback must be a function, the given type is ${typeof callback}`);
} else {
this.listeners.push(callback);
};
};
this.removeListener = (callback) => {
this.listeners = this.listeners.filter(listener => {
return listener != callback
});
};
this.dispatch = () => {
this.listeners.forEach((listener) => {
listener();
});
};
};

function onRecordChange() {
this.listeners = [];
this.addListener = (callback) => {
if (typeof callback !== 'function') {
console.error(`The listener callback must be a function, the given type is ${typeof callback}`);
} else {
this.listeners.push(callback);
};
};
this.removeListener = (callback) => {
this.listeners = this.listeners.filter(listener => {
return listener != callback
});
};
this.dispatch = (newRecord) => {
this.listeners.forEach((listener) => {
listener(newRecord);
});
};
};

var onAddRequest = new onAddRequest(),
onClearAllRequest = new onClearAllRequest(),
onRecordChange = new onRecordChange(),
allRequests = [],
record = false;

function clearAllRequest() {
allRequests = [];
onClearAllRequest.dispatch();
};

function switchRecord() {
if (record) {
record = false;
} else {
record = true;
};
onRecordChange.dispatch(record);
};

chrome.webRequest.onBeforeRequest.addListener((details) => {
if (!record) {
return;
};

if (details.initiator != undefined) {
if (details.initiator.substr(0, 19) == "chrome-extension://") return;
} else {
if (details.url.substr(0, 19) == "chrome-extension://") return;
};

allRequests.push(details);

if (allRequests.length > 2000) {
allRequests = allRequests.slice(0, 2000);
};

onAddRequest.dispatch(details);
}, {urls: ["<all_urls>"]}, ["requestBody"]);

chrome.browserAction.onClicked.addListener(() => {
chrome.tabs.create ({
active: true, url: chrome.extension.getURL("requests_dashboard.html")
});
});
23 changes: 23 additions & 0 deletions icons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(icons.woff2) format('woff2');
}

.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
Binary file added icons.woff2
Binary file not shown.
Binary file added images/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions jquery-3.4.1.min.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"default_locale": "en",
"version": "1.0",
"permissions": ["webRequest", "<all_urls>"],
"background": {
"scripts": ["background.js"],
"persistent": true
},
"browser_action": {
"default_icon": {
"16": "images/icon16.png",
"32": "images/icon32.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
}
},
"icons": {
"16": "images/icon16.png",
"32": "images/icon32.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
},
"manifest_version": 2
}
9 changes: 9 additions & 0 deletions material.min.css

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions material.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 246b1ef

Please sign in to comment.