Skip to content

Commit

Permalink
Prevent HTML injection errors
Browse files Browse the repository at this point in the history
Resolves #42
  • Loading branch information
malmeloo committed Mar 2, 2024
1 parent cd25b19 commit 8cb32a4
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,15 @@ def _get_token(self):

time.sleep(2)
self.waiting_layout.children = [
Window(FormattedTextControl(HTML(
'\n\n\n\n\n<b>Done!</b>\n\n'
f'Signed in as <b>{self.app.user.username}#{self.app.user.discriminator}</b>.\n\n'
)), align=WindowAlign.CENTER, wrap_lines=False)
Window(
FormattedTextControl(
HTML(
'\n\n\n\n\n<b>Done!</b>\n\n'
'Signed in as <b>{}#{}</b>.\n\n'
).format(self.app.user.username, self.app.user.discriminator)
),
align=WindowAlign.CENTER, wrap_lines=False
)
]
self.update()

Expand Down Expand Up @@ -446,10 +451,10 @@ def get_layout(self):
console: str = console_and_game_id[0]
game_id: str = console_and_game_id[1]

label_text = f'<b>-</b> {game_id} ({console.title()})'
label_text = HTML('<b>-</b> {} ({})').format(game_id, console.title())
else:
label_text = f'<b>-</b> {console_and_game_id[0]}'
game_labels.append(Label(HTML(label_text)))
label_text = HTML('<b>-</b> {}').format(console_and_game_id[0])
game_labels.append(Label(label_text))

right_panel_layout = HSplit([])
if self.right_panel_state == 'Menu':
Expand All @@ -467,8 +472,8 @@ def get_layout(self):
Frame(
Box(
HSplit([
Label(HTML(f'<b>Name:</b> {self.riitag_info.name}')),
Label(HTML(f'<b>Games:</b> {len(game_labels)}')),
Label(HTML('<b>Name:</b> {}').format(self.riitag_info.name)),
Label(HTML('<b>Games:</b> {}').format(len(game_labels))),
*game_labels
]), padding_left=3, padding_top=2
), title='RiiTag'),
Expand Down

0 comments on commit 8cb32a4

Please sign in to comment.