Rename Str2html to SanitizeHTML and clarify its behavior (followup)

This commit is contained in:
Earl Warren 2024-03-04 07:05:15 +08:00
parent 2892aaab02
commit 801792e4dc
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 0579CB2928A78A00
54 changed files with 86 additions and 86 deletions

View file

@ -61,7 +61,7 @@ func mailNewUser(ctx context.Context, u *user_model.User, lang string, tos []str
"Body": body, "Body": body,
"Language": locale.Language(), "Language": locale.Language(),
"Locale": locale, "Locale": locale,
"Str2html": templates.Str2html, "SanitizeHTML": templates.SanitizeHTML,
} }
var mailBody bytes.Buffer var mailBody bytes.Buffer

View file

@ -2,7 +2,7 @@
<div class="admin-setting-content"> <div class="admin-setting-content">
{{if .NeedUpdate}} {{if .NeedUpdate}}
<div class="ui negative message flash-error"> <div class="ui negative message flash-error">
<p>{{(ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | Str2html}}</p> <p>{{(ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer) | SanitizeHTML}}</p>
</div> </div>
{{end}} {{end}}
<h4 class="ui top attached header"> <h4 class="ui top attached header">

View file

@ -17,7 +17,7 @@
{{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}} {{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}}
</h1> </h1>
<p class="large"> <p class="large">
{{ctx.Locale.Tr "startpage.install_desc" | Str2html}} {{ctx.Locale.Tr "startpage.install_desc" | SanitizeHTML}}
</p> </p>
</div> </div>
<div class="eight wide center column"> <div class="eight wide center column">
@ -25,7 +25,7 @@
{{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}} {{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}}
</h1> </h1>
<p class="large"> <p class="large">
{{ctx.Locale.Tr "startpage.platform_desc" | Str2html}} {{ctx.Locale.Tr "startpage.platform_desc" | SanitizeHTML}}
</p> </p>
</div> </div>
</div> </div>
@ -35,7 +35,7 @@
{{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}} {{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}}
</h1> </h1>
<p class="large"> <p class="large">
{{ctx.Locale.Tr "startpage.lightweight_desc" | Str2html}} {{ctx.Locale.Tr "startpage.lightweight_desc" | SanitizeHTML}}
</p> </p>
</div> </div>
<div class="eight wide center column"> <div class="eight wide center column">
@ -43,7 +43,7 @@
{{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}} {{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}}
</h1> </h1>
<p class="large"> <p class="large">
{{ctx.Locale.Tr "startpage.license_desc" | Str2html}} {{ctx.Locale.Tr "startpage.license_desc" | SanitizeHTML}}
</p> </p>
</div> </div>
</div> </div>

View file

@ -8,8 +8,8 @@
{{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}} {{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
<body> <body>
<p>{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}</p><br> <p>{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | SanitizeHTML}}</p><br>
<p>{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br> <p>{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | SanitizeHTML}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>

View file

@ -8,8 +8,8 @@
{{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}} {{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
<body> <body>
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br> <p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | SanitizeHTML}}</p><br>
<p>{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br> <p>{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | SanitizeHTML}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>

View file

@ -8,7 +8,7 @@
{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}} {{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}}
<body> <body>
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br> <p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | SanitizeHTML}}</p><br>
<p>{{.locale.Tr "mail.register_notify.text_1" AppName}}</p><br> <p>{{.locale.Tr "mail.register_notify.text_1" AppName}}</p><br>
<p>{{.locale.Tr "mail.register_notify.text_2" .Username}}</p><p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p><br> <p>{{.locale.Tr "mail.register_notify.text_2" .Username}}</p><p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p><br>
<p>{{.locale.Tr "mail.register_notify.text_3" $set_pwd_url}}</p><br> <p>{{.locale.Tr "mail.register_notify.text_3" $set_pwd_url}}</p><br>

View file

@ -8,8 +8,8 @@
{{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}} {{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
<body> <body>
<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br> <p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | SanitizeHTML}}</p><br>
<p>{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br> <p>{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | SanitizeHTML}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>

View file

@ -16,7 +16,7 @@
</head> </head>
<body> <body>
{{if .IsMention}}<p>{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}</p>{{end}} {{if .IsMention}}<p>{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name | SanitizeHTML}}</p>{{end}}
{{if eq .ActionName "push"}} {{if eq .ActionName "push"}}
<p> <p>
{{if .Comment.IsForcePush}} {{if .Comment.IsForcePush}}
@ -30,7 +30,7 @@
{{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink}} {{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink}}
{{else}} {{else}}
{{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | Str2html}} {{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits) | SanitizeHTML}}
{{end}} {{end}}
</p> </p>
{{end}} {{end}}

