@xcanwin/manyoyo 7.0.9 → 7.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/web/frontend/shadcn.html +68 -69
- package/lib/web/server.js +13 -4
- package/package.json +1 -1
package/lib/web/server.js
CHANGED
|
@@ -4098,10 +4098,19 @@ function renderIndexHtml(ctx) {
|
|
|
4098
4098
|
}
|
|
4099
4099
|
|
|
4100
4100
|
function renderShadcnHtml(ctx) {
|
|
4101
|
-
// shadcn
|
|
4102
|
-
//
|
|
4103
|
-
//
|
|
4104
|
-
|
|
4101
|
+
// shadcn.html 是 vite singlefile 打包产物,全部依赖内联成一个 <script>,
|
|
4102
|
+
// 用 .replace('</head>', ...) 有极小概率命中某个库源码里字面量出现的
|
|
4103
|
+
// "</head>",把注入脚本插进内联脚本中间导致整页解析错乱;所以不复用
|
|
4104
|
+
// injectServeTitleFlag 那个 </head> 定位方式,改成跟 applyServeTitle 同款
|
|
4105
|
+
// 更窄、更安全的 <title> 定位,插一个 meta 标记告知前端跳过动态改写 document.title
|
|
4106
|
+
let html = applyServeTitle(loadTemplate('shadcn.html'), ctx);
|
|
4107
|
+
if (typeof ctx.serveTitle === 'string') {
|
|
4108
|
+
html = html.replace(
|
|
4109
|
+
/<\/title>/,
|
|
4110
|
+
() => '</title>\n <meta name="manyoyo-serve-title" content="1">'
|
|
4111
|
+
);
|
|
4112
|
+
}
|
|
4113
|
+
return html;
|
|
4105
4114
|
}
|
|
4106
4115
|
|
|
4107
4116
|
function renderLoginHtml(ctx) {
|