Skip to content

Commit 3b3f188

Browse files
rainerstudiosclaude
andcommitted
Add Better Auth official schema and dual authentication system
- Created Better Auth official schema (user, session, account, verification tables) - Updated dual-auth middleware to query Better Auth tables - Added automatic user sync between Better Auth and legacy users table - Steam inventory endpoints now work with Better Auth sessions - Backend supports both JWT tokens and Better Auth session tokens How it works: 1. Frontend authenticates with Better Auth (Steam OAuth) 2. Better Auth creates session in "session" table 3. Backend middleware verifies session token 4. User data synced to legacy "users" table for portfolio access 5. All portfolio features work seamlessly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 63927ed commit 3b3f188

644 files changed

Lines changed: 62827 additions & 354 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config.js.backup.1761894019

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
module.exports = {
2+
// Configuration for the HTTP API server
3+
'http': {
4+
'port': 3002
5+
},
6+
// Whether to trust a forwarding proxy's IP (trust X-Forwarded-For)
7+
'trust_proxy': true,
8+
// List of usernames and passwords for the Steam accounts
9+
'logins': [
10+
{
11+
'user': 'xgamingserver3',
12+
'pass': '7U33,5mL5iU9(Bd'
13+
},
14+
{
15+
'user': 'xgamingserver1',
16+
'pass': '+8Bpv_fhgBjxZwm'
17+
},
18+
{
19+
'user': 'johnsonk01',
20+
'pass': 'ChAng3M3'
21+
},
22+
{
23+
'user': 'tawala2',
24+
'pass': '&,QMXt[Ru<4!d"w'
25+
}
26+
],
27+
// Optional HTTP/SOCKS5 proxies to auto-rotate for each bot in a round-robin
28+
// Bot assignment: bot[0]=proxy[0], bot[1]=proxy[1], bot[2]=proxy[2], etc.
29+
'proxies': [
30+
'http://pjukyfij:3q9caatdky72@31.59.20.176:6754/', // Bot 0 (xgamingserver3) ✅
31+
'http://pjukyfij:3q9caatdky72@45.38.107.97:6014/', // Bot 1 (xgamingserver1) ✅
32+
'http://pjukyfij:3q9caatdky72@107.172.163.27:6543/', // Bot 2 (johnsonk01) ✅
33+
'http://pjukyfij:3q9caatdky72@64.137.96.74:6641/', // Backup proxy 4 ✅
34+
'http://pjukyfij:3q9caatdky72@216.10.27.159:6837/', // Backup proxy 5 ✅
35+
'http://pjukyfij:3q9caatdky72@142.111.67.146:5611/', // Backup proxy 6 ✅
36+
'http://pjukyfij:3q9caatdky72@142.147.128.93:6593/', // Backup proxy 7 ✅
37+
38+
],
39+
// Bot settings
40+
'bot_settings': {
41+
// Amount of attempts for each request to Valve (increased for better resilience)
42+
'max_attempts': 3,
43+
// Amount of milliseconds to wait between subsequent requests to Valve (per bot)
44+
'request_delay': 1100,
45+
// Amount of milliseconds to wait until a request to Valve is timed out (increased for proxy latency)
46+
'request_ttl': 8000,
47+
// OPTIONAL: Settings for Steam User (https://github.com/DoctorMcKay/node-steam-user#options-)
48+
'steam_user': {}
49+
},
50+
// Origins allowed to connect to the HTTP/HTTPS API
51+
'allowed_origins': [
52+
'https://cs2floatchecker.com',
53+
'https://steamcommunity.com',
54+
'http://localhost:3000',
55+
'https://api.cs2floatchecker.com'
56+
],
57+
// Origins allowed to connect to the HTTP/HTTPS API with Regex
58+
'allowed_regex_origins': [
59+
'https://.*\\.steamcommunity\\.com',
60+
'https://.*\\.vercel\\.app'
61+
],
62+
// Optionally configure a global rate limit across all endpoints
63+
'rate_limit': {
64+
'enable': false,
65+
'window_ms': 60 * 60 * 1000, // 60 min
66+
'max': 10000
67+
},
68+
// Logging Level (error, warn, info, verbose, debug, silly)
69+
'logLevel': 'info',
70+
// Max amount of simultaneous requests from the same IP (incl. WS and HTTP/HTTPS), -1 for unlimited
71+
'max_simultaneous_requests': 50,
72+
// Bool to enable game file updates from the SteamDB Github tracker (updated item definitions, images, names)
73+
'enable_game_file_updates': true,
74+
// Amount of seconds to wait between updating game files (0 = No Interval Updates)
75+
'game_files_update_interval': 3600,
76+
// Postgres connection string to store results in (ex. postgres://user:pass@127.0.0.1:5432/postgres?sslmode=disable)
77+
'database_url': 'postgresql://cs2user:cs2pass123@127.0.0.1:5432/cs2floatapi?sslmode=disable',
78+
// OPTIONAL: Enable bulk inserts, may improve performance with many requests (OPTIMIZED: now enabled)
79+
'enable_bulk_inserts': true,
80+
// OPTIONAL: Key by the caller to allow inserting price information, required to use the feature
81+
'price_key': '',
82+
// OPTIONAL: Key by the caller to allow placing bulk searches
83+
'bulk_key': '',
84+
// OPTIONAL: Maximum queue size allowed before dropping requests (OPTIMIZED: added protection)
85+
'max_queue_size': 100,
86+
// Skin.Broker API key for pricing data (Buff163, Skinport, etc.)
87+
'skinbroker_api_key': 'sbv1eDIL09Ccfvj3KTcgMVTwCKk8echbPWEdX60CgrsLiJl4NGuL',
88+
};

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ app.use(function (error, req, res, next) {
8484
// const steamAuth = require('./lib/steam-auth');
8585

8686
// Use dual authentication middleware (supports Better Auth tokens)
87-
const { dualAuth, optionalAuth } = require('./lib/dual-auth');
87+
const dualAuthModule = require('./lib/dual-auth');
88+
const { dualAuth, optionalAuth } = dualAuthModule;
8889
const steamInventory = require('./lib/steam-inventory');
8990

91+
// Initialize dual-auth with postgres connection
92+
dualAuthModule.initialize(postgres);
9093
winston.info('Better Auth token verification configured');
9194

9295

0 commit comments

Comments
 (0)