View file

@ -13,9 +13,9 @@
<body> <body>
<ul> <ul>
<h3>{{.Locale.Tr "mail.admin.new_user.user_info" | Str2html}}: <a href="{{.NewUserUrl}}">@{{.NewUser.Name}}</a></h3> <h3>{{.Locale.Tr "mail.admin.new_user.user_info" | SanitizeHTML}}: <a href="{{.NewUserUrl}}">@{{.NewUser.Name}}</a></h3>
<li>{{.Locale.Tr "admin.users.created" | Str2html}}: {{DateTime "full" .NewUser.CreatedUnix}}</li> <li>{{.Locale.Tr "admin.users.created" | SanitizeHTML}}: {{DateTime "full" .NewUser.CreatedUnix}}</li>
</ul> </ul>
<p> {{.Body | Str2html}} </p> <p> {{.Body | SanitizeHTML}} </p>
</body> </body>
</html> </html>

View file

@ -5,7 +5,7 @@
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"> <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
</head> </head>
<body> <body>
<p>{{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName) | Str2html}}</p> <p>{{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName) | SanitizeHTML}}</p>
<p>{{.locale.Tr "mail.team_invite.text_2"}}</p><p><a href="{{.InviteURL}}">{{.InviteURL}}</a></p> <p>{{.locale.Tr "mail.team_invite.text_2"}}</p><p><a href="{{.InviteURL}}">{{.InviteURL}}</a></p>
<p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p>
<p>{{.locale.Tr "mail.team_invite.text_3" .Invite.Email}}</p> <p>{{.locale.Tr "mail.team_invite.text_3" .Invite.Email}}</p>

View file

@ -6,7 +6,7 @@
</h4> </h4>
<div class="ui attached error segment"> <div class="ui attached error segment">
<div class="ui red message"> <div class="ui red message">
<p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt" | Str2html}}</p> <p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt" | SanitizeHTML}}</p>
</div> </div>
<form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}" method="post"> <form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}

View file

@ -2,7 +2,7 @@
<div class="org-setting-content"> <div class="org-setting-content">
<div class="gt-df gt-ac"> <div class="gt-df gt-ac">
<div class="gt-f1"> <div class="gt-f1">
{{ctx.Locale.Tr "org.settings.labels_desc" | Str2html}} {{ctx.Locale.Tr "org.settings.labels_desc" | SanitizeHTML}}
</div> </div>
<button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button> <button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
</div> </div>

View file

@ -7,7 +7,7 @@
{{ctx.AvatarUtils.Avatar .Organization 140}} {{ctx.AvatarUtils.Avatar .Organization 140}}
</div> </div>
<div class="content"> <div class="content">
<div class="header">{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div> <div class="header">{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | SanitizeHTML}}</div>
<div class="meta">{{ctx.Locale.Tr "org.teams.invite.by" .Inviter.Name}}</div> <div class="meta">{{ctx.Locale.Tr "org.teams.invite.by" .Inviter.Name}}</div>
<div class="description">{{ctx.Locale.Tr "org.teams.invite.description"}}</div> <div class="description">{{ctx.Locale.Tr "org.teams.invite.description"}}</div>
</div> </div>

View file

@ -32,14 +32,14 @@
<div class="ui radio checkbox"> <div class="ui radio checkbox">
<input type="radio" name="repo_access" value="specific" {{if not .Team.IncludesAllRepositories}}checked{{end}}> <input type="radio" name="repo_access" value="specific" {{if not .Team.IncludesAllRepositories}}checked{{end}}>
<label>{{ctx.Locale.Tr "org.teams.specific_repositories"}}</label> <label>{{ctx.Locale.Tr "org.teams.specific_repositories"}}</label>
<span class="help">{{ctx.Locale.Tr "org.teams.specific_repositories_helper" | Str2html}}</span> <span class="help">{{ctx.Locale.Tr "org.teams.specific_repositories_helper" | SanitizeHTML}}</span>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="ui radio checkbox"> <div class="ui radio checkbox">
<input type="radio" name="repo_access" value="all" {{if .Team.IncludesAllRepositories}}checked{{end}}> <input type="radio" name="repo_access" value="all" {{if .Team.IncludesAllRepositories}}checked{{end}}>
<label>{{ctx.Locale.Tr "org.teams.all_repositories"}}</label> <label>{{ctx.Locale.Tr "org.teams.all_repositories"}}</label>
<span class="help">{{ctx.Locale.Tr "org.teams.all_repositories_helper" | Str2html}}</span> <span class="help">{{ctx.Locale.Tr "org.teams.all_repositories_helper" | SanitizeHTML}}</span>
</div> </div>
</div> </div>

