54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
export default function App() {
|
||
return (
|
||
<>
|
||
<h1>Favicon 代理 API</h1>
|
||
<p>
|
||
通过 HTTP API 代理获取任意网站的 favicon,使用 <strong>Google</strong>、
|
||
<strong>DuckDuckGo</strong> 与<strong>直连目标站</strong>
|
||
多路竞速,谁先返回就用谁,适合在国内无法直连的站点。(Bing 无公开 favicon
|
||
API,故用 DuckDuckGo 作为第二源。)
|
||
</p>
|
||
|
||
<h2>用法</h2>
|
||
<p>GET 请求,支持参数:</p>
|
||
<ul>
|
||
<li>
|
||
<code>url</code> 或 <code>domain</code> 或 <code>u</code>
|
||
:目标网站地址或域名(必填)
|
||
</li>
|
||
<li>
|
||
<code>size</code>:图标尺寸,16–256,默认 128(仅对 Google 源有效)
|
||
</li>
|
||
</ul>
|
||
|
||
<h2>示例</h2>
|
||
<div className="example">
|
||
<code>/api/favicon?url=https://twitter.com</code>
|
||
<br />
|
||
<img
|
||
src="/api/favicon?url=https://twitter.com"
|
||
alt="twitter"
|
||
width={32}
|
||
height={32}
|
||
/>
|
||
</div>
|
||
<div className="example">
|
||
<code>/api/favicon?domain=github.com&size=64</code>
|
||
<br />
|
||
<img
|
||
src="/api/favicon?domain=github.com&size=64"
|
||
alt="github"
|
||
width={64}
|
||
height={64}
|
||
/>
|
||
</div>
|
||
|
||
<h2>直接调用</h2>
|
||
<pre>
|
||
GET https://你的 Workers 域名/api/favicon?url=https://example.com
|
||
</pre>
|
||
<p>返回为图片二进制(或 400/502 JSON 错误)。</p>
|
||
</>
|
||
);
|
||
}
|