feat: redesign match play and add broadcast tooling
This commit is contained in:
22
scripts/dev-login.ts
Normal file
22
scripts/dev-login.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Prints a 10-minute link that signs a browser in as a seeded test player.
|
||||
* Works only against dev and staging servers, and only for seeded players.
|
||||
*
|
||||
* bun scripts/dev-login.ts dev-player-03 [https://esports-dev.vash.software] [/matches/…]
|
||||
*/
|
||||
import { makeSignature } from 'better-auth/crypto';
|
||||
|
||||
const [user, origin = process.env.ORIGIN ?? 'http://127.0.0.1:3102', to] = process.argv.slice(2);
|
||||
if (!user || !(user.startsWith('dev-player-') || user.startsWith('seed-user-'))) {
|
||||
console.error('Usage: bun scripts/dev-login.ts <dev-player-NN|seed-user-NNN> [origin] [path]');
|
||||
process.exit(1);
|
||||
}
|
||||
const secret = process.env.BETTER_AUTH_SECRET;
|
||||
if (!secret) throw new Error('BETTER_AUTH_SECRET is not set');
|
||||
const expires = Date.now() + 10 * 60_000;
|
||||
const url = new URL('/dev/login-as', origin);
|
||||
url.searchParams.set('user', user);
|
||||
url.searchParams.set('expires', String(expires));
|
||||
url.searchParams.set('sig', await makeSignature(`dev-login:${user}:${expires}`, secret));
|
||||
if (to) url.searchParams.set('to', to);
|
||||
console.log(url.toString());
|
||||
Reference in New Issue
Block a user