From 44a6f86830ffd62d742964a13d3fc89edddf256e Mon Sep 17 00:00:00 2001 From: ccbikai Date: Thu, 8 Aug 2024 12:14:29 +0800 Subject: [PATCH 1/4] feat: improve regex for title extraction Enhanced regex pattern to more accurately capture titles in posts by adjusting the lookahead assertion to better handle various punctuation marks and URLs. This improves the robustness of title extraction, ensuring more consistent and correct results across different post formats. --- src/lib/telegram/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/telegram/index.js b/src/lib/telegram/index.js index 5d1b45f..bd13182 100644 --- a/src/lib/telegram/index.js +++ b/src/lib/telegram/index.js @@ -115,7 +115,7 @@ function getPost($, item, { channel, staticProxy, index = 0 }) { const content = $(item).find('.js-message_reply_text')?.length > 0 ? modifyHTMLContent($, $(item).find('.tgme_widget_message_text.js-message_text'), { index }) : modifyHTMLContent($, $(item).find('.tgme_widget_message_text'), { index }) - const title = content?.text()?.match(/[^。\n]*(?=[。\n]|http)/g)?.[0] ?? content?.text() ?? '' + const title = content?.text()?.match(/^.*?(?=[。::]|http\S)/g)?.[0] ?? content?.text() ?? '' const id = $(item).attr('data-post')?.replace(`${channel}/`, '') const tags = $(content).find('a[href^="?q="]')?.each((_index, a) => { From 39e2ccbd8d219b08e46a32351c111fb1878aee1f Mon Sep 17 00:00:00 2001 From: ccbikai Date: Thu, 8 Aug 2024 12:23:41 +0800 Subject: [PATCH 2/4] feat: clarify Telegram channel setup in docs Improved documentation clarity on configuring Telegram channel usernames, added troubleshooting section for common deployment issues, and emphasized the necessity of public channels and correct username format to ensure successful deployment. --- README.md | 11 ++++++++++- README.zh-cn.md | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6587ec6..e371160 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ For detailed tutorials, see [Deploy your Astro site](https://docs.astro.build/en ## ⚒️ Configuration ```env -## Telegram channel name, required +## Telegram Channel Username, must be configured. The string of characters following t.me/ CHANNEL=miantiao_me ## Language and timezone settings, language options see [dayjs](https://github.com/iamkun/dayjs/tree/dev/src/locale) @@ -97,6 +97,15 @@ HOST=telegram.dog STATIC_PROXY= ``` +## Frequently Asked Questions + +1. Why is the content empty after deployment? + - Check if the channel is public, it must be public + - The channel username is a string, not a number + - Turn off the "Restricting Saving Content" setting in the channel + - Redeploy after modifying environment variables + - Telegram blocks public display of some sensitive channels, you can verify by visiting `https://t.me/s/channelusername`. + ## ☕ Sponsor 1. [Follow me on Telegram](https://t.me/miantiao_me) diff --git a/README.zh-cn.md b/README.zh-cn.md index 510916e..ea06fab 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -61,7 +61,7 @@ ## ⚒️ 配置 ```env -## Telegram 频道名称,必须配置 +## Telegram 频道用户名,必须配置。 t.me/ 后面那串字符 CHANNEL=miantiao_me ## 语言和时区设置,语言选项见[dayjs](https://github.com/iamkun/dayjs/tree/dev/src/locale) @@ -95,6 +95,15 @@ HOST=telegram.dog STATIC_PROXY= ``` +## 常问问题 + +1. 为什么部署后内容为空? + - 检查频道是否是公开的,必须是公开的 + - 频道用户名是字符串,不是数字 + - 关闭频道 Restricting Saving Content 设置项 + - 修改完环境变量后需要重新部署 + - Telegram 会屏蔽一些敏感频道的公开展示, 可以通过访问 `https://t.me/s/频道用户名` 确认 + ## ☕ 赞助 1. [在 Telegram 关注我](https://t.me/miantiao_me) From cbfd74b516b9609c553ad56b47c5fb7f7179c5ed Mon Sep 17 00:00:00 2001 From: ccbikai Date: Thu, 8 Aug 2024 12:25:14 +0800 Subject: [PATCH 3/4] Update FAQ section headers for clarity and consistency Refactor FAQ headers to use emojis for improved readability and visual appeal across multiple language README files. --- README.md | 2 +- README.zh-cn.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e371160..4b49a3a 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ HOST=telegram.dog STATIC_PROXY= ``` -## Frequently Asked Questions +## 🙋🏻 FAQs 1. Why is the content empty after deployment? - Check if the channel is public, it must be public diff --git a/README.zh-cn.md b/README.zh-cn.md index ea06fab..dc840ef 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -95,7 +95,7 @@ HOST=telegram.dog STATIC_PROXY= ``` -## 常问问题 +## 🙋🏻 常问问题 1. 为什么部署后内容为空? - 检查频道是否是公开的,必须是公开的 From fc1dd2b4f559df63617e5a60e4adf953c5b795b1 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Thu, 8 Aug 2024 20:59:52 +0800 Subject: [PATCH 4/4] feat: specify SEO and RSS paths in docs Clarify SEO and RSS endpoints for better user understanding. --- README.md | 4 ++-- README.zh-cn.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4b49a3a..ebc2bb9 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ English | [简体中文](./README.zh-cn.md) ## ✨ Features - **Turn your Telegram Channel into a MicroBlog** -- **SEO friendly** +- **SEO friendly** `/sitemap.xml` - **0 JS on the browser side** -- **RSS and RSS JSON** +- **RSS and RSS JSON** `/rss.xml` `/rss.json` ## 🪧 Demo diff --git a/README.zh-cn.md b/README.zh-cn.md index dc840ef..ec3cdc9 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -9,9 +9,9 @@ ## ✨ 特性 - **将 Telegram Channel 转为微博客** -- **SEO 友好** +- **SEO 友好** `/sitemap.xml` - **浏览器端 0 JS** -- **提供 RSS 和 RSS JSON** +- **提供 RSS 和 RSS JSON** `/rss.xml` `/rss.json` ## 🪧 演示