Skip to content

Commit 87a0086

Browse files
committed
chore: git init
Signed-off-by: Charles Chin <eallion.s+github@gmail.com>
0 parents  commit 87a0086

15 files changed

Lines changed: 4081 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Tencent Cloud EdgeOne
2+
.env
3+
.edgeone
4+
node_modules/

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"cSpell.words": [
3+
"cravatar",
4+
"gravatar",
5+
"mastodon",
6+
"memos",
7+
"edgeone",
8+
"eallion"
9+
]
10+
}

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# API Tencent EdgeOne Pages
2+
3+
- `api.eallion.com`
4+
5+
## 功能说明
6+
7+
本项目基于 Tencent EdgeOne Pages Functions 实现,提供了一系列 API 接口,用于代理访问第三方服务。
8+
每个功能都按照 [EdgeOne 官方文档](https://edgeone.cloud.tencent.com/pages/document/162936866445025280) 的要求实现,
9+
采用单独的函数文件结构,所有代码均为 JavaScript。
10+
11+
## API 接口列表
12+
13+
### /bing
14+
15+
代理访问必应每日壁纸数据。
16+
17+
### /favicon
18+
19+
代理访问 `https://t3.gstatic.cn/faviconV2` 获取网站图标。
20+
21+
### /geo
22+
23+
返回客户端的地理位置。
24+
25+
### /gravatar
26+
27+
代理访问 `https://www.libravatar.org/avatar` 获取 Gravatar 头像。
28+
29+
### /ip
30+
31+
返回客户端的公网 IP 地址。
32+
33+
### /mastodon
34+
35+
代理访问 `https://e5n.cc/api/v1/accounts/111136231674527355/statuses` 获取 Mastodon 状态。
36+
37+
### /memos
38+
39+
代理访问 `https://memos.eallion.com/api/v1/memos` 获取 Memos 数据。
40+
41+
### /og
42+
43+
代理访问 `https://og.eallion.com/api/og` 获取 OG 图片。

edgeone.json

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"name": "api-eallion-com",
3+
"nodeVersion": "22.11.0",
4+
"rewrites": [
5+
{
6+
"source": "/cravatar/*",
7+
"destination": "/gravatar/:splat"
8+
}
9+
],
10+
"headers": [
11+
{
12+
"source": "/*",
13+
"headers": [
14+
{
15+
"key": "Access-Control-Allow-Origin",
16+
"value": "*"
17+
}
18+
]
19+
},
20+
{
21+
"source": "/cravatar*",
22+
"headers": [
23+
{
24+
"key": "Content-Type",
25+
"value": "image/webp"
26+
},
27+
{
28+
"key": "Cache-Control",
29+
"value": "public, max-age=604800"
30+
},
31+
{
32+
"key": "CDN-Cache-Control",
33+
"value": "public, max-age=604800"
34+
}
35+
]
36+
},
37+
{
38+
"source": "/gravatar*",
39+
"headers": [
40+
{
41+
"key": "Content-Type",
42+
"value": "image/webp"
43+
},
44+
{
45+
"key": "Cache-Control",
46+
"value": "public, max-age=604800"
47+
},
48+
{
49+
"key": "CDN-Cache-Control",
50+
"value": "public, max-age=604800"
51+
}
52+
]
53+
},
54+
{
55+
"source": "/mastodon*",
56+
"headers": [
57+
{
58+
"key": "Cache-Control",
59+
"value": "no-store"
60+
},
61+
{
62+
"key": "CDN-Cache-Control",
63+
"value": "no-store"
64+
}
65+
]
66+
},
67+
{
68+
"source": "/memos*",
69+
"headers": [
70+
{
71+
"key": "Cache-Control",
72+
"value": "no-store"
73+
},
74+
{
75+
"key": "CDN-Cache-Control",
76+
"value": "no-store"
77+
}
78+
]
79+
},
80+
{
81+
"source": "/ip*",
82+
"headers": [
83+
{
84+
"key": "Cache-Control",
85+
"value": "no-store"
86+
},
87+
{
88+
"key": "CDN-Cache-Control",
89+
"value": "no-store"
90+
}
91+
]
92+
},
93+
{
94+
"source": "/geo*",
95+
"headers": [
96+
{
97+
"key": "Cache-Control",
98+
"value": "no-store"
99+
},
100+
{
101+
"key": "CDN-Cache-Control",
102+
"value": "no-store"
103+
}
104+
]
105+
},
106+
{
107+
"source": "/favicon*",
108+
"headers": [
109+
{
110+
"key": "Content-Type",
111+
"value": "image/png"
112+
},
113+
{
114+
"key": "Cache-Control",
115+
"value": "public, max-age=604800"
116+
},
117+
{
118+
"key": "CDN-Cache-Control",
119+
"value": "public, max-age=604800"
120+
}
121+
]
122+
}
123+
],
124+
"cache": [
125+
{
126+
"source": "/bing*",
127+
"cacheTtl": 3600
128+
},
129+
{
130+
"source": "/favicon*",
131+
"cacheTtl": 604800
132+
},
133+
{
134+
"source": "/og*",
135+
"cacheTtl": 604800
136+
},
137+
{
138+
"source": "/cravatar*",
139+
"cacheTtl": 604800
140+
},
141+
{
142+
"source": "/gravatar*",
143+
"cacheTtl": 604800
144+
},
145+
{
146+
"source": "/memos*",
147+
"cacheTtl": 0
148+
},
149+
{
150+
"source": "/mastodon*",
151+
"cacheTtl": 0
152+
},
153+
{
154+
"source": "/ip*",
155+
"cacheTtl": 0
156+
},
157+
{
158+
"source": "/geo*",
159+
"cacheTtl": 0
160+
}
161+
]
162+
}

0 commit comments

Comments
 (0)