chore(repo): move desktop app under apps

This commit is contained in:
t8y2 committed 2026-05-18 02:35:39 +08:00
1 parent 5dabdb3985
commit 06683c57b1
424 files changed
+148 -147

No files matched your search

@@ -0,0 +1,107 @@
<script setup lang="ts">
import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Lock, Loader2, ShieldCheck } from "lucide-vue-next";
const props = withDefaults(
defineProps<{
setupMode?: boolean;
}>(),
{ setupMode: false },
);
const emit = defineEmits<{ authenticated: [] }>();
const { t } = useI18n();
const password = ref("");
const confirmPassword = ref("");
const error = ref("");
const loading = ref(false);
async function submit() {
if (props.setupMode && password.value !== confirmPassword.value) {
error.value = t("auth.passwordMismatch");
return;
}
loading.value = true;
error.value = "";
try {
const url = props.setupMode ? "/api/auth/setup" : "/api/auth/login";
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ password: password.value }),
});
if (res.ok) {
emit("authenticated");
} else {
const text = await res.text();
error.value = text || t("auth.loginFailed");
}
} catch (e: any) {
error.value = e?.message || t("auth.connectFailed");
} finally {
loading.value = false;
}
}
</script>
<template>
<div
class="flex items-center justify-center h-screen bg-gradient-to-br from-background via-background to-blue-950/20"
>
<div class="w-[360px] space-y-8">
<div class="flex flex-col items-center gap-4">
<img src="/logo.png" alt="DBX" class="w-20 h-20 rounded-2xl shadow-lg shadow-blue-500/20" />
<div class="text-center">
<h1 class="text-2xl font-bold tracking-tight">DBX</h1>
<p class="text-sm text-muted-foreground mt-1">
{{ setupMode ? t("auth.setupDescription") : t("auth.loginDescription") }}
</p>
</div>
</div>
<form class="space-y-4" @submit.prevent="submit" autocomplete="off">
<div v-if="setupMode" class="flex items-center justify-center gap-2 text-sm text-muted-foreground">
<ShieldCheck class="w-4 h-4" />
<span>{{ t("auth.setupTitle") }}</span>
</div>
<div class="relative">
<Lock class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
<Input
v-model="password"
type="password"
:placeholder="setupMode ? t('auth.newPassword') : t('auth.enterPassword')"
class="pl-10 h-11"
autocomplete="off"
autofocus
/>
</div>
<div v-if="setupMode" class="relative">
<Lock class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
<Input
v-model="confirmPassword"
type="password"
:placeholder="t('auth.confirmPassword')"
class="pl-10 h-11"
autocomplete="off"
/>
</div>
<p v-if="error" class="text-sm text-destructive text-center">{{ error }}</p>
<Button
type="submit"
class="w-full h-11 text-sm font-medium"
:disabled="loading || !password || (setupMode && !confirmPassword)"
>
<Loader2 v-if="loading" class="w-4 h-4 animate-spin mr-2" />
{{ loading ? t("auth.processing") : setupMode ? t("auth.setPassword") : t("auth.login") }}
</Button>
</form>
<p class="text-center text-xs text-muted-foreground/50">Powered by DBX</p>
</div>
</div>
</template>