|
@@ -347,6 +347,14 @@ export default function({ apiClient, app, moduleDir }: ModuleParams) {
|
|
|
进入管理后台
|
|
进入管理后台
|
|
|
</a>
|
|
</a>
|
|
|
|
|
|
|
|
|
|
+ {/* 迁移管理入口按钮 */}
|
|
|
|
|
+ <a
|
|
|
|
|
+ href="/migrations"
|
|
|
|
|
+ className="w-full flex justify-center py-3 px-4 border border-blue-600 rounded-md shadow-sm text-lg font-medium text-blue-600 bg-white hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
|
|
|
+ >
|
|
|
|
|
+ 数据库迁移
|
|
|
|
|
+ </a>
|
|
|
|
|
+
|
|
|
{/* 移动端入口按钮 */}
|
|
{/* 移动端入口按钮 */}
|
|
|
<a
|
|
<a
|
|
|
href="/mobile"
|
|
href="/mobile"
|
|
@@ -366,21 +374,25 @@ export default function({ apiClient, app, moduleDir }: ModuleParams) {
|
|
|
const createHtmlWithConfig = (scriptConfig: EsmScriptConfig, title = '应用Starter') => {
|
|
const createHtmlWithConfig = (scriptConfig: EsmScriptConfig, title = '应用Starter') => {
|
|
|
return (c: HonoContext) => {
|
|
return (c: HonoContext) => {
|
|
|
const isProd = GLOBAL_CONFIG.ENV === 'production';
|
|
const isProd = GLOBAL_CONFIG.ENV === 'production';
|
|
|
|
|
+ const isLocalDeploy = Deno.env.get('IS_LOCAL_DEPLOY') === 'true';
|
|
|
|
|
|
|
|
return c.html(
|
|
return c.html(
|
|
|
<html lang="zh-CN">
|
|
<html lang="zh-CN">
|
|
|
<head>
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
<meta charset="UTF-8" />
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
|
+ {isProd && <meta name="version" content={Deno.env.get('VERSION') || '0.1.0'} />}
|
|
|
<title>{title}</title>
|
|
<title>{title}</title>
|
|
|
|
|
|
|
|
- {isProd ? (
|
|
|
|
|
|
|
+ {isLocalDeploy ? (
|
|
|
<script type="module" src={scriptConfig.prodSrc || `/client_dist/${scriptConfig.prodPath}`}></script>
|
|
<script type="module" src={scriptConfig.prodSrc || `/client_dist/${scriptConfig.prodPath}`}></script>
|
|
|
) : (
|
|
) : (
|
|
|
- <script src={scriptConfig.src} href={scriptConfig.href} deno-json={scriptConfig.denoJson} refresh={scriptConfig.refresh}></script>
|
|
|
|
|
|
|
+ <script src={scriptConfig.src} href={scriptConfig.href} deno-json={scriptConfig.denoJson}
|
|
|
|
|
+ {...isProd ? {}:{ refresh: true }}
|
|
|
|
|
+ ></script>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
- {isProd ? (<script src="/tailwindcss@3.4.16/index.js"></script>) : (<script src="https://cdn.tailwindcss.com"></script>)}
|
|
|
|
|
|
|
+ {isLocalDeploy ? (<script src="/tailwindcss@3.4.16/index.js"></script>) : (<script src="https://cdn.tailwindcss.com"></script>)}
|
|
|
|
|
|
|
|
<script dangerouslySetInnerHTML={{ __html: `window.CONFIG = ${JSON.stringify(GLOBAL_CONFIG)};` }} />
|
|
<script dangerouslySetInnerHTML={{ __html: `window.CONFIG = ${JSON.stringify(GLOBAL_CONFIG)};` }} />
|
|
|
|
|
|
|
@@ -436,14 +448,31 @@ export default function({ apiClient, app, moduleDir }: ModuleParams) {
|
|
|
}, GLOBAL_CONFIG.APP_NAME))
|
|
}, GLOBAL_CONFIG.APP_NAME))
|
|
|
|
|
|
|
|
honoApp.get('/mobile/*', createHtmlWithConfig({
|
|
honoApp.get('/mobile/*', createHtmlWithConfig({
|
|
|
- src: "https://esm.d8d.fun/xb",
|
|
|
|
|
- href: "/client/mobile/mobile_app.tsx",
|
|
|
|
|
- denoJson: "/deno.json",
|
|
|
|
|
- refresh: true,
|
|
|
|
|
|
|
+ src: "https://esm.d8d.fun/xb",
|
|
|
|
|
+ href: "/client/mobile/mobile_app.tsx",
|
|
|
|
|
+ denoJson: "/deno.json",
|
|
|
|
|
+ refresh: true,
|
|
|
prodPath: "mobile/mobile_app.js"
|
|
prodPath: "mobile/mobile_app.js"
|
|
|
}, GLOBAL_CONFIG.APP_NAME))
|
|
}, GLOBAL_CONFIG.APP_NAME))
|
|
|
|
|
|
|
|
- const staticRoutes = serveStatic({
|
|
|
|
|
|
|
+ // 迁移管理路由
|
|
|
|
|
+ honoApp.get('/migrations', createHtmlWithConfig({
|
|
|
|
|
+ src: "https://esm.d8d.fun/xb",
|
|
|
|
|
+ href: "/client/migrations/migrations_app.tsx",
|
|
|
|
|
+ denoJson: "/deno.json",
|
|
|
|
|
+ refresh: true,
|
|
|
|
|
+ prodPath: "migrations/migrations_app.js"
|
|
|
|
|
+ }, GLOBAL_CONFIG.APP_NAME))
|
|
|
|
|
+
|
|
|
|
|
+ honoApp.get('/migrations/*', createHtmlWithConfig({
|
|
|
|
|
+ src: "https://esm.d8d.fun/xb",
|
|
|
|
|
+ href: "/client/migrations/migrations_app.tsx",
|
|
|
|
|
+ denoJson: "/deno.json",
|
|
|
|
|
+ refresh: true,
|
|
|
|
|
+ prodPath: "migrations/migrations_app.js"
|
|
|
|
|
+ }, GLOBAL_CONFIG.APP_NAME))
|
|
|
|
|
+
|
|
|
|
|
+ const staticRoutes = serveStatic({
|
|
|
root: moduleDir,
|
|
root: moduleDir,
|
|
|
onFound: async (path: string, c: HonoContext) => {
|
|
onFound: async (path: string, c: HonoContext) => {
|
|
|
const fileExt = path.split('.').pop()?.toLowerCase()
|
|
const fileExt = path.split('.').pop()?.toLowerCase()
|