Spaces:
Sleeping
Sleeping
Upload templates.py
Browse files- core/templates.py +43 -0
core/templates.py
CHANGED
|
@@ -2094,12 +2094,51 @@ async def get_login_html(request: Request, error: str = None) -> HTMLResponse:
|
|
| 2094 |
line-height: 1.5;
|
| 2095 |
}}
|
| 2096 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2097 |
@media (max-width: 480px) {{
|
| 2098 |
.container {{
|
| 2099 |
padding: 32px 24px;
|
| 2100 |
}}
|
| 2101 |
}}
|
| 2102 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2103 |
</head>
|
| 2104 |
<body>
|
| 2105 |
<div class="container">
|
|
@@ -2126,6 +2165,10 @@ async def get_login_html(request: Request, error: str = None) -> HTMLResponse:
|
|
| 2126 |
<div class="hint">
|
| 2127 |
会话保持 24 小时
|
| 2128 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2129 |
</div>
|
| 2130 |
</body>
|
| 2131 |
</html>
|
|
|
|
| 2094 |
line-height: 1.5;
|
| 2095 |
}}
|
| 2096 |
|
| 2097 |
+
.iframe-hint {{
|
| 2098 |
+
margin-top: 16px;
|
| 2099 |
+
padding: 12px 14px;
|
| 2100 |
+
background: #fff4e6;
|
| 2101 |
+
border: 1px solid #ffd666;
|
| 2102 |
+
border-radius: 8px;
|
| 2103 |
+
font-size: 13px;
|
| 2104 |
+
color: #d46b08;
|
| 2105 |
+
line-height: 1.5;
|
| 2106 |
+
display: none;
|
| 2107 |
+
}}
|
| 2108 |
+
|
| 2109 |
+
.iframe-hint a {{
|
| 2110 |
+
color: #0071e3;
|
| 2111 |
+
text-decoration: none;
|
| 2112 |
+
font-weight: 600;
|
| 2113 |
+
}}
|
| 2114 |
+
|
| 2115 |
+
.iframe-hint a:hover {{
|
| 2116 |
+
text-decoration: underline;
|
| 2117 |
+
}}
|
| 2118 |
+
|
| 2119 |
@media (max-width: 480px) {{
|
| 2120 |
.container {{
|
| 2121 |
padding: 32px 24px;
|
| 2122 |
}}
|
| 2123 |
}}
|
| 2124 |
</style>
|
| 2125 |
+
<script>
|
| 2126 |
+
// 检测是否在 iframe 内
|
| 2127 |
+
if (window.self !== window.top) {{
|
| 2128 |
+
document.addEventListener('DOMContentLoaded', function() {{
|
| 2129 |
+
const hint = document.getElementById('iframe-hint');
|
| 2130 |
+
if (hint) {{
|
| 2131 |
+
hint.style.display = 'block';
|
| 2132 |
+
// 获取当前完整 URL(去掉 iframe 参数)
|
| 2133 |
+
const currentUrl = window.location.href.replace(/[?&]__theme=.*?(&|$)/, '');
|
| 2134 |
+
const link = document.getElementById('direct-link');
|
| 2135 |
+
if (link) {{
|
| 2136 |
+
link.href = currentUrl;
|
| 2137 |
+
}}
|
| 2138 |
+
}}
|
| 2139 |
+
}});
|
| 2140 |
+
}}
|
| 2141 |
+
</script>
|
| 2142 |
</head>
|
| 2143 |
<body>
|
| 2144 |
<div class="container">
|
|
|
|
| 2165 |
<div class="hint">
|
| 2166 |
会话保持 24 小时
|
| 2167 |
</div>
|
| 2168 |
+
|
| 2169 |
+
<div id="iframe-hint" class="iframe-hint">
|
| 2170 |
+
⚠️ HuggingFace 内部无法登录,<a id="direct-link" href="#" target="_blank">点我跳转到新窗口</a>
|
| 2171 |
+
</div>
|
| 2172 |
</div>
|
| 2173 |
</body>
|
| 2174 |
</html>
|