From 4da1a7ad73e78eef32f8e86d690733dfb7a9a1af Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 10:31:47 +0200 Subject: [PATCH 01/13] Update dependency @vitejs/plugin-react to v6.0.5 (#40010) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7f31aaec50..893525403f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5262,8 +5262,8 @@ __metadata: linkType: hard "@vitejs/plugin-react@npm:^6.0.0": - version: 6.0.4 - resolution: "@vitejs/plugin-react@npm:6.0.4" + version: 6.0.5 + resolution: "@vitejs/plugin-react@npm:6.0.5" dependencies: "@rolldown/pluginutils": "npm:^1.0.1" peerDependencies: @@ -5275,7 +5275,7 @@ __metadata: optional: true babel-plugin-react-compiler: optional: true - checksum: 10c0/38446b54f51760b97d81abfa2fb9130bdc7a545183c97b26cfc7a5982fbcbeef431f482a3d44ef8225ca3e8c37e852a0843f8f84d0834391cab49b36a172dbf8 + checksum: 10c0/fb02246fe3652d7fb746190bdd098b9e29918dfcf8c67b9c0c37300ce789e82331b2ba761530ac6ac9a61390b774d44f401787bd1c87a6c866d1e74a745cc1a0 languageName: node linkType: hard From b48468a345931baf92af8f9c160b3af2feed7011 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 11:09:17 +0200 Subject: [PATCH 02/13] New Crowdin Translations (automated) (#40017) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/ar.json | 21 ++- app/javascript/mastodon/locales/en-GB.json | 7 + app/javascript/mastodon/locales/pt-PT.json | 80 +++++++++- config/locales/be.yml | 2 + config/locales/cs.yml | 2 + config/locales/da.yml | 2 + config/locales/de.yml | 2 + config/locales/el.yml | 2 + config/locales/en-GB.yml | 20 +++ config/locales/es-AR.yml | 2 + config/locales/es-MX.yml | 2 + config/locales/es.yml | 2 + config/locales/fi.yml | 2 + config/locales/fr-CA.yml | 2 + config/locales/fr.yml | 2 + config/locales/ga.yml | 2 + config/locales/gl.yml | 15 ++ config/locales/he.yml | 2 + config/locales/hu.yml | 2 + config/locales/is.yml | 2 + config/locales/it.yml | 2 + config/locales/nan-TW.yml | 14 ++ config/locales/nl.yml | 2 + config/locales/pt-BR.yml | 2 + config/locales/pt-PT.yml | 166 +++++++++++++++++++++ config/locales/simple_form.pt-PT.yml | 12 +- config/locales/sq.yml | 2 + config/locales/sv.yml | 2 + config/locales/vi.yml | 2 + config/locales/zh-CN.yml | 2 + config/locales/zh-TW.yml | 2 + 31 files changed, 377 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/locales/ar.json b/app/javascript/mastodon/locales/ar.json index 4758b93bc1..f71cbcd60d 100644 --- a/app/javascript/mastodon/locales/ar.json +++ b/app/javascript/mastodon/locales/ar.json @@ -2,9 +2,10 @@ "about.blocks": "خوادم تحت الإشراف", "about.contact": "للاتصال:", "about.default_locale": "افتراضي", + "about.disclaimer": "ماستودون هو برنامج مجاني ومفتوح المصدر، وهو علامة تجارية لشركة ماستودون المحدودة.", "about.domain_blocks.no_reason_available": "السبب غير متوفر", - "about.domain_blocks.preamble": "يتيح مَستُدون عمومًا لمستخدميه مطالعة المحتوى من المستخدمين من الخواديم الأخرى في الفدرالية والتفاعل معهم. وهذه هي الاستثناءات التي وضعت على هذا الخادوم.", - "about.domain_blocks.silenced.explanation": "لن تظهر لك ملفات التعريف الشخصية والمحتوى من هذا الخادوم، إلا إن بحثت عنه عمدًا أو تابعته.", + "about.domain_blocks.preamble": "يتيح لك ماستودون عمومًا عرض المحتوى والتفاعل مع المستخدمين من أي خادم آخر في شبكة فيديفيرس. هذه هي الاستثناءات التي تمّت على هذا الخادم تحديدًا.", + "about.domain_blocks.silenced.explanation": "لن ترى بشكل عام الملفات الشخصية والمحتوى من هذا الخادم، إلا إذا بحثت عنه صراحةً أو اخترت الاشتراك فيه عن طريق المتابعة.", "about.domain_blocks.silenced.title": "محدود", "about.domain_blocks.suspended.explanation": "لن يتم معالجة أي بيانات من هذا الخادم أو تخزينها أو تبادلها، مما يجعل أي تفاعل أو اتصال مع المستخدمين من هذا الخادم مستحيلا.", "about.domain_blocks.suspended.title": "مُعلّق", @@ -266,6 +267,7 @@ "admin.impact_report.instance_followers": "المتابِعون الذين سوف يخسرهم مستخدمونا", "admin.impact_report.instance_follows": "المتابِعون الذين سوف يخسرهم مستخدموهم", "admin.impact_report.title": "موجز التأثير", + "alert.need_reload.message": "تم تحديث ماستودون. قد لا تعمل بعض الأشياء بشكل صحيح حتى تعيد تحميل الصفحة.", "alert.rate_limited.message": "يُرجى إعادة المحاولة بعد {retry_time, time, medium}.", "alert.rate_limited.title": "معدل الطلبات محدود", "alert.unexpected.message": "لقد طرأ خطأ غير متوقّع.", @@ -415,9 +417,24 @@ "collections.maximum_collection_count_reached": "لقد أنشأت الحد الأقصى لعدد المجموعات", "collections.name_length_hint": "الحد الأقصى هو ٤٠ حرفًا", "collections.new_collection": "مجموعة جديدة", + "collections.pending_accounts.message": "قد تظهر الحسابات على أنها معلقة عندما ننتظر ردًّا من المستخدم أو خادمه. أنت فقط من يستطيع رؤية الحسابات المعلقة.", + "collections.pending_accounts.title": "لماذا أرى حسابات معلقة؟", "collections.remove_account": "إزالة", + "collections.report_collection": "أبلغ عن هذه المجموعة", + "collections.revoke_collection_inclusion": "أخلي نفسي من هذه المجموعة", + "collections.revoke_inclusion.confirmation": "تم إخلاؤك من ”{collection}“", + "collections.revoke_inclusion.error": "حدث خطأ، يرجى المحاولة مرة أخرى لاحقًا.", + "collections.search_accounts_label": "ابحث عن حساب لإضافته", + "collections.search_accounts_max_reached": "لقد أضفت الحد الأقصى لعدد الحسابات", "collections.sensitive": "حساس", "collections.share_short": "مشاركة", + "collections.sort_alphabetical": "ألفبائي", + "collections.sort_by": "افرز حسب:", + "collections.sort_date_added": "تاريخ الإضافة", + "collections.sort_last_active": "آخر نشاط", + "collections.sort_most_followers": "معظم المتابعين", + "collections.suggestions.can_not_add": "لا يمكن إضافته", + "collections.suggestions.can_not_add_desc": "قد تكون هذه الحسابات قد اختارت عدم اكتشافها، أو قد تكون موجودة على خادم لا يدعم المجموعات.", "collections.visibility_public": "للعامة", "collections.visibility_title": "مدى الظهور", "collections.visibility_unlisted": "غير مُدرَج", diff --git a/app/javascript/mastodon/locales/en-GB.json b/app/javascript/mastodon/locales/en-GB.json index 60e9b7d232..d56cfc7361 100644 --- a/app/javascript/mastodon/locales/en-GB.json +++ b/app/javascript/mastodon/locales/en-GB.json @@ -267,6 +267,7 @@ "admin.impact_report.instance_followers": "Followers our users would lose", "admin.impact_report.instance_follows": "Followers their users would lose", "admin.impact_report.title": "Impact summary", + "alert.need_reload.message": "Mastodon has been updated. Some things may not work correctly until you reload the page.", "alert.rate_limited.message": "Please retry after {retry_time, time, medium}.", "alert.rate_limited.title": "Rate limited", "alert.unexpected.message": "An unexpected error occurred.", @@ -1138,6 +1139,9 @@ "report.categories.spam": "Spam", "report.categories.violation": "Content violates one or more server rules", "report.category.subtitle": "Choose the best match", + "report.category.title_account": "Tell us what's going on with this profile", + "report.category.title_collection": "Tell us what's going on with this collection", + "report.category.title_status": "Tell us what's going on with this post", "report.close": "Done", "report.comment.title": "Is there anything else you think we should know?", "report.forward": "Forward to {target}", @@ -1227,6 +1231,7 @@ "status.block": "Block @{name}", "status.bookmark": "Bookmark", "status.cancel_reblog_private": "Unboost", + "status.cannot_edit": "You are not allowed to edit this post", "status.cannot_quote": "You are not allowed to quote this post", "status.cannot_reblog": "This post cannot be boosted", "status.contains_quote": "Contains quote", @@ -1260,8 +1265,10 @@ "status.more": "More", "status.mute": "Mute @{name}", "status.mute_conversation": "Mute conversation", + "status.not_quoted": "You are not quoted in this post", "status.open": "Expand this post", "status.pin": "Pin on profile", + "status.public_only": "This post is private", "status.quote": "Quote", "status.quote.cancel": "Cancel quote", "status.quote_error.blocked_account_hint.title": "This post is hidden because you've blocked @{name}.", diff --git a/app/javascript/mastodon/locales/pt-PT.json b/app/javascript/mastodon/locales/pt-PT.json index bc415b1e2e..70dbc9765d 100644 --- a/app/javascript/mastodon/locales/pt-PT.json +++ b/app/javascript/mastodon/locales/pt-PT.json @@ -2,6 +2,7 @@ "about.blocks": "Servidores moderados", "about.contact": "Contacto:", "about.default_locale": "Padrão", + "about.disclaimer": "Mastodon é um software gratuito, de código aberto, e uma marca registada da Mastodon GmbH.", "about.domain_blocks.no_reason_available": "Motivo não disponível", "about.domain_blocks.preamble": "O Mastodon, geralmente, permite-lhe ver conteúdo e interagir com utilizadores de qualquer outro servidor na fediverso. Estas são as exceções aplicadas neste servidor em particular.", "about.domain_blocks.silenced.explanation": "Normalmente não verá perfis e conteúdos deste servidor, a não ser que os procures explicitamente ou opte por segui-los.", @@ -18,7 +19,7 @@ "account.add_or_remove_from_list": "Adicionar ou remover das listas", "account.badges.admin": "Admin", "account.badges.blocked": "Bloqueado", - "account.badges.bot": "Robô", + "account.badges.bot": "Automatizada", "account.badges.domain_blocked": "Domínio bloqueado", "account.badges.group": "Grupo", "account.badges.muted": "Silenciado", @@ -68,6 +69,16 @@ "account.go_to_profile": "Ir para o perfil", "account.hide_reblogs": "Esconder partilhas de @{name}", "account.in_memoriam": "Em Memória.", + "account.join_modal.day": "Dia", + "account.join_modal.me": "Juntou-se a {server} em", + "account.join_modal.me_anniversary": "Feliz Fedianiversário! Juntou-se a {server} em", + "account.join_modal.me_today": "É o seu primeiro dia em {server}!", + "account.join_modal.other": "{name} juntou-se a {server} em", + "account.join_modal.other_today": "É o primeiro dia de {name} em {server}!", + "account.join_modal.share.celebrate": "Partilhe uma publicação comemorativa", + "account.join_modal.share.intro": "Partilhe uma publicação de apresentação", + "account.join_modal.share.welcome": "Partilhe uma publicação de boas-vindas", + "account.join_modal.years": "{number, plural, one {ano} other {anos}}", "account.joined_short": "Juntou-se a", "account.languages": "Alterar idiomas subscritos", "account.last_active": "Última atividade", @@ -75,6 +86,7 @@ "account.locked_info": "Esta conta é privada. O proprietário revê manualmente quem o pode seguir.", "account.media": "Media", "account.mention": "Mencionar @{name}", + "account.menu.add_to_collection": "Adicionar a coleção…", "account.menu.add_to_list": "Adicionar à lista…", "account.menu.block": "Bloquear conta", "account.menu.block_domain": "Bloquear {domain}", @@ -102,6 +114,7 @@ "account.name.copy": "Copiar identificador", "account.name.help.domain": "{domain} é o servidor onde estão alojados o perfil e publicações do utilizador.", "account.name.help.domain_self": "{domain} é o servidor que hospeda o teu perfil e publicações.", + "account.name.help.footer": "Tal como pode enviar e-mails para pessoas que utilizam diferentes serviços de e-mail, pode interagir com pessoas noutros servidores do Mastodon e com qualquer pessoa noutras aplicações do Fediverso.", "account.name.help.header": "Um identificador é como um endereço de correio eletrónico", "account.name.help.username": "{username} é o nome de utilizador desta conta no seu servidor. Alguém pode ter o mesmo nome de utilizador noutro servidor.", "account.name.help.username_self": "{username} é o teu nome de utilizador neste servidor. Alguém pode ter o mesmo nome de utilizador noutro servidor.", @@ -116,6 +129,7 @@ "account.note.edit_button": "Editar", "account.note.title": "Nota pessoal (visível apenas por si)", "account.open_original_page": "Abrir a página original", + "account.pending": "Pendente", "account.posts": "Publicações", "account.remove_from_followers": "Remover {name} dos seguidores", "account.report": "Denunciar @{name}", @@ -211,6 +225,10 @@ "account_edit.profile_tab.show_media.title": "Mostrar separador 'Media'", "account_edit.profile_tab.show_media_replies.description": "Quando ativado, o separador 'Media' mostra tanto as suas publicações quanto as suas respostas às publicações de outras pessoas.", "account_edit.profile_tab.show_media_replies.title": "Incluir respostas no separador 'Media'", + "account_edit.profile_tab.show_relations.description": "Mostra, no seu perfil, as contas que segue e os seus seguidores a outros utilizadores. As pessoas continuarão a poder ver se as está a seguir.", + "account_edit.profile_tab.show_relations.title": "Mostrar 'Seguidores' e 'A seguir'", + "account_edit.profile_tab.subtitle": "Personalize a forma como o seu perfil é apresentado.", + "account_edit.profile_tab.title": "Definições de apresentação do perfil", "account_edit.save": "Guardar", "account_edit.upload_modal.back": "Voltar", "account_edit.upload_modal.done": "Concluído", @@ -238,6 +256,7 @@ "account_edit_tags.search_placeholder": "Insira uma etiqueta…", "account_edit_tags.suggestions": "Sugestões:", "account_edit_tags.tag_status_count": "{count, plural, one {# publicação} other {# publicações}}", + "account_list.hidden_notice": "Isto apenas é visível para si. Para mostrar esta lista a outras pessoas, aceda a {page} > {modal} > {field}.", "account_list.total": "{total, plural, one {# conta} other {# contas}}", "admin.dashboard.daily_retention": "Taxa de retenção de utilizadores por dia após a inscrição", "admin.dashboard.monthly_retention": "Taxa de retenção de utilizadores por mês após a inscrição", @@ -248,6 +267,7 @@ "admin.impact_report.instance_followers": "Seguidores que os nossos utilizadores perderiam", "admin.impact_report.instance_follows": "Seguidores que os utilizadores deles perderiam", "admin.impact_report.title": "Resumo do impacto", + "alert.need_reload.message": "O Mastodon foi atualizado. Algumas funcionalidades podem não funcionar corretamente até que recarregue a página.", "alert.rate_limited.message": "Volta a tentar depois das {retry_time, time, medium}.", "alert.rate_limited.title": "Limite de tentativas", "alert.unexpected.message": "Ocorreu um erro inesperado.", @@ -309,11 +329,15 @@ "annual_report.summary.share_on_mastodon": "Partilhar no Mastodon", "attachments_list.unprocessed": "(não processado)", "audio.hide": "Ocultar áudio", + "block_modal.no_collections": "Nenhum de vocês pode adicionar o outro às suas coleções. Serão automaticamente removidos das coleções existentes um do outro, se for o caso.", "block_modal.remote_users_caveat": "Solicitaremos ao servidor {domain} que respeite a sua decisão. No entanto, o cumprimento não é garantido, sendo que alguns servidores podem gerir bloqueios de forma diferente. As publicações públicas podem continuar visíveis para utilizadores não autenticados.", "block_modal.show_less": "Mostrar menos", "block_modal.show_more": "Mostrar mais", + "block_modal.they_cant_mention": "Não podem mencionar-se, seguir-se ou citar-se uns aos outros.", + "block_modal.they_cant_see_posts": "Eles não conseguem ver o seu conteúdo e você não vai ver o deles.", "block_modal.they_will_know": "Ele pode ver que o bloqueaste.", "block_modal.title": "Bloquear utilizador?", + "block_modal.you_wont_see_mentions": "Não vai ver publicações de outras pessoas que os mencionem.", "boost_modal.combo": "Pode clicar em {combo} para não voltar a ver isto", "boost_modal.reblog": "Partilhar a publicação?", "boost_modal.undo_reblog": "Deixar de partilhar a publicação?", @@ -344,10 +368,13 @@ "collection.share_modal.share_via_system": "Compartilhar com…", "collection.share_modal.title": "Partilhar coleção", "collection.share_modal.title_new": "Partilhe a sua nova coleção!", + "collection.share_template_other": "Dá uma vista de olhos nesta excelente coleção:", + "collection.share_template_own": "Dá uma vista de olhos na minha nova coleção:", "collections.account_count": "{count, plural, one {# conta} other {# contas}}", "collections.accounts.empty_description": "Adicione até {count} contas", "collections.accounts.empty_editor_title": "Ainda não há ninguém nesta coleção", "collections.accounts.empty_title": "Esta coleção está vazia", + "collections.add_to_collection": "Adicionar {name} a coleções", "collections.block_collection_owner": "Bloquear conta", "collections.by_account": "por {account_handle}", "collections.collection_description": "Descrição", @@ -370,18 +397,28 @@ "collections.detail.loading": "A carregar a coleção…", "collections.detail.revoke_inclusion": "Remover-me", "collections.detail.sensitive_content": "Conteúdo sensível", + "collections.detail.sensitive_note": "A descrição e as contas podem não ser adequadas para todos os públicos.", "collections.detail.share": "Partilhar esta coleção", "collections.detail.you_are_in_this_collection": "Está em destaque nesta coleção", "collections.edit_details": "Editar detalhes", + "collections.error_loading_collections": "Ocorreu um erro ao tentar carregar estas coleções.", "collections.hidden_accounts_description": "Bloqueou ou silenciou {count, plural, one {este utilizador} other {estes utilizadores}}", "collections.hidden_accounts_link": "{count, plural, one {# conta escondida} other {# contas escondidas}}", "collections.hints.accounts_counter": "{count}/{max} contas", "collections.last_updated_at": "Última atualização: {date}", + "collections.list.collections_with_count": "{count, plural, one {# Coleção} other {# Coleções}}", + "collections.list.created_by_author": "Criada por {name}", + "collections.list.created_by_you": "Criada por si", + "collections.list.featuring_you": "Que o incluem", "collections.manage_accounts": "Gerir contas", "collections.mark_as_sensitive": "Marcar como sensível", "collections.mark_as_sensitive_hint": "Oculta a descrição e as contas da coleção por trás de um aviso de conteúdo. O nome da coleção ainda estará visível.", + "collections.maximum_collection_count_description": "O seu servidor permite a criação de até {count} coleções.", + "collections.maximum_collection_count_reached": "Criou o máximo de coleções permitidas", "collections.name_length_hint": "Limite de 40 carateres", "collections.new_collection": "Nova coleção", + "collections.pending_accounts.message": "As contas podem aparecer como pendentes quando estamos à espera de uma resposta do utilizador ou do seu servidor. Só você pode ver as contas pendentes.", + "collections.pending_accounts.title": "Porque estou a ver contas pendentes?", "collections.remove_account": "Remover", "collections.report_collection": "Denunciar esta coleção", "collections.revoke_collection_inclusion": "Remover-me desta coleção", @@ -391,6 +428,11 @@ "collections.search_accounts_max_reached": "Já adicionou o máximo de contas", "collections.sensitive": "Sensível", "collections.share_short": "Partilhar", + "collections.sort_alphabetical": "Alfabeticamente", + "collections.sort_by": "Ordenar por:", + "collections.sort_date_added": "Data de inclusão", + "collections.sort_last_active": "Última atividade", + "collections.sort_most_followers": "Mais seguidores", "collections.suggestions.can_not_add": "Não pode ser adicionada", "collections.suggestions.can_not_add_desc": "Estas contas podem ter optado por não participar nas funcionalidades de descoberta, ou podem estar num servidor que não suporta coleções.", "collections.suggestions.must_follow": "Deve seguir primeiro", @@ -427,6 +469,7 @@ "column.other_collections": "Coleções de {name}", "column.pins": "Publicações afixadas", "column.public": "Cronologia federada", + "column.your_collections": "As Suas Coleções", "column_back_button.label": "Voltar", "column_header.hide_settings": "Ocultar configurações", "column_header.moveLeft_settings": "Mover coluna para a esquerda", @@ -519,6 +562,7 @@ "confirmations.remove_from_followers.message": "{name} vai parar de seguir-te. Tens a certeza que prentedes continuar?", "confirmations.remove_from_followers.title": "Remover seguidor?", "confirmations.revoke_collection_inclusion.confirm": "Remover-me", + "confirmations.revoke_collection_inclusion.message": "O curador não poderá voltar a adicioná-lo a esta coleção durante 24 horas. Para impedir que o adicione a coleções de forma permanente, pode bloqueá-lo.", "confirmations.revoke_collection_inclusion.title": "Remover-se desta coleção?", "confirmations.revoke_quote.confirm": "Remover publicação", "confirmations.revoke_quote.message": "Esta ação é irreversível.", @@ -541,6 +585,12 @@ "copy_icon_button.copy_this_text": "Copiar link para a área de transferência", "copypaste.copied": "Copiado", "copypaste.copy_to_clipboard": "Copiar para a área de transferência", + "custom_homepage.about": "Sobre", + "custom_homepage.about_this_server": "Sobre este servidor", + "custom_homepage.administered_by": "Administrado por", + "custom_homepage.contact": "Contacto:", + "custom_homepage.latest_activity": "Atividade mais recente", + "custom_homepage.these_are_the_latest_posts": "Estas são as últimas 40 publicações das contas deste servidor.", "directory.federated": "Do fediverso conhecido", "directory.local": "Apenas de {domain}", "directory.new_arrivals": "Recém-chegados", @@ -597,6 +647,10 @@ "empty_column.account_unavailable": "Perfil indisponível", "empty_column.blocks": "Ainda não bloqueaste nenhum utilizador.", "empty_column.bookmarked_statuses": "Ainda não tem nenhuma publicação salva. Quando salvar uma, ela aparecerá aqui.", + "empty_column.collections": "{acct} ainda não criou nenhuma coleção.", + "empty_column.collections.featured_in": "Ainda não foi adicionado a nenhuma coleção.", + "empty_column.collections.featured_in_undiscoverable": "Para que as pessoas possam adicioná-lo às suas coleções, tem de autorizar a sua inclusão nas funcionalidades de descoberta em Preferências > Privacidade e alcance", + "empty_column.collections_self": "Ainda não criou nenhuma coleção.", "empty_column.community": "A cronologia local está vazia. Escreve algo publicamente para começar!", "empty_column.direct": "Ainda não tens qualquer menção privada. Quando enviares ou receberes uma, ela irá aparecer aqui.", "empty_column.disabled_feed": "Esta cronologia foi desativada pelos administradores do seu servidor.", @@ -728,6 +782,7 @@ "home.pending_critical_update.link": "Ver atualizações", "home.pending_critical_update.title": "Está disponível uma atualização de segurança crítica!", "home.show_announcements": "Mostrar mensagens de manutenção", + "ignore_notifications_modal.bots_title": "Ignorar notificações de bots?", "ignore_notifications_modal.disclaimer": "O Mastodon não pode informar os utilizadores de que ignoraste as notificações deles. Ignorar as notificações não impedirá que as mensagens sejam enviadas.", "ignore_notifications_modal.filter_instead": "Em vez disso, filtrar", "ignore_notifications_modal.filter_to_act_users": "Ainda poderás aceitar, rejeitar ou reportar utilizadores", @@ -742,6 +797,7 @@ "info_button.label": "Ajuda", "info_button.what_is_alt_text": "

O que é texto alternativo?

O texto alternativo fornece descrições de imagens para pessoas com deficiências visuais, ligações de baixa largura de banda ou pessoas que procuram um contexto adicional.

Pode melhorar a acessibilidade e a compreensão de todos escrevendo um texto alternativo claro, conciso e objetivo.

", "interaction_modal.action": "Para interagir com a publicação de {name}, necessita de iniciar sessão na sua conta em qualquer servidor Mastodon que utilize.", + "interaction_modal.action_follow": "Para seguir {name}, precisa de iniciar sessão na sua conta em qualquer servidor de Mastodon que utilize.", "interaction_modal.go": "Ir", "interaction_modal.no_account_yet": "Ainda não tens conta?", "interaction_modal.on_another_server": "Num servidor diferente", @@ -767,6 +823,12 @@ "keyboard_shortcuts.heading": "Atalhos de teclado", "keyboard_shortcuts.home": "abrir a cronologia na página inicial", "keyboard_shortcuts.hotkey": "Atalho", + "keyboard_shortcuts.keys.alt": "Alt", + "keyboard_shortcuts.keys.backspace": "Retrocesso", + "keyboard_shortcuts.keys.enter": "Enter", + "keyboard_shortcuts.keys.esc": "Esc", + "keyboard_shortcuts.keys.page_down": "Page Down", + "keyboard_shortcuts.keys.page_up": "Page Up", "keyboard_shortcuts.legend": "mostrar esta legenda", "keyboard_shortcuts.load_more": "Focar botão \"Carregar mais\"", "keyboard_shortcuts.local": "abrir a cronologia local", @@ -787,6 +849,7 @@ "keyboard_shortcuts.toggle_sensitivity": "Mostrar / Ocultar media", "keyboard_shortcuts.toot": "criar uma nova publicação", "keyboard_shortcuts.top": "Mover para o topo da lista", + "keyboard_shortcuts.translate": "Traduzir uma publicação", "keyboard_shortcuts.unfocus": "remover o foco da área de texto / pesquisa", "keyboard_shortcuts.up": "mover para cima na lista", "learn_more_link.got_it": "Entendido", @@ -797,6 +860,7 @@ "lightbox.zoom_in": "Ampliar para o tamanho real", "lightbox.zoom_out": "Ajustar para caber", "limited_account_hint.action": "Mostrar perfil mesmo assim", + "limited_account_hint.title": "Este perfil ou servidor foi escondido pelos moderadores de {domain}.", "link_preview.author": "Por {name}", "link_preview.more_from_author": "Mais de {name}", "link_preview.shares": "{count, plural, one {{counter} publicação} other {{counter} publicações}}", @@ -858,6 +922,7 @@ "navigation_bar.live_feed_local": "Cronologia local", "navigation_bar.live_feed_public": "Cronologia federada", "navigation_bar.logout": "Sair", + "navigation_bar.main": "Principal", "navigation_bar.moderation": "Moderação", "navigation_bar.more": "Mais", "navigation_bar.mutes": "Utilizadores ocultados", @@ -943,6 +1008,7 @@ "notifications.column_settings.admin.report": "Novas denúncias:", "notifications.column_settings.admin.sign_up": "Novas inscrições:", "notifications.column_settings.alert": "Notificações no ambiente de trabalho", + "notifications.column_settings.collections": "Coleções:", "notifications.column_settings.favourite": "Favoritos:", "notifications.column_settings.filter_bar.advanced": "Mostrar todas as categorias", "notifications.column_settings.filter_bar.category": "Barra de filtros rápidos", @@ -962,6 +1028,7 @@ "notifications.column_settings.update": "Edições:", "notifications.filter.all": "Todas", "notifications.filter.boosts": "Partilhas", + "notifications.filter.collections": "Coleções", "notifications.filter.favourites": "Favoritos", "notifications.filter.follows": "Seguidores", "notifications.filter.mentions": "Menções", @@ -978,6 +1045,8 @@ "notifications.policy.drop": "Ignorar", "notifications.policy.drop_hint": "Enviar para o vazio, para nunca mais ser visto", "notifications.policy.filter": "Filtrar", + "notifications.policy.filter_bots_hint": "Contas marcadas como automatizadas", + "notifications.policy.filter_bots_title": "Bots", "notifications.policy.filter_hint": "Enviar para a caixa de notificações filtradas", "notifications.policy.filter_limited_accounts_hint": "Limitado pelos moderadores do servidor", "notifications.policy.filter_limited_accounts_title": "Contas moderadas", @@ -1070,6 +1139,9 @@ "report.categories.spam": "Spam", "report.categories.violation": "O conteúdo viola uma ou mais regras do servidor", "report.category.subtitle": "Escolhe o mais adequado", + "report.category.title_account": "Diga-nos o que se passa com este perfil", + "report.category.title_collection": "Diga-nos o que se passa com esta coleção", + "report.category.title_status": "Diga-nos o que se passa com esta publicação", "report.close": "Concluído", "report.comment.title": "Há mais alguma coisa que devamos saber?", "report.forward": "Reencaminhar para {target}", @@ -1131,6 +1203,7 @@ "search_popout.user": "utilizador", "search_results.accounts": "Perfis", "search_results.all": "Tudo", + "search_results.collections": "Coleções", "search_results.hashtags": "Etiquetas", "search_results.no_results": "Sem resultados.", "search_results.no_search_yet": "Tenta procurar por publicações, perfis ou etiquetas.", @@ -1141,6 +1214,7 @@ "server_banner.active_users": "utilizadores ativos", "server_banner.administered_by": "Administrado por:", "server_banner.is_one_of_many": "{domain} é um dos muitos servidores Mastodon independentes que podes utilizar para participar no fediverso.", + "server_banner.more_about_this_server": "Mais sobre este servidor", "server_banner.server_stats": "Estatísticas do servidor:", "sign_in_banner.create_account": "Criar conta", "sign_in_banner.follow_anyone": "Segue qualquer pessoa no fediverso e vê tudo por ordem cronológica. Sem algoritmos, anúncios ou caça-cliques à vista.", @@ -1157,6 +1231,7 @@ "status.block": "Bloquear @{name}", "status.bookmark": "Guardar nos marcadores", "status.cancel_reblog_private": "Deixar de partilhar", + "status.cannot_edit": "Não tem permissão para editar esta publicação", "status.cannot_quote": "Não lhe é permitido citar esta publicação", "status.cannot_reblog": "Esta publicação não pode ser partilhada", "status.contains_quote": "Contém citação", @@ -1190,8 +1265,10 @@ "status.more": "Mais", "status.mute": "Ocultar @{name}", "status.mute_conversation": "Ocultar conversa", + "status.not_quoted": "Não é citado nesta publicação", "status.open": "Expandir esta publicação", "status.pin": "Afixar no perfil", + "status.public_only": "Esta publicação é privada", "status.quote": "Citação", "status.quote.cancel": "Cancelar citação", "status.quote_error.blocked_account_hint.title": "Esta publicação está oculta porque bloqueou @{name}.", @@ -1250,6 +1327,7 @@ "tabs_bar.menu": "Menu", "tabs_bar.notifications": "Notificações", "tabs_bar.publish": "Nova publicação", + "tabs_bar.quick_links": "Ligações rápidas", "tabs_bar.search": "Pesquisar", "tag.remove": "Remover", "terms_of_service.effective_as_of": "Válido a partir de {date}", diff --git a/config/locales/be.yml b/config/locales/be.yml index eb62257c6b..a59f989628 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -70,6 +70,8 @@ be: custom: Уласнае delete: Выдаліць даныя deleted: Выдалены + deletion_irreversible: Даныя гэтага ўліковага запісу былі незваротна выдаленыя. + deletion_reversible_hint_html: Гэты ўліковы запіс чакае на выдаленне, і яго даныя будуць незваротна выдаленыя %{date}. demote: Панізіць у правах destroyed_msg: Даныя %{username} цяпер у чарзе на прымусовае выдаленне disable: Замарозіць diff --git a/config/locales/cs.yml b/config/locales/cs.yml index dec39c5326..bd97287661 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -70,6 +70,8 @@ cs: custom: Vlastní delete: Smazat data deleted: Smazáno + deletion_irreversible: Data tohoto účtu byla nevratně smazána. + deletion_reversible_hint_html: Tento účet čeká na odstranění a jeho data budou plně odstraněna %{date}. demote: Degradovat destroyed_msg: Data účtu %{username} jsou nyní ve frontě k okamžitému smazání disable: Zmrazit diff --git a/config/locales/da.yml b/config/locales/da.yml index b253a28c07..c2b189437d 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -64,6 +64,8 @@ da: custom: Tilpasset delete: Slet data deleted: Slettet + deletion_irreversible: Denne kontos data er blevet slettet permanent. + deletion_reversible_hint_html: Denne konto afventer sletning, og dataene vil blive fuldstændigt slettet %{date}. demote: Degradér destroyed_msg: "%{username}s data er nu sat i kø mhp. snarlig sletning" disable: Frys diff --git a/config/locales/de.yml b/config/locales/de.yml index f2673ce54d..bc7a33a47c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -64,6 +64,8 @@ de: custom: Angepasst delete: Daten löschen deleted: Gelöscht + deletion_irreversible: Diese Kontodaten wurden unwiderruflich gelöscht. + deletion_reversible_hint_html: Dieses Konto wurde zum Löschen vorgemerkt und die Daten werden am %{date} vollständig entfernt werden. demote: Zurückstufen destroyed_msg: Die Daten von %{username} befinden sich nun in der Warteschlange und werden in Kürze gelöscht disable: Einfrieren diff --git a/config/locales/el.yml b/config/locales/el.yml index 2a271b4903..99279f4508 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -64,6 +64,8 @@ el: custom: Προσαρμοσμένο delete: Διαγραφή δεδομένων deleted: Διαγεγραμμένοι + deletion_irreversible: Τα δεδομένα αυτού του λογαριασμού έχουν διαγραφεί αμετάκλητα. + deletion_reversible_hint_html: Εκκρεμεί η διαγραφή αυτού του λογαριασμού και τα δεδομένα θα διαγραφούν πλήρως στις %{date}. demote: Υποβιβασμός destroyed_msg: Τα δεδομένα του/της %{username} εκκρεμούν για άμεση διαγραφή disable: Πάγωμα diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index d23cdd33da..7a2ec02036 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -4,6 +4,7 @@ en-GB: about_mastodon_html: 'The social network of the future: No ads, no corporate surveillance, ethical design, and decentralisation! Own your data with Mastodon!' contact_missing: Not set contact_unavailable: N/A + default_thumbnail_description: Two smiling cartoon mastodons (who look like elephants) toss a paper plane between them. They're surrounded by a bright blue sky and floating planets with trees and more mastodons on them. hosted_on: Mastodon hosted on %{domain} title: About accounts: @@ -63,6 +64,8 @@ en-GB: custom: Custom delete: Delete data deleted: Deleted + deletion_irreversible: The data of this account has been irreversibly deleted. + deletion_reversible_hint_html: This account is pending deletion, and the data will be fully removed on %{date}. demote: Demote destroyed_msg: "%{username}'s data is now queued to be deleted imminently" disable: Freeze @@ -288,7 +291,11 @@ en-GB: enable_relay_html: "%{name} enabled the relay %{target}" enable_sign_in_token_auth_user_html: "%{name} enabled email token authentication for %{target}" enable_user_html: "%{name} enabled login for user %{target}" + listable_tag_html: can be suggested memorialize_account_html: "%{name} turned %{target}'s account into a memoriam page" + not_listable_tag_html: won't be suggested + not_trendable_tag_html: won't appear under trends + not_usable_tag_html: cannot be used promote_user_html: "%{name} promoted user %{target}" publish_terms_of_service_html: "%{name} published updates to the terms of service" reject_appeal_html: "%{name} rejected moderation decision appeal from %{target}" @@ -301,6 +308,7 @@ en-GB: sensitive_account_html: "%{name} marked %{target}'s media as sensitive" silence_account_html: "%{name} limited %{target}'s account" suspend_account_html: "%{name} suspended %{target}'s account" + trendable_tag_html: can appear under trends unassigned_report_html: "%{name} unassigned report %{target}" unblock_email_account_html: "%{name} unblocked %{target}'s email address" unsensitive_account_html: "%{name} unmarked %{target}'s media as sensitive" @@ -313,8 +321,10 @@ en-GB: update_ip_block_html: "%{name} changed rule for IP %{target}" update_report_html: "%{name} updated report %{target}" update_status_html: "%{name} updated post by %{target}" + update_tag_html: "%{name} changed %{target} settings to: " update_user_role_html: "%{name} changed %{target} role" update_username_block_html: "%{name} updated rule for usernames containing %{target}" + usable_tag_html: can be used; deleted_account: deleted account empty: No logs found. filter_by_action: Filter by action @@ -345,12 +355,20 @@ en-GB: updated_msg: Announcement successfully updated! collections: accounts: Accounts + back_to_account: Back to account page + back_to_report: Back to report page + batch: + add_to_report: 'Add to report #%{id}' + remove_from_report: Remove from report + report: Report collection_title: Collection by %{name} contents: Contents + no_collection_selected: No collections were changed as none were selected number_of_accounts: one: 1 account other: "%{count} accounts" open: Open + title: Account collections - @%{name} view_publicly: View publicly critical_update_pending: Critical update pending custom_emojis: @@ -484,8 +502,10 @@ en-GB: title: Block new email domain no_email_domain_block_selected: No email domain blocks were changed as none were selected not_permitted: Not permitted + reset: Reset resolved_dns_records_hint_html: The domain name resolves to the following MX domains, which are ultimately responsible for accepting email. Blocking an MX domain will block sign-ups from any email address which uses the same MX domain, even if the visible domain name is different. Be careful not to block major email providers. resolved_through_html: Resolved through %{domain} + search: Search title: Blocked email domains export_domain_allows: new: diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 0975dc0b5d..9c28c7529d 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -64,6 +64,8 @@ es-AR: custom: Personalizar delete: Eliminar datos deleted: Eliminado + deletion_irreversible: Los datos de esta cuenta fueron eliminados irreversiblemente. + deletion_reversible_hint_html: Esta cuenta está pendiente de eliminación, y los datos se eliminarán completamente el %{date}. demote: Bajar de nivel destroyed_msg: Los datos de %{username} están ahora en cola para ser eliminados inminentemente disable: Congelar diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index 8add2cfbf0..defa95b422 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -64,6 +64,8 @@ es-MX: custom: Personalizado delete: Eliminar datos deleted: Eliminado + deletion_irreversible: Los datos de esta cuenta han sido eliminados de forma irreversible. + deletion_reversible_hint_html: Esta cuenta está pendiente de eliminación, y los datos se eliminarán completamente el %{date}. demote: Degradar destroyed_msg: Los datos de %{username} están ahora en cola para ser eliminados inminentemente disable: Deshabilitar diff --git a/config/locales/es.yml b/config/locales/es.yml index 49a0bc3253..3b5e5c2d49 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -64,6 +64,8 @@ es: custom: Personalizado delete: Eliminar datos deleted: Eliminado + deletion_irreversible: Los datos de esta cuenta han sido eliminados de forma irreversible. + deletion_reversible_hint_html: Esta cuenta está pendiente de eliminación, y los datos se eliminarán completamente el %{date}. demote: Degradar destroyed_msg: Los datos de %{username} están ahora en cola para ser eliminados inminentemente disable: Deshabilitar diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 05d8dfd310..263b26332b 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -64,6 +64,8 @@ fi: custom: Mukautettu delete: Poista tiedot deleted: Poistettu + deletion_irreversible: Tämä tilin tiedot on poistettu peruuttamattomasti. + deletion_reversible_hint_html: Tämä tili odottaa poistoa, ja tiedot poistetaan kokonaan %{date}. demote: Alenna destroyed_msg: Käyttäjän %{username} tiedot ovat nyt jonossa poistettavaksi välittömästi disable: Jäädytä diff --git a/config/locales/fr-CA.yml b/config/locales/fr-CA.yml index 5035c9da92..f2eb3a7d09 100644 --- a/config/locales/fr-CA.yml +++ b/config/locales/fr-CA.yml @@ -64,6 +64,8 @@ fr-CA: custom: Personnalisé delete: Supprimer les données deleted: Supprimé + deletion_irreversible: Les données de ce compte ont été supprimées définitivement. + deletion_reversible_hint_html: Ce compte est en attente de suppression, et les données seront complètement supprimées le %{date}. demote: Rétrograder destroyed_msg: Les données de %{username} sont maintenant en file d’attente pour être supprimées imminemment disable: Geler diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 432174d864..bb51be1f11 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -64,6 +64,8 @@ fr: custom: Personnaliser delete: Supprimer les données deleted: Supprimé + deletion_irreversible: Les données de ce compte ont été supprimées définitivement. + deletion_reversible_hint_html: Ce compte est en attente de suppression, et les données seront complètement supprimées le %{date}. demote: Rétrograder destroyed_msg: Les données de %{username} sont maintenant en file d’attente pour être supprimées imminemment disable: Désactiver diff --git a/config/locales/ga.yml b/config/locales/ga.yml index 8bb6c3725b..90615c7977 100644 --- a/config/locales/ga.yml +++ b/config/locales/ga.yml @@ -73,6 +73,8 @@ ga: custom: Saincheaptha delete: Scrios sonraí deleted: Scriosta + deletion_irreversible: Scriosadh sonraí an chuntais seo go neamh-inchúlghairthe. + deletion_reversible_hint_html: Tá an cuntas seo ar feitheamh le scriosadh, agus bainfear na sonraí go hiomlán ar %{date}. demote: Ísligh destroyed_msg: Tá sonraí %{username} ciúáilte anois le scriosadh gan mhoill disable: Reoigh diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 5c0f694045..29e28229b3 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -64,6 +64,8 @@ gl: custom: Personalizado delete: Eliminar datos deleted: Eliminado + deletion_irreversible: Elimináronse definitivamente os datos desta conta. + deletion_reversible_hint_html: Esta conta está pendente para eliminala, e os datos vanse eliminar totalmente o %{date}. demote: Rebaixar destroyed_msg: Os datos de %{username} están na cola para ser eliminados axiña disable: Desactivar @@ -1013,13 +1015,17 @@ gl: critical_update: Crítica - actualiza axiña description: Aconsellamos manter actualizado o teu servidor Mastodon para beneficiarte dos últimos arranxos e características. A maiores, de cando en vez hai actualizacións para evitar problemas importantes de seguridade. Debido a isto, Mastodon comproba cada 30 minutos se hai actualizacións e avisarate seguindo as túas preferencias de notificación por correo electrónico. documentation_link: Saber máis + nearing_eol: A versión que estás a utilizar vai deixar de ter mantemento o %{date}, pensa en actualizala. release_notes: Notas da versión + supported_until: O mantemento remata o %{date} title: Actualizacións dispoñibles type: Tipo types: major: Versión principal minor: Versión intermedia patch: Versión de arranxos - solución de problemas e cambios simples + unsupported_branch: A versión que estás utilizando non recibe mantemento, considera actualizar o máis axiña posible. + unsupported_since: Sen mantemento desde %{date} version: Versión statuses: account: Autoría @@ -1285,6 +1291,15 @@ gl: auto_close_registrations: body: Debido á falta de actividade recente de moderación, a creación de contas en %{instance} mudou ao modo de revisión manual das solicitudes, para evitar que %{instance} sexa usada como plataforma por actores maliciosos. Podes volver ao rexistro aberto en calquera momento. subject: O modo de creación de contas en %{instance} mudou automáticamente a aprobación manual + end_of_support_out_of_support_warning: + body: A versión de Mastodon que estás utilizando no servidor xa non recibe mantemento. Recomendámosche actualizala o máis axiña posible! + subject: A versión Mastodon %{branch} utilizada para %{instance} xa non recibe mantemento! + end_of_support_three_months_warning: + body: A versión de Mastodon que se utiliza actualmente no teu servidor vai deixar de recibir mantemento en 3 meses. Aconsellámosche actualizala con tempo a unha versión máis recente. + subject: O mantemento de Mastodon %{branch} que utiliza %{instance} remata en 3 meses. + end_of_support_two_weeks_warning: + body: A versión de Mastodon que se utiliza actualmente no teu servidor vai deixar de recibir mantemento en 2 semanas. Aconsellámosche actualizala con tempo a unha versión máis recente. + subject: O mantemento de Mastodon %{branch} que utiliza %{instance} remata en 2 semanas. new_appeal: actions: delete_statuses: borrar as súas publicacións diff --git a/config/locales/he.yml b/config/locales/he.yml index 7edb5ad2c0..68440e1c9b 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -70,6 +70,8 @@ he: custom: התאמה אישית delete: מחיקת נתונים deleted: מחוקים + deletion_irreversible: נתוני חשבון זה נמחקו באופן בלתי הפיך. + deletion_reversible_hint_html: חשבון זה מועמד למחיקה, והמידע האצור בו ימחק בתאריך %{date}. demote: הורדה בדרגה destroyed_msg: הנתונים של %{username} נכנסו לתור המחיקה וצפויים להימחק באופן מיידי disable: הקפאה diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 024caa2003..a700e8eb06 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -64,6 +64,8 @@ hu: custom: Egyéni delete: Adatok törlése deleted: Törölve + deletion_irreversible: A fiók adatait véglegesen törölték. + deletion_reversible_hint_html: 'Ez a fiók törlésre vár, és az adatok véglegesen el lesznek távolítva ekkor: %{date}.' demote: Lefokozás destroyed_msg: A %{username} fiók adatai bekerültek a végleges törlése váró sorba disable: Befagyasztás diff --git a/config/locales/is.yml b/config/locales/is.yml index 91002985ee..23a9fa1412 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -64,6 +64,8 @@ is: custom: Sérsniðið delete: Eyða gögnum deleted: Eytt + deletion_irreversible: Gögnum þessa notandaaðgangs hefur verið eytt óafturkvæmt. + deletion_reversible_hint_html: Þessi notandaaðgangur biður eftir að verða eytt og verða gögn hans fjarlægð að fullu þann %{date}. demote: Lækka í tign destroyed_msg: Gögn notandans %{username} eru núna í bið eftir að vera endanlega eytt disable: Gera óvirkt diff --git a/config/locales/it.yml b/config/locales/it.yml index 95c0ed312d..59e682855c 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -64,6 +64,8 @@ it: custom: Personalizzato delete: Elimina i dati deleted: Eliminato + deletion_irreversible: I dati di questo account sono stati cancellati in modo irreversibile. + deletion_reversible_hint_html: Questo account è in attesa di eliminazione e i dati saranno completamente rimossi in data %{date}. demote: Retrocedi destroyed_msg: I dati di %{username} sono ora accodati per l'imminente eliminazione disable: Congela diff --git a/config/locales/nan-TW.yml b/config/locales/nan-TW.yml index 1292095fa2..087fa3080b 100644 --- a/config/locales/nan-TW.yml +++ b/config/locales/nan-TW.yml @@ -61,6 +61,8 @@ nan-TW: custom: 自訂 delete: Thâi資料 deleted: Thâi掉ah + deletion_irreversible: Tsit ê口座ê資料已經hōo lâng thâi掉,bē當復原。 + deletion_reversible_hint_html: Tsit ê口座當leh等待thâi掉,資料ē佇 %{date} kui ê thâi掉。 demote: 降級 destroyed_msg: Teh-beh thâi掉 %{username} ê資料 disable: 冷凍 @@ -2295,5 +2297,17 @@ nan-TW: apps_ios_action: 對App Store載落去 apps_step: Kā阮ê官方應用程式載落去。 apps_title: Mastodon APP + checklist_subtitle: 予lán幫tsān lí佇tsit ê社群新境界起行: + checklist_title: 歡迎ê檢查列單 + edit_profile_action: 個人化 + edit_profile_step: 若有全面ê個人資料,通促進lí ê互動。 + edit_profile_title: 個人化lí ê個人資料 + explanation: 下kha是一寡撇步,幫tsān lí開始 + feature_action: 看詳細 + feature_audience: Mastodon提供lí獨一ê,無需要中lâng,就通管理lí ê觀眾ê可能性。部署佇lí ê基礎設施ê Mastodon,允准lí對別ê線頂ê Mastodon服侍器跟tuè lâng kap予lâng跟tuè,koh控制權無屬佇別lâng,kan-ta lí。 + feature_audience_title: 有自信來建立lí ê觀眾 + feature_control: Lí上知影佇lí厝ê時間線想beh看siánn物。無演算法á是廣告無彩lí ê時間。自一个口座跟tuè hānn任何Mastodon ê服侍器ê逐ê lâng,kap照時間順序收著in ê PO文,予lí ê網路角勢小寡較像lí。 + feature_control_title: 掌握lí家己ê時間線 feature_creativity: Mastodon支持聲音、影kap圖片êPO文、容易使用性ê描述、投票、內容ê警告、動畫ê標頭、自訂ê繪文字kap裁縮小圖ê控制等等,幫tsān lí展現家己。無論beh發表藝術作品、音樂,á是podcast,Mastodon佇tsia為lí服務。 + feature_creativity_title: 無比ê創造力 sign_in_action: 登入 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 7ad46dcf02..3b61ad9ed8 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -64,6 +64,8 @@ nl: custom: Handmatig delete: Gegevens verwijderen deleted: Verwijderd + deletion_irreversible: De gegevens van dit account zijn definitief verwijderd. + deletion_reversible_hint_html: Dit account is in afwachting van verwijdering en de gegevens worden op %{date} definitief verwijderd. demote: Degraderen destroyed_msg: De verwijdering van de gegevens van %{username} staat nu in de wachtrij disable: Bevriezen diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 9233dd27cb..f1eb83a8b4 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -64,6 +64,8 @@ pt-BR: custom: Personalizado delete: Excluir dados deleted: Excluído + deletion_irreversible: Os dados desta conta foram excluídos de forma irreversível. + deletion_reversible_hint_html: Esta conta está com uma exclusão pendente, os dados serão totalmente excluídos em %{date}. demote: Rebaixar destroyed_msg: Os dados de %{username} estão na fila para serem excluídos em breve disable: Congelar diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 6847423e00..f240b6e7f0 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -4,6 +4,7 @@ pt-PT: about_mastodon_html: 'A rede social do futuro: sem publicidade e sem vigilância empresarial; desenho ético e descentralizado! Toma posse dos teus dados com o Mastodon!' contact_missing: Por definir contact_unavailable: n.d. + default_thumbnail_description: Dois mastodontes de desenho animado sorridentes (que se parecem com elefantes) atiram um avião de papel um ao outro. Estão rodeados por um céu azul brilhante e planetas flutuantes com árvores e mais mastodontes neles. hosted_on: Mastodon alojado em %{domain} title: Sobre accounts: @@ -63,6 +64,8 @@ pt-PT: custom: Personalizado delete: Eliminar dados deleted: Eliminada + deletion_irreversible: Os dados desta conta foram eliminados irreversivelmente. + deletion_reversible_hint_html: Esta conta está pendente para eliminação, e os dados serão totalmente removidos em %{date}. demote: Despromovida destroyed_msg: Os dados de %{username} estão agora em fila de espera para serem eliminados de imediato disable: Congelar @@ -288,7 +291,11 @@ pt-PT: enable_relay_html: "%{name} ativou o retransmissor %{target}" enable_sign_in_token_auth_user_html: "%{name} ativou o token de autenticação por e-mail para %{target}" enable_user_html: "%{name} ativou o início de sessão para o utilizador %{target}" + listable_tag_html: pode ser sugerida memorialize_account_html: "%{name} transformou a conta de %{target} num memorial" + not_listable_tag_html: não será sugerida + not_trendable_tag_html: não aparecerá nas tendências + not_usable_tag_html: não pode ser utilizada promote_user_html: "%{name} promoveu o utilizador %{target}" publish_terms_of_service_html: "%{name} publicou a atualização dos termos de serviço" reject_appeal_html: "%{name} rejeitou a contestação da decisão de moderação de %{target}" @@ -301,6 +308,7 @@ pt-PT: sensitive_account_html: "%{name} marcou a media de %{target} como sensível" silence_account_html: "%{name} limitou a conta de %{target}" suspend_account_html: "%{name} suspendeu a conta de %{target}" + trendable_tag_html: pode aparecer nas tendências unassigned_report_html: "%{name} deixou de atribuir a denúncia %{target}" unblock_email_account_html: "%{name} desbloqueou o endereço de e-mail de %{target}" unsensitive_account_html: "%{name} desmarcou a media de %{target} como sensível" @@ -313,8 +321,10 @@ pt-PT: update_ip_block_html: "%{name} alterou regra para o IP %{target}" update_report_html: "%{name} atualizou a denúncia %{target}" update_status_html: "%{name} atualizou a publicação de %{target}" + update_tag_html: "%{name} alterou as configurações de %{target} para: " update_user_role_html: "%{name} alterou a função %{target}" update_username_block_html: "%{name} atualizou regra para nomes de utilizadores que contêm %{target}" + usable_tag_html: pode ser utilizada; deleted_account: conta eliminada empty: Não foram encontrados registos. filter_by_action: Filtrar por ação @@ -345,12 +355,20 @@ pt-PT: updated_msg: Mensagem de manutenção atualizada com sucesso! collections: accounts: Contas + back_to_account: Voltar à página da conta + back_to_report: Voltar à página da denúncia + batch: + add_to_report: 'Adicionar à denúncia #%{id}' + remove_from_report: Remover da denúncia + report: Denúncia collection_title: Colecionado por %{name} contents: Conteúdo + no_collection_selected: Nenhuma coleção foi alterada, pois nenhuma foi selecionada number_of_accounts: one: 1 conta other: "%{count} contas" open: Abrir + title: Coleções da conta - @%{name} view_publicly: Ver publicamente critical_update_pending: Atualização crítica pendente custom_emojis: @@ -484,9 +502,89 @@ pt-PT: title: Bloquear novo domínio de e-mail no_email_domain_block_selected: Não foram alterados quaisquer bloqueios de domínios de e-mail, uma vez que nenhum foi selecionado not_permitted: Não permitido + reset: Repor resolved_dns_records_hint_html: O nome de domínio resolve para os seguintes domínios MX, que são, em última análise, responsáveis por aceitar o e-mail. Bloquear um domínio MX irá bloquear as inscrições de qualquer endereço de e-mail que use o mesmo domínio MX, mesmo quando o nome de domínio visível é diferente. Cuidado para não bloquear os principais fornecedores de e-mail. resolved_through_html: Resolvido através de %{domain} + search: Pesquisar title: Domínios de e-mail bloqueados + email_subscriptions: + accounts: + account: Conta + empty: + hint: Ainda nenhuma conta tem subscritores. + no_lists_yet: Ainda não há listas + last_email: Último e-mail + lead: As contas que ativaram a funcionalidade e que têm subscritores serão apresentadas abaixo. + show: + confirm_disable_feature: Desativar newsletters por e-mail para %{name}? As atualizações por e-mail deixarão de ser enviadas para esta conta. O utilizador ainda poderá voltar a ativar a funcionalidade nas definições da sua conta. Para remover permanentemente o acesso a esta funcionalidade, edite a permissão da conta em Funções. + confirm_remove_subscriber: "%{email} deixará de receber e-mails de %{name}. Esta ação não pode ser anulada." + consent: Os subscritores apenas consentiram receber publicações por e-mail. Não utilize esta lista para outros fins. + date: Data de inscrição + disable_feature: Desativar funcionalidade + disabled: A funcionalidade foi desativada e já não estão a ser enviados e-mails para esta lista. + email: Endereços de e-mail + empty: + hint: Ainda ninguém subscreveu esta conta. + no_subscribers_yet: Ainda sem subscritores + enable_feature: Ativar funcionalidade + no_access_html: Esta conta já não tem as permissões necessárias para ativar a funcionalidade. Altere isto em Funções. + title: Newsletters por e-mail de %{name} + view_account: Ver conta + status: Estado + subscribers: Subscritores + title: Listas de e-mail + additional_footer_texts: + show: + title: Texto adicional de rodapé + compliance_settings: + additional_footer_text: + action: Gerir + hint: Texto opcional que aparece no rodapé dos e-mails apenas da newsletter + title: Texto adicional de rodapé + lead: As newsletters por e-mail podem ser consideradas e-mails de marketing, dependendo das jurisdições onde opera. + privacy_policy: + action: Gerir + hint: Uma ligação para esta política é colocada no rodapé de cada e-mail + title: Política de privacidade + title: Definições de conformidade + danger_zone: + disable_feature: + action: Desativar + hint: Desativar a funcionalidade para todas as contas + title: Desativar funcionalidade + erase_all_data: + action: Apagar dados + hint: Eliminar permanentemente todos os e-mails em todas as listas de e-mails + title: Apagar todos os dados + title: Zona perigosa + disabled_msg: As subscrições por e-mail foram desativadas com sucesso. + index: + disabled: + cannot_be_enabled: O seu fornecedor técnico não ativou esta funcionalidade para o seu servidor. + description: Esta funcionalidade permite que contas especificadas adicionem um widget aos seus perfis, permitindo que visitantes sem uma conta no Mastodon recebam as suas publicações via e-mail. + get_started: Começar agora + lead: Permitir que os visitantes recebam publicações via e-mail de contas dedicadas neste servidor. + title: Newsletters por e-mail + purged_msg: Todos os dados de subscrições de e-mail estão a ser apagados. + roles: + accounts: Contas + edit_role: Editar função + empty: + hint: Ninguém tem permissão para utilizar esta funcionalidade. + no_roles_added: Nenhuma função adicionada + lead: Contas com as seguintes funções podem ativar esta funcionalidade nos seus perfis. + manage_roles: Gerir funções + role_name: Nome da função + title: Funções + setups: + show: + enable_feature: Ativar funcionalidade + important_information: Informação importante + list: + 1_permission_explanation: Quando esta funcionalidade estiver ativada, as contas com as permissões designadas podem adicionar um formulário de recolha de e-mail aos seus perfis. + 2_feature_explanation: Quando os visitantes se registarem na página de perfil de uma conta e confirmarem a sua subscrição, passarão a receber atualizações por e-mail quando a conta criar novas publicações públicas. + 3_privacy_policy_warning: Os administradores do servidor terão acesso a informações de identificação pessoal (endereços de e-mail) recolhidas. Como tal, a política de privacidade e os Termos de Serviço do servidor devem ser atualizados antes de utilizar esta funcionalidade. + 4_cost_warning: E-mails podem ter custos associados, dependendo da configuração de alojamento. Fale com o seu fornecedor de alojamento antes de ativar, pois esta funcionalidade poderá aumentar drasticamente a quantidade de e-mails enviados a partir do seu servidor. export_domain_allows: new: title: Importar permissões de domínio @@ -641,6 +739,8 @@ pt-PT: new: title: Criar nova regra de IP no_ip_block_selected: Nenhuma regra de IP foi alterada pois nenhuma foi selecionada + reset: Repor + search: Pesquisar title: Regras de IP relationships: title: Relações de %{acct} @@ -671,6 +771,7 @@ pt-PT: action_log: Registo de auditoria action_taken_by: Ação tomada por actions: + delete_description_html: As publicações denunciadas e/ou coleções serão eliminadas e um aviso será registado para o ajudar a tomar medidas em futuras infrações pela mesma conta. mark_as_sensitive_description_html: A media nas publicações denunciadas será marcada como sensível e uma punição será registada para ajudá-lo a escalar ações em futuras infrações pela mesma conta. other_description_html: Veja mais opções para controlar o comportamento da conta e personalizar a comunicação para a conta denunciada. resolve_description_html: Nenhuma ação será tomada contra a conta denunciada, não será registada nenhuma reprimenda e a denúncia será fechada. @@ -697,6 +798,7 @@ pt-PT: confirm: Confirmar confirm_action: Confirmar a ação de moderação contra @%{acct} created_at: Denunciado + delete_and_resolve: Eliminar conteúdo forwarded: Encaminhado forwarded_replies_explanation: Esta denúncia é de um utilizador remoto e sobre conteúdo remoto. Foi encaminhada para si porque o conteúdo denunciado é em resposta a um dos seus utilizadores. forwarded_to: Encaminhado para %{domain} @@ -790,6 +892,7 @@ pt-PT: manage_custom_emojis: Gerir emojis personalizados manage_custom_emojis_description: Permite aos utilizadores gerirem os emojis personalizados do servidor manage_email_subscriptions: Gerir Subscrições de E-mail + manage_email_subscriptions_description: Permitir a utilizadores com esta permissão ativar a funcionalidade de newsletter por e-mail para a sua conta manage_federation: Gerir federação manage_federation_description: Permite aos utilizadores bloquearem ou permitirem a federação com outros domínios e controlar a entregabilidade manage_invites: Gerir convites @@ -877,6 +980,17 @@ pt-PT: authenticated: Apesar utilizadores autenticados disabled: Requerer função de utilizador especifica public: Todos + landing_page: + hints: + about_html: Uma página com a descrição, informações de contacto, regras e outras informações relativas a este servidor. + local_feed_html: Um feed em direto que apresenta as publicações mais recentes de utilizadores neste servidor. + overview_html: Uma página que apresenta a descrição do seu servidor, juntamente com as publicações locais mais recentes dos utilizadores neste servidor. + trends_html: Uma página que destaca o que é popular neste servidor neste momento. + values: + about: Página Sobre + local_feed: Cronologia local + overview: Visão Geral + trends: Em destaque registrations: moderation_recommandation: Certifique-se de que dispõe de uma equipa de moderação adequada e reativa antes de abrir as inscrições a todos! preamble: Controle quem pode criar uma conta no seu servidor. @@ -896,17 +1010,22 @@ pt-PT: site_uploads: delete: Eliminar ficheiro enviado destroyed_msg: Envio do site eliminado com sucesso! + skip_to_content: Saltar para o conteúdo software_updates: critical_update: Crítico — por favor, atualize rapidamente description: Recomenda-se que mantenha a sua instalação do Mastodon atualizada para beneficiar das últimas correções e funcionalidades. Além disso, é por vezes crítico atualizar o Mastodon de forma atempada para evitar problemas de segurança. Por estas razões, o Mastodon verifica as atualizações a cada 30 minutos e irá notificá-lo de acordo com as suas preferências de notificação por e-mail. documentation_link: Saber mais + nearing_eol: O suporte para a versão que está a utilizar terminará a %{date}, por favor considere atualizar. release_notes: Notas de lançamento + supported_until: Suporte termina em %{date} title: Atualizações disponíveis type: Tipo types: major: Versão principal minor: Versão menor patch: Versão de atualização — correções de problemas e alterações fáceis de aplicar + unsupported_branch: A versão que está a utilizar não é suportada, por favor atualize assim que possível. + unsupported_since: Sem suporte desde %{date} version: Versão statuses: account: Autor @@ -1122,6 +1241,7 @@ pt-PT: other: Utilizada por %{count} pessoas na última semana title: Recomendações e destaques trending: Em destaque + update_available: Atualização disponível username_blocks: add_new: Adicionar novo block_registrations: Bloquear inscrições @@ -1171,6 +1291,15 @@ pt-PT: auto_close_registrations: body: Devido à falta de atividade recente dos moderadores, as inscrições em %{instance} foram automaticamente alteradas para requererem revisão manual, para evitar que %{instance} seja utilizada como plataforma para potenciais más intenções. Pode voltar a alterar para inscrições abertas em qualquer altura. subject: As inscrições em %{instance} foram automaticamente alteradas para requererem aprovação + end_of_support_out_of_support_warning: + body: A versão do Mastodon atualmente em uso no seu servidor já não é suportada. Recomendamos que atualize o mais brevemente possível! + subject: Mastodon %{branch} utilizado em %{instance} já não é suportado! + end_of_support_three_months_warning: + body: A versão do Mastodon atualmente em uso no seu servidor deixará de ser suportada em 3 meses. Poderá ser do seu interesse atualizar para uma versão mais recente antecipadamente. + subject: O suporte para o Mastodon %{branch} utilizado em %{instance} terminará em 3 meses. + end_of_support_two_weeks_warning: + body: A versão do Mastodon atualmente em uso no seu servidor deixará de ser suportada em 2 semanas. Poderá ser do seu interesse atualizar para uma versão mais recente antecipadamente. + subject: O suporte para o Mastodon %{branch} utilizado em %{instance} terminará em 2 semanas. new_appeal: actions: delete_statuses: para eliminar as publicações dele @@ -1411,6 +1540,7 @@ pt-PT: your_appeal_rejected: A tua contestação foi rejeitada edit_profile: other: Outro + privacy_redesign_body: A escolha de mostrar as tuas contas seguidas e seguidores é agora feita diretamente no teu perfil. redesign_body: Agora é possível aceder à edição do perfil diretamente a partir da página de perfil. redesign_button: Vamos lá redesign_title: Existe uma nova experiência de edição de perfil @@ -1443,7 +1573,9 @@ pt-PT: success_html: A partir de agora, começará a receber e-mails sempre que %{name} publicar novas atualizações. Adicione %{sender} aos seus contactos para que essas mensagens não acabem na pasta de correio indesejado. title: Está inscrito unsubscribe: Cancelar subscrição + disabled: Desativado inactive: Inativa + no_access: Sem acesso status: Estado subscribers: Subscritores emoji_styles: @@ -1479,7 +1611,9 @@ pt-PT: blocks: Bloqueaste bookmarks: Itens Salvos csv: CSV + custom_filters: Filtros domain_blocks: Bloqueios de domínio + json: JSON lists: Listas mutes: Que ocultaste storage: Armazenamento de media @@ -1557,7 +1691,9 @@ pt-PT: empty: Ficheiro CSV vazio incompatible_type: Incompatível com o tipo de importação selecionado invalid_csv_file: 'Arquivo CSV inválido. Erro: %{error}' + invalid_json_file: 'Ficheiro JSON inválido. Erro: %{error}' over_rows_processing_limit: contém mais de %{count} linhas + status_not_found_warning: Alguns dos teus filtros ocultam publicações específicas que não são conhecidas por este servidor. Estas publicações não serão filtradas automaticamente se forem descobertas mais tarde pelo servidor. too_large: O ficheiro é demasiado grande failures: Falhas imported: Importado @@ -1574,6 +1710,9 @@ pt-PT: bookmarks_html: one: Está prestes a substituir os seus itens salvos com até %{count} publicação de %{filename}. other: Está prestes a substituir os seus itens salvos com até %{count} publicações de %{filename}. + custom_filters_html: + one: Está prestes a substituir os seus filtros pelo conteúdo de %{filename}. Até %{count} filtro será adicionado aos novos filtros. + other: Está prestes a substituir os seus filtros pelo conteúdo de %{filename}. Até %{count} filtros serão adicionados aos novos filtros. domain_blocking_html: one: Estás prestes a substituir a tua lista de bloqueios de domínio com até %{count} domínio de %{filename}. other: Estás prestes a substituir a tua lista de bloqueios de domínio com até %{count} domínios de %{filename}. @@ -1593,6 +1732,9 @@ pt-PT: bookmarks_html: one: Está prestes a adicionar até %{count} publicação de %{filename} aos teus marcadores. other: Está prestes a adicionar até %{count} publicações de %{filename} aos teus marcadores. + custom_filters_html: + one: Está prestes a adicionar até %{count} filtro de %{filename} aos seus filtros. + other: Está prestes a adicionar até %{count} filtros de %{filename} aos seus filtros. domain_blocking_html: one: Estás prestes a bloquear até %{count} domínio de %{filename}. other: Estás prestes a bloquear até %{count} domínios de %{filename}. @@ -1629,6 +1771,7 @@ pt-PT: types: blocking: Lista de bloqueios bookmarks: Itens Salvos + custom_filters: Filtros domain_blocking: Lista de domínios bloqueados following: Lista de pessoas que estás a seguir lists: Listas @@ -1723,6 +1866,27 @@ pt-PT: copy_account_note_text: 'Este utilizador migrou de %{acct}, aqui estão as tuas notas anteriores sobre ele:' navigation: toggle_menu: Alternar o menu + notification_fallbacks: + added_to_collection: + title_html: "%{name} adicionou-o a uma coleção" + admin_report: + title_html: "%{name} denunciou %{target}" + admin_sign_up: + title_and_others_html: + one: "%{name} e mais outra pessoa inscreveu-se" + other: "%{name} e mais %{count} pessoas inscreveram-se" + title_html: "%{name} inscreveu-se" + collection_update: + title_html: "%{name} atualizou uma coleção em que está incluído" + generic: + sign_in: Iniciar sessão na aplicação web do Mastodon + summary_html: Está a utilizar uma aplicação que não suporta a versão mais recente do Mastodon. %{link} para funcionalidade completa. + moderation_warning: + summary_html: Está a utilizar uma aplicação que não suporta a versão mais recente do Mastodon. %{link}. + title: Recebeu um aviso de moderação. + severed_relationships: + summary_html: Um administrador de %{from} suspendeu %{target}, o que significa que já não pode receber atualizações ou interagir com eles. %{link} para obter uma lista das relações perdidas. + title: Ligações perdidas com %{name} notification_mailer: admin: report: @@ -1771,6 +1935,7 @@ pt-PT: administration_emails: Notificações por e-mail do administrador email_events: Eventos para notificações por e-mail email_events_hint: 'Seleciona os casos para os quais desejas receber notificações:' + moderation_emails: Notificações de moderação por e-mail number: human: decimal_units: @@ -1794,6 +1959,7 @@ pt-PT: next: Seguinte older: Mais antiga prev: Anterior + truncate_html: "…" polls: errors: already_voted: Já votaste nesta sondagem diff --git a/config/locales/simple_form.pt-PT.yml b/config/locales/simple_form.pt-PT.yml index f2fa0268a8..b69431e94f 100644 --- a/config/locales/simple_form.pt-PT.yml +++ b/config/locales/simple_form.pt-PT.yml @@ -91,6 +91,7 @@ pt-PT: closed_registrations_message: Apresentado quando as inscrições estiverem encerradas content_cache_retention_period: Todas as publicações de outros servidores (incluindo partilhas e respostas) serão eliminadas após o número de dias especificado, independentemente de qualquer interação do utilizador local com essas publicações. Isto inclui mensagens em que um utilizador local as tenha salvo ou adicionado aos favoritos. As menções privadas entre utilizadores de instâncias diferentes também se perderão e serão impossíveis de recuperar. A utilização desta definição destina-se a instâncias para fins especiais e quebra muitas expectativas dos utilizadores quando implementada para utilização geral. custom_css: Pode aplicar estilos personalizados na versão web do Mastodon. + email_footer_text: Texto opcional que aparece no rodapé de e-mails de newsletters apenas. favicon: WEBP, PNG, GIF ou JPG. Substitui o ícone de favorito padrão do Mastodon por um ícone personalizado. landing_page: Seleciona a página que os novos visitantes veem quando chegam ao seu servidor pela primeira vez. Se selecionar «Tendências», então as tendências precisam estar ativas nas Definições de Descoberta. Se selecionar «Cronologia local», então «Acesso a cronologias com publicações locais em destaque» precisa de estar definido como «Todos» nas Definições de Descoberta. mascot: Sobrepõe-se à ilustração na interface web avançada. @@ -108,6 +109,7 @@ pt-PT: status_page_url: URL de uma página onde as pessoas podem ver o estado deste servidor durante uma interrupção theme: Tema que os visitantes e os novos utilizadores veem. thumbnail: Uma imagem de cerca de 2:1, apresentada ao lado da informação do seu servidor. + thumbnail_description: Uma descrição da imagem para ajudar pessoas com deficiências visuais a compreender o seu conteúdo. trendable_by_default: Ignorar a revisão manual do conteúdo em destaque. Os itens individuais poderão ainda assim ser posteriormente removidos das tendências. trends: As tendências mostram quais as publicações, etiquetas e notícias que estão a ganhar destaque no seu servidor. wrapstodon: Ofereça aos utilizadores locais a possibilidade de gerar um resumo divertido da sua utilização do Mastodon durante o ano. Esta funcionalidade está disponível entre 10 e 31 de Dezembro de cada ano e é oferecida aos utilizadores que fizeram pelo menos uma publicação Pública ou Não listada e utilizaram pelo menos uma etiqueta durante o ano. @@ -159,6 +161,7 @@ pt-PT: other: Temos de nos certificar que tem pelo menos %{count} para utilizar %{domain}. Não vamos guardar esta informação. role: A função controla as permissões que o utilizador tem. user_role: + collection_limit: Limita o número de Coleções que um único utilizador com esta função pode criar. Tenha em atenção que, ao diminuir este número, os utilizadores que já atingiram este limite não perderão quaisquer Coleções. No entanto, estes não poderão criar outras adicionais. color: Cor a ser utilizada para a função em toda a interface de utilizador, como RGB no formato hexadecimal highlighted: Isto torna a função visível publicamente name: Nome público da função, se esta estiver definida para ser apresentada com um emblema @@ -213,7 +216,7 @@ pt-PT: defaults: autofollow: Convidar para seguir a sua conta avatar: Imagem de perfil - bot: Esta é uma conta robô + bot: Esta é uma conta automatizada chosen_languages: Filtrar idiomas confirm_new_password: Confirmar nova palavra-passe confirm_password: Confirmar palavra-passe @@ -291,6 +294,7 @@ pt-PT: closed_registrations_message: Mensagem personalizada quando as inscrições não estiverem disponíveis content_cache_retention_period: Período de retenção de conteúdos remotos custom_css: CSS personalizado + email_footer_text: Texto adicional de rodapé favicon: Ícone de favoritos landing_page: Página inicial para novos visitantes local_live_feed_access: Acesso a cronologias com publicações locais em destaque @@ -315,9 +319,13 @@ pt-PT: status_page_url: URL da página de estado theme: Tema predefinido thumbnail: Miniatura do servidor + thumbnail_description: Texto alternativo da miniatura trendable_by_default: Permitir tendências sem revisão prévia trends: Ativar destaques wrapstodon: Ativar Wrapstodon + form_email_subscriptions_confirmation: + agreement_email_volume: Compreendo que ativar esta funcionalidade pode aumentar significativamente o volume de e-mails enviados pelo servidor e que sou o único responsável por quaisquer custos incorridos. + agreement_privacy_and_terms: Eu atualizei a Política de Privacidade e os Termos de Serviço. interactions: must_be_follower: Bloquear notificações de não-seguidores must_be_following: Bloquear notificações de pessoas que não segues @@ -337,6 +345,7 @@ pt-PT: notification_emails: appeal: Alguém contestou uma decisão de moderação digest: Enviar e-mails de resumo + end_of_support: A versão atual do Mastodon está a aproximar-se do fim do suporte favourite: Quando alguém adiciona uma publicação sua aos favoritos follow: Alguém começou a segui-lo follow_request: Alguém pediu para ser seu seguidor @@ -385,6 +394,7 @@ pt-PT: role: Função time_zone: Fuso horário user_role: + collection_limit: Número máximo de Coleções por utilizador color: Cor do emblema highlighted: Apresentar o cargo como emblema nos perfis de utilizador name: Nome diff --git a/config/locales/sq.yml b/config/locales/sq.yml index fc6af2501e..11470a1bc5 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -64,6 +64,8 @@ sq: custom: Vetjake delete: Fshiji të dhënat deleted: U fshi + deletion_irreversible: Të dhënat e kësaj llogarie janë fshirë në mënyrë të pakthyeshme. + deletion_reversible_hint_html: Kjo llogari është në pritje të fshirjes dhe të dhënat do të hiqen plotësisht më %{date}. demote: Zhgradoje destroyed_msg: Të dhënat e %{username} tani janë vënë në radhë për fshirje të menjëhershme disable: Çaktivizoje diff --git a/config/locales/sv.yml b/config/locales/sv.yml index a6f0c7c349..a0c061a1b3 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -64,6 +64,8 @@ sv: custom: Anpassade delete: Radera data deleted: Raderad + deletion_irreversible: Datan för detta konto har oåterkalleligen raderats. + deletion_reversible_hint_html: Detta konto väntar på radering och datan kommer att tas bort fullt ut %{date}. demote: Degradera destroyed_msg: "%{username}s data har nu lagts till kön för att raderas omedelbart" disable: Inaktivera diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 1912b0e537..69fece18ab 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -61,6 +61,8 @@ vi: custom: Tùy chỉnh delete: Xóa dữ liệu deleted: Đã xóa + deletion_irreversible: Dữ liệu của người này đã bị xóa vĩnh viễn. + deletion_reversible_hint_html: Tài khoản này đang chờ xóa và dữ liệu sẽ bị xóa hoàn toàn vào ngày %{date}. demote: Hạ vai trò destroyed_msg: Dữ liệu %{username} sẽ được lên lịch xóa ngay bây giờ disable: Khóa diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index edd6c5d4f6..d5138c43e0 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -61,6 +61,8 @@ zh-CN: custom: 自定义 delete: 删除数据 deleted: 已删除 + deletion_irreversible: 此账号的数据已被不可逆转地删除。 + deletion_reversible_hint_html: 此账号等待删除,数据将在 %{date} 完全移除。 demote: 取消管理员 destroyed_msg: "%{username} 的数据已被安排至删除队列" disable: 冻结 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 9ec3cfa4fc..c99bfdef3d 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -63,6 +63,8 @@ zh-TW: custom: 自訂 delete: 刪除資料 deleted: 已刪除 + deletion_irreversible: 此帳號之資料已被不可逆地刪除。 + deletion_reversible_hint_html: 此帳號正在等待刪除中,資料將於 %{date} 完全移除。 demote: 降級 destroyed_msg: 即將刪除 %{username} 的資料 disable: 停用 From 0c1e3aa807c6b8f5669a9ceea34c819b35b12e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Hern=C3=A1ndez?= Date: Mon, 3 Aug 2026 14:09:52 +0200 Subject: [PATCH 03/13] Replace vite_rails gem with our own vite integration (#40004) --- Gemfile | 3 +- Gemfile.lock | 16 +- app/helpers/routing_helper.rb | 2 +- bin/vite | 16 -- config/application.rb | 1 - .../initializers/content_security_policy.rb | 18 +- config/initializers/vite.rb | 16 ++ config/vite.json | 23 -- config/vite.yml | 36 +++ config/vite/plugin-name-lookup.ts | 68 ----- lib/premailer_bundled_asset_strategy.rb | 8 +- lib/tasks/assets.rake | 11 +- lib/vite.rb | 48 ++++ lib/vite/builder.rb | 50 ++++ lib/vite/config.rb | 88 +++++++ lib/vite/dev_server.rb | 25 ++ lib/vite/manifest.rb | 189 ++++++++++++++ lib/vite/name_resolver.rb | 49 ++++ lib/vite/proxy.rb | 25 ++ lib/vite/tagger.rb | 241 ++++++++++++++++++ lib/vite/tags_helper.rb | 41 +++ lib/vite/tasks.rb | 33 +++ lib/vite_ruby/sri_extensions.rb | 153 ----------- package.json | 4 +- spec/fixtures/files/vite-manifest-assets.json | 6 + spec/fixtures/files/vite-manifest.json | 101 ++++++++ spec/lib/vite/builder_spec.rb | 31 +++ spec/lib/vite/config_spec.rb | 58 +++++ spec/lib/vite/dev_server_spec.rb | 29 +++ spec/lib/vite/manifest_spec.rb | 142 +++++++++++ spec/lib/vite/name_resolver_spec.rb | 51 ++++ spec/lib/vite/proxy_spec.rb | 65 +++++ spec/lib/vite/tagger_spec.rb | 218 ++++++++++++++++ vite.config.mts | 8 +- 34 files changed, 1577 insertions(+), 296 deletions(-) delete mode 100755 bin/vite create mode 100644 config/initializers/vite.rb delete mode 100644 config/vite.json create mode 100644 config/vite.yml delete mode 100644 config/vite/plugin-name-lookup.ts create mode 100644 lib/vite.rb create mode 100644 lib/vite/builder.rb create mode 100644 lib/vite/config.rb create mode 100644 lib/vite/dev_server.rb create mode 100644 lib/vite/manifest.rb create mode 100644 lib/vite/name_resolver.rb create mode 100644 lib/vite/proxy.rb create mode 100644 lib/vite/tagger.rb create mode 100644 lib/vite/tags_helper.rb create mode 100644 lib/vite/tasks.rb delete mode 100644 lib/vite_ruby/sri_extensions.rb create mode 100644 spec/fixtures/files/vite-manifest-assets.json create mode 100644 spec/fixtures/files/vite-manifest.json create mode 100644 spec/lib/vite/builder_spec.rb create mode 100644 spec/lib/vite/config_spec.rb create mode 100644 spec/lib/vite/dev_server_spec.rb create mode 100644 spec/lib/vite/manifest_spec.rb create mode 100644 spec/lib/vite/name_resolver_spec.rb create mode 100644 spec/lib/vite/proxy_spec.rb create mode 100644 spec/lib/vite/tagger_spec.rb diff --git a/Gemfile b/Gemfile index 52d5e083ca..28b6044b19 100644 --- a/Gemfile +++ b/Gemfile @@ -74,6 +74,7 @@ gem 'public_suffix', '~> 7.0' gem 'pundit', '~> 2.3' gem 'rack-attack', '~> 6.6' gem 'rack-cors', require: 'rack/cors' +gem 'rack-proxy', require: 'rack/proxy' gem 'rails-i18n', '~> 8.0' gem 'redcarpet', '~> 3.6' gem 'redis', '~> 5' @@ -231,6 +232,4 @@ gem 'hcaptcha', '~> 7.1' gem 'mail', '~> 2.8' -gem 'vite_rails' - gem 'base58', '~> 0.2.3' diff --git a/Gemfile.lock b/Gemfile.lock index b0d2f3b30b..9105076482 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -214,7 +214,6 @@ GEM railties (>= 5) dotenv (3.2.0) drb (2.2.3) - dry-cli (1.4.1) elastic-transport (8.5.3) faraday (< 3) multi_json @@ -642,8 +641,8 @@ GEM base64 (>= 0.1.0) logger (>= 1.6.0) rack (>= 3.0.0, < 4) - rack-proxy (0.8.3) - rack + rack-proxy (1.0.1) + rack (>= 2.0, < 4) rack-session (2.1.2) base64 (>= 0.1.0) rack (>= 3.0.0) @@ -901,15 +900,6 @@ GEM validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix - vite_rails (3.11.1) - railties (>= 5.1, < 9) - vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.10.2) - dry-cli (>= 0.7, < 2) - logger (~> 1.6) - mutex_m - rack-proxy (~> 0.6, >= 0.6.1) - zeitwerk (~> 2.2) warden (1.2.9) rack (>= 2.0.9) webauthn (3.4.3) @@ -1051,6 +1041,7 @@ DEPENDENCIES pundit (~> 2.3) rack-attack (~> 6.6) rack-cors + rack-proxy rack-test (~> 2.1) rails (~> 8.1.0) rails-i18n (~> 8.0) @@ -1091,7 +1082,6 @@ DEPENDENCIES tty-prompt (~> 0.23) twitter-text (~> 3.1.0) tzinfo-data (~> 1.2023) - vite_rails webauthn (~> 3.0) webmock (~> 3.18) webpush! diff --git a/app/helpers/routing_helper.rb b/app/helpers/routing_helper.rb index b5d090db49..8c69430eeb 100644 --- a/app/helpers/routing_helper.rb +++ b/app/helpers/routing_helper.rb @@ -4,7 +4,7 @@ module RoutingHelper extend ActiveSupport::Concern include ActionView::Helpers::AssetTagHelper - include ViteRails::TagHelpers + include Vite::TagsHelper included do include Rails.application.routes.url_helpers diff --git a/bin/vite b/bin/vite deleted file mode 100755 index 9664d0d987..0000000000 --- a/bin/vite +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'vite' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("vite_ruby", "vite") diff --git a/config/application.rb b/config/application.rb index 181924da64..6f502295e0 100644 --- a/config/application.rb +++ b/config/application.rb @@ -50,7 +50,6 @@ require_relative '../lib/action_dispatch/remote_ip_extensions' require_relative '../lib/active_record/database_tasks_extensions' require_relative '../lib/active_record/batches' require_relative '../lib/simple_navigation/item_extensions' -require_relative '../lib/vite_ruby/sri_extensions' require_relative '../lib/json-canonicalization/floats_fix' Bundler.require(:pam_authentication) if ENV['PAM_ENABLED'] == 'true' diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 33894db93f..b343c372dd 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -30,19 +30,21 @@ Rails.application.config.content_security_policy do |p| p.child_src :self, :blob, assets_host p.worker_src :self, :blob, assets_host - if Rails.env.development? - vite_public_host = ENV.fetch('VITE_DEV_SERVER_PUBLIC', "localhost:#{ViteRuby.config.port}") - front_end_build_urls = %w(ws http).map { |protocol| "#{protocol}#{'s' if ViteRuby.config.https}://#{vite_public_host}" } + p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url + p.script_src :self, assets_host, "'wasm-unsafe-eval'" + p.frame_src :self, :https + p.style_src :self, assets_host + + next unless Rails.env.development? + + Rails.application.config.to_prepare do + vite_public_host = "#{Vite.config.host}:#{Vite.config.port}" + front_end_build_urls = %w(ws http).map { |protocol| "#{protocol}#{'s' if Vite.config.https?}://#{vite_public_host}" } p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url, *front_end_build_urls p.script_src :self, :unsafe_inline, :unsafe_eval, assets_host p.frame_src :self, :https, :http p.style_src :self, assets_host, :unsafe_inline - else - p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url - p.script_src :self, assets_host, "'wasm-unsafe-eval'" - p.frame_src :self, :https - p.style_src :self, assets_host end end diff --git a/config/initializers/vite.rb b/config/initializers/vite.rb new file mode 100644 index 0000000000..4294afc40d --- /dev/null +++ b/config/initializers/vite.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'vite' + +Vite.setup do |config| + config.copy_from Rails.application.config_for(:vite) + config.logger = Rails.logger.tagged('vite') + + if Rails.env.development? + Rails.application.config.middleware.insert_before(0, Vite::Proxy, config:, dev_server: Vite.dev_server) + else + Rails.application.config.to_prepare do + Vite.preload if defined?(Rails::Server) || defined?(Rails::Console) + end + end +end diff --git a/config/vite.json b/config/vite.json deleted file mode 100644 index 254dc3365a..0000000000 --- a/config/vite.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "all": { - "sourceCodeDir": "app/javascript", - "additionalEntrypoints": [ - "~/{fonts,icons,images}/**/*", - "~/styles/entrypoints/*.scss" - ], - "watchAdditionalPaths": [] - }, - "production": { - "publicOutputDir": "packs" - }, - "development": { - "autoBuild": true, - "publicOutputDir": "packs-dev", - "port": 3036 - }, - "test": { - "autoBuild": true, - "publicOutputDir": "packs", - "port": 3037 - } -} diff --git a/config/vite.yml b/config/vite.yml new file mode 100644 index 0000000000..95d701c2ac --- /dev/null +++ b/config/vite.yml @@ -0,0 +1,36 @@ +# Main configuration for Vite integration inside Rails +# see lib/vite/config.rb for more info +# +# All values need to match Vite's configuration in vite.config.mts +shared: + cache_dir: 'node_modules/.vite' + +development: + host: 'localhost' + port: 3036 + https: false + base_path: '/packs-dev/' + manifest_path: 'public/packs-dev/.vite/manifest.json' + manifest_assets_path: 'public/packs-dev/.vite/manifest-assets.json' + auto_build: true + build_command: 'yarn build:development' + tag_strategies: ['dev_server', 'manifest'] + out_dir: 'public/packs-dev' + +test: + base_path: '/packs/' + manifest_path: 'public/packs/.vite/manifest.json' + manifest_assets_path: 'public/packs/.vite/manifest-assets.json' + auto_build: true + build_command: 'yarn build:production' + tag_strategies: ['manifest'] + out_dir: 'public/packs' + +production: + base_path: '/packs/' + manifest_path: 'public/packs/.vite/manifest.json' + manifest_assets_path: 'public/packs/.vite/manifest-assets.json' + auto_build: false + build_command: 'yarn build:production' + tag_strategies: ['manifest'] + out_dir: 'public/packs' diff --git a/config/vite/plugin-name-lookup.ts b/config/vite/plugin-name-lookup.ts deleted file mode 100644 index 82dbf712e2..0000000000 --- a/config/vite/plugin-name-lookup.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { relative, extname } from 'node:path'; - -import type { Plugin } from 'vite'; - -export function MastodonNameLookup(): Plugin { - const nameMap: Record = {}; - - let root = ''; - - return { - name: 'mastodon-name-lookup', - applyToEnvironment(environment) { - return !!environment.config.build.manifest; - }, - configResolved(userConfig) { - root = userConfig.root; - }, - generateBundle(options, bundle) { - if (!root) { - throw new Error( - 'MastodonNameLookup plugin requires the root to be set in the config.', - ); - } - - // Iterate over all chunks in the bundle and create a lookup map - for (const file in bundle) { - const chunk = bundle[file]; - if ( - chunk?.type !== 'chunk' || - !chunk.isEntry || - !chunk.facadeModuleId - ) { - continue; - } - - const relativePath = relative( - root, - sanitizeFileName(chunk.facadeModuleId), - ); - const ext = extname(relativePath); - const name = chunk.name.replace(ext, ''); - - if (nameMap[name]) { - throw new Error( - `Entrypoint ${relativePath} conflicts with ${nameMap[name]}`, - ); - } - - nameMap[name] = relativePath; - } - - this.emitFile({ - type: 'asset', - fileName: '.vite/manifest-lookup.json', - source: JSON.stringify(nameMap, null, 2), - }); - }, - }; -} - -// Taken from https://github.com/rollup/rollup/blob/4f69d33af3b2ec9320c43c9e6c65ea23a02bdde3/src/utils/sanitizeFileName.ts -// https://datatracker.ietf.org/doc/html/rfc2396 -// eslint-disable-next-line no-control-regex -const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$%&*+,:;<=>?[\]^`{|}\u007F]/g; - -function sanitizeFileName(name: string): string { - return name.replace(INVALID_CHAR_REGEX, ''); -} diff --git a/lib/premailer_bundled_asset_strategy.rb b/lib/premailer_bundled_asset_strategy.rb index f02f49e6f9..1c31bd2b68 100644 --- a/lib/premailer_bundled_asset_strategy.rb +++ b/lib/premailer_bundled_asset_strategy.rb @@ -2,16 +2,16 @@ module PremailerBundledAssetStrategy def load(url) - if ViteRuby.instance.dev_server_running? + if Rails.env.development? && Vite.dev_server.running? # Request from the dev server - return unless url.start_with?("/#{ViteRuby.config.public_output_dir}/") + return unless url.start_with?(Vite.config.base_path) headers = {} # Vite dev server wants this header for CSS files, otherwise it will respond with a JS file that inserts the CSS (to support hot reloading) headers['Accept'] = 'text/css' if url.end_with?('.scss', '.css') Net::HTTP.get( - URI("#{ViteRuby.config.origin}#{url}"), + URI("#{Vite.config.backend}#{url}"), headers ).presence else @@ -22,7 +22,7 @@ module PremailerBundledAssetStrategy path.read end - rescue ViteRuby::MissingEntrypointError + rescue Vite::Manifest::MissingEntryError # If the path is not in the manifest, ignore it end diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index de722f6bc1..0b0f114ec6 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -14,9 +14,16 @@ end if Rake::Task.task_defined?('assets:precompile') Rake::Task['assets:precompile'].enhance do + # Vite integration + Vite.tasks.precompile + Rake::Task['assets:generate_static_pages'].invoke end end -# We don't want vite_ruby to run yarn, we do that in a separate step -Rake::Task['vite:install_dependencies'].clear +if Rake::Task.task_defined?('assets:clobber') + Rake::Task['assets:clobber'].enhance do + # Vite integration + Vite.tasks.clobber + end +end diff --git a/lib/vite.rb b/lib/vite.rb new file mode 100644 index 0000000000..98944cda9c --- /dev/null +++ b/lib/vite.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Integration library between Mastodon backend and Vite +module Vite + autoload :Builder, 'vite/builder' + autoload :Config, 'vite/config' + autoload :DevServer, 'vite/dev_server' + autoload :Manifest, 'vite/manifest' + autoload :NameResolver, 'vite/name_resolver' + autoload :Proxy, 'vite/proxy' + autoload :Tagger, 'vite/tagger' + autoload :TagsHelper, 'vite/tags_helper' + autoload :Tasks, 'vite/tasks' + + def self.setup + yield config if block_given? + end + + def self.config + @config ||= Config.new + end + + def self.logger + @logger ||= config.logger + end + + def self.dev_server + @dev_server ||= DevServer.new(config:) + end + + def self.tagger + @tagger ||= Tagger.new(config:, manifest:, dev_server:) + end + + def self.manifest + @manifest ||= Manifest.new(config:, logger:) + end + + def self.tasks + @tasks ||= Vite::Tasks.new(config:) + end + + def self.preload + manifest.load + rescue Vite::Manifest::MissingManifestError => e + logger.error { e.message } + end +end diff --git a/lib/vite/builder.rb b/lib/vite/builder.rb new file mode 100644 index 0000000000..5e97b43232 --- /dev/null +++ b/lib/vite/builder.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module Vite + # Execute the configured build command and log its output + # @see Vite::Config#build_command + class Builder + class BuildError < StandardError + def initialize(command, exit_status) + super("Vite build command '#{command}' failed with status: #{exit_status}") + end + end + + attr_reader :config, :logger + + def initialize(config:, logger:) + @config = config + @logger = logger + end + + def build + logger.info { "Build: Building assets with vite with command: '#{config.build_command}'" } + Open3.popen3(config.build_command) do |_stdin, stdout, stderr, wait_thread| + read_pipe(stdout) do |line| + logger.info { line.strip } + end + read_pipe(stderr) do |line| + logger.error { line.strip } + end + + wait_thread.value + end + end + + def build! + status = build + + raise(BuildError.new(config.build_command, status.exitstatus)) unless status.success? + end + + private + + def read_pipe(io) + while (line = io.gets) + next if line.blank? + + yield line + end + end + end +end diff --git a/lib/vite/config.rb b/lib/vite/config.rb new file mode 100644 index 0000000000..cc974d788a --- /dev/null +++ b/lib/vite/config.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +module Vite + # Main configuration options to integrate with Vite: + # - host: Main host for Vite's dev server. Default: localhost + # - port: Main port for Vite's dev server. Default: 5173 + # - https: Whether to use HTTPS to connect to the dev server or not. Default: false + # - base_path: The prefix path added to the assets. Default: /packs-dev/ + # - tag_strategies: How to generate javascript and stylesheet tags in views. Possible values are: + # * dev_server: Generate tags linking directly to the dev server through an internal proxy + # * manifest: Generate tags using assets listed in Vite's manifest files + # Default: [:dev_server, :manifest] + # - manifest_path: Where the manifest file is located. Default: public/packs-dev/.vite/manifest.json + # - manifest_assets_path: Where the manifest-assets file is located. Default: public/packs-dev/.vite/manifest-assets.json + # - auto_build: Whether to automatically build assets or not. This is useful for tess. Default: false + # - build_command: How to build assets when auto_build is enabled. Default: 'yarn build:development' + # - out_dir: Output dir for built assets. Default: 'public/packs-dev' + # - cache_dir: Vite's build cache path. Default: 'node_modules/.vite' + # - logger: Main logger instance for other Vite classes. Default: Logger.new($stdout) + class Config + attr_accessor :host, + :port, + :https, + :base_path, + :tag_strategies, + :manifest_path, + :manifest_assets_path, + :auto_build, + :build_command, + :out_dir, + :cache_dir, + :logger + + def initialize(cnf = nil) + @host = 'localhost' + @port = 5173 + @https = false + @base_path = '/packs-dev/' + + @tag_strategies = [:dev_server, :manifest] + @manifest_path = 'public/packs-dev/.vite/manifest.json' + @manifest_assets_path = 'public/packs-dev/.vite/manifest-assets.json' + + @auto_build = false + @build_command = 'yarn build:development' + + @out_dir = 'public/packs-dev' + @cache_dir = 'node_modules/.vite' + + @logger = Logger.new($stdout) + + copy_from(cnf) unless cnf.nil? + end + + def https? + https + end + + def protocol + https? ? 'https' : 'http' + end + + def backend + "#{protocol}://#{host}:#{port}" + end + + def auto_build? + auto_build + end + + def copy_from(other) + self.host = other[:host] unless other[:host].nil? + self.port = other[:port] unless other[:port].nil? + self.https = other[:https] unless other[:https].nil? + self.base_path = other[:base_path] unless other[:base_path].nil? + + self.tag_strategies = other[:tag_strategies].map(&:to_sym) unless other[:tag_strategies].nil? + self.manifest_path = other[:manifest_path] unless other[:manifest_path].nil? + self.manifest_assets_path = other[:manifest_assets_path] unless other[:manifest_assets_path].nil? + + self.out_dir = other[:out_dir] unless other[:out_dir].nil? + self.cache_dir = other[:cache_dir] unless other[:cache_dir].nil? + + self.auto_build = other[:auto_build] unless other[:auto_build].nil? + self.build_command = other[:build_command] unless other[:build_command].nil? + end + end +end diff --git a/lib/vite/dev_server.rb b/lib/vite/dev_server.rb new file mode 100644 index 0000000000..0e463c2ac7 --- /dev/null +++ b/lib/vite/dev_server.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Vite + # Check the status of Vite's dev server + class DevServer + WAIT_TIME = 5 # seconds + attr_reader :config + + def initialize(config:) + @config = config + end + + # Original idea from vite_ruby gem + def running? + return @running if defined?(@running) && Time.now.to_i - @running_checked_at < WAIT_TIME + + Socket.tcp(config.host, config.port).close + @running = true + rescue + @running = false + ensure + @running_checked_at = Time.now.to_i + end + end +end diff --git a/lib/vite/manifest.rb b/lib/vite/manifest.rb new file mode 100644 index 0000000000..9812c39637 --- /dev/null +++ b/lib/vite/manifest.rb @@ -0,0 +1,189 @@ +# frozen_string_literal: true + +module Vite + # We use two manifest files to list the assets loaded in our backend: + # - manifest.json: This is the main file that lists all the javascript and stylesheets our frontend app uses + # - manifest-assets.json: This only lists media assets linked directly from our backend, mainly images + # + # Not all the assets listed in the manifest.json file are linked or used by the app view, so we don't need to + # keep track of those. The idea behind this class is to keep track only of the main entrypoints and all their + # subsequent imports. Imports in this case include other javascript modules and stylesheets generated by Vite. + # + # This class focuses on reducing the amount of data we keep per entrypoint and making fast lookups. To do so + # it keeps two main datastructures: + # - entries: A Hash with references to each main entrypoint (including media assets) + # - pool: An Array with all the referenced imports and stylesheets + # + # Each entrypoint has a list of IDs for each import and stylesheet that it needs to load, this ID is + # an index to the main pool. With this the referenced asset is stored only once and referenced across + # entries with a unique ID. In the original manifest files references are also nested, if an entrypoint + # imports a javascript module, this first module can import other modules and stylesheet and so on. To keep + # fetching entrypoints fast, the final list of modules and stylesheets to load per entrypoint + # is expanded when loading the manifest data and not when rendering views. Each entrypoint has the final + # list of IDs of imports and stylesheets it will need to link in the backend, without further recursive + # checks. + class Manifest + class MissingManifestError < StandardError; end + + class MissingEntryError < StandardError + def initialize(entry) + super("Failed to find entry '#{entry}' in manifest files") + end + end + + attr_reader :config, :entries, :pool, :logger + + def initialize(config:, logger:) + @config = config + @virtual = {} + @entries = {} + @pool = [] + @loaded = false + @logger = logger + end + + def reload + @loaded = false + load + end + + def load + return if @loaded + + retries = 0 + + begin + build if retries.positive? + load_manifest + @loaded = true + rescue Errno::ENOENT => e + if retries.zero? && config.auto_build? + retries = 1 + retry + else + raise MissingManifestError, e.message + end + end + end + + def fetch(name, type: nil) + load + + key = type == :virtual ? @virtual[name] : name + + entries[key] + end + + def fetch!(name, type: nil) + fetch(name, type:) || raise(MissingEntryError, name) + end + + def imports_for(entry) + find_entries(entry[:import_ids] || []) + end + + def stylesheets_for(entry) + find_entries(entry[:stylesheet_ids] || []) + end + + private + + def load_manifest + @virtual = {} + @entries = {} + @pool = [] + # intermediate Hash for fast lookups while parsing the manifest + @lookup = {} + + logger.debug { "loading manifest file: #{config.manifest_path}" } + json = JSON.load_file(config.manifest_path) + json.each do |key, raw| + # Only select main entrypoints and locales + next unless raw['isEntry'] || key.start_with?('mastodon/locales/') + + import_ids, stylesheet_ids = resolve_relations(json, raw) + + @virtual[raw['name']] = key + @entries[key] = { + file: raw['file'], + integrity: raw['integrity'], + import_ids: import_ids, + stylesheet_ids: stylesheet_ids, + } + end + + logger.debug { "loading manifest file: #{config.manifest_assets_path}" } + assets = JSON.load_file(config.manifest_assets_path) + assets.each do |key, raw| + @entries[key] = { + file: raw['file'], + integrity: raw['integrity'], + } + end + ensure + @lookup = {} + end + + def build + logger.debug { 'AutoBuild enabled' } + builder.build + end + + def builder + @builder ||= Vite::Builder.new(config:, logger:) + end + + def resolve_relations(manifest, raw) + # NOTE: By using Set we make sure we add each asset only once + imports = Set.new + stylesheets = Set.new + + raw['imports']&.each do |import| + raw_import = manifest[import] + next unless raw_import + + id, deps = lookup(file: raw_import['file'], integrity: raw_import['integrity']) do + resolve_relations(manifest, raw_import) + end + + imports.merge(deps[0]) + stylesheets.merge(deps[1]) + imports.add id + end + + raw['css']&.each do |stylesheet| + # the css field includes the file names of the stylesheets and not + # the src names which are the ones used as keys in the manifest + raw_style = manifest.values.find { |value| value['file'] == stylesheet } + # some listed CSS files are not included as a entry in the manifest, + # but they are among the generated assets. We can still link to them + # but without the integrity field + raw_style = { 'file' => stylesheet } if raw_style.nil? + + id, = lookup(file: raw_style['file'], integrity: raw_style['integrity']) + stylesheets.add id + end + + [imports, stylesheets] + end + + # Lookup in the internal cache if an entry has been processed + # If not, yield and save the result of the block as the entry deps + def lookup(file:, integrity:) + id, deps = @lookup[file] || [] + + if id.nil? + @pool << { file:, integrity: } + id = @pool.size - 1 # last ID + deps = yield if block_given? + @lookup[file] = [id, deps] + end + + [id, deps] + end + + def find_entries(ids) + ids.filter_map { |id| pool[id] } + end + end +end diff --git a/lib/vite/name_resolver.rb b/lib/vite/name_resolver.rb new file mode 100644 index 0000000000..03eb2f2acd --- /dev/null +++ b/lib/vite/name_resolver.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module Vite + # When using assets in frontend views, we need to have an actual path that serves the asset. + # This path needs to include: + # - Vite's base_path, this is where the bundle is generated + # - If the asset needs to be included inside the main entrypoints path or not + # + # For convenience assets that are single file names (i.e: application.ts) are considered to + # be entrypoints. To make them work with Vite the `entrypoints/` prefix needs to be added. + # If an asset is referenced with a relative path like `styles/application.scss`, that path + # is used as is given. + # + # Examples: + # resolver = Vite::NameResolver.new(config: Vite.config) + # resolver.full_path('application.ts') + # # => '/packs-dev/entrypoints/application.ts' + # resolver.full_path('styles/application.scss') + # # => '/packs-dev/styles/application.scss' + # + # The #full_path is useful when working with Vite's dev server. + # When serving asssets from a manifest, it is necessary to resolve first the #entrypoint_path + # to have a proper reference of the asset inside the manifest file and then generate the + # #bundle_path of the asset's real file name defined in the manifest + class NameResolver + attr_reader :config + + def initialize(config:) + @config = config + end + + # Full path to the given asset + def full_path(name) + bundle_path(entrypoint_path(name)) + end + + # Determines if an asset name should be considered an entrypoint and builds + # the path accordingly + def entrypoint_path(name) + # If the name is a single file we assume it is inside app/javascripts/entrypoints + name.include?('/') ? name : "entrypoints/#{name}" + end + + # Asset's bundle path that includes Vite's base_path as a prefix + def bundle_path(name) + "#{config.base_path}#{name}" + end + end +end diff --git a/lib/vite/proxy.rb b/lib/vite/proxy.rb new file mode 100644 index 0000000000..e63e75f253 --- /dev/null +++ b/lib/vite/proxy.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'rack/proxy' + +module Vite + # Simple proxy that redirects asset requests to the running Vite dev server + class Proxy < Rack::Proxy + attr_reader :config, :dev_server + + def initialize(app, config:, dev_server:, **) + @config = config + @dev_server = dev_server + + super(app, backend: config.backend, ssl_verify_none: !config.https?, **) + end + + def perform_request(env) + if dev_server.running? && env['PATH_INFO'].start_with?(config.base_path) + super + else + @app.call(env) + end + end + end +end diff --git a/lib/vite/tagger.rb b/lib/vite/tagger.rb new file mode 100644 index 0000000000..febed5ddf5 --- /dev/null +++ b/lib/vite/tagger.rb @@ -0,0 +1,241 @@ +# frozen_string_literal: true + +module Vite + # This class generates the HTML tags needed to load assets in the app views + # + # It does it by following different strategies: + # - dev_server: If Vite's dev server is running, it generates a simple tag + # for an asset that the server will know how to handle + # - manifest: When using a manifest, each asset is expanded in a collection + # of tags that include the main asset and all of their dependencies. + # For example a javascript asset includes an include tag for the main + # javascript file, preload tags for each of their dependencies and + # stylesheet links for each css module file generated by Vite + # + # When both :dev_server and :manifest strategies are defined, it will first + # try to use the :dev_server and if it's not running it will fallback to :manifest + class Tagger + SKIP = Object.new + + module Common + def vite_preload_tag(helper, *sources, crossorigin:, **options) + url_options = options.extract!(:host, :protocol) + asset_paths = sources.map { |source| helper.path_to_asset(source, **url_options) } + helper.try(:request).try( + :send_early_hints, + 'Link' => asset_paths.map do |href| + %(<#{href}>; rel=modulepreload; as=script; crossorigin=#{crossorigin}) + end.join(',') + ) + + tags = asset_paths.map do |href| + helper.tag.link(rel: 'modulepreload', href:, as: 'script', crossorigin:, **options) + end + + helper.safe_join(tags) + end + end + + # When Vite's dev server is running we just need to generate tags + # linking to the main assets (javascript, stylesheets, etc) and the + # dev server will do the rest + class DevServerStrategy + include Common + + attr_reader :config, :resolver, :dev_server + + def initialize(config:, dev_server:) + @config = config + @dev_server = dev_server || DevServer.new(config:) + @resolver = NameResolver.new(config:) + end + + def vite_client_tag(helper, crossorigin: 'anonymous', **) + return SKIP unless dev_server.running? + + src = resolver.bundle_path('@vite/client') + helper.javascript_include_tag(src, type: 'module', extname: false, crossorigin:, **) + end + + def vite_react_refresh_tag(helper, **options) + return SKIP unless dev_server.running? + + options[:nonce] = true unless options.key?(:nonce) + + react_refresh = resolver.bundle_path('@react-refresh') + + preamble = <<~REACT_PREAMBLE_CODE.html_safe # rubocop:disable Rails/OutputSafety + import RefreshRuntime from '#{react_refresh}' + RefreshRuntime.injectIntoGlobalHook(window) + window.$RefreshReg$ = () => {} + window.$RefreshSig$ = () => (type) => type + window.__vite_plugin_react_preamble_installed__ = true + REACT_PREAMBLE_CODE + + helper.javascript_tag(preamble, type: :module, **options) + end + + def vite_javascript_tag(helper, *names, type: 'module', crossorigin: '', asset_type: '', **) # rubocop:disable Lint/UnusedMethodArgument + return SKIP unless dev_server.running? + + scripts = names.map { |name| resolver.full_path(name) } + + helper.javascript_include_tag(*scripts, crossorigin:, type:, extname: false, **) + end + + def vite_stylesheet_tag(helper, *names, type: :stylesheet, **options) # rubocop:disable Lint/UnusedMethodArgument + return SKIP unless dev_server.running? + + style_paths = names.map { |name| resolver.full_path(name) } + + options[:extname] = false + + helper.stylesheet_link_tag(*style_paths, **options) + end + + def vite_asset_path(helper, name, **_options) + return SKIP unless dev_server.running? + + helper.path_to_asset resolver.full_path(name) + end + + def vite_polyfills_tag(*) + return SKIP unless dev_server.running? + + '' + end + + def vite_preload_file_tag(helper, name, crossorigin: 'anonymous', **) + return SKIP unless dev_server.running? + + vite_preload_tag(helper, resolver.full_path(name), crossorigin:, **) + end + end + + class ManifestStrategy + include Common + + attr_reader :config, :manifest, :resolver + + def initialize(config:, manifest: nil) + @config = config + @manifest = manifest || Manifest.new(config:, logger: config.logger) + @resolver = NameResolver.new(config:) + end + + def vite_client_tag(*) + '' + end + + def vite_react_refresh_tag(*) + '' + end + + def vite_javascript_tag(helper, *names, type: 'module', crossorigin: '', asset_type: '', media: nil, **) + names = names.map { |name| resolver.entrypoint_path(name) } + + scripts = [] + preloads = [] + stylesheets = [] + entries = names.map { |name| manifest.fetch!(name, type: asset_type) } + + entries.each do |entry| + scripts << helper.javascript_include_tag( + resolver.bundle_path(entry[:file]), + integrity: entry[:integrity], + crossorigin:, + type:, + extname: false, + ** + ) + + preloads = manifest.imports_for(entry).map do |import| + vite_preload_tag( + helper, + resolver.bundle_path(import[:file]), + integrity: import[:integrity], + crossorigin:, + ** + ) + end + + stylesheets = manifest.stylesheets_for(entry).map do |stylesheet| + helper.stylesheet_link_tag( + resolver.bundle_path(stylesheet[:file]), + integrity: stylesheet[:integrity], + crossorigin:, + media:, + ** + ) + end + end + + helper.safe_join(scripts + preloads + stylesheets) + end + + def vite_stylesheet_tag(helper, *names, type: :stylesheet, **options) + options[:extname] = false + + stylesheets = names.map do |name| + entry = manifest.fetch!(resolver.entrypoint_path(name), type:) + helper.stylesheet_link_tag( + resolver.bundle_path(entry[:file]), + integrity: entry[:integrity], + **options + ) + end + + helper.safe_join(stylesheets) + end + + def vite_asset_path(helper, name, type: nil, **) + entry = manifest.fetch!(resolver.entrypoint_path(name), type:) + helper.path_to_asset resolver.bundle_path(entry[:file]) + end + + def vite_polyfills_tag(helper, crossorigin: 'anonymous', **) + entry = manifest.fetch!('polyfills', type: :virtual) + + helper.javascript_include_tag( + resolver.bundle_path(entry[:file]), + type: 'module', + integrity: entry[:integrity], + crossorigin:, + ** + ) + end + + def vite_preload_file_tag(helper, name, crossorigin: 'anonymous', **) + entry = manifest.fetch(resolver.entrypoint_path(name)) + return SKIP unless entry + + vite_preload_tag(helper, resolver.bundle_path(entry[:file]), integrity: entry[:integrity], crossorigin:, **) + end + end + + attr_reader :strategies + + def initialize(config:, manifest: nil, dev_server: nil) + @strategies = config.tag_strategies.filter_map do |name| + case name + when :dev_server + DevServerStrategy.new(config:, dev_server:) + when :manifest + ManifestStrategy.new(config:, manifest:) + end + end + end + + def method_missing(method, ...) + return super unless method.to_s.start_with?('vite_') + + strategies.lazy.map { |s| s.__send__(method, ...) }.find { |result| result != SKIP } || '' + end + + def respond_to_missing?(method, include_private = false) + return super unless method.to_s.start_with?('vite_') + + strategies.all? { |s| s.respond_to?(method, include_private) } + end + end +end diff --git a/lib/vite/tags_helper.rb b/lib/vite/tags_helper.rb new file mode 100644 index 0000000000..5d434c4a66 --- /dev/null +++ b/lib/vite/tags_helper.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Vite + module TagsHelper + def vite_javascript_tag(*names, type: 'module', crossorigin: '', **) + Vite.tagger.vite_javascript_tag(self, *names, type:, crossorigin:, **) + end + + def vite_typescript_tag(*names, **) + vite_javascript_tag(*names, asset_type: :typescript, **) + end + + def vite_stylesheet_tag(*names, type: :stylesheet, **) + Vite.tagger.vite_stylesheet_tag(self, *names, type:, **) + end + + def vite_client_tag(crossorigin: 'anonymous', **) + Vite.tagger.vite_client_tag(self, crossorigin:, **) + end + + def vite_react_refresh_tag(**) + Vite.tagger.vite_react_refresh_tag(self, **) + end + + def vite_asset_path(name, **) + Vite.tagger.vite_asset_path(self, name, **) + end + + def vite_polyfills_tag(crossorigin: 'anonymous', **) + Vite.tagger.vite_polyfills_tag(self, crossorigin:, **) + end + + def vite_preload_file_tag(name, crossorigin: 'anonymous', **) + Vite.tagger.vite_preload_file_tag(self, name, crossorigin:, **) + end + + def vite_preload_tag(*sources, crossorigin:, **) + Vite.tagger.vite_preload_tag(self, *sources, crossorigin:, **) + end + end +end diff --git a/lib/vite/tasks.rb b/lib/vite/tasks.rb new file mode 100644 index 0000000000..0c81150ce5 --- /dev/null +++ b/lib/vite/tasks.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Vite + class Tasks + attr_reader :config, :logger + + def initialize(config:) + @config = config + # We want tasks to always log out to STDOUT + @logger = ActiveSupport::TaggedLogging.new( + ActiveSupport::Logger.new($stdout) + ).tagged('vite') + end + + # Intended to run within assets:precompile task + def precompile + Vite::Builder.new(config:, logger:).build! + end + + # Intended to run within assets:clobber task + def clobber + [config.out_dir, config.cache_dir].each do |path| + dir = Rails.root.join(path) + if dir.exist? + logger.info { "Deleting directory '#{dir}'" } + dir.rmtree + else + logger.info { "Directory '#{dir}' doesn't exist, nothing to delete" } + end + end + end + end +end diff --git a/lib/vite_ruby/sri_extensions.rb b/lib/vite_ruby/sri_extensions.rb deleted file mode 100644 index 139483d057..0000000000 --- a/lib/vite_ruby/sri_extensions.rb +++ /dev/null @@ -1,153 +0,0 @@ -# frozen_string_literal: true - -module ViteRuby::ManifestIntegrityExtension - def path_and_integrity_for(name, **) - entry = lookup!(name, **) - - { path: entry.fetch('file'), integrity: entry.fetch('integrity', nil) } - end - - def load_manifest - # Invalidate the name lookup cache when reloading manifest - @name_lookup_cache = nil unless dev_server_running? - - super - end - - def load_name_lookup_cache - JSON.load_file(config.build_output_dir.join('.vite/manifest-lookup.json')) - end - - # Upstream's `virtual` type is a hack, re-implement it with efficient exact name lookup - def resolve_virtual_entry(name) - return name if dev_server_running? - - @name_lookup_cache ||= load_name_lookup_cache - - @name_lookup_cache.fetch(name) - end - - # Find a manifest entry by the *final* file name - def integrity_hash_for_file(file_name) - @integrity_cache ||= {} - @integrity_cache[file_name] ||= begin - entry = manifest.find { |_key, entry| entry['file'] == file_name } - - entry[1].fetch('integrity', nil) if entry - end - end - - def resolve_entries_with_integrity(*names, **options) - entries = names.map { |name| lookup!(name, **options) } - script_paths = entries.map do |entry| - { - file: entry.fetch('file'), - # TODO: Secure this so we require the integrity hash outside of dev - integrity: entry['integrity'], - } - end - - imports = dev_server_running? ? [] : entries.flat_map { |entry| import_chunks_for(entry) } - - { - scripts: script_paths, - imports: imports.filter_map { |entry| { file: entry.fetch('file'), integrity: entry.fetch('integrity') } }.uniq, - stylesheets: dev_server_running? ? [] : (entries + imports).flat_map { |entry| entry['css'] }.compact.uniq, - } - end - - # We need to override this method to not include the manifest, as in our case it is too large and will cause a JSON max nesting error rather than raising the expected exception - def missing_entry_error(name, **) - raise ViteRuby::MissingEntrypointError.new( - file_name: resolve_entry_name(name, **), - last_build: builder.last_build_metadata, - manifest: '', - config: config - ) - end -end - -ViteRuby::Manifest.prepend ViteRuby::ManifestIntegrityExtension - -module ViteRails::TagHelpers::IntegrityExtension - def vite_javascript_tag(*names, - type: 'module', - asset_type: :javascript, - skip_preload_tags: false, - skip_style_tags: false, - crossorigin: '', - media: nil, - **options) - entries = vite_manifest.resolve_entries_with_integrity(*names, type: asset_type) - - ''.html_safe.tap do |tags| - entries.fetch(:scripts).each do |script| - tags << javascript_include_tag( - script[:file], - integrity: script[:integrity], - crossorigin: crossorigin, - type: type, - extname: false, - **options - ) - end - - unless skip_preload_tags - entries.fetch(:imports).each do |import| - tags << vite_preload_tag(import[:file], integrity: import[:integrity], crossorigin: crossorigin, **options) - end - end - - options[:extname] = false if Rails::VERSION::MAJOR >= 7 - - unless skip_style_tags - entries.fetch(:stylesheets).each do |stylesheet| - # This is for stylesheets imported from Javascript. The entry for the JS entrypoint only contains the final CSS file name, so we need to look it up in the manifest - tags << stylesheet_link_tag( - stylesheet, - integrity: vite_manifest.integrity_hash_for_file(stylesheet), - media: media, - crossorigin: crossorigin, - **options - ) - end - end - end - end - - def vite_stylesheet_tag(*names, type: :stylesheet, **options) - ''.html_safe.tap do |tags| - names.each do |name| - entry = vite_manifest.path_and_integrity_for(name, type:) - - options[:extname] = false if Rails::VERSION::MAJOR >= 7 - - tags << stylesheet_link_tag(entry[:path], integrity: entry[:integrity], **options) - end - end - end - - def vite_preload_file_tag(name, - asset_type: :javascript, - crossorigin: 'anonymous', **options) - ''.html_safe.tap do |tags| - entries = vite_manifest.resolve_entries_with_integrity(name, type: asset_type) - - entries.fetch(:scripts).each do |script| - tags << vite_preload_tag(script[:file], integrity: script[:integrity], crossorigin: crossorigin, **options) - end - end - rescue ViteRuby::MissingEntrypointError - # Ignore this error, it is not critical if the file is not preloaded - end - - def vite_polyfills_tag(crossorigin: 'anonymous', **) - return if ViteRuby.instance.dev_server_running? - - entry = vite_manifest.path_and_integrity_for('polyfills', type: :virtual) - - javascript_include_tag(entry[:path], type: 'module', integrity: entry[:integrity], crossorigin: crossorigin, **) - end -end - -ViteRails::TagHelpers.prepend ViteRails::TagHelpers::IntegrityExtension diff --git a/package.json b/package.json index 3cbca6116f..6b4a5fb7ac 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ ], "scripts": { "dev": "vite dev", - "build:development": "cross-env RAILS_ENV=development NODE_ENV=development vite build", - "build:production": "cross-env RAILS_ENV=production NODE_ENV=production vite build", + "build:development": "cross-env RAILS_ENV=development NODE_ENV=development vite build --mode development", + "build:production": "cross-env RAILS_ENV=production NODE_ENV=production vite build --mode production", "fix:js": "eslint . --cache --fix", "fix:css": "stylelint --fix \"**/*.{css,scss}\"", "fix": "yarn fix:js && yarn fix:css", diff --git a/spec/fixtures/files/vite-manifest-assets.json b/spec/fixtures/files/vite-manifest-assets.json new file mode 100644 index 0000000000..c27c53fb8a --- /dev/null +++ b/spec/fixtures/files/vite-manifest-assets.json @@ -0,0 +1,6 @@ +{ + "icons/main.png": { + "file": "assets/main-abc.png", + "integrity": "abc-9" + } +} diff --git a/spec/fixtures/files/vite-manifest.json b/spec/fixtures/files/vite-manifest.json new file mode 100644 index 0000000000..76d42fe7b7 --- /dev/null +++ b/spec/fixtures/files/vite-manifest.json @@ -0,0 +1,101 @@ +{ + "mastodon/locales/en-GB.json": { + "file": "intl/en-GB.js", + "name": "en-GB", + "src": "mastodon/locales/en-GB.json", + "isDynamicEntry": true, + "integrity": "abc-1" + }, + "entrypoints/application.ts": { + "file": "application.js", + "name": "application", + "src": "entrypoints/application.ts", + "isEntry": true, + "imports": ["_no-deps.js", "_dep-1.js", "_dep-2.js"], + "css": ["assets/main.css", "assets/unlisted.css"], + "integrity": "abc-2" + }, + "entrypoints/admin.ts": { + "file": "admin.js", + "name": "admin", + "src": "entrypoints/admin.ts", + "isEntry": true, + "imports": ["_no-deps.js", "_dep-1.js", "_dep-2.js", "_dep-3.js"], + "css": ["assets/main.css", "assets/unlisted.css"], + "integrity": "cba-2" + }, + "_no-deps.js": { + "file": "no-deps.js", + "name": "no-deps", + "integrity": "abc-3" + }, + "_dep-1.js": { + "file": "dep-1.js", + "name": "dep-1", + "imports": ["_dep-1-1.js", "_dep-1-2.js"], + "css": ["assets/dep-1.css", "assets/dep-2.css"], + "integrity": "abc-4" + }, + "_dep-2.js": { + "file": "dep-2.js", + "name": "dep-2", + "imports": ["_dep-1-1.js"], + "css": ["assets/dep-2.css"], + "integrity": "abc-5" + }, + "_dep-3.js": { + "file": "dep-3.js", + "name": "dep-3", + "integrity": "cba-5" + }, + "_dep-1-1.js": { + "file": "dep-1-1.js", + "name": "dep-1-1", + "css": ["assets/dep-1-1.css"], + "integrity": "abc-6" + }, + "_dep-1-2.js": { + "file": "dep-1-2.js", + "name": "dep-1-2", + "integrity": "abc-7" + }, + "../legacy/polyfills.js": { + "file": "polyfills.js", + "name": "polyfills", + "isEntry": true, + "integrity": "abc-8" + }, + "styles/entrypoints/inert.scss": { + "file": "assets/inert-xyz.css", + "name": "inert", + "names": ["inert.css"], + "src": "styles/entrypoints/inert.scss", + "isEntry": true, + "integrity": "abc-10" + }, + "_main.css": { + "file": "assets/main.css", + "src": "_main.css", + "integrity": "abc-11" + }, + "_dep-1.css": { + "file": "assets/dep-1.css", + "src": "_dep-1.css", + "integrity": "abc-12" + }, + "_dep-2.css": { + "file": "assets/dep-2.css", + "src": "_dep-2.css", + "integrity": "abc-13" + }, + "_dep-1-1.css": { + "file": "assets/dep-1-1.css", + "src": "_dep-1-1.css", + "integrity": "abc-14" + }, + "node_modules/somepackage.js": { + "file": "package.js", + "src": "node_modules/somepackage.js", + "integrity": "noop" + } +} diff --git a/spec/lib/vite/builder_spec.rb b/spec/lib/vite/builder_spec.rb new file mode 100644 index 0000000000..eb14f7b6a3 --- /dev/null +++ b/spec/lib/vite/builder_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::Builder do + subject { described_class.new(config:, logger:) } + + let(:config) { Struct.new(:build_command).new('echo "spec builder"') } + let(:buffer) { StringIO.new } + let(:logger) { Logger.new(buffer) } + + describe '#build' do + it 'executes the configured build_command and logs the output' do + subject.build + + buffer.rewind + + expect(buffer.read).to include('spec builder') + end + end + + describe '#build!' do + context 'when the command fails' do + let(:config) { Struct.new(:build_command).new('false') } + + it 'raises an error' do + expect { subject.build! }.to raise_error(Vite::Builder::BuildError) + end + end + end +end diff --git a/spec/lib/vite/config_spec.rb b/spec/lib/vite/config_spec.rb new file mode 100644 index 0000000000..200bda7251 --- /dev/null +++ b/spec/lib/vite/config_spec.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::Config do + subject { described_class.new } + + describe '#backend' do + it 'returns the full dev server URL' do + expect(subject.backend).to eq('http://localhost:5173') + end + end + + describe '#copy_from' do + let(:other) do + { + host: '127.0.0.1', + port: 3036, + https: true, + base_path: '/specs/', + tag_strategies: ['dev_server'], + manifest_path: 'public/specs/.vite/manifest.json', + manifest_assets_path: 'public/specs/.vite/manifest-assets.json', + auto_build: true, + build_command: 'echo "spec config"', + out_dir: 'public/specs', + cache_dir: 'tmp/.vite', + } + end + + before do + subject.copy_from(other) + end + + it 'copies server data from a hash' do + expect(subject.host).to eq(other[:host]) + expect(subject.port).to eq(other[:port]) + expect(subject.https?).to eq(other[:https]) + expect(subject.base_path).to eq(other[:base_path]) + end + + it 'copies manifest data from a hash' do + expect(subject.tag_strategies).to eq([:dev_server]) + expect(subject.manifest_path).to eq(other[:manifest_path]) + expect(subject.manifest_assets_path).to eq(other[:manifest_assets_path]) + end + + it 'copies build data from a hash' do + expect(subject.auto_build?).to eq(other[:auto_build]) + expect(subject.build_command).to eq(other[:build_command]) + end + + it 'copies asset management data from a hash' do + expect(subject.out_dir).to eq(other[:out_dir]) + expect(subject.cache_dir).to eq(other[:cache_dir]) + end + end +end diff --git a/spec/lib/vite/dev_server_spec.rb b/spec/lib/vite/dev_server_spec.rb new file mode 100644 index 0000000000..0e9ca111e9 --- /dev/null +++ b/spec/lib/vite/dev_server_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::DevServer do + subject { described_class.new(config:) } + + # port == 0 means that it will pick up any available port provided by the OS + let(:server) { TCPServer.new('localhost', 0) } + let!(:config) { Struct.new(:host, :port).new('localhost', server.addr[1]) } + + after { server.close } + + describe '#running?' do + context 'when the server is running' do + it 'returns true' do + expect(subject.running?).to be(true) + end + end + + context 'when the server is not running' do + it 'returns false' do + server.close + + expect(subject.running?).to be(false) + end + end + end +end diff --git a/spec/lib/vite/manifest_spec.rb b/spec/lib/vite/manifest_spec.rb new file mode 100644 index 0000000000..cc0636ea0f --- /dev/null +++ b/spec/lib/vite/manifest_spec.rb @@ -0,0 +1,142 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::Manifest do + subject { described_class.new(config:, logger:) } + + let(:config) do + Vite::Config.new({ + auto_build: false, + manifest_path: manifest_path, + manifest_assets_path: manifest_assets_path, + }) + end + + let(:logger) { Logger.new(StringIO.new) } + + let(:manifest_path) { manifest_file.to_path } + let(:manifest_assets_path) { manifest_assets_file.to_path } + + let(:manifest_file) { file_fixture('vite-manifest.json') } + let(:manifest_assets_file) { file_fixture('vite-manifest-assets.json') } + + describe '#fetch' do + it 'gets assets from manifest_assets' do + entry = subject.fetch('icons/main.png') + expect(entry[:file]).to eq('assets/main-abc.png') + expect(entry[:integrity]).to eq('abc-9') + end + + it 'gets locales' do + entry = subject.fetch('mastodon/locales/en-GB.json') + expect(entry[:file]).to eq('intl/en-GB.js') + expect(entry[:integrity]).to eq('abc-1') + end + + it 'gets virtual assets' do + entry = subject.fetch('polyfills', type: :virtual) + expect(entry[:file]).to eq('polyfills.js') + expect(entry[:integrity]).to eq('abc-8') + end + + it 'gets stylesheets' do + entry = subject.fetch('styles/entrypoints/inert.scss') + expect(entry[:file]).to eq('assets/inert-xyz.css') + expect(entry[:integrity]).to eq('abc-10') + end + + context 'when assets have dependencies' do + let(:entry) { subject.fetch('entrypoints/application.ts') } + + it 'gets the entrypoint' do + expect(entry[:file]).to eq('application.js') + expect(entry[:integrity]).to eq('abc-2') + end + + it 'resolves all the imports from bottom to top without duplicates' do + imports = subject.imports_for(entry).pluck(:file) + expect(imports).to eq(%w(no-deps.js dep-1-1.js dep-1-2.js dep-1.js dep-2.js)) + end + + it 'resolves all the stylesheets from bottom to top without duplicates' do + stylesheets = subject.stylesheets_for(entry).pluck(:file) + expect(stylesheets).to eq(%w(assets/dep-1-1.css assets/dep-1.css assets/dep-2.css assets/main.css assets/unlisted.css)) + end + + context 'when another entrypoint has the same dependencies' do + let(:entry) { subject.fetch('entrypoints/admin.ts') } + + it 'resolves all the imports from bottom to top without duplicates' do + imports = subject.imports_for(entry).pluck(:file) + expect(imports).to eq(%w(no-deps.js dep-1-1.js dep-1-2.js dep-1.js dep-2.js dep-3.js)) + end + + it 'resolves all the stylesheets from bottom to top without duplicates' do + stylesheets = subject.stylesheets_for(entry).pluck(:file) + expect(stylesheets).to eq(%w(assets/dep-1-1.css assets/dep-1.css assets/dep-2.css assets/main.css assets/unlisted.css)) + end + end + end + end + + describe 'fetch!' do + it 'raises an error on missing entries' do + expect { subject.fetch!('missing.ts') }.to raise_error(Vite::Manifest::MissingEntryError) + end + end + + describe '#load' do + it 'has one reference per entrypoint' do + subject.load + + entries = subject.entries + expect(entries.keys.count).to eq(6) + end + + it 'only keeps track of dependencies' do + subject.load + + pool = subject.pool + expect(pool.count).to eq(11) + # This file is present in the manifest but not referenced by any entrypoint + expect(pool.find { |entry| entry[:file] == 'package.js' }).to be_nil + end + + context 'when the manifest is missing' do + let(:manifest_path) { 'tmp/missing.json' } + + it 'raises an error' do + expect { subject.load }.to raise_error(Vite::Manifest::MissingManifestError) + end + + context 'when auto_build is enabled' do + let(:config) do + Vite::Config.new({ + auto_build: true, + manifest_path: manifest_path, + manifest_assets_path: manifest_assets_path, + }) + end + + let(:manifest_path) { Rails.root.join('tmp', 'vite-manifest.json') } + + let(:builder) { instance_double(Vite::Builder) } + + after do + FileUtils.rm_f(manifest_path) + end + + it 'builds on missing file' do + allow(Vite::Builder).to receive(:new).and_return(builder) + allow(builder).to receive(:build) do + # Create an empty file + File.write(manifest_path, '{}') + end + + expect { subject.load }.to_not raise_error + end + end + end + end +end diff --git a/spec/lib/vite/name_resolver_spec.rb b/spec/lib/vite/name_resolver_spec.rb new file mode 100644 index 0000000000..7407995921 --- /dev/null +++ b/spec/lib/vite/name_resolver_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::NameResolver do + subject { described_class.new(config:) } + + let(:config) { Struct.new(:base_path).new('/specs/') } + + describe '#full_path' do + context 'with an entrypoint' do + it 'returns full path' do + expect(subject.full_path('common.ts')).to eq('/specs/entrypoints/common.ts') + end + end + + context 'with a nested path' do + it 'returns full path' do + expect(subject.full_path('styles/application.scss')).to eq('/specs/styles/application.scss') + end + end + end + + describe '#entrypoint_path' do + context 'with an entrypoint' do + it 'returns entrypoint path' do + expect(subject.entrypoint_path('common.ts')).to eq('entrypoints/common.ts') + end + end + + context 'with a nested path' do + it 'returns entrypoint path' do + expect(subject.entrypoint_path('styles/application.scss')).to eq('styles/application.scss') + end + end + end + + describe '#bundle_path' do + context 'with an entrypoint' do + it 'returns bundle path' do + expect(subject.bundle_path('entrypoints/common.ts')).to eq('/specs/entrypoints/common.ts') + end + end + + context 'with a nested path' do + it 'returns bundle path' do + expect(subject.bundle_path('styles/application.scss')).to eq('/specs/styles/application.scss') + end + end + end +end diff --git a/spec/lib/vite/proxy_spec.rb b/spec/lib/vite/proxy_spec.rb new file mode 100644 index 0000000000..399f9bb241 --- /dev/null +++ b/spec/lib/vite/proxy_spec.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::Proxy do + include Rack::Test::Methods + + subject { described_class.new(stack, config:, dev_server:) } + + let(:app) { subject } + + let(:stack) { ->(_env) { [404, { 'content-type' => 'text/plain' }, ['Not Found']] } } + + let(:config) do + Vite::Config.new({ https: false, base_path: '/specs/' }) + end + + describe '#call' do + context 'when the dev server is running' do + let(:dev_server) do + Class.new do + def self.running? + true + end + end + end + + before do + # This represent Vite's dev server + stub_request(:get, "#{config.backend}/specs/app.js").to_return(status: 200, body: 'script') + end + + it 'proxies asset requests' do + get '/specs/app.js' + expect(last_response.ok?).to be(true) + expect(last_response.body).to eq('script') + end + + it 'does not proxy other requests' do + get '/accounts' + expect(last_response).to have_http_status(404) + end + end + + context 'when the dev server is not running' do + let(:dev_server) do + Class.new do + def self.running? + false + end + end + end + + it 'does not proxy asset requests' do + get '/specs/app.js' + expect(last_response).to have_http_status(404) + end + + it 'does not proxy other requests' do + get '/accounts' + expect(last_response).to have_http_status(404) + end + end + end +end diff --git a/spec/lib/vite/tagger_spec.rb b/spec/lib/vite/tagger_spec.rb new file mode 100644 index 0000000000..2b88af0912 --- /dev/null +++ b/spec/lib/vite/tagger_spec.rb @@ -0,0 +1,218 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Vite::Tagger do + include RSpec::Rails::HelperExampleGroup + + subject { described_class.new(config:, manifest:, dev_server:) } + + let(:manifest) { Vite::Manifest.new(config:, logger:) } + + let(:logger) { Logger.new(StringIO.new) } + + let(:manifest_path) { manifest_file.to_path } + let(:manifest_assets_path) { manifest_assets_file.to_path } + + let(:manifest_file) { file_fixture('vite-manifest.json') } + let(:manifest_assets_file) { file_fixture('vite-manifest-assets.json') } + + let(:nonce) { 'hoGYqEChtkb4m4rpaLV1ng==' } + + context 'with :dev_server strategy' do + let(:config) do + Vite::Config.new({ + auto_build: false, + manifest_path: manifest_path, + manifest_assets_path: manifest_assets_path, + base_path: '/packs-dev/', + tag_strategies: [:dev_server], + }) + end + + let(:dev_server) do + Class.new do + def self.running? + true + end + end + end + + describe '#vite_client_tag' do + it 'returns @vite/client tag' do + tag = subject.vite_client_tag(helper) + expect(tag.to_s).to eq('') + end + end + + describe '#vite_react_refresh_tag' do + let(:react_refresh) do + <<~JAVASCRIPT.html_safe + import RefreshRuntime from '/packs-dev/@react-refresh' + RefreshRuntime.injectIntoGlobalHook(window) + window.$RefreshReg$ = () => {} + window.$RefreshSig$ = () => (type) => type + window.__vite_plugin_react_preamble_installed__ = true + JAVASCRIPT + end + + it 'returns react-refresh tag' do + tag = subject.vite_react_refresh_tag(helper, nonce:) + expect(tag.to_s).to eq(helper.javascript_tag(react_refresh, type: :module, nonce:)) + end + end + + describe '#vite_javascript_tag' do + it 'generates a simple include tag' do + tag = subject.vite_javascript_tag(helper, 'application.ts') + expect(tag.to_s).to eq('') + end + end + + describe '#vite_stylesheet_tag' do + it 'generates a simple link tag' do + tag = subject.vite_stylesheet_tag(helper, 'styles/application.scss') + expect(tag.to_s).to eq('') + end + end + + describe '#vite_asset_path' do + it 'returns full path to asset' do + expect(subject.vite_asset_path(helper, 'icons/main.png')).to eq('/packs-dev/icons/main.png') + end + end + + describe '#vite_polyfills_tag' do + it 'returns an empty string' do + expect(subject.vite_polyfills_tag(helper)).to eq('') + end + end + + describe '#vite_preload_file_tag' do + it 'returns a preload link tag' do + tag = subject.vite_preload_file_tag(helper, 'mastodon/locales/en-GB.json') + expect(tag.to_s).to eq('') + end + end + end + + context 'with :manifest strategy' do + let(:config) do + Vite::Config.new({ + auto_build: false, + manifest_path: manifest_path, + manifest_assets_path: manifest_assets_path, + base_path: '/packs-dev/', + tag_strategies: [:manifest], + }) + end + + let(:dev_server) do + Class.new do + def self.running? + false + end + end + end + + describe '#vite_client_tag' do + it 'returns an empty string' do + expect(subject.vite_client_tag(helper)).to eq('') + end + end + + describe '#vite_react_refresh_tag' do + it 'returns an empty string' do + expect(subject.vite_react_refresh_tag(helper)).to eq('') + end + end + + describe '#vite_javascript_tag' do + let(:expected) do + '' \ + '' \ + '' \ + '' \ + '' \ + '' \ + '' \ + '' \ + '' \ + '' \ + '' + end + + it 'returns tags for the main javascript module and its dependencies' do + tag = subject.vite_javascript_tag(helper, 'application.ts') + expect(tag.to_s).to eq(expected) + end + end + + describe '#vite_stylesheet_tag' do + it 'returns stylesheet link tag to the bundled asset' do + tag = subject.vite_stylesheet_tag(helper, 'styles/entrypoints/inert.scss') + expect(tag.to_s).to eq('') + end + end + + describe '#vite_asset_path' do + it 'returns path to the bundled asset' do + expect(subject.vite_asset_path(helper, 'icons/main.png')).to eq('/packs-dev/assets/main-abc.png') + end + end + + describe '#vite_polyfills_tag' do + it 'returns include tag to polyfill module' do + tag = subject.vite_polyfills_tag(helper) + expect(tag.to_s).to eq('') + end + end + + describe '#vite_preload_file_tag' do + it 'returns a preload link tag to bundled asset' do + tag = subject.vite_preload_file_tag(helper, 'mastodon/locales/en-GB.json') + expect(tag.to_s).to eq('') + end + end + end + + context 'with both strategies' do + let(:config) do + Vite::Config.new({ + auto_build: false, + manifest_path: manifest_path, + manifest_assets_path: manifest_assets_path, + base_path: '/packs-dev/', + tag_strategies: [:dev_server, :manifest], + }) + end + + context 'when the dev server is running' do + let(:dev_server) do + Class.new do + def self.running? + true + end + end + end + + it 'uses :dev_server strategy' do + expect(subject.vite_client_tag(helper)).to_not be_empty + end + end + + context 'when the dev server is not running' do + let(:dev_server) do + Class.new do + def self.running? + false + end + end + end + + it 'uses :manifest strategy' do + expect(subject.vite_client_tag(helper)).to be_empty + end + end + end +end diff --git a/vite.config.mts b/vite.config.mts index 8b2cefb8f5..8bc4882894 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -21,7 +21,6 @@ import svgr from 'vite-plugin-svgr'; import { MastodonAssetsManifest } from './config/vite/plugin-assets-manifest'; import { MastodonThemes } from './config/vite/plugin-mastodon-themes'; -import { MastodonNameLookup } from './config/vite/plugin-name-lookup'; import { MastodonServiceWorkerChunkPaths } from './config/vite/plugin-sw-chunk-paths'; import { MastodonServiceWorkerLocales } from './config/vite/plugin-sw-locales'; @@ -105,10 +104,14 @@ export const config: UserConfigFnPromise = async ({ mode, command }) => { // but it needs to be scoped to the whole domain 'Service-Worker-Allowed': '/', }, - hmr: { + hmr: true, + ws: { // Forcing the protocol to be insecure helps if you are proxying your dev server with SSL, // because Vite still tries to connect to localhost. protocol: 'ws', + // The client can't connect through the main Rails app proxy since it doesn't support + // WebSockets. It needs to connect directly to Vite's server, that's why we set the port again + clientPort: 3036, }, port: 3036, }, @@ -202,7 +205,6 @@ export const config: UserConfigFnPromise = async ({ mode, command }) => { (visualizer({ template: process.env.CI ? 'raw-data' : 'treemap', }) as PluginOption), - MastodonNameLookup(), ], } satisfies UserConfig; }; From a36492954b508ddc2453253bab34f5061c2770ed Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Aug 2026 14:12:02 +0200 Subject: [PATCH 04/13] =?UTF-8?q?Fix=20navigation=20switching=20to=20user?= =?UTF-8?q?=20=E2=80=9CAccount=E2=80=9D=20category=20when=20rejecting=20or?= =?UTF-8?q?=20accepting=20appeal=20(#40026)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/disputes/appeals_controller.rb | 4 ++-- spec/controllers/admin/disputes/appeals_controller_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/disputes/appeals_controller.rb b/app/controllers/admin/disputes/appeals_controller.rb index 7c70603e23..ccdbeda08d 100644 --- a/app/controllers/admin/disputes/appeals_controller.rb +++ b/app/controllers/admin/disputes/appeals_controller.rb @@ -14,7 +14,7 @@ class Admin::Disputes::AppealsController < Admin::BaseController authorize @appeal, :approve? log_action :approve, @appeal ApproveAppealService.new.call(@appeal, current_account) - redirect_to disputes_strike_path(@appeal.strike) + redirect_to admin_disputes_strike_path(@appeal.strike) end def reject @@ -22,7 +22,7 @@ class Admin::Disputes::AppealsController < Admin::BaseController log_action :reject, @appeal @appeal.reject!(current_account) UserMailer.appeal_rejected(@appeal.account.user, @appeal).deliver_later - redirect_to disputes_strike_path(@appeal.strike) + redirect_to admin_disputes_strike_path(@appeal.strike) end private diff --git a/spec/controllers/admin/disputes/appeals_controller_spec.rb b/spec/controllers/admin/disputes/appeals_controller_spec.rb index 6b955dd803..a4c08936d7 100644 --- a/spec/controllers/admin/disputes/appeals_controller_spec.rb +++ b/spec/controllers/admin/disputes/appeals_controller_spec.rb @@ -40,7 +40,7 @@ RSpec.describe Admin::Disputes::AppealsController do emails = capture_emails { subject } expect(response) - .to redirect_to(disputes_strike_path(appeal.strike)) + .to redirect_to(admin_disputes_strike_path(appeal.strike)) expect(target_account.reload) .to_not be_suspended @@ -64,7 +64,7 @@ RSpec.describe Admin::Disputes::AppealsController do emails = capture_emails { subject } expect(response) - .to redirect_to(disputes_strike_path(appeal.strike)) + .to redirect_to(admin_disputes_strike_path(appeal.strike)) expect(emails.size) .to eq(1) From 72235a9d619120b9152296c82aab1e5a92287ac3 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Aug 2026 16:13:45 +0200 Subject: [PATCH 05/13] Change `UpdateAccountSummariesToVersion3` migration to minimize downtime (#40027) --- ...3_update_account_summaries_to_version_3.rb | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/db/migrate/20260728145403_update_account_summaries_to_version_3.rb b/db/migrate/20260728145403_update_account_summaries_to_version_3.rb index 748ba16a5b..a7a1ae4296 100644 --- a/db/migrate/20260728145403_update_account_summaries_to_version_3.rb +++ b/db/migrate/20260728145403_update_account_summaries_to_version_3.rb @@ -2,11 +2,26 @@ class UpdateAccountSummariesToVersion3 < ActiveRecord::Migration[8.0] def up - reapplication_global_follow_recommendations_v1 do - drop_view :account_summaries, materialized: true - create_view :account_summaries, version: 3, materialized: { no_data: true } - safety_assured { add_index :account_summaries, :account_id, unique: true } - end + # First, create a temporary `account_summaries` and populate it. + # This is the most expensive part. + create_view :tmp_account_summaries, + sql_definition: Scenic::Definition.new(:account_summaries, 3).to_sql, + materialized: true + + rename_index :account_summaries, :index_account_summaries_on_account_id, :tmp_index_account_summaries_on_account_id + safety_assured { add_index :tmp_account_summaries, :account_id, name: :index_account_summaries_on_account_id, unique: true } + + # Then, drop `global_follow_recommendations` and `account_summaries` + # Downtime starts here but should hopefuly be pretty short. + drop_view :global_follow_recommendations, materialized: true + drop_view :account_summaries, materialized: true + + # Then rename `tmp_account_summaries` to `account_summaries` + safety_assured { execute('ALTER MATERIALIZED VIEW tmp_account_summaries RENAME TO account_summaries') } + + # Then re-create `global_follow_recommendations`, populating it + create_view :global_follow_recommendations, version: 1, materialized: true + safety_assured { add_index :global_follow_recommendations, :account_id, unique: true } end def down From dc6b681f2d6946e4da8cfa0ed882ce9e9be93627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Hern=C3=A1ndez?= Date: Mon, 3 Aug 2026 17:17:31 +0200 Subject: [PATCH 06/13] Add OTel span attribute to deprecated endpoints (#40030) --- .../concerns/deprecation_concern.rb | 5 ++ .../concerns/deprecation_concern_spec.rb | 54 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 spec/controllers/concerns/deprecation_concern_spec.rb diff --git a/app/controllers/concerns/deprecation_concern.rb b/app/controllers/concerns/deprecation_concern.rb index ad8de724a1..b9c7d286f0 100644 --- a/app/controllers/concerns/deprecation_concern.rb +++ b/app/controllers/concerns/deprecation_concern.rb @@ -11,6 +11,11 @@ module DeprecationConcern before_action(**kwargs) do response.headers['Deprecation'] = deprecation_timestamp response.headers['Sunset'] = sunset if sunset + + span = OpenTelemetry::Trace.current_span + next unless span&.recording? + + span.set_attribute('app.endpoint.deprecated', true) end end end diff --git a/spec/controllers/concerns/deprecation_concern_spec.rb b/spec/controllers/concerns/deprecation_concern_spec.rb new file mode 100644 index 0000000000..d27f09da03 --- /dev/null +++ b/spec/controllers/concerns/deprecation_concern_spec.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe DeprecationConcern do + render_views + + controller(ApplicationController) do + include DeprecationConcern # rubocop:disable RSpec/DescribedClass + + deprecate_api '2026-08-03', sunset: '2026-10-01' + + def deprecated + render plain: 'deprecated' + end + end + + before do + routes.draw do + get 'deprecated' => 'anonymous#deprecated' + end + end + + context 'with response headers' do + it 'adds Deprecation header' do + get :deprecated + + expect(response.body).to eq('deprecated') + expect(response.headers['Deprecation']).to eq('@1785715200') + end + + it 'adds Sunset header' do + get :deprecated + + expect(response.headers['Sunset']).to eq('Thu, 01 Oct 2026 00:00:00 GMT') + end + end + + context 'with OpenTelemetry traces' do + let(:span) { instance_double(OpenTelemetry::Trace::Span) } + + before do + allow(OpenTelemetry::Trace).to receive(:current_span).and_return(span) + allow(span).to receive(:recording?).and_return(true) + allow(span).to receive(:set_attribute) + end + + it 'adds a deprecation attribute request span' do + get :deprecated + + expect(span).to have_received(:set_attribute).with('app.endpoint.deprecated', true) + end + end +end From 7ecff7f0ad0204435afff45ce1f82e8a9f0c5652 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Aug 2026 17:17:52 +0200 Subject: [PATCH 07/13] Add back erroneously removed index on `account_summaries` (#40029) --- db/schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 69310f47e7..e4d8d851a8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2026_07_28_145507) do +ActiveRecord::Schema[8.1].define(version: 2026_08_03_140751) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -1636,6 +1636,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_07_28_145507) do WHERE ((accounts.suspended_at IS NULL) AND (accounts.requested_deletion_at IS NULL) AND (accounts.silenced_at IS NULL) AND (accounts.moved_to_account_id IS NULL) AND (accounts.discoverable = true) AND (accounts.locked = false)) GROUP BY accounts.id; SQL + add_index "account_summaries", ["account_id", "language", "sensitive"], name: "idx_on_account_id_language_sensitive_250461e1eb" add_index "account_summaries", ["account_id"], name: "index_account_summaries_on_account_id", unique: true create_view "global_follow_recommendations", materialized: true, sql_definition: <<-SQL From 564bab55df621632146ac6a9d15ad65cfe4165ba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:27:04 +0200 Subject: [PATCH 08/13] Update crowdin/github-action digest to c7af9bc (#40023) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/crowdin-download-stable.yml | 2 +- .github/workflows/crowdin-download.yml | 2 +- .github/workflows/crowdin-upload.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/crowdin-download-stable.yml b/.github/workflows/crowdin-download-stable.yml index d68bd80f2b..2eef46f73e 100644 --- a/.github/workflows/crowdin-download-stable.yml +++ b/.github/workflows/crowdin-download-stable.yml @@ -24,7 +24,7 @@ jobs: # Download the translation files from Crowdin - name: crowdin action - uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2 + uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2 with: upload_sources: false upload_translations: false diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml index acd80085a0..e221fd647e 100644 --- a/.github/workflows/crowdin-download.yml +++ b/.github/workflows/crowdin-download.yml @@ -26,7 +26,7 @@ jobs: # Download the translation files from Crowdin - name: crowdin action - uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2 + uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2 with: upload_sources: false upload_translations: false diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml index 2554df51a1..08858de77d 100644 --- a/.github/workflows/crowdin-upload.yml +++ b/.github/workflows/crowdin-upload.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - name: crowdin action - uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2 + uses: crowdin/github-action@c7af9bc98b01694653031fef2a0dc6c7888ce9bc # v2 with: upload_sources: true upload_translations: false From d7c7cc0c5216690ef189c121d08ff9b347fde312 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 3 Aug 2026 12:02:00 -0400 Subject: [PATCH 09/13] Update playwright to version 1.62 (#40019) --- Gemfile.lock | 2 +- package.json | 2 +- yarn.lock | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9105076482..aa9a009b2d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -595,7 +595,7 @@ GEM pg (1.6.3) pghero (3.8.0) activerecord (>= 7.2) - playwright-ruby-client (1.61.0) + playwright-ruby-client (1.62.0) base64 concurrent-ruby (>= 1.1.6) mime-types (>= 3.0) diff --git a/package.json b/package.json index 6b4a5fb7ac..8906e31ad9 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "msw": "^2.12.1", "msw-storybook-addon": "^2.0.6", "oxfmt": "^0.47.0", - "playwright": "^1.61.1", + "playwright": "^1.62.1", "storybook": "^10.3.0", "stylelint": "^17.0.0", "stylelint-config-standard-scss": "^17.0.0", diff --git a/yarn.lock b/yarn.lock index 893525403f..cb1ac68c3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3048,7 +3048,7 @@ __metadata: msw-storybook-addon: "npm:^2.0.6" oxfmt: "npm:^0.47.0" path-complete-extname: "npm:^1.0.0" - playwright: "npm:^1.61.1" + playwright: "npm:^1.62.1" postcss-preset-env: "npm:^11.0.0" prop-types: "npm:^15.8.1" punycode: "npm:^2.3.0" @@ -11278,27 +11278,27 @@ __metadata: languageName: node linkType: hard -"playwright-core@npm:1.61.1": - version: 1.61.1 - resolution: "playwright-core@npm:1.61.1" +"playwright-core@npm:1.62.1": + version: 1.62.1 + resolution: "playwright-core@npm:1.62.1" bin: playwright-core: cli.js - checksum: 10c0/c28896ba82a602182e240ed4f9c467fb0dd9cb57d510f8aba9f25183fe1cde3a0105725a29baffa4157fe885bbb11e228032a2aad0424111584fde45303f07bd + checksum: 10c0/a37d0f03bb73364cfd0eba704c4b3359b609c4779ae2649a88d8e2b3a29c7357dfcc58bdcf0cb68ddffdef7687abf78902c8356e89f189682c7e19be38e108f0 languageName: node linkType: hard -"playwright@npm:^1.61.1": - version: 1.61.1 - resolution: "playwright@npm:1.61.1" +"playwright@npm:^1.62.1": + version: 1.62.1 + resolution: "playwright@npm:1.62.1" dependencies: fsevents: "npm:2.3.2" - playwright-core: "npm:1.61.1" + playwright-core: "npm:1.62.1" dependenciesMeta: fsevents: optional: true bin: playwright: cli.js - checksum: 10c0/cea1bc4d2a64ec3ef683891606774029da7b8a8036ed98332565cec2f8e89549ca1fab9a89fbfba4e08e27e0d7e7d148031e965af66d5ff97bb3c34058cfcad0 + checksum: 10c0/4d3522cd46325f50c46f8874d31f70d036f6983228a9f8b9d68fc249e4c17464edcd97cc4adfbb24e712d1829c1386d3bc24e17f58a1ced94e7c423300c21845 languageName: node linkType: hard From 03a7d80b5f7e361b8c7e72195c969d775d37dc1c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 16:04:27 +0000 Subject: [PATCH 10/13] Update dependency aws-sdk-s3 to v1.228.2 (#40005) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index aa9a009b2d..98cca79d97 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,7 +111,7 @@ GEM aws-sdk-kms (1.130.0) aws-sdk-core (~> 3, >= 3.254.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.228.1) + aws-sdk-s3 (1.228.2) aws-sdk-core (~> 3, >= 3.254.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) From 4c0a6b5bb1fb8c980be8a622dcad0710511afdfd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 16:04:32 +0000 Subject: [PATCH 11/13] Update dependency axios to v1.19.0 (#40006) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/yarn.lock b/yarn.lock index cb1ac68c3e..b9da1ffd2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5871,14 +5871,14 @@ __metadata: linkType: hard "axios@npm:^1.4.0": - version: 1.18.1 - resolution: "axios@npm:1.18.1" + version: 1.19.0 + resolution: "axios@npm:1.19.0" dependencies: follow-redirects: "npm:^1.16.0" - form-data: "npm:^4.0.5" + form-data: "npm:^4.0.6" https-proxy-agent: "npm:^5.0.1" proxy-from-env: "npm:^2.1.0" - checksum: 10c0/9d9378a3af0d0ad730a52ad9d15ec7201f3926ad6e7e8bbffc5ae21ca2835ad11d1d9598698f5dd9718917486039f55ea1d7dc23d8e44fa827a55cc3262c02fc + checksum: 10c0/559fe7d51291787def61566a3db78b87510c8faf9c8a8c006d9d8b933808628ff0d8eca7756b40ae25e07da96d946c68c1ffba3da9075ed0b5d3661801d76869 languageName: node linkType: hard @@ -8138,16 +8138,16 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^4.0.5": - version: 4.0.5 - resolution: "form-data@npm:4.0.5" +"form-data@npm:^4.0.6": + version: 4.0.6 + resolution: "form-data@npm:4.0.6" dependencies: asynckit: "npm:^0.4.0" combined-stream: "npm:^1.0.8" es-set-tostringtag: "npm:^2.1.0" - hasown: "npm:^2.0.2" - mime-types: "npm:^2.1.12" - checksum: 10c0/dd6b767ee0bbd6d84039db12a0fa5a2028160ffbfaba1800695713b46ae974a5f6e08b3356c3195137f8530dcd9dfcb5d5ae1eeff53d0db1e5aad863b619ce3b + hasown: "npm:^2.0.4" + mime-types: "npm:^2.1.35" + checksum: 10c0/43947a77bf0ff45c6ceed789778982d47a3f3e720a74b71721174ebf3310a5f1a8be1d6b38a3ee3688e8a18a2c4273073ec0844cd37efda3eaf46d41c9c318ff languageName: node linkType: hard @@ -8556,12 +8556,12 @@ __metadata: languageName: node linkType: hard -"hasown@npm:^2.0.2": - version: 2.0.2 - resolution: "hasown@npm:2.0.2" +"hasown@npm:^2.0.2, hasown@npm:^2.0.4": + version: 2.0.4 + resolution: "hasown@npm:2.0.4" dependencies: function-bind: "npm:^1.1.2" - checksum: 10c0/3769d434703b8ac66b209a4cca0737519925bbdb61dd887f93a16372b14694c63ff4e797686d87c90f08168e81082248b9b028bad60d4da9e0d1148766f56eb9 + checksum: 10c0/2d8de939e270b70618f8cebb69746620db10617dbb495bc66ddad326955ea24d3ca4af133aff3eb7c1853e0218f867bc2b050ec26fe02e3aea58f880ffc5e506 languageName: node linkType: hard @@ -10120,7 +10120,7 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^2.1.12": +"mime-types@npm:^2.1.35": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: From b026b2395c6c3a024b60bd8c080b67538432d1aa Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Aug 2026 19:49:00 +0200 Subject: [PATCH 12/13] Fix forgotten migration file (#40034) --- ...0751_add_back_languages_index_to_account_summaries.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20260803140751_add_back_languages_index_to_account_summaries.rb diff --git a/db/migrate/20260803140751_add_back_languages_index_to_account_summaries.rb b/db/migrate/20260803140751_add_back_languages_index_to_account_summaries.rb new file mode 100644 index 0000000000..2a0fcabec8 --- /dev/null +++ b/db/migrate/20260803140751_add_back_languages_index_to_account_summaries.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddBackLanguagesIndexToAccountSummaries < ActiveRecord::Migration[8.1] + disable_ddl_transaction! + + def change + add_index :account_summaries, [:account_id, :language, :sensitive], algorithm: :concurrently + end +end From f8cb997b98ba219d110839b4178ee9b469ff944b Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Aug 2026 20:04:50 +0200 Subject: [PATCH 13/13] Add index on `target_account_id` to `follow_requests` (#40033) --- ...172525_add_target_account_index_to_follow_requests.rb | 9 +++++++++ db/schema.rb | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb diff --git a/db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb b/db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb new file mode 100644 index 0000000000..bf22c54134 --- /dev/null +++ b/db/migrate/20260803172525_add_target_account_index_to_follow_requests.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddTargetAccountIndexToFollowRequests < ActiveRecord::Migration[8.1] + disable_ddl_transaction! + + def change + add_index :follow_requests, [:target_account_id, :account_id], algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index e4d8d851a8..0d6c703d99 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2026_08_03_140751) do +ActiveRecord::Schema[8.1].define(version: 2026_08_03_172525) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -632,6 +632,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_03_140751) do t.datetime "updated_at", precision: nil, null: false t.string "uri" t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true + t.index ["target_account_id", "account_id"], name: "index_follow_requests_on_target_account_id_and_account_id" end create_table "follows", force: :cascade do |t|