@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.
Files changed (100) hide show
  1. package/bin/lib/commands/build.js +18 -12
  2. package/browser-extensions/README.md +1 -0
  3. package/browser-extensions/chrome/background.js +857 -0
  4. package/browser-extensions/chrome/content.js +51 -0
  5. package/browser-extensions/chrome/devtools.html +9 -0
  6. package/browser-extensions/chrome/devtools.js +23 -0
  7. package/browser-extensions/chrome/icons/gx_off_128.png +0 -0
  8. package/browser-extensions/chrome/icons/gx_off_16.png +0 -0
  9. package/browser-extensions/chrome/icons/gx_off_32.png +0 -0
  10. package/browser-extensions/chrome/icons/gx_off_64.png +0 -0
  11. package/browser-extensions/chrome/icons/gx_on_128.png +0 -0
  12. package/browser-extensions/chrome/icons/gx_on_16.png +0 -0
  13. package/browser-extensions/chrome/icons/gx_on_32.png +0 -0
  14. package/browser-extensions/chrome/icons/gx_on_64.png +0 -0
  15. package/browser-extensions/chrome/inspector.js +1087 -0
  16. package/browser-extensions/chrome/manifest.json +70 -0
  17. package/browser-extensions/chrome/panel.html +638 -0
  18. package/browser-extensions/chrome/panel.js +862 -0
  19. package/browser-extensions/chrome/popup.html +399 -0
  20. package/browser-extensions/chrome/popup.js +515 -0
  21. package/browser-extensions/chrome/rules.json +1 -0
  22. package/browser-extensions/chrome/test-chrome.html +145 -0
  23. package/browser-extensions/chrome/test-mixed-content.html +190 -0
  24. package/browser-extensions/chrome/test-uri-pattern.html +199 -0
  25. package/browser-extensions/firefox/README.md +134 -0
  26. package/browser-extensions/firefox/background.js +804 -0
  27. package/browser-extensions/firefox/content.js +120 -0
  28. package/browser-extensions/firefox/debug-errors.html +229 -0
  29. package/browser-extensions/firefox/debug-https.html +113 -0
  30. package/browser-extensions/firefox/devtools.html +9 -0
  31. package/browser-extensions/firefox/devtools.js +24 -0
  32. package/browser-extensions/firefox/icons/gx_off_128.png +0 -0
  33. package/browser-extensions/firefox/icons/gx_off_16.png +0 -0
  34. package/browser-extensions/firefox/icons/gx_off_32.png +0 -0
  35. package/browser-extensions/firefox/icons/gx_off_64.png +0 -0
  36. package/browser-extensions/firefox/icons/gx_on_128.png +0 -0
  37. package/browser-extensions/firefox/icons/gx_on_16.png +0 -0
  38. package/browser-extensions/firefox/icons/gx_on_32.png +0 -0
  39. package/browser-extensions/firefox/icons/gx_on_64.png +0 -0
  40. package/browser-extensions/firefox/inspector.js +1087 -0
  41. package/browser-extensions/firefox/manifest.json +67 -0
  42. package/browser-extensions/firefox/panel.html +638 -0
  43. package/browser-extensions/firefox/panel.js +862 -0
  44. package/browser-extensions/firefox/popup.html +525 -0
  45. package/browser-extensions/firefox/popup.js +536 -0
  46. package/browser-extensions/firefox/test-gramercy.html +126 -0
  47. package/browser-extensions/firefox/test-imports.html +58 -0
  48. package/browser-extensions/firefox/test-masking.html +147 -0
  49. package/browser-extensions/firefox/test-uri-pattern.html +199 -0
  50. package/package.json +7 -2
  51. package/runtime/PortalContainer.vue +326 -0
  52. package/runtime/dev-tools/DevToolsModal.vue +217 -0
  53. package/runtime/dev-tools/LayoutSwitcher.vue +221 -0
  54. package/runtime/dev-tools/MockDataEditor.vue +621 -0
  55. package/runtime/dev-tools/SocketSimulator.vue +562 -0
  56. package/runtime/dev-tools/StoreInspector.vue +644 -0
  57. package/runtime/dev-tools/index.js +6 -0
  58. package/runtime/gxpStringsPlugin.js +428 -0
  59. package/runtime/index.html +22 -0
  60. package/runtime/main.js +32 -0
  61. package/runtime/mock-api/auth-middleware.js +97 -0
  62. package/runtime/mock-api/image-generator.js +221 -0
  63. package/runtime/mock-api/index.js +197 -0
  64. package/runtime/mock-api/response-generator.js +394 -0
  65. package/runtime/mock-api/route-generator.js +323 -0
  66. package/runtime/mock-api/socket-triggers.js +371 -0
  67. package/runtime/mock-api/spec-loader.js +300 -0
  68. package/runtime/server.js +180 -0
  69. package/runtime/stores/gxpPortalConfigStore.js +554 -0
  70. package/runtime/stores/index.js +6 -0
  71. package/runtime/vite-inspector-plugin.js +749 -0
  72. package/runtime/vite-source-tracker-plugin.js +232 -0
  73. package/runtime/vite.config.js +402 -0
  74. package/scripts/launch-chrome.js +90 -0
  75. package/scripts/pack-chrome.js +91 -0
  76. package/socket-events/AiSessionMessageCreated.json +18 -0
  77. package/socket-events/SocialStreamPostCreated.json +24 -0
  78. package/socket-events/SocialStreamPostVariantCompleted.json +23 -0
  79. package/template/README.md +332 -0
  80. package/template/app-manifest.json +32 -0
  81. package/template/dev-assets/images/avatar-placeholder.png +0 -0
  82. package/template/dev-assets/images/background-placeholder.jpg +0 -0
  83. package/template/dev-assets/images/banner-placeholder.jpg +0 -0
  84. package/template/dev-assets/images/icon-placeholder.png +0 -0
  85. package/template/dev-assets/images/logo-placeholder.png +0 -0
  86. package/template/dev-assets/images/product-placeholder.jpg +0 -0
  87. package/template/dev-assets/images/thumbnail-placeholder.jpg +0 -0
  88. package/template/env.example +51 -0
  89. package/template/gitignore +53 -0
  90. package/template/index.html +22 -0
  91. package/template/main.js +28 -0
  92. package/template/src/DemoPage.vue +459 -0
  93. package/template/src/Plugin.vue +38 -0
  94. package/template/src/stores/index.js +9 -0
  95. package/template/src/stores/test-data.json +173 -0
  96. package/template/theme-layouts/AdditionalStyling.css +0 -0
  97. package/template/theme-layouts/PrivateLayout.vue +39 -0
  98. package/template/theme-layouts/PublicLayout.vue +39 -0
  99. package/template/theme-layouts/SystemLayout.vue +39 -0
  100. package/template/vite.config.js +333 -0