View file

@ -27,16 +27,16 @@
</div> </div>
{{if eq .Team.LowerName "owners"}} {{if eq .Team.LowerName "owners"}}
<div class="item"> <div class="item">
{{ctx.Locale.Tr "org.teams.owners_permission_desc" | Str2html}} {{ctx.Locale.Tr "org.teams.owners_permission_desc" | SanitizeHTML}}
</div> </div>
{{else}} {{else}}
<div class="item"> <div class="item">
<h3>{{ctx.Locale.Tr "org.team_access_desc"}}</h3> <h3>{{ctx.Locale.Tr "org.team_access_desc"}}</h3>
<ul> <ul>
{{if .Team.IncludesAllRepositories}} {{if .Team.IncludesAllRepositories}}
<li>{{ctx.Locale.Tr "org.teams.all_repositories" | Str2html}}</li> <li>{{ctx.Locale.Tr "org.teams.all_repositories" | SanitizeHTML}}</li>
{{else}} {{else}}
<li>{{ctx.Locale.Tr "org.teams.specific_repositories" | Str2html}}</li> <li>{{ctx.Locale.Tr "org.teams.specific_repositories" | SanitizeHTML}}</li>
{{end}} {{end}}
{{if .Team.CanCreateOrgRepo}} {{if .Team.CanCreateOrgRepo}}
<li>{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}</li> <li>{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}</li>
@ -44,10 +44,10 @@
</ul> </ul>
{{if (eq .Team.AccessMode 2)}} {{if (eq .Team.AccessMode 2)}}
<h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3> <h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3>
{{ctx.Locale.Tr "org.teams.write_permission_desc" | Str2html}} {{ctx.Locale.Tr "org.teams.write_permission_desc" | SanitizeHTML}}
{{else if (eq .Team.AccessMode 3)}} {{else if (eq .Team.AccessMode 3)}}
<h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3> <h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3>
{{ctx.Locale.Tr "org.teams.admin_permission_desc" | Str2html}} {{ctx.Locale.Tr "org.teams.admin_permission_desc" | SanitizeHTML}}
{{else}} {{else}}
<table class="ui table"> <table class="ui table">
<thead> <thead>

View file

@ -2,11 +2,11 @@
{{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}} {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}}
{{if .UsesIgnoreRevs}} {{if .UsesIgnoreRevs}}
<div class="ui info message"> <div class="ui info message">
<p>{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true") | SanitizeHTML}}</p>
</div> </div>
{{else}} {{else}}
<div class="ui error message"> <div class="ui error message">
<p>{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink | SanitizeHTML}}</p>
</div> </div>
{{end}} {{end}}
{{end}} {{end}}

View file

@ -210,7 +210,7 @@
{{ctx.Locale.Tr "repo.branch.delete_html"}} <span class="name"></span> {{ctx.Locale.Tr "repo.branch.delete_html"}} <span class="name"></span>
</div> </div>
<div class="content"> <div class="content">
<p>{{ctx.Locale.Tr "repo.branch.delete_desc" | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.branch.delete_desc" | SanitizeHTML}}</p>
</div> </div>
{{template "base/modal_actions_confirm" .}} {{template "base/modal_actions_confirm" .}}
</div> </div>

View file

@ -158,7 +158,7 @@
{{end}} {{end}}
</div> </div>
</div> </div>
<span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/" | Str2html}}</span> <span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/" | SanitizeHTML}}</span>
</div> </div>
<div class="inline field"> <div class="inline field">

View file

