mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
🔄 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:
@@ -1,10 +1,10 @@
|
||||
import { bus } from "./bus";
|
||||
import { auth } from "./auth";
|
||||
import { domain } from "./dns";
|
||||
import { secret } from "./secret";
|
||||
import { cluster } from "./cluster";
|
||||
import { postgres } from "./postgres";
|
||||
import { LibraryQueue } from "./steam";
|
||||
import { secret, steamEncryptionKey } from "./secret";
|
||||
import { libraryQueue } from "./steam";
|
||||
|
||||
export const apiService = new sst.aws.Service("Api", {
|
||||
cluster,
|
||||
@@ -14,8 +14,8 @@ export const apiService = new sst.aws.Service("Api", {
|
||||
bus,
|
||||
auth,
|
||||
postgres,
|
||||
LibraryQueue,
|
||||
steamEncryptionKey,
|
||||
libraryQueue,
|
||||
secret.SteamApiKey,
|
||||
secret.PolarSecret,
|
||||
secret.PolarWebhookSecret,
|
||||
secret.NestriFamilyMonthly,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { bus } from "./bus";
|
||||
import { domain } from "./dns";
|
||||
import { secret } from "./secret";
|
||||
import { cluster } from "./cluster";
|
||||
import { postgres } from "./postgres";
|
||||
import { secret, steamEncryptionKey } from "./secret";
|
||||
|
||||
export const authService = new sst.aws.Service("Auth", {
|
||||
cluster,
|
||||
@@ -13,7 +13,6 @@ export const authService = new sst.aws.Service("Auth", {
|
||||
bus,
|
||||
postgres,
|
||||
secret.PolarSecret,
|
||||
steamEncryptionKey,
|
||||
secret.GithubClientID,
|
||||
secret.DiscordClientID,
|
||||
secret.GithubClientSecret,
|
||||
|
||||
19
infra/bus.ts
19
infra/bus.ts
@@ -1,8 +1,8 @@
|
||||
import { vpc } from "./vpc";
|
||||
import { storage } from "./storage";
|
||||
import { secret } from "./secret";
|
||||
// import { email } from "./email";
|
||||
import { storage } from "./storage";
|
||||
import { postgres } from "./postgres";
|
||||
import { steamEncryptionKey } from "./secret";
|
||||
|
||||
export const bus = new sst.aws.Bus("Bus");
|
||||
|
||||
@@ -11,16 +11,25 @@ bus.subscribe("Event", {
|
||||
handler: "packages/functions/src/events/index.handler",
|
||||
link: [
|
||||
// email,
|
||||
postgres,
|
||||
bus,
|
||||
storage,
|
||||
steamEncryptionKey
|
||||
postgres,
|
||||
secret.PolarSecret,
|
||||
secret.SteamApiKey
|
||||
],
|
||||
timeout: "10 minutes",
|
||||
memory: "3002 MB",// For faster processing of large(r) images
|
||||
permissions: [
|
||||
{
|
||||
actions: ["ses:SendEmail"],
|
||||
actions: ["ses:SendEmail","sqs:SendMessage"],
|
||||
resources: ["*"],
|
||||
},
|
||||
],
|
||||
// transform: {
|
||||
// function: {
|
||||
// deadLetterConfig: {
|
||||
// targetArn: EventDlq.arn,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
});
|
||||
@@ -1,6 +1,5 @@
|
||||
import { vpc } from "./vpc";
|
||||
import { isPermanentStage } from "./stage";
|
||||
import { steamEncryptionKey } from "./secret";
|
||||
|
||||
// TODO: Add a dev db to use, this will help with running zero locally... and testing it
|
||||
export const postgres = new sst.aws.Aurora("Database", {
|
||||
@@ -42,7 +41,7 @@ export const postgres = new sst.aws.Aurora("Database", {
|
||||
|
||||
|
||||
new sst.x.DevCommand("Studio", {
|
||||
link: [postgres, steamEncryptionKey],
|
||||
link: [postgres],
|
||||
dev: {
|
||||
command: "bun db:dev studio",
|
||||
directory: "packages/core",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const secret = {
|
||||
PolarSecret: new sst.Secret("PolarSecret", process.env.POLAR_API_KEY),
|
||||
SteamApiKey: new sst.Secret("SteamApiKey"),
|
||||
GithubClientID: new sst.Secret("GithubClientID"),
|
||||
DiscordClientID: new sst.Secret("DiscordClientID"),
|
||||
PolarWebhookSecret: new sst.Secret("PolarWebhookSecret"),
|
||||
@@ -14,17 +15,4 @@ export const secret = {
|
||||
NestriFamilyYearly: new sst.Secret("NestriFamilyYearly"),
|
||||
};
|
||||
|
||||
export const allSecrets = Object.values(secret);
|
||||
|
||||
sst.Linkable.wrap(random.RandomString, (resource) => ({
|
||||
properties: {
|
||||
value: resource.result,
|
||||
},
|
||||
}));
|
||||
|
||||
export const steamEncryptionKey = new random.RandomString(
|
||||
"SteamEncryptionKey",
|
||||
{
|
||||
length: 32,
|
||||
},
|
||||
);
|
||||
export const allSecrets = Object.values(secret);
|
||||
@@ -1,19 +1,29 @@
|
||||
import { bus } from "./bus";
|
||||
import { vpc } from "./vpc";
|
||||
import { secret } from "./secret";
|
||||
import { postgres } from "./postgres";
|
||||
import { steamEncryptionKey } from "./secret";
|
||||
|
||||
export const LibraryQueue = new sst.aws.Queue("LibraryQueue", {
|
||||
fifo: true,
|
||||
visibilityTimeout: "10 minutes",
|
||||
export const libraryDlq = new sst.aws.Queue("LibraryDLQ");
|
||||
|
||||
export const libraryQueue = new sst.aws.Queue("LibraryQueue", {
|
||||
dlq: libraryDlq.arn,
|
||||
visibilityTimeout: "5 minutes",
|
||||
});
|
||||
|
||||
LibraryQueue.subscribe({
|
||||
libraryQueue.subscribe({
|
||||
vpc,
|
||||
timeout: "10 minutes",
|
||||
memory: "3002 MB",
|
||||
timeout: "5 minutes",
|
||||
handler: "packages/functions/src/queues/library.handler",
|
||||
link: [
|
||||
bus,
|
||||
postgres,
|
||||
steamEncryptionKey
|
||||
secret.SteamApiKey
|
||||
],
|
||||
permissions: [
|
||||
{
|
||||
actions: ["sqs:SendMessage"],
|
||||
resources: ["*"],
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user