Change public accounts pages to mount the web UI (#19319)

* Change public accounts pages to mount the web UI

* Fix handling of remote usernames in routes

- When logged in, serve web app
- When logged out, redirect to permalink
- Fix `app-body` class not being set sometimes due to name conflict

* Fix missing `multiColumn` prop

* Fix failing test

* Use `discoverable` attribute to control indexing directives

* Fix `<ColumnLoading />` not using `multiColumn`

* Add `noindex` to accounts in REST API

* Change noindex directive to not be rendered by default before a route is mounted

* Add loading indicator for detailed status in web UI

* Fix missing indicator appearing while account is loading in web UI
This commit is contained in:
Eugen Rochko 2022-10-20 14:35:29 +02:00 committed by GitHub
parent b0e3f0312c
commit 839f893168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 393 additions and 2468 deletions

View file

@ -2,47 +2,26 @@
en:
about:
about_mastodon_html: 'The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!'
api: API
apps: Mobile apps
contact_missing: Not set
contact_unavailable: N/A
documentation: Documentation
hosted_on: Mastodon hosted on %{domain}
privacy_policy: Privacy Policy
source_code: Source code
title: About
what_is_mastodon: What is Mastodon?
accounts:
choices_html: "%{name}'s choices:"
endorsements_hint: You can endorse people you follow from the web interface, and they will show up here.
featured_tags_hint: You can feature specific hashtags that will be displayed here.
follow: Follow
followers:
one: Follower
other: Followers
following: Following
instance_actor_flash: This account is a virtual actor used to represent the server itself and not any individual user. It is used for federation purposes and should not be suspended.
joined: Joined %{date}
last_active: last active
link_verified_on: Ownership of this link was checked on %{date}
media: Media
moved_html: "%{name} has moved to %{new_profile_link}:"
network_hidden: This information is not available
nothing_here: There is nothing here!
people_followed_by: People whom %{name} follows
people_who_follow: People who follow %{name}
pin_errors:
following: You must be already following the person you want to endorse
posts:
one: Post
other: Posts
posts_tab_heading: Posts
posts_with_replies: Posts and replies
roles:
bot: Bot
group: Group
unavailable: Profile unavailable
unfollow: Unfollow
admin:
account_actions:
action: Perform action
@ -1176,9 +1155,6 @@ en:
hint: This filter applies to select individual posts regardless of other criteria. You can add more posts to this filter from the web interface.
title: Filtered posts
footer:
developers: Developers
more: More…
resources: Resources
trending_now: Trending now
generic:
all: All
@ -1221,7 +1197,6 @@ en:
following: Following list
muting: Muting list
upload: Upload
in_memoriam_html: In Memoriam.
invites:
delete: Deactivate
expired: Expired
@ -1402,22 +1377,7 @@ en:
remove_selected_follows: Unfollow selected users
status: Account status
remote_follow:
acct: Enter your username@domain you want to act from
missing_resource: Could not find the required redirect URL for your account
no_account_html: Don't have an account? You can <a href='%{sign_up_path}' target='_blank'>sign up here</a>
proceed: Proceed to follow
prompt: 'You are going to follow:'
reason_html: "<strong>Why is this step necessary?</strong> <code>%{instance}</code> might not be the server where you are registered, so we need to redirect you to your home server first."
remote_interaction:
favourite:
proceed: Proceed to favourite
prompt: 'You want to favourite this post:'
reblog:
proceed: Proceed to boost
prompt: 'You want to boost this post:'
reply:
proceed: Proceed to reply
prompt: 'You want to reply to this post:'
reports:
errors:
invalid_rules: does not reference valid rules

View file

@ -3,6 +3,31 @@
require 'sidekiq_unique_jobs/web'
require 'sidekiq-scheduler/web'
# Paths of routes on the web app that to not require to be indexed or
# have alternative format representations requiring separate controllers
WEB_APP_PATHS = %w(
/getting-started
/keyboard-shortcuts
/home
/public
/public/local
/conversations
/lists/(*any)
/notifications
/favourites
/bookmarks
/pinned
/start
/directory
/explore/(*any)
/search
/publish
/follow_requests
/blocks
/domain_blocks
/mutes
).freeze
Rails.application.routes.draw do
root 'home#index'
@ -59,9 +84,6 @@ Rails.application.routes.draw do
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
resources :accounts, path: 'users', only: [:show], param: :username do
get :remote_follow, to: 'remote_follow#new'
post :remote_follow, to: 'remote_follow#create'
resources :statuses, only: [:show] do
member do
get :activity
@ -85,16 +107,21 @@ Rails.application.routes.draw do
resource :inbox, only: [:create], module: :activitypub
get '/@:username', to: 'accounts#show', as: :short_account
get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
get '/@:username/media', to: 'accounts#show', as: :short_account_media
get '/@:username/tagged/:tag', to: 'accounts#show', as: :short_account_tag
get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
constraints(username: /[^@\/.]+/) do
get '/@:username', to: 'accounts#show', as: :short_account
get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
get '/@:username/media', to: 'accounts#show', as: :short_account_media
get '/@:username/tagged/:tag', to: 'accounts#show', as: :short_account_tag
end
get '/interact/:id', to: 'remote_interaction#new', as: :remote_interaction
post '/interact/:id', to: 'remote_interaction#create'
constraints(account_username: /[^@\/.]+/) do
get '/@:account_username/following', to: 'following_accounts#index'
get '/@:account_username/followers', to: 'follower_accounts#index'
get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
end
get '/@:username_with_domain/(*any)', to: 'home#index', constraints: { username_with_domain: /([^\/])+?/ }, format: false
get '/settings', to: redirect('/settings/profile')
namespace :settings do
@ -187,9 +214,6 @@ Rails.application.routes.draw do
resource :relationships, only: [:show, :update]
resource :statuses_cleanup, controller: :statuses_cleanup, only: [:show, :update]
get '/explore', to: redirect('/web/explore')
get '/public', to: redirect('/web/public')
get '/public/local', to: redirect('/web/public/local')
get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
resource :authorize_interaction, only: [:show, :create]
@ -642,8 +666,11 @@ Rails.application.routes.draw do
end
end
get '/web/(*any)', to: 'home#index', as: :web
WEB_APP_PATHS.each do |path|
get path, to: 'home#index'
end
get '/web/(*any)', to: redirect('/%{any}', status: 302), as: :web
get '/about', to: 'about#show'
get '/about/more', to: redirect('/about')