Compare commits

...

31 Commits
main ... main

Author SHA1 Message Date
Thor 22e9559aa2 Merge remote-tracking branch 'upstream/main' into main 1 year ago
Thor 8be9ee756a Merge remote-tracking branch 'upstream/main' into main 2 years ago
Thor b4853ea584 Merge remote-tracking branch 'upstream/main' into main 2 years ago
root ecc8e19071 Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Thor f196a3d4d9 Merge remote-tracking branch 'upstream/main' into main 2 years ago
Thor d8da65025d Correct strings file for new automated status deletion thresholds 2 years ago
Thor 0d2e4b6294 Weeded out another locally modified strings file 2 years ago
Thor 244a5e21ea Merge branch 'dev' into main 2 years ago
Thor 22f653c17b Merge branch 'main' of https://github.com/glitch-soc/mastodon into dev 2 years ago
Thor 36e533eaab Merge branch 'main' of https://github.com/glitch-soc/mastodon into dev 2 years ago
Thor eb8fa57261 Add more automated post deletion age thresholds 2 years ago
Thor affab99b47 Revert to upstream translations (keep on local branch instead) 2 years ago
Thor 6b0dc8407e Enable edit support 2 years ago
Thor 7f3114e4cb Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Thor 74bb52bd7e Fix sticker alignment bug 2 years ago
Thor 6a50920252 Remove margin on emojis in detailed statuses 2 years ago
Thor 7a325063af Fix big emoji sizes for detailed statuses 2 years ago
Thor e9272004de Revert more vanilla features to upstream 2 years ago
Thor 2271f10292 Revert vanilla components.scss to upstream 2 years ago
Thor 96c9b527f6 Revert vanilla compose.js to upstream 2 years ago
Thor ca90a99560 Revert redundant vanilla patches to upstream 2 years ago
Thor 775e4c4be9 Add sticker support 2 years ago
Thor ad6397f1bb Bigger emojis 2 years ago
Thor 89a476f0bc Remove duplicate JS code for media gallery 2 years ago
Thor bc8d4d0c78 Merge branch 'main' of github.com:berserker-town/glitch-soc into main 2 years ago
Thor e998b1e630 Increase media attachment limit to 20 2 years ago
Thor c4bb82b49e Add support for 20 media attachments 2 years ago
Thor 655573f9c5 Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Thor d4219bd203 HiDPI image patch 2 years ago
Thor f487fe0951 Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Mastodon 65e9b5c2e6 Rename the local timeline to the Tavern 2 years ago
  1. 4
      app/javascript/flavours/glitch/actions/compose.js
  2. 57
      app/javascript/flavours/glitch/components/media_gallery.js
  3. 2
      app/javascript/flavours/glitch/features/compose/containers/options_container.js
  4. 2
      app/javascript/flavours/glitch/features/ui/index.js
  5. 19
      app/javascript/flavours/glitch/styles/components/status.scss
  6. 3
      app/javascript/flavours/glitch/utils/resize_image.js
  7. 4
      app/lib/activitypub/activity/create.rb
  8. 4
      app/models/account_statuses_cleanup_policy.rb
  9. 8
      app/models/media_attachment.rb
  10. 2
      app/services/activitypub/process_status_update_service.rb
  11. 4
      app/services/post_status_service.rb
  12. 4
      app/services/update_status_service.rb
  13. 5
      config/locales/en.yml

