Skip to content

Commit

Permalink
Merge branch 'RetroAchievements:master' into connectapi-allprogress-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
drisc authored Dec 30, 2024
2 parents aeee9a5 + 132c31a commit 8cef8ae
Show file tree
Hide file tree
Showing 52 changed files with 975 additions and 263 deletions.
25 changes: 18 additions & 7 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,24 @@ rules:
newline-before-return: error

# prevent accidental imports from libraries that build the Base* components
no-restricted-imports:
- error
- patterns:
- '@testing-library/react'
- '@radix-ui/*'
- 'sonner'
- 'vaul'
no-restricted-imports: [
'error',
{
patterns: [
'@testing-library/react',
'@radix-ui/*',
'sonner',
'vaul',
],
paths: [
{
name: '@inertiajs/react',
importNames: ['Head'],
message: 'Use @/common/components/SEO instead.'
}
]
}
]

# don't enforce explicit-any rule in test files or autogenerated files
overrides:
Expand Down
53 changes: 53 additions & 0 deletions app/Community/Actions/FormatLegacyCommentPayloadAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace App\Community\Actions;

class FormatLegacyCommentPayloadAction
{
// Only allow `href` and `title` attributes. Anything else is malicious.
private const LINK_PATTERN = '/<a\s+href=[\'"](?:https?:\/\/[^\/]+)?\/game\/[\w\-]+\/hashes[\'"](?:\s+title=[\'"][^"\']*[\'"])?\s*>[^<>]*<\/a>/i';

public function execute(string $payload, bool $isTicketComment): string
{
// Replace all <br /> tags with newlines for consistent processing.
$text = str_replace('<br />', "\n", $payload);

if (!$isTicketComment) {
return $this->formatText($text);
}

// Store original link tags with angle brackets in markers.
$marker = '@@LINK_PLACEHOLDER_' . uniqid() . '_@@';
$links = [];

// Replace each link with a marker, storing the full HTML tag.
$text = preg_replace_callback(self::LINK_PATTERN, function ($match) use (&$links, $marker) {
$links[] = $match[0];

return $marker . (count($links) - 1) . $marker;
}, $text);

// Process the text and restore links.
$text = $this->formatText($text);
foreach ($links as $i => $link) {
$text = str_replace($marker . $i . $marker, $link, $text);
}

return $text;
}

private function formatText(string $text): string
{
// Convert special characters to HTML entities.
$text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5);

// Convert newlines to <br /> tags and normalize multiple line breaks.
return preg_replace(
'/<br\s*\/?>(\s*<br\s*\/?>)+/',
'<br /><br />',
nl2br($text)
);
}
}
3 changes: 3 additions & 0 deletions app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public function share(Request $request): array
] : null,

