- Add Next.js app structure with base configs, linting, and formatting - Implement LiveKit Meet page, types, and utility functions - Add Docker, Compose, and deployment scripts for backend and token server - Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers - Include CSS modules and global styles for UI - Add postMessage and studio integration utilities - Update package.json with dependencies and scripts for development and testing
30 lines
986 B
JavaScript
30 lines
986 B
JavaScript
// e2e/decode_token.js
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const file = '/tmp/token_resp.txt';
|
|
if (!fs.existsSync(file)) { console.error('token response file not found:', file); process.exit(2); }
|
|
const s = fs.readFileSync(file, 'utf8');
|
|
const m = s.match(/"token":"([^"]+)"/);
|
|
if (!m) { console.error('token not found in file'); process.exit(2); }
|
|
const t = m[1];
|
|
console.log('TOKEN:', t);
|
|
const parts = t.split('.');
|
|
if (parts.length < 2) { console.error('invalid token'); process.exit(2); }
|
|
let payload = parts[1];
|
|
payload += '='.repeat((4 - (payload.length % 4)) % 4);
|
|
try {
|
|
const buf = Buffer.from(payload.replace(/-/g,'+').replace(/_/g,'/'), 'base64');
|
|
const json = buf.toString('utf8');
|
|
try {
|
|
const obj = JSON.parse(json);
|
|
console.log('PAYLOAD:');
|
|
console.log(JSON.stringify(obj, null, 2));
|
|
} catch (e) {
|
|
console.log('decoded payload (not json):', json);
|
|
}
|
|
} catch (err) {
|
|
console.error('decode error', err);
|
|
process.exit(1);
|
|
}
|
|
|