Raí Santos commited on
Commit
21c7036
·
1 Parent(s): 87bbdf3
Files changed (8) hide show
  1. .dockerignore +66 -0
  2. .gitignore +24 -93
  3. Dockerfile +1 -5
  4. README.md +27 -15
  5. dist/app.min.js +0 -0
  6. dist/app.min.js.gz +2 -2
  7. dist/build-report.json +8 -8
  8. public/app.js +14 -4
.dockerignore ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git
3
+ .gitignore
4
+ .gitattributes
5
+
6
+ # Dependencies
7
+ node_modules
8
+
9
+ # Media files (served from Hugging Face CDN in production)
10
+ public/videos
11
+ public/songs
12
+
13
+ # Build outputs (will be built inside Docker)
14
+ dist
15
+
16
+ # IDE
17
+ .vscode
18
+ .idea
19
+ *.swp
20
+ *.swo
21
+ *~
22
+
23
+ # OS
24
+ .DS_Store
25
+ Thumbs.db
26
+
27
+ # Logs
28
+ logs
29
+ *.log
30
+ npm-debug.log*
31
+
32
+ # Environment
33
+ .env*
34
+
35
+ # Documentation
36
+ *.md
37
+ !README.md
38
+ cursor_*.md
39
+
40
+ # Test files
41
+ test
42
+ tests
43
+ *.test.js
44
+ *.spec.js
45
+
46
+ # CI/CD
47
+ .github
48
+
49
+ # Docker
50
+ Dockerfile*
51
+ docker-compose*.yml
52
+ .dockerignore
53
+ Makefile
54
+
55
+ # Temporary
56
+ tmp
57
+ temp
58
+ *.tmp
59
+
60
+ # Scripts não necessários em produção
61
+ scripts/analyze-bundle.js
62
+ scripts/optimize-images.js
63
+
64
+ # Create icons (não usado)
65
+ create-icons.js
66
+ generate-icons.html
.gitignore CHANGED
@@ -1,108 +1,39 @@
1
  # Dependencies
2
  node_modules/
3
- npm-debug.log*
4
- yarn-debug.log*
5
- yarn-error.log*
6
-
7
- # Runtime data
8
- pids
9
- *.pid
10
- *.seed
11
- *.pid.lock
12
-
13
- # Coverage directory used by tools like istanbul
14
- coverage/
15
- *.lcov
16
-
17
- # nyc test coverage
18
- .nyc_output
19
-
20
- # Grunt intermediate storage
21
- .grunt
22
-
23
- # Bower dependency directory
24
- bower_components
25
-
26
- # node-waf configuration
27
- .lock-wscript
28
-
29
- # Compiled binary addons
30
- build/Release
31
-
32
- # Dependency directories
33
- jspm_packages/
34
-
35
- # TypeScript v1 declaration files
36
- typings/
37
-
38
- # Optional npm cache directory
39
- .npm
40
-
41
- # Optional eslint cache
42
- .eslintcache
43
-
44
- # Optional REPL history
45
- .node_repl_history
46
-
47
- # Output of 'npm pack'
48
- *.tgz
49
-
50
- # Yarn Integrity file
51
- .yarn-integrity
52
-
53
- # dotenv environment variables file
54
- .env
55
- .env.test
56
- .env.production
57
- .env.local
58
 
59
- # parcel-bundler cache
60
- .cache
61
- .parcel-cache
62
 
63
- # next.js build output
64
- .next
 
65
 
66
- # nuxt.js build output
67
- .nuxt
68
-
69
- # vuepress build output
70
- .vuepress/dist
71
-
72
- # Serverless directories
73
- .serverless
74
-
75
- # FuseBox cache
76
- .fusebox/
77
-
78
- # DynamoDB Local files
79
- .dynamodb/
80
-
81
- # TernJS port file
82
- .tern-port
83
-
84
- # Stores VSCode versions used for testing VSCode extensions
85
- .vscode-test
86
-
87
- # Docker
88
- .dockerignore
89
 
90
- # OS generated files
91
  .DS_Store
92
- .DS_Store?
93
- ._*
94
- .Spotlight-V100
95
- .Trashes
96
- ehthumbs.db
97
  Thumbs.db
98
 
99
- # IDE files
100
  .vscode/
101
  .idea/
102
  *.swp
103
  *.swo
104
  *~
105
 
106
- # Logs
107
- logs
108
- *.log
 
 
 
 
 
 
 
 
 
 
1
  # Dependencies
2
  node_modules/
3
+ package-lock.json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ # Build outputs
6
+ dist/
 
7
 
8
+ # Media files (too large for git, served from Hugging Face CDN)
9
+ public/videos/
10
+ public/songs/
11
 
12
+ # Logs
13
+ logs
14
+ *.log
15
+ npm-debug.log*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ # OS
18
  .DS_Store
 
 
 
 
 
19
  Thumbs.db
20
 
21
+ # IDE
22
  .vscode/
23
  .idea/
24
  *.swp
25
  *.swo
26
  *~
27
 
