diff --git a/app/src/components/Common.js b/app/src/components/Common.js index 0b44ef48..15e59471 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -62,7 +62,8 @@ export const DEFAULT_LIMIT = 20; export const NAME = process.env && process.env.REACT_APP_NAME ? process.env.REACT_APP_NAME : null; // Other services on a WROLPi. -export const FILES_MEDIA_URI = `https://${window.location.hostname}:${window.location.port}/media/`; +const port = window.location.port ? `${window.location.port}` : ''; +export const FILES_MEDIA_URI = `https://${window.location.hostname}${port}/media/`; export const MAP_VIEWER_URI = `https://${window.location.hostname}:8084`; export const ZIM_VIEWER_URI = `https://${window.location.hostname}:8085`; export const HELP_VIEWER_URI = `https://${window.location.hostname}:8086`; @@ -1821,11 +1822,13 @@ export function useLocalStorage(key, initialValue, decode = JSON.parse, encode = // Initialize state with the value from localStorage or initial value const [value, setValue] = useState(() => { + let item; try { - const item = window.localStorage.getItem(key); + item = window.localStorage.getItem(key); // Parse the stored item (integer, bool, etc.). Use the initial value if empty. return item ? decode(item) : initialValue; } catch (error) { + console.error('useLocalStorage', key, item, initialValue); console.error('Error reading localStorage:', error); return initialValue; } diff --git a/app/src/components/VideoPlayer.js b/app/src/components/VideoPlayer.js index 29e53726..8edfdcd7 100644 --- a/app/src/components/VideoPlayer.js +++ b/app/src/components/VideoPlayer.js @@ -8,7 +8,7 @@ import { encodeMediaPath, getParentDirectory, humanFileSize, - humanNumber, isoDatetimeToElapsedPopup, + humanNumber, isoDatetimeToAgoPopup, isoDatetimeToString, MultilineText, PageContainer, @@ -367,7 +367,7 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
{title}
- {videoFile.published_datetime &&

{isoDatetimeToElapsedPopup(videoFile.published_datetime)}

} + {videoFile.published_datetime &&

{isoDatetimeToAgoPopup(videoFile.published_datetime)}

}

{channel && {channel.name}