import variables from 'modules/variables'; import { PureComponent } from 'react'; import { MdEmail, MdContactPage } from 'react-icons/md'; import { FaDiscord, FaTwitter } from 'react-icons/fa'; import { SiGithubsponsors, SiLiberapay, SiKofi, SiPatreon } from 'react-icons/si'; import { BiDonateHeart } from 'react-icons/bi'; import Tooltip from 'components/helpers/tooltip/Tooltip'; import other_contributors from 'modules/other_contributors.json'; export default class About extends PureComponent { getMessage = (text) => variables.language.getMessage(variables.languagecode, text); constructor() { super(); this.state = { contributors: [], sponsors: [], other_contributors: [], photographers: this.getMessage('modals.main.loading'), update: this.getMessage('modals.main.settings.sections.about.version.checking_update'), loading: this.getMessage('modals.main.loading'), image: localStorage.getItem('theme') === 'dark' ? './././icons/mue_dark.svg' : './././icons/mue_light.svg', }; this.controller = new AbortController(); } async getGitHubData() { let contributors, sponsors, photographers, versionData; try { versionData = await ( await fetch( variables.constants.GITHUB_URL + '/repos/' + variables.constants.ORG_NAME + '/' + variables.constants.REPO_NAME + '/releases', { signal: this.controller.signal }, ) ).json(); contributors = await ( await fetch( variables.constants.GITHUB_URL + '/repos/' + variables.constants.ORG_NAME + '/' + variables.constants.REPO_NAME + '/contributors', { signal: this.controller.signal }, ) ).json(); sponsors = ( await ( await fetch(variables.constants.SPONSORS_URL + '/list', { signal: this.controller.signal, }) ).json() ).sponsors; photographers = await ( await fetch(variables.constants.API_URL + '/images/photographers', { signal: this.controller.signal, }) ).json(); } catch (e) { if (this.controller.signal.aborted === true) { return; } return this.setState({ update: this.getMessage('modals.main.settings.sections.about.version.error.title'), loading: this.getMessage('modals.main.settings.sections.about.version.error.description'), }); } if (sponsors.length === 0) { sponsors = [{ handle: 'empty' }]; } if (this.controller.signal.aborted === true) { return; } const newVersion = versionData[0].tag_name; let update = this.getMessage('modals.main.settings.sections.about.version.no_update'); if ( Number(variables.constants.VERSION.replaceAll('.', '')) < Number(newVersion.replaceAll('.', '')) ) { update = `${this.getMessage( 'modals.main.settings.sections.about.version.update_available', )}: ${newVersion}`; } this.setState({ // exclude bots contributors: contributors.filter((contributor) => !contributor.login.includes('bot')), sponsors, update, other_contributors, photographers: photographers.sort().join(', '), loading: null, }); } componentDidMount() { if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') { this.setState({ update: this.getMessage('modals.main.settings.sections.about.version.checking_update'), loading: this.getMessage('modals.main.marketplace.offline.description'), }); return; } this.getGitHubData(); } componentWillUnmount() { // stop making requests this.controller.abort(); } render() { return ( <> {this.getMessage('modals.main.settings.sections.about.title')}
As Mue is entirely free, we rely on donations to cover pay the server bills and fund development
{this.state.loading}
{this.state.loading}