Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Balance Admin spacing and stop treating API keys as passwords (#1779)

Ali Khokhara3f6c6913ffe
diff --git a/e2e/form_support.py b/e2e/form_support.py
new file mode 100644
index 00000000..27792f66
--- /dev/null
+++ b/e2e/form_support.py
@@ -0,0 +1,12 @@
+"""Browser contracts for FCC's advisory autofill opt-outs."""
+
+
+def assert_autofill_opt_out(page):
+ failures = page.locator(
+ 'form, textarea, input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"])'
+ ).evaluate_all("""nodes => nodes.flatMap(node => {
+ const valid = node.autocomplete === 'off' && node.hasAttribute('data-1p-ignore') &&
+ node.hasAttribute('data-bwignore') && node.getAttribute('data-form-type') === 'other';
+ return valid ? [] : [{id: node.id, tag: node.tagName, type: node.type}];
+ })""")
+ assert failures == [], failures
diff --git a/e2e/test_admin_assets.py b/e2e/test_admin_assets.py
index 831c8f48..bf7d8037 100644
--- a/e2e/test_admin_assets.py
+++ b/e2e/test_admin_assets.py
@@ -2,11 +2,99 @@
from urllib.parse import urlsplit
+import pytest
from playwright.sync_api import Error, Page, Request, expect
+from e2e.form_support import assert_autofill_opt_out
from free_claude_code.core.version import package_version
[email protected]("width", [1280, 900, 390])
+def test_admin_page_spacing_matches_visible_action_bar(page, admin_base_url, width):
+ page.set_viewport_size({"width": width, "height": 720})
+ page.goto(f"{admin_base_url}/admin")
+ expect(page.locator("#messageArea")).to_have_text("")
+
+ def assert_spacing():
+ page.wait_for_function("""() => !document.querySelector('.action-bar')
+ .getAnimations({subtree: true}).some(animation => animation.playState === 'running')""")
+ # Wait for layout/ResizeObserver delivery, then inspect rendered geometry.
+ page.evaluate(
+ "() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))"
+ )
+ measurements = page.evaluate("""() => {
+ const main = document.querySelector('.main');
+ const style = getComputedStyle(main);
+ const bar = document.querySelector('.action-bar');
+ const last = document.querySelector('.admin-view:not([hidden]) .form-sections > :last-child');
+ const heading = document.querySelector('#pageTitle');
+ const range = document.createRange();
+ range.selectNodeContents(heading);
+ const text = range.getBoundingClientRect();
+ const context = document.createElement('canvas').getContext('2d');
+ context.font = getComputedStyle(heading).font;
+ const metrics = context.measureText(heading.textContent);
+ const inkTop = text.top + (text.height - metrics.fontBoundingBoxAscent - metrics.fontBoundingBoxDescent) / 2
+ + metrics.fontBoundingBoxAscent - metrics.actualBoundingBoxAscent;
+ return {
+ top: parseFloat(style.paddingTop),
+ bottom: parseFloat(style.paddingBottom),
+ bar: bar.getBoundingClientRect().height,
+ endGap: last ? main.getBoundingClientRect().bottom - last.getBoundingClientRect().bottom : null,
+ headingGap: inkTop - main.getBoundingClientRect().top,
+ };
+ }""")
+ assert measurements["bottom"] - measurements["bar"] == pytest.approx(
+ measurements["top"], abs=1
+ )
+ # Ink can overshoot the font's cap metric; allow pixel rounding as well.
+ assert measurements["headingGap"] == pytest.approx(measurements["top"], abs=2)
+ if measurements["endGap"] is not None:
+ assert measurements["endGap"] - measurements["bar"] == pytest.approx(
+ measurements["top"], abs=1
+ )
+
+ for title in ("Providers", "Model Config", "Messaging"):
+ page.get_by_role("button", name=title, exact=True).click()
+ expect(page.locator("#pageTitle")).to_have_text(title)
+ assert_spacing()
+
+ original_height = page.locator(".action-bar").bounding_box()["height"]
+ page.locator("#messageArea").evaluate(
+ "node => node.textContent = 'A longer validation message that wraps onto multiple lines. '.repeat(20)"
+ )
+ assert_spacing()
+ assert page.locator(".action-bar").bounding_box()["height"] > original_height
+ page.set_viewport_size({"width": 700 if width > 900 else 1200, "height": 720})
+ assert_spacing()
+
+ page.get_by_role("button", name="Integrations", exact=True).click()
+ expect(page.locator(".action-bar")).to_be_hidden()
+ assert_spacing()
+ page.get_by_role("button", name="Providers", exact=True).click()
+ expect(page.locator(".action-bar")).to_be_visible()
+ assert_spacing()
+
+
+def test_settings_text_fields_opt_out_of_autofill(page, admin_base_url):
+ page.goto(f"{admin_base_url}/admin")
+ expect(page.locator("#messageArea")).to_have_text("")
+ for title in ("Providers", "Model Config", "Messaging", "Integrations"):
+ page.get_by_role("button", name=title, exact=True).click()
+ assert_autofill_opt_out(page)
+ page.get_by_role("button", name="Providers", exact=True).click()
+ key = page.locator("#field-NVIDIA_NIM_API_KEY")
+ expect(key).to_have_value("")
+ expect(key).to_have_attribute("type", "text")
+ expect(key).to_have_attribute("autocapitalize", "none")
+ expect(key).to_have_attribute("spellcheck", "false")
+ expect(key).to_have_attribute("autocorrect", "off")
+ expect(page.locator('.field input[type="password"]')).to_have_count(0)
+ key.fill("manually-entered-api-key")
+ expect(key).to_have_value("manually-entered-api-key")
+ expect(page.locator("#applyButton")).to_be_enabled()
+
+
def test_selected_admin_tab_survives_refresh_and_browser_navigation(
page, admin_base_url
):
@@ -117,6 +205,7 @@ def test_admin_loads_current_release_assets_before_rendering_dynamic_content(
assert f"{versioned_root}/admin.css" in requested_paths
assert f"{versioned_root}/code_sessions.css" in requested_paths
assert f"{versioned_root}/model_combobox.js" in requested_paths
+ assert f"{versioned_root}/form_controls.js" in requested_paths
assert f"{versioned_root}/code_sessions.js" in requested_paths
assert f"{versioned_root}/admin.js" in requested_paths
assert "/admin/assets/admin.css" not in requested_paths
diff --git a/e2e/test_code_sessions.py b/e2e/test_code_sessions.py
index c241f669..44fbda83 100644
--- a/e2e/test_code_sessions.py
+++ b/e2e/test_code_sessions.py
@@ -5,6 +5,7 @@ import uuid
import pytest
from playwright.sync_api import expect
+from e2e.form_support import assert_autofill_opt_out
from free_claude_code.application.code_sessions.models import (
HarnessEvent,
PromptRequest,
@@ -1226,6 +1227,7 @@ def test_question_input_survives_streaming_and_secret_answer_is_not_stored(
create_session(page, admin_base_url, tmp_path)
send(page, "Ask me a question")
connection = code_control.connection()
+ assert_autofill_opt_out(page)
prompt = PromptRequest(
7,
"questions",
@@ -1267,6 +1269,7 @@ def test_question_input_survives_streaming_and_secret_answer_is_not_stored(
secret = page.get_by_label("Your answer", exact=True)
secret.fill("private-answer")
expect(secret).to_have_attribute("type", "password")
+ assert_autofill_opt_out(page)
secret.focus()
secret.evaluate(
"input => { window.savedPromptInput = input; input.setSelectionRange(2, 6); }"
diff --git a/pyproject.toml b/pyproject.toml
index ac827125..5205ad9b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "6.2.17"
+version = "6.2.18"
description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/src/free_claude_code/api/admin_routes.py b/src/free_claude_code/api/admin_routes.py
index 9e44dda1..8dd36e66 100644
--- a/src/free_claude_code/api/admin_routes.py
+++ b/src/free_claude_code/api/admin_routes.py
@@ -43,6 +43,7 @@ _ADMIN_ASSET_FILENAMES = frozenset(
{
"admin.css",
"admin.js",
+ "form_controls.js",
"app-icon.svg",
"code_sessions.css",
"code_sessions.js",
diff --git a/src/free_claude_code/api/admin_static/admin.css b/src/free_claude_code/api/admin_static/admin.css
index ec3aa1d3..49dab1f0 100644
--- a/src/free_claude_code/api/admin_static/admin.css
+++ b/src/free_claude_code/api/admin_static/admin.css
@@ -205,7 +205,7 @@ textarea:focus-visible,
.main {
min-width: 0;
padding: 40px 48px;
- padding-bottom: calc(40px + 96px); /* Fixed action bar clearance */
+ padding-bottom: calc(40px + var(--action-bar-height, 0px));
}
.topbar {
@@ -215,9 +215,10 @@ textarea:focus-visible,
.topbar h2 {
font-size: 30px;
font-weight: 800;
+ line-height: 1;
letter-spacing: -0.02em;
color: var(--text-strong);
- margin: 0;
+ margin: calc((1cap - 1em) / 2) 0 0;
}
/* Provider Strip & Panels */
@@ -483,6 +484,10 @@ textarea:focus-visible,
gap: 24px;
}
+.form-sections > .settings-section:last-child {
+ margin-bottom: 0;
+}
+
.settings-section {
padding: 24px;
scroll-margin-top: 24px;
@@ -852,7 +857,7 @@ textarea:focus-visible,
.main {
padding: 24px 20px;
- padding-bottom: calc(24px + 180px); /* Stacked action bar clearance */
+ padding-bottom: calc(24px + var(--action-bar-height, 0px));
}
.action-bar {
diff --git a/src/free_claude_code/api/admin_static/admin.js b/src/free_claude_code/api/admin_static/admin.js
index 5dbf5be0..ee21a266 100644
--- a/src/free_claude_code/api/admin_static/admin.js
+++ b/src/free_claude_code/api/admin_static/admin.js
@@ -637,7 +637,7 @@ function renderField(field) {
label.appendChild(sourceEl);
}
- const input = inputForField(field);
+ const input = window.FccFormControls.configure(inputForField(field));
input.id = `field-${field.key}`;
input.dataset.key = field.key;
input.dataset.original = comparableValue(field.value);
@@ -737,7 +737,9 @@ function inputForField(field) {
const input = document.createElement("input");
input.type = field.type === "number" ? "number" : "text";
if (field.type === "secret") {
- input.type = "password";
+ input.setAttribute("autocapitalize", "none");
+ input.spellcheck = false;
+ input.setAttribute("autocorrect", "off");
input.placeholder = field.configured
? "Configured - enter a new value to replace"
: "Not configured";
@@ -779,7 +781,7 @@ class ModelListEditor {
const addRow = document.createElement("div");
addRow.className = "model-list-add";
- this.addInput = document.createElement("input");
+ this.addInput = window.FccFormControls.configure(document.createElement("input"));
this.addInput.id = this.inputId;
this.addInput.type = "text";
this.addInput.autocomplete = "off";
@@ -1469,6 +1471,14 @@ jetBrainsIntegrationDialog.addEventListener("click", (event) => {
}
});
+// Keep footer clearance exact when messages wrap or a view hides the bar.
+new ResizeObserver(([entry]) => {
+ document.documentElement.style.setProperty(
+ "--action-bar-height",
+ `${entry.target.getBoundingClientRect().height}px`,
+ );
+}).observe(document.querySelector(".action-bar"), { box: "border-box" });
+
load().then(showRestartNotice).catch((error) => {
showMessage(error.message, "error");
});
diff --git a/src/free_claude_code/api/admin_static/code_sessions.js b/src/free_claude_code/api/admin_static/code_sessions.js
index 8a90a4b1..cc68f0f1 100644
--- a/src/free_claude_code/api/admin_static/code_sessions.js
+++ b/src/free_claude_code/api/admin_static/code_sessions.js
@@ -49,7 +49,7 @@
const node = document.createElement(tag);
if (text !== undefined) node.textContent = text;
if (className) node.className = className;
- return node;
+ return window.FccFormControls.configure(node);
}
function button(text, action, className = "secondary-button") {
const node = element("button", text, className);
diff --git a/src/free_claude_code/api/admin_static/form_controls.js b/src/free_claude_code/api/admin_static/form_controls.js
new file mode 100644
index 00000000..4bbeb4a4
--- /dev/null
+++ b/src/free_claude_code/api/admin_static/form_controls.js
@@ -0,0 +1,15 @@
+(() => {
+ "use strict";
+ window.FccFormControls = {
+ configure(node) {
+ if (node.matches('input:not([type="hidden"]), textarea, form')) {
+ node.autocomplete = "off";
+ // Advisory opt-outs for 1Password, Bitwarden, and Dashlane.
+ node.setAttribute("data-1p-ignore", "");
+ node.setAttribute("data-bwignore", "");
+ node.setAttribute("data-form-type", "other");
+ }
+ return node;
+ },
+ };
+})();
diff --git a/src/free_claude_code/api/admin_static/index.html b/src/free_claude_code/api/admin_static/index.html
index 25390cdc..54bf5f9a 100644
--- a/src/free_claude_code/api/admin_static/index.html
+++ b/src/free_claude_code/api/admin_static/index.html
@@ -167,6 +167,7 @@
</div>
</footer>
</div>
+ <script src="/admin/assets/__FCC_VERSION__/form_controls.js"></script>
<script src="/admin/assets/__FCC_VERSION__/model_combobox.js"></script>
<script src="/admin/assets/__FCC_VERSION__/session_ui.js"></script>
<script src="/admin/assets/__FCC_VERSION__/code_sessions.js"></script>
diff --git a/src/free_claude_code/api/admin_static/session_ui.js b/src/free_claude_code/api/admin_static/session_ui.js
index 5fed913e..df7e46d9 100644
--- a/src/free_claude_code/api/admin_static/session_ui.js
+++ b/src/free_claude_code/api/admin_static/session_ui.js
@@ -4,7 +4,7 @@
const element = document.createElement(tag);
if (className) element.className = className;
element.textContent = text;
- return element;
+ return window.FccFormControls.configure(element);
}
function button(label, className, action) {
const element = node("button", className, label);
diff --git a/tests/api/test_admin.py b/tests/api/test_admin.py
index 5d691731..1ed10d4d 100644
--- a/tests/api/test_admin.py
+++ b/tests/api/test_admin.py
@@ -193,6 +193,7 @@ def test_admin_page_uses_installed_version(monkeypatch, tmp_path):
assert 'href="/admin/assets/9.8.7/admin.css"' in response.text
assert 'href="/admin/assets/9.8.7/code_sessions.css"' in response.text
assert 'src="/admin/assets/9.8.7/model_combobox.js"' in response.text
+ assert 'src="/admin/assets/9.8.7/form_controls.js"' in response.text
assert 'src="/admin/assets/9.8.7/code_sessions.js"' in response.text
assert 'src="/admin/assets/9.8.7/admin.js"' in response.text
assert 'href="/admin/assets/admin.css"' not in response.text
@@ -206,6 +207,7 @@ def test_admin_page_uses_installed_version(monkeypatch, tmp_path):
(
("admin.css", "text/css"),
("admin.js", "text/javascript"),
+ ("form_controls.js", "text/javascript"),
("code_sessions.css", "text/css"),
("code_sessions.js", "text/javascript"),
("session_ui.js", "text/javascript"),
diff --git a/uv.lock b/uv.lock
index ce85018f..f5c28971 100644
--- a/uv.lock
+++ b/uv.lock
@@ -598,7 +598,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "6.2.17"
+version = "6.2.18"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },