feat(helpers): 添加东12时区日期格式化函数并更新相关调用
refactor(handlers): 修改文章链接格式为年/月/日结构并统一使用东12时区时间 docs: 更新Markdown标题级别和收听语音版标题
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { replaceImageProxy, formatDateToGMT0WithTime } from '../helpers.js';
|
||||
import { replaceImageProxy, formatMarkdownText, formatDateToGMT12WithTime } from '../helpers.js';
|
||||
import { getDailyReportContent } from '../github.js';
|
||||
import { storeInKV } from '../kv.js';
|
||||
import { marked } from '../marked.esm.js';
|
||||
@@ -18,15 +18,17 @@ export async function handleWriteRssData(request, env) {
|
||||
return new Response(`No content found for ${path}`, { status: 404 });
|
||||
}
|
||||
|
||||
// 从 "YYYY-MM-DD" 格式的 dateStr 中提取 "YYYY-MM"
|
||||
const yearMonth = dateStr.substring(0, 7);
|
||||
const report = {
|
||||
report_date: dateStr,
|
||||
title: dateStr+'日刊',
|
||||
link: '/daily/'+dateStr+'.html',
|
||||
link: '/'+yearMonth+'/'+dateStr+'/',
|
||||
content_html: null,
|
||||
// 可以添加其他相關欄位,例如作者、來源等
|
||||
published_date: formatDateToGMT0WithTime(new Date()) // 記錄保存時間
|
||||
published_date: formatDateToGMT12WithTime(new Date()) // 記錄保存時間
|
||||
}
|
||||
report.content_html = marked.parse(replaceImageProxy(env.IMG_PROXY, content));
|
||||
report.content_html = marked.parse(formatMarkdownText(replaceImageProxy(env.IMG_PROXY, content)));
|
||||
storeInKV(env.DATA_KV, `${dateStr}-report`, report);
|
||||
|
||||
return new Response(JSON.stringify(report), {
|
||||
|
||||
Reference in New Issue
Block a user