From 493d236dc40f60d730cbbcf6ed962a7d546bafdd Mon Sep 17 00:00:00 2001 From: josedario87 Date: Sun, 10 Aug 2025 00:45:59 -0600 Subject: [PATCH] UI mejorada --- components/AuroraBackground.client.vue | 4 ++-- components/MainContainer.client.vue | 19 +++++++++++++++---- components/PlaybackControls.client.vue | 4 +++- components/TrackList.client.vue | 4 +++- docker-compose.yml | 2 +- nuxt.config.ts | 21 ++++++++++----------- server/api/music/[filename].get.ts | 20 +++++++++++++++++--- server/api/music/index.get.ts | 7 +++++-- 8 files changed, 56 insertions(+), 25 deletions(-) diff --git a/components/AuroraBackground.client.vue b/components/AuroraBackground.client.vue index d19669c..c80ae2e 100644 --- a/components/AuroraBackground.client.vue +++ b/components/AuroraBackground.client.vue @@ -201,7 +201,7 @@ onMounted(() => { left: 0; width: 100%; height: 100%; - z-index: -1; + z-index: 0; /* Render above body background but below main content */ overflow: hidden; pointer-events: none; } @@ -357,4 +357,4 @@ onMounted(() => { will-change: transform; transform: translateZ(0); } - \ No newline at end of file + diff --git a/components/MainContainer.client.vue b/components/MainContainer.client.vue index f9c4e3c..8fe8897 100644 --- a/components/MainContainer.client.vue +++ b/components/MainContainer.client.vue @@ -56,7 +56,15 @@ const hasActiveTrack = computed(() => !!props.currentTrack) \ No newline at end of file + diff --git a/components/PlaybackControls.client.vue b/components/PlaybackControls.client.vue index 2096b78..9f1080b 100644 --- a/components/PlaybackControls.client.vue +++ b/components/PlaybackControls.client.vue @@ -65,6 +65,8 @@ const cycleRepeat = () => { \ No newline at end of file + diff --git a/components/TrackList.client.vue b/components/TrackList.client.vue index 8d31e48..041504f 100644 --- a/components/TrackList.client.vue +++ b/components/TrackList.client.vue @@ -78,6 +78,8 @@ const handleTrackClick = (track, index) => { \ No newline at end of file + diff --git a/docker-compose.yml b/docker-compose.yml index b2b00c2..759ebaa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: container_name: repodructor restart: unless-stopped volumes: - # Mount manually mounted NAS directory + # Mount music directory from server - /srv/repodructor/musica:/app/public/music:ro environment: - NODE_ENV=production diff --git a/nuxt.config.ts b/nuxt.config.ts index 2896027..6b76f22 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -15,8 +15,8 @@ export default defineNuxtConfig({ // Server configuration for proxy compatibility devServer: { - host: '0.0.0.0', - port: 3000, + host: process.env.NUXT_HOST || '0.0.0.0', + port: process.env.NUXT_PORT ? Number(process.env.NUXT_PORT) : 3000, https: false }, @@ -26,13 +26,12 @@ export default defineNuxtConfig({ // Vite configuration for HMR through proxy vite: { server: { - hmr: { - // Use proxy host instead of direct connection - host: 'musica.nucleoriofrio.com', - // Use default HTTPS port (443) through proxy - clientPort: 443, - protocol: 'wss' - } + // Configure HMR via env when developing behind HTTPS proxy + hmr: process.env.NODE_ENV !== 'production' ? { + host: process.env.HMR_HOST || undefined, + clientPort: process.env.HMR_CLIENT_PORT ? Number(process.env.HMR_CLIENT_PORT) : undefined, + protocol: process.env.HMR_PROTOCOL || undefined + } : undefined } }, @@ -139,7 +138,7 @@ export default defineNuxtConfig({ // Runtime configuration runtimeConfig: { public: { - musicPath: '/music' + musicPath: process.env.NUXT_PUBLIC_MUSIC_PATH || '/music' } }, -}) \ No newline at end of file +}) diff --git a/server/api/music/[filename].get.ts b/server/api/music/[filename].get.ts index 094110a..8779913 100644 --- a/server/api/music/[filename].get.ts +++ b/server/api/music/[filename].get.ts @@ -16,18 +16,23 @@ export default defineEventHandler(async (event) => { const headers = getHeaders(event) const realIP = headers['x-real-ip'] || headers['x-forwarded-for'] || 'unknown' console.log(`[MUSIC API] Request from ${realIP} for file: ${filename}`) + console.log('Original filename bytes:', [...filename].map(c => c.charCodeAt(0))) // Decode the filename try { filename = decodeURIComponent(filename) console.log('Decoded filename:', filename) + console.log('Decoded filename bytes:', [...filename].map(c => c.charCodeAt(0))) } catch (error) { console.error('Error decoding filename:', error) // If decoding fails, use original filename } try { - const musicDir = join(process.cwd(), 'public', 'music') + const config = useRuntimeConfig() + const defaultPublicPath = config.public?.musicPath || '/music' + const publicRel = defaultPublicPath.replace(/^\//, '') + const musicDir = process.env.MUSIC_DIR || join(process.cwd(), 'public', publicRel) const filePath = join(musicDir, filename) // Security check: ensure the file is within the music directory @@ -41,7 +46,16 @@ export default defineEventHandler(async (event) => { // Check if file exists try { await fs.access(filePath) - } catch { + console.log('File found successfully:', filePath) + } catch (error) { + console.log('File NOT found:', filePath) + console.log('Directory contents:') + try { + const files = await fs.readdir(musicDir) + files.forEach(file => console.log(' -', file)) + } catch (e) { + console.log('Cannot read directory:', e) + } throw createError({ statusCode: 404, statusMessage: 'File not found' @@ -100,4 +114,4 @@ export default defineEventHandler(async (event) => { statusMessage: 'Failed to serve music file' }) } -}) \ No newline at end of file +}) diff --git a/server/api/music/index.get.ts b/server/api/music/index.get.ts index ed5a227..2fe8a9e 100644 --- a/server/api/music/index.get.ts +++ b/server/api/music/index.get.ts @@ -8,7 +8,10 @@ export default defineEventHandler(async (event) => { const realIP = headers['x-real-ip'] || headers['x-forwarded-for'] || 'unknown' console.log(`[MUSIC API] Music list request from ${realIP}`) - const musicDir = join(process.cwd(), 'public', 'music') + const config = useRuntimeConfig() + const defaultPublicPath = config.public?.musicPath || '/music' + const publicRel = defaultPublicPath.replace(/^\//, '') + const musicDir = process.env.MUSIC_DIR || join(process.cwd(), 'public', publicRel) // Check if music directory exists try { @@ -54,4 +57,4 @@ export default defineEventHandler(async (event) => { statusMessage: 'Failed to load music files' }) } -}) \ No newline at end of file +})