Files
Henry_Du 3eff710d5d feat(微信订阅): 接入歌曲排期模板并加固部署流程
订阅消息(小程序侧唯一能主动触达用户的通道):
- 新增 server/utils/wechatSubscribeFields.ts:按微信字段类型裁剪值(thing≤20、
  phrase 必须 5 个汉字、time/date/character_string 各自上限),空白压成一行,
  北京时间 time 由 playTime 的开始时间生成,解析不出退化为当天 00:00。
- wechatSubscribeService 内置 SONG_SELECTED 模板(站长新给的那个模板 ID),
  并转发上述纯函数;notificationService.createSongSelectedNotification 现在会带上
  playDate/playTime/sequence,三个排期接口(schedule / publish / bulk-publish)补传 sequence。
- 新增 test/wechatSubscribeFields.test.mjs(10 例,node --test 全绿)。
- test-subscribe 管理接口支持 vars 覆盖并返回真实发送值,方便站长核对字段名。

部署流程(Gitea Actions 容器里没有 buildx 插件,旧流程在此硬失败):
- 每个 job 各自安装/探测 docker-buildx(v0.19.3,走 gh-proxy 再退直连),
  不把 `buildx version` 当唯一依据;装不上时降级为普通 `docker build` 继续发布,
  不再因为缺插件整条流水线失败。

注意:SONG_SELECTED 的字段名(thing2/date4/time1/character_string3/phrase5)是按常见
命名推断的,需在公众平台后台核对;不一致时用环境变量覆盖,模板 ID 变更后老用户需重新授权。
2026-10-11 00:04:14 +08:00

180 lines
4.1 KiB
Vue

<template>
<div class="site-footer">
<div class="footer-info">
<span v-if="icpNumber" class="footer-item">
<a
:href="`https://beian.miit.gov.cn/`"
class="icp-link"
rel="noopener noreferrer"
target="_blank"
>
{{ icpNumber }}
</a>
</span>
<span v-if="gonganNumber" class="footer-item">
<a
:href="gonganLink || 'https://beian.mps.gov.cn/'"
class="icp-link"
rel="noopener noreferrer"
target="_blank"
>
{{ gonganNumber }}
</a>
</span>
<span v-if="siteTitle" class="footer-item">© {{ currentYear }} {{ siteTitle }}</span>
<span v-else class="footer-item">© {{ currentYear }} {{ copyrightOwner }}</span>
<span class="footer-item">响应耗时 {{ responseTime }}ms</span>
<span class="footer-item">
<a
class="voicehub-link"
href="https://github.com/laoshuikaixue/VoiceHub"
target="_blank"
rel="noopener noreferrer"
>
{{ displayName }} v{{ systemVersion }}
</a>
</span>
<span v-if="isNetlify" class="footer-item">
<a
href="https://www.netlify.com"
target="_blank"
rel="noopener noreferrer"
class="netlify-badge"
>
<img
src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg"
alt="Deploys by Netlify"
>
</a>
</span>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { getCopyrightOwner, getSystemName } from '@/utils/core/security'
import packageJson from '~~/package.json'
// 使用 useSiteConfig composable 获取配置
const { siteTitle, siteVersion, icp: icpNumber, gonganNumber } = useSiteConfig()
const config = useRuntimeConfig()
// 自动生成公安联网备案链接
const gonganLink = computed(() => {
if (!gonganNumber.value) return '#'
// 提取数字部分
const codeMatch = gonganNumber.value.match(/\d+/)
const code = codeMatch ? codeMatch[0] : ''
if (!code) return '#'
return `https://beian.mps.gov.cn/#/query/webSearch?code=${code}`
})
const isNetlify = config.public.isNetlify
const copyrightOwner = getCopyrightOwner()
const systemName = getSystemName()
const systemVersion = computed(() => siteVersion.value || packageJson.version)
const displayName = computed(() => siteTitle.value || systemName)
const currentYear = new Date().getFullYear()
const responseTime = ref(0)
onMounted(() => {
if (typeof window !== 'undefined' && window.performance) {
// 使用 requestAnimationFrame 确保在渲染后计算
requestAnimationFrame(() => {
const loadTime = Math.round(window.performance.now())
responseTime.value = loadTime
})
}
})
</script>
<style scoped>
.site-footer {
text-align: center;
padding: 20px 0;
margin-top: 30px;
border-top: 1px solid var(--border-primary);
width: 100%;
}
.footer-info {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 0;
}
.footer-item {
color: var(--text-tertiary);
font-size: 12px;
white-space: nowrap;
}
.footer-item:not(:last-child)::after {
content: ' | ';
margin: 0 10px;
color: var(--text-quaternary);
}
.footer-item a {
color: inherit;
text-decoration: none;
transition: color 0.2s ease;
}
.footer-item a:hover {
color: var(--text-secondary);
}
.icp-link,
.voicehub-link {
color: inherit;
text-decoration: none;
transition: color 0.2s ease;
}
.icp-link:hover,
.voicehub-link:hover {
color: var(--text-secondary);
}
.netlify-badge {
display: inline-flex;
align-items: center;
vertical-align: middle;
}
.netlify-badge img {
height: 16px;
opacity: 0.8;
transition: opacity 0.2s ease;
}
.netlify-badge:hover img {
opacity: 1;
}
@media (max-width: 768px) {
.site-footer {
padding: 15px 0;
margin-top: 20px;
}
.footer-info {
gap: 0;
}
.footer-item {
font-size: 11px;
}
.footer-item:not(:last-child)::after {
margin: 0 2px;
}
}
</style>