diff --git a/ui/redux/actions/settings.js b/ui/redux/actions/settings.js index 235b822ad..24e6625d0 100644 --- a/ui/redux/actions/settings.js +++ b/ui/redux/actions/settings.js @@ -310,17 +310,31 @@ export function doFetchLanguage(language) { export function doFetchHomepages() { return (dispatch) => { - // -- Use this env flag to use local homepage data. Otherwise, it will grab from `/$/api/content/v1/get`. + // -- Use this env flag to use local homepage data. Otherwise, it will grab from `/$/api/content/v*/get`. // @if USE_LOCAL_HOMEPAGE_DATA='true' const homepages = require('homepages'); if (homepages) { - window.homepages = homepages; + const v2 = {}; + const homepageKeys = Object.keys(homepages); + + homepageKeys.forEach((hp) => { + v2[hp] = { + categories: homepages[hp], + }; + }); + + const meme = require('memes'); + if (meme && v2['en']) { + v2['en'].meme = meme; + } + + window.homepages = v2; dispatch({ type: ACTIONS.FETCH_HOMEPAGES_DONE }); return; } // @endif - fetch('https://odysee.com/$/api/content/v1/get') + fetch('https://odysee.com/$/api/content/v2/get') .then((response) => response.json()) .then((json) => { if (json?.status === 'success' && json?.data) { diff --git a/ui/redux/selectors/settings.js b/ui/redux/selectors/settings.js index d81089d53..2494dda8e 100644 --- a/ui/redux/selectors/settings.js +++ b/ui/redux/selectors/settings.js @@ -66,7 +66,7 @@ export const selectLanguage = (state) => { export const selectHomepageData = (state) => { const homepageCode = selectHomepageCode(state); const homepages = window.homepages; - return homepages ? homepages[homepageCode] || homepages['en'] || {} : {}; + return homepages ? homepages[homepageCode].categories || homepages['en'].categories || {} : {}; }; export const selectInRegionByCode = (state, code) => { diff --git a/web/component/meme.jsx b/web/component/meme.jsx index 77fc8d2ba..7d491887c 100644 --- a/web/component/meme.jsx +++ b/web/component/meme.jsx @@ -1,12 +1,16 @@ import React from 'react'; import Button from 'component/button'; -const memes = require('memes'); export default function Meme() { + const meme = window?.homepages?.en?.meme; + if (!meme) { + return null; + } + return (