Spaces:
Sleeping
Sleeping
Đỗ 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 +3 -0
- frontend/public/pochi.jpeg +3 -0
- frontend/src/App.jsx +12 -11
- frontend/src/components/Sidebar.jsx +1 -1
frontend/public/hnam.jpeg
ADDED
|
Git LFS Details
|
frontend/public/pochi.jpeg
ADDED
|
Git LFS Details
|
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 |
-
|
| 11 |
-
|
| 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
|
| 44 |
-
if (profile.avatar === '
|
| 45 |
-
profile.avatar
|
| 46 |
-
|
| 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 |
-
|
| 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,
|