mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
- Implement dynamic initialization detection in lora_routes - Add initialization notice template with loading spinner - Create CSS styles for initialization notice - Add client-side script to auto-refresh page when initialization completes
87 lines
3.4 KiB
HTML
87 lines
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>LoRA Manager</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="/loras_static/css/style.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/loras_static/images/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/loras_static/images/favicon-16x16.png">
|
|
<link rel="manifest" href="/loras_static/images/site.webmanifest">
|
|
|
|
<!-- 预加载关键资源 -->
|
|
<link rel="preload" href="/loras_static/css/style.css" as="style">
|
|
<link rel="preload" href="/loras_static/js/main.js" as="script" crossorigin="anonymous">
|
|
|
|
<!-- 优化字体加载 -->
|
|
<link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin>
|
|
|
|
<!-- 添加性能监控 -->
|
|
<script>
|
|
performance.mark('page-start');
|
|
window.addEventListener('load', () => {
|
|
performance.mark('page-end');
|
|
performance.measure('page-load', 'page-start', 'page-end');
|
|
});
|
|
</script>
|
|
|
|
<!-- 添加安全相关的 meta 标签 -->
|
|
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">
|
|
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
|
|
|
|
<!-- 添加资源加载策略 -->
|
|
<link rel="preconnect" href="https://civitai.com">
|
|
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
|
|
</head>
|
|
<body>
|
|
<div class="theme-toggle" onclick="toggleTheme()">
|
|
<img src="/loras_static/images/theme-toggle.svg" alt="Theme">
|
|
</div>
|
|
|
|
{% include 'components/modals.html' %}
|
|
{% include 'components/loading.html' %}
|
|
|
|
<div class="container">
|
|
{% if is_initializing %}
|
|
<div class="initialization-notice">
|
|
<div class="notice-content">
|
|
<div class="loading-spinner"></div>
|
|
<h2>Initializing LoRA Manager</h2>
|
|
<p>Scanning and building LoRA cache. This may take a few minutes...</p>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
{% include 'components/controls.html' %}
|
|
<!-- Lora卡片容器 -->
|
|
<div class="card-grid" id="loraGrid">
|
|
<!-- Cards will be dynamically inserted here -->
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script type="module" src="/loras_static/js/main.js"></script>
|
|
<script>
|
|
// 检查初始化状态并设置自动刷新
|
|
{% if is_initializing %}
|
|
async function checkInitStatus() {
|
|
try {
|
|
const response = await fetch('/api/loras?page=1&page_size=1');
|
|
if (response.ok) {
|
|
// 如果成功获取数据,说明初始化完成,刷新页面
|
|
window.location.reload();
|
|
} else {
|
|
// 如果还未完成,继续轮询
|
|
setTimeout(checkInitStatus, 2000); // 每2秒检查一次
|
|
}
|
|
} catch (error) {
|
|
// 如果出错,继续轮询
|
|
setTimeout(checkInitStatus, 2000);
|
|
}
|
|
}
|
|
|
|
// 启动状态检查
|
|
checkInitStatus();
|
|
{% endif %}
|
|
</script>
|
|
</body>
|
|
</html> |