@ -274,7 +274,7 @@ export function doodleSet(options) {
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = 4;
const uploadLimit = 20;
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
const progress = new Array(files.length).fill(0);
@ -293,7 +293,7 @@ export function uploadCompose(files) {
dispatch(uploadComposeRequest());
for (const [i, f] of Array.from(files).entries()) {
if (media.size + i > 3) break;
if (media.size + i > 19) break;
resizeImage(f).then(file => {
const data = new FormData();

@ -101,52 +101,45 @@ class Item extends React.PureComponent {
render () {
const { attachment, index, size, standalone, letterbox, displayWidth, visible } = this.props;
let width = 50;
let width = 100;
let height = 100;
let top = 'auto';
let left = 'auto';
let bottom = 'auto';
let right = 'auto';
if (size === 1) {
width = 100;
}
let root = Math.sqrt(size);
let numCols = Math.ceil(root);
let numRows = Math.ceil(size / numCols);
if (size === 4 || (size === 3 && index > 0)) {
height = 50;
let col = index % numCols;
let row = Math.floor(index / numCols);
if(row === numRows - 1) {
width = 100 / (1 + ((size - 1) % numCols));
} else {
width = 100 / numCols;
}
if (size === 2) {
if (index === 0) {
height = 100 / numRows;
if(numCols > 1) {
if(col === 0) {
right = '2px';
} else if(col === numCols - 1) {
left = '2px';;
} else {
left = '2px';
}
} else if (size === 3) {
if (index === 0) {
right = '2px';
} else if (index > 0) {
left = '2px';
}
}
if (index === 1) {
if(numRows > 1) {
if(row === 0) {
bottom = '2px';
} else if (index > 1) {
} else if(row === numRows - 1) {
top = '2px';
}
} else if (size === 4) {
if (index === 0 || index === 2) {
right = '2px';
}
if (index === 1 || index === 3) {
left = '2px';
}
if (index < 2) {
bottom = '2px';
} else {
top = '2px';
bottom = '2px';
}
}
@ -154,7 +147,7 @@ class Item extends React.PureComponent {
if (attachment.get('type') === 'unknown') {
return (
<div className={classNames('media-gallery__item', { standalone })} key={attachment.get('id')} style={{ left: left, top: top, right: right, bottom: bottom, width: `${width}%`, height: `${height}%` }}>
<div className={classNames('media-gallery__item', { standalone })} key={attachment.get('id')} style={{ 'padding-left': left, 'padding-top': top, 'padding-right': right, 'padding-bottom': bottom, width: `${width}%`, height: `${height}%` }}>
<a className='media-gallery__item-thumbnail' href={attachment.get('remote_url') || attachment.get('url')} style={{ cursor: 'pointer' }} title={attachment.get('description')} target='_blank' rel='noopener noreferrer'>
<Blurhash
hash={attachment.get('blurhash')}
@ -226,7 +219,7 @@ class Item extends React.PureComponent {
}
return (
<div className={classNames('media-gallery__item', { standalone, letterbox })} key={attachment.get('id')} style={{ left: left, top: top, right: right, bottom: bottom, width: `${width}%`, height: `${height}%` }}>
<div className={classNames('media-gallery__item', { standalone, letterbox })} key={attachment.get('id')} style={{ 'padding-left': left, 'padding-top': top, 'padding-right': right, 'padding-bottom': bottom, width: `${width}%`, height: `${height}%` }}>
<Blurhash
hash={attachment.get('blurhash')}
dummy={!useBlurhash}
@ -344,7 +337,7 @@ class MediaGallery extends React.PureComponent {
render () {
const { media, intl, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props;
const { visible } = this.state;
const size = media.take(4).size;
const size = media.take(20).size; // Attachment limit patch
const uncached = media.every(attachment => attachment.get('type') === 'unknown');
const width = this.state.width || defaultWidth;
@ -366,7 +359,7 @@ class MediaGallery extends React.PureComponent {
if (this.isStandaloneEligible()) {
children = <Item standalone autoplay={autoplay} onClick={this.handleClick} attachment={media.get(0)} displayWidth={width} visible={visible} />;
} else {
children = media.take(4).map((attachment, i) => <Item key={attachment.get('id')} autoplay={autoplay} onClick={this.handleClick} attachment={attachment} index={i} size={size} letterbox={letterbox} displayWidth={width} visible={visible || uncached} />);
children = media.take(20).map((attachment, i) => <Item key={attachment.get('id')} autoplay={autoplay} onClick={this.handleClick} attachment={attachment} index={i} size={size} letterbox={letterbox} displayWidth={width} visible={visible || uncached} />); // Attachment limit patch
}
if (uncached) {

@ -17,7 +17,7 @@ function mapStateToProps (state) {
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']).toArray().join(','),
resetFileKey: state.getIn(['compose', 'resetFileKey']),
hasPoll: !!poll,
allowMedia: !poll && (media ? media.size + pending_media < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 4),
allowMedia: !poll && (media ? media.size + pending_media < 20 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 20),
hasMedia: media && !!media.size,
allowPoll: !(media && !!media.size),
showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),

@ -74,7 +74,7 @@ const mapStateToProps = state => ({
layout: state.getIn(['meta', 'layout']),
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 20,
layout: state.getIn(['meta', 'layout']),
layout_local_setting: state.getIn(['local_settings', 'layout']),
isWide: state.getIn(['local_settings', 'stretch']),

@ -62,9 +62,16 @@
}
.emojione {
width: 20px;
height: 20px;
margin: -3px 0 0;
width: 32px;
height: 32px;
margin: 0;
}
img.emojione[alt^=":sticker_"] {
width: 128px;
height: 128px;
display: block;
margin: 0 auto;
}
p, pre, blockquote {
@ -621,9 +628,9 @@
line-height: 24px;
.emojione {
width: 24px;
height: 24px;
margin: -1px 0 0;
width: 32px;
height: 32px;
margin: 0;
}
}

@ -1,6 +1,7 @@
import EXIF from 'exif-js';
const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
//const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
const MAX_IMAGE_PIXELS = 8294400; // 3840x2160px (HiDPI patch)
const _browser_quirks = {};

@ -124,7 +124,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
visibility: @status_parser.visibility,
thread: replied_to_status,
conversation: conversation_from_uri(@object['conversation']),
media_attachment_ids: process_attachments.take(4).map(&:id),
media_attachment_ids: process_attachments.take(20).map(&:id),
poll: process_poll,
}
end
@ -257,7 +257,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
as_array(@object['attachment']).each do |attachment|
media_attachment_parser = ActivityPub::Parser::MediaAttachmentParser.new(attachment)
next if media_attachment_parser.remote_url.blank? || media_attachments.size >= 4
next if media_attachment_parser.remote_url.blank? || media_attachments.size >= 20
begin
media_attachment = MediaAttachment.create(

@ -23,6 +23,10 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
include Redisable
ALLOWED_MIN_STATUS_AGE = [
1.day.seconds,
2.days.seconds,
3.days.seconds,
5.days.seconds,
1.week.seconds,
2.weeks.seconds,
1.month.seconds,

@ -68,12 +68,14 @@ class MediaAttachment < ApplicationRecord
IMAGE_STYLES = {
original: {
pixels: 2_073_600, # 1920x1080px
# pixels: 2_073_600, # 1920x1080px
pixels: 8_294_400, # 3840x2160px (HiDPI patch)
file_geometry_parser: FastGeometryParser,
}.freeze,
small: {
pixels: 230_400, # 640x360px
# pixels: 230_400, # 640x360px
pixels: 640_000, # 800x800px (HiDPI patch)
file_geometry_parser: FastGeometryParser,
blurhash: BLURHASH_OPTIONS,
}.freeze,
@ -133,7 +135,7 @@ class MediaAttachment < ApplicationRecord
convert_options: {
output: {
'loglevel' => 'fatal',
vf: 'scale=\'min(400\, iw):min(400\, ih)\':force_original_aspect_ratio=decrease',
vf: 'scale=\'min(800\, iw):min(800\, ih)\':force_original_aspect_ratio=decrease',
}.freeze,
}.freeze,
format: 'png',

@ -70,7 +70,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
as_array(@json['attachment']).each do |attachment|
media_attachment_parser = ActivityPub::Parser::MediaAttachmentParser.new(attachment)
next if media_attachment_parser.remote_url.blank? || next_media_attachments.size > 4
next if media_attachment_parser.remote_url.blank? || next_media_attachments.size > 20
begin
media_attachment = previous_media_attachments.find { |previous_media_attachment| previous_media_attachment.remote_url == media_attachment_parser.remote_url }

@ -114,9 +114,9 @@ class PostStatusService < BaseService
return
end
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll].present?
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 20 || @options[:poll].present? # Attachment limit patch
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(20).map(&:to_i)) # Attachment limit patch
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:audio_or_video?)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_ready') if @media.any?(&:not_processed?)

@ -61,9 +61,9 @@ class UpdateStatusService < BaseService
def validate_media!
return [] if @options[:media_ids].blank? || !@options[:media_ids].is_a?(Enumerable)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll].present?
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 20 || @options[:poll].present? # Attachment limit patch
media_attachments = @status.account.media_attachments.where(status_id: [nil, @status.id]).where(scheduled_status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i)).to_a
media_attachments = @status.account.media_attachments.where(status_id: [nil, @status.id]).where(scheduled_status_id: nil).where(id: @options[:media_ids].take(20).map(&:to_i)).to_a # Attachment limit patch
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if media_attachments.size > 1 && media_attachments.find(&:audio_or_video?)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_ready') if media_attachments.any?(&:not_processed?)

@ -1506,6 +1506,11 @@ en:
keep_self_fav: Keep posts you favourited
keep_self_fav_hint: Doesn't delete your own posts if you have favourited them
min_age:
'86400': 1 day
'172800': 2 days
'259200': 3 days
'432000': 5 days
'604800': 1 week
'1209600': 2 weeks
'15778476': 6 months
'2629746': 1 month

Loading…
Cancel
Save