在不少站点能看到允许用户自定义 CSS,这算是一个比较有趣的功能
用户可在个人页设置 CSS 样式,文本最大允许 6kb,后台自动过滤以下文本:
"http://", "https://", "data:", "function",
"@import", "import", "javascript", "url(",
"expression", "XMLHttpRequest", "=>", "document.",
".js", "$.", "axios", "<?php", "<script>",
"</script>", "?>", "behavior:", "script",
"$(", "@namespace", "document", "window",
"app.", "$"
源码
https://github.com/HamCQ/flarum-ext-user-css
安装
composer require hamcq/usercss:"*"
更新
composer update hamcq/usercss:"*"
php flarum migrate
php flarum cache:clear