Akkoma patches
don't replace my history re-add CI lint stuff upload to $build-tag change SW path use default SW fix notifications streams use akkoma hashtag schema add local intl
This commit is contained in:
parent
859db01268
commit
076f7534db
74 changed files with 456 additions and 221 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@
|
|||
|
||||
# Ignore bundler config and downloaded libraries.
|
||||
/.bundle
|
||||
distribution
|
||||
/vendor/bundle
|
||||
|
||||
# Ignore the default SQLite database.
|
||||
|
|
30
.woodpecker.yml
Normal file
30
.woodpecker.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
pipeline:
|
||||
build:
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- push
|
||||
image: node:16
|
||||
commands:
|
||||
- yarn
|
||||
- TARGET=distribution ./build.sh
|
||||
|
||||
release:
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- push
|
||||
image: node:16
|
||||
secrets:
|
||||
- SCW_ACCESS_KEY
|
||||
- SCW_SECRET_KEY
|
||||
- SCW_DEFAULT_ORGANIZATION_ID
|
||||
commands:
|
||||
- apt-get update && apt-get install -y rclone wget zip
|
||||
- wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64
|
||||
- mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli
|
||||
- chmod +x scaleway-cli
|
||||
- ./scaleway-cli object config install type=rclone
|
||||
- export BUILD_TAG=$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}
|
||||
- zip mastofe.zip -r distribution
|
||||
- rclone copyto mastofe.zip scaleway:akkoma-updates/frontend/$BUILD_TAG/masto-fe.zip
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
import 'packs/public-path';
|
||||
import escapeTextContentForBrowser from 'escape-html';
|
||||
|
||||
const { delegate } = require('@rails/ujs');
|
||||
|
||||
import emojify from '../mastodon/features/emoji/emoji';
|
||||
|
||||
delegate(document, '#account_display_name', 'input', ({ target }) => {
|
||||
|
|
|
@ -811,7 +811,7 @@ export function fetchPinnedAccounts() {
|
|||
return (dispatch, getState) => {
|
||||
dispatch(fetchPinnedAccountsRequest());
|
||||
|
||||
api(getState).get(`/api/v1/endorsements`, { params: { limit: 0 } }).then(response => {
|
||||
api(getState).get('/api/v1/endorsements', { params: { limit: 0 } }).then(response => {
|
||||
dispatch(importFetchedAccounts(response.data));
|
||||
dispatch(fetchPinnedAccountsSuccess(response.data));
|
||||
}).catch(err => dispatch(fetchPinnedAccountsFail(err)));
|
||||
|
@ -873,7 +873,7 @@ export function changePinnedAccountsSuggestions(value) {
|
|||
return {
|
||||
type: PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_CHANGE,
|
||||
value,
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export function resetPinnedAccountsEditor() {
|
||||
|
|
|
@ -11,7 +11,7 @@ export function initBoostModal(props) {
|
|||
|
||||
dispatch({
|
||||
type: BOOSTS_INIT_MODAL,
|
||||
privacy
|
||||
privacy,
|
||||
});
|
||||
|
||||
dispatch(openModal('BOOST', props));
|
||||
|
|
|
@ -18,7 +18,10 @@ const urlBase64ToUint8Array = (base64String) => {
|
|||
return outputArray;
|
||||
};
|
||||
|
||||
const getApplicationServerKey = () => document.querySelector('[name="applicationServerKey"]').getAttribute('content');
|
||||
const getApplicationServerKey = () => {
|
||||
const k = document.querySelector('[name="applicationServerKey"]');
|
||||
return k === null ? '' : k.getAttribute('content');
|
||||
};
|
||||
|
||||
const getRegistration = () => navigator.serviceWorker.ready;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const applyMigrations = (state) => {
|
|||
if (state.getIn(['settings', 'notifications', 'showUnread']) !== false) {
|
||||
state.setIn(['settings', 'notifications', 'showUnread'], state.getIn(['local_settings', 'notifications', 'show_unread']));
|
||||
}
|
||||
state.removeIn(['local_settings', 'notifications', 'show_unread'])
|
||||
state.removeIn(['local_settings', 'notifications', 'show_unread']);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -80,6 +80,7 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti
|
|||
},
|
||||
|
||||
onReceive (data) {
|
||||
console.log("recv", timelineId, data)
|
||||
switch(data.event) {
|
||||
case 'update':
|
||||
dispatch(updateTimeline(timelineId, JSON.parse(data.payload), options.accept));
|
||||
|
|
|
@ -27,6 +27,7 @@ export const loadPending = timeline => ({
|
|||
});
|
||||
|
||||
export function updateTimeline(timeline, status, accept) {
|
||||
console.log("UPDATE", timeline, status);
|
||||
return (dispatch, getState) => {
|
||||
if (typeof accept === 'function' && !accept(status)) {
|
||||
return;
|
||||
|
@ -55,7 +56,7 @@ export function updateTimeline(timeline, status, accept) {
|
|||
timeline,
|
||||
status,
|
||||
usePendingItems: preferPendingItems,
|
||||
filtered
|
||||
filtered,
|
||||
});
|
||||
|
||||
if (timeline === 'home') {
|
||||
|
|
|
@ -55,8 +55,9 @@ export const ImmutableHashtag = ({ hashtag }) => (
|
|||
name={hashtag.get('name')}
|
||||
href={hashtag.get('url')}
|
||||
to={`/tags/${hashtag.get('name')}`}
|
||||
people={hashtag.getIn(['history', 0, 'accounts']) * 1 + hashtag.getIn(['history', 1, 'accounts']) * 1}
|
||||
history={hashtag.get('history').reverse().map((day) => day.get('uses')).toArray()}
|
||||
people={0}
|
||||
uses={0}
|
||||
history={[]}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
@ -121,7 +121,8 @@ export default class IntersectionObserverArticle extends React.Component {
|
|||
aria-setsize={listLength}
|
||||
data-id={id}
|
||||
tabIndex='0'
|
||||
style={style}>
|
||||
style={style}
|
||||
>
|
||||
{children && React.cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })}
|
||||
</article>
|
||||
);
|
||||
|
|
|
@ -360,7 +360,7 @@ class MediaGallery extends React.PureComponent {
|
|||
} else if (width) {
|
||||
style.height = width / (16/9);
|
||||
} else {
|
||||
return (<div className={computedClass} ref={this.handleRef}></div>);
|
||||
return (<div className={computedClass} ref={this.handleRef} />);
|
||||
}
|
||||
|
||||
if (this.isStandaloneEligible()) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import { createBrowserHistory } from 'history';
|
|||
import { multiply } from 'color-blend';
|
||||
|
||||
export default class ModalRoot extends React.PureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object,
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ import { FormattedMessage } from 'react-intl';
|
|||
|
||||
export default
|
||||
class Spoilers extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
spoilerText: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
|
@ -22,16 +23,16 @@ class Spoilers extends React.PureComponent {
|
|||
const { hidden } = this.state;
|
||||
|
||||
const toggleText = hidden ?
|
||||
<FormattedMessage
|
||||
(<FormattedMessage
|
||||
id='status.show_more'
|
||||
defaultMessage='Show more'
|
||||
key='0'
|
||||
/> :
|
||||
<FormattedMessage
|
||||
/>) :
|
||||
(<FormattedMessage
|
||||
id='status.show_less'
|
||||
defaultMessage='Show less'
|
||||
key='0'
|
||||
/>;
|
||||
/>);
|
||||
|
||||
return ([
|
||||
<p className='spoiler__text'>
|
||||
|
@ -43,8 +44,9 @@ class Spoilers extends React.PureComponent {
|
|||
</p>,
|
||||
<div className={`status__content__spoiler ${!hidden ? 'status__content__spoiler--visible' : ''}`}>
|
||||
{children}
|
||||
</div>
|
||||
</div>,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ export const defaultMediaVisibility = (status, settings) => {
|
|||
}
|
||||
|
||||
return (displayMedia !== 'hide_all' && !status.get('sensitive') || displayMedia === 'show_all');
|
||||
}
|
||||
};
|
||||
|
||||
export default @injectIntl
|
||||
class Status extends ImmutablePureComponent {
|
||||
|
@ -297,7 +297,9 @@ class Status extends ImmutablePureComponent {
|
|||
if (this.node && this.props.getScrollPosition) {
|
||||
const position = this.props.getScrollPosition();
|
||||
if (position !== null && this.node.offsetTop < position.top) {
|
||||
requestAnimationFrame(() => { this.props.updateScrollBottom(position.height - position.top); });
|
||||
requestAnimationFrame(() => {
|
||||
this.props.updateScrollBottom(position.height - position.top);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const textMatchesTarget = (text, origin, host) => {
|
|||
return (text === origin || text === host
|
||||
|| text.startsWith(origin + '/') || text.startsWith(host + '/')
|
||||
|| 'www.' + text === host || ('www.' + text).startsWith(host + '/'));
|
||||
}
|
||||
};
|
||||
|
||||
const isLinkMisleading = (link) => {
|
||||
let linkTextParts = [];
|
||||
|
|
|
@ -10,6 +10,7 @@ const messages = defineMessages({
|
|||
unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' },
|
||||
private: { id: 'privacy.private.short', defaultMessage: 'Followers-only' },
|
||||
direct: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' },
|
||||
local: { id: 'privacy.local.short', defaultMessage: 'Local users only' },
|
||||
});
|
||||
|
||||
export default @injectIntl
|
||||
|
@ -29,6 +30,7 @@ class VisibilityIcon extends ImmutablePureComponent {
|
|||
unlisted: 'unlock',
|
||||
private: 'lock',
|
||||
direct: 'envelope',
|
||||
local: 'lock',
|
||||
}[visibility];
|
||||
|
||||
const label = intl.formatMessage(messages[visibility]);
|
||||
|
|
|
@ -35,7 +35,7 @@ const createIdentityContext = state => ({
|
|||
accountId: state.meta.me,
|
||||
disabledAccountId: state.meta.disabled_account_id,
|
||||
accessToken: state.meta.access_token,
|
||||
permissions: state.role ? state.role.permissions : 0,
|
||||
permissions: [],
|
||||
});
|
||||
|
||||
export default class Mastodon extends React.PureComponent {
|
||||
|
|
|
@ -32,7 +32,7 @@ class ActionBar extends React.PureComponent {
|
|||
<div className='account__disclaimer'>
|
||||
<Icon id='info-circle' fixedWidth /> <FormattedMessage
|
||||
id='account.suspended_disclaimer_full'
|
||||
defaultMessage="This user has been suspended by a moderator."
|
||||
defaultMessage='This user has been suspended by a moderator.'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -174,8 +174,7 @@ class Header extends ImmutablePureComponent {
|
|||
|
||||
if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) {
|
||||
info.push(<span className='relationship-tag'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>);
|
||||
}
|
||||
else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
|
||||
} else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
|
||||
info.push(<span className='relationship-tag'><FormattedMessage id='account.blocked' defaultMessage='Blocked' /></span>);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from 'flavours/glitch/actions/accounts';
|
||||
import {
|
||||
mentionCompose,
|
||||
directCompose
|
||||
directCompose,
|
||||
} from 'flavours/glitch/actions/compose';
|
||||
import { initMuteModal } from 'flavours/glitch/actions/mutes';
|
||||
import { initBlockModal } from 'flavours/glitch/actions/blocks';
|
||||
|
|
|
@ -88,7 +88,7 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
return [
|
||||
this.props.spoiler? this.props.spoilerText: '',
|
||||
countableText(this.props.text),
|
||||
this.props.advancedOptions && this.props.advancedOptions.get('do_not_federate') ? ' 👁️' : ''
|
||||
this.props.advancedOptions && this.props.advancedOptions.get('do_not_federate') ? ' 👁️' : '',
|
||||
].join('');
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,6 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
return (
|
||||
<div className='compose-form'>
|
||||
<WarningContainer />
|
||||
|
||||
<ReplyIndicatorContainer />
|
||||
|
||||
<div className={`spoiler-input ${spoiler ? 'spoiler-input--visible' : ''}`} ref={this.setRef}>
|
||||
|
|
|
@ -153,7 +153,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
|
|||
...rest,
|
||||
active: value && name === value,
|
||||
name,
|
||||
})
|
||||
}),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ const messages = defineMessages({
|
|||
|
||||
export default @injectIntl
|
||||
class Header extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
columns: ImmutablePropTypes.list,
|
||||
unreadNotifications: PropTypes.number,
|
||||
|
@ -71,8 +72,8 @@ class Header extends ImmutablePureComponent {
|
|||
// Only renders the component if the column isn't being shown.
|
||||
const renderForColumn = conditionalRender.bind(null,
|
||||
columnId => !columns || !columns.some(
|
||||
column => column.get('id') === columnId
|
||||
)
|
||||
column => column.get('id') === columnId,
|
||||
),
|
||||
);
|
||||
|
||||
// The result.
|
||||
|
@ -131,4 +132,5 @@ class Header extends ImmutablePureComponent {
|
|||
</nav>
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -42,5 +42,4 @@ export default class NavigationBar extends ImmutablePureComponent {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,4 +95,5 @@ class Publisher extends ImmutablePureComponent {
|
|||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -137,4 +137,5 @@ class SearchResults extends ImmutablePureComponent {
|
|||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,10 @@ class TextareaIcons extends ImmutablePureComponent {
|
|||
id={icon}
|
||||
/>
|
||||
</span>
|
||||
) : null
|
||||
) : null,
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import UploadContainer from '../containers/upload_container';
|
|||
import SensitiveButtonContainer from '../containers/sensitive_button_container';
|
||||
|
||||
export default class UploadForm extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
mediaIds: ImmutablePropTypes.list.isRequired,
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ import { profileLink, termsLink } from 'flavours/glitch/utils/backend_links';
|
|||
|
||||
const buildHashtagRE = () => {
|
||||
try {
|
||||
const HASHTAG_SEPARATORS = "_\\u00b7\\u200c";
|
||||
const HASHTAG_SEPARATORS = '_\\u00b7\\u200c';
|
||||
const ALPHA = '\\p{L}\\p{M}';
|
||||
const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}';
|
||||
return new RegExp(
|
||||
|
@ -22,7 +22,7 @@ const buildHashtagRE = () => {
|
|||
'[' + WORD + '_]*' +
|
||||
'[' + ALPHA + ']' +
|
||||
'[' + WORD + '_]*' +
|
||||
'))', 'iu'
|
||||
'))', 'iu',
|
||||
);
|
||||
} catch {
|
||||
return /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i;
|
||||
|
|
|
@ -43,6 +43,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||
export default @connect(mapStateToProps, mapDispatchToProps)
|
||||
@injectIntl
|
||||
class Compose extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
multiColumn: PropTypes.bool,
|
||||
showSearch: PropTypes.bool,
|
||||
|
|
|
@ -60,7 +60,7 @@ class LocalSettingsPage extends React.PureComponent {
|
|||
onChange={onChange}
|
||||
>
|
||||
<FormattedMessage id='settings.hicolor_privacy_icons' defaultMessage='High color privacy icons' />
|
||||
<span className='hint'><FormattedMessage id='settings.hicolor_privacy_icons.hint' defaultMessage="Display privacy icons in bright and easily distinguishable colors" /></span>
|
||||
<span className='hint'><FormattedMessage id='settings.hicolor_privacy_icons.hint' defaultMessage='Display privacy icons in bright and easily distinguishable colors' /></span>
|
||||
</LocalSettingsPageItem>
|
||||
<LocalSettingsPageItem
|
||||
settings={settings}
|
||||
|
@ -77,7 +77,7 @@ class LocalSettingsPage extends React.PureComponent {
|
|||
onChange={onChange}
|
||||
>
|
||||
<FormattedMessage id='settings.tag_misleading_links' defaultMessage='Tag misleading links' />
|
||||
<span className='hint'><FormattedMessage id='settings.tag_misleading_links.hint' defaultMessage="Add a visual indication with the link target host to every link not mentioning it explicitly" /></span>
|
||||
<span className='hint'><FormattedMessage id='settings.tag_misleading_links.hint' defaultMessage='Add a visual indication with the link target host to every link not mentioning it explicitly' /></span>
|
||||
</LocalSettingsPageItem>
|
||||
<LocalSettingsPageItem
|
||||
settings={settings}
|
||||
|
@ -100,7 +100,7 @@ class LocalSettingsPage extends React.PureComponent {
|
|||
id='mastodon-settings--notifications-tab_badge'
|
||||
onChange={onChange}
|
||||
>
|
||||
<FormattedMessage id='settings.notifications.tab_badge' defaultMessage="Unread notifications badge" />
|
||||
<FormattedMessage id='settings.notifications.tab_badge' defaultMessage='Unread notifications badge' />
|
||||
<span className='hint'><FormattedMessage id='settings.notifications.tab_badge.hint' defaultMessage="Display a badge for unread notifications in the column icons when the notifications column isn't open" /></span>
|
||||
</LocalSettingsPageItem>
|
||||
<LocalSettingsPageItem
|
||||
|
@ -110,7 +110,7 @@ class LocalSettingsPage extends React.PureComponent {
|
|||
onChange={onChange}
|
||||
>
|
||||
<FormattedMessage id='settings.notifications.favicon_badge' defaultMessage='Unread notifications favicon badge' />
|
||||
<span className='hint'><FormattedMessage id='settings.notifications.favicon_badge.hint' defaultMessage="Add a badge for unread notifications to the favicon" /></span>
|
||||
<span className='hint'><FormattedMessage id='settings.notifications.favicon_badge.hint' defaultMessage='Add a badge for unread notifications to the favicon' /></span>
|
||||
</LocalSettingsPageItem>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ export default class LocalSettingsPageItem extends React.PureComponent {
|
|||
let optionId = `${id}--${opt.value}`;
|
||||
return (
|
||||
<label htmlFor={optionId}>
|
||||
<input type='radio'
|
||||
<input
|
||||
type='radio'
|
||||
name={id}
|
||||
id={optionId}
|
||||
value={opt.value}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import classNames from 'classnames'
|
||||
import classNames from 'classnames';
|
||||
|
||||
export default class PillBarButton extends React.PureComponent {
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { injectIntl } from 'react-intl';
|
|||
import {
|
||||
fetchPinnedAccountsSuggestions,
|
||||
clearPinnedAccountsSuggestions,
|
||||
changePinnedAccountsSuggestions
|
||||
changePinnedAccountsSuggestions,
|
||||
} from '../../../actions/accounts';
|
||||
import Search from 'flavours/glitch/features/list_editor/components/search';
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { expandPublicTimeline, expandCommunityTimeline } from 'flavours/glitch/actions/timelines';
|
||||
import Masonry from 'react-masonry-infinite';
|
||||
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
||||
import DetailedStatusContainer from 'flavours/glitch/features/status/containers/detailed_status_container';
|
||||
import { debounce } from 'lodash';
|
||||
import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
|
||||
|
||||
const mapStateToProps = (state, { local }) => {
|
||||
const timeline = state.getIn(['timelines', local ? 'community' : 'public'], ImmutableMap());
|
||||
|
||||
return {
|
||||
statusIds: timeline.get('items', ImmutableList()),
|
||||
isLoading: timeline.get('isLoading', false),
|
||||
hasMore: timeline.get('hasMore', false),
|
||||
};
|
||||
};
|
||||
|
||||
export default @connect(mapStateToProps)
|
||||
class PublicTimeline extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
statusIds: ImmutablePropTypes.list.isRequired,
|
||||
isLoading: PropTypes.bool.isRequired,
|
||||
hasMore: PropTypes.bool.isRequired,
|
||||
local: PropTypes.bool,
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
this._connect();
|
||||
}
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
if (prevProps.local !== this.props.local) {
|
||||
this._disconnect();
|
||||
this._connect();
|
||||
}
|
||||
}
|
||||
|
||||
_connect () {
|
||||
const { dispatch, local } = this.props;
|
||||
|
||||
dispatch(local ? expandCommunityTimeline() : expandPublicTimeline());
|
||||
}
|
||||
|
||||
handleLoadMore = () => {
|
||||
const { dispatch, statusIds, local } = this.props;
|
||||
const maxId = statusIds.last();
|
||||
|
||||
if (maxId) {
|
||||
dispatch(local ? expandCommunityTimeline({ maxId }) : expandPublicTimeline({ maxId }));
|
||||
}
|
||||
}
|
||||
|
||||
setRef = c => {
|
||||
this.masonry = c;
|
||||
}
|
||||
|
||||
handleHeightChange = debounce(() => {
|
||||
if (!this.masonry) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.masonry.forcePack();
|
||||
}, 50)
|
||||
|
||||
render () {
|
||||
const { statusIds, hasMore, isLoading } = this.props;
|
||||
|
||||
const sizes = [
|
||||
{ columns: 1, gutter: 0 },
|
||||
{ mq: '415px', columns: 1, gutter: 10 },
|
||||
{ mq: '640px', columns: 2, gutter: 10 },
|
||||
{ mq: '960px', columns: 3, gutter: 10 },
|
||||
{ mq: '1255px', columns: 3, gutter: 10 },
|
||||
];
|
||||
|
||||
const loader = (isLoading && statusIds.isEmpty()) ? <LoadingIndicator key={0} /> : undefined;
|
||||
|
||||
return (
|
||||
<Masonry ref={this.setRef} className='statuses-grid' hasMore={hasMore} loadMore={this.handleLoadMore} sizes={sizes} loader={loader}>
|
||||
{statusIds.map(statusId => (
|
||||
<div className='statuses-grid__item' key={statusId}>
|
||||
<DetailedStatusContainer
|
||||
id={statusId}
|
||||
compact
|
||||
measureHeight
|
||||
onHeightChange={this.handleHeightChange}
|
||||
/>
|
||||
</div>
|
||||
)).toArray()}
|
||||
</Masonry>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ const ColumnLink = ({ icon, text, to, onClick, href, method, badge, transparent,
|
|||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return onClick(e);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<a href='#' onClick={onClick && handleOnClick} className={className} title={text} {...other} tabIndex='0'>
|
||||
{iconElement}
|
||||
|
|
|
@ -575,7 +575,7 @@ class DoodleModal extends ImmutablePureComponent {
|
|||
<div>
|
||||
<select aria-label='Canvas size' onInput={this.changeSize} defaultValue={this.size}>
|
||||
{ Object.values(mapValues(DOODLE_SIZES, (val, k) =>
|
||||
<option key={k} value={k}>{val[2]}</option>
|
||||
<option key={k} value={k}>{val[2]}</option>,
|
||||
)) }
|
||||
</select>
|
||||
</div>
|
||||
|
@ -602,7 +602,7 @@ class DoodleModal extends ImmutablePureComponent {
|
|||
'foreground': this.fg === c[0],
|
||||
'background': this.bg === c[0],
|
||||
})}
|
||||
/>
|
||||
/>,
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -63,8 +63,8 @@ class NavigationPanel extends React.Component {
|
|||
|
||||
{(signedIn || timelinePreview) && (
|
||||
<>
|
||||
<ColumnLink transparent to='/public/local' icon='users' text={intl.formatMessage(messages.local)} />
|
||||
<ColumnLink transparent exact to='/public' icon='globe' text={intl.formatMessage(messages.federated)} />
|
||||
<ColumnLink transparent to='/web/public/local' icon='users' text={intl.formatMessage(messages.local)} />
|
||||
<ColumnLink transparent exact to='/web/public' icon='globe' text={intl.formatMessage(messages.federated)} />
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
|
@ -405,7 +405,7 @@ class UI extends React.Component {
|
|||
navigator.serviceWorker.addEventListener('message', this.handleServiceWorkerPostMessage);
|
||||
}
|
||||
|
||||
this.favicon = new Favico({ animation:"none" });
|
||||
this.favicon = new Favico({ animation:'none' });
|
||||
|
||||
// On first launch, redirect to the follow recommendations page
|
||||
if (signedIn && this.props.firstLaunch) {
|
||||
|
|
|
@ -552,7 +552,7 @@ class Video extends React.PureComponent {
|
|||
|
||||
playerStyle.height = height;
|
||||
} else if (inline) {
|
||||
return (<div className={computedClass} ref={this.setPlayerRef} tabindex={0}></div>);
|
||||
return (<div className={computedClass} ref={this.setPlayerRef} tabindex={0} />);
|
||||
}
|
||||
|
||||
let preload;
|
||||
|
|
|
@ -150,16 +150,16 @@ function apiStatusToTextMentions (state, status) {
|
|||
}
|
||||
|
||||
return set.union(status.mentions.filter(
|
||||
mention => mention.id !== me
|
||||
mention => mention.id !== me,
|
||||
).map(
|
||||
mention => `@${mention.acct} `
|
||||
mention => `@${mention.acct} `,
|
||||
)).join('');
|
||||
}
|
||||
|
||||
function apiStatusToTextHashtags (state, status) {
|
||||
const text = unescapeHTML(status.content);
|
||||
return ImmutableOrderedSet([]).union(recoverHashtags(status.tags, text).map(
|
||||
(name) => `#${name} `
|
||||
(name) => `#${name} `,
|
||||
)).join('');
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ function clearAll(state) {
|
|||
map.set('in_reply_to', null);
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.mergeWith(overwrite, state.get('default_advanced_options'))
|
||||
map => map.mergeWith(overwrite, state.get('default_advanced_options')),
|
||||
);
|
||||
map.set('privacy', state.get('default_privacy'));
|
||||
map.set('sensitive', state.get('default_sensitive'));
|
||||
|
@ -202,7 +202,7 @@ function continueThread (state, status) {
|
|||
map.set('in_reply_to', status.id);
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: status.local_only }))
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: status.local_only })),
|
||||
);
|
||||
map.set('privacy', status.visibility);
|
||||
map.set('sensitive', false);
|
||||
|
@ -414,7 +414,7 @@ export default function compose(state = initialState, action) {
|
|||
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: !!action.status.get('local_only') }))
|
||||
map => map.merge(new ImmutableMap({ do_not_federate: !!action.status.get('local_only') })),
|
||||
);
|
||||
map.set('focusDate', new Date());
|
||||
map.set('caretPosition', null);
|
||||
|
@ -451,7 +451,7 @@ export default function compose(state = initialState, action) {
|
|||
map.set('poll', null);
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.mergeWith(overwrite, state.get('default_advanced_options'))
|
||||
map => map.mergeWith(overwrite, state.get('default_advanced_options')),
|
||||
);
|
||||
map.set('idempotencyKey', uuid());
|
||||
});
|
||||
|
@ -571,7 +571,7 @@ export default function compose(state = initialState, action) {
|
|||
map.set('language', action.status.get('language'));
|
||||
map.update(
|
||||
'advanced_options',
|
||||
map => map.merge(new ImmutableMap({ do_not_federate }))
|
||||
map => map.merge(new ImmutableMap({ do_not_federate })),
|
||||
);
|
||||
map.set('id', null);
|
||||
|
||||
|
|
13
app/javascript/flavours/glitch/reducers/rules.js
Normal file
13
app/javascript/flavours/glitch/reducers/rules.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { RULES_FETCH_SUCCESS } from 'flavours/glitch/actions/rules';
|
||||
import { List as ImmutableList, fromJS } from 'immutable';
|
||||
|
||||
const initialState = ImmutableList();
|
||||
|
||||
export default function rules(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case RULES_FETCH_SUCCESS:
|
||||
return state;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -88,25 +88,7 @@ const sharedCallbacks = {
|
|||
},
|
||||
|
||||
received (data) {
|
||||
const { stream } = data;
|
||||
|
||||
subscriptions.filter(({ channelName, params }) => {
|
||||
const streamChannelName = stream[0];
|
||||
|
||||
if (stream.length === 1) {
|
||||
return channelName === streamChannelName;
|
||||
}
|
||||
|
||||
const streamIdentifier = stream[1];
|
||||
|
||||
if (['hashtag', 'hashtag:local'].includes(channelName)) {
|
||||
return channelName === streamChannelName && params.tag === streamIdentifier;
|
||||
} else if (channelName === 'list') {
|
||||
return channelName === streamChannelName && params.list === streamIdentifier;
|
||||
}
|
||||
|
||||
return false;
|
||||
}).forEach(subscription => {
|
||||
subscriptions.forEach(subscription => {
|
||||
subscription.onReceive(data);
|
||||
});
|
||||
},
|
||||
|
@ -230,7 +212,7 @@ const createConnection = (streamingAPIBaseURL, accessToken, channelName, { conne
|
|||
channelName = params.shift();
|
||||
|
||||
if (streamingAPIBaseURL.startsWith('ws')) {
|
||||
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`, accessToken);
|
||||
const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?stream=user&${params.join('&')}`, accessToken);
|
||||
|
||||
ws.onopen = connected;
|
||||
ws.onmessage = e => received(JSON.parse(e.data));
|
||||
|
|
28
app/javascript/flavours/glitch/util/main.js
Normal file
28
app/javascript/flavours/glitch/util/main.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
import * as registerPushNotifications from 'flavours/glitch/actions/push_notifications';
|
||||
import { setupBrowserNotifications } from 'flavours/glitch/actions/notifications';
|
||||
import { default as Mastodon, store } from 'flavours/glitch/containers/mastodon';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ready from './ready';
|
||||
|
||||
const perf = require('./performance');
|
||||
|
||||
function main() {
|
||||
perf.start('main()');
|
||||
|
||||
ready(() => {
|
||||
const mountNode = document.getElementById('mastodon');
|
||||
const props = JSON.parse(mountNode.getAttribute('data-props'));
|
||||
|
||||
ReactDOM.render(<Mastodon {...props} />, mountNode);
|
||||
store.dispatch(setupBrowserNotifications());
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// avoid offline in dev mode because it's harder to debug
|
||||
require('offline-plugin/runtime').install();
|
||||
store.dispatch(registerPushNotifications.register());
|
||||
}
|
||||
perf.stop('main()');
|
||||
});
|
||||
}
|
||||
|
||||
export default main;
|
|
@ -3,6 +3,6 @@ export function recoverHashtags (recognizedTags, text) {
|
|||
const re = new RegExp(`(?:^|[^\/\)\w])#(${tag.name})`, 'i');
|
||||
const matched_hashtag = text.match(re);
|
||||
return matched_hashtag ? matched_hashtag[1] : null;
|
||||
}
|
||||
},
|
||||
).filter(x => x !== null);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ export function assignHandlers (target, handlers) {
|
|||
// We just bind each handler to the `target`.
|
||||
const handle = target.handlers = {};
|
||||
Object.keys(handlers).forEach(
|
||||
key => handle[key] = handlers[key].bind(target)
|
||||
key => handle[key] = handlers[key].bind(target),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ const createIdentityContext = state => ({
|
|||
accountId: state.meta.me,
|
||||
disabledAccountId: state.meta.disabled_account_id,
|
||||
accessToken: state.meta.access_token,
|
||||
permissions: state.role ? state.role.permissions : 0,
|
||||
permissions: [],
|
||||
});
|
||||
|
||||
export default class Mastodon extends React.PureComponent {
|
||||
|
|
|
@ -11,7 +11,7 @@ function openWebCache() {
|
|||
}
|
||||
|
||||
function fetchRoot() {
|
||||
return fetch('/', { credentials: 'include', redirect: 'manual' });
|
||||
return fetch('/web', { credentials: 'include', redirect: 'manual' });
|
||||
}
|
||||
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
|
@ -58,7 +58,7 @@ registerRoute(
|
|||
// Cause a new version of a registered Service Worker to replace an existing one
|
||||
// that is already installed, and replace the currently active worker on open pages.
|
||||
self.addEventListener('install', function(event) {
|
||||
event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put('/', root)));
|
||||
event.waitUntil(Promise.all([openWebCache(), fetchRoot()]).then(([cache, root]) => cache.put('/web', root)));
|
||||
});
|
||||
|
||||
self.addEventListener('activate', function(event) {
|
||||
|
@ -68,14 +68,13 @@ self.addEventListener('activate', function(event) {
|
|||
self.addEventListener('fetch', function(event) {
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
if (url.pathname === '/auth/sign_out') {
|
||||
const asyncResponse = fetch(event.request);
|
||||
const asyncCache = openWebCache();
|
||||
|
||||
event.respondWith(asyncResponse.then(response => {
|
||||
if (response.ok || response.type === 'opaqueredirect') {
|
||||
return Promise.all([
|
||||
asyncCache.then(cache => cache.delete('/')),
|
||||
asyncCache.then(cache => cache.delete('/web')),
|
||||
indexedDB.deleteDatabase('mastodon'),
|
||||
]).then(() => response);
|
||||
}
|
||||
|
|
20
build.sh
Executable file
20
build.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
TARGET="${TARGET:-./distribution}" # Where pleroma’s repository is sitting
|
||||
mkdir -p $TARGET/emoji
|
||||
|
||||
die() {
|
||||
echo "Die: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -d "${TARGET}" ] || die "${TARGET} directory is missing, are you sure TARGET is set to a pleroma repository? (Info: TARGET=${TARGET} )"
|
||||
|
||||
yarn install -D || die "Installing dependencies via yarn failed"
|
||||
|
||||
rm -rf public/packs public/assets
|
||||
env -i "PATH=$PATH" npm run build || die "Building the frontend failed"
|
||||
cp public/assets/sw.js "${TARGET}/sw.js" || die "installing sw.js (service-worker) failed"
|
||||
rm -rf "${TARGET}/packs" || die "Removing old assets in priv/static/packs failed"
|
||||
cp -r public/packs "${TARGET}/packs" || die "Copying new assets in priv/static/packs failed"
|
||||
rm -rf "${TARGET}/emoji/*.svg" || die "Removing the old emoji assets failed"
|
||||
cp -r public/emoji/* "${TARGET}/emoji" || die "Installing the new emoji assets failed"
|
|
@ -58,8 +58,7 @@ module.exports = {
|
|||
entry: entries,
|
||||
|
||||
output: {
|
||||
filename: 'js/[name]-[chunkhash].js',
|
||||
chunkFilename: 'js/[name]-[chunkhash].chunk.js',
|
||||
filename: 'js/[name].js',
|
||||
hotUpdateChunkFilename: 'js/[id]-[hash].hot-update.js',
|
||||
hashFunction: 'sha256',
|
||||
path: output.path,
|
||||
|
@ -102,8 +101,7 @@ module.exports = {
|
|||
},
|
||||
),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'css/[name]-[contenthash:8].css',
|
||||
chunkFilename: 'css/[name]-[contenthash:8].chunk.css',
|
||||
filename: 'css/[name].css',
|
||||
}),
|
||||
new AssetsManifestPlugin({
|
||||
integrity: true,
|
||||
|
|
18
dev.sh
Executable file
18
dev.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
TARGET="${TARGET:-./distribution}" # Where pleroma’s repository is sitting
|
||||
mkdir -p $TARGET/emoji
|
||||
|
||||
die() {
|
||||
echo "Die: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -d "${TARGET}" ] || die "${TARGET} directory is missing, are you sure TARGET is set to a pleroma repository? (Info: TARGET=${TARGET} )"
|
||||
|
||||
yarn install -D || die "Installing dependencies via yarn failed"
|
||||
|
||||
rm -rf public/packs public/assets
|
||||
env -i "PATH=$PATH" npm run build:development || die "Building the frontend failed"
|
||||
rm -rf "${TARGET}/packs" || die "Removing old assets in priv/static/packs failed"
|
||||
cp -r public/packs "${TARGET}/packs" || die "Copying new assets in priv/static/packs failed"
|
||||
rm -rf "${TARGET}/emoji/*.svg" || die "Removing the old emoji assets failed"
|
|
@ -1,14 +1,17 @@
|
|||
{
|
||||
"name": "@mastodon/mastodon",
|
||||
"description": "mastodon",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "git push --tags",
|
||||
"build:development": "cross-env RAILS_ENV=development NODE_ENV=development ./bin/webpack",
|
||||
"build:production": "cross-env RAILS_ENV=production NODE_ENV=production ./bin/webpack",
|
||||
"build:development": "cross-env NODE_ENV=development webpack --config config/webpack/development.js",
|
||||
"build:production": "cross-env NODE_ENV=production webpack --config config/webpack/production.js",
|
||||
"build": "cross-env NODE_ENV=production webpack --config config/webpack/production.js",
|
||||
"manage:translations": "node ./config/webpack/translationRunner.js",
|
||||
"dev": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack/development.js --progress --color",
|
||||
"start": "node ./streaming/index.js",
|
||||
"test": "${npm_execpath} run test:lint:js && ${npm_execpath} run test:jest",
|
||||
"test:lint": "${npm_execpath} run test:lint:js && ${npm_execpath} run test:lint:sass",
|
||||
|
@ -48,6 +51,7 @@
|
|||
"blurhash": "^2.0.4",
|
||||
"classnames": "^2.3.2",
|
||||
"cocoon-js-vanilla": "^1.3.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"color-blend": "^3.0.1",
|
||||
"compression-webpack-plugin": "^6.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
8
package.sh
Executable file
8
package.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
TARGET="${TARGET:-./distribution}"
|
||||
|
||||
rm -rf "${TARGET}/packs" || die "Removing old assets in priv/static/packs failed"
|
||||
cp -r public/packs "${TARGET}/packs" || die "Copying new assets in priv/static/packs failed"
|
||||
rm -rf "${TARGET}/emoji/*.svg" || die "Removing the old emoji assets failed"
|
||||
cp -r public/emoji/* "${TARGET}/emoji" || die "Installing the new emoji assets failed"
|
15
yarn.lock
15
yarn.lock
|
@ -2673,6 +2673,14 @@ babel-preset-jest@^29.2.0:
|
|||
babel-plugin-jest-hoist "^29.2.0"
|
||||
babel-preset-current-node-syntax "^1.0.0"
|
||||
|
||||
babel-runtime@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
|
||||
integrity sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==
|
||||
dependencies:
|
||||
core-js "^2.4.0"
|
||||
regenerator-runtime "^0.11.0"
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||
|
@ -3508,7 +3516,7 @@ core-js-pure@^3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
|
||||
integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==
|
||||
|
||||
core-js@^2.5.0:
|
||||
core-js@^2.4.0, core-js@^2.5.0:
|
||||
version "2.6.12"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec"
|
||||
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==
|
||||
|
@ -9301,6 +9309,11 @@ regenerate@^1.4.2:
|
|||
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
|
||||
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==
|
||||
|
||||
regenerator-runtime@^0.11.0:
|
||||
version "0.11.1"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
|
||||
|
||||
regenerator-runtime@^0.12.0:
|
||||
version "0.12.1"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de"
|
||||
|
|
Loading…
Reference in a new issue