28
+ # Environment
29
+ .env
30
+ .env.local
31
+ .env.*.local
32
+
33
+ # Temporary
34
+ tmp/
35
+ temp/
36
+ *.tmp
37
+
38
+ # Analysis files
39
+ cursor_*.md
Dockerfile CHANGED
@@ -14,15 +14,11 @@ COPY package*.json ./
14
  RUN npm ci --only=production --quiet && \
15
  npm cache clean --force
16
 
17
- # Copy application code
18
  COPY public ./public
19
  COPY server.js ./
20
  COPY scripts ./scripts
21
 
22
- # Create directories for media (will be populated at runtime if needed)
23
- RUN mkdir -p public/videos public/songs && \
24
- chmod -R 755 public
25
-
26
  # Non-root user for security
27
  RUN addgroup -g 1001 -S nodejs && \
28
  adduser -S nodejs -u 1001 -G nodejs && \
 
14
  RUN npm ci --only=production --quiet && \
15
  npm cache clean --force
16
 
17
+ # Copy application code (videos/audio will be served from Hugging Face CDN in production)
18
  COPY public ./public
19
  COPY server.js ./
20
  COPY scripts ./scripts
21
 
 
 
 
 
22
  # Non-root user for security
23
  RUN addgroup -g 1001 -S nodejs && \
24
  adduser -S nodejs -u 1001 -G nodejs && \
README.md CHANGED
@@ -127,16 +127,19 @@ docker run -p 7860:7860 fitness-app
127
  # Instalar dependências
128
  npm install
129
 
130
- # Baixar vídeos e áudios (31 MB)
 
131
  npm run download
132
 
133
- # Build de produção
134
  npm run build
135
 
136
  # Iniciar servidor
137
  npm start
138
  ```
139
 
 
 
140
  ### Scripts Disponíveis
141
 
142
  - `npm start` - Inicia o servidor de produção
@@ -146,12 +149,13 @@ npm start
146
 
147
  ## 📊 Performance
148
 
149
- - **Bundle Gzipped**: 33.45 KB (86.3% de compressão)
150
- - **Load Time 3G**: 0.36s
151
  - **Load Time 4G**: 0.05s
152
  - **Offline**: 100% funcional (PWA + Service Worker)
153
- - **Vídeos**: 14 vídeos locais (31 MB total)
154
- - **Cache Strategy**: LRU com limite de 20 vídeos
 
155
 
156
  ## 🔒 Privacidade
157
 
@@ -167,17 +171,25 @@ MIT License - Veja o arquivo LICENSE para mais detalhes.
167
 
168
  ## 🐛 Correções Recentes
169
 
170
- ### v3.5.0 (Atual)
171
- ✅ **Vídeos e Áudios Locais**: Migrados do Hugging Face CDN para local (31 MB)
172
- ✅ **Modal de Notificações**: Corrigido bug que impedia fechar
173
- ✅ **Performance**: Bundle 86% menor (gzipped)
174
- ✅ **Docker**: Multi-stage build otimizado
175
- ✅ **Security**: Removido onclick inline
176
- ✅ **Service Worker**: Cache separado para vídeos e áudios
177
 
178
  ### Bugs Corrigidos
 
 
179
  - ✅ Botão × do modal de notificações não funcionava
180
  - ✅ Botões "Marcar como Lidas" e "Limpar Todas" não respondiam
181
  - ✅ onclick inline substituído por event listeners seguros
182
- - ✅ Vídeos não carregavam do Hugging Face
183
- - ✅ Build Docker falhava ao baixar mídia
 
 
 
 
 
 
 
127
  # Instalar dependências
128
  npm install
129
 
130
+ # Baixar vídeos e áudios para desenvolvimento (31 MB)
131
+ # Opcional - Em produção usa Hugging Face CDN automaticamente
132
  npm run download
133
 
134
+ # Build de produção (opcional)
135
  npm run build
136
 
137
  # Iniciar servidor
138
  npm start
139
  ```
140
 
141
+ **Nota:** Os vídeos são servidos do Hugging Face CDN em produção. O comando `npm run download` é apenas para desenvolvimento local offline.
142
+
143
  ### Scripts Disponíveis
144
 
145
  - `npm start` - Inicia o servidor de produção
 
149
 
150
  ## 📊 Performance
151
 
152
+ - **Bundle Gzipped**: 33.27 KB (86.3% de compressão)
153
+ - **Load Time 3G**: 0.35s
154
  - **Load Time 4G**: 0.05s
155
  - **Offline**: 100% funcional (PWA + Service Worker)
156
+ - **Vídeos**: Servidos do Hugging Face CDN (14 vídeos - 31 MB total)
157
+ - **Cache Strategy**: LRU com limite de 20 vídeos e 10 áudios
158
+ - **Smart Detection**: Usa arquivos locais em dev, CDN em produção
159
 
160
  ## 🔒 Privacidade
161
 
 
171
 
172
  ## 🐛 Correções Recentes
173
 
