Compare commits
13 Commits
main
...
test-pages
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c748e4144 | ||
|
|
aa921d911c | ||
|
|
05c923206f | ||
|
|
40b44fa14e | ||
|
|
fa5a38d6a8 | ||
|
|
383428125d | ||
|
|
710a7ac6d1 | ||
|
|
66be5cd4a6 | ||
|
|
fd2204d829 | ||
|
|
4e82693238 | ||
|
|
15e862533d | ||
|
|
7978271f0f | ||
|
|
370fc9a47e |
3
.gitignore
vendored
3
.gitignore
vendored
@ -36,3 +36,6 @@ yarn-error.log*
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
# cloudflare
|
||||
.wrangler
|
||||
@ -1,5 +1,4 @@
|
||||
import { ConnectionDetails } from '@/lib/types';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { AccessToken, AccessTokenOptions, VideoGrant } from 'livekit-server-sdk';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
@ -29,7 +28,7 @@ export async function GET(request: NextRequest) {
|
||||
// Generate participant token
|
||||
const participantToken = await createParticipantToken(
|
||||
{
|
||||
identity: `${participantName}__${randomUUID()}`,
|
||||
identity: pseudoRandomParticipantId(participantName),
|
||||
name: participantName,
|
||||
metadata,
|
||||
},
|
||||
@ -65,6 +64,15 @@ function createParticipantToken(userInfo: AccessTokenOptions, roomName: string)
|
||||
return at.toJwt();
|
||||
}
|
||||
|
||||
function pseudoRandomParticipantId(participantName: string): string {
|
||||
const randomPart = 'xxxx-xxxx-xxxx'.replace(/[x]/g, function (c) {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
||||
return `${v.toString(16)}`;
|
||||
});
|
||||
return `${participantName}_${randomPart}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the LiveKit server URL for the given region.
|
||||
*/
|
||||
@ -79,3 +87,5 @@ function getLiveKitURL(region: string | null): string {
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export const runtime = 'edge'; // Can be removed if not deploying to Edge Runtime. See https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
|
||||
|
||||
@ -68,3 +68,5 @@ export async function GET(req: NextRequest) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const runtime = 'edge'; // Can be removed if not deploying to Edge Runtime. See https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
|
||||
|
||||
@ -37,3 +37,5 @@ export async function GET(req: NextRequest) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const runtime = 'edge'; // Can be removed if not deploying to Edge Runtime. See https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
|
||||
|
||||
@ -26,3 +26,5 @@ export default function CustomRoomConnection(props: {
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export const runtime = 'edge'; // Can be removed if not deploying to Edge Runtime. See https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
|
||||
|
||||
@ -199,3 +199,5 @@ export default function Page() {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export const runtime = 'edge'; // Can be removed if not deploying to Edge Runtime. See https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
|
||||
|
||||
@ -24,3 +24,5 @@ export default function Page({
|
||||
<PageClientImpl roomName={params.roomName} region={searchParams.region} hq={hq} codec={codec} />
|
||||
);
|
||||
}
|
||||
|
||||
export const runtime = 'edge'; // Can be removed if not deploying to Edge Runtime. See https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
@ -13,4 +15,10 @@ const nextConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
// This allows you to access Cloudflare bindings in local development.
|
||||
// Ignore this, you probably don't need it.
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await setupDevPlatform();
|
||||
}
|
||||
|
||||
export default nextConfig;
|
||||
@ -6,7 +6,9 @@
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
"lint": "next lint",
|
||||
"pages:build": "pnpm dlx @cloudflare/next-on-pages",
|
||||
"preview": "pnpm pages:build && pnpm --package=wrangler dlx wrangler pages dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@datadog/browser-logs": "^5.10.0",
|
||||
@ -22,6 +24,7 @@
|
||||
"tinykeys": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/next-on-pages": "^1.13.2",
|
||||
"@types/node": "20.14.13",
|
||||
"@types/react": "18.3.3",
|
||||
"@types/react-dom": "18.3.0",
|
||||
|
||||
2683
pnpm-lock.yaml
generated
2683
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
10
wrangler.toml
Normal file
10
wrangler.toml
Normal file
@ -0,0 +1,10 @@
|
||||
# Generated by Wrangler on Thu Aug 22 2024 13:43:56 GMT+0200 (Central European Summer Time)
|
||||
name = "meet-sandbox-staging"
|
||||
pages_build_output_dir = ".vercel/output/static"
|
||||
compatibility_date = "2024-08-22"
|
||||
compatibility_flags = [ "nodejs_compat" ]
|
||||
send_metrics = false
|
||||
|
||||
[vars]
|
||||
NEXT_PUBLIC_LK_TOKEN_ENDPOINT = "/api/token"
|
||||
NEXT_PUBLIC_SHOW_SETTINGS_MENU = "true"
|
||||
Loading…
x
Reference in New Issue
Block a user