Spaces:
Sleeping
Sleeping
Add Dockerfile and configure app port to 7860
Browse files- .gitattributes +1 -0
- Dockerfile +25 -0
- README.md +6 -4
- custom.css +460 -0
- custom.js +1 -0
- fonts/DankMono-Italic.woff2 +0 -0
- fonts/DankMono-Regular.woff2 +0 -0
- fonts/DingTalk-JinBuTi.woff2 +3 -0
- fonts/JetBrainsMono-ExtraBold.woff2 +0 -0
- sync_data.sh +130 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
fonts/DingTalk-JinBuTi.woff2 filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ghcr.io/open-webui/open-webui:main
|
| 2 |
+
|
| 3 |
+
# 复制字体文件
|
| 4 |
+
COPY fonts/* /app/build/assets/fonts/
|
| 5 |
+
# 复制自定义CSS和JS文件
|
| 6 |
+
COPY custom.css /app/build/assets/
|
| 7 |
+
COPY custom.js /app/build/assets/
|
| 8 |
+
|
| 9 |
+
# 在</head>标签前添加custom.css引用
|
| 10 |
+
RUN sed -i 's|</head>|<link rel="stylesheet" href="/assets/custom.css"></head>|' /app/build/index.html && sed -i 's|</body>|<script src="/assets/custom.js"></script></body>|' /app/build/index.html
|
| 11 |
+
|
| 12 |
+
# 安装Redis 在open webui 函数中使用 OCR功能
|
| 13 |
+
RUN apt-get update && apt-get install -y redis-server
|
| 14 |
+
# 修改Redis配置和权限
|
| 15 |
+
RUN mkdir -p /var/run/redis && chown -R 1000:1000 /var/run/redis && chown -R 1000:1000 /var/lib/redis && chmod 777 /var/run/redis
|
| 16 |
+
|
| 17 |
+
# 创建启动Redis的脚本
|
| 18 |
+
RUN echo "#!/bin/bash" > redis-start.sh && echo 'redis-server --daemonize yes --save "" --appendonly no --requirepass ${REDIS_PASSWORD}' >> redis-start.sh && echo "sleep 2" >> redis-start.sh && echo "echo 'Redis status:'" >> redis-start.sh && echo 'redis-cli -a ${REDIS_PASSWORD} ping' >> redis-start.sh
|
| 19 |
+
|
| 20 |
+
COPY sync_data.sh sync_data.sh
|
| 21 |
+
RUN chmod -R 777 ./data && sed -i "1r sync_data.sh" ./start.sh && sed -i "1r redis-start.sh" ./start.sh
|
| 22 |
+
# 设置端口
|
| 23 |
+
ENV PORT=7860
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: eeeeooopeniiiiwoooebooooui
|
| 3 |
+
emoji: "🤗"
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
app_port: 7860
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 12 |
+
|
custom.css
ADDED
|
@@ -0,0 +1,460 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@font-face {
|
| 2 |
+
font-family: 'Dank Mono';
|
| 3 |
+
src: url('../assets/fonts/DankMono-Regular.woff2') format('woff2');
|
| 4 |
+
font-display: swap;
|
| 5 |
+
font-style: normal;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
@font-face {
|
| 9 |
+
font-family: 'Dank Mono';
|
| 10 |
+
src: url('../assets/fonts/DankMono-Italic.woff2') format('woff2');
|
| 11 |
+
font-display: swap;
|
| 12 |
+
font-style: italic;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
@font-face {
|
| 16 |
+
font-family: 'JinBuTi';
|
| 17 |
+
src: url('../assets/fonts/DingTalk-JinBuTi.woff2') format('woff2');
|
| 18 |
+
font-display: swap;
|
| 19 |
+
}
|
| 20 |
+
@font-face {
|
| 21 |
+
font-family: 'JetBrains Mono';
|
| 22 |
+
src: url('../assets/fonts/JetBrainsMono-ExtraBold.woff2') format('woff2');
|
| 23 |
+
font-display: swap;
|
| 24 |
+
font-weight: 800; /* 从 bold 改为 800,对应 ExtraBold font-weight: bold 通常等同于 font-weight: 700 */
|
| 25 |
+
font-style: normal;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
html {
|
| 29 |
+
scroll-behavior: smooth;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
body {
|
| 33 |
+
font-family: 'JinBuTi', -apple-system, BlinkMacSystemFont, sans-serif;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/* 代码块容器样式 */
|
| 37 |
+
.language-javascript, [class*="language-"] {
|
| 38 |
+
background: #f6f8fa !important;
|
| 39 |
+
border-radius: 10px !important;
|
| 40 |
+
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.1) !important;
|
| 41 |
+
position: relative;
|
| 42 |
+
margin: 1.2em 0;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.dark .language-javascript, .dark [class*="language-"] {
|
| 46 |
+
background: #282c34 !important;
|
| 47 |
+
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4) !important;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* 代码块顶部栏 */
|
| 51 |
+
.sticky.top-8 {
|
| 52 |
+
background: #e1e4e8 !important;
|
| 53 |
+
height: 40px !important;
|
| 54 |
+
display: flex;
|
| 55 |
+
align-items: center;
|
| 56 |
+
border-radius: 10px 10px 0 0;
|
| 57 |
+
padding: 0 15px !important;
|
| 58 |
+
margin-bottom: -59px !important;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.dark .sticky.top-8 {
|
| 62 |
+
background: #21252b !important;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/* 语言标识 */
|
| 66 |
+
.text-text-300 {
|
| 67 |
+
position: absolute;
|
| 68 |
+
left: 60px;
|
| 69 |
+
top: 2px;
|
| 70 |
+
color: #abb2bf !important;
|
| 71 |
+
font-size: 17px !important;
|
| 72 |
+
font-weight: 500 !important;
|
| 73 |
+
z-index: 11;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.dark .text-text-300 {
|
| 77 |
+
color: #586069 !important;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/* 顶部按钮样式优化 */
|
| 81 |
+
.save-code-button, .copy-code-button, .run-code-button {
|
| 82 |
+
background: #f8f9fa !important;
|
| 83 |
+
color: #333 !important;
|
| 84 |
+
border: 1px solid #d1d5da !important;
|
| 85 |
+
font-size: 12px !important;
|
| 86 |
+
padding: 4px 12px !important;
|
| 87 |
+
border-radius: 4px !important;
|
| 88 |
+
transition: all 0.2s ease-in-out !important;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.dark .save-code-button, .dark .copy-code-button, .dark .run-code-button {
|
| 92 |
+
background: #323842 !important;
|
| 93 |
+
color: #abb2bf !important;
|
| 94 |
+
border: 1px solid #3e4451 !important;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.save-code-button:hover, .copy-code-button:hover {
|
| 98 |
+
background: #e9ecef !important;
|
| 99 |
+
color: #222 !important;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.dark .save-code-button:hover, .dark .copy-code-button:hover {
|
| 103 |
+
background: #3e4451 !important;
|
| 104 |
+
color: #fff !important;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/* 代码块顶部装饰圆点 */
|
| 108 |
+
.language-javascript::before, [class*="language-"]::before {
|
| 109 |
+
content: " ";
|
| 110 |
+
position: absolute;
|
| 111 |
+
border-radius: 50%;
|
| 112 |
+
background: #ff5f56;
|
| 113 |
+
width: 12px;
|
| 114 |
+
height: 12px;
|
| 115 |
+
left: 15px;
|
| 116 |
+
top: 14px;
|
| 117 |
+
box-shadow: 20px 0 #ffbd2e, 40px 0 #27c93f;
|
| 118 |
+
z-index: 10;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.dakr .language-javascript::before, .dakr [class*="language-"]::before {
|
| 122 |
+
background: #fc625d;
|
| 123 |
+
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/* 代码内容区域 */
|
| 127 |
+
.cm-content {
|
| 128 |
+
/* font-family: 'Dank Mono', -apple-system, BlinkMacSystemFont, Inter, ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; */
|
| 129 |
+
font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, Inter, ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
| 130 |
+
font-size: 15px !important;
|
| 131 |
+
line-height: 1.6em !important;
|
| 132 |
+
padding: 20px 1.4em 1em 30px !important;
|
| 133 |
+
color: #24292e !important;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.dark .cm-content {
|
| 137 |
+
color: #abb2bf !important;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/* 代码语法高亮 */
|
| 141 |
+
.cm-line .ͼb {
|
| 142 |
+
/* 关键字 */
|
| 143 |
+
color: #d73a49 !important;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.dark .cm-line .ͼb {
|
| 147 |
+
color: #c678dd !important;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.cm-line .ͼd {
|
| 151 |
+
/* 数字 */
|
| 152 |
+
color: #a29bfe !important;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
.dakr .cm-line .ͼd {
|
| 156 |
+
color: #e5c07b !important;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.cm-line .ͼe {
|
| 160 |
+
/* 字符串 */
|
| 161 |
+
color: #6a89cc !important;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.dakr .cm-line .ͼe {
|
| 165 |
+
color: #98c379 !important;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
.cm-line .ͼg {
|
| 169 |
+
/* 变量 */
|
| 170 |
+
color: #2ca9e1 !important;
|
| 171 |
+
font-style: italic;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.dakr .cm-line .ͼg {
|
| 175 |
+
color: #e3adb9 !important;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
/* 代码语法高亮 - 扩展 */
|
| 179 |
+
.cm-comment {
|
| 180 |
+
/* 注释 */
|
| 181 |
+
color: #7f848e !important;
|
| 182 |
+
font-style: italic;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
.cm-property {
|
| 186 |
+
color: #61afef !important;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
cm-tag {
|
| 190 |
+
color: #e06c75 !important;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.cm-attribute {
|
| 194 |
+
color: #d19a66 !important;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
.cm-string {
|
| 198 |
+
color: #98c379 !important;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.cm-operator {
|
| 202 |
+
color: #56b6c2 !important;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
span.ͼc {
|
| 206 |
+
color: #7d5fff !important;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
span.ͼl {
|
| 210 |
+
color: #6bddcd !important;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
span.ͼt {
|
| 214 |
+
/* 暗色模式下的逗号 */
|
| 215 |
+
color: #ddb078 !important;
|
| 216 |
+
;
|
| 217 |
+
font-style: italic;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
span.ͼr {
|
| 221 |
+
/* 暗色模式下的函数名 */
|
| 222 |
+
font-style: italic;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
span.ͼf {
|
| 226 |
+
/* 亮色模式下奇怪的符号 */
|
| 227 |
+
color: #70a1ff;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
span.ͼm {
|
| 231 |
+
/* 亮色模式下的注释 */
|
| 232 |
+
color: #f29a76;
|
| 233 |
+
font-style: italic;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
span.ͼw {
|
| 237 |
+
/* 暗色模式下的注释 */
|
| 238 |
+
font-style: italic;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
/* 滚动条样式 */
|
| 242 |
+
.cm-scroller::-webkit-scrollbar {
|
| 243 |
+
height: 10px !important;
|
| 244 |
+
width: 10px !important;
|
| 245 |
+
background-color: #f6f8fa !important;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
.dark .cm-scroller::-webkit-scrollbar {
|
| 249 |
+
background-color: #282c34 !important;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.cm-scroller::-webkit-scrollbar-track {
|
| 253 |
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1) !important;
|
| 254 |
+
border-radius: 10px !important;
|
| 255 |
+
background-color: #f6f8fa !important;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
.dark .cm-scroller::-webkit-scrollbar-track {
|
| 259 |
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, .3) !important;
|
| 260 |
+
background-color: #282c34 !important;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.cm-scroller::-webkit-scrollbar-thumb {
|
| 264 |
+
border-radius: 10px !important;
|
| 265 |
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, .2) !important;
|
| 266 |
+
background-color: #d1d5da !important;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
.dark .cm-scroller::-webkit-scrollbar-thumb {
|
| 270 |
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, .5) !important;
|
| 271 |
+
background-color: #3e4451 !important;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
/* 行号栏样式 */
|
| 275 |
+
.cm-gutters {
|
| 276 |
+
background: #f6f8fa !important;
|
| 277 |
+
border-right: 1px solid #d1d5da !important;
|
| 278 |
+
color: #586069 !important;
|
| 279 |
+
padding-right: 10px !important;
|
| 280 |
+
font-family: "Dank Mono";
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
.dark .cm-gutters {
|
| 284 |
+
background: #282c34 !important;
|
| 285 |
+
border-right: 1px solid #3e4451 !important;
|
| 286 |
+
color: #495162 !important;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
/* 当前行高亮 */
|
| 290 |
+
.cm-activeLine {
|
| 291 |
+
background: #6699ff0b !important;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
.cm-gutterElement.cm-activeLineGutter {
|
| 295 |
+
background-color: #f9d3e3;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.dark .cm-gutterElement.cm-activeLineGutter {
|
| 299 |
+
background-color: #dd7694;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
/* 添加代码选中样式 */
|
| 303 |
+
.cm-selectionBackground, .cm-content ::selection {
|
| 304 |
+
background-color: rgba(122, 129, 255, 0.2) !important;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
.cm-line.cm-selected {
|
| 308 |
+
background-color: rgba(122, 129, 255, 0.2) !important;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
/* 选中时的文本颜色保持原样,确保可读性 */
|
| 312 |
+
.cm-content ::selection {
|
| 313 |
+
color: rgba(62, 158, 111, 0.9) !important;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.dark .cm-content ::selection {
|
| 317 |
+
color: rgba(245, 177, 255, 0.9) !important;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
/* 匹配相同结果时的颜色 */
|
| 321 |
+
.cm-selectionMatch {
|
| 322 |
+
background-color: #9c88ff5a !important;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
/* 当有多行选中时的样式 */
|
| 326 |
+
.cm-selectionLayer>.cm-selectionBackground {
|
| 327 |
+
background-color: rgba(122, 129, 255, 0.2) !important;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
/* 代码块折叠/展开样式添加与修改 */
|
| 331 |
+
.cm-scroller {
|
| 332 |
+
background-color: #f6f8fa;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
#collapsed>.cm-scroller, #expanded>.cm-scroller {
|
| 336 |
+
padding-bottom: 40px;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
.dark .cm-scroller {
|
| 340 |
+
background-color: #282c34;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
.cm-scroller {
|
| 344 |
+
overflow: auto !important;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
.cm-editor {
|
| 348 |
+
transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
|
| 349 |
+
overflow: hidden !important;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
/* 只给超高的代码块添加最大高度和内边距 */
|
| 353 |
+
.cm-editor#collapsed {
|
| 354 |
+
height: 400px;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
/* .cm-editor#expanded { padding-bottom: 40px; } */
|
| 358 |
+
.code-expand-btn {
|
| 359 |
+
position: absolute;
|
| 360 |
+
bottom: 10px;
|
| 361 |
+
left: 50%;
|
| 362 |
+
transform: translateX(-50%);
|
| 363 |
+
display: flex;
|
| 364 |
+
justify-content: center;
|
| 365 |
+
align-items: center;
|
| 366 |
+
padding: 6px 15px;
|
| 367 |
+
border-radius: 15px;
|
| 368 |
+
font-size: 12px;
|
| 369 |
+
cursor: pointer;
|
| 370 |
+
border: none;
|
| 371 |
+
color: #666;
|
| 372 |
+
background: rgba(255, 255, 255, 0.6);
|
| 373 |
+
backdrop-filter: blur(8px);
|
| 374 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 375 |
+
-webkit-backdrop-filter: blur(8px);
|
| 376 |
+
z-index: 11;
|
| 377 |
+
transition: all 0.3s ease;
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
.dark .code-expand-btn {
|
| 381 |
+
background: rgba(45, 45, 45, 0.6);
|
| 382 |
+
color: #fff;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
.code-expand-btn:hover {
|
| 386 |
+
background: rgba(255, 255, 255, 0.8);
|
| 387 |
+
backdrop-filter: blur(12px);
|
| 388 |
+
-webkit-backdrop-filter: blur(12px);
|
| 389 |
+
transform: translateX(-50%) translateY(-2px);
|
| 390 |
+
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
.dark .code-expand-btn:hover {
|
| 394 |
+
background: rgba(45, 45, 45, 0.8);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
.code-expand-btn:active {
|
| 398 |
+
transform: translateX(-50%) translateY(0);
|
| 399 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
.code-expand-btn::before {
|
| 403 |
+
content: "⌄";
|
| 404 |
+
display: inline-block;
|
| 405 |
+
margin-right: 4px;
|
| 406 |
+
font-size: 14px;
|
| 407 |
+
transition: transform 0.3s ease;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
.code-expand-btn#expanded::before {
|
| 411 |
+
transform: rotate(180deg);
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
.code-expand-btn::after {
|
| 415 |
+
content: "展开代码";
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
.code-expand-btn#expanded::after {
|
| 419 |
+
content: "收起代码";
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
/* 渐变遮罩 */
|
| 423 |
+
.cm-editor#collapsed::after {
|
| 424 |
+
content: '';
|
| 425 |
+
position: absolute;
|
| 426 |
+
bottom: 0;
|
| 427 |
+
left: 0;
|
| 428 |
+
right: 0;
|
| 429 |
+
height: 100px;
|
| 430 |
+
background: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.8) 100%);
|
| 431 |
+
pointer-events: none;
|
| 432 |
+
opacity: 0;
|
| 433 |
+
transition: opacity 0.3s ease;
|
| 434 |
+
z-index: 10;
|
| 435 |
+
/* 确保遮罩层覆盖到滚动条 */
|
| 436 |
+
width: calc(100% + 17px);
|
| 437 |
+
/* 17px是标准滚动条宽度 */
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
.dark .cm-editor#collapsed::after {
|
| 441 |
+
background: linear-gradient(transparent 0%, rgba(45, 45, 45, 0.3) 40%, rgba(45, 45, 45, 0.6) 80%, rgba(45, 45, 45, 0.8) 100%);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
/* 只在折叠状态显示渐变遮罩 */
|
| 445 |
+
.cm-editor#collapsed::after {
|
| 446 |
+
opacity: 1;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/* 隐藏原始的折叠按钮 */
|
| 450 |
+
/* button.flex.gap-1.items-center:not(.run-code-button) {
|
| 451 |
+
display: none;
|
| 452 |
+
} */
|
| 453 |
+
div.flex.items-center.gap-0\.5 button.flex.gap-1.items-center:not(.run-code-button) {
|
| 454 |
+
display: none;
|
| 455 |
+
}
|
| 456 |
+
/* 代码区域使用字体 */
|
| 457 |
+
.cm-editor {
|
| 458 |
+
font-family: 'JetBrains Mono', monospace;
|
| 459 |
+
font-weight: 800;
|
| 460 |
+
}
|
custom.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
(function () { function checkIsEditPage() { return window.location.href.includes('/functions'); } let isCurrentlyEditPage = checkIsEditPage(); function onRouteChange() { isCurrentlyEditPage = checkIsEditPage(); if (isCurrentlyEditPage) { if (mutationObserverActive) { mutationObserver.disconnect(); mutationObserverActive = false; } } else { initializeAllCodeBlocks(); if (!mutationObserverActive) { mutationObserver.observe(document.body, { childList: true, subtree: true }); mutationObserverActive = true; } } } const originalPushState = history.pushState; history.pushState = function (state, title, url) { originalPushState.apply(history, arguments); onRouteChange(); }; window.addEventListener('popstate', onRouteChange); const observedCodeBlocks = new WeakSet(); const resizeObserver = new ResizeObserver((entries) => { if (isCurrentlyEditPage) return; for (const entry of entries) { const editorRoot = entry.target; if (!editorRoot.classList.contains('cm-editor')) continue; updateCodeBlock(editorRoot); } }); function updateCodeBlock(editorRoot) { if (editorRoot.querySelector('.code-expand-btn')) return; const height = editorRoot.scrollHeight; if (height > 400) { editorRoot.id = 'collapsed'; const expandBtn = document.createElement('button'); expandBtn.className = 'code-expand-btn'; expandBtn.id = 'collapsed'; editorRoot.appendChild(expandBtn); editorRoot.style.height = '400px'; } } function initializeCodeBlock(editorRoot) { if (observedCodeBlocks.has(editorRoot)) return; observedCodeBlocks.add(editorRoot); resizeObserver.observe(editorRoot); updateCodeBlock(editorRoot); } function initializeAllCodeBlocks() { if (isCurrentlyEditPage) return; document.querySelectorAll('.cm-editor').forEach(initializeCodeBlock); } const mutationObserver = new MutationObserver((mutations) => { if (isCurrentlyEditPage) return; let hasNewCodeBlocks = false; mutations.forEach((mutation) => { mutation.addedNodes.forEach((node) => { if (node.nodeType !== 1) return; if (node.classList?.contains('cm-editor')) { initializeCodeBlock(node); hasNewCodeBlocks = true; } else { const matches = node.querySelectorAll?.('.cm-editor') || []; matches.forEach((el) => { initializeCodeBlock(el); hasNewCodeBlocks = true; }); } }); }); if (hasNewCodeBlocks) requestAnimationFrame(initializeAllCodeBlocks); }); let mutationObserverActive = false; document.addEventListener('click', function (evt) { if (!evt.target.classList.contains('code-expand-btn')) return; const editorRoot = evt.target.closest('.cm-editor'); if (!editorRoot) return; const isCollapsed = editorRoot.id === 'collapsed'; requestAnimationFrame(() => { if (isCollapsed) { const scroller = editorRoot.querySelector('.cm-scroller'); editorRoot.style.height = `${scroller.scrollHeight}px`; editorRoot.id = 'expanded'; evt.target.id = 'expanded'; } else { editorRoot.style.height = '400px'; editorRoot.id = 'collapsed'; evt.target.id = 'collapsed'; const scrollTarget = editorRoot.closest('.relative.my-2')?.parentElement; scrollTarget?.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); function init() { isCurrentlyEditPage = checkIsEditPage(); if (!isCurrentlyEditPage) initializeAllCodeBlocks(); mutationObserver.observe(document.body, { childList: true, subtree: true }); mutationObserverActive = true; } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } window.addEventListener('error', (error) => { console.error('Code block error:', error); }); window.addEventListener('unhandledrejection', (event) => { console.error('Unhandled rejection:', event.reason); }); })();
|
fonts/DankMono-Italic.woff2
ADDED
|
Binary file (24.8 kB). View file
|
|
|
fonts/DankMono-Regular.woff2
ADDED
|
Binary file (23.1 kB). View file
|
|
|
fonts/DingTalk-JinBuTi.woff2
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a1f2dbf309f5aa4802039b616a4e5a22053b6aee1bd413637371b3a8facf473c
|
| 3 |
+
size 1002760
|
fonts/JetBrainsMono-ExtraBold.woff2
ADDED
|
Binary file (93.7 kB). View file
|
|
|
sync_data.sh
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
mkdir -p ./data
|
| 4 |
+
|
| 5 |
+
# 生成校验和文件
|
| 6 |
+
generate_sum() {
|
| 7 |
+
local file=$1
|
| 8 |
+
local sum_file=$2
|
| 9 |
+
sha256sum "$file" > "$sum_file"
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
# 优先从WebDAV恢复数据
|
| 13 |
+
if [ ! -z "$WEBDAV_URL" ] && [ ! -z "$WEBDAV_USERNAME" ] && [ ! -z "$WEBDAV_PASSWORD" ]; then
|
| 14 |
+
echo "尝试从WebDAV恢复数据..."
|
| 15 |
+
curl -L --fail --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" "$WEBDAV_URL/webui.db" -o "./data/webui.db" && {
|
| 16 |
+
echo "从WebDAV恢复数据成功"
|
| 17 |
+
} || {
|
| 18 |
+
if [ ! -z "$G_NAME" ] && [ ! -z "$G_TOKEN" ]; then
|
| 19 |
+
echo "从WebDAV恢复失败,尝试从GitHub恢复..."
|
| 20 |
+
REPO_URL="https://${G_TOKEN}@github.com/${G_NAME}.git"
|
| 21 |
+
git clone "$REPO_URL" ./data/temp && {
|
| 22 |
+
if [ -f ./data/temp/webui.db ]; then
|
| 23 |
+
mv ./data/temp/webui.db ./data/webui.db
|
| 24 |
+
echo "从GitHub仓库恢复成功"
|
| 25 |
+
rm -rf ./data/temp
|
| 26 |
+
else
|
| 27 |
+
echo "GitHub仓库中未找到webui.db"
|
| 28 |
+
rm -rf ./data/temp
|
| 29 |
+
fi
|
| 30 |
+
}
|
| 31 |
+
else
|
| 32 |
+
echo "WebDAV恢复失败,且未配置GitHub"
|
| 33 |
+
fi
|
| 34 |
+
}
|
| 35 |
+
else
|
| 36 |
+
echo "未配置WebDAV,跳过数据恢复"
|
| 37 |
+
fi
|
| 38 |
+
|
| 39 |
+
# 同步函数
|
| 40 |
+
sync_data() {
|
| 41 |
+
while true; do
|
| 42 |
+
echo "开始同步..."
|
| 43 |
+
HOUR=$(date +%H)
|
| 44 |
+
|
| 45 |
+
if [ -f "./data/webui.db" ]; then
|
| 46 |
+
# 生成新的校验和文件
|
| 47 |
+
generate_sum "./data/webui.db" "./data/webui.db.sha256.new"
|
| 48 |
+
|
| 49 |
+
# 检查文件是否变化
|
| 50 |
+
if [ ! -f "./data/webui.db.sha256" ] || ! cmp -s "./data/webui.db.sha256.new" "./data/webui.db.sha256"; then
|
| 51 |
+
echo "检测到文件变化,开始同步..."
|
| 52 |
+
mv "./data/webui.db.sha256.new" "./data/webui.db.sha256"
|
| 53 |
+
|
| 54 |
+
# 同步到WebDAV
|
| 55 |
+
if [ ! -z "$WEBDAV_URL" ] && [ ! -z "$WEBDAV_USERNAME" ] && [ ! -z "$WEBDAV_PASSWORD" ]; then
|
| 56 |
+
echo "同步到WebDAV..."
|
| 57 |
+
|
| 58 |
+
# 上传数据文件
|
| 59 |
+
curl -L -T "./data/webui.db" --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" "$WEBDAV_URL/webui.db" && {
|
| 60 |
+
echo "WebDAV更新成功"
|
| 61 |
+
|
| 62 |
+
# 每日备份(包括WebDAV和GitHub),在每天0点进行
|
| 63 |
+
if [ "$HOUR" = "00" ]; then
|
| 64 |
+
echo "开始每日备份..."
|
| 65 |
+
|
| 66 |
+
# 获取前一天的日期
|
| 67 |
+
YESTERDAY=$(date -d "yesterday" '+%Y%m%d')
|
| 68 |
+
FILENAME_DAILY="webui_${YESTERDAY}.db"
|
| 69 |
+
|
| 70 |
+
# WebDAV每日备份
|
| 71 |
+
curl -L -T "./data/webui.db" --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" "$WEBDAV_URL/$FILENAME_DAILY" && {
|
| 72 |
+
echo "WebDAV日期备份成功: $FILENAME_DAILY"
|
| 73 |
+
|
| 74 |
+
# GitHub每日备份
|
| 75 |
+
if [ ! -z "$G_NAME" ] && [ ! -z "$G_TOKEN" ]; then
|
| 76 |
+
echo "开始GitHub每日备份..."
|
| 77 |
+
REPO_URL="https://${G_TOKEN}@github.com/${G_NAME}.git"
|
| 78 |
+
git clone "$REPO_URL" ./data/temp || {
|
| 79 |
+
echo "GitHub克隆失败"
|
| 80 |
+
rm -rf ./data/temp
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
if [ -d "./data/temp" ]; then
|
| 84 |
+
cd ./data/temp
|
| 85 |
+
git config user.name "AutoSync Bot"
|
| 86 |
+
git config user.email "autosync@bot.com"
|
| 87 |
+
git checkout main || git checkout master
|
| 88 |
+
cp ../webui.db ./webui.db
|
| 89 |
+
|
| 90 |
+
if [[ -n $(git status -s) ]]; then
|
| 91 |
+
git add webui.db
|
| 92 |
+
git commit -m "Auto sync webui.db for ${YESTERDAY}"
|
| 93 |
+
git push origin HEAD && {
|
| 94 |
+
echo "GitHub推送成功"
|
| 95 |
+
} || echo "GitHub推送失败"
|
| 96 |
+
else
|
| 97 |
+
echo "GitHub: 无数据变化"
|
| 98 |
+
fi
|
| 99 |
+
cd ../..
|
| 100 |
+
rm -rf ./data/temp
|
| 101 |
+
fi
|
| 102 |
+
fi
|
| 103 |
+
} || echo "WebDAV日期备份失败"
|
| 104 |
+
fi
|
| 105 |
+
} || {
|
| 106 |
+
echo "WebDAV上传失败,重试..."
|
| 107 |
+
sleep 10
|
| 108 |
+
curl -L -T "./data/webui.db" --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" "$WEBDAV_URL/webui.db" || {
|
| 109 |
+
echo "WebDAV重试失败"
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
fi
|
| 113 |
+
else
|
| 114 |
+
echo "文件未发生变化,跳过同步"
|
| 115 |
+
rm -f "./data/webui.db.sha256.new"
|
| 116 |
+
fi
|
| 117 |
+
else
|
| 118 |
+
echo "未找到webui.db,跳过同步"
|
| 119 |
+
fi
|
| 120 |
+
|
| 121 |
+
echo "当前时间: $(date '+%Y-%m-%d %H:%M:%S')"
|
| 122 |
+
# echo "下次同步: $(date -d '+5 minutes' '+%Y-%m-%d %H:%M:%S')"
|
| 123 |
+
# sleep 300
|
| 124 |
+
echo "下次同步: $(date -d "+$SYNC_INTERVAL seconds" '+%Y-%m-%d %H:%M:%S')"
|
| 125 |
+
sleep $SYNC_INTERVAL
|
| 126 |
+
done
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
# 启动同步进程
|
| 130 |
+
sync_data &
|