Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[yufushiro] stable-4.3 から m.yufushiro.dev の差分 #1

Draft
wants to merge 15 commits into
base: stable-4.3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
b311591
[yufushiro] 「ソースコードを表示」リンク先のURLを変更
yufushiro Aug 8, 2023
a0c5e1e
[yufushiro] コンテナイメージのビルド用Workflowを設定
yufushiro Aug 8, 2023
b6c04bf
[yufushiro] Linterのworkflowから pull_request event を削除
yufushiro Aug 10, 2023
ab178be
[yufushiro] GitHub Workflow での古いバージョンのRubyによるテストを無効化
yufushiro Dec 13, 2024
8f329ea
[yufushiro] Linterによる指摘箇所を修正
yufushiro Aug 10, 2023
4b23df8
[yufushiro] JPEG形式のカスタム絵文字を受け入れる
yufushiro Aug 9, 2023
de4b0a9
[yufushiro] カスタム絵文字のshortcodeに隣接できる文字種の制限を緩和
yufushiro Aug 10, 2023
80d3d9e
[yufushiro] Sidekiqの定期実行ジョブの実行頻度を下げる
yufushiro Aug 15, 2023
ac57598
[yufushiro] カスタム絵文字のファイルサイズ上限を 1 MiB まで緩和
yufushiro Aug 21, 2023
aca3131
[yufushiro] 複数枚の画像が添付された場合は先頭の画像のみをTwitter Cardに使用する
yufushiro Aug 24, 2023
0a822a9
[yufushiro] 恒久的でないアカウント凍結にDelete activityを使用する実装に対する回避策
yufushiro Oct 30, 2023
1838cad
[yufushiro] プロフィール画像のファイルサイズ上限を 4 MiB まで緩和
yufushiro Feb 20, 2024
be877e5
[yufushiro] 固定された投稿の表示件数を3件までとする
yufushiro Feb 23, 2024
94a17f8
[yufushiro] theme_colorを変更
yufushiro Mar 29, 2024
ed73ff0
[yufushiro] 埋め込みカードの `.expanded` を常に無効化する
yufushiro Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/build-push-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ jobs:
runs-on: ubuntu-latest
# This is only allowed to run if:
# - the PR branch is in the `mastodon/mastodon` repository
# - the PR is not a draft
# - the PR has the "build-image" label
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'build-image') }}
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'build-image') }}
steps:
# Repository needs to be cloned so `git rev-parse` below works
- name: Clone repository
Expand All @@ -32,10 +31,10 @@ jobs:
uses: ./.github/workflows/build-container-image.yml
with:
file_to_build: Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
use_native_arm64_builder: true
push_to_images: |
ghcr.io/mastodon/mastodon
ghcr.io/yufushiro/mastodon
version_metadata: ${{ needs.compute-suffix.outputs.metadata }}
flavor: |
latest=auto
Expand All @@ -49,10 +48,10 @@ jobs:
uses: ./.github/workflows/build-container-image.yml
with:
file_to_build: streaming/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
use_native_arm64_builder: true
push_to_images: |
ghcr.io/mastodon/mastodon-streaming
ghcr.io/yufushiro/mastodon-streaming
version_metadata: ${{ needs.compute-suffix.outputs.metadata }}
flavor: |
latest=auto
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/check-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ name: Check i18n

on:
push:
branches:
- 'main'
- 'stable-*'
pull_request:
branches:
- 'main'
- 'stable-*'
branches: [yufushiro]

env:
RAILS_ENV: test
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ name: 'CodeQL'
on:
merge_group:
push:
branches:
- 'main'
- 'stable-*'
pull_request:
branches:
- 'main'
- 'stable-*'
schedule:
- cron: '22 6 * * 1'
branches: ['yufushiro']

jobs:
analyze:
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/lint-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ on:
- '.github/workflows/lint-css.yml'
- '.github/stylelint-matcher.json'

pull_request:
paths:
- 'package.json'
- 'yarn.lock'
- '.nvmrc'
- '.prettier*'
- 'stylelint.config.js'
- '**/*.css'
- '**/*.scss'
- '.github/workflows/lint-css.yml'
- '.github/stylelint-matcher.json'

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ on:
- '**/*.tsx'
- '.github/workflows/lint-js.yml'

pull_request:
paths:
- 'package.json'
- 'yarn.lock'
- 'tsconfig.json'
- '.nvmrc'
- '.prettier*'
- '.eslint*'
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
- '.github/workflows/lint-js.yml'

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/lint-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ on:
- '**/*.rake'
- '.github/workflows/lint-ruby.yml'

