Add self signed cert support to the test dashboard.
This commit is contained in:
1 parent
ff16548585
commit
be278b3c7c
3 files changed
+161
-14
No files matched your search
+31
-2
@@ -176,16 +176,21 @@
|
||||
<div style="display:flex; gap: 20px; align-items:center; flex-wrap:wrap; font-size:0.85rem;">
|
||||
<div style="flex:1; min-width:240px;">
|
||||
<label>Primary Base URL:</label>
|
||||
<input type="text" id="primaryUrl" value="http://127.0.0.1:3000" style="margin-bottom:0;" />
|
||||
<input type="text" id="primaryUrl" value="https://127.0.0.1:3000" style="margin-bottom:0;" />
|
||||
</div>
|
||||
<div style="flex:1; min-width:240px;">
|
||||
<label>Replica Base URL:</label>
|
||||
<input type="text" id="replicaUrl" value="http://127.0.0.1:3001" style="margin-bottom:0;" />
|
||||
<input type="text" id="replicaUrl" value="https://127.0.0.1:3001" style="margin-bottom:0;" />
|
||||
</div>
|
||||
<div style="flex:1; min-width:180px;">
|
||||
<label>Replication Bearer Token:</label>
|
||||
<input type="password" id="replToken" value="change-me" style="margin-bottom:0;" />
|
||||
</div>
|
||||
<div style="min-width:220px; display:flex; align-items:flex-end;">
|
||||
<label style="font-size:0.8rem; display:flex; align-items:center; gap:6px; cursor:pointer; padding-bottom:6px; color:var(--success);">
|
||||
<input type="checkbox" id="trustAllCerts" checked style="width:auto; margin:0;" /> 🛡️ Trust Self-Signed Certs (Proxy)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -286,6 +291,30 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Transparently proxy external/HTTPS instance calls via dashboard proxy when self-signed cert trust is active
|
||||
const nativeFetch = window.fetch;
|
||||
window.fetch = function(input, init) {
|
||||
const trustAll = document.getElementById('trustAllCerts')?.checked ?? true;
|
||||
if (trustAll) {
|
||||
const urlStr = typeof input === 'string' ? input : (input && input.url ? input.url : null);
|
||||
if (urlStr) {
|
||||
try {
|
||||
const parsed = new URL(urlStr, window.location.href);
|
||||
if (parsed.origin !== window.location.origin) {
|
||||
const proxyBase = (window.location.protocol === 'file:') ? 'http://127.0.0.1:8080' : '';
|
||||
const proxiedUrl = `${proxyBase}/proxy?url=${encodeURIComponent(urlStr)}`;
|
||||
if (typeof input === 'string') {
|
||||
input = proxiedUrl;
|
||||
} else {
|
||||
input = new Request(proxiedUrl, input);
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
return nativeFetch(input, init);
|
||||
};
|
||||
|
||||
let primaryHeadSeq = 0;
|
||||
let replicaHeadSeq = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user