UNPKG

@gramercytech/gx-toolkit

Version:
382 lines (328 loc) 10.2 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> body { width: 400px; padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f8f9fa; } .header { background: #fff; padding: 16px; border-bottom: 1px solid #e9ecef; } .title { margin: 0 0 12px 0; font-size: 16px; font-weight: 600; color: #212529; } .toggle-container { display: flex; align-items: center; gap: 12px; } .toggle-button { background: #dc3545; border: none; padding: 8px 16px; border-radius: 20px; color: white; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; } .toggle-button.enabled { background: #28a745; } .toggle-button:hover { opacity: 0.9; } .status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; } .content { padding: 16px; } .section { margin-bottom: 20px; } .section-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: #495057; } .config-container { background: white; border: 1px solid #dee2e6; border-radius: 6px; padding: 16px; } .rule-container { background: white; border: 1px solid #dee2e6; border-radius: 6px; padding: 16px; margin-bottom: 12px; } .rule-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; } .rule-title { font-size: 14px; font-weight: 600; color: #495057; margin: 0; } .rule-toggle { margin-left: auto; } .input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; } .input-label { font-size: 12px; color: #6c757d; font-weight: 500; } input[type="text"] { padding: 8px 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 13px; } input[type="text"]:focus { outline: none; border-color: #007bff; box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); } input[type="text"]:disabled { background: #f8f9fa; color: #6c757d; cursor: not-allowed; } .checkbox-group { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; } .checkbox-group input[type="checkbox"] { margin: 0; } .checkbox-group label { font-size: 12px; color: #495057; margin: 0; cursor: pointer; } .pattern-display { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 4px; padding: 8px 10px; font-size: 11px; color: #6c757d; font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; word-break: break-all; margin-bottom: 8px; } .pattern-input { display: none; } .pattern-input.visible { display: block; } .save-button { background: #28a745; border: none; color: white; padding: 12px 20px; border-radius: 4px; font-size: 14px; cursor: pointer; width: 100%; margin-top: 8px; } .save-button:hover { background: #218838; } .save-button:disabled { background: #6c757d; cursor: not-allowed; } .status { margin-top: 12px; padding: 8px 12px; border-radius: 4px; font-size: 12px; text-align: center; } .status.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; } .status.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; } .help-text { font-size: 11px; color: #6c757d; margin-top: 4px; line-height: 1.3; } .example-text { font-size: 11px; color: #007bff; margin-bottom: 8px; font-style: italic; } .rule-disabled { opacity: 0.6; pointer-events: none; } .blank-option { background: #fff3cd; border: 1px solid #ffeaa7; border-radius: 4px; padding: 8px 10px; margin-bottom: 12px; } .blank-option-title { font-size: 12px; font-weight: 600; color: #856404; margin-bottom: 4px; } </style> </head> <body> <div class="header"> <h1 class="title">JavaScript Proxy</h1> <div class="toggle-container"> <button id="toggleButton" class="toggle-button"> <div class="status-dot"></div> <span id="toggleText">OFF</span> </button> <label style="font-size: 12px; color: #6c757d;"> <input type="checkbox" id="maskingMode" style="margin-right: 4px;"> URL Masking Mode </label> </div> </div> <div class="content" style="padding-top: 8px;"> <div class="section"> <div class="section-title">Cache Management</div> <div class="config-container"> <div class="checkbox-group"> <input type="checkbox" id="clearCacheOnEnable"> <label for="clearCacheOnEnable">Clear cache when extension is enabled</label> </div> <div class="help-text" style="margin-top: -8px; margin-bottom: 12px;">Automatically clears browser cache to ensure fresh redirects</div> <div class="checkbox-group"> <input type="checkbox" id="disableCacheForRedirects"> <label for="disableCacheForRedirects">Disable caching for matched URLs</label> </div> <div class="help-text" style="margin-top: -8px; margin-bottom: 12px;">Adds cache-busting headers to prevent service worker caching</div> <button id="clearCacheButton" style="background: #ffc107; color: #212529; border: none; padding: 8px 16px; border-radius: 4px; font-size: 12px; cursor: pointer; width: 100%; margin-top: 8px;"> Clear Cache Now </button> </div> </div> </div> <div class="content"> <div class="section"> <div class="section-title">Proxy Rules</div> <!-- JavaScript Rule --> <div class="rule-container"> <div class="rule-header"> <div class="rule-title">JavaScript Files (.js)</div> <div class="rule-toggle"> <input type="checkbox" id="jsRuleEnabled"> <label for="jsRuleEnabled" style="font-size: 12px; margin-left: 4px;">Enabled</label> </div> </div> <div id="jsRuleContent"> <div class="example-text">Redirects JavaScript files from production uploads to your local development server</div> <div class="input-group"> <label class="input-label">Redirect To URL</label> <input type="text" id="jsRedirectUrl" placeholder="https://localhost:3060/src/Plugin.vue"> <div class="help-text">Local URL where matching JavaScript files should be redirected</div> </div> <div class="checkbox-group"> <input type="checkbox" id="jsCustomPattern"> <label for="jsCustomPattern">Use custom URL pattern</label> </div> <div class="input-group"> <label class="input-label">URL Pattern to Match</label> <div id="jsPatternDisplay" class="pattern-display"></div> <input type="text" id="jsCustomPatternInput" class="pattern-input" placeholder=""> <div class="help-text">RegEx pattern to match JavaScript file URLs</div> </div> </div> </div> <!-- CSS Rule --> <div class="rule-container"> <div class="rule-header"> <div class="rule-title">CSS Files (.css)</div> <div class="rule-toggle"> <input type="checkbox" id="cssRuleEnabled"> <label for="cssRuleEnabled" style="font-size: 12px; margin-left: 4px;">Enabled</label> </div> </div> <div id="cssRuleContent"> <div class="example-text">Handle CSS files from production uploads</div> <div class="blank-option"> <div class="blank-option-title">Return Blank CSS</div> <div class="checkbox-group" style="margin-bottom: 6px;"> <input type="checkbox" id="cssReturnBlank"> <label for="cssReturnBlank">Return empty CSS file instead of redirecting</label> </div> <div class="help-text" style="margin: 0;">Useful for disabling production styles during development</div> </div> <div id="cssRedirectSection"> <div class="input-group"> <label class="input-label">Redirect To URL</label> <input type="text" id="cssRedirectUrl" placeholder="https://localhost:3060/src/styles.css"> <div class="help-text">Local URL where matching CSS files should be redirected</div> </div> </div> <div class="checkbox-group"> <input type="checkbox" id="cssCustomPattern"> <label for="cssCustomPattern">Use custom URL pattern</label> </div> <div class="input-group"> <label class="input-label">URL Pattern to Match</label> <div id="cssPatternDisplay" class="pattern-display"></div> <input type="text" id="cssCustomPatternInput" class="pattern-input" placeholder=""> <div class="help-text">RegEx pattern to match CSS file URLs</div> </div> </div> </div> </div> <button id="saveButton" class="save-button">Save Configuration</button> <div id="status" class="status" style="display: none;"></div> </div> <script src="popup.js"></script> </body> </html>