Skip to content
Merged

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default async function RootLayout({
children: React.ReactNode
}) {
const config = await getConfig()
const hasCustomFont = config.settings.advanced.customCSS.includes('font-family')
const customCSS = config.settings.advanced?.customCSS || ''
const hasCustomFont = typeof customCSS === 'string' ? customCSS.includes('font-family') : false

if (config.settings.appearance.favicon) {
metadata.icons = {
Expand All @@ -79,7 +80,7 @@ export default async function RootLayout({
}

return (
<html lang="en" data-theme={userTheme ?? config.settings.appearance.systemThemes} suppressHydrationWarning>
<html lang="en" data-theme={userTheme ?? config.settings.appearance.theme} suppressHydrationWarning>
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand All @@ -90,14 +91,14 @@ export default async function RootLayout({
<body suppressHydrationWarning className={`${!hasCustomFont ? inter.variable + ' font-sans' : ''} min-h-screen flex flex-col`}>
<ThemeProvider
attribute="class"
defaultTheme={config.settings.appearance.systemThemes}
defaultTheme={config.settings.appearance.systemThemes as string | undefined}
enableSystem
disableTransitionOnChange
>
<ThemeProviderWrapper
initialUserTheme={userTheme}
initialUserColors={userCustomColors}
systemTheme={config.settings.appearance.systemThemes}
systemTheme={config.settings.appearance.theme}
systemColors={config.settings.appearance.customColors}
>
<Snowfall />
Expand Down
1 change: 1 addition & 0 deletions packages/lib/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export const DEFAULT_CONFIG: EmberlyConfig = {
input: '217.2 32.6% 17.5%',
ring: '212.7 26.8% 83.9%',
},
systemThemes: {},
},
advanced: {
customCSS: '',
Expand Down
12 changes: 8 additions & 4 deletions packages/lib/embeds/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ export async function buildRichMetadata({

// Build thumbnail/preview URL
// For images, use the raw URL to show full quality image
// For videos, use the thumbnail endpoint/poster
// For videos: if rich embeds disabled, use raw video (Discord plays it inline)
// if rich embeds enabled, use thumbnail (og:video tag will handle playback)
let imageUrl: string | undefined
try {
if (classification.isImage) {
imageUrl = rawUrl
} else if (classification.isVideo) {
imageUrl = new URL(`/api/files/${fileId}/thumbnail`, baseUrl).toString()
// When rich embeds disabled, use raw video URL so Discord can play it directly
imageUrl = enableRich
? new URL(`/api/files/${fileId}/thumbnail`, baseUrl).toString()
: rawUrl
} else {
// For other file types, try to get a generic preview
imageUrl = new URL(`/api/files/${fileId}/thumbnail`, baseUrl).toString()
Expand Down Expand Up @@ -120,7 +124,7 @@ export async function buildRichMetadata({
alt: classification.isImage ? 'Preview image' : 'File preview',
}
] : undefined,
videos: classification.isVideo && videoUrl ? [
videos: classification.isVideo && videoUrl && enableRich ? [
{
url: videoUrl,
secureUrl: videoUrl,
Expand All @@ -129,7 +133,7 @@ export async function buildRichMetadata({
height: 720,
},
] : undefined,
audio: classification.isAudio ? [
audio: classification.isAudio && enableRich ? [
{
url: rawUrl,
type: mimeType || 'audio/mpeg',
Expand Down
Loading