@gxp-dev/tools 2.0.5
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/.github/workflows/npm-publish.yml +48 -0
- package/CLAUDE.md +400 -0
- package/README.md +247 -0
- package/REFACTOR_PLAN.md +194 -0
- package/bin/gx-devtools.js +87 -0
- package/bin/lib/cli.js +251 -0
- package/bin/lib/commands/assets.js +337 -0
- package/bin/lib/commands/build.js +259 -0
- package/bin/lib/commands/datastore.js +433 -0
- package/bin/lib/commands/dev.js +328 -0
- package/bin/lib/commands/extensions.js +298 -0
- package/bin/lib/commands/index.js +35 -0
- package/bin/lib/commands/init.js +307 -0
- package/bin/lib/commands/publish.js +189 -0
- package/bin/lib/commands/socket.js +158 -0
- package/bin/lib/commands/ssl.js +47 -0
- package/bin/lib/constants.js +120 -0
- package/bin/lib/tui/App.tsx +600 -0
- package/bin/lib/tui/components/CommandInput.tsx +278 -0
- package/bin/lib/tui/components/GeminiPanel.tsx +161 -0
- package/bin/lib/tui/components/Header.tsx +27 -0
- package/bin/lib/tui/components/LogPanel.tsx +122 -0
- package/bin/lib/tui/components/TabBar.tsx +56 -0
- package/bin/lib/tui/components/WelcomeScreen.tsx +80 -0
- package/bin/lib/tui/index.tsx +63 -0
- package/bin/lib/tui/services/ExtensionService.ts +122 -0
- package/bin/lib/tui/services/GeminiService.ts +395 -0
- package/bin/lib/tui/services/ServiceManager.ts +336 -0
- package/bin/lib/tui/services/SocketService.ts +204 -0
- package/bin/lib/tui/services/ViteService.ts +107 -0
- package/bin/lib/tui/services/index.ts +13 -0
- package/bin/lib/utils/files.js +180 -0
- package/bin/lib/utils/index.js +17 -0
- package/bin/lib/utils/paths.js +138 -0
- package/bin/lib/utils/prompts.js +71 -0
- package/bin/lib/utils/ssl.js +233 -0
- 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/docs/DOCUSAURUS_IMPORT.md +378 -0
- package/docs/_category_.json +8 -0
- package/docs/app-manifest.md +272 -0
- package/docs/building-for-platform.md +315 -0
- package/docs/dev-tools.md +291 -0
- package/docs/getting-started.md +180 -0
- package/docs/gxp-store.md +305 -0
- package/docs/index.md +44 -0
- package/package.json +77 -0
- 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
- package/tsconfig.tui.json +21 -0
- package/vite.config.js +164 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Test JavaScript Imports Interception</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<h1>JavaScript Import Interception Test</h1>
|
|
8
|
+
<p>Check the Network tab and proxy notifications to see if imports are intercepted.</p>
|
|
9
|
+
|
|
10
|
+
<div id="results"></div>
|
|
11
|
+
|
|
12
|
+
<script type="module">
|
|
13
|
+
const results = document.getElementById('results');
|
|
14
|
+
|
|
15
|
+
function log(message) {
|
|
16
|
+
const div = document.createElement('div');
|
|
17
|
+
div.textContent = `${new Date().toLocaleTimeString()}: ${message}`;
|
|
18
|
+
results.appendChild(div);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Test 1: Dynamic import
|
|
22
|
+
log('Testing dynamic import...');
|
|
23
|
+
try {
|
|
24
|
+
const module = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js');
|
|
25
|
+
log('✅ Dynamic import successful');
|
|
26
|
+
} catch (error) {
|
|
27
|
+
log('❌ Dynamic import failed: ' + error.message);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Test 2: Fetch (for comparison)
|
|
31
|
+
log('Testing fetch...');
|
|
32
|
+
try {
|
|
33
|
+
const response = await fetch('https://api.github.com/users/octocat');
|
|
34
|
+
log('✅ Fetch successful');
|
|
35
|
+
} catch (error) {
|
|
36
|
+
log('❌ Fetch failed: ' + error.message);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Test 3: Worker (if supported)
|
|
40
|
+
log('Testing Web Worker...');
|
|
41
|
+
try {
|
|
42
|
+
const workerCode = `
|
|
43
|
+
self.postMessage('Worker loaded successfully');
|
|
44
|
+
self.close();
|
|
45
|
+
`;
|
|
46
|
+
const blob = new Blob([workerCode], { type: 'application/javascript' });
|
|
47
|
+
const worker = new Worker(URL.createObjectURL(blob));
|
|
48
|
+
worker.onmessage = () => log('✅ Web Worker successful');
|
|
49
|
+
worker.onerror = () => log('❌ Web Worker failed');
|
|
50
|
+
} catch (error) {
|
|
51
|
+
log('❌ Web Worker failed: ' + error.message);
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<!-- Test 4: Static import (commented out as it needs a real module file) -->
|
|
56
|
+
<!-- <script type="module" src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script> -->
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Test URL Masking vs Redirection</title>
|
|
5
|
+
<style>
|
|
6
|
+
body { font-family: Arial, sans-serif; padding: 20px; max-width: 800px; }
|
|
7
|
+
.mode-section { margin: 20px 0; padding: 20px; border: 2px solid #ddd; border-radius: 8px; }
|
|
8
|
+
.redirect-mode { border-color: #dc3545; background: #fff5f5; }
|
|
9
|
+
.masking-mode { border-color: #28a745; background: #f8fff8; }
|
|
10
|
+
.test-buttons { margin: 15px 0; }
|
|
11
|
+
button { padding: 10px 15px; margin: 5px; cursor: pointer; }
|
|
12
|
+
.redirect-btn { background: #dc3545; color: white; border: none; border-radius: 4px; }
|
|
13
|
+
.masking-btn { background: #28a745; color: white; border: none; border-radius: 4px; }
|
|
14
|
+
.results { background: #f5f5f5; padding: 10px; margin: 10px 0; border-radius: 4px; }
|
|
15
|
+
.code { background: #e9ecef; padding: 8px; font-family: monospace; margin: 8px 0; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<h1>URL Masking vs Redirection Test</h1>
|
|
20
|
+
|
|
21
|
+
<div class="mode-section redirect-mode">
|
|
22
|
+
<h2>🔴 Redirect Mode (Traditional)</h2>
|
|
23
|
+
<p><strong>How it works:</strong> Browser URL bar changes to show the new destination</p>
|
|
24
|
+
<div class="code">
|
|
25
|
+
Original URL: https://api.example.com/data<br>
|
|
26
|
+
Browser shows: https://api.alternative.com/data
|
|
27
|
+
</div>
|
|
28
|
+
<p><strong>Use case:</strong> When you want users to see they're being redirected</p>
|
|
29
|
+
|
|
30
|
+
<div class="test-buttons">
|
|
31
|
+
<button class="redirect-btn" onclick="testRedirect()">Test Redirect Mode</button>
|
|
32
|
+
</div>
|
|
33
|
+
<div id="redirectResults" class="results"></div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="mode-section masking-mode">
|
|
37
|
+
<h2>🟢 Masking Mode (Transparent Proxy)</h2>
|
|
38
|
+
<p><strong>How it works:</strong> Browser URL bar shows original URL, but request goes to proxy server</p>
|
|
39
|
+
<div class="code">
|
|
40
|
+
Original URL: https://api.example.com/data<br>
|
|
41
|
+
Browser shows: https://api.example.com/data<br>
|
|
42
|
+
Actual request goes to: https://api.alternative.com/data<br>
|
|
43
|
+
Headers include: X-Proxy-Original-Host: api.example.com
|
|
44
|
+
</div>
|
|
45
|
+
<p><strong>Use case:</strong> Transparent proxying without changing visible URLs</p>
|
|
46
|
+
|
|
47
|
+
<div class="test-buttons">
|
|
48
|
+
<button class="masking-btn" onclick="testMasking()">Test Masking Mode</button>
|
|
49
|
+
</div>
|
|
50
|
+
<div id="maskingResults" class="results"></div>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="mode-section">
|
|
54
|
+
<h2>📋 Setup Instructions</h2>
|
|
55
|
+
<ol>
|
|
56
|
+
<li><strong>For Redirect Mode:</strong>
|
|
57
|
+
<ul>
|
|
58
|
+
<li>Add rule: Pattern <code>httpbin\.org</code> → Redirect <code>postman-echo.com</code></li>
|
|
59
|
+
<li>Leave "Mask URL" checkbox unchecked</li>
|
|
60
|
+
<li>Leave "URL Masking Mode" unchecked</li>
|
|
61
|
+
</ul>
|
|
62
|
+
</li>
|
|
63
|
+
<li><strong>For Masking Mode:</strong>
|
|
64
|
+
<ul>
|
|
65
|
+
<li>Add rule: Pattern <code>httpbin\.org</code> → Redirect <code>postman-echo.com</code></li>
|
|
66
|
+
<li>Check "Mask URL" checkbox for the rule, OR</li>
|
|
67
|
+
<li>Check "URL Masking Mode" for global masking</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</li>
|
|
70
|
+
</ol>
|
|
71
|
+
|
|
72
|
+
<h3>🔧 Server Requirements for Masking</h3>
|
|
73
|
+
<p>Your proxy server needs to:</p>
|
|
74
|
+
<ul>
|
|
75
|
+
<li>Accept the original Host header</li>
|
|
76
|
+
<li>Read <code>X-Proxy-Original-Host</code> and <code>X-Proxy-Original-URL</code> headers</li>
|
|
77
|
+
<li>Route requests based on these headers</li>
|
|
78
|
+
<li>Return appropriate CORS headers if needed</li>
|
|
79
|
+
</ul>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
function log(elementId, message) {
|
|
84
|
+
const element = document.getElementById(elementId);
|
|
85
|
+
const timestamp = new Date().toLocaleTimeString();
|
|
86
|
+
element.innerHTML += `<div>${timestamp}: ${message}</div>`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function testRedirect() {
|
|
90
|
+
const results = document.getElementById('redirectResults');
|
|
91
|
+
results.innerHTML = '';
|
|
92
|
+
|
|
93
|
+
log('redirectResults', '🧪 Testing redirect mode...');
|
|
94
|
+
log('redirectResults', '📝 Make sure extension is in REDIRECT mode (Mask URL unchecked)');
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const response = await fetch('https://httpbin.org/get?test=redirect');
|
|
98
|
+
const data = await response.json();
|
|
99
|
+
log('redirectResults', `✅ Request successful to: ${data.url}`);
|
|
100
|
+
log('redirectResults', `📍 Check browser URL bar - should show redirected domain`);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
log('redirectResults', `❌ Request failed: ${error.message}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function testMasking() {
|
|
107
|
+
const results = document.getElementById('maskingResults');
|
|
108
|
+
results.innerHTML = '';
|
|
109
|
+
|
|
110
|
+
log('maskingResults', '🧪 Testing masking mode...');
|
|
111
|
+
log('maskingResults', '📝 Make sure extension is in MASKING mode (Mask URL checked)');
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
const response = await fetch('https://httpbin.org/get?test=masking');
|
|
115
|
+
const data = await response.json();
|
|
116
|
+
log('maskingResults', `✅ Request successful`);
|
|
117
|
+
log('maskingResults', `📍 Check browser URL bar - should show original domain`);
|
|
118
|
+
log('maskingResults', `🔍 Check Network tab for actual destination`);
|
|
119
|
+
|
|
120
|
+
// Check if proxy headers were included
|
|
121
|
+
if (data.headers && data.headers['X-Proxy-Original-Host']) {
|
|
122
|
+
log('maskingResults', `✅ Proxy headers detected: ${data.headers['X-Proxy-Original-Host']}`);
|
|
123
|
+
} else {
|
|
124
|
+
log('maskingResults', `⚠️ No proxy headers detected - check masking configuration`);
|
|
125
|
+
}
|
|
126
|
+
} catch (error) {
|
|
127
|
+
log('maskingResults', `❌ Request failed: ${error.message}`);
|
|
128
|
+
log('maskingResults', `💡 This might be expected if proxy server doesn't support masking`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Auto-check extension status
|
|
133
|
+
window.addEventListener('load', async function() {
|
|
134
|
+
try {
|
|
135
|
+
if (typeof browser !== 'undefined') {
|
|
136
|
+
const state = await browser.runtime.sendMessage({ action: 'getState' });
|
|
137
|
+
console.log('Extension state:', state);
|
|
138
|
+
} else {
|
|
139
|
+
console.log('Extension not detected');
|
|
140
|
+
}
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.log('Extension communication failed:', error);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
</script>
|
|
146
|
+
</body>
|
|
147
|
+
</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>
|