@@ -0,0 +1,190 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Mixed Content Proxy Test</title>
5
+ <style>
6
+ body { font-family: Arial, sans-serif; padding: 20px; max-width: 800px; }
7
+ .test-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
+ .status-indicator { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; }
16
+ .blocked { background: #dc3545; }
17
+ .allowed { background: #28a745; }
18
+ .warning-icon { background: #ffc107; }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <h1>🔒 Mixed Content Proxy Test</h1>
23
+
24
+ <div class="test-section info">
25
+ <h2>🌐 Current Page Security</h2>
26
+ <div id="pageInfo"></div>
27
+ <div class="code" id="currentUrl"></div>
28
+ </div>
29
+
30
+ <div class="test-section warning">
31
+ <h2>⚠️ Mixed Content Policy</h2>
32
+ <p><strong>Browser Security Rule:</strong> HTTPS pages cannot make requests to HTTP endpoints</p>
33
+ <ul>
34
+ <li><span class="status-indicator blocked"></span><strong>BLOCKED:</strong> HTTPS → HTTP (Subresources)</li>
35
+ <li><span class="status-indicator warning-icon"></span><strong>WARNING:</strong> HTTPS → HTTP (Navigation)</li>
36
+ <li><span class="status-indicator allowed"></span><strong>ALLOWED:</strong> HTTPS → HTTPS</li>
37
+ <li><span class="status-indicator allowed"></span><strong>ALLOWED:</strong> HTTP → HTTP</li>
38
+ </ul>
39
+ </div>
40
+
41
+ <div class="test-section">
42
+ <h2>🧪 Mixed Content Tests</h2>
43
+ <button onclick="testHttpsToHttp()">Test HTTPS → HTTP Fetch</button>
44
+ <button onclick="testHttpsToHttps()">Test HTTPS → HTTPS Fetch</button>
45
+ <button onclick="testImageLoad()">Test HTTP Image Load</button>
46
+ <button onclick="testScriptLoad()">Test HTTP Script Load</button>
47
+ <div id="testResults" class="results"></div>
48
+ </div>
49
+
50
+ <div class="test-section error">
51
+ <h2>❌ Common Scenarios That Fail</h2>
52
+ <div class="code">
53
+ # Page: https://example.com<br>
54
+ # Proxy rule: api.service.com → http://my-proxy.local:8080<br>
55
+ # Result: ❌ BLOCKED - Mixed content violation
56
+ </div>
57
+ </div>
58
+
59
+ <div class="test-section success">
60
+ <h2>✅ Working Solutions</h2>
61
+ <h3>Option 1: Use HTTPS for Proxy Target</h3>
62
+ <div class="code">
63
+ # Proxy rule: api.service.com → https://my-proxy.com<br>
64
+ # Result: ✅ WORKS - Both HTTPS
65
+ </div>
66
+
67
+ <h3>Option 2: Setup HTTPS on Local Proxy</h3>
68
+ <div class="code">
69
+ # Use mkcert or similar to create local HTTPS<br>
70
+ # Proxy rule: api.service.com → https://localhost:8443<br>
71
+ # Result: ✅ WORKS - HTTPS to HTTPS
72
+ </div>
73
+
74
+ <h3>Option 3: Browser Flags (Development Only)</h3>
75
+ <div class="code">
76
+ # Chrome: --disable-web-security --disable-features=VizDisplayCompositor<br>
77
+ # Firefox: security.mixed_content.block_active_content = false<br>
78
+ # Result: ⚠️ WORKS but INSECURE
79
+ </div>
80
+ </div>
81
+
82
+ <div class="test-section info">
83
+ <h2>🔧 Extension Capabilities</h2>
84
+ <table style="width: 100%; border-collapse: collapse;">
85
+ <tr style="background: #f8f9fa;">
86
+ <th style="border: 1px solid #ddd; padding: 8px;">Request Type</th>
87
+ <th style="border: 1px solid #ddd; padding: 8px;">HTTPS → HTTP</th>
88
+ <th style="border: 1px solid #ddd; padding: 8px;">Extension Override</th>
89
+ </tr>
90
+ <tr>
91
+ <td style="border: 1px solid #ddd; padding: 8px;">Main Frame Navigation</td>
92
+ <td style="border: 1px solid #ddd; padding: 8px;">⚠️ Warning shown</td>
93
+ <td style="border: 1px solid #ddd; padding: 8px;">✅ Can redirect</td>
94
+ </tr>
95
+ <tr>
96
+ <td style="border: 1px solid #ddd; padding: 8px;">fetch() / XHR</td>
97
+ <td style="border: 1px solid #ddd; padding: 8px;">❌ Blocked</td>
98
+ <td style="border: 1px solid #ddd; padding: 8px;">❌ Still blocked</td>
99
+ </tr>
100
+ <tr>
101
+ <td style="border: 1px solid #ddd; padding: 8px;">Images / CSS</td>
102
+ <td style="border: 1px solid #ddd; padding: 8px;">❌ Blocked</td>
103
+ <td style="border: 1px solid #ddd; padding: 8px;">❌ Still blocked</td>
104
+ </tr>
105
+ <tr>
106
+ <td style="border: 1px solid #ddd; padding: 8px;">Scripts / Modules</td>
107
+ <td style="border: 1px solid #ddd; padding: 8px;">❌ Blocked</td>
108
+ <td style="border: 1px solid #ddd; padding: 8px;">❌ Still blocked</td>
109
+ </tr>
110
+ </table>
111
+ </div>
112
+
113
+ <script>
114
+ function log(message, type = 'info') {
115
+ const results = document.getElementById('testResults');
116
+ const timestamp = new Date().toLocaleTimeString();
117
+ const icon = type === 'error' ? '❌' : type === 'success' ? '✅' : type === 'warning' ? '⚠️' : 'ℹ️';
118
+ results.innerHTML += `<div>${timestamp} ${icon} ${message}</div>`;
119
+ }
120
+
121
+ function updatePageInfo() {
122
+ const protocol = window.location.protocol;
123
+ const isHttps = protocol === 'https:';
124
+ const pageInfo = document.getElementById('pageInfo');
125
+ const currentUrl = document.getElementById('currentUrl');
126
+
127
+ pageInfo.innerHTML = `
128
+ <strong>Protocol:</strong> ${protocol} ${isHttps ? '🔒 Secure' : '🔓 Insecure'}<br>
129
+ <strong>Mixed Content Policy:</strong> ${isHttps ? '✅ Active' : '➖ Not applicable'}
130
+ `;
131
+ currentUrl.textContent = window.location.href;
132
+ }
133
+
134
+ async function testHttpsToHttp() {
135
+ log('Testing HTTPS page → HTTP endpoint...');
136
+
137
+ try {
138
+ const response = await fetch('http://httpbin.org/get?test=mixed-content');
139
+ log(`✅ Request succeeded: ${response.status}`, 'success');
140
+ } catch (error) {
141
+ if (error.message.includes('mixed content')) {
142
+ log(`❌ Mixed content blocked: ${error.message}`, 'error');
143
+ } else {
144
+ log(`❌ Request failed: ${error.message}`, 'error');
145
+ }
146
+ }
147
+ }
148
+
149
+ async function testHttpsToHttps() {
150
+ log('Testing HTTPS page → HTTPS endpoint...');
151
+
152
+ try {
153
+ const response = await fetch('https://httpbin.org/get?test=secure');
154
+ log(`✅ Request succeeded: ${response.status}`, 'success');
155
+ } catch (error) {
156
+ log(`❌ Request failed: ${error.message}`, 'error');
157
+ }
158
+ }
159
+
160
+ function testImageLoad() {
161
+ log('Testing HTTP image load...');
162
+
163
+ const img = new Image();
164
+ img.onload = () => log('✅ HTTP image loaded successfully', 'success');
165
+ img.onerror = () => log('❌ HTTP image blocked by mixed content policy', 'error');
166
+ img.src = 'http://httpbin.org/image/png?test=image';
167
+ }
168
+
169
+ function testScriptLoad() {
170
+ log('Testing HTTP script load...');
171
+
172
+ const script = document.createElement('script');
173
+ script.onload = () => log('✅ HTTP script loaded successfully', 'success');
174
+ script.onerror = () => log('❌ HTTP script blocked by mixed content policy', 'error');
175
+ script.src = 'http://httpbin.org/base64/Y29uc29sZS5sb2coJ0hUVFAgc2NyaXB0IGxvYWRlZCcpOw==';
176
+ document.head.appendChild(script);
177
+ }
178
+
179
+ // Initialize page
180
+ updatePageInfo();
181
+
182
+ // Show initial warning if on HTTPS
183
+ if (window.location.protocol === 'https:') {
184
+ log('⚠️ This is an HTTPS page. HTTP requests will be blocked by mixed content policy.', 'warning');
185
+ } else {
186
+ log('ℹ️ This is an HTTP page. No mixed content restrictions apply.', 'info');
187
+ }
188
+ </script>
189
+ </body>
190
+ </html>
@@ -0,0 +1,199 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>JavaScript Proxy URI Pattern Test</title>
7
+ <style>
8
+ body {
9
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
10
+ max-width: 800px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ background: #f8f9fa;
14
+ }
15
+ .container {
16
+ background: white;
17
+ padding: 30px;
18
+ border-radius: 8px;
19
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
20
+ }
21
+ h1 {
22
+ color: #333;
23
+ margin-bottom: 30px;
24
+ }
25
+ .test-section {
26
+ margin-bottom: 30px;
27
+ padding: 20px;
28
+ border: 1px solid #e9ecef;
29
+ border-radius: 6px;
30
+ }
31
+ .test-section h3 {
32
+ margin-top: 0;
33
+ color: #495057;
34
+ }
35
+ .url-test {
36
+ margin: 10px 0;
37
+ padding: 10px;
38
+ background: #f8f9fa;
39
+ border-left: 4px solid #007bff;
40
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
41
+ font-size: 13px;
42
+ word-break: break-all;
43
+ }
44
+ .should-match {
45
+ border-left-color: #28a745;
46
+ }
47
+ .should-not-match {
48
+ border-left-color: #dc3545;
49
+ }
50
+ button {
51
+ background: #007bff;
52
+ color: white;
53
+ border: none;
54
+ padding: 10px 20px;
55
+ border-radius: 4px;
56
+ cursor: pointer;
57
+ margin: 5px;
58
+ }
59
+ button:hover {
60
+ background: #0056b3;
61
+ }
62
+ .status {
63
+ margin-top: 20px;
64
+ padding: 15px;
65
+ border-radius: 4px;
66
+ font-weight: bold;
67
+ }
68
+ .success {
69
+ background: #d4edda;
70
+ color: #155724;
71
+ border: 1px solid #c3e6cb;
72
+ }
73
+ .error {
74
+ background: #f8d7da;
75
+ color: #721c24;
76
+ border: 1px solid #f5c6cb;
77
+ }
78
+ </style>
79
+ </head>
80
+ <body>
81
+ <div class="container">
82
+ <h1>JavaScript Proxy URI Pattern Test</h1>
83
+
84
+ <div class="test-section">
85
+ <h3>Default Pattern</h3>
86
+ <p>Default pattern: <code>uploads\/plugin-version\/\d+\/file_name\/.*\.js(\?.*)?</code></p>
87
+ <p>This should match JavaScript files in the uploads/plugin-version/* path on any domain.</p>
88
+ </div>
89
+
90
+ <div class="test-section">
91
+ <h3>URLs That Should Match (Will Redirect)</h3>
92
+
93
+ <div class="url-test should-match">
94
+ https://example.com/uploads/plugin-version/123/file_name/script.js
95
+ </div>
96
+
97
+ <div class="url-test should-match">
98
+ https://westernightwall.zenith-develop.env.eventfinity.app/uploads/plugin-version/3/file_name/T9OvqS1727804478.js
99
+ </div>
100
+
101
+ <div class="url-test should-match">
102
+ https://different-domain.com/uploads/plugin-version/456/file_name/myfile.js?signature=abc123&expires=789
103
+ </div>
104
+
105
+ <div class="url-test should-match">
106
+ https://api.staging.example.org/uploads/plugin-version/999/file_name/component.js?token=xyz
107
+ </div>
108
+ </div>
109
+
110
+ <div class="test-section">
111
+ <h3>URLs That Should NOT Match (No Redirect)</h3>
112
+
113
+ <div class="url-test should-not-match">
114
+ https://example.com/uploads/versions/123/file_name/script.js
115
+ <small>(different path: versions instead of plugin-version)</small>
116
+ </div>
117
+
118
+ <div class="url-test should-not-match">
119
+ https://example.com/uploads/plugin-version/123/file_name/style.css
120
+ <small>(not a .js file)</small>
121
+ </div>
122
+
123
+ <div class="url-test should-not-match">
124
+ https://example.com/other-path/plugin-version/123/file_name/script.js
125
+ <small>(wrong base path)</small>
126
+ </div>
127
+
128
+ <div class="url-test should-not-match">
129
+ https://localhost:3060/src/Plugin.vue
130
+ <small>(localhost - prevent redirect loops)</small>
131
+ </div>
132
+ </div>
133
+
134
+ <div class="test-section">
135
+ <h3>Test Actions</h3>
136
+ <p>Click the buttons below to test loading JavaScript files:</p>
137
+
138
+ <button onclick="testUrl('https://example.com/uploads/plugin-version/123/file_name/test.js')">
139
+ Test Matching URL
140
+ </button>
141
+
142
+ <button onclick="testUrl('https://example.com/uploads/plugin-version/456/file_name/test.js?signed=true')">
143
+ Test Matching URL with Query
144
+ </button>
145
+
146
+ <button onclick="testUrl('https://example.com/other-path/test.js')">
147
+ Test Non-Matching URL
148
+ </button>
149
+
150
+ <div id="status"></div>
151
+ </div>
152
+
153
+ <div class="test-section">
154
+ <h3>Instructions</h3>
155
+ <ol>
156
+ <li>Install and enable the JavaScript Proxy extension</li>
157
+ <li>Configure it to redirect to your local development server</li>
158
+ <li>Open browser developer tools to see network requests</li>
159
+ <li>Click the test buttons above to see which URLs get redirected</li>
160
+ <li>URLs matching the pattern should redirect to your local server</li>
161
+ <li>URLs not matching should load normally (and probably fail)</li>
162
+ </ol>
163
+ </div>
164
+ </div>
165
+
166
+ <script>
167
+ function testUrl(url) {
168
+ const status = document.getElementById('status');
169
+ status.innerHTML = `<div class="status">Testing: ${url}</div>`;
170
+
171
+ // Create a script element to test the URL
172
+ const script = document.createElement('script');
173
+ script.src = url;
174
+
175
+ script.onload = function() {
176
+ status.innerHTML = `<div class="status success">✅ Successfully loaded: ${url}</div>`;
177
+ };
178
+
179
+ script.onerror = function() {
180
+ status.innerHTML = `<div class="status error">❌ Failed to load: ${url}<br><small>This is expected for test URLs that don't exist</small></div>`;
181
+ };
182
+
183
+ // Add to page to trigger the request
184
+ document.head.appendChild(script);
185
+
186
+ // Remove after a short delay
187
+ setTimeout(() => {
188
+ if (script.parentNode) {
189
+ script.parentNode.removeChild(script);
190
+ }
191
+ }, 5000);
192
+ }
193
+
194
+ // Log current page URL for reference
195
+ console.log('Test page URL:', window.location.href);
196
+ console.log('Use browser dev tools to monitor network requests and see proxy behavior');
197
+ </script>
198
+ </body>
199
+ </html>
@@ -0,0 +1,134 @@
1
+ # Traffic Proxy Firefox Extension
2
+
3
+ A Firefox extension that intercepts and redirects web traffic to alternative domains based on configurable regex patterns.
4
+
5
+ ## Features
6
+
7
+ - 🔄 **Traffic Interception**: Intercepts fetch calls and XMLHttpRequests
8
+ - 🎯 **Regex Pattern Matching**: Flexible domain matching using regular expressions
9
+ - 🔴🟢 **Visual Toggle**: Red/green toolbar button indicating proxy status
10
+ - ⚙️ **Settings Panel**: Easy-to-use interface for managing proxy rules
11
+ - 🔔 **Notifications**: Real-time notifications when traffic is being proxied
12
+ - 💾 **Persistent Storage**: Rules and settings are saved between browser sessions
13
+
14
+ ## Installation
15
+
16
+ ### Method 1: Temporary Installation (Development)
17
+
18
+ 1. Open Firefox and navigate to `about:debugging`
19
+ 2. Click "This Firefox" on the left sidebar
20
+ 3. Click "Load Temporary Add-on"
21
+ 4. Navigate to the extension folder and select `manifest.json`
22
+
23
+ ### Method 2: Creating an XPI Package
24
+
25
+ 1. Zip all extension files:
26
+ ```bash
27
+ zip -r traffic-proxy-extension.xpi manifest.json background.js content.js popup.html popup.js icons/
28
+ ```
29
+ 2. Install the XPI file through Firefox's Add-ons manager
30
+
31
+ ## Icon Setup
32
+
33
+ The extension includes SVG icon files that need to be converted to PNG format:
34
+
35
+ 1. Open `icons/create_icons.html` in your browser
36
+ 2. Click the download buttons to get PNG files
37
+ 3. Save them in the `icons/` directory with the correct names
38
+
39
+ Alternatively, use an online SVG to PNG converter for the files in `icons/`.
40
+
41
+ ## Usage
42
+
43
+ ### Enabling the Proxy
44
+
45
+ 1. Look for the Traffic Proxy button in your Firefox toolbar
46
+ 2. Click the button to open the settings panel
47
+ 3. Click the toggle button to enable/disable the proxy
48
+ - 🔴 Red = OFF
49
+ - 🟢 Green = ON
50
+
51
+ ### Adding Proxy Rules
52
+
53
+ 1. Open the extension settings panel
54
+ 2. Click "+ Add Rule"
55
+ 3. Enter a regex pattern for the domain to intercept (e.g., `api\.example\.com`)
56
+ 4. Enter the redirect domain (e.g., `api.alternative.com`)
57
+ 5. Click "Save Changes"
58
+
59
+ ### Example Rules
60
+
61
+ | Pattern | Redirect To | Description |
62
+ |---------|-------------|-------------|
63
+ | `api\.example\.com` | `api.alternative.com` | Redirect all API calls from example.com to alternative.com |
64
+ | `.*\.googleapis\.com` | `api.myproxy.com` | Redirect all Google API calls to your proxy server |
65
+ | `cdn\.jsdelivr\.net` | `my-cdn.example.com` | Redirect CDN requests to your own server |
66
+
67
+ ## How It Works
68
+
69
+ 1. **Background Script**: Handles webRequest interception and manages extension state
70
+ 2. **Content Script**: Intercepts JavaScript fetch() and XMLHttpRequest calls
71
+ 3. **Popup Interface**: Provides user interface for configuration
72
+ 4. **Storage**: Saves rules and settings using Firefox's local storage API
73
+
74
+ ## Permissions
75
+
76
+ The extension requires the following permissions:
77
+
78
+ - `webRequest` & `webRequestBlocking`: To intercept and modify network requests
79
+ - `<all_urls>`: To intercept requests from any website
80
+ - `storage`: To save proxy rules and settings
81
+ - `notifications`: To show proxy activity notifications
82
+ - `activeTab`: To access the current tab information
83
+
84
+ ## Development
85
+
86
+ ### File Structure
87
+
88
+ ```
89
+ ├── manifest.json # Extension manifest
90
+ ├── background.js # Background script (main logic)
91
+ ├── content.js # Content script (fetch/XHR interception)
92
+ ├── popup.html # Settings panel HTML
93
+ ├── popup.js # Settings panel JavaScript
94
+ ├── icons/ # Extension icons
95
+ │ ├── icon-off-*.png # Red icons (proxy disabled)
96
+ │ └── icon-on-*.png # Green icons (proxy enabled)
97
+ └── README.md # This file
98
+ ```
99
+
100
+ ### Testing
101
+
102
+ 1. Enable the extension
103
+ 2. Add a test rule (e.g., `httpbin\.org` → `postman-echo.com`)
104
+ 3. Visit a website that makes requests to the target domain
105
+ 4. Check the browser's Network tab to verify redirections
106
+ 5. Verify notifications appear when traffic is proxied
107
+
108
+ ## Security Considerations
109
+
110
+ - This extension can intercept ALL network traffic when enabled
111
+ - Only install from trusted sources
112
+ - Review proxy rules carefully before enabling
113
+ - Be aware that redirected traffic may be logged by the target servers
114
+
115
+ ## Troubleshooting
116
+
117
+ ### Extension Not Working
118
+ - Check that the extension is enabled in `about:addons`
119
+ - Verify permissions are granted
120
+ - Check browser console for errors
121
+
122
+ ### Icons Not Showing
123
+ - Ensure PNG icon files exist in the `icons/` directory
124
+ - Convert SVG files to PNG if needed
125
+ - Check file permissions
126
+
127
+ ### Rules Not Matching
128
+ - Test regex patterns using online regex testers
129
+ - Ensure domains are properly escaped (use `\.` for literal dots)
130
+ - Check that the proxy is enabled (green button)
131
+
132
+ ## License
133
+
134
+ This extension is provided as-is for educational and development purposes.