fix nonces in py files

pull/83/head
Aevann 2023-01-02 06:20:59 +02:00
parent f23cbadca4
commit daad32d0ce
3 changed files with 7 additions and 7 deletions

View File

@ -280,9 +280,9 @@ class Comment(Base):
if v:
sub = self.post.sub
if sub in {'furry','vampire','racist','femboy'} and not v.house.lower().startswith(sub): body += ' disabled '
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"'''
body += f''' data-nonce="{g.nonce}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"'''
else:
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_no_v()"'''
body += f''' data-nonce="{g.nonce}" data-onclick="poll_vote_no_v()"'''
body += f'''><label class="custom-control-label" for="comment-{o.id}">{o.body_html}<span class="presult-{self.id}'''
if not self.total_poll_voted(v): body += ' d-none'

View File

@ -285,7 +285,7 @@ class Submission(Base):
for o in self.options:
if o.exclusive > 1:
body += f'''<div class="custom-control mt-2"><input name="option-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" data-nonce="{{g.nonce}}" data-onclick="bet_vote(this,'{o.id}')"'''
body += f'''<div class="custom-control mt-2"><input name="option-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" data-nonce="{g.nonce}" data-onclick="bet_vote(this,'{o.id}')"'''
if o.voted(v): body += " checked "
if not (v and v.coins >= POLL_BET_COINS) or self.total_bet_voted(v): body += " disabled "
@ -299,7 +299,7 @@ class Submission(Base):
body += " - <b>WINNER!</b>"
if not winner and v and v.admin_level >= PERMS['POST_BETS_DISTRIBUTE']:
body += f'''<button class="btn btn-primary distribute" data-areyousure="postToastReload(this,'/distribute/{o.id}')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)">Declare winner</button>'''
body += f'''<button class="btn btn-primary distribute" data-areyousure="postToastReload(this,'/distribute/{o.id}')" data-nonce="{g.nonce}" data-onclick="areyousure(this)">Declare winner</button>'''
body += "</div>"
else:
input_type = 'radio' if o.exclusive else 'checkbox'
@ -309,9 +309,9 @@ class Submission(Base):
if v:
sub = self.sub
if sub in {'furry','vampire','racist','femboy'} and not v.house.lower().startswith(sub): body += ' disabled '
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'post')"'''
body += f''' data-nonce="{g.nonce}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'post')"'''
else:
body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_no_v()"'''
body += f''' data-nonce="{g.nonce}" data-onclick="poll_vote_no_v()"'''
body += f'''><label class="custom-control-label" for="post-{o.id}">{o.body_html}<span class="presult-{self.id}'''
if not self.total_poll_voted(v): body += ' d-none'

View File

@ -411,7 +411,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
sanitized = sanitized.replace('\n','')
if showmore and len(sanitized) > 3500:
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" data-nonce="{{g.nonce}}">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized, count=1)
sanitized = showmore_regex.sub(r'\1<p><button class="showmore">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized, count=1)
return sanitized.strip()