🔄 refactor(steam): Migrate to Steam OpenID authentication and official Web API (#282)

## 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 -->
This commit is contained in:
Wanjohi
2025-06-02 09:22:18 +03:00
committed by GitHub
parent ae364f69bd
commit c0194ecef4
71 changed files with 8268 additions and 2134 deletions

View File

@@ -1,4 +1,4 @@
import type { Size } from "@nestri/core/src/base-game/base-game.sql";
import type { Size, Links} from "@nestri/core/src/base-game/base-game.sql";
import type { Limitations } from "@nestri/core/src/steam/steam.sql";
import type { ImageColor, ImageDimensions } from "@nestri/core/src/images/images.sql";
import {
@@ -6,7 +6,6 @@ import {
table,
number,
string,
boolean,
enumeration,
createSchema,
relationships,
@@ -38,7 +37,6 @@ const steam_accounts = table("steam_accounts")
name: string(),
status: string(),
user_id: string(),
username: string(),
avatar_hash: string(),
member_since: number(),
last_synced_at: number(),
@@ -53,10 +51,9 @@ const teams = table("teams")
.columns({
id: string(),
name: string(),
slug: string(),
owner_id: string(),
invite_code: string(),
max_members: number(),
owner_steam_id: string(),
...timestamps,
})
.primaryKey("id");
@@ -83,7 +80,7 @@ const games = table("games")
.columns({
base_game_id: string(),
category_slug: string(),
type: enumeration<"tag" | "genre" | "publisher" | "developer">(),
type: enumeration<"tag" | "genre" | "publisher" | "developer" | "categorie" | "franchise">(),
...timestamps
})
.primaryKey("category_slug", "base_game_id", "type")
@@ -93,9 +90,11 @@ const base_games = table("base_games")
id: string(),
slug: string(),
name: string(),
release_date: number(),
// This should be an array, and i dunno how to include it here
size: json<Size>(),
description: string(),
release_date: number(),
links: json<Links>().optional(),
description: string().optional(),
primary_genre: string().optional(),
controller_support: enumeration<"full" | "partial" | "unknown">(),
compatibility: enumeration<"high" | "mid" | "low" | "unknown">(),
@@ -116,13 +115,11 @@ const categories = table("categories")
const game_libraries = table("game_libraries")
.columns({
base_game_id: string(),
owner_id: string(),
time_acquired: number(),
last_played: number(),
total_playtime: number(),
is_family_shared: boolean(),
owner_steam_id: string(),
last_played: number().optional(),
...timestamps
}).primaryKey("base_game_id", "owner_id")
}).primaryKey("base_game_id", "owner_steam_id")
const images = table("images")
.columns({
@@ -150,6 +147,11 @@ export const schema = createSchema({
destSchema: members,
destField: ["steam_id"],
}),
teams: r.many({
sourceField: ["id"],
destSchema: teams,
destField: ["owner_steam_id"],
}),
friends: r.many(
{
sourceField: ["id"],
@@ -166,7 +168,7 @@ export const schema = createSchema({
{
sourceField: ["id"],
destSchema: game_libraries,
destField: ["owner_id"],
destField: ["owner_steam_id"],
},
{
sourceField: ["base_game_id"],
@@ -176,11 +178,6 @@ export const schema = createSchema({
),
})),
relationships(users, (r) => ({
teams: r.many({
sourceField: ["id"],
destSchema: teams,
destField: ["owner_id"],
}),
members: r.many({
sourceField: ["id"],
destSchema: members,
@@ -194,8 +191,8 @@ export const schema = createSchema({
})),
relationships(teams, (r) => ({
owner: r.one({
sourceField: ["owner_id"],
destSchema: users,
sourceField: ["owner_steam_id"],
destSchema: steam_accounts,
destField: ["id"],
}),
members: r.many({
@@ -229,7 +226,7 @@ export const schema = createSchema({
destField: ["base_game_id"],
},
{
sourceField: ["owner_id"],
sourceField: ["owner_steam_id"],
destSchema: steam_accounts,
destField: ["id"],
}
@@ -289,7 +286,7 @@ export const schema = createSchema({
relationships(game_libraries, (r) => ({
owner: r.one({
sourceField: ["owner_id"],
sourceField: ["owner_steam_id"],
destSchema: steam_accounts,
destField: ["id"]
}),