pull_request:
paths:
- 'Gemfile*'
- '.rubocop*.yml'
- '.ruby-version'
- 'config/brakeman.ignore'
- '**/*.rb'
- '**/*.rake'
- '.github/workflows/lint-ruby.yml'

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Ruby Testing
on:
merge_group:
push:
branches:
- 'main'
- 'stable-*'
pull_request:
branches: [yufushiro]

env:
BUNDLE_CLEAN: true
Expand Down Expand Up @@ -124,8 +121,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '3.1'
- '3.2'
- '.ruby-version'
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -226,8 +221,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '3.1'
- '3.2'
- '.ruby-version'
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -305,8 +298,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '3.1'
- '3.2'
- '.ruby-version'

steps:
Expand Down Expand Up @@ -422,8 +413,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '3.1'
- '3.2'
- '.ruby-version'
search-image:
- docker.elastic.co/elasticsearch/elasticsearch:7.17.13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = fa
remoteUrl: state.getIn(['accounts', accountId, 'url']),
isAccount: !!state.getIn(['accounts', accountId]),
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], emptyList),
featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned${tagged ? `:${tagged}` : ''}`, 'items'], emptyList),
featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned${tagged ? `:${tagged}` : ''}`, 'items'], emptyList).take(3),
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']),
hasMore: state.getIn(['timelines', `account:${path}`, 'hasMore']),
suspended: state.getIn(['accounts', accountId, 'suspended'], false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class Card extends PureComponent {
const provider = card.get('provider_name').length === 0 ? decodeIDNA(getHostname(card.get('url'))) : card.get('provider_name');
const interactive = card.get('type') === 'video';
const language = card.get('language') || '';
const largeImage = (card.get('image')?.length > 0 && card.get('width') > card.get('height')) || interactive;
const largeImage = false;
const showAuthor = !!card.getIn(['authors', 0, 'accountId']);

const description = (
Expand Down
10 changes: 7 additions & 3 deletions app/lib/activitypub/activity/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ def perform
private

def delete_person
with_redis_lock("delete_in_progress:#{@account.id}", autorelease: 2.hours, raise_on_failure: false) do
DeleteAccountService.new.call(@account, reserve_username: false, skip_activitypub: true)
end
# Workaround for some implementations (such as Misskey) that send Delete activity for non-permanent account suspension.
@account.silence!
AccountModerationNote.create!(
account: Account.local.find_by!(username: 'yufushiro'),
target_account: @account,
content: 'Delete activity has been received.'
)
end

def delete_note
Expand Down
15 changes: 15 additions & 0 deletions app/lib/activitypub/activity/undo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def perform
undo_like
when 'Block'
undo_block
when 'Delete'
undo_delete
when nil
handle_reference
end
Expand Down Expand Up @@ -125,6 +127,19 @@ def undo_block
end
end

def undo_delete
target_account = account_from_uri(target_uri)

return if target_account.nil?

target_account.unsilence!
AccountModerationNote.create!(
account: Account.local.find_by!(username: 'yufushiro'),
target_account: target_account,
content: 'Undo Delete activity has been received.'
)
end

def target_uri
@target_uri ||= value_or_id(@object['object'])
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/account/avatar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Account::Avatar
extend ActiveSupport::Concern

IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
LIMIT = 2.megabytes
LIMIT = 4.megabytes

AVATAR_DIMENSIONS = [400, 400].freeze
AVATAR_GEOMETRY = [AVATAR_DIMENSIONS.first, AVATAR_DIMENSIONS.last].join('x')
Expand Down
19 changes: 14 additions & 5 deletions app/models/custom_emoji.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,32 @@
class CustomEmoji < ApplicationRecord
include Attachmentable

LIMIT = 256.kilobytes
LIMIT = 1.megabyte
MINIMUM_SHORTCODE_SIZE = 2

SHORTCODE_RE_FRAGMENT = '[a-zA-Z0-9_]{2,}'

SCAN_RE = /(?<=[^[:alnum:]:]|\n|^)
SCAN_RE = /(?<=[^a-zA-Z0-9]|\n|^)
:(#{SHORTCODE_RE_FRAGMENT}):
(?=[^[:alnum:]:]|$)/x
(?=[^a-zA-Z0-9]|$)/x
SHORTCODE_ONLY_RE = /\A#{SHORTCODE_RE_FRAGMENT}\z/

IMAGE_MIME_TYPES = %w(image/png image/gif image/webp).freeze
IMAGE_MIME_TYPES = %w(image/jpeg image/png image/gif image/webp).freeze

belongs_to :category, class_name: 'CustomEmojiCategory', optional: true

has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode, inverse_of: false, dependent: nil

has_attached_file :image, styles: { static: { format: 'png', convert_options: '-coalesce +profile "!icc,*" +set date:modify +set date:create +set date:timestamp', file_geometry_parser: FastGeometryParser } }, validate_media_type: false, processors: [:lazy_thumbnail]
has_attached_file :image,
styles: {
static: {
format: 'png',
convert_options: '-coalesce +profile "!icc,*" +set date:modify +set date:create +set date:timestamp',
file_geometry_parser: FastGeometryParser,
},
},
validate_media_type: false,
processors: [:lazy_thumbnail]

normalizes :domain, with: ->(domain) { domain.downcase }

Expand Down
1 change: 1 addition & 0 deletions app/serializers/node_info/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def metadata
{
nodeName: Setting.site_title,
nodeDescription: Setting.site_short_description,
themeColor: '#99ddff',
}
end

Expand Down
6 changes: 5 additions & 1 deletion app/views/statuses/_og_image.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
- if activity.is_a?(Status) && (activity.non_sensitive_with_media? || (activity.with_media? && Setting.preview_sensitive_media))
- player_card = false
- activity.ordered_media_attachments.each do |media|
- activity.ordered_media_attachments.each_with_index do |media, index|
- if media.image?
= opengraph 'og:image', full_asset_url(media.file.url(:original))
= opengraph 'og:image:type', media.file_content_type
- if index.zero?
= opengraph 'twitter:image', full_asset_url(media.file.url(:original))
- unless media.file.meta.nil?
= opengraph 'og:image:width', media.file.meta.dig('original', 'width')
= opengraph 'og:image:height', media.file.meta.dig('original', 'height')
- if media.description.present?
= opengraph 'og:image:alt', media.description
- if index.zero?
= opengraph 'twitter:image:alt', media.description
- elsif media.video? || media.gifv?
- player_card = true
= opengraph 'og:image', full_asset_url(media.file.url(:small))
Expand Down
16 changes: 8 additions & 8 deletions config/sidekiq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
:listened_queues_only: true
:schedule:
scheduled_statuses_scheduler:
every: '5m'
interval: '12h'
class: Scheduler::ScheduledStatusesScheduler
queue: scheduler
trends_refresh_scheduler:
every: '5m'
interval: '12h'
class: Scheduler::Trends::RefreshScheduler
queue: scheduler
trends_review_notifications_scheduler:
every: '6h'
interval: '12h'
class: Scheduler::Trends::ReviewNotificationsScheduler
queue: scheduler
indexing_scheduler:
interval: 1 minute
interval: '12h'
class: Scheduler::IndexingScheduler
queue: scheduler
vacuum_scheduler:
Expand All @@ -48,19 +48,19 @@
class: Scheduler::PgheroScheduler
queue: scheduler
instance_refresh_scheduler:
cron: '0 * * * *'
interval: '12h'
class: Scheduler::InstanceRefreshScheduler
queue: scheduler
accounts_statuses_cleanup_scheduler:
interval: 1 minute
interval: '12h'
class: Scheduler::AccountsStatusesCleanupScheduler
queue: scheduler
suspended_user_cleanup_scheduler:
interval: 1 minute
interval: '12h'
class: Scheduler::SuspendedUserCleanupScheduler
queue: scheduler
software_update_check_scheduler:
interval: 30 minutes
interval: '12h'
class: Scheduler::SoftwareUpdateCheckScheduler
queue: scheduler
auto_close_registrations_scheduler:
Expand Down
11 changes: 4 additions & 7 deletions lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def prerelease
end

def build_metadata
ENV.fetch('MASTODON_VERSION_METADATA', nil)
'yufushiro'
end

def to_a
Expand All @@ -50,7 +50,7 @@ def api_versions
end

def repository
ENV.fetch('GITHUB_REPOSITORY', 'mastodon/mastodon')
ENV.fetch('GITHUB_REPOSITORY', 'yufushiro/mastodon')
end

def source_base_url
Expand All @@ -63,11 +63,8 @@ def source_tag
end

def source_url
if source_tag
"#{source_base_url}/tree/#{source_tag}"
else
source_base_url
end
# Pull Request #1 の URL を返す
"#{source_base_url}/pull/1"
end

def user_agent
Expand Down
Loading
Loading