Author SHA1 Message Date
ahp ea821ff70b feat(web): show/hide toggle on the login password field
- an eye button inside the password field switches it between hidden
  and plain text; it is labelled for screen readers, exposes its state
  with aria-pressed and resets when the sign-in mode changes
- the field stays LTR, so the button sits at its right edge in both
  languages
2026-11-26 17:58:21 +03:30
6 changed files with 41 additions and 84 deletions

No files matched your search

+1 -3
View File
@@ -51,9 +51,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) and the proje
worker with timestamp-midpoint trimming, enabling the progress stream
and duration caps: 30 min on WebGPU, 10 min on WASM, 60 MB per file —
no input can wedge the demo at an eternal "processing" state anymore.
- `CONTRIBUTING.fa.md`: a Persian translation of the contribution guide,
with a language switcher in both files like the READMEs (#31).
- A show/hide toggle (eye icon) on the login page's password field.
### Changed
-64
View File
@@ -1,64 +0,0 @@
# مشارکت در سخن
[English](CONTRIBUTING.md) | **فارسی**
ممنون که به سخن سر زدید. این مخزن یک کیت گفتار به متنِ فارسی است که
می‌شود سلف‌هاستش کرد: یک بک‌اند FastAPI با موتور faster-whisper، یک ورکر
Celery، یک داشبورد Next.js (فارسی‌محور و راست‌به‌چپ)، یک ربات تلگرام
اختیاری، یک پایپ‌لاین فاین‌تیونِ LoRA با نتایجِ اندازه‌گیری‌شده، و یک دموی
عمومیِ مرورگری روی Hugging Face.
## راه‌اندازی محیط توسعه
برای بک‌اند و ربات Python 3.12 و برای داشبورد وب Node 22 لازم است:
pip install -e "backend[dev]" -e "bot[dev]"
cd web && npm ci
وابستگی‌های سنگین (torch / faster-whisper) فقط برای ابزارهای آموزش و
بنچمارک لازم‌اند:
pip install -r training/requirements.txt -r benchmarks/requirements.txt
pip install -r space/gradio/requirements.txt # self-hostable Gradio demo
## تست‌ها، لینت و نظم کامیت‌ها
CI روی هر push و pull request همین دستورها را اجرا می‌کند:
ruff check backend bot training benchmarks space deploy
mypy --config-file backend/pyproject.toml backend/sokhan
pytest backend/tests bot/tests
cd web && npm ci && npm run build
هوک‌های pre-commit (ruff به‌علاوهٔ چند بررسی پایه) را برای هر کلون یک بار
فعال کنید:
pip install pre-commit && pre-commit install
پیام کامیت‌ها از Conventional Commits پیروی می‌کنند (`feat:`، `fix:`،
`docs:`، ...) و نسخه‌گذاری پروژه بر اساس Semantic Versioning است؛ هر
تغییری که کاربر می‌بیند یک خط در CHANGELOG.md می‌گیرد.
## دموی مرورگری و ورک‌فلوی sync-space
`space/` دموی استاتیکی است که Whisper در آن کاملاً سمتِ مرورگر اجرا
می‌شود (transformers.js). ورک‌فلوی `Sync demo Space` با هر push‌ای که به
`space/` دست بزند، آن را با سکرتِ `HF_TOKEN` در Actions مخزن روی
hf.co/spaces/Abol0pati/sokhan-fa-demo منتشر می‌کند - برای همین دموی
عمومی هیچ‌وقت از `main` عقب نمی‌ماند. `space/gradio/` یک اپ جدا و
سلف‌هاست‌شدنی است که چک‌پوینتِ فاین‌تیون‌شده را با همان تنظیمات موتورِ
محیط production سرو می‌کند؛ این اپ عمداً روی Space عمومی آپلود نمی‌شود
(قیمت‌گذاری ۲۰۲۶ هاگینگ‌فیس، Spaceهای میزبانی‌شدهٔ Gradio/Docker را پشت
اشتراک PRO قفل کرده است).
## قاعدهٔ «اول اندازه‌گیری»
هر ادعایی دربارهٔ دقت (WER، CER، سرعت) که در README، کارت مدل یا
changelog می‌آید باید از `benchmarks/benchmark_wer.py` (یا ارزیابیِ
نوت‌بوک) آمده باشد و فیکسچر و سخت‌افزارش ذکر شده باشد. هیچ عددِ ساختگی
پذیرفته نیست.
## امنیت
گزارش‌های امنیتی را به‌صورت issue عمومی باز نکنید - برای افشای خصوصی
SECURITY.md را ببینید.
-2
View File
@@ -1,7 +1,5 @@
# Contributing to Sokhan
**English** | [فارسی](CONTRIBUTING.fa.md)
Thanks for looking into Sokhan. This repo is a self-hostable Persian
speech-to-text kit: a FastAPI backend with a faster-whisper engine, a
Celery worker, a Next.js (Persian-first, RTL) dashboard, an optional
+2
View File
@@ -53,6 +53,8 @@
"emailPlaceholder": "you@example.com",
"passwordLabel": "Password",
"passwordPlaceholder": "••••••••",
"showPassword": "Show password",
"hidePassword": "Hide password",
"codeLabel": "Connect code",
"codePlaceholder": "Enter your connect code",
"codeHint": "Have a connect code? No email or password needed.",
+2
View File
@@ -53,6 +53,8 @@
"emailPlaceholder": "you@example.com",
"passwordLabel": "رمز عبور",
"passwordPlaceholder": "••••••••",
"showPassword": "نمایش رمز عبور",
"hidePassword": "پنهان کردن رمز عبور",
"codeLabel": "کد اتصال",
"codePlaceholder": "کد اتصال را وارد کن",
"codeHint": "اگر کد اتصال داری، لازم نیست ایمیل و رمز عبور وارد کنی.",
+36 -15
View File
@@ -2,6 +2,7 @@
import { useState, type FormEvent } from "react";
import { useTranslations } from "next-intl";
import { Eye, EyeOff } from "lucide-react";
import { useRouter } from "@/i18n/navigation";
import { ApiError, login, register, setToken, tokenLogin } from "@/lib/api";
@@ -17,6 +18,7 @@ export default function LoginPage() {
const [mode, setMode] = useState<Mode>("login");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [code, setCode] = useState("");
const [emailError, setEmailError] = useState<string | null>(null);
const [passwordError, setPasswordError] = useState<string | null>(null);
@@ -27,6 +29,7 @@ export default function LoginPage() {
function switchMode(next: Mode) {
if (next === mode) return;
setMode(next);
setShowPassword(false);
setEmailError(null);
setPasswordError(null);
setCodeError(null);
@@ -176,21 +179,39 @@ export default function LoginPage() {
>
{t("passwordLabel")}
</label>
<input
id="login-password"
name="password"
type="password"
dir="ltr"
autoComplete={mode === "register" ? "new-password" : "current-password"}
value={password}
onChange={(event) => {
setPassword(event.target.value);
if (passwordError) setPasswordError(null);
}}
placeholder={t("passwordPlaceholder")}
aria-invalid={passwordError ? true : undefined}
className={inputClasses}
/>
{/* The field is always LTR, so the toggle sits at its physical right. */}
<div className="relative" dir="ltr">
<input
id="login-password"
name="password"
type={showPassword ? "text" : "password"}
dir="ltr"
autoComplete={mode === "register" ? "new-password" : "current-password"}
value={password}
onChange={(event) => {
setPassword(event.target.value);
if (passwordError) setPasswordError(null);
}}
placeholder={t("passwordPlaceholder")}
aria-invalid={passwordError ? true : undefined}
className={`${inputClasses} pr-11`}
/>
<button
type="button"
onClick={() => setShowPassword((shown) => !shown)}
aria-label={showPassword ? t("hidePassword") : t("showPassword")}
aria-pressed={showPassword}
aria-controls="login-password"
title={showPassword ? t("hidePassword") : t("showPassword")}
className="absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-e-lg text-stone-500 transition-colors hover:text-stone-800 focus-visible:ring-2 focus-visible:ring-teal-700"
>
{showPassword ? (
<EyeOff className="h-5 w-5" aria-hidden="true" />
) : (
<Eye className="h-5 w-5" aria-hidden="true" />
)}
</button>
</div>
{passwordError ? (
<p className="mt-1.5 text-sm text-red-700">{passwordError}</p>
) : mode === "register" ? (