Skip to content

Commit

Permalink
Merge pull request #828 from carolcoral/main
Browse files Browse the repository at this point in the history
fix: 修复侧边栏爱发电用户访问地址错误问题
  • Loading branch information
carolcoral authored Nov 12, 2024
2 parents ebef1f8 + 6a3cfd6 commit ba41304
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1112,9 +1112,14 @@ spec:
- $formkit: url
name: powerLink
label: 赞助地址
help: https://afdian.com/a/ (必须带上末尾的/)
- $formkit: number
name: showNum
label: 最大展示条数
- $formkit: text
name: username
label: 赞助用户名
help: carolcoral
- $formkit: group
name: music
label: 音乐卡片
Expand Down
4 changes: 2 additions & 2 deletions templates/assets/js/halo.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ let halo = {
var data = getArrayItems(values, 1);
let powerStar = document.getElementById("power-star")
if (values.length === 0) {
powerStar.href = GLOBAL_CONFIG.source.power.powerLink
powerStar.href = GLOBAL_CONFIG.source.power.powerLink + GLOBAL_CONFIG.source.power.username
powerStar.innerHTML = `
<div id="power-star-image" style="background-image: url('/themes/theme-hao/assets/images/afadian/afadian.webp')">
</div>
Expand All @@ -390,7 +390,7 @@ let halo = {
</div>`;
} else {
if (powerStar) {
powerStar.href = "https://afdian.net/u/" + data[0]["user"].user_id
powerStar.href = GLOBAL_CONFIG.source.power.powerLink + data[0]["user"].user_id
powerStar.innerHTML = `
<div id="power-star-image" style="background-image: url(${data[0]["user"].avatar})">
</div>
Expand Down
3 changes: 2 additions & 1 deletion templates/modules/variables/site-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
source: {
power: {
powerLink: [[${theme.config.sidebar.power.powerLink}]],
showNum: [[${theme.config.sidebar.power.showNum}]]
showNum: [[${theme.config.sidebar.power.showNum}]],
username: [[${theme.config.sidebar.power.username}]]
},
links: {
linksUrl: [[${ theme.config.link.linksUrl }]],
Expand Down
2 changes: 1 addition & 1 deletion templates/modules/widgets/aside/power.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<div class="card-widget card-power">
<div class="item-headline"><i class="haofont hao-icon-aifadian-line"></i><span>爱发电赞助</span>
<a class="power-charge" th:href="${theme.config.sidebar.power.powerLink}" target="_blank" title="赞助博主">赞助
<a class="power-charge" th:href="${theme.config.sidebar.power.powerLink}+${theme.config.sidebar.power.username}" target="_blank" title="赞助博主">赞助
</a>
</div>
<a id="power-star" rel="external nofollow" target="_blank" title="推荐博主">
Expand Down
2 changes: 1 addition & 1 deletion theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ spec:
repo: https://github.com/chengzhongxue/halo-theme-hao
settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap"
version: "1.6.0"
version: "1.6.1"
require: ">=2.20.0"

0 comments on commit ba41304

Please sign in to comment.