mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 16:55:37 +02:00
## Description <!-- Briefly describe the purpose and scope of your changes --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for managing multiple Steam profiles per user, including a new profiles page with avatar selection and profile management. - Introduced a streamlined Steam authentication flow using a popup window, replacing the previous QR code and team-based login. - Added utilities for Steam image handling and metadata, including avatar preloading and static Steam metadata mappings. - Enhanced OpenID verification for Steam login. - Added new image-related events and expanded event handling for Steam account updates and image processing. - **Improvements** - Refactored the account structure from teams to profiles, updating related UI, context, and storage. - Updated API headers and authentication logic to use Steam IDs instead of team IDs. - Expanded game metadata with new fields for categories, franchises, and social links. - Improved library and category schemas for richer game and profile data. - Simplified and improved Steam API client methods for fetching user info, friends, and game libraries using Steam Web API. - Updated queue processing to handle individual game updates and publish image events. - Adjusted permissions and queue configurations for better message handling and dead-letter queue support. - Improved slug creation and rating estimation utilities. - **Bug Fixes** - Fixed avatar image loading to display higher quality images after initial load. - **Removals** - Removed all team, member, and credential management functionality and related database schemas. - Eliminated the QR code-based login and related UI components. - Deleted legacy team and member database tables and related code. - Removed encryption utilities and deprecated secret keys in favor of new secret management. - **Chores** - Updated dependencies and internal configuration for new features and schema changes. - Cleaned up unused code and updated database migrations for new data structures. - Adjusted import orders and removed unused imports across multiple modules. - Added new resource declarations and updated service link configurations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
150 lines
5.4 KiB
TypeScript
150 lines
5.4 KiB
TypeScript
import '@fontsource-variable/mona-sans';
|
|
import '@fontsource-variable/geist-mono';
|
|
import '@fontsource/geist-sans/400.css';
|
|
import '@fontsource/geist-sans/500.css';
|
|
import '@fontsource/geist-sans/600.css';
|
|
import '@fontsource/geist-sans/700.css';
|
|
import '@fontsource/geist-sans/800.css';
|
|
import '@fontsource/geist-sans/900.css';
|
|
import { Text } from '@nestri/www/ui/text';
|
|
import { styled } from "@macaron-css/solid";
|
|
import { ZeroProvider } from './providers/zero';
|
|
import { ProfilesRoute } from './pages/profiles';
|
|
import { NewProfile } from '@nestri/www/pages/new';
|
|
import { SteamRoute } from '@nestri/www/pages/steam';
|
|
import { OpenAuthProvider } from "@openauthjs/solid";
|
|
import { NotFound } from '@nestri/www/pages/not-found';
|
|
import { Navigate, Route, Router } from "@solidjs/router";
|
|
import { globalStyle, macaron$ } from "@macaron-css/core";
|
|
import { useStorage } from '@nestri/www/providers/account';
|
|
import { Screen as FullScreen } from '@nestri/www/ui/layout';
|
|
import { darkClass, lightClass, theme } from '@nestri/www/ui/theme';
|
|
import { AccountProvider, useAccount } from '@nestri/www/providers/account';
|
|
import { Component, createSignal, Match, onCleanup, Switch } from 'solid-js';
|
|
|
|
const Root = styled("div", {
|
|
base: {
|
|
inset: 0,
|
|
lineHeight: 1,
|
|
fontSynthesis: "none",
|
|
color: theme.color.d1000.gray,
|
|
fontFamily: theme.font.family.body,
|
|
textRendering: "optimizeLegibility",
|
|
WebkitFontSmoothing: "antialised",
|
|
backgroundColor: theme.color.background.d100,
|
|
},
|
|
});
|
|
|
|
globalStyle("html", {
|
|
fontSize: 16,
|
|
fontWeight: 400,
|
|
// Hardcode colors
|
|
"@media": {
|
|
"(prefers-color-scheme: light)": {
|
|
backgroundColor: "#f4f5f6",
|
|
},
|
|
"(prefers-color-scheme: dark)": {
|
|
backgroundColor: "rgb(19,21,23)",
|
|
},
|
|
},
|
|
});
|
|
|
|
globalStyle("dialog:modal", {
|
|
maxHeight: "unset",
|
|
maxWidth: "unset"
|
|
})
|
|
|
|
globalStyle("h1, h2, h3, h4, h5, h6, p", {
|
|
margin: 0,
|
|
});
|
|
|
|
macaron$(() =>
|
|
["::placeholder", ":-ms-input-placeholder"].forEach((selector) =>
|
|
globalStyle(selector, {
|
|
opacity: 1,
|
|
color: theme.color.d1000.gray,
|
|
}),
|
|
),
|
|
);
|
|
|
|
globalStyle("body", {
|
|
cursor: "default",
|
|
});
|
|
|
|
globalStyle("*", {
|
|
boxSizing: "border-box",
|
|
});
|
|
|
|
export const App: Component = () => {
|
|
const [theme, setTheme] = createSignal<string>(
|
|
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
? "dark"
|
|
: "light",
|
|
);
|
|
|
|
const darkMode = window.matchMedia("(prefers-color-scheme: dark)");
|
|
const setColorScheme = (e: MediaQueryListEvent) => {
|
|
setTheme(e.matches ? "dark" : "light");
|
|
};
|
|
darkMode.addEventListener("change", setColorScheme);
|
|
onCleanup(() => {
|
|
darkMode.removeEventListener("change", setColorScheme);
|
|
});
|
|
|
|
const storage = useStorage();
|
|
|
|
return (
|
|
<OpenAuthProvider
|
|
issuer={import.meta.env.VITE_AUTH_URL}
|
|
clientID="web"
|
|
>
|
|
<Root class={theme() === "light" ? lightClass : darkClass}>
|
|
<Router>
|
|
<Route
|
|
path="*"
|
|
component={(props) => (
|
|
<AccountProvider
|
|
loadingUI={
|
|
<FullScreen>
|
|
<Text weight='semibold' spacing='xs' size="3xl" font="heading" >Confirming your identity…</Text>
|
|
</FullScreen>
|
|
}>
|
|
<ZeroProvider>
|
|
{/* props.children */}
|
|
{props.children}
|
|
</ZeroProvider>
|
|
</AccountProvider>
|
|
)}
|
|
>
|
|
<Route path=":steamID">{SteamRoute}</Route>
|
|
<Route path="profiles" component={ProfilesRoute} />
|
|
<Route path="new" component={NewProfile} />
|
|
<Route
|
|
path="/"
|
|
component={() => {
|
|
const account = useAccount();
|
|
return (
|
|
<Switch>
|
|
<Match when={account.current.profiles.length > 0}>
|
|
<Navigate
|
|
href={`/${(
|
|
account.current.profiles.find(
|
|
(w) => w.id === storage.value.steam,
|
|
) || account.current.profiles[0]
|
|
).id}`}
|
|
/>
|
|
</Match>
|
|
<Match when={true}>
|
|
<Navigate href={`/new`} />
|
|
</Match>
|
|
</Switch>
|
|
);
|
|
}}
|
|
/>
|
|
<Route path="*" component={() => <NotFound />} />
|
|
</Route>
|
|
</Router>
|
|
</Root>
|
|
</OpenAuthProvider>
|
|
)
|
|
} |