集成Hermes的简历渲染器(vendored, exports加CSS): 详情页简历全文改智联样式渲染(服务端渲染+样式内联), 纯文本降级兜底

This commit is contained in:
mzl92
2026-08-31 10:28:31 +08:00
parent f955869052
commit a711b9d42c
5 changed files with 227 additions and 2 deletions
+8
View File
@@ -7,6 +7,7 @@ const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const Database = require('better-sqlite3');
const { renderResumeHTML, CSS: ZR_CSS } = require('./scripts/resume-renderer');
const PORT = process.env.PORT || 8300;
const ADMIN_DIR = process.env.ADMIN_DIR || '/data/admin';
@@ -247,6 +248,13 @@ app.get('/api/candidates/:id', requireAuth, (req, res) => {
res.json(row);
});
// 简历智联样式渲染(服务端渲染, 样式随响应内联)
app.get('/api/candidates/:id/resume-html', requireAuth, (req, res) => {
const row = rdb.prepare('SELECT * FROM candidates WHERE id = ?').get(req.params.id);
if (!row) return res.status(404).json({ error: '不存在' });
res.type('text/html; charset=utf-8').send(`<style>${ZR_CSS}</style>${renderResumeHTML(row)}`);
});
app.get('/api/export.csv', requireAuth, (req, res) => {
const { level, greeted, date_from, date_to, q, today } = req.query;
const where = []; const params = [];