mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +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 -->
98 lines
2.7 KiB
TypeScript
98 lines
2.7 KiB
TypeScript
import { bus } from "./bus";
|
|
import { domain } from "./dns";
|
|
import { secret } from "./secret";
|
|
import { cluster } from "./cluster";
|
|
import { postgres } from "./postgres";
|
|
|
|
export const authService = new sst.aws.Service("Auth", {
|
|
cluster,
|
|
cpu: $app.stage === "production" ? "1 vCPU" : undefined,
|
|
memory: $app.stage === "production" ? "2 GB" : undefined,
|
|
command: ["bun", "run", "./src/auth/index.ts"],
|
|
link: [
|
|
bus,
|
|
postgres,
|
|
secret.PolarSecret,
|
|
secret.GithubClientID,
|
|
secret.DiscordClientID,
|
|
secret.GithubClientSecret,
|
|
secret.DiscordClientSecret,
|
|
],
|
|
image: {
|
|
dockerfile: "packages/functions/Containerfile",
|
|
},
|
|
environment: {
|
|
NO_COLOR: "1",
|
|
STORAGE: "/tmp/persist.json"
|
|
},
|
|
loadBalancer: {
|
|
rules: [
|
|
{
|
|
listen: "80/http",
|
|
forward: "3002/http",
|
|
},
|
|
],
|
|
},
|
|
permissions: [
|
|
{
|
|
actions: ["ses:SendEmail"],
|
|
resources: ["*"],
|
|
},
|
|
],
|
|
dev: {
|
|
command: "bun dev:auth",
|
|
directory: "packages/functions",
|
|
url: "http://localhost:3002",
|
|
},
|
|
scaling:
|
|
$app.stage === "production"
|
|
? {
|
|
min: 2,
|
|
max: 10,
|
|
}
|
|
: undefined,
|
|
//For temporarily persisting the persist.json
|
|
transform: {
|
|
taskDefinition: (args) => {
|
|
const volumes = $output(args.volumes).apply(v => {
|
|
const next = [...v, {
|
|
name: "shared-tmp",
|
|
dockerVolumeConfiguration: {
|
|
scope: "shared",
|
|
driver: "local"
|
|
}
|
|
}];
|
|
|
|
return next;
|
|
})
|
|
|
|
// "containerDefinitions" is a JSON string, parse first
|
|
let containers = $jsonParse(args.containerDefinitions);
|
|
|
|
containers = containers.apply((containerDefinitions) => {
|
|
containerDefinitions[0].mountPoints = [
|
|
...(containerDefinitions[0].mountPoints ?? []),
|
|
{
|
|
sourceVolume: "shared-tmp",
|
|
containerPath: "/tmp"
|
|
}
|
|
]
|
|
return containerDefinitions;
|
|
});
|
|
|
|
args.volumes = volumes
|
|
args.containerDefinitions = $jsonStringify(containers);
|
|
}
|
|
}
|
|
});
|
|
|
|
export const auth = !$dev ? new sst.aws.Router("AuthRoute", {
|
|
routes: {
|
|
// I think auth.url should work all the same
|
|
"/*": authService.nodes.loadBalancer.dnsName,
|
|
},
|
|
domain: {
|
|
name: "auth." + domain,
|
|
dns: sst.cloudflare.dns(),
|
|
},
|
|
}) : authService |