feat: add EncryptID SDK and AuthProvider

SDK added as dependency, AuthProvider wraps layout, Dockerfile updated
for parent context build with SDK copy. No auth guards needed (GET-only routes).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-18 10:20:31 +00:00
parent 3f9ce76ca2
commit 6ab52b72f7
5 changed files with 30 additions and 10 deletions

View File

@ -1,20 +1,23 @@
FROM node:20-alpine AS base
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Dependencies stage
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml* package-lock.json* ./
RUN if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; else npm install; fi
COPY rtube-online/package.json rtube-online/package-lock.json* ./
# Copy local SDK dependency
COPY encryptid-sdk /encryptid-sdk/
RUN npm ci || npm install
# Ensure SDK is properly linked in node_modules
RUN rm -rf node_modules/@encryptid/sdk && \
mkdir -p node_modules/@encryptid && \
cp -r /encryptid-sdk node_modules/@encryptid/sdk
# Build stage
FROM base AS builder
WORKDIR /app
COPY . .
RUN rm -rf node_modules .next
COPY --from=deps /app/node_modules ./node_modules
COPY rtube-online/ .
RUN npm run build
# Production stage

View File

@ -1,6 +1,7 @@
import type { Metadata } from 'next'
import localFont from 'next/font/local'
import './globals.css'
import { AuthProvider } from '@/components/AuthProvider'
const geistSans = localFont({
src: './fonts/GeistVF.woff',
@ -32,7 +33,9 @@ export default function RootLayout({
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
{children}
<AuthProvider>
{children}
</AuthProvider>
</body>
</html>
)

View File

@ -0,0 +1,12 @@
'use client';
import { EncryptIDProvider } from '@encryptid/sdk/ui/react';
export function AuthProvider({ children }: { children: React.ReactNode }) {
const Provider = EncryptIDProvider as any;
return (
<Provider serverUrl={process.env.NEXT_PUBLIC_ENCRYPTID_SERVER_URL}>
{children}
</Provider>
);
}

View File

@ -1,11 +1,12 @@
services:
rtube:
build:
context: .
dockerfile: Dockerfile
context: ..
dockerfile: rtube-online/Dockerfile
container_name: rtube
restart: unless-stopped
environment:
- NEXT_PUBLIC_ENCRYPTID_SERVER_URL=${NEXT_PUBLIC_ENCRYPTID_SERVER_URL:-https://encryptid.jeffemmett.com}
- R2_ENDPOINT=${R2_ENDPOINT}
- R2_BUCKET=${R2_BUCKET:-rtube-videos}
- R2_ACCESS_KEY_ID=${R2_ACCESS_KEY_ID}

View File

@ -10,6 +10,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.700.0",
"@encryptid/sdk": "file:../encryptid-sdk",
"hls.js": "^1.5.0",
"next": "14.2.35",
"react": "^18",