mirror of
https://github.com/HuLaSpark/HuLa.git
synced 2026-09-24 23:11:59 +08:00
fix(readme): 🐛 fix readme file not showing issue
This commit is contained in:
+2
-1
@@ -349,11 +349,12 @@ Execute **pnpm run commit** to invoke _git commit_ interaction, complete informa
|
||||
|---------|----------|--------|---------|
|
||||
| 2025-09-03 | **烛火** | `¥500` |  |
|
||||
| 2025-09-05 | **Orion** | `¥200` |  |
|
||||
| 2025-08-26 | **唐勇** | `¥200` |  |
|
||||
| 2025-10-23 | **唐勇** | `¥400` |  |
|
||||
| 2025-04-25 | **上官俊斌** | `¥200` |  |
|
||||
| 2025-05-27 | **临安居士** | `¥188` |  |
|
||||
| 2025-04-20 | **姜兴(Simon)** | `¥188` |  |
|
||||
| 2025-02-17 | **禾硕** | `¥168` |  |
|
||||
| 2025-10-16 | **xx豪** | `¥101` |  |
|
||||
| 2025-10-15 | **兵** | `¥100` |  |
|
||||
| 2025-08-13 | **zhongjing** | `¥100` |  |
|
||||
| 2025-07-15 | **粉兔** | `¥100` |  |
|
||||
|
||||
@@ -352,11 +352,12 @@ sudo xattr -r -d com.apple.quarantine /Applications/应用名称.app
|
||||
|---------|----------|--------|---------|
|
||||
| 2025-09-03 | **烛火** | `¥500` |  |
|
||||
| 2025-09-05 | **Orion** | `¥200` |  |
|
||||
| 2025-08-26 | **唐勇** | `¥200` |  |
|
||||
| 2025-10-23 | **唐勇** | `¥400` |  |
|
||||
| 2025-04-25 | **上官俊斌** | `¥200` |  |
|
||||
| 2025-05-27 | **临安居士** | `¥188` |  |
|
||||
| 2025-04-20 | **姜兴(Simon)** | `¥188` |  |
|
||||
| 2025-02-17 | **禾硕** | `¥168` |  |
|
||||
| 2025-10-16 | **xx豪** | `¥101` |  |
|
||||
| 2025-10-15 | **兵** | `¥100` |  |
|
||||
| 2025-08-13 | **zhongjing** | `¥100` |  |
|
||||
| 2025-07-15 | **粉兔** | `¥100` |  |
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 212 KiB |
+18
-17
@@ -1,6 +1,6 @@
|
||||
|
||||
<p align="center">
|
||||
<img width="350px" height="150px" src="public/hula.png"/>
|
||||
<img width="350px" height="150px" src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/public/hula.png"/>
|
||||
</p>
|
||||
|
||||
<p align="center">An instant messaging system built with Tauri, Vite 7, Vue 3, and TypeScript</p>
|
||||
@@ -117,21 +117,21 @@ HuLa is an instant messaging system built with Tauri, Vite 7, Vue 3, and TypeScr
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img.png" alt="Main Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img.png" alt="Main Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>💬 Main Chat Interface</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_1.png" alt="Chat Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_1.png" alt="Chat Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>🗨️ Chat Conversation Interface</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img_2.png" alt="Contact Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_2.png" alt="Contact Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>😊 Emoji Selection</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_3.png" alt="Settings Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_3.png" alt="Settings Interface" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>⚙️ System Settings</em>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -147,29 +147,29 @@ HuLa is an instant messaging system built with Tauri, Vite 7, Vue 3, and TypeScr
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img_4.png" alt="Message Features" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_4.png" alt="Message Features" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>📱 Diverse Messaging</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_5.png" alt="Theme Switching" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_5.png" alt="Theme Switching" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>🎨 Status Toggle</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_6.png" alt="Emojis" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_6.png" alt="Emojis" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>📷 Image Viewer</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img_7.png" alt="Group Management" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_7.png" alt="Group Management" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>👥 Group Management</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_8.png" alt="Personal Settings" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_8.png" alt="Personal Settings" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>🤖 ChatBot Plugin Features</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_9.png" alt="File Transfer" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_9.png" alt="File Transfer" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>🤖 ChatBot Settings Page</em>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -278,7 +278,7 @@ Downloading installation packages from the web may show a damaged package prompt
|
||||
#### 1. Open "System Settings" - "Security & Privacy", check as shown: Allow apps downloaded from "Anywhere" to run:
|
||||
|
||||
<div align="center">
|
||||
<img src="preview/img_10.png" alt="img_10.png" />
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_10.png" alt="img_10.png" />
|
||||
</div>
|
||||
|
||||
#### 2. If errors persist, execute the following commands in Terminal:
|
||||
@@ -312,8 +312,8 @@ Execute **pnpm run commit** to invoke _git commit_ interaction, complete informa
|
||||
<p><em>If you find HuLa helpful, welcome to sponsor and support us. Your support is our motivation to keep moving forward!</em></p>
|
||||
|
||||
<div>
|
||||
<img src="preview/zs.jpg" height="240" alt="WeChat Code">
|
||||
<img src="preview/zfb.png" height="240" alt="Alipay Code">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/zs.jpg" height="240" alt="WeChat Code">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/zfb.png" height="240" alt="Alipay Code">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
@@ -327,8 +327,8 @@ Execute **pnpm run commit** to invoke _git commit_ interaction, complete informa
|
||||
<p><em>Join developers and users for discussions, get the latest news and technical support</em></p>
|
||||
|
||||
<div style="display: flex; justify-content: center; gap: 20px;">
|
||||
<img src="preview/wx.png" width="260" height="340" alt="WeChat Group QR Code">
|
||||
<img src="preview/qq.jpg" width="260" height="340" alt="QQ Group QR Code">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/wx.png" width="260" height="340" alt="WeChat Group QR Code">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/qq.jpg" width="260" height="340" alt="QQ Group QR Code">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -349,11 +349,12 @@ Execute **pnpm run commit** to invoke _git commit_ interaction, complete informa
|
||||
|---------|----------|--------|---------|
|
||||
| 2025-09-03 | **烛火** | `¥500` |  |
|
||||
| 2025-09-05 | **Orion** | `¥200` |  |
|
||||
| 2025-08-26 | **唐勇** | `¥200` |  |
|
||||
| 2025-10-23 | **唐勇** | `¥400` |  |
|
||||
| 2025-04-25 | **上官俊斌** | `¥200` |  |
|
||||
| 2025-05-27 | **临安居士** | `¥188` |  |
|
||||
| 2025-04-20 | **姜兴(Simon)** | `¥188` |  |
|
||||
| 2025-02-17 | **禾硕** | `¥168` |  |
|
||||
| 2025-10-16 | **xx豪** | `¥101` |  |
|
||||
| 2025-10-15 | **兵** | `¥100` |  |
|
||||
| 2025-08-13 | **zhongjing** | `¥100` |  |
|
||||
| 2025-07-15 | **粉兔** | `¥100` |  |
|
||||
|
||||
+18
-17
@@ -1,6 +1,6 @@
|
||||
|
||||
<p align="center">
|
||||
<img width="350px" height="150px" src="public/hula.png"/>
|
||||
<img width="350px" height="150px" src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/public/hula.png"/>
|
||||
</p>
|
||||
|
||||
<p align="center">一款基于Tauri、Vite 7、Vue 3 和 TypeScript 构建的即时通讯系统</p>
|
||||
@@ -117,21 +117,21 @@ HuLa 是一款基于 Tauri、Vite 7、Vue 3 和 TypeScript 构建的即时通讯
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img.png" alt="主界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img.png" alt="主界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>💬 主聊天界面</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_1.png" alt="聊天界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_1.png" alt="聊天界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>🗨️ 聊天对话界面</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img_2.png" alt="联系人界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_2.png" alt="联系人界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>😊 表情包选择</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_3.png" alt="设置界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_3.png" alt="设置界面" width="400" style="border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); margin: 8px;">
|
||||
<br><em>⚙️ 系统设置</em>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -147,29 +147,29 @@ HuLa 是一款基于 Tauri、Vite 7、Vue 3 和 TypeScript 构建的即时通讯
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img_4.png" alt="消息功能" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_4.png" alt="消息功能" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>📱 消息多样化</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_5.png" alt="主题切换" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_5.png" alt="主题切换" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>🎨 状态切换</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_6.png" alt="表情包" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_6.png" alt="表情包" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em> 📷 图片查看</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="preview/img_7.png" alt="群聊管理" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_7.png" alt="群聊管理" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>👥 群聊管理</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_8.png" alt="个人设置" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_8.png" alt="个人设置" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>🤖 ChatBot 插件功能</em>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img src="preview/img_9.png" alt="文件传输" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_9.png" alt="文件传输" width="280" style="border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin: 6px;">
|
||||
<br><em>🤖 ChatBot 设置页面</em>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -281,7 +281,7 @@ pnpm run tauri:build
|
||||
#### 1. 打开 "系统设置" - "安全性与隐私",如图勾选:允许 "任何来源" 下载的 App 运行:
|
||||
|
||||
<div align="center">
|
||||
<img src="preview/img_10.png" alt="img_10.png" />
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/img_10.png" alt="img_10.png" />
|
||||
</div>
|
||||
|
||||
#### 2. 如果还报错,请在终端执行以下命令解决:
|
||||
@@ -315,8 +315,8 @@ sudo xattr -r -d com.apple.quarantine /Applications/应用名称.app
|
||||
<p><em>如果您觉得 HuLa 对您有帮助,欢迎赞助支持,您的支持是我们不断前进的动力!</em></p>
|
||||
|
||||
<div>
|
||||
<img src="preview/zs.jpg" height="240" alt="WeChat Code">
|
||||
<img src="preview/zfb.png" height="240" alt="Alipay Code">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/zs.jpg" height="240" alt="WeChat Code">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/zfb.png" height="240" alt="Alipay Code">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
@@ -330,8 +330,8 @@ sudo xattr -r -d com.apple.quarantine /Applications/应用名称.app
|
||||
<p><em>与开发者和用户一起交流讨论,获取最新资讯和技术支持</em></p>
|
||||
|
||||
<div style="display: flex; justify-content: center; gap: 20px;">
|
||||
<img src="preview/wx.png" width="260" height="340" alt="微信群二维码">
|
||||
<img src="preview/qq.jpg" width="260" height="340" alt="QQ群二维码">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/wx.png" width="260" height="340" alt="微信群二维码">
|
||||
<img src="https://raw.gitcode.com/HuLaSpark/HuLa/files/master/preview/qq.jpg" width="260" height="340" alt="QQ群二维码">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -352,11 +352,12 @@ sudo xattr -r -d com.apple.quarantine /Applications/应用名称.app
|
||||
|---------|----------|--------|---------|
|
||||
| 2025-09-03 | **烛火** | `¥500` |  |
|
||||
| 2025-09-05 | **Orion** | `¥200` |  |
|
||||
| 2025-08-26 | **唐勇** | `¥200` |  |
|
||||
| 2025-10-23 | **唐勇** | `¥400` |  |
|
||||
| 2025-04-25 | **上官俊斌** | `¥200` |  |
|
||||
| 2025-05-27 | **临安居士** | `¥188` |  |
|
||||
| 2025-04-20 | **姜兴(Simon)** | `¥188` |  |
|
||||
| 2025-02-17 | **禾硕** | `¥168` |  |
|
||||
| 2025-10-16 | **xx豪** | `¥101` |  |
|
||||
| 2025-10-15 | **兵** | `¥100` |  |
|
||||
| 2025-08-13 | **zhongjing** | `¥100` |  |
|
||||
| 2025-07-15 | **粉兔** | `¥100` |  |
|
||||
|
||||
@@ -4,12 +4,6 @@ use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
const IS_DESKTOP: bool = false;
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
const IS_DESKTOP: bool = true;
|
||||
|
||||
/// 处理图片 URL,将相对路径转换为 base64 数据 URI
|
||||
fn process_image_url(url: &str, base_dir: &Path) -> String {
|
||||
// 如果是绝对 URL 或已经是 data URI,直接返回
|
||||
@@ -44,22 +38,6 @@ fn process_image_url(url: &str, base_dir: &Path) -> String {
|
||||
let base64_data = general_purpose::STANDARD.encode(&img_data);
|
||||
format!("data:{};base64,{}", mime_type, base64_data)
|
||||
} else {
|
||||
let normalized = url.trim_start_matches("./");
|
||||
|
||||
if let Some(stripped) = normalized.strip_prefix("preview/") {
|
||||
return format!(
|
||||
"https://gitee.com/HuLaSpark/HuLa/raw/master/preview/{}",
|
||||
stripped
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(stripped) = normalized.strip_prefix("public/") {
|
||||
return format!(
|
||||
"https://gitee.com/HuLaSpark/HuLa/raw/master/preview/{}",
|
||||
stripped
|
||||
);
|
||||
}
|
||||
|
||||
// 如果无法读取,返回原始 URL
|
||||
url.to_string()
|
||||
}
|
||||
@@ -85,10 +63,9 @@ pub async fn parse_markdown(app: AppHandle, file_path: String) -> Result<String,
|
||||
];
|
||||
|
||||
// 生产模式 - 应用资源目录 (仅桌面端打包 docs)
|
||||
if IS_DESKTOP {
|
||||
if let Ok(resource_dir) = app.path().resource_dir() {
|
||||
possible_paths.push(resource_dir.join(&file_path));
|
||||
}
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if let Ok(resource_dir) = app.path().resource_dir() {
|
||||
possible_paths.push(resource_dir.join(&file_path));
|
||||
}
|
||||
|
||||
// 生产模式 - 应用配置目录 (兼容旧版本安装路径)
|
||||
@@ -155,37 +132,51 @@ pub async fn parse_markdown(app: AppHandle, file_path: String) -> Result<String,
|
||||
/// 读取 README markdown 文件
|
||||
#[tauri::command]
|
||||
pub async fn get_readme_html(app: AppHandle, language: String) -> Result<String, String> {
|
||||
// 获取应用根目录
|
||||
let app_dir = app
|
||||
.path()
|
||||
.app_config_dir()
|
||||
.map_err(|e| format!("无法获取应用目录: {}", e))?;
|
||||
|
||||
// 构建 README 文件路径
|
||||
// 在开发模式下,从项目根目录读取
|
||||
// 在生产模式下,从资源目录读取
|
||||
// 在开发模式下,从项目根目录读取 README.md
|
||||
// 在生产模式下,从资源目录的 docs 文件夹读取 README.md
|
||||
let readme_filename = if language == "zh" {
|
||||
"README.md"
|
||||
} else {
|
||||
"README.en.md"
|
||||
};
|
||||
|
||||
// 尝试多个可能的路径
|
||||
let mut possible_paths = vec![
|
||||
// 开发模式 - 项目根目录
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(readme_filename),
|
||||
// 生产模式 - 兼容旧版的应用配置目录
|
||||
app_dir.join(readme_filename),
|
||||
];
|
||||
let readme_relative_path = Path::new("docs").join(readme_filename);
|
||||
let project_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.unwrap()
|
||||
.to_path_buf();
|
||||
|
||||
// 生产模式 - 应用资源目录
|
||||
if IS_DESKTOP {
|
||||
let mut possible_paths = vec![];
|
||||
|
||||
#[cfg(dev)]
|
||||
{
|
||||
// 开发环境:优先使用项目根目录的 README.md(本地图片)
|
||||
possible_paths.push(project_root.join(readme_filename));
|
||||
|
||||
// 回退:src-tauri/docs 目录
|
||||
possible_paths.push(
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join(&readme_relative_path),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(dev))]
|
||||
{
|
||||
// 生产环境:优先使用打包资源目录的 docs/README.md(远程图片)
|
||||
// 优先级 1: 应用资源目录
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
if let Ok(resource_dir) = app.path().resource_dir() {
|
||||
possible_paths.push(resource_dir.join(readme_filename));
|
||||
possible_paths.push(resource_dir.join(&readme_relative_path));
|
||||
}
|
||||
|
||||
// 优先级 2: 应用配置目录
|
||||
if let Ok(app_config_dir) = app.path().app_config_dir() {
|
||||
possible_paths.push(app_config_dir.join(&readme_relative_path));
|
||||
}
|
||||
|
||||
// 优先级 3: 回退到根目录
|
||||
possible_paths.push(project_root.join(readme_filename));
|
||||
}
|
||||
|
||||
let mut markdown_content = None;
|
||||
|
||||
Reference in New Issue
Block a user