gui: connect addresses' save and the typed certificate move into tlscerts.js, within the core script budget (quantum_lsfc on X)
The Connect to row put TestCoreScriptBudget 180 bytes over (1265892 > 1265712). The typed-certificate copy in asTyped and the resolve line in Save now live in tlscerts.js, which the editor imports, so the core carries no new code. A save before tlscerts.js has loaded sends no resolve, and the server keeps what was saved (a left-out resolve keeps it), as it already did for the server pin. Run on mote at the head rebased on origin/mainb942a872b: go test -count=1 -timeout 45m ./internal/netproxy ./internal/provider ./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./... for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs (chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok. Rebased again on origin/maindea131174and run on mote: netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was not run again at that head (no new main commit touches the offline check or the dial). The 94 GUI files the editor's Save, Test and certificate rows reach, run at origin/main436d507f0: 88 reds in 15 files, the same tests red on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621 #4391 #5147 #6030 #6209 #4397 #4673 #6099). Not tried: a real managed network with an L4 SNI gateway (the reporter's), and the rule's dial on Windows or Linux beyond go vet.
This commit is contained in:
@@ -8048,9 +8048,8 @@ function asTyped() {
|
||||
// provider of the user's own
|
||||
body.insecureTLS = !!draft.insecureTLS;
|
||||
body.http1 = !!draft.http1;
|
||||
// a client certificate typed (#5596) is tried as it would be saved
|
||||
for (const k of CERT_FIELDS) if (draft[k] != null) body[k] = draft[k].trim();
|
||||
if (draft.resolve) body.resolve = draft.resolve; // connect addresses (tlscerts.js)
|
||||
// a client certificate typed (#5596) and connect addresses are tried as they would be saved
|
||||
window.tlsTyped?.(draft, body);
|
||||
return body;
|
||||
}
|
||||
const CERT_FIELDS = ["clientCert", "clientKey", "serverCA", "serverPin"];
|
||||
@@ -9278,7 +9277,7 @@ function baseAPIOf(p) {
|
||||
|
||||
// draftOf is a saved provider as its editor's form holds it.
|
||||
function draftOf(p) {
|
||||
return { id: p.id, name: p.name, preset: p.preset, chat: p.chat, responses: p.responses, anthropic: p.anthropic, gemini: p.gemini || "", catalog: p.catalog, decide: p.decide || "", key: "", api: baseAPIOf(p), chosen: pickedOf(p), none: !!p.noModels, best: !!p.bestInFamily, extra: [], headers: headerRows(p.headers), extraBody: extraBodyText(p.extraBody), replyHeaders: (p.replyHeaders || []).join(", "), passHeaders: (p.passHeaders || []).join(", "), icon: p.icon || "", iconFrom: p.iconFrom || "", fallback: [...(p.fallback || [])], unlisted: !!p.unlisted, hiddenDrawers: [...(p.hiddenDrawers || [])], hiddenVideomakers: [...(p.hiddenVideomakers || [])], searches: !!p.searches, unredacted: !!p.unredacted, countFree: !!p.countFree, billing: p.billing || "", insecureTLS: !!p.insecureTLS, http1: !!p.http1, clientCert: p.clientCert || "", clientKey: p.clientKey || "", serverCA: p.serverCA || "", serverPin: p.serverPin || "", resolve: p.resolve || null, socket: p.socket || "", limitRestOff: !!p.limitRestOff, noBalanceProbe: !!p.noBalanceProbe, upstreamProviders: !!p.upstreamProviders, passErrors: !!p.passErrors, imageFilesOff: !!p.imageFilesOff, nativeCompaction: !!p.nativeCompaction, passUserAgent: p.passUserAgent !== false, pinUpstream: !!p.pinUpstream, authHeader: p.authHeader || "", balanceURL: p.balanceURL || "", balancePath: p.balancePath || "", balanceMethod: p.balanceMethod || "", modelsURL: p.modelsURL || "", listOff: !!p.listOff, contexts: contextsText(p.contexts), outputs: contextsText(p.outputs), compacts: contextsText(p.compacts), keysUrl: p.keysUrl || "", ...proxyDraft(p), ...concurrencyDraft(p), rateWindows: (p.rateWindows || []).map((w) => ({ ...w })) };
|
||||
return { id: p.id, name: p.name, preset: p.preset, chat: p.chat, responses: p.responses, anthropic: p.anthropic, gemini: p.gemini || "", catalog: p.catalog, decide: p.decide || "", key: "", api: baseAPIOf(p), chosen: pickedOf(p), none: !!p.noModels, best: !!p.bestInFamily, extra: [], headers: headerRows(p.headers), extraBody: extraBodyText(p.extraBody), replyHeaders: (p.replyHeaders || []).join(", "), passHeaders: (p.passHeaders || []).join(", "), icon: p.icon || "", iconFrom: p.iconFrom || "", fallback: [...(p.fallback || [])], unlisted: !!p.unlisted, hiddenDrawers: [...(p.hiddenDrawers || [])], hiddenVideomakers: [...(p.hiddenVideomakers || [])], searches: !!p.searches, unredacted: !!p.unredacted, countFree: !!p.countFree, billing: p.billing || "", insecureTLS: !!p.insecureTLS, http1: !!p.http1, clientCert: p.clientCert || "", clientKey: p.clientKey || "", serverCA: p.serverCA || "", serverPin: p.serverPin || "", resolve: p.resolve, socket: p.socket || "", limitRestOff: !!p.limitRestOff, noBalanceProbe: !!p.noBalanceProbe, upstreamProviders: !!p.upstreamProviders, passErrors: !!p.passErrors, imageFilesOff: !!p.imageFilesOff, nativeCompaction: !!p.nativeCompaction, passUserAgent: p.passUserAgent !== false, pinUpstream: !!p.pinUpstream, authHeader: p.authHeader || "", balanceURL: p.balanceURL || "", balancePath: p.balancePath || "", balanceMethod: p.balanceMethod || "", modelsURL: p.modelsURL || "", listOff: !!p.listOff, contexts: contextsText(p.contexts), outputs: contextsText(p.outputs), compacts: contextsText(p.compacts), keysUrl: p.keysUrl || "", ...proxyDraft(p), ...concurrencyDraft(p), rateWindows: (p.rateWindows || []).map((w) => ({ ...w })) };
|
||||
}
|
||||
|
||||
// duplicateProvider opens the Add form on a copy of p, its key p's unless another is pasted (#268).
|
||||
@@ -10307,8 +10306,7 @@ function drawEditor(p, presetID) {
|
||||
body.billing = draft.billing || "";
|
||||
if (tlsTakes()) { body.insecureTLS = !!draft.insecureTLS && onHTTPS(); body.http1 = !!draft.http1 && onHTTPS(); }
|
||||
if (certTakes()) for (const k of CERT_FIELDS) body[k] = onHTTPS() ? (draft[k] || "").trim() : "";
|
||||
else pinBody(body);
|
||||
if (draft.resolve) body.resolve = draft.resolve;
|
||||
pinBody(body, certTakes());
|
||||
if (socketable()) body.socket = draft.socket || "";
|
||||
if (custom) body.limitRestOff = !!draft.limitRestOff;
|
||||
body.noBalanceProbe = !!draft.noBalanceProbe;
|
||||
|
||||
@@ -54,11 +54,18 @@ function drawPin(pin, draft, peek, seen) {
|
||||
// every one of theirs and Remote magpie's, and a preset's pointed at their
|
||||
// own server, never the vendor's own hosts; save has the Save body carry
|
||||
// the pin. The client certificate's fields are saved by app.js itself.
|
||||
window.tlsTyped = (draft, body) => {
|
||||
for (const k of ["clientCert", "clientKey", "serverCA", "serverPin"]) if (draft[k] != null) body[k] = draft[k].trim();
|
||||
if (draft.resolve) body.resolve = draft.resolve;
|
||||
};
|
||||
|
||||
window.tlsCertRows = function ({ p, pr, draft, at, certTakes, onHTTPS, addressOf, asTyped, show, save }) {
|
||||
if (!at.isConnected) return;
|
||||
const rows = [];
|
||||
const rows = [], saves = [];
|
||||
const keep = (f) => saves.push(f);
|
||||
save((body, own) => { if (!own) for (const f of saves) f(body); if (draft.resolve) body.resolve = draft.resolve; });
|
||||
const takes = certTakes() || (p ? !!p.takesServerPin || (!!p.preset && !p.account) : !!pr) && (p?.preset || pr?.id) !== "google-vertex";
|
||||
if (takes) rows.push(pinRow({ p, pr, draft, certTakes, addressOf, asTyped, show, save }));
|
||||
if (takes) rows.push(pinRow({ p, pr, draft, certTakes, addressOf, asTyped, show, save: keep }));
|
||||
if (certTakes()) {
|
||||
const box = el("div", "client-cert");
|
||||
for (const [k, label, hold] of [["clientCert", t("Certificate"), "client.pem"], ["clientKey", t("Key"), "client-key.pem"], ["serverCA", t("Server CA"), "ca.pem"]]) {
|
||||
|
||||
Reference in New Issue
Block a user