Skip to content

Commit

Permalink
Fix relative emote urls
Browse files Browse the repository at this point in the history
  • Loading branch information
RblSb committed Jul 29, 2024
1 parent 63b0384 commit e0fddd8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ class _ServerListPageState extends State<ServerListPage> {
if (!link.contains('://')) link = 'http://$link';
final uri = Uri.parse(link);
final protocol = uri.scheme == 'https' ? 'wss' : 'ws';
final port = uri.port == 80 ? '' : ':${uri.port}';
var port = uri.port == 0 ? '' : ':${uri.port}';
if (uri.scheme == 'http' && uri.port == 80) port = '';
if (uri.scheme == 'https' && uri.port == 443) port = '';
final url = '$protocol://${uri.host}$port${uri.path}';
Navigator.of(context).popUntil((route) => route.isFirst);
Navigator.push(
Expand Down
2 changes: 1 addition & 1 deletion lib/models/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class AppModel extends ChangeNotifier {
);
playlist.setPlaylistLock(type.isPlaylistOpen);
player.loadVideo(playlist.pos);
chat.setEmotes(type.config.emotes);
chat.setEmotes(type.config.emotes, getChannelLink());
chatPanel.notifyListeners();
if (chat.isUnknownClient) tryAutologin();
break;
Expand Down
7 changes: 6 additions & 1 deletion lib/models/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ class ChatModel extends ChangeNotifier {
notifyListeners();
}

void setEmotes(List<Emotes> emotes) {
void setEmotes(List<Emotes> emotes, String relativeHost) {
for (final emote in emotes) {
if (emote.image.startsWith('/')) {
emote.image = '$relativeHost${emote.image}';
}
}
_emotes = emotes;
emotesPattern = RegExp('(' +
escapeRegExp(
Expand Down

0 comments on commit e0fddd8

Please sign in to comment.