<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>未分类 - 十步回眸一笑 - 个人技术笔记</title>
	<atom:link href="https://www.hishd.top/archives/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>https://www.hishd.top</link>
	<description></description>
	<lastBuildDate>Fri, 13 Oct 2023 14:19:40 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>使用CloudFlare works反代Telegrame API</title>
		<link>https://www.hishd.top/archives/256</link>
					<comments>https://www.hishd.top/archives/256#respond</comments>
		
		<dc:creator><![CDATA[DB.Russell]]></dc:creator>
		<pubDate>Fri, 13 Oct 2023 09:59:48 +0000</pubDate>
				<category><![CDATA[未分类]]></category>
		<guid isPermaLink="false">https://www.hishd.top/?p=256</guid>

					<description><![CDATA[由于目前国内的国情，想要在国内使用Telegram是不可能，但相比QQ和微信这些，TG的消息通知会来的更便捷实 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>由于目前国内的国情，想要在国内使用Telegram是不可能，但相比QQ和微信这些，TG的消息通知会来的更便捷实用性更高。uptime-kuma、哪咋探针等一些系统都是可以使用TG来接受消息或者管理。所以可以借助cloudflare的works来反代api达到“白嫖”的目的，但目前cloudflare的国内访问基本都是绕美绕日的，所以速度和可靠性上并不是最优解，当然我们也可以使用自建的方式来反代api。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" width="2526" height="884" src="https://photo.hishd.top/2023/10/20231013091752765.png" alt="" class="wp-image-259" style="width:840px;height:294px" srcset="https://photo.hishd.top/2023/10/20231013091752765.png 2526w, https://photo.hishd.top/2023/10/20231013091752765-1536x538.png 1536w, https://photo.hishd.top/2023/10/20231013091752765-2048x717.png 2048w" sizes="(max-width: 2526px) 100vw, 2526px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1746" height="1354" src="https://photo.hishd.top/2023/10/20231013092010498.png" alt="" class="wp-image-260" srcset="https://photo.hishd.top/2023/10/20231013092010498.png 1746w, https://photo.hishd.top/2023/10/20231013092010498-1536x1191.png 1536w" sizes="(max-width: 1746px) 100vw, 1746px" /></figure>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="2088" height="1062" src="https://photo.hishd.top/2023/10/20231013092154179.png" alt="" class="wp-image-261" style="width:840px;height:427px" srcset="https://photo.hishd.top/2023/10/20231013092154179.png 2088w, https://photo.hishd.top/2023/10/20231013092154179-1536x781.png 1536w, https://photo.hishd.top/2023/10/20231013092154179-2048x1042.png 2048w" sizes="(max-width: 2088px) 100vw, 2088px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2880" height="1276" src="https://photo.hishd.top/2023/10/20231013092314191.png" alt="" class="wp-image-262" srcset="https://photo.hishd.top/2023/10/20231013092314191.png 2880w, https://photo.hishd.top/2023/10/20231013092314191-1536x681.png 1536w, https://photo.hishd.top/2023/10/20231013092314191-2048x907.png 2048w" sizes="auto, (max-width: 2880px) 100vw, 2880px" /></figure>



<p>把红框中的代码全部删除，全选复制下面的代码。</p>



<pre class="wp-block-code"><code>const whitelist = &#91;"/bot<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">888518123</mark>:"];
const tg_host = "api.telegram.org";

addEventListener('fetch', event =&gt; {
    event.respondWith(handleRequest(event.request))
})

function validate(path) {
    for (var i = 0; i &lt; whitelist.length; i++) {
        if (path.startsWith(whitelist&#91;i]))
            return true;
    }
    return false;
}

async function handleRequest(request) {
    var u = new URL(request.url);
    u.host = tg_host;
    if (!validate(u.pathname))
        return new Response('Unauthorized', {
            status: 403
        });
    var req = new Request(u, {
        method: request.method,
        headers: request.headers,
        body: request.body
    });
    const result = await fetch(req);
    return result;
}</code></pre>



<p>bot后的数字替换为你在<a href="https://t.me/BotFather">@BotFather</a>中新建Bot的HTTP API中的冒号前的数字部分</p>



<p>然后点击右上角“保存并部署”即可</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2772" height="996" src="https://photo.hishd.top/2023/10/20231013093508805.png" alt="" class="wp-image-264" srcset="https://photo.hishd.top/2023/10/20231013093508805.png 2772w, https://photo.hishd.top/2023/10/20231013093508805-1536x552.png 1536w, https://photo.hishd.top/2023/10/20231013093508805-2048x736.png 2048w" sizes="auto, (max-width: 2772px) 100vw, 2772px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2288" height="632" src="https://photo.hishd.top/2023/10/20231013094032511.png" alt="" class="wp-image-265" srcset="https://photo.hishd.top/2023/10/20231013094032511.png 2288w, https://photo.hishd.top/2023/10/20231013094032511-1536x424.png 1536w, https://photo.hishd.top/2023/10/20231013094032511-2048x566.png 2048w" sizes="auto, (max-width: 2288px) 100vw, 2288px" /></figure>



<p>免费账户每日有十万请求数，如果没有其他应用的话这十万一天是绝对是绰绰有余的。</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1340" height="718" src="https://photo.hishd.top/2023/10/20231013095043647.png" alt="" class="wp-image-267" style="width:571px;height:306px"/></figure>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="2300" height="1106" src="https://photo.hishd.top/2023/10/20231013095115285.png" alt="" class="wp-image-268" style="width:715px;height:344px" srcset="https://photo.hishd.top/2023/10/20231013095115285.png 2300w, https://photo.hishd.top/2023/10/20231013095115285-1536x739.png 1536w, https://photo.hishd.top/2023/10/20231013095115285-2048x985.png 2048w" sizes="auto, (max-width: 2300px) 100vw, 2300px" /></figure>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1190" height="976" src="https://photo.hishd.top/2023/10/20231013095237105.png" alt="" class="wp-image-269" style="width:434px;height:355px"/></figure>



<p>添加好路由后，新建一个DNS记录。随便用一个ipv4的地址指向这个前缀。把代理状态打开，点亮小橙云。</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2118" height="882" src="https://photo.hishd.top/2023/10/20231013095606671.png" alt="" class="wp-image-270" srcset="https://photo.hishd.top/2023/10/20231013095606671.png 2118w, https://photo.hishd.top/2023/10/20231013095606671-1536x640.png 1536w, https://photo.hishd.top/2023/10/20231013095606671-2048x853.png 2048w" sizes="auto, (max-width: 2118px) 100vw, 2118px" /></figure>



<p>这样就可以在需要使用TG api的地方把这个域名代替进去使用了。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>本文参考：https://mrchou.com/internet/reverse-proxy-telegram-alert-with-cloudflare-workers.html</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.hishd.top/archives/256/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
