fix: secure external links

This commit is contained in:
Erzbir
2026-08-07 14:45:46 +08:00
parent e83853ba34
commit bca8725ac8
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
<tbody> <tbody>
<tr th:each="link : ${group.links}"> <tr th:each="link : ${group.links}">
<td> <td>
<a th:href="${link.spec.url}" target="_blank" class="link-item"> <a th:href="${link.spec.url}" target="_blank" rel="noopener noreferrer" class="link-item">
<div class="link-container"> <div class="link-container">
<div class="link-logo-wrap"> <div class="link-logo-wrap">
<img class="link-logo" src="" th:src="${link.spec.logo}" <img class="link-logo" src="" th:src="${link.spec.logo}"
+4 -4
View File
@@ -4,12 +4,12 @@
<span th:text="#{footer.powered_by}">Powered by</span> <span th:text="#{footer.powered_by}">Powered by</span>
<span>&nbsp;</span> <span>&nbsp;</span>
<span> <span>
<a target="_blank" href="http://www.halo.run">Halo</a> <a target="_blank" rel="noopener noreferrer" href="http://www.halo.run">Halo</a>
</span> </span>
<span>&nbsp;::&nbsp;</span> <span>&nbsp;::&nbsp;</span>
<span th:text="#{footer.theme}">Theme</span> <span th:text="#{footer.theme}">Theme</span>
<span>&nbsp;</span> <span>&nbsp;</span>
<a target="_blank" href="https://github.com/Erzbir/halo-theme-terminal">Terminal</a> <a target="_blank" rel="noopener noreferrer" href="https://github.com/Erzbir/halo-theme-terminal">Terminal</a>
</div> </div>
<div class="footer-copyright-site"> <div class="footer-copyright-site">
<div class="footer-user"> <div class="footer-user">
@@ -21,12 +21,12 @@
<div class="footer-icp"> <div class="footer-icp">
<p> <p>
<span th:if="${not #strings.isEmpty(theme.config.icp.icp_text)}"> <span th:if="${not #strings.isEmpty(theme.config.icp.icp_text)}">
<a target="_blank" href="https://beian.miit.gov.cn/" <a target="_blank" rel="noopener noreferrer" href="https://beian.miit.gov.cn/"
th:href="${theme.config.icp.icp_link}" th:href="${theme.config.icp.icp_link}"
th:text="${theme.config.icp.icp_text}"></a> th:text="${theme.config.icp.icp_text}"></a>
</span> </span>
<span th:if="${not #strings.isEmpty(theme.config.icp.filing_text)}"> <span th:if="${not #strings.isEmpty(theme.config.icp.filing_text)}">
<a target="_blank" href="https://www.beian.gov.cn/" <a target="_blank" rel="noopener noreferrer" href="https://www.beian.gov.cn/"
th:href="${theme.config.icp.filing_link}" th:href="${theme.config.icp.filing_link}"
th:text="${theme.config.icp.filing_text}"></a> th:text="${theme.config.icp.filing_text}"></a>
</span> </span>
+8
View File
@@ -4,6 +4,7 @@
<a class="sns-icon" <a class="sns-icon"
th:attr="aria-label=#{sns.email}" th:attr="aria-label=#{sns.email}"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:href="'mailto:'+${theme.config.sns.email}" th:href="'mailto:'+${theme.config.sns.email}"
th:if="${not #strings.isEmpty(theme.config.sns.email)}"> th:if="${not #strings.isEmpty(theme.config.sns.email)}">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="icon-regular" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="icon-regular" viewBox="0 0 24 24">
@@ -20,6 +21,7 @@
<!-- GitHub --> <!-- GitHub -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:attr="aria-label=#{sns.github}" th:attr="aria-label=#{sns.github}"
th:href="'https://github.com/'+${theme.config.sns.github}" th:href="'https://github.com/'+${theme.config.sns.github}"
th:if="${not #strings.isEmpty(theme.config.sns.github)}"> th:if="${not #strings.isEmpty(theme.config.sns.github)}">
@@ -34,6 +36,7 @@
<!-- Discord --> <!-- Discord -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:attr="aria-label=#{sns.discord}" th:attr="aria-label=#{sns.discord}"
th:href="${theme.config.sns.discord}" th:href="${theme.config.sns.discord}"
th:if="${not #strings.isEmpty(theme.config.sns.discord)}"> th:if="${not #strings.isEmpty(theme.config.sns.discord)}">
@@ -48,6 +51,7 @@
<!-- Telegram --> <!-- Telegram -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:attr="aria-label=#{sns.telegram}" th:attr="aria-label=#{sns.telegram}"
th:href="'https://t.me/'+${theme.config.sns.telegram}" th:href="'https://t.me/'+${theme.config.sns.telegram}"
th:if="${not #strings.isEmpty(theme.config.sns.telegram)}"> th:if="${not #strings.isEmpty(theme.config.sns.telegram)}">
@@ -62,6 +66,7 @@
<!-- Facebook --> <!-- Facebook -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:attr="aria-label=#{sns.facebook}" th:attr="aria-label=#{sns.facebook}"
th:href="'https://www.facebook.com/'+${theme.config.sns.facebook}" th:href="'https://www.facebook.com/'+${theme.config.sns.facebook}"
th:if="${not #strings.isEmpty(theme.config.sns.facebook)}"> th:if="${not #strings.isEmpty(theme.config.sns.facebook)}">
@@ -76,6 +81,7 @@
<!-- Instagram --> <!-- Instagram -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:attr="aria-label=#{sns.instagram}" th:attr="aria-label=#{sns.instagram}"
th:href="'https://www.instagram.com/'+${theme.config.sns.instagram}" th:href="'https://www.instagram.com/'+${theme.config.sns.instagram}"
th:if="${not #strings.isEmpty(theme.config.sns.instagram)}"> th:if="${not #strings.isEmpty(theme.config.sns.instagram)}">
@@ -91,6 +97,7 @@
<!-- X --> <!-- X -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:attr="aria-label=#{sns.x}" th:attr="aria-label=#{sns.x}"
th:href="'https://x.com/'+${theme.config.sns.x}" th:href="'https://x.com/'+${theme.config.sns.x}"
th:if="${not #strings.isEmpty(theme.config.sns.x)}"> th:if="${not #strings.isEmpty(theme.config.sns.x)}">
@@ -108,6 +115,7 @@
<!-- RSS --> <!-- RSS -->
<a class="sns-icon" <a class="sns-icon"
target="_blank" target="_blank"
rel="noopener noreferrer"
th:href="@{/rss.xml}" th:href="@{/rss.xml}"
th:attr="aria-label=#{sns.rss}" th:attr="aria-label=#{sns.rss}"
th:if="${theme.config.sns.rss}"> th:if="${theme.config.sns.rss}">