diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/base_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/auth/sessions_controller.rb | 15 | ||||
-rw-r--r-- | app/controllers/oauth/authorizations_controller.rb | 14 | ||||
-rw-r--r-- | app/helpers/settings_helper.rb | 1 | ||||
-rw-r--r-- | app/javascript/mastodon/locales/ru.json | 8 | ||||
-rw-r--r-- | app/javascript/styles/mastodon/accessibility.scss | 2 | ||||
-rw-r--r-- | app/javascript/styles/mastodon/components.scss | 4 | ||||
-rw-r--r-- | app/javascript/styles/mastodon/reset.scss | 5 | ||||
-rw-r--r-- | app/services/fetch_link_card_service.rb | 18 | ||||
-rw-r--r-- | app/services/fetch_oembed_service.rb | 2 | ||||
-rw-r--r-- | app/views/accounts/_header.html.haml | 5 | ||||
-rw-r--r-- | app/views/layouts/modal.html.haml | 2 |
13 files changed, 62 insertions, 22 deletions
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index 0b3735087..90f42251e 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -53,10 +53,6 @@ class Api::BaseController < ApplicationController [params[:limit].to_i.abs, default_limit * 2].min end - def truthy_param?(key) - ActiveModel::Type::Boolean.new.cast(params[key]) - end - def current_resource_owner @current_user ||= User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8ffc31bb4..dca6c5a5a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -128,6 +128,10 @@ class ApplicationController < ActionController::Base protected + def truthy_param?(key) + ActiveModel::Type::Boolean.new.cast(params[key]) + end + def forbidden respond_with_error(403) end diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 7cd46662f..f4401b3dd 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -11,6 +11,7 @@ class Auth::SessionsController < Devise::SessionsController prepend_before_action :set_pack before_action :set_instance_presenter, only: [:new] before_action :set_body_classes + after_action :clear_site_data, only: [:destroy] def new Devise.omniauth_configs.each do |provider, config| @@ -28,8 +29,10 @@ class Auth::SessionsController < Devise::SessionsController end def destroy + tmp_stored_location = stored_location_for(:user) super flash.delete(:notice) + store_location_for(:user, tmp_stored_location) if continue_after? end protected @@ -126,4 +129,16 @@ class Auth::SessionsController < Devise::SessionsController end paths end + + def clear_site_data + return if continue_after? + + # Should be '"*"' but that doen't work in Chrome (neither does '"executionContexts"') + # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data + response.headers['Clear-Site-Data'] = '"cache", "cookies"' + end + + def continue_after? + truthy_param?(:continue) + end end diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index eb977510b..f6f5d1ecc 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -18,4 +18,18 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController def set_pack use_pack 'auth' end + + def render_success + if skip_authorization? || (matching_token? && !truthy_param?('force_login')) + redirect_or_render authorize_response + elsif Doorkeeper.configuration.api_only + render json: pre_auth + else + render :new + end + end + + def truthy_param?(key) + ActiveModel::Type::Boolean.new.cast(params[key]) + end end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index fc03fcf82..ed873ceed 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -8,6 +8,7 @@ module SettingsHelper bg: 'Български', ca: 'Català', co: 'Corsu', + cs: 'Čeština', cy: 'Cymraeg', da: 'Dansk', de: 'Deutsch', diff --git a/app/javascript/mastodon/locales/ru.json b/app/javascript/mastodon/locales/ru.json index 83cbb5240..7499f03ea 100644 --- a/app/javascript/mastodon/locales/ru.json +++ b/app/javascript/mastodon/locales/ru.json @@ -63,7 +63,7 @@ "column_header.show_settings": "Показать настройки", "column_header.unpin": "Открепить", "column_subheading.settings": "Настройки", - "community.column_settings.media_only": "Только медиа", + "community.column_settings.media_only": "Только с медиа", "compose_form.direct_message_warning": "Этот статус будет виден только упомянутым пользователям.", "compose_form.direct_message_warning_learn_more": "Узнать больше", "compose_form.hashtag_warning": "Этот пост не будет показывается в поиске по хэштегу, т.к. он непубличный. Только публичные посты можно найти в поиске по хэштегу.", @@ -76,7 +76,7 @@ "compose_form.sensitive.unmarked": "Медиафайлы не отмечены как чувствительные", "compose_form.spoiler.marked": "Текст скрыт за предупреждением", "compose_form.spoiler.unmarked": "Текст не скрыт", - "compose_form.spoiler_placeholder": "Напишите свое предупреждение здесь", + "compose_form.spoiler_placeholder": "Текст предупреждения", "confirmation_modal.cancel": "Отмена", "confirmations.block.confirm": "Заблокировать", "confirmations.block.message": "Вы уверены, что хотите заблокировать {name}?", @@ -290,7 +290,7 @@ "status.mention": "Упомянуть @{name}", "status.more": "Больше", "status.mute": "Заглушить @{name}", - "status.mute_conversation": "Заглушить тред", + "status.mute_conversation": "Заглушить всю цепочку", "status.open": "Развернуть статус", "status.pin": "Закрепить в профиле", "status.pinned": "Закреплённый статус", @@ -300,7 +300,7 @@ "status.reblogs.empty": "Никто ещё не продвинул этот статус. Как только кто-то это сделает, они появятся здесь.", "status.redraft": "Удалить и исправить", "status.reply": "Ответить", - "status.replyAll": "Ответить на тред", + "status.replyAll": "Ответить всем", "status.report": "Пожаловаться", "status.sensitive_toggle": "Нажмите для просмотра", "status.sensitive_warning": "Чувствительный контент", diff --git a/app/javascript/styles/mastodon/accessibility.scss b/app/javascript/styles/mastodon/accessibility.scss index 373bcd4ac..d33806c84 100644 --- a/app/javascript/styles/mastodon/accessibility.scss +++ b/app/javascript/styles/mastodon/accessibility.scss @@ -1,4 +1,4 @@ -$black-emojis: '8ball' 'ant' 'back' 'black_circle' 'black_large_square' 'black_medium_small_square' 'black_medium_square' 'black_nib' 'black_small_square' 'bomb' 'bust_in_silhouette' 'camera' 'camera_with_flash' 'clubs' 'copyright' 'curly_loop' 'currency_exchange' 'end' 'heavy_check_mark' 'heavy_division_sign' 'heavy_dollar_sign' 'heavy_minus_sign' 'heavy_multiplication_x' 'heavy_plus_sign' 'lower_left_fountain_pen' 'on' 'registered' 'soon' 'spades' 'spider' 'tm' 'top' 'waving_black_flag' 'wavy_dash' 'video_game'; +$black-emojis: '8ball' 'ant' 'back' 'black_circle' 'black_heart' 'black_large_square' 'black_medium_small_square' 'black_medium_square' 'black_nib' 'black_small_square' 'bomb' 'bowling' 'bust_in_silhouette' 'busts_in_silhouette' 'camera' 'camera_with_flash' 'clubs' 'copyright' 'curly_loop' 'currency_exchange' 'dark_sunglasses' 'eight_pointed_black_star' 'electric_plug' 'end' 'female-guard' 'film_projector' 'fried_egg' 'gorilla' 'guardsman' 'heavy_check_mark' 'heavy_division_sign' 'heavy_dollar_sign' 'heavy_minus_sign' 'heavy_multiplication_x' 'heavy_plus_sign' 'hocho' 'hole' 'joystick' 'kaaba' 'lower_left_ballpoint_pen' 'lower_left_fountain_pen' 'male-guard' 'microphone' 'mortar_board' 'movie_camera' 'musical_score' 'on' 'registered' 'soon' 'spades' 'speaking_head_in_silhouette' 'spider' 'telephone_receiver' 'tm' 'top' 'tophat' 'turkey' 'vhs' 'video_camera' 'video_game' 'water_buffalo' 'waving_black_flag' 'wavy_dash'; %white-emoji-outline { filter: drop-shadow(1px 1px 0 $white) drop-shadow(-1px 1px 0 $white) drop-shadow(1px -1px 0 $white) drop-shadow(-1px -1px 0 $white); diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 359b2b6a7..c6b3ed0e2 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -1666,14 +1666,14 @@ a.account__display-name { &.top { bottom: -5px; - margin-left: -13px; + margin-left: -7px; border-width: 5px 7px 0; border-top-color: $ui-secondary-color; } &.bottom { top: -5px; - margin-left: -13px; + margin-left: -7px; border-width: 0 7px 5px; border-bottom-color: $ui-secondary-color; } diff --git a/app/javascript/styles/mastodon/reset.scss b/app/javascript/styles/mastodon/reset.scss index ff3b2c022..a140e8bc7 100644 --- a/app/javascript/styles/mastodon/reset.scss +++ b/app/javascript/styles/mastodon/reset.scss @@ -53,6 +53,11 @@ table { border-spacing: 0; } +html { + scrollbar-face-color: lighten($ui-base-color, 4%); + scrollbar-track-color: rgba($base-overlay-background, 0.1); +} + ::-webkit-scrollbar { width: 12px; height: 12px; diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index 560a81768..ea94e2491 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -87,34 +87,36 @@ class FetchLinkCardService < BaseService end def attempt_oembed - embed = FetchOEmbedService.new.call(@url, html: @html) + service = FetchOEmbedService.new + embed = service.call(@url, html: @html) + url = Addressable::URI.parse(service.endpoint_url) return false if embed.nil? @card.type = embed[:type] @card.title = embed[:title] || '' @card.author_name = embed[:author_name] || '' - @card.author_url = embed[:author_url] || '' + @card.author_url = embed[:author_url].present? ? (url + embed[:author_url]).to_s : '' @card.provider_name = embed[:provider_name] || '' - @card.provider_url = embed[:provider_url] || '' + @card.provider_url = embed[:provider_url].present? ? (url + embed[:provider_url]).to_s : '' @card.width = 0 @card.height = 0 case @card.type when 'link' - @card.image_remote_url = embed[:thumbnail_url] if embed[:thumbnail_url].present? + @card.image_remote_url = (url + embed[:thumbnail_url]).to_s if embed[:thumbnail_url].present? when 'photo' return false if embed[:url].blank? - @card.embed_url = embed[:url] - @card.image_remote_url = embed[:url] + @card.embed_url = (url + embed[:url]).to_s + @card.image_remote_url = (url + embed[:url]).to_s @card.width = embed[:width].presence || 0 @card.height = embed[:height].presence || 0 when 'video' @card.width = embed[:width].presence || 0 @card.height = embed[:height].presence || 0 @card.html = Formatter.instance.sanitize(embed[:html], Sanitize::Config::MASTODON_OEMBED) - @card.image_remote_url = embed[:thumbnail_url] if embed[:thumbnail_url].present? + @card.image_remote_url = (url + embed[:thumbnail_url]).to_s if embed[:thumbnail_url].present? when 'rich' # Most providers rely on <script> tags, which is a no-no return false @@ -146,7 +148,7 @@ class FetchLinkCardService < BaseService @card.title = meta_property(page, 'og:title').presence || page.at_xpath('//title')&.content || '' @card.description = meta_property(page, 'og:description').presence || meta_property(page, 'description') || '' - @card.image_remote_url = meta_property(page, 'og:image') if meta_property(page, 'og:image') + @card.image_remote_url = (Addressable::URI.parse(@url) + meta_property(page, 'og:image')).to_s if meta_property(page, 'og:image') return if @card.title.blank? && @card.html.blank? diff --git a/app/services/fetch_oembed_service.rb b/app/services/fetch_oembed_service.rb index 998228517..9ddf9b13b 100644 --- a/app/services/fetch_oembed_service.rb +++ b/app/services/fetch_oembed_service.rb @@ -31,7 +31,7 @@ class FetchOEmbedService return if @endpoint_url.blank? - @endpoint_url = Addressable::URI.parse(@endpoint_url).to_s + @endpoint_url = (Addressable::URI.parse(@url) + @endpoint_url).to_s rescue Addressable::URI::InvalidURIError @endpoint_url = nil end diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml index 95e55a1b0..bfad49b6c 100644 --- a/app/views/accounts/_header.html.haml +++ b/app/views/accounts/_header.html.haml @@ -3,7 +3,10 @@ = image_tag account.header.url, class: 'parallax' .public-account-header__bar = link_to short_account_url(account), class: 'avatar' do - = image_tag account.avatar.url + - if current_account&.user&.setting_auto_play_gif + = image_tag account.avatar_original_url + - else + = image_tag account.avatar_static_url .public-account-header__tabs .public-account-header__tabs__name %h1 diff --git a/app/views/layouts/modal.html.haml b/app/views/layouts/modal.html.haml index a86b4fd3f..b6e33ca91 100644 --- a/app/views/layouts/modal.html.haml +++ b/app/views/layouts/modal.html.haml @@ -5,7 +5,7 @@ .name = t 'users.signed_in_as' %span.username @#{current_account.local_username_and_domain} - = link_to destroy_user_session_path, method: :delete, class: 'logout-link icon-button' do + = link_to destroy_user_session_path(continue: true), method: :delete, class: 'logout-link icon-button' do = fa_icon 'sign-out' .container-alt= yield |