Merge branch 'main' into linked-notifications
This commit is contained in:
commit
159d371655
17 changed files with 390 additions and 83 deletions
|
|
@ -1,23 +1,27 @@
|
|||
// src/lib/auth.ts (or your auth config file)
|
||||
import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { env as privateEnv } from '$env/dynamic/private';
|
||||
import { env as publicEnv } from '$env/dynamic/public';
|
||||
import { db } from "./server/db";
|
||||
import * as schema from "./server/db/schema";
|
||||
import { generateUsername } from "./utils/random";
|
||||
import { uploadProfilePicture } from "./server/s3";
|
||||
import { apiKey } from "better-auth/plugins";
|
||||
|
||||
if (!env.GOOGLE_CLIENT_ID) throw new Error('GOOGLE_CLIENT_ID is not set');
|
||||
if (!env.GOOGLE_CLIENT_SECRET) throw new Error('GOOGLE_CLIENT_SECRET is not set');
|
||||
if (!privateEnv.GOOGLE_CLIENT_ID) throw new Error('GOOGLE_CLIENT_ID is not set');
|
||||
if (!privateEnv.GOOGLE_CLIENT_SECRET) throw new Error('GOOGLE_CLIENT_SECRET is not set');
|
||||
if (!publicEnv.PUBLIC_BETTER_AUTH_URL) throw new Error('PUBLIC_BETTER_AUTH_URL is not set');
|
||||
|
||||
export const auth = betterAuth({
|
||||
baseURL: env.PUBLIC_BETTER_AUTH_URL,
|
||||
secret: env.PRIVATE_BETTER_AUTH_SECRET,
|
||||
baseURL: publicEnv.PUBLIC_BETTER_AUTH_URL,
|
||||
secret: privateEnv.PRIVATE_BETTER_AUTH_SECRET,
|
||||
appName: "Rugplay",
|
||||
|
||||
trustedOrigins: [
|
||||
env.BETTER_AUTH_URL, "http://rugplay.com", "http://localhost:5173",
|
||||
publicEnv.PUBLIC_BETTER_AUTH_URL,
|
||||
"http://rugplay.com",
|
||||
"http://localhost:5173",
|
||||
],
|
||||
|
||||
plugins: [
|
||||
|
|
@ -41,8 +45,8 @@ export const auth = betterAuth({
|
|||
}),
|
||||
socialProviders: {
|
||||
google: {
|
||||
clientId: env.GOOGLE_CLIENT_ID,
|
||||
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||
clientId: privateEnv.GOOGLE_CLIENT_ID,
|
||||
clientSecret: privateEnv.GOOGLE_CLIENT_SECRET,
|
||||
mapProfileToUser: async (profile) => {
|
||||
const newUsername = generateUsername();
|
||||
let s3ImageKey: string | null = null;
|
||||
|
|
@ -78,7 +82,7 @@ export const auth = betterAuth({
|
|||
user: {
|
||||
additionalFields: {
|
||||
username: { type: "string", required: true, input: false },
|
||||
isAdmin: { type: "boolean", required: false, input: false },
|
||||
isAdmin: { type: "boolean", required: true, input: false },
|
||||
isBanned: { type: "boolean", required: false, input: false },
|
||||
banReason: { type: "string", required: false, input: false },
|
||||
baseCurrencyBalance: { type: "string", required: false, input: false },
|
||||
|
|
|
|||
|
|
@ -203,13 +203,15 @@
|
|||
|
||||
<!-- Page dots -->
|
||||
<div class="flex items-center justify-center gap-2">
|
||||
{#each tips as _, index}
|
||||
{#each tips as tip, index}
|
||||
<button
|
||||
aria-label={`Go to page ${index + 1}`}
|
||||
onclick={() => goToPage(index)}
|
||||
class="h-2 w-2 rounded-full transition-colors {index === currentPage
|
||||
? 'bg-primary'
|
||||
: 'bg-muted-foreground/30 hover:bg-muted-foreground/50'}"
|
||||
aria-label={`Go to tip ${index + 1}: ${tip.title}`}
|
||||
aria-current={index === currentPage ? 'page' : undefined}
|
||||
></button>
|
||||
{/each}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -105,7 +105,14 @@
|
|||
async function handleTileClick(index: number) {
|
||||
if (!isPlaying || revealedTiles.includes(index) || !sessionToken) return;
|
||||
lastClickedTile = index;
|
||||
try {
|
||||
|
||||
// Temporarily disabled - using local simulation
|
||||
toast.error('Mines game temporarily disabled', {
|
||||
description: 'This feature is currently under maintenance'
|
||||
});
|
||||
return;
|
||||
|
||||
/* try {
|
||||
const response = await fetch('/api/gambling/mines/reveal', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
|
@ -142,12 +149,19 @@
|
|||
toast.error('Failed to reveal tile', {
|
||||
description: error instanceof Error ? error.message : 'Unknown error occurred'
|
||||
});
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
async function cashOut() {
|
||||
if (!isPlaying || !sessionToken) return;
|
||||
try {
|
||||
|
||||
// Temporarily disabled
|
||||
toast.error('Mines game temporarily disabled', {
|
||||
description: 'This feature is currently under maintenance'
|
||||
});
|
||||
return;
|
||||
|
||||
/* try {
|
||||
const response = await fetch('/api/gambling/mines/cashout', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
|
@ -175,12 +189,19 @@
|
|||
toast.error('Failed to cash out', {
|
||||
description: error instanceof Error ? error.message : 'Unknown error occurred'
|
||||
});
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
async function startGame() {
|
||||
if (!canBet) return;
|
||||
balance -= betAmount;
|
||||
|
||||
// Temporarily disabled
|
||||
toast.error('Mines game temporarily disabled', {
|
||||
description: 'This feature is currently under maintenance'
|
||||
});
|
||||
return;
|
||||
|
||||
/* balance -= betAmount;
|
||||
onBalanceUpdate?.(balance);
|
||||
try {
|
||||
const response = await fetch('/api/gambling/mines/start', {
|
||||
|
|
@ -207,7 +228,7 @@
|
|||
toast.error('Failed to start game', {
|
||||
description: error instanceof Error ? error.message : 'Unknown error occurred'
|
||||
});
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ export function formatPrice(price: number): string {
|
|||
export function formatValue(value: number | string): string {
|
||||
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
||||
if (typeof numValue !== 'number' || isNaN(numValue)) return '$0.00';
|
||||
|
||||
if (numValue >= 1e12) return `$${(numValue / 1e12).toFixed(2)}T`;
|
||||
if (numValue >= 1e9) return `$${(numValue / 1e9).toFixed(2)}B`;
|
||||
if (numValue >= 1e6) return `$${(numValue / 1e6).toFixed(2)}M`;
|
||||
if (numValue >= 1e3) return `$${(numValue / 1e3).toFixed(2)}K`;
|
||||
|
|
|
|||
Reference in a new issue