'config' => [
'app' => [
'url' => config('app.url'),
],
'services' => [
'patreon' => ['userId' => config('services.patreon.user_id')],
],
Expand Down
6 changes: 4 additions & 2 deletions app/Platform/Services/TicketViewService.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ public function load(Ticket $ticket): void
$this->ticketNotes = nl2br($ticket->ReportNotes);
foreach ($ticket->achievement->game->hashes as $hash) {
if (stripos($this->ticketNotes, $hash->md5) !== false) {
$replacement = '<a href="/linkedhashes.php?g=' . $ticket->achievement->game->id . '" title="' .
attributeEscape($hash->name) . '">' . $hash->md5 . '</a>';
$hashesRoute = route('game.hashes.index', ['game' => $ticket->achievement->game]);
$escapedHashName = attributeEscape($hash->name);
$replacement = "<a href='{$hashesRoute}' title='{$escapedHashName}'>{$hash->md5}</a>";

$this->ticketNotes = str_ireplace($hash->md5, $replacement, $this->ticketNotes);
}
}
Expand Down
2 changes: 2 additions & 0 deletions lang/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,10 @@
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "Wir bieten <1>die Emulatoren</1>, du brauchst nur <2>die Spiele</2>. Von der Atari 2600 bis PlayStation 2 und alles dazwischen.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "Wir freuen uns, dich hier begrüßen zu dürfen! Wir wissen, dass du vielleicht einige Fragen zum Hardcore-Modus, RetroPoints (weiße Punkte), Subsets oder Emulatoren hast. Keine Sorge, wir haben alles im Griff! Schau dir unsere <1>umfassende FAQ</1> an, um zu starten. Viel Spaß beim Spielen!",
"Getting Started": "Erste Schritte",
"Remember my view": "Meine Ansicht speichern",
"Moderation Comments - {{user}}": "Moderationskommentare - {{user}}",
"Moderation Comments": "Moderationskommentare",
"Columns": "Spalten",
"supportedGameFilesCountLabel_one": "Aktuell gibt es <1>{{count, number}}</1> registrierten Spieldatei-Hash, welcher für dieses Spiel unterstützt wird.",
"supportedGameFilesCountLabel_other": "Aktuell gibt es <1>{{count, number}}</1> registrierte Spieldatei-Hashes, welche für dieses Spiel unterstützt werden.",
"userCount_one": "<1>{{userCount, number}}</1> Benutzer ist gerade online.",
Expand Down
2 changes: 2 additions & 0 deletions lang/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,10 @@
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!",
"Getting Started": "Getting Started",
"Remember my view": "Remember my view",
"Moderation Comments - {{user}}": "Moderation Comments - {{user}}",
"Moderation Comments": "Moderation Comments",
"Columns": "Columns",
"supportedGameFilesCountLabel_one": "There is currently <1>{{count, number}}</1> supported game file hash registered for this game.",
"supportedGameFilesCountLabel_other": "There are currently <1>{{count, number}}</1> supported game file hashes registered for this game.",
"userCount_one": "<1>{{userCount, number}}</1> user is currently online.",
Expand Down
2 changes: 2 additions & 0 deletions lang/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,10 @@
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "Proporcionamos <1>los emuladores</1>, solo necesitas <2>los juegos</2>. Desde la Atari 2600 hasta la PlayStation 2, y todas las que hay en mitad.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "¡Nos emociona tenerte aquí! Sabemos que podrías tener preguntas sobre el modo hardcore, los RetroPoints (puntos blancos), los subsets o qué emuladores son los mejores para usar. ¡No te preocupes, estamos aquí para ayudarte! Consulta nuestras <1>preguntas frecuentes</1> para comenzar. ¡Diviértete jugando!",
"Getting Started": "Empezando",
"Remember my view": "Recordar mi vista",
"Moderation Comments - {{user}}": "Comentarios de moderación - {{user}}",
"Moderation Comments": "Comentarios de moderación",
"Columns": "Columnas",
"supportedGameFilesCountLabel_one": "Actualmente <1>{{count, number}}</1> registro de hash de archivo soportado registrado para este juego.",
"supportedGameFilesCountLabel_other": "Actualmente hay registrados <1>{{count, number}}</1> hashes de archivos soportados registrados para este juego.",
"userCount_one": "Hay <1>{{userCount, number}}</1> usuario en línea.",
Expand Down
30 changes: 16 additions & 14 deletions lang/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,22 +476,24 @@
"Special Filters": "Filtres Spéciaux",
"All {{systemName}} Games": "Tous les Jeux {{systemName}}",
"{{hubTitle}} (Hub)": "{{hubTitle}} (Hub)",
"Related Hubs": "Related Hubs",
"Manage": "Manage",
"Related Hubs": "Hubs en commun",
"Manage": "Gérer",
"Hub": "Hub",
"Links": "Links",
"No related hubs.": "No related hubs.",
"All Hubs": "All Hubs",
"Links": "Liens",
"No related hubs.": "Aucun hub en commun.",
"All Hubs": "Tous les Hubs",
"Go to previous news page": "Aller à la page précédente des actualités",
"Go to next news page": "Aller à la page suivante des actualités",
"Swipe to view more": "Glisser pour voir plus",
"Games are now grouped by system": "Games are now grouped by system",
"Games are no longer grouped": "Games are no longer grouped",
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!",
"Getting Started": "Getting Started",
"Moderation Comments - {{user}}": "Moderation Comments - {{user}}",
"Moderation Comments": "Moderation Comments",
"Games are now grouped by system": "Les jeux sont à présent groupés par système",
"Games are no longer grouped": "Les jeux ne sont plus groupés",
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "Nous fournissons <1>les émulateurs</1>, vous avez juste besoin <2>des jeux</2>. De l'Atari 2600 jusqu'à la PlayStation 2, et tout ce qui se trouve entre les deux.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "Nous sommes ravis de vous accueillir ! Nous savons que vous devez avoir quelques questions à propos du mode hardcore, des RetroPoints (points blancs), des subsets, ou quel émulateur utiliser. Pas de panique, nous avons ce qu'il vous faut ! Lisez notre <1>FAQ compréhensive</1> pour commencer. Amusez-vous bien !",
"Getting Started": "Premiers pas",
"Remember my view": "Mémoriser mon affichage",
"Moderation Comments - {{user}}": "Commentaires de la Modération - {{user}}",
"Moderation Comments": "Commentaires de la Modération",
"Columns": "Colonnes",
"supportedGameFilesCountLabel_one": "Il y a actuellement <1>{{count, number}}</1> empreinte de fichier de jeu pris en charge enregistrée pour ce jeu.",
"supportedGameFilesCountLabel_other": "Il y a actuellement <1>{{count, number}}</1> empreintes de fichiers de jeu pris en charge enregistrées pour ce jeu.",
"userCount_one": "<1>{{userCount, number}}</1> utilisateur est actuellement en ligne.",
Expand All @@ -508,6 +510,6 @@
"playerCount_other": "{{val, number}} joueurs",
"playersInGameLabel_one": "En train de regarder <1>{{visible, number}}</1> sur <2>{{total, number}}</2> joueur en train de jouer.",
"playersInGameLabel_other": "En train de regarder <1>{{visible, number}}</1> sur <2>{{total, number}}</2> joueurs en train de jouer.",
"rowGroupAriaLabel_one": "{{systemName}} group with {{val, number}} game",
"rowGroupAriaLabel_other": "{{systemName}} group with {{val, number}} games"
"rowGroupAriaLabel_one": "Groupe {{systemName}} avec {{val, number}} jeu",
"rowGroupAriaLabel_other": "Groupe {{systemName}} avec {{val, number}} jeux"
}
2 changes: 2 additions & 0 deletions lang/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,10 @@
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "My dostarczamy <1>emulatory</1>, Ty jedynie potrzebujesz <2>gier</2>. Od Atari 2600 do PlayStation 2 i wszystko pomiędzy nimi.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "Cieszymy się, że tu jesteś! Wiemy, że możesz mieć trochę pytań o tryb Hardcore, RetroPoints (białe punkty), podzestawy, lub których emulatorów używać. Nie martw się, we wszystkim pomożemy! Odwiedź nasze <1>obszerne FAQ</1>, aby rozpocząć. Miłego grania!",
"Getting Started": "Pierwsze kroki",
"Remember my view": "Remember my view",
"Moderation Comments - {{user}}": "Komentarze moderacji - {{user}}",
"Moderation Comments": "Komentarze moderacji",
"Columns": "Columns",
"supportedGameFilesCountLabel_one": "Obecnie jest <1>{{count, number}}</1> zarejestrowany hash pliku gry",
"supportedGameFilesCountLabel_few": "Obecnie są <1>{{count, number}}</1> zarejestrowane hashe plików gry",
"supportedGameFilesCountLabel_many": "Obecnie jest <1>{{count, number}}</1> zarejestrowanych hashów plików gry",
Expand Down
22 changes: 12 additions & 10 deletions lang/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,13 @@
"Awards - Exact": "Prêmios - Exato",
"Special Filters": "Filtros Especiais",
"All {{systemName}} Games": "Todos os Jogos de {{systemName}}",
"{{hubTitle}} (Hub)": "{{hubTitle}} (Hub)",
"Related Hubs": "Related Hubs",
"Manage": "Manage",
"Hub": "Hub",
"{{hubTitle}} (Hub)": "{{hubTitle}} (Centro)",
"Related Hubs": "Centros Relacionados",
"Manage": "Gerenciar",
"Hub": "Centro",
"Links": "Links",
"No related hubs.": "No related hubs.",
"All Hubs": "All Hubs",
"No related hubs.": "Nenhum centro relacionado.",
"All Hubs": "Todos os Centros",
"Go to previous news page": "Ir para a página de notícias anterior",
"Go to next news page": "Ir para a próxima página de notícias",
"Swipe to view more": "Arraste para ver mais",
Expand All @@ -490,8 +490,10 @@
"We provide <1>the emulators</1>, you just need <2>the games</2>. From Atari 2600 to PlayStation 2, and everything in between.": "Nós fornecemos <1>os emuladores</1>, você só precisará <2>dos jogos</2>. Desde o Atari 2600 até o PlayStation 2, e tudo entre os dois.",
"We're excited to have you here! We know you might have some questions about hardcore mode, RetroPoints (white points), subsets, or which emulators to use. Don't worry, we've got you covered! Check out our <1>comprehensive FAQ</1> to get started. Happy gaming!": "Estamos felizes de tê-lo aqui! Sabemos que você pode ter algumas dúvidas sobre o modo hardcore, RetroPoints (pontos em branco), subconjuntos, ou quais emuladores usar. Não se preocupe, vamos ajudá-lo! Confira o nosso <1>extensivo FAQ</1> para começar. Boa jogatina!",
"Getting Started": "Introdução",
"Moderation Comments - {{user}}": "Moderation Comments - {{user}}",
"Moderation Comments": "Moderation Comments",
"Remember my view": "Lembrar meus filtros",
"Moderation Comments - {{user}}": "Comentários da Moderação - {{user}}",
"Moderation Comments": "Comentários da Moderação",
"Columns": "Colunas",
"supportedGameFilesCountLabel_one": "Atualmente existe <1>{{count, number}}</1> hash de arquivo de jogo suportado registrado para este jogo.",
"supportedGameFilesCountLabel_other": "Atualmente existem <1>{{count, number}}</1> hashes de arquivos de jogo suportados registrados para este jogo.",
"userCount_one": "<1>{{userCount, number}}</1> usuário está atualmente online.",
Expand All @@ -508,6 +510,6 @@
"playerCount_other": "{{val, number}} jogadores",
"playersInGameLabel_one": "Vendo <1>{{visible, number}}</1> de <2>{{total, number}}</2> jogador no jogo.",
"playersInGameLabel_other": "Vendo <1>{{visible, number}}</1> de <2>{{total, number}}</2> jogadores no jogo.",
"rowGroupAriaLabel_one": "{{systemName}} group with {{val, number}} game",
"rowGroupAriaLabel_other": "{{systemName}} group with {{val, number}} games"
"rowGroupAriaLabel_one": "{{systemName}} grupo com {{val, number}} jogo",
"rowGroupAriaLabel_other": "{{systemName}} grupo com {{val, number}} jogos"
}
Loading

0 comments on commit 8cef8ae

Please sign in to comment.