Compare commits

...
This repository has been archived on 2023-07-01. You can view files and clone it, but cannot push or open issues or pull requests.

19 Commits

Author SHA1 Message Date
kibigo! da2b6dda6a This is a better way of detecting frontends 2017-06-22 21:10:02 -07:00
kibigo! ed82421870 Forgot to delete a debugging thing sry 😰 2017-06-22 20:38:08 -07:00
kibigo! b3904c2553 MORE FRONTENDS (EASY MODE) WIN!!! 2017-06-22 20:15:11 -07:00
beatrix 101a4c6913 glitch the getting started image 2017-06-22 13:04:56 -04:00
kibigo! 11da74dbb7 Very minor styling improvements to toot-collapsing 2017-06-22 00:54:33 -07:00
kibigo! 51a86b32c3 Updates height upon collapsing 2017-06-21 20:17:12 -07:00
kibigo! 51b783cdbc Minor collapsing button improvements~ 2017-06-21 19:54:41 -07:00
kibigo! 3915f06b02 Collapsable toots [1/??] 2017-06-21 19:40:53 -07:00
kibigo! 07b1171c73 Profile Metadata HACK 😈 2017-06-20 19:44:43 -07:00
Go Shoemake 571576d6f7 Fixes drawer so stuff doesn't overflow 2017-06-20 23:46:17 +00:00
Charlotte Fields 7151ec7680 cybre cleanup 2017-06-20 23:46:17 +00:00
Chronister a4b3009c1c cybrespace to 1.4.2 2017-06-20 23:46:17 +00:00
Chronister ef30a92c71 All cybrespace changes through 5/28 2017-06-20 23:46:17 +00:00
Charlotte Fields 613aa55e03 adding cybre changes 2017-06-20 23:46:17 +00:00
beatrix-bitrot 88a08d54b6 update local modifications for cors and cp 2017-06-20 23:46:17 +00:00
beatrix-bitrot 3a69d70eae silly readme update to test automated deploys 2017-06-20 23:46:17 +00:00
beatrix-bitrot 9c778f4abf update README.md 2017-06-20 23:46:17 +00:00
beatrix ac61ce5826 Update README.md 2017-06-20 23:46:17 +00:00
Beatrix Bitrot 73d6da32be CORS tweaks 2017-06-20 23:46:17 +00:00
31 changed files with 425 additions and 120 deletions

View File

