refactor(web/group/announcement): drop DOMPurify

This commit is contained in:
Baoshuo Ren 2022-10-08 19:40:34 +08:00
parent 8b97bdf55e
commit 1740cc8265
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 4 additions and 10 deletions

View File

@ -315,11 +315,7 @@
<b><?= $group['title'] ?></b>
</a>
<?php if ($group_announcement): ?>
<div id="announcement-content-<?= $group['id'] ?>"></div>
<script>(function(){
$('#announcement-content-<?= $group['id'] ?>')
.html(DOMPurify.sanitize(decodeURIComponent("<?= rawurlencode($group_announcement) ?>"), <?= DOM_SANITIZE_CONFIG ?>));
})();</script>
<div><?= HTML::pruifier()->purify($group_announcement) ?></div>
<?php else: ?>
<div>(暂无公告)</div>
<?php endif ?>

View File

@ -17,11 +17,9 @@
<?= $group['title'] ?>
</a>
<?php if ($group_announcement): ?>
<div id="announcement-content-<?= $group['id'] ?>" class="text-break"></div>
<script>(function(){
$('#announcement-content-<?= $group['id'] ?>')
.html(DOMPurify.sanitize(decodeURIComponent("<?= urlencode($group_announcement) ?>"), <?= DOM_SANITIZE_CONFIG ?>));
})();</script>
<div class="text-break">
<?= HTML::pruifier()->purify($group_announcement) ?>
</div>
<?php else: ?>
<div>(暂无公告)</div>
<?php endif ?>