Compare commits
No commits in common. "5302cb9d72018a41fc5c59da19fcd4ae2f1ea574" and "7036338b336d39b388d67751d8dfd3e6b26fc70c" have entirely different histories.
5302cb9d72
...
7036338b33
@ -3,24 +3,14 @@
|
||||
<div class="view active">
|
||||
<h1>👋 Welcome! <a v-if="isAdmin" href="/auth/admin/" class="admin-link" title="Admin Console">Admin</a></h1>
|
||||
<div v-if="authStore.userInfo?.user" class="user-info">
|
||||
<h3 class="user-name-heading">
|
||||
<span class="icon">👤</span>
|
||||
<span v-if="!editingName" class="user-name-row">
|
||||
<span class="display-name" :title="authStore.userInfo.user.user_name">{{ authStore.userInfo.user.user_name }}</span>
|
||||
<button class="mini-btn" @click="startEdit" title="Edit name">✏️</button>
|
||||
</span>
|
||||
<span v-else class="user-name-row editing">
|
||||
<input
|
||||
v-model="newName"
|
||||
class="name-input"
|
||||
:placeholder="authStore.userInfo.user.user_name"
|
||||
:disabled="authStore.isLoading"
|
||||
maxlength="64"
|
||||
@keyup.enter="saveName"
|
||||
/>
|
||||
<button class="mini-btn" @click="saveName" :disabled="authStore.isLoading" title="Save name">💾</button>
|
||||
<button class="mini-btn" @click="cancelEdit" :disabled="authStore.isLoading" title="Cancel">✖</button>
|
||||
</span>
|
||||
<h3>
|
||||
👤
|
||||
<template v-if="!editingName">{{ authStore.userInfo.user.user_name }} <button class="mini-btn" @click="startEdit" title="Edit name">✏️</button></template>
|
||||
<template v-else>
|
||||
<input v-model="newName" :placeholder="authStore.userInfo.user.user_name" :disabled="authStore.isLoading" maxlength="64" @keyup.enter="saveName" />
|
||||
<button class="mini-btn" @click="saveName" :disabled="authStore.isLoading">💾</button>
|
||||
<button class="mini-btn" @click="cancelEdit" :disabled="authStore.isLoading">✖</button>
|
||||
</template>
|
||||
</h3>
|
||||
<span><strong>Visits:</strong></span>
|
||||
<span>{{ authStore.userInfo.user.visits || 0 }}</span>
|
||||
@ -196,61 +186,7 @@ async function saveName() {
|
||||
.user-info span {
|
||||
text-align: left;
|
||||
}
|
||||
.user-name-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 0 0.25rem 0;
|
||||
}
|
||||
.user-name-row {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
max-width: 100%;
|
||||
}
|
||||
.user-name-row.editing { flex: 1 1 auto; }
|
||||
.icon { flex: 0 0 auto; }
|
||||
.display-name {
|
||||
font-weight: 600;
|
||||
font-size: 1.05em;
|
||||
line-height: 1.2;
|
||||
max-width: 14ch;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.name-input {
|
||||
width: auto;
|
||||
flex: 1 1 140px;
|
||||
min-width: 120px;
|
||||
padding: 6px 8px;
|
||||
font-size: 0.9em;
|
||||
border: 1px solid #a9c5d6;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.user-name-heading .name-input { width: auto; }
|
||||
.name-input:focus { outline: 2px solid #667eea55; border-color: #667eea; }
|
||||
.mini-btn {
|
||||
width: auto;
|
||||
padding: 4px 6px;
|
||||
margin: 0;
|
||||
font-size: 0.75em;
|
||||
line-height: 1;
|
||||
background: #eef5fa;
|
||||
border: 1px solid #b7d2e3;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s, transform 0.15s;
|
||||
}
|
||||
.mini-btn:hover:not(:disabled) { background: #dcecf6; }
|
||||
.mini-btn:active:not(:disabled) { transform: translateY(1px); }
|
||||
.mini-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
@media (max-width: 480px) {
|
||||
.user-name-heading { flex-direction: column; align-items: flex-start; }
|
||||
.user-name-row.editing { width: 100%; }
|
||||
.display-name { max-width: 100%; }
|
||||
}
|
||||
.mini-btn { font-size: 0.7em; margin-left: 0.3em; }
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
|
@ -138,20 +138,20 @@ def main():
|
||||
|
||||
default_port = DEFAULT_DEV_PORT if args.command == "dev" else DEFAULT_SERVE_PORT
|
||||
host, port, uds, all_ifaces = parse_endpoint(args.hostport, default_port)
|
||||
devmode = args.command == "dev"
|
||||
reload_enabled = args.command == "dev"
|
||||
|
||||
# Determine origin (dev mode default override)
|
||||
origin = args.origin
|
||||
if devmode and not args.origin and not args.rp_id:
|
||||
# Dev mode: Vite runs on another port, override:
|
||||
origin = "http://localhost:4403"
|
||||
effective_origin = args.origin
|
||||
if reload_enabled and not effective_origin:
|
||||
# Use a distinct port (4403) for RP origin in dev if not explicitly provided
|
||||
effective_origin = "http://localhost:4403"
|
||||
|
||||
# Export configuration via environment for lifespan initialization in each process
|
||||
os.environ.setdefault("PASSKEY_RP_ID", args.rp_id)
|
||||
if args.rp_name:
|
||||
os.environ["PASSKEY_RP_NAME"] = args.rp_name
|
||||
if origin:
|
||||
os.environ["PASSKEY_ORIGIN"] = origin
|
||||
if effective_origin:
|
||||
os.environ["PASSKEY_ORIGIN"] = effective_origin
|
||||
|
||||
# One-time initialization + bootstrap before starting any server processes.
|
||||
# Lifespan in worker processes will call globals.init with bootstrap disabled.
|
||||
@ -161,7 +161,7 @@ def main():
|
||||
_globals.init(
|
||||
rp_id=args.rp_id,
|
||||
rp_name=args.rp_name,
|
||||
origin=origin,
|
||||
origin=effective_origin,
|
||||
default_admin=os.getenv("PASSKEY_DEFAULT_ADMIN") or None,
|
||||
default_org=os.getenv("PASSKEY_DEFAULT_ORG") or None,
|
||||
bootstrap=True,
|
||||
@ -169,7 +169,7 @@ def main():
|
||||
)
|
||||
|
||||
run_kwargs: dict = {
|
||||
"reload": devmode,
|
||||
"reload": reload_enabled,
|
||||
"log_level": "info",
|
||||
}
|
||||
if uds:
|
||||
@ -181,7 +181,7 @@ def main():
|
||||
run_kwargs["port"] = port
|
||||
|
||||
bun_process: subprocess.Popen | None = None
|
||||
if devmode:
|
||||
if reload_enabled:
|
||||
# Spawn frontend dev server (bun) only in the original parent (avoid duplicates on reload)
|
||||
if os.environ.get("PASSKEY_BUN_PARENT") != "1":
|
||||
os.environ["PASSKEY_BUN_PARENT"] = "1"
|
||||
@ -189,7 +189,7 @@ def main():
|
||||
if (frontend_dir / "package.json").exists():
|
||||
try:
|
||||
bun_process = subprocess.Popen(
|
||||
["bun", "--bun", "run", "dev"], cwd=str(frontend_dir)
|
||||
["bun", "run", "dev"], cwd=str(frontend_dir)
|
||||
)
|
||||
logging.info("Started bun dev server")
|
||||
except FileNotFoundError:
|
||||
@ -213,7 +213,7 @@ def main():
|
||||
|
||||
if all_ifaces and not uds:
|
||||
# If reload enabled, fallback to single dual-stack attempt (::) to keep reload simple
|
||||
if devmode:
|
||||
if reload_enabled:
|
||||
run_kwargs["host"] = "::"
|
||||
run_kwargs["port"] = port
|
||||
uvicorn.run("passkey.fastapi:app", **run_kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user