@ -1,70 +1,5 @@
Mastodon
Mastodon Glitch Edition
========
Now with automated deploys!
[![Build Status](http://img.shields.io/travis/tootsuite/mastodon.svg)][travis]
[![Code Climate](https://img.shields.io/codeclimate/github/tootsuite/mastodon.svg)][code_climate]
[travis]: https://travis-ci.org/tootsuite/mastodon
[code_climate]: https://codeclimate.com/github/tootsuite/mastodon
Mastodon is a free, open-source social network server. A decentralized solution to commercial platforms, it avoids the risks of a single company monopolizing your communication. Anyone can run Mastodon and participate in the social network seamlessly.
An alternative implementation of the GNU social project. Based on [ActivityStreams](https://en.wikipedia.org/wiki/Activity_Streams_(format)), [Webfinger](https://en.wikipedia.org/wiki/WebFinger), [PubsubHubbub](https://en.wikipedia.org/wiki/PubSubHubbub) and [Salmon](https://en.wikipedia.org/wiki/Salmon_(protocol)).
Click on the screenshot to watch a demo of the UI:
[![Screenshot](https://i.imgur.com/pG3Nnz3.jpg)][youtube_demo]
[youtube_demo]: https://www.youtube.com/watch?v=YO1jQ8_rAMU
The project focus is a clean REST API and a good user interface. Ruby on Rails is used for the back-end, while React.js and Redux are used for the dynamic front-end. A static front-end for public resources (profiles and statuses) is also provided.
If you would like, you can [support the development of this project on Patreon][patreon]. Alternatively, you can donate to this BTC address: `17j2g7vpgHhLuXhN4bueZFCvdxxieyRVWd`
[patreon]: https://www.patreon.com/user?u=619786
## Resources
- [List of Mastodon instances](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md)
- [Use this tool to find Twitter friends on Mastodon](https://mastodon-bridge.herokuapp.com)
- [API overview](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md)
- [Frequently Asked Questions](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md)
- [List of apps](https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md)
## Features
- **Fully interoperable with GNU social and any OStatus platform**
Whatever implements Atom feeds, ActivityStreams, Salmon, PubSubHubbub and Webfinger is part of the network
- **Real-time timeline updates**
See the updates of people you're following appear in real-time in the UI via WebSockets
- **Federated thread resolving**
If someone you follow replies to a user unknown to the server, the server fetches the full thread so you can view it without leaving the UI
- **Media attachments like images and WebM**
Upload and view images and WebM videos attached to the updates
- **OAuth2 and a straightforward REST API**
Mastodon acts as an OAuth2 provider so 3rd party apps can use the API, which is RESTful and simple
- **Background processing for long-running tasks**
Mastodon tries to be as fast and responsive as possible, so all long-running tasks that can be delegated to background processing, are
- **Deployable via Docker**
You don't need to mess with dependencies and configuration if you want to try Mastodon, if you have Docker and Docker Compose the deployment is extremely easy
## Development
Please follow the [development guide](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Development-guide.md) from the documentation repository.
## Deployment
There are guides in the documentation repository for [deploying on various platforms](https://github.com/tootsuite/documentation#running-mastodon).
## Contributing
You can open issues for bugs you've found or features you think are missing. You can also submit pull requests to this repository. [Here are the guidelines for code contributions](CONTRIBUTING.md)
**IRC channel**: #mastodon on irc.freenode.net
## Extra credits
- The [Emoji One](https://github.com/Ranks/emojione) pack has been used for the emojis
- The error page image courtesy of [Dopatwo](https://www.youtube.com/user/dopatwo)
![Mastodon error image](https://mastodon.social/oops.png)
So here's the deal: we all work on this code, and then it runs on dev.glitch.social and anyone who uses that does so absolutely at their own risk. can you dig it?

View File

@ -9,6 +9,7 @@ class HomeController < ApplicationController
@web_settings = Web::Setting.find_by(user: current_user)&.data || {}
@admin = Account.find_local(Setting.site_contact_username)
@streaming_api_base_url = Rails.configuration.x.streaming_api_base_url
@frontend = (params[:frontend] and Rails.configuration.x.available_frontends.include? params[:frontend] + '.js') ? params[:frontend] : 'mastodon'
end
private

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -17,6 +17,7 @@ class IconButton extends React.PureComponent {
disabled: PropTypes.bool,
inverted: PropTypes.bool,
animate: PropTypes.bool,
flip: PropTypes.bool,
overlay: PropTypes.bool,
};
@ -69,7 +70,7 @@ class IconButton extends React.PureComponent {
}
return (
<Motion defaultStyle={{ rotate: this.props.active ? -360 : 0 }} style={{ rotate: this.props.animate ? spring(this.props.active ? -360 : 0, { stiffness: 120, damping: 7 }) : 0 }}>
<Motion defaultStyle={{ rotate: this.props.active ? (this.props.flip ? -180 : -360) : 0 }} style={{ rotate: this.props.animate ? spring(this.props.active ? (this.props.flip ? -180 : -360) : 0, { stiffness: this.props.flip ? 60 : 120, damping: 7 }) : 0 }}>
{({ rotate }) =>
<button
aria-label={this.props.title}

View File

@ -3,19 +3,24 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import Avatar from './avatar';
import AvatarOverlay from './avatar_overlay';
import RelativeTimestamp from './relative_timestamp';
import DisplayName from './display_name';
import MediaGallery from './media_gallery';
import VideoPlayer from './video_player';
import AttachmentList from './attachment_list';
import StatusContent from './status_content';
import StatusActionBar from './status_action_bar';
import { FormattedMessage } from 'react-intl';
import IconButton from './icon_button';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import emojify from '../emoji';
import escapeTextContentForBrowser from 'escape-html';
import ImmutablePureComponent from 'react-immutable-pure-component';
import scheduleIdleTask from '../features/ui/util/schedule_idle_task';
const messages = defineMessages({
collapse: { id: 'status.collapse', defaultMessage: 'Collapse' },
uncollapse: { id: 'status.uncollapse', defaultMessage: 'Uncollapse' },
});
class Status extends ImmutablePureComponent {
static contextTypes = {
@ -38,12 +43,14 @@ class Status extends ImmutablePureComponent {
autoPlayGif: PropTypes.bool,
muted: PropTypes.bool,
intersectionObserverWrapper: PropTypes.object,
intl: PropTypes.object.isRequired,
};
state = {
isExpanded: false,
isIntersecting: true, // assume intersecting until told otherwise
isHidden: false, // set to true in requestIdleCallback to trigger un-render
isCollapsed: false,
}
// Avoid checking props that are functions (and whose equality will always
@ -61,7 +68,11 @@ class Status extends ImmutablePureComponent {
updateOnStates = ['isExpanded']
shouldComponentUpdate (nextProps, nextState) {
if (!nextState.isIntersecting && nextState.isHidden) {
if (nextState.isCollapsed !== this.state.isCollapsed) {
// If the collapsed state of the element has changed then we definitely
// need to re-update.
return true;
} else if (!nextState.isIntersecting && nextState.isHidden) {
// It's only if we're not intersecting (i.e. offscreen) and isHidden is true
// that either "isIntersecting" or "isHidden" matter, and then they're
// the only things that matter.
@ -75,7 +86,13 @@ class Status extends ImmutablePureComponent {
return super.shouldComponentUpdate(nextProps, nextState);
}
componentDidUpdate (prevProps, prevState) {
if (prevState.isCollapsed !== this.state.isCollapsed) this.saveHeight();
}
componentDidMount () {
const node = this.node;
if (!this.props.intersectionObserverWrapper) {
// TODO: enable IntersectionObserver optimization for notification statuses.
// These are managed in notifications/index.js rather than status_list.js
@ -87,6 +104,8 @@ class Status extends ImmutablePureComponent {
this.handleIntersection
);
if (node.clientHeight > 400) this.setState({ isCollapsed: true });
this.componentMounted = true;
}
@ -151,11 +170,15 @@ class Status extends ImmutablePureComponent {
this.setState({ isExpanded: !this.state.isExpanded });
};
handleCollapsedClick = () => {
this.setState({ isCollapsed: !this.state.isCollapsed });
}
render () {
let media = null;
let statusAvatar;
const { status, account, ...other } = this.props;
const { isExpanded, isIntersecting, isHidden } = this.state;
const { status, account, intl, ...other } = this.props;
const { isExpanded, isIntersecting, isHidden, isCollapsed } = this.state;
if (status === null) {
return null;
@ -208,9 +231,17 @@ class Status extends ImmutablePureComponent {
}
return (
<div className={`status ${this.props.muted ? 'muted' : ''} status-${status.get('visibility')}`} data-id={status.get('id')} ref={this.handleRef}>
<div className={`status ${this.props.muted ? 'muted' : ''} status-${status.get('visibility')} ${isCollapsed ? 'status-collapsed' : ''}`} data-id={status.get('id')} ref={this.handleRef}>
<div className='status__info'>
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a>
<IconButton
className='status__collapse-button'
animate flip
active={isCollapsed}
title={isCollapsed ? intl.formatMessage(messages.uncollapse) : intl.formatMessage(messages.collapse)}
icon='angle-double-up'
onClick={this.handleCollapsedClick}
/>
<a onClick={this.handleAccountClick} data-id={status.getIn(['account', 'id'])} href={status.getIn(['account', 'url'])} className='status__display-name'>
<div className='status__avatar'>
@ -219,17 +250,18 @@ class Status extends ImmutablePureComponent {
<DisplayName account={status.get('account')} />
</a>
</div>
<StatusContent status={status} onClick={this.handleClick} expanded={isExpanded} onExpandedToggle={this.handleExpandedToggle} onHeightUpdate={this.saveHeight} />
{media}
{isCollapsed ? null : media}
<StatusActionBar {...this.props} />
{isCollapsed ? null : <StatusActionBar {...this.props} />}
</div>
);
}
}
export default Status;
export default injectIntl(Status);

View File

@ -5,6 +5,7 @@ import IconButton from './icon_button';
import DropdownMenu from './dropdown_menu';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import RelativeTimestamp from './relative_timestamp';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
@ -144,6 +145,8 @@ class StatusActionBar extends ImmutablePureComponent {
<div className='status__action-bar-dropdown'>
<DropdownMenu items={menu} icon='ellipsis-h' size={18} direction='right' ariaLabel='More' />
</div>
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a>
</div>
);
}

View File

@ -16,6 +16,57 @@ const messages = defineMessages({
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
});
/*
THIS IS A MESS BECAUSE EFFING MASTODON AND ITS EFFING HTML BIOS
INSTEAD OF JUST STORING EVERYTHING IN PLAIN EFFING TEXT ! ! ! !
BLANK LINES ALSO WON'T WORK BECAUSE RIGHT NOW MASTODON CONVERTS
THOSE INTO `<P>` ELEMENTS INSTEAD OF LEAVING IT AS `<BR><BR>` !
TL:DR; THIS IS LARGELY A HACK. WITH BETTER BACKEND STUFF WE CAN
IMPROVE THIS BY BETTER PREDICTING HOW THE METADATA WILL BE SENT
WHILE MAINTAINING BASIC PLAIN-TEXT PROCESSING. THE OTHER OPTION
IS TO TURN ALL BIOS INTO PLAIN-TEXT VIA A TREE-WALKER, AND THEN
PROCESS THE YAML AND LINKS AND EVERYTHING OURSELVES. THIS WOULD
BE INCREDIBLY COMPLICATED, AND IT WOULD BE A MILLION TIMES LESS
DIFFICULT IF MASTODON JUST GAVE US PLAIN-TEXT BIOS (WHICH QUITE
FRANKLY MAKES THE MOST SENSE SINCE THAT'S WHAT USERS PROVIDE IN
SETTINGS) TO BEGIN WITH AND LEFT ALL PROCESSING TO THE FRONTEND
TO HANDLE ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
ANYWAY I KNOW WHAT NEEDS TO BE DONE REGARDING BACKEND STUFF BUT
I'M NOT SMART ENOUGH TO FIGURE OUT HOW TO ACTUALLY IMPLEMENT IT
SO FEEL FREE TO @ ME IF YOU NEED MY IDEAS REGARDING THAT. UNTIL
THEN WE'LL JUST HAVE TO MAKE DO WITH THIS MESSY AND UNFORTUNATE
HACKING ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
with love,
@kibi@glitch.social <3
*/
const NEW_LINE = /(?:^|\r?\n|<br\s*\/?>)/g
const YAML_OPENER = /---/;
const YAML_CLOSER = /(?:---|\.\.\.)/;
const YAML_STRING = /(?:"(?:[^"\n]){1,32}"|'(?:[^'\n]){1,32}'|(?:[^'":\n]){1,32})/g;
const YAML_LINE = new RegExp("\\s*" + YAML_STRING.source + "\\s*:\\s*" + YAML_STRING.source + "\\s*", "g");
const BIO_REGEX = new RegExp(NEW_LINE.source + "*" + YAML_OPENER.source + NEW_LINE.source + "+(?:" + YAML_LINE.source + NEW_LINE.source + "+){0,4}" + YAML_CLOSER.source + NEW_LINE.source + "*");
const processBio = (data) => {
let props = {text: data, metadata: []};
let yaml = data.match(BIO_REGEX);
if (!yaml) return props;
else yaml = yaml[0];
let start = props.text.indexOf(yaml);
let end = start + yaml.length;
props.text = props.text.substr(0, start) + props.text.substr(end);
yaml = yaml.replace(NEW_LINE, "\n");
let metadata = (yaml ? yaml.match(YAML_LINE) : []) || [];
for (let i = 0; i < metadata.length; i++) {
let result = metadata[i].match(YAML_STRING);
if (result[0][0] === '"' || result[0][0] === "'") result[0] = result[0].substr(1, result[0].length - 2);
if (result[1][0] === '"' || result[1][0] === "'") result[0] = result[1].substr(1, result[1].length - 2);
props.metadata.push(result);
}
return props;
};
const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
autoPlayGif: state.getIn(['meta', 'auto_play_gif']),
@ -120,21 +171,44 @@ class Header extends ImmutablePureComponent {
lockedIcon = <i className='fa fa-lock' />;
}
const content = { __html: emojify(account.get('note')) };
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
const { text, metadata } = processBio(account.get('note'));
return (
<div className='account__header' style={{ backgroundImage: `url(${account.get('header')})` }}>
<div>
<Avatar account={account} autoPlayGif={this.props.autoPlayGif} />
<div className='account__header__wrapper'>
<div className='account__header' style={{ backgroundImage: `url(${account.get('header')})` }}>
<div>
<Avatar account={account} autoPlayGif={this.props.autoPlayGif} />
<span className='account__header__display-name' dangerouslySetInnerHTML={displayNameHTML} />
<span className='account__header__username'>@{account.get('acct')} {lockedIcon}</span>
<div className='account__header__content' dangerouslySetInnerHTML={content} />
<span className='account__header__display-name' dangerouslySetInnerHTML={displayNameHTML} />
<span className='account__header__username'>@{account.get('acct')} {lockedIcon}</span>
<div className='account__header__content' dangerouslySetInnerHTML={{__html: emojify(text)}} />
{info}
{actionBtn}
{info}
{actionBtn}
</div>
</div>
{metadata.length && (
<div className='account__metadata'>
{(() => {
let data = [];
for (let i = 0; i < metadata.length; i++) {
data.push(
<div
className='account__metadata-item'
title={metadata[i][0] + ":" + metadata[i][1]}
key={i}
>
<span dangerouslySetInnerHTML={{__html: emojify(metadata[i][0])}} />
<strong dangerouslySetInnerHTML={{__html: emojify(metadata[i][1])}} />
</div>
);
}
return data;
})()}
</div>
) || null}
</div>
);
}

View File

@ -191,6 +191,14 @@
{
"defaultMessage": "{name} boosted",
"id": "status.reblogged_by"
},
{
"defaultMessage": "Collapse",
"id": "status.collapse"
},
{
"defaultMessage": "Uncollapse",
"id": "status.uncollapse"
}
],
"path": "app/javascript/mastodon/components/status.json"
@ -1170,4 +1178,4 @@
],
"path": "app/javascript/mastodon/features/ui/components/video_modal.json"
}
]
]

View File

@ -143,6 +143,7 @@
"search.placeholder": "Search",
"search_results.total": "{count, number} {count, plural, one {result} other {results}}",
"status.cannot_reblog": "This post cannot be boosted",
"status.collapse": "Collapse",
"status.delete": "Delete",
"status.favourite": "Favourite",
"status.load_more": "Load more",
@ -159,6 +160,7 @@
"status.sensitive_warning": "Sensitive content",
"status.show_less": "Show less",
"status.show_more": "Show more",
"status.uncollapse": "Uncollapse",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Compose",
"tabs_bar.federated_timeline": "Federated",

View File

View File

@ -1,2 +1,3 @@
import { start } from 'rails-ujs';
require('../mastodon/locales');
start();

View File

@ -0,0 +1 @@
require('../styles/custom.scss');

View File

@ -0,0 +1,6 @@
import main from '../../mastodon/main';
import loadPolyfills from '../../mastodon/load_polyfills';
loadPolyfills().then(main).catch(e => {
console.error(e);
});

View File

@ -456,9 +456,11 @@
.reply-indicator__content {
font-size: 15px;
line-height: 20px;
color: $primary-text-color;
word-wrap: break-word;
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
white-space: pre-wrap;
.emojione {
@ -542,8 +544,10 @@
padding: 8px 10px;
padding-left: 68px;
position: relative;
height: auto;
min-height: 48px;
border-bottom: 1px solid lighten($ui-base-color, 8%);
overflow: hidden;
cursor: default;
@keyframes fade {
@ -598,6 +602,14 @@
}
}
}
&.status-collapsed {
height: 48px;
.status__content {
height: 20px;
}
}
}
.notification-favourite {
@ -611,8 +623,8 @@
}
.status__relative-time {
margin-left: auto;
color: lighten($ui-base-color, 26%);
float: right;
font-size: 14px;
}
@ -627,7 +639,13 @@
}
.status__info {
margin: 2px 0 0;
font-size: 15px;
line-height: 24px;
}
.status__collapse-button {
float: right;
}
.status-check-box {
@ -820,9 +838,12 @@
padding: 10px;
}
.account__header {
.account__header__wrapper {
flex: 0 0 auto;
background: lighten($ui-base-color, 4%);
}
.account__header {
text-align: center;
background-size: cover;
background-position: center;
@ -887,6 +908,42 @@
}
}
.account__metadata {
display: block;
font-size: 15px;
line-height: 36px;
overflow: hidden;
.account__metadata-item {
display: flex;
flex-direction: row;
border-top: 1px solid lighten($ui-base-color, 8%);
& > span, & > strong {
display: inline-block;
padding: 10px 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
& > span {
flex: 0 0 auto;
width: 120px;
color: $ui-primary-color;
background: lighten($ui-base-color, 13%);
font-variant: small-caps;
}
& > strong {
flex: auto;
color: $primary-text-color;
background: $ui-base-color;
font-weight: bold;
}
}
}
.account__action-bar {
border-top: 1px solid lighten($ui-base-color, 8%);
border-bottom: 1px solid lighten($ui-base-color, 8%);

View File

@ -0,0 +1,123 @@
@import 'application';
@media screen and (min-width: 1300px) {
.column {
flex-grow: 1 !important;
max-width: 400px;
}
.drawer {
flex-grow: 1 !important;
flex-basis: 200px !important;
min-width: 268px;
max-width: 400px;
}
}
.muted {
.status__content p, .status__content a {
color: lighten($ui-base-color, 35%);
}
.status__display-name strong {
color: lighten($ui-base-color, 35%);
}
}
.status time:after,
.detailed-status__datetime span:after {
font: normal normal normal 14px/1 FontAwesome;
content: "\00a0\00a0\f08e";
}
.compose-form__buttons button.active:last-child {
color:$ui-secondary-color;
background-color: $ui-highlight-color;
border-radius:3px;
}
.about-body .mascot {
display:none;
}
.screenshot-with-signup {
min-height:300px;
}
.screenshot-with-signup .closed-registrations-message,
.screenshot-with-signup form {
background-color: rgba(0,0,0,0.7);
margin:auto;
}
.screenshot-with-signup .closed-registrations-message .clock {
font-size:150%;
}
.drawer .drawer__inner {
overflow: visible;
height:inherit;
}
.drawer__pager {
overflow-y:auto;
}
.column {
// trying to fix @mdhughes safari problem
max-height:100vh;
}
.media-gallery {
height:auto !important;
max-height:30vh;
position:relative;
margin-top:20px;
margin-left:-68px;
width: calc(100% + 80px);
}
.media-gallery:before{
content: "";
display: block;
padding-top: 100%;
}
.media-gallery__item,
.media-gallery .media-spoiler{
left: 0;
right: 0;
top: 0;
bottom: 0 !important;
position:absolute;
}
.media-spoiler-video:before {
content:"";
display:block;
padding-top:100%;
}
.media-spoiler-video,
.status__video-player,
.detailed-status > .media-spoiler,
.status > .media-spoiler {
height:auto !important;
max-height:30vh;
position:relative;
margin-top:20px;
margin-left:-68px;
width: calc(100% + 80px) !important;
}
.status__video-player-video {
transform:unset;
}
.detailed-status > .media-spoiler,
.status > .media-spoiler {
height:30vh !important;
vertical-align:middle;
}

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = 500
MAX_CHARS = 512
def validate(status)
return unless status.local? && !status.reblog?

View File

@ -9,4 +9,4 @@
%li= link_to t('about.get_started'), new_user_registration_path
%li= link_to t('auth.login'), new_user_session_path
%li= link_to t('about.terms'), terms_path
%li= link_to t('about.source_code'), 'https://github.com/tootsuite/mastodon'
%li= link_to t('about.source_code'), 'https://github.com/chronister/mastodon'

View File

@ -36,7 +36,7 @@
.info
= link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
·
= link_to t('about.other_instances'), 'https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md'
= link_to t('about.other_instances'), 'https://instances.mastodon.xyz/'
·
= link_to t('about.about_this'), about_more_path
@ -82,6 +82,6 @@
·
= link_to t('about.apps'), 'https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md'
·
= link_to t('about.source_code'), 'https://github.com/tootsuite/mastodon'
= link_to t('about.source_code'), 'https://github.com/chronister/mastodon'
·
= link_to t('about.other_instances'), 'https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/List-of-Mastodon-instances.md'
= link_to t('about.other_instances'), 'https://instances.mastodon.xyz/'

View File

@ -1,7 +1,8 @@
- content_for :header_tags do
%script#initial-state{ type: 'application/json' }!= json_escape(render(file: 'home/initial_state', formats: :json))
= javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous'
= javascript_pack_tag "frontends/#{@frontend}", integrity: true, crossorigin: 'anonymous'
= stylesheet_pack_tag "frontends/#{@frontend}", integrity: true, media: 'all'
.app-holder#mastodon{ data: { props: Oj.dump(default_props) } }
%noscript

View File

@ -18,11 +18,13 @@
= ' - '
= title
= stylesheet_pack_tag 'application', media: 'all'
= javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous'
= javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous'
= csrf_meta_tags
- if controller_name != 'home'
= stylesheet_pack_tag 'application', integrity: true, media: 'all'
= yield :header_tags
- body_classes ||= @body_classes

View File

@ -67,12 +67,17 @@ module Mastodon
config.active_job.queue_adapter = :sidekiq
#config.middleware.insert_before 0, Rack::Cors, debug: true, logger: (-> { Rails.logger }) do
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/@:username', headers: :any, methods: [:get], credentials: false
resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :patch, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
resource '/oauth/token', headers: :any, methods: [:post], credentials: false
resource '/assets/*', headers: :any, methods: [:get, :head, :options]
resource '/stylesheets/*', headers: :any, methods: [:get, :head, :options]
resource '/javascripts/*', headers: :any, methods: [:get, :head, :options]
resource '/packs/*', headers: :any, methods: [:get, :head, :options]
end
end

View File

@ -93,9 +93,12 @@ Rails.application.configure do
end
config.action_dispatch.default_headers = {
'Server' => 'Mastodon',
'X-Frame-Options' => 'DENY',
'X-Content-Type-Options' => 'nosniff',
'X-XSS-Protection' => '1; mode=block',
'Server' => 'Mastodon',
'X-Frame-Options' => 'DENY',
'X-Content-Type-Options' => 'nosniff',
'X-XSS-Protection' => '1; mode=block',
'Content-Security-Policy' => "frame-ancestors 'none'; object-src 'none'; script-src 'self' https://dev-static.glitch.social 'unsafe-inline'; base-uri 'none';" ,
'Referrer-Policy' => 'no-referrer, strict-origin-when-cross-origin',
'Strict-Transport-Security' => 'max-age=63072000; includeSubDomains; preload'
}
end

View File

@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
Rails.application.configure do
frontends = []
Rails.root.join('app', 'javascript', 'packs', 'frontends').each_child(false) { |f| frontends.push f.to_s }
config.x.available_frontends = frontends
end

View File

@ -7,7 +7,7 @@
# For more information, see docs/Running-Mastodon/Administration-guide.md
#
defaults: &defaults
site_title: Mastodon
site_title: 'dev.glitch.social'
site_description: ''
site_extended_description: ''
site_contact_username: ''

View File

@ -51,18 +51,7 @@ module.exports = {
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: (module, count) => {
const reactIntlPathRegexp = new RegExp(`node_modules\\${sep}react-intl`);
if (module.resource && reactIntlPathRegexp.test(module.resource)) {
// skip react-intl because it's useless to put in the common chunk,
// e.g. because "shared" modules between zh-TW and zh-CN will never
// be loaded together
return false;
}
return count >= 2;
},
minChunks: Infinity
}),
],

View File

@ -8,8 +8,8 @@
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #282c37;
color: #9baec8;
background: #181818 url("/background-photo.png");
color: #1ea21e;
text-align: center;
margin: 0;
padding: 20px;
@ -33,7 +33,7 @@
<body>
<div class="dialog">
<img src="/oops.png" alt="Mastodon" />
<img src="/logo.png" alt="dev.glitch.social" />
<div>
<h1>We're sorry, but something went wrong.</h1>

BIN
public/background-cybre.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

View File

@ -3,7 +3,7 @@
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#2b5797</TileColor>
<TileColor>#1ea21e</TileColor>
</tile>
</msapplication>
</browserconfig>

54
public/clock.js Normal file
View File

@ -0,0 +1,54 @@
document.addEventListener("DOMContentLoaded", function(event) {
updateClock();
setInterval(updateClock, 1000);
});
function getNextOpen(now) {
var days = [[0, 14], [4, 18], [8, 22], [12], [2, 16], [6, 20], [10]]
var nowday = now.getUTCDay();
var nour = now.getUTCHours();
var open_hour = -1;
var d = 0;
while (open_hour == -1) {
var times = days[(nowday + d) % 7];
for (var i = 0; i < times.length; ++i) {
var time = times[i];
if (time == nour) {
return "refresh";
} else if (time > nour || d > 0) {
open_hour = time;
break;
}
}
if (open_hour == -1) {
d += 1;
nour = -1;
}
}
var open = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + d));
var ts = open.setUTCHours(open_hour);
return open;
}
function updateClock() {
var clock = document.querySelector(".closed-registrations-message .clock");
var now = new Date();
var open = getNextOpen(now);
if (open == "refresh") {
location.reload();
return;
}
var until = open - now;
var ms = until % 1000;
var s = Math.floor((until / 1000)) % 60;
var m = Math.floor((until / 1000 / 60)) % 60;
var h = Math.floor((until / 1000 / 60 / 60));
if (m < 10) m = "0" + m;
if (s < 10) s = "0" + s;
clock.innerHTML = h + ":" + m + ":" + s;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 KiB

BIN
public/riot-glitch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB