Skip to content

An open-source, self-hosted system for apps built with web technologies.

Release System 0.1.40

zohayrslileh5bab69f35a2a
diff --git a/package.json b/package.json
index 11e72a4..8bc37be 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "phreshos",
"displayName": "PhreshOS",
- "version": "0.1.39",
+ "version": "0.1.40",
"description": "The PhreshOS server, desktop, and authoritative system runtime.",
"type": "module",
"private": true,
diff --git a/source/client/view/structure/authentication/credentials-form.tsx b/source/client/view/structure/authentication/credentials-form.tsx
index 4436b70..d7dbf64 100644
--- a/source/client/view/structure/authentication/credentials-form.tsx
+++ b/source/client/view/structure/authentication/credentials-form.tsx
@@ -3,11 +3,12 @@ import { enterSurface, prepareSurfaceEntrance, restSurface } from "../../appeara
import { useReducedMotion } from "@libs/react-motion"
import { Surface, useAppearance, useResolveTheme, useScale } from "@phreshos/react-ui"
import { obscuredBackground } from "../../components/loading"
+import Spinner from "../../components/spinner"
import Alert from "../../components/alert"
import { type SyntheticEvent, useLayoutEffect, useRef } from "react"
/** The common username-and-password surface for registration and sign-in. */
-export default function CredentialsForm({ title, description, submitLabel, passwordAutocomplete, requirements, error, onSubmit }: CredentialsFormProps) {
+export default function CredentialsForm({ title, description, submitLabel, passwordAutocomplete, requirements, error, pending, onSubmit }: CredentialsFormProps) {
const surface = useRef<HTMLFormElement>(null)
@@ -38,6 +39,8 @@ export default function CredentialsForm({ title, description, submitLabel, passw
event.preventDefault()
+ if (pending) return
+
const data = new FormData(event.currentTarget)
onSubmit(String(data.get("username") ?? ""), String(data.get("password") ?? ""))
@@ -53,6 +56,8 @@ export default function CredentialsForm({ title, description, submitLabel, passw
className="relative isolate m-auto grid w-[min(24rem,calc(100%-2rem))] grid-rows-[auto_minmax(0,1fr)] text-slate-800 shadow-window-active"
+ aria-busy={pending}
+
onSubmit={submit}
>
@@ -89,6 +94,8 @@ export default function CredentialsForm({ title, description, submitLabel, passw
required
+ disabled={pending}
+
autoFocus
className="h-10 rounded-lg border border-white/70 bg-white/70 px-3 font-normal shadow-window-content outline-none focus:border-sky-400 focus:ring-2 focus:ring-sky-200/80"
@@ -115,6 +122,8 @@ export default function CredentialsForm({ title, description, submitLabel, passw
required
+ disabled={pending}
+
className="h-10 rounded-lg border border-white/70 bg-white/70 px-3 font-normal shadow-window-content outline-none focus:border-sky-400 focus:ring-2 focus:ring-sky-200/80"
/>
@@ -135,11 +144,13 @@ export default function CredentialsForm({ title, description, submitLabel, passw
type="submit"
+ disabled={pending}
+
className="h-10 cursor-pointer rounded-lg border border-sky-700/35 from-sky-500 to-sky-600 px-4 font-medium text-white shadow-taskbar-control outline-none hover:from-sky-400 hover:to-sky-500 focus-visible:ring-2 focus-visible:ring-white/90"
>
- {submitLabel}
+ {pending ? <Spinner className="m-auto size-5" /> : submitLabel}
</button>
@@ -164,5 +175,7 @@ interface CredentialsFormProps {
error?: string | null
+ pending: boolean
+
onSubmit: (username: string, password: string) => void
}
diff --git a/source/client/view/structure/authentication/register.tsx b/source/client/view/structure/authentication/register.tsx
index 404ac72..b4ea61a 100644
--- a/source/client/view/structure/authentication/register.tsx
+++ b/source/client/view/structure/authentication/register.tsx
@@ -1,7 +1,6 @@
import { type AuthenticationState, type RegistrationError } from "@server/core/authentication/authentication"
import CredentialsForm from "./credentials-form"
import { LinkManagerContext } from "../../contexts"
-import Loading from "../../components/loading"
import usePromise from "@libs/react-promise"
import useStorage from "@libs/storage-hook"
@@ -22,8 +21,6 @@ export default function Register({ state, onClosed }: RegisterProps) {
return "error" in response ? message(response.error, state) : null
})
- if (registration.isPending) return <Loading />
-
return <CredentialsForm
title="Set up your system"
@@ -38,6 +35,8 @@ export default function Register({ state, onClosed }: RegisterProps) {
error={registration.exception ? String(registration.exception.current) : registration.solve?.current}
+ pending={registration.isPending}
+
onSubmit={registration.safeExecute}
/>
diff --git a/source/client/view/structure/authentication/sign-in.tsx b/source/client/view/structure/authentication/sign-in.tsx
index a666cef..8af2da3 100644
--- a/source/client/view/structure/authentication/sign-in.tsx
+++ b/source/client/view/structure/authentication/sign-in.tsx
@@ -1,6 +1,5 @@
import CredentialsForm from "./credentials-form"
import { LinkManagerContext } from "../../contexts"
-import Loading from "../../components/loading"
import usePromise from "@libs/react-promise"
import useStorage from "@libs/storage-hook"
@@ -19,8 +18,6 @@ export default function () {
return !!authorizationToken
})
- if (signIn.isPending) return <Loading />
-
return <CredentialsForm
title="Sign in"
@@ -33,6 +30,8 @@ export default function () {
error={signIn.exception ? String(signIn.exception.current) : signIn.solve && !signIn.solve.current ? "The username or password is incorrect." : null}
+ pending={signIn.isPending}
+
onSubmit={signIn.safeExecute}
/>