api-accept
Alex Gleason 2022-04-10 17:52:42 -05:00
rodzic 2ea13e2582
commit 37a8bc7083
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 23 dodań i 10 usunięć

Wyświetl plik

@ -368,11 +368,14 @@ class ActionBar extends React.PureComponent<IActionBar, IActionBarState> {
action: this.handleCopy,
icon: require('@tabler/icons/icons/link.svg'),
});
// menu.push({
// text: intl.formatMessage(messages.embed),
// action: this.handleEmbed,
// icon: require('feather-icons/dist/icons/link-2.svg'),
// });
if (features.embeds) {
menu.push({
text: intl.formatMessage(messages.embed),
action: this.handleEmbed,
icon: require('feather-icons/dist/icons/link-2.svg'),
});
}
}
if (me) {

Wyświetl plik

@ -1,10 +1,13 @@
import axios from 'axios';
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
export default @injectIntl
import api from 'soapbox/api';
export default @connect()
@injectIntl
class EmbedModal extends ImmutablePureComponent {
static propTypes = {
@ -19,12 +22,18 @@ class EmbedModal extends ImmutablePureComponent {
oembed: null,
};
componentDidMount() {
const { url } = this.props;
fetchEmbed = () => {
const { dispatch, url } = this.props;
return dispatch((dispatch, getState) => {
return api(getState).get('/api/oembed', { params: { url } });
});
}
componentDidMount() {
this.setState({ loading: true });
axios.post('/api/web/embed', { url }).then(res => {
this.fetchEmbed().then(res => {
this.setState({ loading: false, oembed: res.data });
const iframeDocument = this.iframe.contentWindow.document;

Wyświetl plik

@ -30,6 +30,7 @@ const getInstanceFeatures = (instance: Instance) => {
privacyScopes: v.software !== TRUTHSOCIAL,
spoilers: v.software !== TRUTHSOCIAL,
filters: v.software !== TRUTHSOCIAL,
embeds: v.software === MASTODON,
polls: any([
v.software === MASTODON && gte(v.version, '2.8.0'),
v.software === PLEROMA,