mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-10 09:57:01 +08:00
Compare commits
5
Commits
v1.0.1
...
840496c48f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
840496c48f | ||
|
|
9843b35f54 | ||
|
|
bfd66f5019 | ||
|
|
0bc31360b0 | ||
|
|
267d9bb93e |
+10
-1
@@ -1,7 +1,16 @@
|
|||||||
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
|
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
|
||||||
# CHANGE LOG
|
# CHANGE LOG
|
||||||
|
|
||||||
## main(v1.0.1)
|
## v1.0.3
|
||||||
|
|
||||||
|
- fix: 修复 github actions 部署问题
|
||||||
|
- feat: telegram /new 不指定域名时, 使用随机地址
|
||||||
|
|
||||||
|
## v1.0.2
|
||||||
|
|
||||||
|
- fix: 修复 oauth2 登录失败的问题
|
||||||
|
|
||||||
|
## v1.0.1
|
||||||
|
|
||||||
- feat: |UI| 增加极简模式主页, 可在 `外观` 中切换
|
- feat: |UI| 增加极简模式主页, 可在 `外观` 中切换
|
||||||
- fix: 修复 oauth2 登录时,default role 不生效的问题
|
- fix: 修复 oauth2 登录时,default role 不生效的问题
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cloudflare_temp_email",
|
"name": "cloudflare_temp_email",
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -24,15 +24,15 @@
|
|||||||
"@vueuse/core": "^12.8.2",
|
"@vueuse/core": "^12.8.2",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||||
"axios": "^1.10.0",
|
"axios": "^1.11.0",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"mail-parser-wasm": "^0.2.1",
|
"mail-parser-wasm": "^0.2.1",
|
||||||
"naive-ui": "^2.42.0",
|
"naive-ui": "^2.42.0",
|
||||||
"postal-mime": "^2.4.4",
|
"postal-mime": "^2.4.4",
|
||||||
"vooks": "^0.2.12",
|
"vooks": "^0.2.12",
|
||||||
"vue": "^3.5.17",
|
"vue": "^3.5.18",
|
||||||
"vue-clipboard3": "^2.0.0",
|
"vue-clipboard3": "^2.0.0",
|
||||||
"vue-i18n": "^11.1.10",
|
"vue-i18n": "^11.1.11",
|
||||||
"vue-router": "^4.5.1"
|
"vue-router": "^4.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -42,12 +42,12 @@
|
|||||||
"unplugin-auto-import": "^19.3.0",
|
"unplugin-auto-import": "^19.3.0",
|
||||||
"unplugin-vue-components": "^28.8.0",
|
"unplugin-vue-components": "^28.8.0",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vite-plugin-pwa": "^1.0.1",
|
"vite-plugin-pwa": "^1.0.2",
|
||||||
"vite-plugin-top-level-await": "^1.6.0",
|
"vite-plugin-top-level-await": "^1.6.0",
|
||||||
"vite-plugin-wasm": "^3.5.0",
|
"vite-plugin-wasm": "^3.5.0",
|
||||||
"workbox-build": "^7.3.0",
|
"workbox-build": "^7.3.0",
|
||||||
"workbox-window": "^7.3.0",
|
"workbox-window": "^7.3.0",
|
||||||
"wrangler": "^4.25.0"
|
"wrangler": "^4.28.1"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+479
-510
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "temp-email-pages",
|
"name": "temp-email-pages",
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"wrangler": "^4.25.0"
|
"wrangler": "^4.28.1"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "temp-mail-docs",
|
"name": "temp-mail-docs",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.0.15",
|
"@types/node": "^24.2.0",
|
||||||
"vitepress": "^1.6.3",
|
"vitepress": "^1.6.4",
|
||||||
"wrangler": "^4.25.0"
|
"wrangler": "^4.28.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vitepress dev docs",
|
"dev": "vitepress dev docs",
|
||||||
|
|||||||
Generated
+360
-348
File diff suppressed because it is too large
Load Diff
+10
-10
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cloudflare_temp_email",
|
"name": "cloudflare_temp_email",
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -11,26 +11,26 @@
|
|||||||
"build": "wrangler deploy --dry-run --outdir dist --minify"
|
"build": "wrangler deploy --dry-run --outdir dist --minify"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cloudflare/workers-types": "^4.20250719.0",
|
"@cloudflare/workers-types": "^4.20250807.0",
|
||||||
"@eslint/js": "9.18.0",
|
"@eslint/js": "9.18.0",
|
||||||
"@simplewebauthn/types": "10.0.0",
|
"@simplewebauthn/types": "10.0.0",
|
||||||
"@types/node": "^22.16.5",
|
"@types/node": "^22.17.0",
|
||||||
"eslint": "9.18.0",
|
"eslint": "9.18.0",
|
||||||
"globals": "^15.15.0",
|
"globals": "^15.15.0",
|
||||||
"typescript-eslint": "^8.37.0",
|
"typescript-eslint": "^8.39.0",
|
||||||
"wrangler": "^4.25.0"
|
"wrangler": "^4.28.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.848.0",
|
"@aws-sdk/client-s3": "^3.863.0",
|
||||||
"@aws-sdk/s3-request-presigner": "^3.848.0",
|
"@aws-sdk/s3-request-presigner": "^3.863.0",
|
||||||
"@simplewebauthn/server": "10.0.1",
|
"@simplewebauthn/server": "10.0.1",
|
||||||
"hono": "^4.8.5",
|
"hono": "^4.9.0",
|
||||||
"jsonpath-plus": "^10.3.0",
|
"jsonpath-plus": "^10.3.0",
|
||||||
"mimetext": "^3.0.27",
|
"mimetext": "^3.0.27",
|
||||||
"postal-mime": "^2.4.4",
|
"postal-mime": "^2.4.4",
|
||||||
"resend": "^4.7.0",
|
"resend": "^4.8.0",
|
||||||
"telegraf": "4.16.3",
|
"telegraf": "4.16.3",
|
||||||
"worker-mailer": "^1.1.4"
|
"worker-mailer": "^1.1.5"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/lib/core/network/client.js b/lib/core/network/client.js
|
diff --git a/lib/core/network/client.js b/lib/core/network/client.js
|
||||||
index 25fbbbb47c7f88e83ae26f629e5ae1a0c141725c..209d4a6bf05352f44eeb082eb327581d698de5ce 100644
|
index 25fbbbb47c7f88e83ae26f629e5ae1a0c141725c..ab82c5391596ee2ed8dbe4128f3ba57a8cc998ca 100644
|
||||||
--- a/lib/core/network/client.js
|
--- a/lib/core/network/client.js
|
||||||
+++ b/lib/core/network/client.js
|
+++ b/lib/core/network/client.js
|
||||||
@@ -1,18 +1,18 @@
|
@@ -1,18 +1,18 @@
|
||||||
@@ -37,7 +37,17 @@ index 25fbbbb47c7f88e83ae26f629e5ae1a0c141725c..209d4a6bf05352f44eeb082eb327581d
|
|||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const node_fetch_1 = __importDefault(require("node-fetch"));
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
||||||
const check_1 = require("../helpers/check");
|
const check_1 = require("../helpers/check");
|
||||||
@@ -61,10 +61,10 @@ const DEFAULT_OPTIONS = {
|
@@ -39,7 +39,8 @@ const multipart_stream_1 = __importDefault(require("./multipart-stream"));
|
||||||
|
const error_1 = __importDefault(require("./error"));
|
||||||
|
const url_1 = require("url");
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
-const debug = require('debug')('telegraf:client');
|
||||||
|
+// const debug = require('debug')('telegraf:client');
|
||||||
|
+const debug = (msg) => console.debug(`[telegraf:client] ${msg}`);
|
||||||
|
const { isStream } = multipart_stream_1.default;
|
||||||
|
const WEBHOOK_REPLY_METHOD_ALLOWLIST = new Set([
|
||||||
|
'answerCallbackQuery',
|
||||||
|
@@ -61,10 +62,10 @@ const DEFAULT_OPTIONS = {
|
||||||
apiRoot: 'https://api.telegram.org',
|
apiRoot: 'https://api.telegram.org',
|
||||||
apiMode: 'bot',
|
apiMode: 'bot',
|
||||||
webhookReply: true,
|
webhookReply: true,
|
||||||
@@ -52,7 +62,7 @@ index 25fbbbb47c7f88e83ae26f629e5ae1a0c141725c..209d4a6bf05352f44eeb082eb327581d
|
|||||||
attachmentAgent: undefined,
|
attachmentAgent: undefined,
|
||||||
testEnv: false,
|
testEnv: false,
|
||||||
};
|
};
|
||||||
@@ -112,9 +112,9 @@ async function buildFormDataConfig(payload, agent) {
|
@@ -112,9 +113,9 @@ async function buildFormDataConfig(payload, agent) {
|
||||||
}
|
}
|
||||||
const boundary = crypto.randomBytes(32).toString('hex');
|
const boundary = crypto.randomBytes(32).toString('hex');
|
||||||
const formData = new multipart_stream_1.default(boundary);
|
const formData = new multipart_stream_1.default(boundary);
|
||||||
@@ -65,7 +75,7 @@ index 25fbbbb47c7f88e83ae26f629e5ae1a0c141725c..209d4a6bf05352f44eeb082eb327581d
|
|||||||
return {
|
return {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
compress: true,
|
compress: true,
|
||||||
@@ -205,14 +205,15 @@ async function attachFormMedia(form, media, id, agent) {
|
@@ -205,14 +206,15 @@ async function attachFormMedia(form, media, id, agent) {
|
||||||
if ('source' in media && media.source) {
|
if ('source' in media && media.source) {
|
||||||
let mediaSource = media.source;
|
let mediaSource = media.source;
|
||||||
if (typeof media.source === 'string') {
|
if (typeof media.source === 'string') {
|
||||||
|
|||||||
Generated
+734
-731
File diff suppressed because it is too large
Load Diff
@@ -108,9 +108,9 @@ export const newAddress = async (
|
|||||||
}
|
}
|
||||||
// check domain
|
// check domain
|
||||||
const allowDomains = checkAllowDomains ? await getAllowDomains(c) : getDomains(c);
|
const allowDomains = checkAllowDomains ? await getAllowDomains(c) : getDomains(c);
|
||||||
// if domain is not set, use the first domain
|
// if domain is not set, use the random domain
|
||||||
if (!domain && allowDomains.length > 0) {
|
if (!domain && allowDomains.length > 0) {
|
||||||
domain = allowDomains[0];
|
domain = allowDomains[Math.floor(Math.random() * allowDomains.length)];
|
||||||
}
|
}
|
||||||
// check domain is valid
|
// check domain is valid
|
||||||
if (!domain || !allowDomains.includes(domain)) {
|
if (!domain || !allowDomains.includes(domain)) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const CONSTANTS = {
|
export const CONSTANTS = {
|
||||||
VERSION: 'v' + '1.0.1',
|
VERSION: 'v' + '1.0.3',
|
||||||
|
|
||||||
// DB Version
|
// DB Version
|
||||||
DB_VERSION_KEY: 'db_version',
|
DB_VERSION_KEY: 'db_version',
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ export const jwtListToAddressData = async (
|
|||||||
for (const jwt of jwtList) {
|
for (const jwt of jwtList) {
|
||||||
try {
|
try {
|
||||||
const { address, address_id } = await Jwt.verify(jwt, c.env.JWT_SECRET, "HS256");
|
const { address, address_id } = await Jwt.verify(jwt, c.env.JWT_SECRET, "HS256");
|
||||||
|
const name = await c.env.DB.prepare(
|
||||||
|
`SELECT name FROM address WHERE id = ? `
|
||||||
|
).bind(address_id).first("name");
|
||||||
|
if (!name) {
|
||||||
|
addressList.push("无效地址");
|
||||||
|
invalidJwtList.push(jwt);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
addressList.push(address as string);
|
addressList.push(address as string);
|
||||||
addressIdMap[address as string] = address_id as number;
|
addressIdMap[address as string] = address_id as number;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -75,7 +83,7 @@ export const bindTelegramAddress = async (
|
|||||||
return address as string;
|
return address as string;
|
||||||
}
|
}
|
||||||
if (jwtList.length >= getIntValue(c.env.TG_MAX_ADDRESS, 5)) {
|
if (jwtList.length >= getIntValue(c.env.TG_MAX_ADDRESS, 5)) {
|
||||||
throw Error("绑定地址数量已达上限");
|
throw Error("绑定地址数量已达上限, 请先 /cleaninvalidaddress");
|
||||||
}
|
}
|
||||||
await c.env.KV.put(`${CONSTANTS.TG_KV_PREFIX}:${userId}`, JSON.stringify([...jwtList, jwt]));
|
await c.env.KV.put(`${CONSTANTS.TG_KV_PREFIX}:${userId}`, JSON.stringify([...jwtList, jwt]));
|
||||||
// for mail push to telegram
|
// for mail push to telegram
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ const COMMANDS = [
|
|||||||
description: "查看邮件, 请输入 /mails <邮箱地址>, 不输入地址默认查看第一个地址"
|
description: "查看邮件, 请输入 /mails <邮箱地址>, 不输入地址默认查看第一个地址"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: "cleaninvalidadress",
|
command: "cleaninvalidaddress",
|
||||||
description: "清理无效地址, 请输入 /cleaninvalidadress"
|
description: "清理无效地址, 请输入 /cleaninvalidaddress"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ export function newTelegramBot(c: Context<HonoCustomType>, token: string): Teleg
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const address = ctx?.message?.text.slice("/unbind".length).trim();
|
const address = ctx?.message?.text.slice("/delete".length).trim();
|
||||||
if (!address) {
|
if (!address) {
|
||||||
return await ctx.reply("请输入地址");
|
return await ctx.reply("请输入地址");
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ export function newTelegramBot(c: Context<HonoCustomType>, token: string): Teleg
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.command("cleaninvalidadress", async (ctx: TgContext) => {
|
bot.command("cleaninvalidaddress", async (ctx: TgContext) => {
|
||||||
const userId = ctx?.message?.from?.id;
|
const userId = ctx?.message?.from?.id;
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
return await ctx.reply("无法获取用户信息");
|
return await ctx.reply("无法获取用户信息");
|
||||||
|
|||||||
@@ -110,20 +110,22 @@ export default {
|
|||||||
if (!user_id) {
|
if (!user_id) {
|
||||||
return c.text(msgs.UserNotFoundMsg, 400)
|
return c.text(msgs.UserNotFoundMsg, 400)
|
||||||
}
|
}
|
||||||
|
// process user roles
|
||||||
const defaultRole = getStringValue(c.env.USER_DEFAULT_ROLE);
|
const defaultRole = getStringValue(c.env.USER_DEFAULT_ROLE);
|
||||||
if (!defaultRole) return c.json({ success: true })
|
if (defaultRole) {
|
||||||
const user_roles = getUserRoles(c);
|
const user_roles = getUserRoles(c);
|
||||||
if (!user_roles.find((r) => r.role === defaultRole)) {
|
if (!user_roles.find((r) => r.role === defaultRole)) {
|
||||||
return c.text(msgs.InvalidUserDefaultRoleMsg, 500);
|
return c.text(msgs.InvalidUserDefaultRoleMsg, 500);
|
||||||
}
|
}
|
||||||
// update user roles
|
// update user roles
|
||||||
const { success: success2 } = await c.env.DB.prepare(
|
const { success: success2 } = await c.env.DB.prepare(
|
||||||
`INSERT INTO user_roles (user_id, role_text)`
|
`INSERT INTO user_roles (user_id, role_text)`
|
||||||
+ ` VALUES (?, ?)`
|
+ ` VALUES (?, ?)`
|
||||||
+ ` ON CONFLICT(user_id) DO NOTHING`
|
+ ` ON CONFLICT(user_id) DO NOTHING`
|
||||||
).bind(user_id, defaultRole).run();
|
).bind(user_id, defaultRole).run();
|
||||||
if (!success2) {
|
if (!success2) {
|
||||||
return c.text(msgs.FailedUpdateUserDefaultRoleMsg, 500);
|
return c.text(msgs.FailedUpdateUserDefaultRoleMsg, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// create jwt
|
// create jwt
|
||||||
const jwt = await Jwt.sign({
|
const jwt = await Jwt.sign({
|
||||||
|
|||||||
Reference in New Issue
Block a user