Đỗ Hải Nam commited on
Commit
1c09c95
·
1 Parent(s): f84178d

fix: use stable public paths for Pochi and Hnam images to avoid hashing and cache issues on Koyeb

Browse files
frontend/public/hnam.jpeg ADDED

Git LFS Details

  • SHA256: 492364b6a2e55004466e89321759572be9eaf54d5d9fab27c3026a62e560d94c
  • Pointer size: 131 Bytes
  • Size of remote file: 676 kB
frontend/public/pochi.jpeg ADDED

Git LFS Details

  • SHA256: 6dd24bcf4dbaecb7bc4baa758a3bd0167a3f8bcd7c9bfef602532848a88aa017
  • Pointer size: 131 Bytes
  • Size of remote file: 789 kB
frontend/src/App.jsx CHANGED
@@ -7,9 +7,8 @@ import { SearchModal, ImageViewer, SettingsModal } from './components/Modals'
7
  import { Menu, MoreHorizontal } from 'lucide-react'
8
  import './App.css'
9
  import GuideTour from './components/GuideTour'
10
- import pochiAsset from './assets/pochi.jpeg'
11
- import hnamAsset from './assets/hnam.jpeg'
12
-
13
  const defaultAvatar = pochiAsset
14
 
15
  const API_BASE = '/api'
@@ -40,15 +39,17 @@ function App() {
40
  if (saved) {
41
  try {
42
  const profile = JSON.parse(saved)
43
- // Migrate old static paths to new hashed assets
44
- if (profile.avatar === '/pochi.jpeg') {
45
- profile.avatar = pochiAsset
46
- localStorage.setItem('user_profile', JSON.stringify(profile))
47
- } else if (profile.avatar === '/hnam.jpeg' || (profile.avatar && profile.avatar.includes('hnam'))) {
48
- // Only update if it's the old string path or contains 'hnam' but isn't already the hashed asset path
49
- if (typeof profile.avatar === 'string' && !profile.avatar.startsWith('data:') && !profile.avatar.includes('assets/hnam-')) {
50
- profile.avatar = hnamAsset
51
  localStorage.setItem('user_profile', JSON.stringify(profile))
 
 
 
 
 
 
52
  }
53
  }
54
  return profile
 
7
  import { Menu, MoreHorizontal } from 'lucide-react'
8
  import './App.css'
9
  import GuideTour from './components/GuideTour'
10
+ const pochiAsset = '/pochi.jpeg'
11
+ const hnamAsset = '/hnam.jpeg'
 
12
  const defaultAvatar = pochiAsset
13
 
14
  const API_BASE = '/api'
 
39
  if (saved) {
40
  try {
41
  const profile = JSON.parse(saved)
42
+ // Migrate old static paths or broken hashed paths to new stable assets
43
+ if (profile.avatar && typeof profile.avatar === 'string') {
44
+ if (profile.avatar === '/pochi.jpeg' || (profile.avatar.includes('pochi') && profile.avatar !== pochiAsset)) {
45
+ profile.avatar = pochiAsset
 
 
 
 
46
  localStorage.setItem('user_profile', JSON.stringify(profile))
47
+ } else if (profile.avatar === '/hnam.jpeg' || (profile.avatar.includes('hnam') && profile.avatar !== hnamAsset)) {
48
+ // Only update if it's an old asset path (not a base64 string)
49
+ if (!profile.avatar.startsWith('data:')) {
50
+ profile.avatar = hnamAsset
51
+ localStorage.setItem('user_profile', JSON.stringify(profile))
52
+ }
53
  }
54
  }
55
  return profile
frontend/src/components/Sidebar.jsx CHANGED
@@ -18,7 +18,7 @@ import {
18
  PanelLeft,
19
  PanelRight
20
  } from 'lucide-react'
21
- import pochiLogo from '../assets/pochi.jpeg'
22
 
23
  const Sidebar = ({
24
  isOpen,
 
18
  PanelLeft,
19
  PanelRight
20
  } from 'lucide-react'
21
+ const pochiLogo = '/pochi.jpeg'
22
 
23
  const Sidebar = ({
24
  isOpen,