diff --git a/README.md b/README.md index a56c7820..d4b24240 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ We have diverged from Mastodon in several ways in pursuit of our own goals. 1. Quote posting ## BTCPay -In order to make BTC flow work, 3 enviornment variables need to be set: +In order to make BTC flow work, 3 environment variables need to be set: -- `BTCPAY_LEGACY_TOKEN`: So called Legacy Tokens can be found in https://btcpay.xxx.com/stores/yyy/Tokens -- `BTCPAY_PUB_KEY`: Public key that is used when creating an access token or pairing https://btcpay.xxx.com/stores/yyy/Tokens/Create +- `BTCPAY_LEGACY_TOKEN`: So called Legacy Tokens can be found in https://btcpay.[yourdomain].com/stores/[yourstore]/Tokens +- `BTCPAY_PUB_KEY`: Public key that is used when creating an access token or pairing https://btcpay.[yourdomain].com/stores/[yourstore]/Tokens/Create - `BTCPAY_MERCHANT_TOKEN`: Token created for facade *merchant* ## Deployment diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js index a52dc427..536c0560 100644 --- a/app/javascript/gabsocial/actions/compose.js +++ b/app/javascript/gabsocial/actions/compose.js @@ -137,6 +137,32 @@ export function directCompose(account, routerHistory) { }; }; +export function handleComposeSubmit(dispatch, getState, response, status) { + if (!dispatch || !getState) return; + + dispatch(insertIntoTagHistory(response.data.tags, status)); + dispatch(submitComposeSuccess({ ...response.data })); + + // To make the app more responsive, immediately push the status into the columns + const insertIfOnline = timelineId => { + const timeline = getState().getIn(['timelines', timelineId]); + + if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) { + let dequeueArgs = {}; + if (timelineId === 'community') dequeueArgs.onlyMedia = getState().getIn(['settings', 'community', 'other', 'onlyMedia']); + dispatch(dequeueTimeline(timelineId, null, dequeueArgs)); + dispatch(updateTimeline(timelineId, { ...response.data })); + } + }; + + if (response.data.visibility !== 'direct') { + insertIfOnline('home'); + } else if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { + insertIfOnline('community'); + insertIfOnline('public'); + } +} + export function submitCompose(routerHistory, group) { return function (dispatch, getState) { if (!me) return; @@ -175,33 +201,7 @@ export function submitCompose(routerHistory, group) { if (response.data.visibility === 'direct' && getState().getIn(['conversations', 'mounted']) <= 0 && routerHistory) { routerHistory.push('/messages'); } - - dispatch(insertIntoTagHistory(response.data.tags, status)); - dispatch(submitComposeSuccess({ ...response.data })); - - // To make the app more responsive, immediately push the status - // into the columns - - const insertIfOnline = timelineId => { - const timeline = getState().getIn(['timelines', timelineId]); - - if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) { - let dequeueArgs = {}; - if (timelineId === 'community') dequeueArgs.onlyMedia = getState().getIn(['settings', 'community', 'other', 'onlyMedia']), - - dispatch(dequeueTimeline(timelineId, null, dequeueArgs)); - dispatch(updateTimeline(timelineId, { ...response.data })); - } - }; - - if (response.data.visibility !== 'direct') { - insertIfOnline('home'); - } - - if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { - insertIfOnline('community'); - insertIfOnline('public'); - } + handleComposeSubmit(dispatch, getState, response, status); }).catch(function (error) { dispatch(submitComposeFail(error)); }); diff --git a/app/javascript/gabsocial/actions/streaming.js b/app/javascript/gabsocial/actions/streaming.js index e599805e..0baf42c9 100644 --- a/app/javascript/gabsocial/actions/streaming.js +++ b/app/javascript/gabsocial/actions/streaming.js @@ -10,6 +10,7 @@ import { updateNotificationsQueue, expandNotifications } from './notifications'; import { updateConversations } from './conversations'; import { fetchFilters } from './filters'; import { getLocale } from '../locales'; +import { handleComposeSubmit } from './compose'; const { messages } = getLocale(); @@ -61,3 +62,18 @@ export const connectHashtagStream = (id, tag, accept) => connectTimelineStream export const connectDirectStream = () => connectTimelineStream('direct', 'direct'); export const connectListStream = id => connectTimelineStream(`list:${id}`, `list&list=${id}`); export const connectGroupStream = id => connectTimelineStream(`group:${id}`, `group&group=${id}`); + +export const connectStatusUpdateStream = () => { + return connectStream('statuscard', null, (dispatch, getState) => { + return { + onConnect() {}, + onDisconnect() {}, + onReceive (data) { + if (!data['event'] || !data['payload']) return; + if (data.event === 'update') { + handleComposeSubmit(dispatch, getState, {data: JSON.parse(data.payload)}, null) + } + }, + }; + }); +} \ No newline at end of file diff --git a/app/javascript/gabsocial/components/extended_video_player.js b/app/javascript/gabsocial/components/extended_video_player.js index 009c0d55..9dfc745f 100644 --- a/app/javascript/gabsocial/components/extended_video_player.js +++ b/app/javascript/gabsocial/components/extended_video_player.js @@ -44,9 +44,9 @@ export default class ExtendedVideoPlayer extends React.PureComponent { return (