174
+ ### v3.6.0 (Atual) - Otimizado para Hugging Face Spaces
175
+ ✅ **Smart Video Loading**: Detecta automaticamente ambiente (dev/prod)
176
+ ✅ **Docker Otimizado**: Build rápido sem download de vídeos (usa CDN)
177
+ ✅ **Performance**: Bundle 86% menor (gzipped) - 33.27 KB total
178
+ ✅ **Security**: Removido todos onclick inline
179
+ ✅ **Service Worker**: Cache inteligente para vídeos/áudios do CDN
180
+ ✅ **Limpeza**: 10 arquivos desnecessários removidos
181
 
182
  ### Bugs Corrigidos
183
+ - ✅ **CRÍTICO**: Vídeos não eram copiados para Docker build
184
+ - ✅ **CRÍTICO**: Build falhava ao tentar baixar 31 MB durante build
185
  - ✅ Botão × do modal de notificações não funcionava
186
  - ✅ Botões "Marcar como Lidas" e "Limpar Todas" não respondiam
187
  - ✅ onclick inline substituído por event listeners seguros
188
+ - ✅ Modal plan não fechava corretamente
189
+ - ✅ Referências a arquivos deletados removidas
190
+
191
+ ### Arquitetura
192
+ - 🎯 **Dev**: Vídeos locais (`npm run download`)
193
+ - 🌐 **Prod**: Hugging Face CDN (automático)
194
+ - 📦 **Docker**: ~200 MB (sem vídeos inclusos)
195
+ - ⚡ **Build**: ~2-3 minutos no Hugging Face
dist/app.min.js CHANGED
The diff for this file is too large to render. See raw diff
 
dist/app.min.js.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:60a022e9575d6ea813d87ef7f0e383d2a557b4105e2910f21440c719c8d00ab2
3
- size 21089
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84a8d26158ad2e1e2654667994c8dbe4aad2f575856e0b078b4b2f707ddf8f0c
3
+ size 21190
dist/build-report.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
- "buildDate": "2025-10-16T17:00:29.398Z",
3
  "files": [
4
  {
5
  "name": "JavaScript",
6
- "originalSize": 148275,
7
- "minifiedSize": 88353,
8
- "gzipSize": 21089,
9
  "minSavings": "40.4%",
10
  "gzipSavings": "85.8%"
11
  },
@@ -35,14 +35,14 @@
35
  }
36
  ],
37
  "totals": {
38
- "originalSize": 249129,
39
- "minifiedSize": 151148,
40
- "gzipSize": 34066,
41
  "minSavings": "39.3%",
42
  "gzipSavings": "86.3%"
43
  },
44
  "performance": {
45
- "estimatedLoadTime3G": "0.35s",
46
  "estimatedLoadTime4G": "0.05s"
47
  }
48
  }
 
1
  {
2
+ "buildDate": "2025-10-16T18:11:47.006Z",
3
  "files": [
4
  {
5
  "name": "JavaScript",
6
+ "originalSize": 148816,
7
+ "minifiedSize": 88636,
8
+ "gzipSize": 21190,
9
  "minSavings": "40.4%",
10
  "gzipSavings": "85.8%"
11
  },
 
35
  }
36
  ],
37
  "totals": {
38
+ "originalSize": 249670,
39
+ "minifiedSize": 151431,
40
+ "gzipSize": 34167,
41
  "minSavings": "39.3%",
42
  "gzipSavings": "86.3%"
43
  },
44
  "performance": {
45
+ "estimatedLoadTime3G": "0.36s",
46
  "estimatedLoadTime4G": "0.05s"
47
  }
48
  }
public/app.js CHANGED
@@ -11,10 +11,20 @@ class FitnessApp {
11
  this.currentSeries = 0;
12
  this.navigationHistory = []; // Track navigation history
13
 
14
- // 🎥 Local Videos and Audio - Now using locally downloaded files for better performance
15
- this.VIDEO_BASE_URL = 'videos/';
16
- this.AUDIO_BASE_URL = 'songs/';
17
- this.HF_DOWNLOAD_PARAM = ''; // No longer needed for local files
 
 
 
 
 
 
 
 
 
 
18
 
19
  // User data
20
  this.userProfile = this.loadUserProfile();
 
11
  this.currentSeries = 0;
12
  this.navigationHistory = []; // Track navigation history
13
 
14
+ // 🎥 Video and Audio Configuration - Smart detection
15
+ // Use local files if in development, Hugging Face CDN in production
16
+ const isLocalDev = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
17
+
18
+ if (isLocalDev) {
19
+ // Development: Use local files (after running npm run download)
20
+ this.VIDEO_BASE_URL = 'videos/';
21
+ this.AUDIO_BASE_URL = 'songs/';
22
+ } else {
23
+ // Production (Hugging Face): Use CDN
24
+ this.VIDEO_BASE_URL = 'https://huggingface.co/datasets/RaiSantos/k30/resolve/main/';
25
+ this.AUDIO_BASE_URL = 'https://huggingface.co/datasets/RaiSantos/k30/resolve/main/';
26
+ }
27
+ this.HF_DOWNLOAD_PARAM = ''; // Not needed with direct URLs
28
 
29
  // User data
30
  this.userProfile = this.loadUserProfile();