fix: URL encode Gist raw endpoints for reliable Shields.io badge rendering
This commit is contained in:
18
README.md
18
README.md
@@ -7,25 +7,25 @@ A collection of enhancements, plugins, and prompts for [OpenWebUI](https://githu
|
||||
|
||||
<!-- STATS_START -->
|
||||
## 📊 Community Stats
|
||||
> 🕐 Auto-updated: 2026-02-11 12:10
|
||||
> 🕐 Auto-updated: 2026-02-11 12:12
|
||||
|
||||
| 👤 Author | 👥 Followers | ⭐ Points | 🏆 Contributions |
|
||||
| :---: | :---: | :---: | :---: |
|
||||
| [Fu-Jie](https://openwebui.com/u/Fu-Jie) |  |  |  |
|
||||
| [Fu-Jie](https://openwebui.com/u/Fu-Jie) |  |  |  |
|
||||
|
||||
| 📝 Posts | ⬇️ Downloads | 👁️ Views | 👍 Upvotes | 💾 Saves |
|
||||
| :---: | :---: | :---: | :---: | :---: |
|
||||
|  |  |  |  |  |
|
||||
|  |  |  |  |  |
|
||||
|
||||
### 🔥 Top 6 Popular Plugins
|
||||
| Rank | Plugin | Version | Downloads | Views | Updated |
|
||||
| :---: | :--- | :---: | :---: | :---: | :---: |
|
||||
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 |  |  | 2026-01-29 |
|
||||
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 |  |  | 2026-01-31 |
|
||||
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 |  |  | 2026-02-07 |
|
||||
| 4️⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 |  |  | 2026-01-29 |
|
||||
| 5️⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 |  |  | 2026-02-10 |
|
||||
| 6️⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 |  |  | 2026-01-29 |
|
||||
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 |  |  | 2026-01-29 |
|
||||
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 |  |  | 2026-01-31 |
|
||||
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 |  |  | 2026-02-07 |
|
||||
| 4️⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 |  |  | 2026-01-29 |
|
||||
| 5️⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 |  |  | 2026-02-10 |
|
||||
| 6️⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 |  |  | 2026-01-29 |
|
||||
|
||||
*See full stats and charts in [Community Stats Report](./docs/community-stats.md)*
|
||||
<!-- STATS_END -->
|
||||
|
||||
18
README_CN.md
18
README_CN.md
@@ -6,25 +6,25 @@ OpenWebUI 增强功能集合。包含个人开发与收集的插件、提示词
|
||||
|
||||
<!-- STATS_START -->
|
||||
## 📊 社区统计
|
||||
> 🕐 自动更新于 2026-02-11 12:10
|
||||
> 🕐 自动更新于 2026-02-11 12:12
|
||||
|
||||
| 👤 作者 | 👥 粉丝 | ⭐ 积分 | 🏆 贡献 |
|
||||
| :---: | :---: | :---: | :---: |
|
||||
| [Fu-Jie](https://openwebui.com/u/Fu-Jie) |  |  |  |
|
||||
| [Fu-Jie](https://openwebui.com/u/Fu-Jie) |  |  |  |
|
||||
|
||||
| 📝 发布 | ⬇️ 下载 | 👁️ 浏览 | 👍 点赞 | 💾 收藏 |
|
||||
| :---: | :---: | :---: | :---: | :---: |
|
||||
|  |  |  |  |  |
|
||||
|  |  |  |  |  |
|
||||
|
||||
### 🔥 热门插件 Top 6
|
||||
| 排名 | 插件 | 版本 | 下载 | 浏览 | 更新日期 |
|
||||
| :---: | :--- | :---: | :---: | :---: | :---: |
|
||||
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 |  |  | 2026-01-29 |
|
||||
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 |  |  | 2026-01-31 |
|
||||
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 |  |  | 2026-02-07 |
|
||||
| 4️⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 |  |  | 2026-01-29 |
|
||||
| 5️⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 |  |  | 2026-02-10 |
|
||||
| 6️⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 |  |  | 2026-01-29 |
|
||||
| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 0.9.2 |  |  | 2026-01-29 |
|
||||
| 🥈 | [Smart Infographic](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 1.5.0 |  |  | 2026-01-31 |
|
||||
| 🥉 | [Export to Word Enhanced](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 0.4.4 |  |  | 2026-02-07 |
|
||||
| 4️⃣ | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 1.2.2 |  |  | 2026-01-29 |
|
||||
| 5️⃣ | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 0.3.7 |  |  | 2026-02-10 |
|
||||
| 6️⃣ | [Markdown Normalizer](https://openwebui.com/posts/markdown_normalizer_baaa8732) | 1.2.4 |  |  | 2026-01-29 |
|
||||
|
||||
*完整统计与趋势图请查看 [社区统计报告](./docs/community-stats.zh.md)*
|
||||
<!-- STATS_END -->
|
||||
|
||||
@@ -800,20 +800,15 @@ class OpenWebUIStats:
|
||||
lines.append("")
|
||||
|
||||
# 定义徽章 URL (使用 Gist ID)
|
||||
# 注意: 这里使用 shields.io 的 endpoint 功能,直接读取 Gist Raw URL
|
||||
# URL 格式: https://gist.githubusercontent.com/{gist_user}/{gist_id}/raw/badge_{key}.json
|
||||
# 由于我们不知道 gist_user,但 Gist ID 是全局唯一的,我们可以用 shields.io 的兼容性或者假设用户名为 Fu-Jie (根据 user request)
|
||||
# 为了通用性,我们这里使用 requests 获取一次 final URL 或者直接硬编码 Fu-Jie (因为 Gist 是私有的或者为了简单)
|
||||
# 用户明确提到: https://gist.github.com/Fu-Jie/db3d95687075a880af6f1fba76d679c6
|
||||
gist_user = "Fu-Jie"
|
||||
if self.gist_id:
|
||||
base_badge_url = f"https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/{gist_user}/{self.gist_id}/raw"
|
||||
else:
|
||||
base_badge_url = ""
|
||||
import urllib.parse
|
||||
|
||||
def get_badge(key: str, style: str = "flat") -> str:
|
||||
if not base_badge_url:
|
||||
gist_user = "Fu-Jie"
|
||||
|
||||
def get_badge(key: str, is_post: bool = False, style: str = "flat") -> str:
|
||||
if not self.gist_id:
|
||||
# 降级:如果没有 Gist,显示静态文本
|
||||
if is_post:
|
||||
return "**-**"
|
||||
val = stats.get(f"total_{key}", 0)
|
||||
if key == "followers":
|
||||
val = user.get("followers", 0)
|
||||
@@ -827,7 +822,10 @@ class OpenWebUIStats:
|
||||
val = stats.get("total_saves", 0)
|
||||
return f"**{val}**{fmt_delta(key)}"
|
||||
|
||||
return f""
|
||||
# 对 Gist Raw URL 进行转义,确保 Shields.io 正确处理
|
||||
raw_url = f"https://gist.githubusercontent.com/{gist_user}/{self.gist_id}/raw/badge_{key}.json"
|
||||
encoded_url = urllib.parse.quote(raw_url, safe="")
|
||||
return f""
|
||||
|
||||
# 作者信息表格
|
||||
if user:
|
||||
@@ -860,12 +858,8 @@ class OpenWebUIStats:
|
||||
idx = i + 1
|
||||
medal = medals[i] if i < len(medals) else str(idx)
|
||||
|
||||
# 如果有 Gist,使用动态徽章
|
||||
dl_cell = f"{post['downloads']}"
|
||||
vw_cell = f"{post['views']}"
|
||||
if base_badge_url:
|
||||
dl_cell = f""
|
||||
vw_cell = f""
|
||||
dl_cell = get_badge(f"p{idx}_dl", is_post=True)
|
||||
vw_cell = get_badge(f"p{idx}_vw", is_post=True)
|
||||
|
||||
lines.append(
|
||||
f"| {medal} | [{post['title']}]({post['url']}) | {post['version']} | {dl_cell} | {vw_cell} | {post['updated_at']} |"
|
||||
|
||||
Reference in New Issue
Block a user