@ -19,7 +19,7 @@
{{end}} {{end}}
{{if not .DiffNotAvailable}} {{if not .DiffNotAvailable}}
<div class="diff-detail-stats gt-df gt-ac gt-fw"> <div class="diff-detail-stats gt-df gt-ac gt-fw">
{{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} {{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | SanitizeHTML}}
</div> </div>
{{end}} {{end}}
</div> </div>

View file

@ -1,5 +1,5 @@
{{Eval .file.Addition "+" .file.Deletion}} {{Eval .file.Addition "+" .file.Deletion}}
<span class="diff-stats-bar gt-mx-3" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.stats_desc_file" (Eval .file.Addition "+" .file.Deletion) .file.Addition .file.Deletion | Str2html}}"> <span class="diff-stats-bar gt-mx-3" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.stats_desc_file" (Eval .file.Addition "+" .file.Deletion) .file.Addition .file.Deletion | SanitizeHTML}}">
{{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}} {{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}}
<div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .file.Addition "/" "(" .file.Addition "+" .file.Deletion "+" 0.0 ")"}}%"></div> <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .file.Addition "/" "(" .file.Addition "+" .file.Deletion "+" 0.0 ")"}}%"></div>
</span> </span>

View file

@ -24,7 +24,7 @@
</h4> </h4>
<div class="ui attached guide table segment empty-repo-guide"> <div class="ui attached guide table segment empty-repo-guide">
<div class="item"> <div class="item">
<h3>{{ctx.Locale.Tr "repo.clone_this_repo"}} <small>{{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}</small></h3> <h3>{{ctx.Locale.Tr "repo.clone_this_repo"}} <small>{{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | SanitizeHTML}}</small></h3>
<div class="repo-button-row"> <div class="repo-button-row">
{{if and .CanWriteCode (not .Repository.IsArchived)}} {{if and .CanWriteCode (not .Repository.IsArchived)}}

View file

@ -61,7 +61,7 @@
<li class="item"> <li class="item">
<div class="ui grid middle aligned"> <div class="ui grid middle aligned">
<div class="ten wide column"> <div class="ten wide column">
{{ctx.Locale.Tr "repo.org_labels_desc" | Str2html}} {{ctx.Locale.Tr "repo.org_labels_desc" | SanitizeHTML}}
{{if .IsOrganizationOwner}} {{if .IsOrganizationOwner}}
<a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>: <a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>:
{{end}} {{end}}

View file

@ -181,7 +181,7 @@
{{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}} {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}}
</div> </div>
<div class="content"> <div class="content">
<p>{{ctx.Locale.Tr "repo.branch.delete_desc" | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.branch.delete_desc" | SanitizeHTML}}</p>
</div> </div>
{{template "base/modal_actions_confirm" .}} {{template "base/modal_actions_confirm" .}}
</div> </div>

View file

@ -17,7 +17,7 @@
<span id="lfs_settings" class="gt-hidden">(<a id="lfs_settings_show" href="#">{{ctx.Locale.Tr "repo.settings.advanced_settings"}}</a>)</span> <span id="lfs_settings" class="gt-hidden">(<a id="lfs_settings_show" href="#">{{ctx.Locale.Tr "repo.settings.advanced_settings"}}</a>)</span>
</div> </div>
<div id="lfs_endpoint" class="gt-hidden"> <div id="lfs_endpoint" class="gt-hidden">
<span class="help">{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}</span> <span class="help">{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | SanitizeHTML}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}</span>
<div class="inline field {{if .Err_LFSEndpoint}}error{{end}}"> <div class="inline field {{if .Err_LFSEndpoint}}error{{end}}">
<label>{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.label"}}</label> <label>{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.label"}}</label>
<input name="lfs_endpoint" value="{{.lfs_endpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}"> <input name="lfs_endpoint" value="{{.lfs_endpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}">

View file

@ -54,7 +54,7 @@
<span class="time">{{TimeSinceUnix $release.CreatedUnix ctx.Locale}}</span> <span class="time">{{TimeSinceUnix $release.CreatedUnix ctx.Locale}}</span>
{{end}} {{end}}
{{if and (not $release.IsDraft) ($.Permission.CanRead $.UnitTypeCode)}} {{if and (not $release.IsDraft) ($.Permission.CanRead $.UnitTypeCode)}}
| <span class="ahead"><a href="{{$.RepoLink}}/compare/{{$release.TagName | PathEscapeSegments}}...{{$release.TargetBehind | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind | Str2html}}</a> {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}</span> | <span class="ahead"><a href="{{$.RepoLink}}/compare/{{$release.TagName | PathEscapeSegments}}...{{$release.TargetBehind | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind | SanitizeHTML}}</a> {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}</span>
{{end}} {{end}}
</p> </p>
<div class="markup desc"> <div class="markup desc">

View file

