@gxp-dev/tools 2.0.6 โ 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/commands/build.js +18 -12
- package/browser-extensions/README.md +1 -0
- package/browser-extensions/chrome/background.js +857 -0
- package/browser-extensions/chrome/content.js +51 -0
- package/browser-extensions/chrome/devtools.html +9 -0
- package/browser-extensions/chrome/devtools.js +23 -0
- package/browser-extensions/chrome/icons/gx_off_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_64.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_64.png +0 -0
- package/browser-extensions/chrome/inspector.js +1087 -0
- package/browser-extensions/chrome/manifest.json +70 -0
- package/browser-extensions/chrome/panel.html +638 -0
- package/browser-extensions/chrome/panel.js +862 -0
- package/browser-extensions/chrome/popup.html +399 -0
- package/browser-extensions/chrome/popup.js +515 -0
- package/browser-extensions/chrome/rules.json +1 -0
- package/browser-extensions/chrome/test-chrome.html +145 -0
- package/browser-extensions/chrome/test-mixed-content.html +190 -0
- package/browser-extensions/chrome/test-uri-pattern.html +199 -0
- package/browser-extensions/firefox/README.md +134 -0
- package/browser-extensions/firefox/background.js +804 -0
- package/browser-extensions/firefox/content.js +120 -0
- package/browser-extensions/firefox/debug-errors.html +229 -0
- package/browser-extensions/firefox/debug-https.html +113 -0
- package/browser-extensions/firefox/devtools.html +9 -0
- package/browser-extensions/firefox/devtools.js +24 -0
- package/browser-extensions/firefox/icons/gx_off_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_64.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_64.png +0 -0
- package/browser-extensions/firefox/inspector.js +1087 -0
- package/browser-extensions/firefox/manifest.json +67 -0
- package/browser-extensions/firefox/panel.html +638 -0
- package/browser-extensions/firefox/panel.js +862 -0
- package/browser-extensions/firefox/popup.html +525 -0
- package/browser-extensions/firefox/popup.js +536 -0
- package/browser-extensions/firefox/test-gramercy.html +126 -0
- package/browser-extensions/firefox/test-imports.html +58 -0
- package/browser-extensions/firefox/test-masking.html +147 -0
- package/browser-extensions/firefox/test-uri-pattern.html +199 -0
- package/package.json +7 -2
- package/runtime/PortalContainer.vue +326 -0
- package/runtime/dev-tools/DevToolsModal.vue +217 -0
- package/runtime/dev-tools/LayoutSwitcher.vue +221 -0
- package/runtime/dev-tools/MockDataEditor.vue +621 -0
- package/runtime/dev-tools/SocketSimulator.vue +562 -0
- package/runtime/dev-tools/StoreInspector.vue +644 -0
- package/runtime/dev-tools/index.js +6 -0
- package/runtime/gxpStringsPlugin.js +428 -0
- package/runtime/index.html +22 -0
- package/runtime/main.js +32 -0
- package/runtime/mock-api/auth-middleware.js +97 -0
- package/runtime/mock-api/image-generator.js +221 -0
- package/runtime/mock-api/index.js +197 -0
- package/runtime/mock-api/response-generator.js +394 -0
- package/runtime/mock-api/route-generator.js +323 -0
- package/runtime/mock-api/socket-triggers.js +371 -0
- package/runtime/mock-api/spec-loader.js +300 -0
- package/runtime/server.js +180 -0
- package/runtime/stores/gxpPortalConfigStore.js +554 -0
- package/runtime/stores/index.js +6 -0
- package/runtime/vite-inspector-plugin.js +749 -0
- package/runtime/vite-source-tracker-plugin.js +232 -0
- package/runtime/vite.config.js +402 -0
- package/scripts/launch-chrome.js +90 -0
- package/scripts/pack-chrome.js +91 -0
- package/socket-events/AiSessionMessageCreated.json +18 -0
- package/socket-events/SocialStreamPostCreated.json +24 -0
- package/socket-events/SocialStreamPostVariantCompleted.json +23 -0
- package/template/README.md +332 -0
- package/template/app-manifest.json +32 -0
- package/template/dev-assets/images/avatar-placeholder.png +0 -0
- package/template/dev-assets/images/background-placeholder.jpg +0 -0
- package/template/dev-assets/images/banner-placeholder.jpg +0 -0
- package/template/dev-assets/images/icon-placeholder.png +0 -0
- package/template/dev-assets/images/logo-placeholder.png +0 -0
- package/template/dev-assets/images/product-placeholder.jpg +0 -0
- package/template/dev-assets/images/thumbnail-placeholder.jpg +0 -0
- package/template/env.example +51 -0
- package/template/gitignore +53 -0
- package/template/index.html +22 -0
- package/template/main.js +28 -0
- package/template/src/DemoPage.vue +459 -0
- package/template/src/Plugin.vue +38 -0
- package/template/src/stores/index.js +9 -0
- package/template/src/stores/test-data.json +173 -0
- package/template/theme-layouts/AdditionalStyling.css +0 -0
- package/template/theme-layouts/PrivateLayout.vue +39 -0
- package/template/theme-layouts/PublicLayout.vue +39 -0
- package/template/theme-layouts/SystemLayout.vue +39 -0
- package/template/vite.config.js +333 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Override fetch to intercept requests
|
|
2
|
+
(function () {
|
|
3
|
+
const originalFetch = window.fetch;
|
|
4
|
+
let isProxyEnabled = false;
|
|
5
|
+
let proxyConfig = {};
|
|
6
|
+
|
|
7
|
+
// Get initial state from background script
|
|
8
|
+
browser.runtime
|
|
9
|
+
.sendMessage({ action: "getConfig" })
|
|
10
|
+
.then((response) => {
|
|
11
|
+
if (response) {
|
|
12
|
+
isProxyEnabled = response.enabled;
|
|
13
|
+
proxyConfig = response;
|
|
14
|
+
console.log("[Traffic Proxy Content] Config received:", {
|
|
15
|
+
enabled: isProxyEnabled,
|
|
16
|
+
config: proxyConfig,
|
|
17
|
+
url: window.location.href,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
.catch((err) =>
|
|
22
|
+
console.error("[Traffic Proxy Content] Failed to get proxy config:", err)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// Listen for config changes
|
|
26
|
+
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
27
|
+
if (message.action === "configUpdate") {
|
|
28
|
+
isProxyEnabled = message.enabled;
|
|
29
|
+
proxyConfig = message.config;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Override fetch function
|
|
34
|
+
window.fetch = function (input, init) {
|
|
35
|
+
console.log("fetch", input, init);
|
|
36
|
+
if (!isProxyEnabled) {
|
|
37
|
+
return originalFetch.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let url = input;
|
|
41
|
+
if (typeof input === "object" && input.url) {
|
|
42
|
+
url = input.url;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Apply proxy rules
|
|
46
|
+
const modifiedUrl = applyProxyRules(url);
|
|
47
|
+
|
|
48
|
+
// If URL was modified, use the new URL
|
|
49
|
+
if (modifiedUrl !== url) {
|
|
50
|
+
if (typeof input === "string") {
|
|
51
|
+
input = modifiedUrl;
|
|
52
|
+
} else if (typeof input === "object") {
|
|
53
|
+
input = new Request(modifiedUrl, input);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return originalFetch.apply(this, arguments);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Apply proxy rules to URL
|
|
61
|
+
function applyProxyRules(url) {
|
|
62
|
+
if (!proxyConfig || !proxyConfig.rules) {
|
|
63
|
+
return url;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
// Check each rule type
|
|
68
|
+
for (const [ruleType, rule] of Object.entries(proxyConfig.rules)) {
|
|
69
|
+
if (!rule.enabled || !rule.pattern) continue;
|
|
70
|
+
|
|
71
|
+
const regex = new RegExp(rule.pattern, "i");
|
|
72
|
+
if (regex.test(url)) {
|
|
73
|
+
// Handle blank return for CSS
|
|
74
|
+
if (rule.returnBlank) {
|
|
75
|
+
console.log(
|
|
76
|
+
`[Traffic Proxy Content] Returning blank for ${ruleType}: ${url}`
|
|
77
|
+
);
|
|
78
|
+
return ruleType === "css"
|
|
79
|
+
? "data:text/css;charset=utf-8,"
|
|
80
|
+
: "data:text/javascript;charset=utf-8,";
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Handle redirect
|
|
84
|
+
if (rule.redirectUrl) {
|
|
85
|
+
console.log(
|
|
86
|
+
`[Traffic Proxy Content] Redirecting ${ruleType}: ${url} โ ${rule.redirectUrl}`
|
|
87
|
+
);
|
|
88
|
+
return rule.redirectUrl;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.log("Error processing URL for proxy rules:", url, e);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return url;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Override XMLHttpRequest as well
|
|
100
|
+
const originalXHROpen = XMLHttpRequest.prototype.open;
|
|
101
|
+
XMLHttpRequest.prototype.open = function (
|
|
102
|
+
method,
|
|
103
|
+
url,
|
|
104
|
+
async,
|
|
105
|
+
user,
|
|
106
|
+
password
|
|
107
|
+
) {
|
|
108
|
+
console.log("open", method, url, async, user, password);
|
|
109
|
+
if (isProxyEnabled) {
|
|
110
|
+
url = applyProxyRules(url);
|
|
111
|
+
}
|
|
112
|
+
return originalXHROpen.call(this, method, url, async, user, password);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Note: Dynamic imports (import('module')) are handled by the background script's webRequest API
|
|
116
|
+
// Static imports (import ... from 'module') are also handled by webRequest API
|
|
117
|
+
// This content script primarily handles fetch() and XHR calls
|
|
118
|
+
|
|
119
|
+
console.log("Traffic Proxy content script loaded");
|
|
120
|
+
})();
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Debug Proxy Errors</title>
|
|
5
|
+
<style>
|
|
6
|
+
body { font-family: Arial, sans-serif; padding: 20px; max-width: 1000px; }
|
|
7
|
+
.section { margin: 20px 0; padding: 20px; border: 2px solid #ddd; border-radius: 8px; }
|
|
8
|
+
.error { border-color: #dc3545; background: #fff5f5; }
|
|
9
|
+
.success { border-color: #28a745; background: #f8fff8; }
|
|
10
|
+
.warning { border-color: #ffc107; background: #fffbf0; }
|
|
11
|
+
.info { border-color: #17a2b8; background: #f0f9ff; }
|
|
12
|
+
.code { background: #e9ecef; padding: 8px; font-family: monospace; margin: 8px 0; word-break: break-all; }
|
|
13
|
+
.results { background: #f5f5f5; padding: 10px; margin: 10px 0; border-radius: 4px; max-height: 300px; overflow-y: auto; }
|
|
14
|
+
button { padding: 10px 15px; margin: 5px; cursor: pointer; background: #007bff; color: white; border: none; border-radius: 4px; }
|
|
15
|
+
.error-btn { background: #dc3545; }
|
|
16
|
+
.success-btn { background: #28a745; }
|
|
17
|
+
table { width: 100%; border-collapse: collapse; margin: 10px 0; }
|
|
18
|
+
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
|
19
|
+
th { background: #f8f9fa; }
|
|
20
|
+
</style>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<h1>๐ Debug Proxy Errors</h1>
|
|
24
|
+
|
|
25
|
+
<div class="section error">
|
|
26
|
+
<h2>โ Common Firefox Errors</h2>
|
|
27
|
+
<table>
|
|
28
|
+
<tr>
|
|
29
|
+
<th>Error</th>
|
|
30
|
+
<th>Meaning</th>
|
|
31
|
+
<th>Common Causes</th>
|
|
32
|
+
</tr>
|
|
33
|
+
<tr>
|
|
34
|
+
<td><code>ns_binding_aborted</code></td>
|
|
35
|
+
<td>Network request was cancelled</td>
|
|
36
|
+
<td>Redirect loops, Invalid redirects, Extension conflicts</td>
|
|
37
|
+
</tr>
|
|
38
|
+
<tr>
|
|
39
|
+
<td><code>ns_error_corrupted_content</code></td>
|
|
40
|
+
<td>Content corruption or invalid response</td>
|
|
41
|
+
<td>Header issues, CORS problems, Content-encoding conflicts</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td><code>ns_error_net_reset</code></td>
|
|
45
|
+
<td>Connection was reset</td>
|
|
46
|
+
<td>Server rejection, Proxy server issues</td>
|
|
47
|
+
</tr>
|
|
48
|
+
</table>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="section warning">
|
|
52
|
+
<h2>โ ๏ธ Quick Fixes</h2>
|
|
53
|
+
<ol>
|
|
54
|
+
<li><strong>Check for redirect loops:</strong> Make sure your redirect target doesn't match your pattern</li>
|
|
55
|
+
<li><strong>Use redirect mode first:</strong> Disable "Mask URL" to test basic functionality</li>
|
|
56
|
+
<li><strong>Test with simple domains:</strong> Try redirecting to a known working server first</li>
|
|
57
|
+
<li><strong>Check proxy server:</strong> Ensure your target server can handle the requests</li>
|
|
58
|
+
</ol>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="section info">
|
|
62
|
+
<h2>๐ Diagnostic Tests</h2>
|
|
63
|
+
<button onclick="checkExtensionStatus()">Check Extension Status</button>
|
|
64
|
+
<button onclick="testSimpleRedirect()">Test Simple Redirect</button>
|
|
65
|
+
<button onclick="testProblematicURL()">Test Problematic URL</button>
|
|
66
|
+
<button onclick="analyzeRules()">Analyze Rules for Loops</button>
|
|
67
|
+
<button class="error-btn" onclick="clearLogs()">Clear Logs</button>
|
|
68
|
+
<div id="diagnosticResults" class="results"></div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="section success">
|
|
72
|
+
<h2>โ
Troubleshooting Steps</h2>
|
|
73
|
+
<div id="troubleshootingSteps">
|
|
74
|
+
<h3>Step 1: Verify Extension State</h3>
|
|
75
|
+
<button onclick="runTroubleshootingStep(1)">Run Step 1</button>
|
|
76
|
+
<div id="step1Results" class="results"></div>
|
|
77
|
+
|
|
78
|
+
<h3>Step 2: Test Without Masking</h3>
|
|
79
|
+
<button onclick="runTroubleshootingStep(2)">Run Step 2</button>
|
|
80
|
+
<div id="step2Results" class="results"></div>
|
|
81
|
+
|
|
82
|
+
<h3>Step 3: Check for Redirect Loops</h3>
|
|
83
|
+
<button onclick="runTroubleshootingStep(3)">Run Step 3</button>
|
|
84
|
+
<div id="step3Results" class="results"></div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<script>
|
|
89
|
+
function log(elementId, message, type = 'info') {
|
|
90
|
+
const element = document.getElementById(elementId);
|
|
91
|
+
const timestamp = new Date().toLocaleTimeString();
|
|
92
|
+
const icon = type === 'error' ? 'โ' : type === 'success' ? 'โ
' : type === 'warning' ? 'โ ๏ธ' : 'โน๏ธ';
|
|
93
|
+
element.innerHTML += `<div>${timestamp} ${icon} ${message}</div>`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function clearLogs() {
|
|
97
|
+
const logElements = ['diagnosticResults', 'step1Results', 'step2Results', 'step3Results'];
|
|
98
|
+
logElements.forEach(id => {
|
|
99
|
+
const element = document.getElementById(id);
|
|
100
|
+
if (element) element.innerHTML = '';
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function checkExtensionStatus() {
|
|
105
|
+
log('diagnosticResults', 'Checking extension status...');
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
if (typeof browser === 'undefined') {
|
|
109
|
+
log('diagnosticResults', 'Browser API not available - extension not loaded', 'error');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const state = await browser.runtime.sendMessage({ action: 'getState' });
|
|
114
|
+
log('diagnosticResults', `Extension enabled: ${state.enabled}`, 'success');
|
|
115
|
+
log('diagnosticResults', `Number of rules: ${state.rules.length}`, 'info');
|
|
116
|
+
|
|
117
|
+
state.rules.forEach((rule, index) => {
|
|
118
|
+
log('diagnosticResults', `Rule ${index + 1}: ${rule.pattern} โ ${rule.redirect} (Mask: ${rule.maskUrl || false})`, 'info');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
} catch (error) {
|
|
122
|
+
log('diagnosticResults', `Extension communication failed: ${error.message}`, 'error');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function testSimpleRedirect() {
|
|
127
|
+
log('diagnosticResults', 'Testing simple redirect with known good server...');
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
// Test with a simple, reliable endpoint
|
|
131
|
+
const response = await fetch('https://httpbin.org/get?test=simple');
|
|
132
|
+
const data = await response.json();
|
|
133
|
+
log('diagnosticResults', `Simple test successful: ${response.status}`, 'success');
|
|
134
|
+
log('diagnosticResults', `Response URL: ${data.url}`, 'info');
|
|
135
|
+
} catch (error) {
|
|
136
|
+
log('diagnosticResults', `Simple test failed: ${error.message}`, 'error');
|
|
137
|
+
log('diagnosticResults', 'This suggests a configuration issue with your rules', 'warning');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function testProblematicURL() {
|
|
142
|
+
log('diagnosticResults', 'Testing the problematic gramercy.cloud URL...');
|
|
143
|
+
|
|
144
|
+
const testUrl = 'https://hilton-pop-art-cytz-dani-martin-hueg.gramercy.cloud/uploads/assets/test.png';
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
const response = await fetch(testUrl);
|
|
148
|
+
log('diagnosticResults', `Gramercy test: ${response.status} ${response.statusText}`, 'success');
|
|
149
|
+
} catch (error) {
|
|
150
|
+
log('diagnosticResults', `Gramercy test failed: ${error.message}`, 'error');
|
|
151
|
+
|
|
152
|
+
if (error.message.includes('ns_binding_aborted')) {
|
|
153
|
+
log('diagnosticResults', 'โ Likely cause: Redirect loop or invalid redirect target', 'warning');
|
|
154
|
+
} else if (error.message.includes('ns_error_corrupted_content')) {
|
|
155
|
+
log('diagnosticResults', 'โ Likely cause: Header modification issues or server response problems', 'warning');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function analyzeRules() {
|
|
161
|
+
log('diagnosticResults', 'Analyzing rules for potential problems...');
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
const state = await browser.runtime.sendMessage({ action: 'getState' });
|
|
165
|
+
const rules = state.rules;
|
|
166
|
+
|
|
167
|
+
if (rules.length === 0) {
|
|
168
|
+
log('diagnosticResults', 'No rules configured', 'warning');
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Check for redirect loops
|
|
173
|
+
rules.forEach((rule, index) => {
|
|
174
|
+
const pattern = new RegExp(rule.pattern, 'i');
|
|
175
|
+
|
|
176
|
+
// Check if redirect target matches the pattern
|
|
177
|
+
if (pattern.test(rule.redirect)) {
|
|
178
|
+
log('diagnosticResults', `โ ๏ธ LOOP DETECTED: Rule ${index + 1} redirects to a domain that matches its own pattern!`, 'error');
|
|
179
|
+
log('diagnosticResults', ` Pattern: ${rule.pattern}`, 'error');
|
|
180
|
+
log('diagnosticResults', ` Redirect: ${rule.redirect}`, 'error');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Check if redirect target matches other patterns
|
|
184
|
+
rules.forEach((otherRule, otherIndex) => {
|
|
185
|
+
if (index !== otherIndex) {
|
|
186
|
+
const otherPattern = new RegExp(otherRule.pattern, 'i');
|
|
187
|
+
if (otherPattern.test(rule.redirect)) {
|
|
188
|
+
log('diagnosticResults', `โ ๏ธ CHAIN DETECTED: Rule ${index + 1} redirects to domain that matches Rule ${otherIndex + 1}`, 'warning');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
log('diagnosticResults', 'Rule analysis complete', 'success');
|
|
195
|
+
|
|
196
|
+
} catch (error) {
|
|
197
|
+
log('diagnosticResults', `Rule analysis failed: ${error.message}`, 'error');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async function runTroubleshootingStep(step) {
|
|
202
|
+
const resultId = `step${step}Results`;
|
|
203
|
+
|
|
204
|
+
switch (step) {
|
|
205
|
+
case 1:
|
|
206
|
+
log(resultId, 'Verifying extension state...');
|
|
207
|
+
await checkExtensionStatus();
|
|
208
|
+
break;
|
|
209
|
+
|
|
210
|
+
case 2:
|
|
211
|
+
log(resultId, 'Testing redirect mode (non-masking)...');
|
|
212
|
+
log(resultId, '1. Disable all "Mask URL" checkboxes in extension popup', 'info');
|
|
213
|
+
log(resultId, '2. Disable "URL Masking Mode" toggle', 'info');
|
|
214
|
+
log(resultId, '3. Try your request again', 'info');
|
|
215
|
+
log(resultId, '4. If it works, the issue is with masking mode', 'warning');
|
|
216
|
+
break;
|
|
217
|
+
|
|
218
|
+
case 3:
|
|
219
|
+
log(resultId, 'Checking for redirect loops...');
|
|
220
|
+
await analyzeRules();
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Auto-run extension check on page load
|
|
226
|
+
window.addEventListener('load', checkExtensionStatus);
|
|
227
|
+
</script>
|
|
228
|
+
</body>
|
|
229
|
+
</html>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Debug HTTPS Traffic Interception</title>
|
|
5
|
+
<style>
|
|
6
|
+
body { font-family: Arial, sans-serif; padding: 20px; }
|
|
7
|
+
.test-section { margin: 20px 0; padding: 15px; border: 1px solid #ccc; }
|
|
8
|
+
.log { background: #f5f5f5; padding: 10px; margin: 10px 0; }
|
|
9
|
+
button { padding: 10px 15px; margin: 5px; }
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<h1>Debug HTTPS Traffic Interception</h1>
|
|
14
|
+
|
|
15
|
+
<div class="test-section">
|
|
16
|
+
<h3>Step 1: Extension Status Check</h3>
|
|
17
|
+
<button onclick="checkExtension()">Check Extension</button>
|
|
18
|
+
<div id="extensionStatus" class="log"></div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="test-section">
|
|
22
|
+
<h3>Step 2: Test Different Request Types</h3>
|
|
23
|
+
<button onclick="testFetch()">Test Fetch</button>
|
|
24
|
+
<button onclick="testXHR()">Test XHR</button>
|
|
25
|
+
<button onclick="testDynamicImport()">Test Dynamic Import</button>
|
|
26
|
+
<button onclick="testImageLoad()">Test Image Load</button>
|
|
27
|
+
<div id="requestResults" class="log"></div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="test-section">
|
|
31
|
+
<h3>Step 3: Console Logs</h3>
|
|
32
|
+
<p>Open DevTools Console to see detailed logs from:</p>
|
|
33
|
+
<ul>
|
|
34
|
+
<li><strong>Background Script:</strong> Look for "[Traffic Proxy]" messages</li>
|
|
35
|
+
<li><strong>Content Script:</strong> Look for "[Traffic Proxy Content]" messages</li>
|
|
36
|
+
</ul>
|
|
37
|
+
<p><strong>Expected test domains:</strong> httpbin.org, api.github.com, cdn.jsdelivr.net</p>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
function log(elementId, message) {
|
|
42
|
+
const element = document.getElementById(elementId);
|
|
43
|
+
const timestamp = new Date().toLocaleTimeString();
|
|
44
|
+
element.innerHTML += `<div>${timestamp}: ${message}</div>`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function checkExtension() {
|
|
48
|
+
const status = document.getElementById('extensionStatus');
|
|
49
|
+
status.innerHTML = '';
|
|
50
|
+
|
|
51
|
+
log('extensionStatus', '๐ Checking extension status...');
|
|
52
|
+
|
|
53
|
+
// Check if browser API is available
|
|
54
|
+
if (typeof browser === 'undefined') {
|
|
55
|
+
log('extensionStatus', 'โ Browser API not available - extension not loaded properly');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
// Try to communicate with background script
|
|
61
|
+
const response = await browser.runtime.sendMessage({ action: 'getState' });
|
|
62
|
+
log('extensionStatus', `โ
Extension responding: Enabled=${response.enabled}, Rules=${response.rules.length}`);
|
|
63
|
+
|
|
64
|
+
if (response.rules.length === 0) {
|
|
65
|
+
log('extensionStatus', 'โ ๏ธ No proxy rules configured. Add some rules to test interception.');
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
log('extensionStatus', `โ Failed to communicate with extension: ${error.message}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function testFetch() {
|
|
73
|
+
log('requestResults', '๐งช Testing fetch to httpbin.org...');
|
|
74
|
+
try {
|
|
75
|
+
const response = await fetch('https://httpbin.org/get?test=fetch');
|
|
76
|
+
log('requestResults', `โ
Fetch successful: ${response.status} ${response.statusText}`);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
log('requestResults', `โ Fetch failed: ${error.message}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function testXHR() {
|
|
83
|
+
log('requestResults', '๐งช Testing XHR to api.github.com...');
|
|
84
|
+
const xhr = new XMLHttpRequest();
|
|
85
|
+
xhr.onload = () => log('requestResults', `โ
XHR successful: ${xhr.status} ${xhr.statusText}`);
|
|
86
|
+
xhr.onerror = () => log('requestResults', `โ XHR failed`);
|
|
87
|
+
xhr.open('GET', 'https://api.github.com/zen');
|
|
88
|
+
xhr.send();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function testDynamicImport() {
|
|
92
|
+
log('requestResults', '๐งช Testing dynamic import from cdn.jsdelivr.net...');
|
|
93
|
+
try {
|
|
94
|
+
const module = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/isNull.js');
|
|
95
|
+
log('requestResults', `โ
Dynamic import successful`);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
log('requestResults', `โ Dynamic import failed: ${error.message}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function testImageLoad() {
|
|
102
|
+
log('requestResults', '๐งช Testing image load from httpbin.org...');
|
|
103
|
+
const img = new Image();
|
|
104
|
+
img.onload = () => log('requestResults', `โ
Image load successful`);
|
|
105
|
+
img.onerror = () => log('requestResults', `โ Image load failed`);
|
|
106
|
+
img.src = 'https://httpbin.org/image/png';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Auto-run extension check on page load
|
|
110
|
+
window.addEventListener('load', checkExtension);
|
|
111
|
+
</script>
|
|
112
|
+
</body>
|
|
113
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Create the GxP DevTools panel
|
|
2
|
+
// Firefox uses the same API as Chrome for creating panels
|
|
3
|
+
browser.devtools.panels.create(
|
|
4
|
+
"GxP Inspector", // Panel title
|
|
5
|
+
"icons/gx_on_32.png", // Icon path (32x32)
|
|
6
|
+
"panel.html" // Panel HTML page
|
|
7
|
+
).then(function(panel) {
|
|
8
|
+
// Panel created callback
|
|
9
|
+
console.log("GxP Inspector panel created");
|
|
10
|
+
|
|
11
|
+
// Optional: Handle panel show/hide events
|
|
12
|
+
panel.onShown.addListener(function(panelWindow) {
|
|
13
|
+
// Panel is now visible
|
|
14
|
+
if (panelWindow.panelShown) {
|
|
15
|
+
panelWindow.panelShown();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
panel.onHidden.addListener(function() {
|
|
20
|
+
// Panel is now hidden
|
|
21
|
+
});
|
|
22
|
+
}).catch(function(error) {
|
|
23
|
+
console.error("Failed to create GxP Inspector panel:", error);
|
|
24
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|