diff options
author | Starfall <us@starfall.systems> | 2021-07-07 11:46:33 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2021-07-07 11:46:33 -0500 |
commit | d30025d28d813999bfe98ce9cee2cda3bebf6c22 (patch) | |
tree | e2cf70344fc6426f3a2c778d3b6d3bab9e22c078 /app/javascript/flavours/glitch/features | |
parent | fadb06ef6e1950a82f08673683e705943b93ba40 (diff) | |
parent | 0c2eb949fc21ceecbd99a81e5ffe75517a1e64df (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js | 15 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/link_footer.js | 4 |
2 files changed, 15 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js index 893e76585..b7ec63333 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js @@ -219,6 +219,10 @@ class FocalPointModal extends ImmutablePureComponent { } handleTextDetection = () => { + this._detectText(); + } + + _detectText = (refreshCache = false) => { const { media } = this.props; this.setState({ detecting: true }); @@ -235,6 +239,7 @@ class FocalPointModal extends ImmutablePureComponent { this.setState({ ocrStatus: 'preparing', progress }); } }, + cacheMethod: refreshCache ? 'refresh' : 'write', }); let media_url = media.get('url'); @@ -247,14 +252,20 @@ class FocalPointModal extends ImmutablePureComponent { } } - (async () => { + return (async () => { await worker.load(); await worker.loadLanguage('eng'); await worker.initialize('eng'); const { data: { text } } = await worker.recognize(media_url); this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false }); await worker.terminate(); - })(); + })().catch((e) => { + if (refreshCache) { + throw e; + } else { + this._detectText(true); + } + }); }).catch((e) => { console.error(e); this.setState({ detecting: false }); diff --git a/app/javascript/flavours/glitch/features/ui/components/link_footer.js b/app/javascript/flavours/glitch/features/ui/components/link_footer.js index d26bbe9f8..db0d2eda7 100644 --- a/app/javascript/flavours/glitch/features/ui/components/link_footer.js +++ b/app/javascript/flavours/glitch/features/ui/components/link_footer.js @@ -3,7 +3,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; import { Link } from 'react-router-dom'; -import { invitesEnabled, version, repository, source_url } from 'flavours/glitch/util/initial_state'; +import { invitesEnabled, version, limitedFederationMode, repository, source_url } from 'flavours/glitch/util/initial_state'; import { signOutLink, securityLink } from 'flavours/glitch/util/backend_links'; import { logOut } from 'flavours/glitch/util/log_out'; import { openModal } from 'flavours/glitch/actions/modal'; @@ -47,7 +47,7 @@ class LinkFooter extends React.PureComponent { <ul> {invitesEnabled && <li><a href='/invites' target='_blank'><FormattedMessage id='getting_started.invite' defaultMessage='Invite people' /></a> · </li>} {!!securityLink && <li><a href='/auth/edit'><FormattedMessage id='getting_started.security' defaultMessage='Security' /></a> · </li>} - <li><a href='/about/more' target='_blank'><FormattedMessage id='navigation_bar.info' defaultMessage='About this server' /></a> · </li> + {!limitedFederationMode && <li><a href='/about/more' target='_blank'><FormattedMessage id='navigation_bar.info' defaultMessage='About this server' /></a> · </li>} <li><a href='https://joinmastodon.org/apps' target='_blank'><FormattedMessage id='navigation_bar.apps' defaultMessage='Mobile apps' /></a> · </li> <li><a href='/terms' target='_blank'><FormattedMessage id='getting_started.terms' defaultMessage='Terms of service' /></a> · </li> <li><a href='/settings/applications' target='_blank'><FormattedMessage id='getting_started.developers' defaultMessage='Developers' /></a> · </li> |