@ -31,7 +31,7 @@
<label for="is_writable"> <label for="is_writable">
{{ctx.Locale.Tr "repo.settings.is_writable"}} {{ctx.Locale.Tr "repo.settings.is_writable"}}
</label> </label>
<small style="padding-left: 26px;">{{ctx.Locale.Tr "repo.settings.is_writable_info" | Str2html}}</small> <small style="padding-left: 26px;">{{ctx.Locale.Tr "repo.settings.is_writable_info" | SanitizeHTML}}</small>
</div> </div>
</div> </div>
<button class="ui primary button"> <button class="ui primary button">

View file

@ -6,7 +6,7 @@
<div class="ui attached segment"> <div class="ui attached segment">
<div class="ui list"> <div class="ui list">
<div class="item"> <div class="item">
{{ctx.Locale.Tr "repo.settings.githooks_desc" | Str2html}} {{ctx.Locale.Tr "repo.settings.githooks_desc" | SanitizeHTML}}
</div> </div>
{{range .Hooks}} {{range .Hooks}}
<div class="item truncated-item-container"> <div class="item truncated-item-container">

View file

@ -191,7 +191,7 @@
<div class="field {{if .Err_LFSEndpoint}}error{{end}}"> <div class="field {{if .Err_LFSEndpoint}}error{{end}}">
<label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label> <label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label>
<input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}"> <input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}">
<p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}</p> <p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | SanitizeHTML}}</p>
</div> </div>
{{end}} {{end}}
<div class="field"> <div class="field">

View file

@ -61,7 +61,7 @@
<div class="field"> <div class="field">
<label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label> <label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label>
<input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}"> <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}">
<p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}</p> <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc" | SanitizeHTML}}</p>
</div> </div>
<div class="inline fields"> <div class="inline fields">
<label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label> <label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label>
@ -89,7 +89,7 @@
<div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box"> <div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box">
<label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label> <label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label>
<input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}"> <input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}">
<p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}</p> <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | SanitizeHTML}}</p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,5 +1,5 @@
{{if eq .HookType "dingtalk"}} {{if eq .HookType "dingtalk"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://dingtalk.com" (ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://dingtalk.com" (ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/dingtalk/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/dingtalk/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}"> <div class="required field {{if .Err_PayloadURL}}error{{end}}">

View file

@ -1,5 +1,5 @@
{{if eq .HookType "discord"}} {{if eq .HookType "discord"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://discord.com" (ctx.Locale.Tr "repo.settings.web_hook_name_discord") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://discord.com" (ctx.Locale.Tr "repo.settings.web_hook_name_discord") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/discord/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/discord/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}"> <div class="required field {{if .Err_PayloadURL}}error{{end}}">

View file

@ -1,6 +1,6 @@
{{if eq .HookType "feishu"}} {{if eq .HookType "feishu"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu") | SanitizeHTML}}</p>
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/feishu/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/feishu/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}"> <div class="required field {{if .Err_PayloadURL}}error{{end}}">

View file

@ -1,5 +1,5 @@
{{if eq .HookType "forgejo"}} {{if eq .HookType "forgejo"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_forgejo") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_forgejo") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/forgejo/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/forgejo/{{or .Webhook.ID "new"}}" method="post">
{{template "base/disable_form_autofill"}} {{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}

View file

@ -1,5 +1,5 @@
{{if eq .HookType "gitea"}} {{if eq .HookType "gitea"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gitea") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gitea") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/gitea/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/gitea/{{or .Webhook.ID "new"}}" method="post">
{{template "base/disable_form_autofill"}} {{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}

View file

@ -1,5 +1,5 @@
{{if eq .HookType "gogs"}} {{if eq .HookType "gogs"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gogs") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gogs") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/gogs/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/gogs/{{or .Webhook.ID "new"}}" method="post">
{{template "base/disable_form_autofill"}} {{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}

View file

@ -1,5 +1,5 @@
{{if eq .HookType "matrix"}} {{if eq .HookType "matrix"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://matrix.org/" (ctx.Locale.Tr "repo.settings.web_hook_name_matrix") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://matrix.org/" (ctx.Locale.Tr "repo.settings.web_hook_name_matrix") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/matrix/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/matrix/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_HomeserverURL}}error{{end}}"> <div class="required field {{if .Err_HomeserverURL}}error{{end}}">

View file

@ -1,5 +1,5 @@
{{if eq .HookType "msteams"}} {{if eq .HookType "msteams"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://teams.microsoft.com" (ctx.Locale.Tr "repo.settings.web_hook_name_msteams") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://teams.microsoft.com" (ctx.Locale.Tr "repo.settings.web_hook_name_msteams") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/msteams/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/msteams/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}"> <div class="required field {{if .Err_PayloadURL}}error{{end}}">

View file

@ -1,5 +1,5 @@
{{if eq .HookType "packagist"}} {{if eq .HookType "packagist"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://packagist.org" (ctx.Locale.Tr "repo.settings.web_hook_name_packagist") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://packagist.org" (ctx.Locale.Tr "repo.settings.web_hook_name_packagist") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/packagist/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/packagist/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_Username}}error{{end}}"> <div class="required field {{if .Err_Username}}error{{end}}">

View file

@ -5,19 +5,19 @@
<div class="field"> <div class="field">
<div class="ui radio non-events checkbox"> <div class="ui radio non-events checkbox">
<input name="events" type="radio" value="push_only" {{if or $isNew .Webhook.PushOnly}}checked{{end}}> <input name="events" type="radio" value="push_only" {{if or $isNew .Webhook.PushOnly}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.event_push_only" | Str2html}}</label> <label>{{ctx.Locale.Tr "repo.settings.event_push_only" | SanitizeHTML}}</label>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="ui radio non-events checkbox"> <div class="ui radio non-events checkbox">
<input name="events" type="radio" value="send_everything" {{if .Webhook.SendEverything}}checked{{end}}> <input name="events" type="radio" value="send_everything" {{if .Webhook.SendEverything}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.event_send_everything" | Str2html}}</label> <label>{{ctx.Locale.Tr "repo.settings.event_send_everything" | SanitizeHTML}}</label>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<div class="ui radio events checkbox"> <div class="ui radio events checkbox">
<input name="events" type="radio" value="choose_events" {{if .Webhook.ChooseEvents}}checked{{end}}> <input name="events" type="radio" value="choose_events" {{if .Webhook.ChooseEvents}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.settings.event_choose" | Str2html}}</label> <label>{{ctx.Locale.Tr "repo.settings.event_choose" | SanitizeHTML}}</label>
</div> </div>
</div> </div>
</div> </div>
@ -255,7 +255,7 @@
<div class="field"> <div class="field">
<label for="branch_filter">{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label> <label for="branch_filter">{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label>
<input id="branch_filter" name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}"> <input id="branch_filter" name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}">
<span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" | Str2html}}</span> <span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" | SanitizeHTML}}</span>
</div> </div>
<!-- Authorization Header --> <!-- Authorization Header -->

View file

@ -1,5 +1,5 @@
{{if eq .HookType "slack"}} {{if eq .HookType "slack"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://slack.com" (ctx.Locale.Tr "repo.settings.web_hook_name_slack") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://slack.com" (ctx.Locale.Tr "repo.settings.web_hook_name_slack") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/slack/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/slack/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}"> <div class="required field {{if .Err_PayloadURL}}error{{end}}">

View file

@ -1,5 +1,5 @@
{{if eq .HookType "telegram"}} {{if eq .HookType "telegram"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://core.telegram.org/bots" (ctx.Locale.Tr "repo.settings.web_hook_name_telegram") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://core.telegram.org/bots" (ctx.Locale.Tr "repo.settings.web_hook_name_telegram") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/telegram/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/telegram/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_BotToken}}error{{end}}"> <div class="required field {{if .Err_BotToken}}error{{end}}">

View file

@ -1,5 +1,5 @@
{{if eq .HookType "wechatwork"}} {{if eq .HookType "wechatwork"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://work.weixin.qq.com" (ctx.Locale.Tr "repo.settings.web_hook_name_wechatwork") | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://work.weixin.qq.com" (ctx.Locale.Tr "repo.settings.web_hook_name_wechatwork") | SanitizeHTML}}</p>
<form class="ui form" action="{{.BaseLink}}/wechatwork/{{or .Webhook.ID "new"}}" method="post"> <form class="ui form" action="{{.BaseLink}}/wechatwork/{{or .Webhook.ID "new"}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}"> <div class="required field {{if .Err_PayloadURL}}error{{end}}">

View file

@ -5,9 +5,9 @@
<div class="header"> <div class="header">
{{ctx.Locale.Tr "repo.invisible_runes_header"}} {{ctx.Locale.Tr "repo.invisible_runes_header"}}
</div> </div>
<p>{{ctx.Locale.Tr "repo.invisible_runes_description" | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.invisible_runes_description" | SanitizeHTML}}</p>
{{if .EscapeStatus.HasAmbiguous}} {{if .EscapeStatus.HasAmbiguous}}
<p>{{ctx.Locale.Tr "repo.ambiguous_runes_description" | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description" | SanitizeHTML}}</p>
{{end}} {{end}}
</div> </div>
{{else if .EscapeStatus.HasAmbiguous}} {{else if .EscapeStatus.HasAmbiguous}}
@ -16,7 +16,7 @@
<div class="header"> <div class="header">
{{ctx.Locale.Tr "repo.ambiguous_runes_header"}} {{ctx.Locale.Tr "repo.ambiguous_runes_header"}}
</div> </div>
<p>{{ctx.Locale.Tr "repo.ambiguous_runes_description" | Str2html}}</p> <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description" | SanitizeHTML}}</p>
</div> </div>
{{end}} {{end}}
{{end}} {{end}}

View file

@ -45,7 +45,7 @@
{{end}} {{end}}
<div class="center gt-mt-5"> <div class="center gt-mt-5">
{{if or .SignedUser.IsAdmin .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}} {{if or .SignedUser.IsAdmin .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}}
{{if .SignedUser.IsAdmin}}<p>{{ctx.Locale.Tr "error.report_message" | Str2html}}</p>{{end}} {{if .SignedUser.IsAdmin}}<p>{{ctx.Locale.Tr "error.report_message" | SanitizeHTML}}</p>{{end}}
</div> </div>
</div> </div>
</div> </div>

View file

@ -35,7 +35,7 @@
{{if .ShowRegistrationButton}} {{if .ShowRegistrationButton}}
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now" | Str2html}}</a> <a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now" | SanitizeHTML}}</a>
</div> </div>
{{end}} {{end}}
</form> </form>

View file

@ -9,11 +9,11 @@
{{template "base/alert" .}} {{template "base/alert" .}}
<p> <p>
<b>{{ctx.Locale.Tr "auth.authorize_application_description"}}</b><br> <b>{{ctx.Locale.Tr "auth.authorize_application_description"}}</b><br>
{{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML | Str2html}} {{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML | SanitizeHTML}}
</p> </p>
</div> </div>
<div class="ui attached segment"> <div class="ui attached segment">
<p>{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML | Str2html}}</p> <p>{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML | SanitizeHTML}}</p>
</div> </div>
<div class="ui attached segment"> <div class="ui attached segment">
<form method="post" action="{{AppSubUrl}}/login/oauth/grant"> <form method="post" action="{{AppSubUrl}}/login/oauth/grant">

View file

@ -34,7 +34,7 @@
<h4 class="ui dividing header"> <h4 class="ui dividing header">
{{ctx.Locale.Tr "twofa"}} {{ctx.Locale.Tr "twofa"}}
</h4> </h4>
<div class="ui warning visible message">{{ctx.Locale.Tr "settings.twofa_is_enrolled" | Str2html}}</div> <div class="ui warning visible message">{{ctx.Locale.Tr "settings.twofa_is_enrolled" | SanitizeHTML}}</div>
{{if .scratch_code}} {{if .scratch_code}}
<div class="required inline field {{if .Err_Token}}error{{end}}"> <div class="required inline field {{if .Err_Token}}error{{end}}">
<label for="token">{{ctx.Locale.Tr "auth.scratch_code"}}</label> <label for="token">{{ctx.Locale.Tr "auth.scratch_code"}}</label>
@ -53,11 +53,11 @@
<label></label> <label></label>
<button class="ui primary button">{{ctx.Locale.Tr "auth.reset_password_helper"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "auth.reset_password_helper"}}</button>
{{if and .has_two_factor (not .scratch_code)}} {{if and .has_two_factor (not .scratch_code)}}
<a href="{{.Link}}?code={{.Code}}&amp;scratch_code=true">{{ctx.Locale.Tr "auth.use_scratch_code" | Str2html}}</a> <a href="{{.Link}}?code={{.Code}}&amp;scratch_code=true">{{ctx.Locale.Tr "auth.use_scratch_code" | SanitizeHTML}}</a>
{{end}} {{end}}
</div> </div>
{{else}} {{else}}
<p class="center">{{ctx.Locale.Tr "auth.invalid_code_forgot_password" (printf "%s/user/forgot_password" AppSubUrl) | Str2html}}</p> <p class="center">{{ctx.Locale.Tr "auth.invalid_code_forgot_password" (printf "%s/user/forgot_password" AppSubUrl) | SanitizeHTML}}</p>
{{end}} {{end}}
</div> </div>
</form> </form>

View file

@ -48,7 +48,7 @@
{{if .ShowRegistrationButton}} {{if .ShowRegistrationButton}}
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now" | Str2html}}</a> <a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now" | SanitizeHTML}}</a>
</div> </div>
{{end}} {{end}}

View file

@ -17,7 +17,7 @@
<div class="inline field"> <div class="inline field">
<label></label> <label></label>
<button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button>
<a href="{{AppSubUrl}}/user/two_factor/scratch">{{ctx.Locale.Tr "auth.use_scratch_code" | Str2html}}</a> <a href="{{AppSubUrl}}/user/two_factor/scratch">{{ctx.Locale.Tr "auth.use_scratch_code" | SanitizeHTML}}</a>
</div> </div>
</div> </div>
</form> </form>

View file

@ -134,9 +134,9 @@
</h4> </h4>
<div class="ui attached error segment"> <div class="ui attached error segment">
<div class="ui red message"> <div class="ui red message">
<p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "settings.delete_prompt" | Str2html}}</p> <p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "settings.delete_prompt" | SanitizeHTML}}</p>
{{if .UserDeleteWithComments}} {{if .UserDeleteWithComments}}
<p class="text left gt-font-semibold">{{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | Str2html}}</p> <p class="text left gt-font-semibold">{{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | SanitizeHTML}}</p>
{{end}} {{end}}
</div> </div>
<form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post"> <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post">

View file

@ -43,7 +43,7 @@
<div class="flex-item"> <div class="flex-item">
<p> <p>
{{ctx.Locale.Tr "settings.gpg_desc"}}<br> {{ctx.Locale.Tr "settings.gpg_desc"}}<br>
{{ctx.Locale.Tr "settings.gpg_helper" "https://docs.codeberg.org/security/gpg-key/" | Str2html}} {{ctx.Locale.Tr "settings.gpg_helper" "https://docs.codeberg.org/security/gpg-key/" | SanitizeHTML}}
</p> </p>
</div> </div>
{{range .GPGKeys}} {{range .GPGKeys}}

View file

@ -31,7 +31,7 @@
<div class="flex-item"> <div class="flex-item">
<p> <p>
{{ctx.Locale.Tr "settings.ssh_desc"}}<br> {{ctx.Locale.Tr "settings.ssh_desc"}}<br>
{{ctx.Locale.Tr "settings.ssh_helper" "https://docs.codeberg.org/security/ssh-key/" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh" | Str2html}} {{ctx.Locale.Tr "settings.ssh_helper" "https://docs.codeberg.org/security/ssh-key/" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh" | SanitizeHTML}}
</p> </p>
</div> </div>
{{if .DisableSSH}} {{if .DisableSSH}}

View file

@ -4,7 +4,7 @@
<div class="ui attached segment"> <div class="ui attached segment">
<p>{{ctx.Locale.Tr "settings.twofa_desc"}}</p> <p>{{ctx.Locale.Tr "settings.twofa_desc"}}</p>
{{if .TOTPEnrolled}} {{if .TOTPEnrolled}}
<p>{{ctx.Locale.Tr "settings.twofa_is_enrolled" | Str2html}}</p> <p>{{ctx.Locale.Tr "settings.twofa_is_enrolled" | SanitizeHTML}}</p>
<form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data"> <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<p>{{ctx.Locale.Tr "settings.regenerate_scratch_token_desc"}}</p> <p>{{ctx.Locale.Tr "settings.regenerate_scratch_token_desc"}}</p>

View file

@ -1,6 +1,6 @@
<h4 class="ui top attached header">{{ctx.Locale.Tr "settings.webauthn"}}</h4> <h4 class="ui top attached header">{{ctx.Locale.Tr "settings.webauthn"}}</h4>
<div class="ui attached segment"> <div class="ui attached segment">
<p>{{ctx.Locale.Tr "settings.webauthn_desc" | Str2html}}</p> <p>{{ctx.Locale.Tr "settings.webauthn_desc" | SanitizeHTML}}</p>
<p>{{ctx.Locale.Tr "settings.webauthn_key_loss_warning"}} {{ctx.Locale.Tr "settings.webauthn_alternative_tip"}}</p> <p>{{ctx.Locale.Tr "settings.webauthn_key_loss_warning"}} {{ctx.Locale.Tr "settings.webauthn_alternative_tip"}}</p>
{{template "user/auth/webauthn_error" .}} {{template "user/auth/webauthn_error" .}}
<div class="flex-list"> <div class="flex-list">