upd
This commit is contained in:
1 parent
42393ce6fc
commit
f8001e64a6
24 files changed
+57
-690
No files matched your search
@@ -1,11 +0,0 @@
|
||||
import worker, * as OTHER_EXPORTS from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
import * as __MIDDLEWARE_0__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
||||
import * as __MIDDLEWARE_1__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
||||
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
|
||||
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
||||
|
||||
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
||||
]
|
||||
export default worker;
|
||||
@@ -1,134 +0,0 @@
|
||||
// This loads all middlewares exposed on the middleware object and then starts
|
||||
// the invocation chain. The big idea is that we can add these to the middleware
|
||||
// export dynamically through wrangler, or we can potentially let users directly
|
||||
// add them as a sort of "plugin" system.
|
||||
|
||||
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-Gs6nOV/middleware-insertion-facade.js";
|
||||
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts";
|
||||
import type { WorkerEntrypointConstructor } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-Gs6nOV/middleware-insertion-facade.js";
|
||||
|
||||
// Preserve all the exports from the worker
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-Gs6nOV/middleware-insertion-facade.js";
|
||||
|
||||
class __Facade_ScheduledController__ implements ScheduledController {
|
||||
readonly #noRetry: ScheduledController["noRetry"];
|
||||
|
||||
constructor(
|
||||
readonly scheduledTime: number,
|
||||
readonly cron: string,
|
||||
noRetry: ScheduledController["noRetry"]
|
||||
) {
|
||||
this.#noRetry = noRetry;
|
||||
}
|
||||
|
||||
noRetry() {
|
||||
if (!(this instanceof __Facade_ScheduledController__)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
// Need to call native method immediately in case uncaught error thrown
|
||||
this.#noRetry();
|
||||
}
|
||||
}
|
||||
|
||||
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return worker;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
const fetchDispatcher: ExportedHandlerFetchHandler = function (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) {
|
||||
if (worker.fetch === undefined) {
|
||||
throw new Error("Handler does not export a fetch() function.");
|
||||
}
|
||||
return worker.fetch(request, env, ctx);
|
||||
};
|
||||
|
||||
return {
|
||||
...worker,
|
||||
fetch(request, env, ctx) {
|
||||
const dispatcher: Dispatcher = function (type, init) {
|
||||
if (type === "scheduled" && worker.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return worker.scheduled(controller, env, ctx);
|
||||
}
|
||||
};
|
||||
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function wrapWorkerEntrypoint(
|
||||
klass: WorkerEntrypointConstructor
|
||||
): WorkerEntrypointConstructor {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return klass;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
// `extend`ing `klass` here so other RPC methods remain callable
|
||||
return class extends klass {
|
||||
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) => {
|
||||
this.env = env;
|
||||
this.ctx = ctx;
|
||||
if (super.fetch === undefined) {
|
||||
throw new Error("Entrypoint class does not define a fetch() function.");
|
||||
}
|
||||
return super.fetch(request);
|
||||
};
|
||||
|
||||
#dispatcher: Dispatcher = (type, init) => {
|
||||
if (type === "scheduled" && super.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return super.scheduled(controller);
|
||||
}
|
||||
};
|
||||
|
||||
fetch(request: Request<unknown, IncomingRequestCfProperties>) {
|
||||
return __facade_invoke__(
|
||||
request,
|
||||
this.env,
|
||||
this.ctx,
|
||||
this.#dispatcher,
|
||||
this.#fetchDispatcher
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;
|
||||
if (typeof ENTRY === "object") {
|
||||
WRAPPED_ENTRY = wrapExportedHandler(ENTRY);
|
||||
} else if (typeof ENTRY === "function") {
|
||||
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);
|
||||
}
|
||||
export default WRAPPED_ENTRY;
|
||||
@@ -1,13 +0,0 @@
|
||||
function stripCfConnectingIPHeader(input, init) {
|
||||
const request = new Request(input, init);
|
||||
request.headers.delete("CF-Connecting-IP");
|
||||
return request;
|
||||
}
|
||||
|
||||
globalThis.fetch = new Proxy(globalThis.fetch, {
|
||||
apply(target, thisArg, argArray) {
|
||||
return Reflect.apply(target, thisArg, [
|
||||
stripCfConnectingIPHeader.apply(null, argArray),
|
||||
]);
|
||||
},
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import worker, * as OTHER_EXPORTS from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
import * as __MIDDLEWARE_0__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
||||
import * as __MIDDLEWARE_1__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
||||
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
|
||||
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
||||
|
||||
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
||||
]
|
||||
export default worker;
|
||||
@@ -1,134 +0,0 @@
|
||||
// This loads all middlewares exposed on the middleware object and then starts
|
||||
// the invocation chain. The big idea is that we can add these to the middleware
|
||||
// export dynamically through wrangler, or we can potentially let users directly
|
||||
// add them as a sort of "plugin" system.
|
||||
|
||||
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-MJIuJQ/middleware-insertion-facade.js";
|
||||
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts";
|
||||
import type { WorkerEntrypointConstructor } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-MJIuJQ/middleware-insertion-facade.js";
|
||||
|
||||
// Preserve all the exports from the worker
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-MJIuJQ/middleware-insertion-facade.js";
|
||||
|
||||
class __Facade_ScheduledController__ implements ScheduledController {
|
||||
readonly #noRetry: ScheduledController["noRetry"];
|
||||
|
||||
constructor(
|
||||
readonly scheduledTime: number,
|
||||
readonly cron: string,
|
||||
noRetry: ScheduledController["noRetry"]
|
||||
) {
|
||||
this.#noRetry = noRetry;
|
||||
}
|
||||
|
||||
noRetry() {
|
||||
if (!(this instanceof __Facade_ScheduledController__)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
// Need to call native method immediately in case uncaught error thrown
|
||||
this.#noRetry();
|
||||
}
|
||||
}
|
||||
|
||||
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return worker;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
const fetchDispatcher: ExportedHandlerFetchHandler = function (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) {
|
||||
if (worker.fetch === undefined) {
|
||||
throw new Error("Handler does not export a fetch() function.");
|
||||
}
|
||||
return worker.fetch(request, env, ctx);
|
||||
};
|
||||
|
||||
return {
|
||||
...worker,
|
||||
fetch(request, env, ctx) {
|
||||
const dispatcher: Dispatcher = function (type, init) {
|
||||
if (type === "scheduled" && worker.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return worker.scheduled(controller, env, ctx);
|
||||
}
|
||||
};
|
||||
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function wrapWorkerEntrypoint(
|
||||
klass: WorkerEntrypointConstructor
|
||||
): WorkerEntrypointConstructor {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return klass;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
// `extend`ing `klass` here so other RPC methods remain callable
|
||||
return class extends klass {
|
||||
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) => {
|
||||
this.env = env;
|
||||
this.ctx = ctx;
|
||||
if (super.fetch === undefined) {
|
||||
throw new Error("Entrypoint class does not define a fetch() function.");
|
||||
}
|
||||
return super.fetch(request);
|
||||
};
|
||||
|
||||
#dispatcher: Dispatcher = (type, init) => {
|
||||
if (type === "scheduled" && super.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return super.scheduled(controller);
|
||||
}
|
||||
};
|
||||
|
||||
fetch(request: Request<unknown, IncomingRequestCfProperties>) {
|
||||
return __facade_invoke__(
|
||||
request,
|
||||
this.env,
|
||||
this.ctx,
|
||||
this.#dispatcher,
|
||||
this.#fetchDispatcher
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;
|
||||
if (typeof ENTRY === "object") {
|
||||
WRAPPED_ENTRY = wrapExportedHandler(ENTRY);
|
||||
} else if (typeof ENTRY === "function") {
|
||||
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);
|
||||
}
|
||||
export default WRAPPED_ENTRY;
|
||||
@@ -1,13 +0,0 @@
|
||||
function stripCfConnectingIPHeader(input, init) {
|
||||
const request = new Request(input, init);
|
||||
request.headers.delete("CF-Connecting-IP");
|
||||
return request;
|
||||
}
|
||||
|
||||
globalThis.fetch = new Proxy(globalThis.fetch, {
|
||||
apply(target, thisArg, argArray) {
|
||||
return Reflect.apply(target, thisArg, [
|
||||
stripCfConnectingIPHeader.apply(null, argArray),
|
||||
]);
|
||||
},
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import worker, * as OTHER_EXPORTS from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
import * as __MIDDLEWARE_0__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
||||
import * as __MIDDLEWARE_1__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
||||
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
|
||||
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
||||
|
||||
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
||||
]
|
||||
export default worker;
|
||||
@@ -1,134 +0,0 @@
|
||||
// This loads all middlewares exposed on the middleware object and then starts
|
||||
// the invocation chain. The big idea is that we can add these to the middleware
|
||||
// export dynamically through wrangler, or we can potentially let users directly
|
||||
// add them as a sort of "plugin" system.
|
||||
|
||||
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-SY4zl5/middleware-insertion-facade.js";
|
||||
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts";
|
||||
import type { WorkerEntrypointConstructor } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-SY4zl5/middleware-insertion-facade.js";
|
||||
|
||||
// Preserve all the exports from the worker
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-SY4zl5/middleware-insertion-facade.js";
|
||||
|
||||
class __Facade_ScheduledController__ implements ScheduledController {
|
||||
readonly #noRetry: ScheduledController["noRetry"];
|
||||
|
||||
constructor(
|
||||
readonly scheduledTime: number,
|
||||
readonly cron: string,
|
||||
noRetry: ScheduledController["noRetry"]
|
||||
) {
|
||||
this.#noRetry = noRetry;
|
||||
}
|
||||
|
||||
noRetry() {
|
||||
if (!(this instanceof __Facade_ScheduledController__)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
// Need to call native method immediately in case uncaught error thrown
|
||||
this.#noRetry();
|
||||
}
|
||||
}
|
||||
|
||||
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return worker;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
const fetchDispatcher: ExportedHandlerFetchHandler = function (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) {
|
||||
if (worker.fetch === undefined) {
|
||||
throw new Error("Handler does not export a fetch() function.");
|
||||
}
|
||||
return worker.fetch(request, env, ctx);
|
||||
};
|
||||
|
||||
return {
|
||||
...worker,
|
||||
fetch(request, env, ctx) {
|
||||
const dispatcher: Dispatcher = function (type, init) {
|
||||
if (type === "scheduled" && worker.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return worker.scheduled(controller, env, ctx);
|
||||
}
|
||||
};
|
||||
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function wrapWorkerEntrypoint(
|
||||
klass: WorkerEntrypointConstructor
|
||||
): WorkerEntrypointConstructor {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return klass;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
// `extend`ing `klass` here so other RPC methods remain callable
|
||||
return class extends klass {
|
||||
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) => {
|
||||
this.env = env;
|
||||
this.ctx = ctx;
|
||||
if (super.fetch === undefined) {
|
||||
throw new Error("Entrypoint class does not define a fetch() function.");
|
||||
}
|
||||
return super.fetch(request);
|
||||
};
|
||||
|
||||
#dispatcher: Dispatcher = (type, init) => {
|
||||
if (type === "scheduled" && super.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return super.scheduled(controller);
|
||||
}
|
||||
};
|
||||
|
||||
fetch(request: Request<unknown, IncomingRequestCfProperties>) {
|
||||
return __facade_invoke__(
|
||||
request,
|
||||
this.env,
|
||||
this.ctx,
|
||||
this.#dispatcher,
|
||||
this.#fetchDispatcher
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;
|
||||
if (typeof ENTRY === "object") {
|
||||
WRAPPED_ENTRY = wrapExportedHandler(ENTRY);
|
||||
} else if (typeof ENTRY === "function") {
|
||||
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);
|
||||
}
|
||||
export default WRAPPED_ENTRY;
|
||||
@@ -1,13 +0,0 @@
|
||||
function stripCfConnectingIPHeader(input, init) {
|
||||
const request = new Request(input, init);
|
||||
request.headers.delete("CF-Connecting-IP");
|
||||
return request;
|
||||
}
|
||||
|
||||
globalThis.fetch = new Proxy(globalThis.fetch, {
|
||||
apply(target, thisArg, argArray) {
|
||||
return Reflect.apply(target, thisArg, [
|
||||
stripCfConnectingIPHeader.apply(null, argArray),
|
||||
]);
|
||||
},
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import worker, * as OTHER_EXPORTS from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
import * as __MIDDLEWARE_0__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
||||
import * as __MIDDLEWARE_1__ from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
||||
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/worker/src/index.ts";
|
||||
|
||||
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
||||
|
||||
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
||||
]
|
||||
export default worker;
|
||||
@@ -1,134 +0,0 @@
|
||||
// This loads all middlewares exposed on the middleware object and then starts
|
||||
// the invocation chain. The big idea is that we can add these to the middleware
|
||||
// export dynamically through wrangler, or we can potentially let users directly
|
||||
// add them as a sort of "plugin" system.
|
||||
|
||||
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-nk20cv/middleware-insertion-facade.js";
|
||||
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/songjunxi/Desktop/repos/vmail/node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/templates/middleware/common.ts";
|
||||
import type { WorkerEntrypointConstructor } from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-nk20cv/middleware-insertion-facade.js";
|
||||
|
||||
// Preserve all the exports from the worker
|
||||
export * from "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/bundle-nk20cv/middleware-insertion-facade.js";
|
||||
|
||||
class __Facade_ScheduledController__ implements ScheduledController {
|
||||
readonly #noRetry: ScheduledController["noRetry"];
|
||||
|
||||
constructor(
|
||||
readonly scheduledTime: number,
|
||||
readonly cron: string,
|
||||
noRetry: ScheduledController["noRetry"]
|
||||
) {
|
||||
this.#noRetry = noRetry;
|
||||
}
|
||||
|
||||
noRetry() {
|
||||
if (!(this instanceof __Facade_ScheduledController__)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
// Need to call native method immediately in case uncaught error thrown
|
||||
this.#noRetry();
|
||||
}
|
||||
}
|
||||
|
||||
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return worker;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
const fetchDispatcher: ExportedHandlerFetchHandler = function (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) {
|
||||
if (worker.fetch === undefined) {
|
||||
throw new Error("Handler does not export a fetch() function.");
|
||||
}
|
||||
return worker.fetch(request, env, ctx);
|
||||
};
|
||||
|
||||
return {
|
||||
...worker,
|
||||
fetch(request, env, ctx) {
|
||||
const dispatcher: Dispatcher = function (type, init) {
|
||||
if (type === "scheduled" && worker.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return worker.scheduled(controller, env, ctx);
|
||||
}
|
||||
};
|
||||
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function wrapWorkerEntrypoint(
|
||||
klass: WorkerEntrypointConstructor
|
||||
): WorkerEntrypointConstructor {
|
||||
// If we don't have any middleware defined, just return the handler as is
|
||||
if (
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
||||
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
||||
) {
|
||||
return klass;
|
||||
}
|
||||
// Otherwise, register all middleware once
|
||||
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
||||
__facade_register__(middleware);
|
||||
}
|
||||
|
||||
// `extend`ing `klass` here so other RPC methods remain callable
|
||||
return class extends klass {
|
||||
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = (
|
||||
request,
|
||||
env,
|
||||
ctx
|
||||
) => {
|
||||
this.env = env;
|
||||
this.ctx = ctx;
|
||||
if (super.fetch === undefined) {
|
||||
throw new Error("Entrypoint class does not define a fetch() function.");
|
||||
}
|
||||
return super.fetch(request);
|
||||
};
|
||||
|
||||
#dispatcher: Dispatcher = (type, init) => {
|
||||
if (type === "scheduled" && super.scheduled !== undefined) {
|
||||
const controller = new __Facade_ScheduledController__(
|
||||
Date.now(),
|
||||
init.cron ?? "",
|
||||
() => {}
|
||||
);
|
||||
return super.scheduled(controller);
|
||||
}
|
||||
};
|
||||
|
||||
fetch(request: Request<unknown, IncomingRequestCfProperties>) {
|
||||
return __facade_invoke__(
|
||||
request,
|
||||
this.env,
|
||||
this.ctx,
|
||||
this.#dispatcher,
|
||||
this.#fetchDispatcher
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;
|
||||
if (typeof ENTRY === "object") {
|
||||
WRAPPED_ENTRY = wrapExportedHandler(ENTRY);
|
||||
} else if (typeof ENTRY === "function") {
|
||||
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);
|
||||
}
|
||||
export default WRAPPED_ENTRY;
|
||||
@@ -1,13 +0,0 @@
|
||||
function stripCfConnectingIPHeader(input, init) {
|
||||
const request = new Request(input, init);
|
||||
request.headers.delete("CF-Connecting-IP");
|
||||
return request;
|
||||
}
|
||||
|
||||
globalThis.fetch = new Proxy(globalThis.fetch, {
|
||||
apply(target, thisArg, argArray) {
|
||||
return Reflect.apply(target, thisArg, [
|
||||
stripCfConnectingIPHeader.apply(null, argArray),
|
||||
]);
|
||||
},
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
var qn=Object.defineProperty;var uu=(r,e,t)=>e in r?qn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var o=(r,e)=>qn(r,"name",{value:e,configurable:!0});var lu=(r,e)=>{for(var t in e)qn(r,t,{get:e[t],enumerable:!0})};var h=(r,e,t)=>(uu(r,typeof e!="symbol"?e+"":e,t),t);function cu(r,e){let t=new Request(r,e);return t.headers.delete("CF-Connecting-IP"),t}o(cu,"stripCfConnectingIPHeader");globalThis.fetch=new Proxy(globalThis.fetch,{apply(r,e,t){return Reflect.apply(r,e,[cu.apply(null,t)])}});function L(r){return new Error(`[unenv] ${r} is not implemented yet!`)}o(L,"createNotImplementedError");function Ue(r){return Object.assign(o(()=>{throw L(r)},"fn"),{__unenv__:!0})}o(Ue,"notImplemented");function $i(r){return class{__unenv__=!0;constructor(){throw new Error(`[unenv] ${r} is not implemented yet!`)}}}o($i,"notImplementedClass");var Fn=globalThis.performance?.timeOrigin??Date.now(),jn=globalThis.performance?.now?globalThis.performance.now.bind(globalThis.performance):()=>Date.now()-Fn,du={name:"node",entryType:"node",startTime:0,duration:0,nodeStart:0,v8Start:0,bootstrapComplete:0,environment:0,loopStart:0,loopExit:0,idleTime:0,uvMetricsInfo:{loopCount:0,events:0,eventsWaiting:0},detail:void 0,toJSON(){return this}},st=class{__unenv__=!0;detail;entryType="event";name;startTime;constructor(e,t){this.name=e,this.startTime=t?.startTime||jn(),this.detail=t?.detail}get duration(){return jn()-this.startTime}toJSON(){return{name:this.name,entryType:this.entryType,startTime:this.startTime,duration:this.duration,detail:this.detail}}};o(st,"PerformanceEntry");var In=o(class extends st{entryType="mark";constructor(){super(...arguments)}get duration(){return 0}},"PerformanceMark"),ur=class extends st{entryType="measure"};o(ur,"PerformanceMeasure");var lr=class extends st{entryType="resource";serverTiming=[];connectEnd=0;connectStart=0;decodedBodySize=0;domainLookupEnd=0;domainLookupStart=0;encodedBodySize=0;fetchStart=0;initiatorType="";name="";nextHopProtocol="";redirectEnd=0;redirectStart=0;requestStart=0;responseEnd=0;responseStart=0;secureConnectionStart=0;startTime=0;transferSize=0;workerStart=0;responseStatus=0};o(lr,"PerformanceResourceTiming");var Qr=class{__unenv__=!0;getEntries(){return[]}getEntriesByName(e,t){return[]}getEntriesByType(e){return[]}};o(Qr,"PerformanceObserverEntryList");var cr=class{__unenv__=!0;timeOrigin=Fn;eventCounts=new Map;_entries=[];_resourceTimingBufferSize=0;navigation=void 0;timing=void 0;timerify(e,t){throw L("Performance.timerify")}get nodeTiming(){return du}eventLoopUtilization(){return{}}markResourceTiming(){return new lr("")}onresourcetimingbufferfull=null;now(){return this.timeOrigin===Fn?jn():Date.now()-this.timeOrigin}clearMarks(e){this._entries=e?this._entries.filter(t=>t.name!==e):this._entries.filter(t=>t.entryType!=="mark")}clearMeasures(e){this._entries=e?this._entries.filter(t=>t.name!==e):this._entries.filter(t=>t.entryType!=="measure")}clearResourceTimings(){this._entries=this._entries.filter(e=>e.entryType!=="resource"||e.entryType!=="navigation")}getEntries(){return this._entries}getEntriesByName(e,t){return this._entries.filter(s=>s.name===e&&(!t||s.entryType===t))}getEntriesByType(e){return this._entries.filter(t=>t.entryType===e)}mark(e,t){let s=new In(e,t);return this._entries.push(s),s}measure(e,t,s){let n,i;typeof t=="string"?(n=this.getEntriesByName(t,"mark")[0]?.startTime,i=this.getEntriesByName(s,"mark")[0]?.startTime):(n=Number.parseFloat(t?.start)||this.now(),i=Number.parseFloat(t?.end)||this.now());let a=new ur(e,{startTime:n,detail:{start:n,end:i}});return this._entries.push(a),a}setResourceTimingBufferSize(e){this._resourceTimingBufferSize=e}addEventListener(e,t,s){throw L("Performance.addEventListener")}removeEventListener(e,t,s){throw L("Performance.removeEventListener")}dispatchEvent(e){throw L("Performance.dispatchEvent")}toJSON(){return this}};o(cr,"Performance");var or=class{__unenv__=!0;_callback=null;constructor(e){this._callback=e}takeRecords(){return[]}disconnect(){throw L("PerformanceObserver.disconnect")}observe(e){throw L("PerformanceObserver.observe")}bind(e){return e}runInAsyncScope(e,t,...s){return e.call(t,...s)}asyncId(){return 0}triggerAsyncId(){return 0}emitDestroy(){return this}};o(or,"PerformanceObserver"),h(or,"supportedEntryTypes",[]);var Mi=globalThis.performance&&"addEventListener"in globalThis.performance?globalThis.performance:new cr;globalThis.performance=Mi;globalThis.Performance=cr;globalThis.PerformanceEntry=st;globalThis.PerformanceMark=In;globalThis.PerformanceMeasure=ur;globalThis.PerformanceObserver=or;globalThis.PerformanceObserverEntryList=Qr;globalThis.PerformanceResourceTiming=lr;import{Writable as Li}from"node:stream";var re=Object.assign(()=>{},{__unenv__:!0});var Q=globalThis.console,Pi=!0,zi=new Li,Ki=new Li,zs=Q?.log??re,fu=Q?.info??zs,Xp=Q?.trace??fu,Zp=Q?.debug??zs,em=Q?.table??zs,hu=Q?.error??zs,tm=Q?.warn??hu,rm=Q?.createTask??Ue("console.createTask");var sm=Q?.clear??re,nm=Q?.count??Line truncated
|
||||
CREATE TABLE IF NOT EXISTS ${f.identifier(n)} (
|
||||
id SERIAL PRIMARY KEY,
|
||||
hash text NOT NULL,
|
||||
created_at numeric
|
||||
)
|
||||
`;t.run(i);let u=t.values(f`SELECT id, hash, created_at FROM ${f.identifier(n)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run(f`BEGIN`);try{for(let l of e)if(!u||Number(u[2])<l.folderMillis){for(let c of l.sql)t.run(f.raw(c));t.run(f`INSERT INTO ${f.identifier(n)} ("hash", "created_at") VALUES(${l.hash}, ${l.folderMillis})`)}t.run(f`COMMIT`)}catch(l){throw t.run(f`ROLLBACK`),l}}};o(wr,"SQLiteSyncDialect"),Md=p,h(wr,Md,"SQLiteSyncDialect");var Ld,Ar=class extends vr{async migrate(e,t,s){let n=typeof s=="string"?"__drizzle_migrations":s.migrationsTable??"__drizzle_migrations",i=f`
|
||||
CREATE TABLE IF NOT EXISTS ${f.identifier(n)} (
|
||||
id SERIAL PRIMARY KEY,
|
||||
hash text NOT NULL,
|
||||
created_at numeric
|
||||
)
|
||||
`;await t.run(i);let u=(await t.values(f`SELECT id, hash, created_at FROM ${f.identifier(n)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async l=>{for(let c of e)if(!u||Number(u[2])<c.folderMillis){for(let d of c.sql)await l.run(f.raw(d));await l.run(f`INSERT INTO ${f.identifier(n)} ("hash", "created_at") VALUES(${c.hash}, ${c.folderMillis})`)}})}};o(Ar,"SQLiteAsyncDialect"),Ld=p,h(Ar,Ld,"SQLiteAsyncDialect");var Pd,Dr=class{getSelectedFields(){return this._.selectedFields}};o(Dr,"TypedQueryBuilder"),Pd=p,h(Dr,Pd,"TypedQueryBuilder");var Qd,pe=class{fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t=!!this.fields,s;return this.fields?s=this.fields:g(e,te)?s=Object.fromEntries(Object.keys(e[Y].selection).map(n=>[n,e[n]])):g(e,ot)?s=e[X].selectedFields:g(e,D)?s={}:s=fn(e),new _r({table:e,fields:s,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}};o(pe,"SQLiteSelectBuilder"),Qd=p,h(pe,Qd,"SQLiteSelectBuilder");var Gd,bs=class extends Dr{_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:e,fields:t,isPartialSelect:s,session:n,dialect:i,withList:a,distinct:u}){super(),this.config={withList:a,table:e,fields:{...t},distinct:u,setOperators:[]},this.isPartialSelect=s,this.session=n,this.dialect=i,this._={selectedFields:t},this.tableName=li(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}createJoin(e){return(t,s)=>{let n=this.tableName,i=li(t);if(typeof i=="string"&&this.config.joins?.some(a=>a.alias===i))throw new Error(`Alias "${i}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof n=="string"&&(this.config.fields={[n]:this.config.fields}),typeof i=="string"&&!g(t,D))){let a=g(t,te)?t[Y].selection:g(t,fe)?t[X].selectedFields:t[v.Symbol.Columns];this.config.fields[i]=a}if(typeof s=="function"&&(s=s(new Proxy(this.config.fields,new oe({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:s,table:t,joinType:e,alias:i}),typeof i=="string")switch(e){case"left":{this.joinsNotNullableMap[i]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[i]=!0;break}case"inner":{this.joinsNotNullableMap[i]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([a])=>[a,!1])),this.joinsNotNullableMap[i]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(e,t){return s=>{let n=typeof s=="function"?s(zd()):s;if(!ui(this.getSelectedFields(),n.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:n}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new oe({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new oe({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new oe({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new oe({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),s=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=s:this.config.orderBy=s}else{let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){return new Proxy(new te(this.getSQL(),this.config.fields,e),new oe({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new oe({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}
Line truncated
|
||||
`)}finalize(){return _t(new Blob(this.chunks,{type:"application/octet-stream"}))}};o(zr,"PassThroughDecoder");var Kr=class{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let s=Math.floor(this.remainder.length/4)*4,n;s===this.remainder.length?(n=this.remainder,this.remainder=""):(n=this.remainder.substr(0,s),this.remainder=this.remainder.substr(s)),n.length&&this.chunks.push(Nn(n))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Nn(this.remainder)),_t(new Blob(this.chunks,{type:"application/octet-stream"}))}};o(Kr,"Base64Decoder");var Vo=/^=[a-f0-9]{2}$/i,rp=/(?==[a-f0-9]{2})/i,sp=/=\r?\n/g,np=/=[a-fA-F0-9]?$/,Ur=class{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),s=new DataView(t);for(let n=0,i=e.length;n<i;n++)s.setUint8(n,parseInt(e[n],16));return t}decodeChunks(e){e=e.replace(sp,"");let t=e.split(rp),s=[];for(let n of t){if(n.charAt(0)!=="="){s.length&&(this.chunks.push(this.decodeQPBytes(s)),s=[]),this.chunks.push(n);continue}if(n.length===3){Vo.test(n)?s.push(n.substr(1)):(s.length&&(this.chunks.push(this.decodeQPBytes(s)),s=[]),this.chunks.push(n));continue}if(n.length>3){let i=n.substr(0,3);Vo.test(i)?(s.push(n.substr(1,2)),this.chunks.push(this.decodeQPBytes(s)),s=[],n=n.substr(3),this.chunks.push(n)):(s.length&&(this.chunks.push(this.decodeQPBytes(s)),s=[]),this.chunks.push(n))}}s.length&&(this.chunks.push(this.decodeQPBytes(s)),s=[])}update(e){let t=this.decoder.decode(e)+`
|
||||
`;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let s=t.match(np);if(s){if(s.index===0){this.remainder=t;return}this.remainder=t.substr(s.index),t=t.substr(0,s.index)}this.decodeChunks(t)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),_t(new Blob(this.chunks,{type:"application/octet-stream"}))}};o(Ur,"QPDecoder");var er=class{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new Kr:/quoted-printable/i.test(e)?this.contentDecoder=new Ur({decoder:Pr(this.contentType.parsed.params.charset)}):this.contentDecoder=new zr}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},s=!1,n="",i="value",a=!1,u=!1,l;for(let c=0,d=e.length;c<d;c++)switch(l=e.charAt(c),i){case"key":if(l==="="){s=n.trim().toLowerCase(),i="value",n="";break}n+=l;break;case"value":if(u)n+=l;else if(l==="\\"){u=!0;continue}else a&&l===a?a=!1:!a&&l==='"'?a=l:!a&&l===";"?(s===!1?t.value=n.trim():t.params[s]=n.trim(),i="key",n=""):n+=l;u=!1;break}return n=n.trim(),i==="value"?s===!1?t.value=n:t.params[s]=n:n&&(t.params[n.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),Uo(t),t}decodeFlowedText(e,t){return e.split(/\r?\n/).reduce((s,n)=>/ $/.test(s)&&!/(^|\n)-- $/.test(s)?t?s.slice(0,-1)+n:s+n:s+`
|
||||
`+n).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=Pr(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let t=this.headerLines[e];if(e&&/^\s/.test(t))this.headerLines[e-1]+=`
|
||||
`+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let s=t.indexOf(":"),n=s<0?t.trim():t.substr(0,s).trim(),i=s<0?"":t.substr(s+1).trim();switch(this.headers.push({key:n.toLowerCase(),originalKey:n,value:i}),n.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Dt.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(Pr().decode(e));break;case"body":this.contentDecoder.update(e)}}};o(er,"MimeNode");var ip={"Æ":"\xC6","Æ":"\xC6","&":"&","&":"&","Á":"\xC1","Á":"\xC1","Ă":"\u0102","Â":"\xC2","Â":"\xC2","А":"\u0410","𝔄":"\u{1D504}","À":"\xC0","À":"\xC0","Α":"\u0391","Ā":"\u0100","⩓":"\u2A53","Ą":"\u0104","𝔸":"\u{1D538}","⁡":"\u2061","Å":"\xC5","Å":"\xC5","𝒜":"\u{1D49C}","≔":"\u2254","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","∖":"\u2216","⫧":"\u2AE7","⌆":"\u2306","Б":"\u0411","∵":"\u2235","ℬ":"\u212C","Β":"\u0392","𝔅":"\u{1D505}","𝔹":"\u{1D539}","˘":"\u02D8","ℬ":"\u212C","≎":"\u224E","Ч":"\u0427","©":"\xA9","©":"\xA9","Ć":"\u0106","⋒":"\u22D2","ⅅ":"\u2145","ℭ":"\u212D","Č":"\u010C","Ç":"\xC7","Ç":"\xC7","Ĉ":"\u0108","∰":"\u2230","Ċ":"\u010A","¸":"\xB8","·":"\xB7","ℭ":"\u212D","Χ":"\u03A7","⊙":"\u2299","⊖":"\u2296","⊕":"\u2295","⊗":"\u2297","∲":"\u2232","”":"\u201D","’":"\u2019","∷":"\u2237","⩴":"\u2A74","≡":"\u2261","∯":"\u222F","∮":"\u222E","ℂ":"\u2102","∐":"\u2210","∳":"\u2233","⨯":"\u2A2F","𝒞":"\u{1D49E}","⋓":"\u22D3","≍":"\u224D","ⅅ":"\u2145","⤑":"\u2911","Ђ":"\u0402","Ѕ":"\u0405","Џ":"\u040F","‡":"\u2021","↡":"\u21A1","⫤":"\u2AE4","Ď":"\u010E","Д":"\u0414","∇":"\u2207","Δ":"\u0394","𝔇":"\u{1D507}","´":"\xB4","˙":"\u02D9","˝":"\u02DD","`":"`","˜":"\u02DC","⋄":"\u22C4","ⅆ":"\u2146","𝔻":"\u{1D53B}","¨":"\xA8","⃜":"\u20DC","≐":"\u2250","∯":"\u222F","¨":"\xA8","⇓":"\u21D3","⇐":"\u21D0","⇔":"\u21D4","⫤":"\u2AE4","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","⇒":"\u21D2","⊨":"\u22A8","⇑":"\u21D1","⇕":"\u21D5","∥":"\u2225","↓":"\u2193","⤓":"\u2913","⇵":"\u21F5","̑":"\u0311","⥐":"\u2950","⥞":"\u295E","↽":"\u21BD","⥖":"\u2956","⥟":"\u295F","⇁":"\u21C1","⥗":"\u2957","⊤":"\u22A4","↧":"\u21A7","⇓":"\u21D3","𝒟":"\u{1D49F}","Đ":"\u0110","Ŋ":"\u014A","Ð":"\xD0","Ð":"\xD0","É":"\xC9","É":"\xC9","Ě":"\u011A","Ê":"\xCA","Ê":"\xCA","Э":"\u042D","Ė":"\u0116","𝔈":"\u{1D508}","È":"\xC8","È":"\xC8","∈":"\u2208","Ē":"\u0112","◻":"\u25FB","▫":"\u25AB","Ę":"\u0118","𝔼":"\u{1D53C}","Ε":"\u0395","⩵":"\u2A75","≂":"\u2242","⇌":"\u21CC","ℰ":"\u213Line truncated
|
||||
`,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426","	":" ","Τ":"\u03A4","Ť":"\u0164","&Tcedil
Line truncated
|
||||
`).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
|
||||
|
||||
`).replace(/<script\b[^>]*>.*?<\/script\b[^>]*>/gi," ").replace(/^.*<body\b[^>]*>/i,"").replace(/^.*<\/head\b[^>]*>/i,"").replace(/^.*<\!doctype\b[^>]*>/i,"").replace(/<\/body\b[^>]*>.*$/i,"").replace(/<\/html\b[^>]*>.*$/i,"").replace(/<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi," ($1) ").replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,"").replace(/<li\b[^>]*>[\n\u0001\s]*/gi,"* ").replace(/<hr\b[^>]*>/g,`
|
||||
-------------
|
||||
`).replace(/<[^>]*>/g," ").replace(/\u0001/g,`
|
||||
`).replace(/[ \t]+/g," ").replace(/^\s+$/gm,"").replace(/\n\n+/g,`
|
||||
|
||||
`).replace(/^\n+/,`
|
||||
`).replace(/\n+$/,`
|
||||
`),r=ap(r),r}o(Qo,"htmlToText");function Go(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}o(Go,"formatTextAddress");function Si(r){let e=[],t=o((s,n)=>{if(n&&e.push(", "),s.group){let i=`${s.name}:`,a=";";e.push(i),s.group.forEach(t),e.push(a)}else e.push(Go(s))},"processAddress");return r.forEach(t),e.join("")}o(Si,"formatTextAddresses");function Wo(r){return`<a href="mailto:${tr(r.address)}" class="postal-email-address">${tr(r.name||`<${r.address}>`)}</a>`}o(Wo,"formatHtmlAddress");function Ti(r){let e=[],t=o((s,n)=>{if(n&&e.push('<span class="postal-email-address-separator">, </span>'),s.group){let i=`<span class="postal-email-address-group">${tr(s.name)}:</span>`,a='<span class="postal-email-address-group">;</span>';e.push(i),s.group.forEach(t),e.push(a)}else e.push(Wo(s))},"processAddress");return r.forEach(t),e.join(" ")}o(Ti,"formatHtmlAddresses");function op(r,e,t){r=(r||"").toString(),e=e||76;let s=0,n=r.length,i="",a,u;for(;s<n;){if(a=r.substr(s,e),a.length<e){i+=a;break}if(u=a.match(/^[^\n\r]*(\r?\n|\r)/)){a=u[0],i+=a,s+=a.length;continue}else(u=a.match(/(\s+)[^\s]*$/))&&u[0].length-(t?(u[1]||"").length:0)<a.length?a=a.substr(0,a.length-(u[0].length-(t?(u[1]||"").length:0))):(u=r.substr(s+a.length).match(/^[^\s]+(\s*)/))&&(a=a+u[0].substr(0,u[0].length-(t?0:(u[1]||"").length)));i+=a,s+=a.length,s<n&&(i+=`\r
|
||||
`)}return i}o(op,"foldLines");function Ni(r){let e=[];if(r.from&&e.push({key:"From",val:Go(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let a={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},u=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",a).format(new Date(r.date));e.push({key:"Date",val:u})}r.to&&r.to.length&&e.push({key:"To",val:Si(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:Si(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:Si(r.bcc)});let t=e.map(a=>a.key.length).reduce((a,u)=>u>a?u:a,0);e=e.flatMap(a=>{let u=t-a.key.length,l=`${a.key}: ${" ".repeat(u)}`,c=`${" ".repeat(a.key.length+1)} ${" ".repeat(u)}`;return op(a.val,80,!0).split(/\r?\n/).map(m=>m.trim()).map((m,x)=>`${x?c:l}${m}`)});let s=e.map(a=>a.length).reduce((a,u)=>u>a?u:a,0),n="-".repeat(s);return`
|
||||
${n}
|
||||
${e.join(`
|
||||
`)}
|
||||
${n}
|
||||
`}o(Ni,"formatTextHeader");function ki(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${Wo(r.from)}</div>`),r.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${tr(r.subject)}</div>`),r.date){let s={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},n=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",s).format(new Date(r.date));e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${tr(r.date)}">${tr(n)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Ti(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Ti(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Ti(r.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
|
||||
<div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}o(ki,"formatHtmlHeader");function up(r){let e=!1,t="text",s,n=[],i={address:[],comment:[],group:[],text:[],textWasQuoted:[]},a,u,l=!1;for(a=0,u=r.length;a<u;a++){let c=r[a],d=a?r[a-1]:null;if(c.type==="operator")switch(c.value){case"<":t="address",l=!1;break;case"(":t="comment",l=!1;break;case":":t="group",e=!0,l=!1;break;case'"':l=!l,t="text";break;default:t="text",l=!1;break}else c.value&&(t==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),d&&d.noBreak&&i[t].length?(i[t][i[t].length-1]+=c.value,t==="text"&&l&&(i.textWasQuoted[i.textWasQuoted.length-1]=!0)):(i[t].push(c.value),t==="text"&&i.textWasQuoted.push(l)))}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),e){i.text=i.text.join(" ");let c=[];i.group.length&&Ri(i.group.join(",")).forEach(m=>{m.group?c=c.concat(m.group):c.push(m)}),n.push({name:Zt(i.text||s&&s.name),group:c})}else{if(!i.address.length&&i.text.length){for(a=i.text.length-1;a>=0;a--)if(!i.textWasQuoted[a]&&i.text[a].match(/^[^@\s]+@[^@\s]+$/)){i.address=i.text.splice(a,1),i.textWasQuoted.splice(a,1);break}let c=o(function(d){return i.address.length?d:(i.address=[d.trim()]," ")},"_regexHandler");if(!i.address.length)for(a=i.text.length-1;a>=0&&!(!i.textWasQuoted[a]&&(i.text[a]=i.text[a].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),i.address.length));a--);}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),i.address.length>1&&(i.text=i.text.concat(i.address.splice(1))),i.text=i.text.join(" "),i.address=i.address.join(" "),!i.address&&/^=\?[^=]+?=$/.test(i.text.trim())){let c=Ri(Zt(i.text));if(c&&c.length)return c}if(!i.address&&e)return[];s={address:i.address||i.text||"",name:Zt(i.text||i.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),n.push(s)}return n}o(up,"_handleAddress");var kn=class{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let t=0,s=this.str.length;t<s;t++){let n=this.str.charAt(t),i=t<s-1?this.str.charAt(t+1):null;this.checkChar(n,i)}return this.list.forEach(t=>{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},t&&![" "," ","\r",`
|
||||
`,",",";"].includes(t)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&e in this.operators){this.node={type:"operator",value:e},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[e],this.escaped=!1;return}else if(['"',"'"].includes(this.operatorExpecting)&&e==="\\"){this.escaped=!0;return}}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),e===`
|
||||
`&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}};o(kn,"Tokenizer");function Ri(r,e){e=e||{};let s=new kn(r).tokenize(),n=[],i=[],a=[];if(s.forEach(u=>{u.type==="operator"&&(u.value===","||u.value===";")?(i.length&&n.push(i),i=[]):i.push(u)}),i.length&&n.push(i),n.forEach(u=>{u=up(u),u.length&&(a=a.concat(u))}),e.flatten){let u=[],l=o(c=>{c.forEach(d=>{if(d.group)return l(d.group);u.push(d)})},"walkAddressList");return l(a),u}return a}o(Ri,"addressParser");var Rn=Ri;function Jo(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(r),n=s.byteLength,i=n%3,a=n-i,u,l,c,d,m,x=0;x<a;x=x+3)m=s[x]<<16|s[x+1]<<8|s[x+2],u=(m&16515072)>>18,l=(m&258048)>>12,c=(m&4032)>>6,d=m&63,e+=t[u]+t[l]+t[c]+t[d];return i==1?(m=s[a],u=(m&252)>>2,l=(m&3)<<4,e+=t[u]+t[l]+"=="):i==2&&(m=s[a]<<8|s[a+1],u=(m&64512)>>10,l=(m&1008)>>4,c=(m&15)<<2,e+=t[u]+t[l]+t[c]+"="),e}o(Jo,"base64ArrayBuffer");var lp=256,cp=2*1024*1024,rt=class{static parse(e,t){return new rt(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||lp,maxHeadersSize:this.options.maxHeadersSize||cp},this.root=this.currentNode=new er({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let s=this.boundaries;if(s.length&&e.length>2&&e[0]===45&&e[1]===45)for(let n=s.length-1;n>=0;n--){let i=s[n];if(e.length!==i.value.length+2&&e.length!==i.value.length+4)continue;let a=e.length===i.value.length+4;if(a&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let u=!0;for(let l=0;l<i.value.length;l++)if(e[l+2]!==i.value[l]){u=!1;break}if(u)return a?(await i.node.finalize(),this.currentNode=i.node.parentNode||this.root):(await i.node.finalizeChildNodes(),this.currentNode=new er({postalMime:this,parentNode:i.node,...this.mimeOptions})),t?this.finalize():void 0}if(this.currentNode.feed(e),t)return this.finalize()}readLine(){let e=this.readPos,t=this.readPos,s=o(()=>({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length}),"res");for(;this.readPos<this.av.length;){let n=this.av[this.readPos++];if(n!==13&&n!==10&&(t=this.readPos),n===10)return s()}return s()}async processNodeTree(){let e={},t=new Set,s=this.textMap=new Map,n=this.forceRfc822Attachments(),i=o(async(a,u,l)=>{if(u=u||!1,l=l||!1,a.contentType.multipart)a.contentType.multipart==="alternative"?u=a:a.contentType.multipart==="related"&&(l=a);else if(this.isInlineMessageRfc822(a)&&!n){let c=new rt;a.subMessage=await c.parse(a.content),s.has(a)||s.set(a,{});let d=s.get(a);(a.subMessage.text||!a.subMessage.html)&&(d.plain=d.plain||[],d.plain.push({type:"subMessage",value:a.subMessage}),t.add("plain")),a.subMessage.html&&(d.html=d.html||[],d.html.push({type:"subMessage",value:a.subMessage}),t.add("html")),c.textMap&&c.textMap.forEach((m,x)=>{s.set(x,m)});for(let m of a.subMessage.attachments||[])this.attachments.push(m)}else if(this.isInlineTextNode(a)){let c=a.contentType.parsed.value.substr(a.contentType.parsed.value.indexOf("/")+1),d=u||a;s.has(d)||s.set(d,{});let m=s.get(d);m[c]=m[c]||[],m[c].push({type:"text",value:a.getTextContent()}),t.add(c)}else if(a.content){let c=a.contentDisposition.parsed.params.filename||a.contentType.parsed.params.name||null,d={filename:c?Zt(c):null,mimeType:a.contentType.parsed.value,disposition:a.contentDisposition.parsed.value||null};switch(l&&a.contentId&&(d.related=!0),a.contentDescription&&(d.description=a.contentDescription),a.contentId&&(d.contentId=a.contentId),a.contentType.parsed.value){case"text/calendar":case"application/ics":{a.contentType.parsed.params.method&&(d.method=a.contentType.parsed.params.method.toString().toUpperCase().trim());let m=a.getTextContent().replace(/\r?\n/g,`
|
||||
`).replace(/\n*$/,`
|
||||
`);d.content=Dt.encode(m);break}default:d.content=a.content}this.attachments.push(d)}for(let c of a.childNodes)await i(c,u,l)},"walk");await i(this.root,!1,[]),s.forEach(a=>{t.forEach(u=>{if(e[u]||(e[u]=[]),a[u])a[u].forEach(l=>{switch(l.type){case"text":e[u].push(l.value);break;case"subMessage":switch(u){case"html":e[u].push(ki(l.value));break;case"plain":e[u].push(Ni(l.value));break}break}});else{let l;switch(u){case"html":l="plain";break;case"plain":l="html";break}(a[l]||[]).forEach(c=>{switch(c.type){case"text":switch(u){case"html":e[u].push(Ho(c.value));break;case"plain":e[u].push(Qo(c.value));break}break;case"subMessage":switch(u){case"html":e[u].push(ki(c.value));break;case"plain":e[u].push(Ni(c.value));break}break}})}})}),Object.keys(e).forEach(a=>{e[a]=e[a].join(`
|
||||
`)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=o(s=>{s.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(s.contentType.parsed.value)&&(e=!0);for(let n of s.childNodes)t(n)},"walk");return t(this.root),e}async resolveStream(e){let t=0,s=[],n=e.getReader();for(;;){let{done:u,value:l}=await n.read();if(u)break;s.push(l),t+=l.length}let i=new Uint8Array(t),a=0;for(let u of s)i.set(u,a),a+=u.length;return i}async parse(e){if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Dt.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await _t(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){let n=this.readLine();await this.processLine(n.bytes,n.done)}await this.processNodeTree();let t={headers:this.root.headers.map(n=>({key:n.key,value:n.value})).reverse()};for(let n of["from","sender"]){let i=this.root.headers.find(a=>a.key===n);if(i&&i.value){let a=Rn(i.value);a&&a.length&&(t[n]=a[0])}}for(let n of["delivered-to","return-path"]){let i=this.root.headers.find(a=>a.key===n);if(i&&i.value){let a=Rn(i.value);if(a&&a.length&&a[0].address){let u=n.replace(/\-(.)/g,(l,c)=>c.toUpperCase());t[u]=a[0].address}}}for(let n of["to","cc","bcc","reply-to"]){let i=this.root.headers.filter(u=>u.key===n),a=[];if(i.filter(u=>u&&u.value).map(u=>Rn(u.value)).forEach(u=>a=a.concat(u||[])),a&&a.length){let u=n.replace(/\-(.)/g,(l,c)=>c.toUpperCase());t[u]=a}}for(let n of["subject","message-id","in-reply-to","references"]){let i=this.root.headers.find(a=>a.key===n);if(i&&i.value){let a=n.replace(/\-(.)/g,(u,l)=>l.toUpperCase());t[a]=Zt(i.value)}}let s=this.root.headers.find(n=>n.key==="date");if(s){let n=new Date(s.value);!n||n.toString()==="Invalid Date"?n=s.value:n=n.toISOString(),t.date=n}switch(this.textContent?.html&&(t.html=this.textContent.html),this.textContent?.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let i of t.attachments||[])i?.content&&(i.content=Jo(i.content),i.encoding="base64");break;case"utf8":let n=new TextDecoder("utf8");for(let i of t.attachments||[])i?.content&&(i.content=n.decode(i.content),i.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}};o(rt,"PostalMime");function Yo(r,e){let t=atob(r),s="";for(let n=0;n<t.length;n++)s+=String.fromCharCode(t.charCodeAt(n)^e.charCodeAt(n%e.length));return s}o(Yo,"decrypt");var Xo=o(async(r,e)=>{let t=r.req.header("X-API-Key");if(!t){let i=r.req.header("Authorization");i?.startsWith("Bearer ")&&(t=i.substring(7))}if(!t)return r.json({error:{code:"UNAUTHORIZED",message:"Missing API Key. Provide it via X-API-Key header or Authorization: Bearer <key>"}},401);let s=ce(r.env.DB),n=await No(s,t);if(!n)return r.json({error:{code:"UNAUTHORIZED",message:"Invalid API Key"}},401);if(!n.isActive)return r.json({error:{code:"FORBIDDEN",message:"API Key is disabled"}},403);if(n.expiresAt&&n.expiresAt<new Date)return r.json({error:{code:"FORBIDDEN",message:"API Key has expired"}},403);r.executionCtx.waitUntil(ko(s,n.id)),r.executionCtx.waitUntil(Lo(s)),r.set("apiKey",{id:n.id,rateLimit:n.rateLimit||100}),await e()},"apiKeyAuth");function dp(){let r=["quick","lazy","happy","sad","bright","dark","warm","cold","soft","hard"],e=["fox","dog","cat","bird","fish","lion","bear","wolf","deer","hawk"],t=r[Math.floor(Math.random()*r.length)],s=e[Math.floor(Math.random()*e.length)],n=Math.floor(Math.random()*1e3);return`${t}-${s}-${n}`}o(dp,"generateRandomLocalPart");var Vr=new Nt;Vr.post("/",async r=>{let e=ce(r.env.DB),t=r.get("apiKey"),s={};try{s=await r.req.json()}catch{}let n=r.env.EMAIL_DOMAIN?r.env.EMAIL_DOMAIN.split(",").map(x=>x.trim()):[];if(n.length===0)return r.json({error:{code:"CONFIGURATION_ERROR",message:"No email domains configured"}},500);let i=s.domain||n[0];if(!n.includes(i))return r.json({error:{code:"VALIDATION_ERROR",message:`Invalid domain. Available domains: ${n.join(", ")}`,details:{field:"domain",allowed:n}}},400);let u=`${s.localPart||dp()}@${i}`,l=s.expiresIn||24*60*60,c=new Date(Date.now()+l*1e3),d=new Date,m={id:Fs(),address:u,domain:i,expiresAt:c,apiKeyId:t.id,createdAt:d,updatedAt:d};try{return await Oo(e,m),await $o(e),r.json({data:{id:m.id,address:m.address,domai
Line truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../bundle-nk20cv/strip-cf-connecting-ip-header.js", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/_internal/utils.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/perf_hooks/performance.mjs", "../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.0.2_unenv@2.0.0-rc.14_workerd@1.20250718.0/node_modules/@cloudflare/unenv-preset/dist/runtime/polyfill/performance.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/console.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/mock/noop.mjs", "../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.0.2_unenv@2.0.0-rc.14_workerd@1.20250718.0/node_modules/@cloudflare/unenv-preset/dist/runtime/node/console.mjs", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-console", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/process/hrtime.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/process/process.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/tty/read-stream.mjs", "../../../node_modules/.pnpm/unenv@2.0.0-rc.14/node_modules/unenv/dist/runtime/node/internal/tty/write-stream.mjs", "../../../node_modules/.pnpm/@cloudflare+unenv-preset@2.0.2_unenv@2.0.0-rc.14_workerd@1.20250718.0/node_modules/@cloudflare/unenv-preset/dist/runtime/node/process.mjs", "../../../node_modules/.pnpm/wrangler@3.114.15/node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-process", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/compose.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/request/constants.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/body.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/url.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/request.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/html.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/context.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/constants.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/hono-base.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/matcher.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/node.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/trie.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/reg-exp-router/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/smart-router/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/trie-router/node.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/router/trie-router/router.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/hono.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/compress.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/utils/mime.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/middleware/serve-static/path.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/middleware/serve-static/index.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/utils.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/helper/websocket/index.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js", "../../../node_modules/.pnpm/hono@4.9.12/node_modules/hono/dist/middleware/cors/index.js", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/entity.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/column.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/subquery.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/src/tracing-utils.ts", "../../../node_modules/.pnpm/drizzle-orm@0.29.5_@libsql+client@0.4.0-pre.7_@types+react@18.3.26_react@18.2.0/node_modules/drizzle-orm/version.js", "../../../node_modules/.pnpm/driLine truncated
|
||||
"sourceRoot": "/Users/songjunxi/Desktop/repos/vmail/.wrangler/tmp/dev-PnrrLK",
|
||||
"sourcesContent": ["function stripCfConnectingIPHeader(input, init) {\n\tconst request = new Request(input, init);\n\trequest.headers.delete(\"CF-Connecting-IP\");\n\treturn request;\n}\n\nglobalThis.fetch = new Proxy(globalThis.fetch, {\n\tapply(target, thisArg, argArray) {\n\t\treturn Reflect.apply(target, thisArg, [\n\t\t\tstripCfConnectingIPHeader.apply(null, argArray),\n\t\t]);\n\t},\n});\n", "/*@__NO_SIDE_EFFECTS__*/ export function rawHeaders(headers) {\n\tconst rawHeaders = [];\n\tfor (const key in headers) {\n\t\tif (Array.isArray(headers[key])) {\n\t\t\tfor (const h of headers[key]) {\n\t\t\t\trawHeaders.push(key, h);\n\t\t\t}\n\t\t} else {\n\t\t\trawHeaders.push(key, headers[key]);\n\t\t}\n\t}\n\treturn rawHeaders;\n}\n/*@__NO_SIDE_EFFECTS__*/ export function mergeFns(...functions) {\n\treturn function(...args) {\n\t\tfor (const fn of functions) {\n\t\t\tfn(...args);\n\t\t}\n\t};\n}\n/*@__NO_SIDE_EFFECTS__*/ export function createNotImplementedError(name) {\n\treturn new Error(`[unenv] ${name} is not implemented yet!`);\n}\n/*@__NO_SIDE_EFFECTS__*/ export function notImplemented(name) {\n\tconst fn = () => {\n\t\tthrow createNotImplementedError(name);\n\t};\n\treturn Object.assign(fn, { __unenv__: true });\n}\n/*@__NO_SIDE_EFFECTS__*/ export function notImplementedAsync(name) {\n\tconst fn = notImplemented(name);\n\tfn.__promisify__ = () => notImplemented(name + \".__promisify__\");\n\tfn.native = fn;\n\treturn fn;\n}\n/*@__NO_SIDE_EFFECTS__*/ export function notImplementedClass(name) {\n\treturn class {\n\t\t__unenv__ = true;\n\t\tconstructor() {\n\t\t\tthrow new Error(`[unenv] ${name} is not implemented yet!`);\n\t\t}\n\t};\n}\n", "import { createNotImplementedError } from \"../../../_internal/utils.mjs\";\nconst _timeOrigin = globalThis.performance?.timeOrigin ?? Date.now();\nconst _performanceNow = globalThis.performance?.now ? globalThis.performance.now.bind(globalThis.performance) : () => Date.now() - _timeOrigin;\nconst nodeTiming = {\n\tname: \"node\",\n\tentryType: \"node\",\n\tstartTime: 0,\n\tduration: 0,\n\tnodeStart: 0,\n\tv8Start: 0,\n\tbootstrapComplete: 0,\n\tenvironment: 0,\n\tloopStart: 0,\n\tloopExit: 0,\n\tidleTime: 0,\n\tuvMetricsInfo: {\n\t\tloopCount: 0,\n\t\tevents: 0,\n\t\teventsWaiting: 0\n\t},\n\tdetail: undefined,\n\ttoJSON() {\n\t\treturn this;\n\t}\n};\nexport class PerformanceEntry {\n\t__unenv__ = true;\n\tdetail;\n\tentryType = \"event\";\n\tname;\n\tstartTime;\n\tconstructor(name, options) {\n\t\tthis.name = name;\n\t\tthis.startTime = options?.startTime || _performanceNow();\n\t\tthis.detail = options?.detail;\n\t}\n\tget duration() {\n\t\treturn _performanceNow() - this.startTime;\n\t}\n\ttoJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tentryType: this.entryType,\n\t\t\tstartTime: this.startTime,\n\t\t\tduration: this.duration,\n\t\t\tdetail: this.detail\n\t\t};\n\t}\n}\nexport const PerformanceMark = class PerformanceMark extends PerformanceEntry {\n\tentryType = \"mark\";\n\tconstructor() {\n\t\tsuper(...arguments);\n\t}\n\tget duration() {\n\t\treturn 0;\n\t}\n};\nexport class PerformanceMeasure extends PerformanceEntry {\n\tentryType = \"measure\";\n}\nexport class PerformanceResourceTiming extends PerformanceEntry {\n\tentryType = \"resource\";\n\tserverTiming = [];\n\tconnectEnd = 0;\n\tconnectStart = 0;\n\tdecodedBodySize = 0;\n\tdomainLookupEnd = 0;\n\tdomainLookupStart = 0;\n\tencodedBodySize = 0;\n\tfetchStart = 0;\n\tinitiatorType = \"\";\n\tname = \"\";\n\tnextHopProtocol = \"\";\n\tredirectEnd = 0;\n\tredirectStart = 0;\n\trequestStart = 0;\n\tresponseEnd = 0;\n\tresponseStart = 0;\n\tsecureConnectionStart = 0;\n\tstartTime = 0;\n\ttransferSize = 0;\n\tworkerStart = 0;\n\tresponseStatus = 0;\n}\nexport class PerformanceObserverEntryList {\n\t__unenv__ = true;\n\tgetEntries() {\n\t\treturn [];\n\t}\n\tgetEntriesByName(_name, _type) {\n\t\treturn [];\n\t}\n\tgetEntriesByType(type) {\n\t\treturn [];\n\t}\n}\nexport class Performance {\n\t__unenv__ = true;\n\ttimeOrigin = _timeOrigin;\n\teventCounts = new Map();\n\t_entries = [];\n\t_resourceTimingBufferSize = 0;\n\tnavigation = undefined;\n\ttiming = undefined;\n\ttimerify(_fn, _options) {\n\t\tthrow createNotImplementedError(\"Performance.timerify\");\n\t}\n\tget nodeTiming() {\n\t\treturn nodeTiming;\n\t}\n\teventLoopUtilization() {\n\t\treturn {};\n\t}\n\tmarkResourceTiming() {\n\t\treturn new PerformanceResourceTiming(\"\");\n\t}\n\tonresourcetimingbufferfull = null;\n\tnow() {\n\t\tif (this.timeOrigin === _timeOrigin) {\n\t\t\treturn _performanceNow();\n\t\t}\n\t\treturn Date.now() - this.timeOrigin;\n\t}\n\tclearMarks(markName) {\n\t\tthis._entries = markName ? this._entries.filter((e) => e.name !== markName) : this._entries.filter((e) => e.entryType !== \"mark\");\n\t}\n\tclearMeasures(measureName) {\n\t\tthis._entries = measureName ? this._entries.filter((e) => e.name !== measureName) : this._entries.filter((e) => e.entryType !== \"measure\");\n\t}\n\tclearResourceTimings() {\n\t\tthLine truncated
|
||||
"mappings": "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 truncated
|
||||
"names": ["stripCfConnectingIPHeader", "input", "init", "request", "__name", "target", "thisArg", "argArray", "createNotImplementedError", "name", "__name", "notImplemented", "notImplementedClass", "name", "__name", "_timeOrigin", "_performanceNow", "nodeTiming", "PerformanceEntry", "name", "options", "__name", "PerformanceMark", "PerformanceMeasure", "PerformanceResourceTiming", "PerformanceObserverEntryList", "_name", "_type", "type", "Performance", "_fn", "_options", "createNotImplementedError", "markName", "e", "measureName", "entry", "startOrMeasureOptions", "endMark", "start", "end", "maxSize", "listener", "event", "PerformanceObserver", "callback", "fn", "thisArg", "args", "__publicField", "performance", "performance", "Performance", "PerformanceEntry", "PerformanceMark", "PerformanceMeasure", "PerformanceObserver", "PerformanceObserverEntryList", "PerformanceResourceTiming", "Writable", "noop_default", "_console", "_ignoreErrors", "_stderr", "Writable", "_stdout", "log", "noop_default", "info", "trace", "debug", "table", "error", "warn", "createTask", "notImplemented", "clear", "_console", "noop_default", "count", "countReset", "dir", "dirxml", "group", "groupEnd", "groupCollapsed", "profile", "profileEnd", "time", "timeEnd", "timeLog", "timeStamp", "Console", "notImplementedClass", "_times", "_stdoutErrorHandler", "noop_default", "_stderrErrorHandler", "workerdConsole", "assert", "clear", "context", "count", "countReset", "createTask", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "profile", "profileEnd", "table", "time", "timeEnd", "timeLog", "timeStamp", "trace", "warn", "Console", "_ignoreErrors", "_stderr", "_stderrErrorHandler", "_stdout", "_stdoutErrorHandler", "_times", "console_default", "console_default", "hrtime", "__name", "startTime", "now", "seconds", "nanos", "diffSeconds", "diffNanos", "EventEmitter", "Socket", "ReadStream", "Socket", "fd", "mode", "__name", "Socket", "WriteStream", "Socket", "fd", "dir", "callback", "x", "y", "dx", "dy", "env", "count", "__name", "Process", "EventEmitter", "impl", "prop", "value", "warning", "type", "code", "args", "eventName", "#stdin", "#stdout", "#stderr", "ReadStream", "WriteStream", "#cwd", "cwd", "createNotImplementedError", "notImplemented", "__name", "globalProcess", "getBuiltinModule", "exit", "platform", "nextTick", "unenvProcess", "Process", "hrtime", "abort", "addListener", "allowedNodeEnvironmentFlags", "hasUncaughtExceptionCaptureCallback", "setUncaughtExceptionCaptureCallback", "loadEnvFile", "sourceMapsEnabled", "arch", "argv", "argv0", "chdir", "config", "connected", "constrainedMemory", "availableMemory", "cpuUsage", "cwd", "debugPort", "dlopen", "disconnect", "emit", "emitWarning", "env", "eventNames", "execArgv", "execPath", "finalization", "features", "getActiveResourcesInfo", "getMaxListeners", "kill", "listeners", "listenerCount", "memoryUsage", "on", "off", "once", "pid", "ppid", "prependListener", "prependOnceListener", "rawListeners", "release", "removeAllListeners", "removeListener", "report", "resourceUsage", "setMaxListeners", "setSourceMapsEnabled", "stderr", "stdin", "stdout", "title", "throwDeprecation", "traceDeprecation", "umask", "uptime", "version", "versions", "domain", "initgroups", "moduleLoadList", "reallyExit", "openStdin", "assert", "binding", "send", "exitCode", "channel", "getegid", "geteuid", "getgid", "getgroups", "getuid", "setegid", "seteuid", "setgid", "setgroups", "setuid", "permission", "mainModule", "_events", "_eventsCount", "_exiting", "_maxListeners", "_debugEnd", "_debugProcess", "_fatalException", "_getActiveHandles", "_getActiveRequests", "_kill", "_preload_modules", "_rawDebug", "_startProfilerIdleNotifier", "_stopProfilerIdleNotifier", "_tickCallback", "_disconnect", "_handleQueue", "_pendingMessage", "_channel", "_send", "_linkedBinding", "_process", "process_default", "process_default", "compose", "__name", "middleware", "onError", "onNotFound", "context", "next", "index", "dispatch", "i", "res", "isError", "handler", "err", "GET_MATCH_RESULT", "parseBody", "__name", "request", "options", "all", "dot", "contentType", "HonoRequest", "parseFormData", "formData", "convertFormDataToBodyData", "form", "value", "key", "handleParsingAllValues", "handleParsingNestedValues", "nestedForm", "keys", "key2", "index", "splitPath", "__name", "path", "paths", "splitRoutingPath", "routePath", "groups", "extractGroupsFromPath", "replaceGroupMarks", "match", "index", "mark", "i", "j", "patternCache", "getPattern", "label", "next", "cacheKey", "tryDecode", "str", "decoder", "tryDecodeURI", "getPath", "request", "url", "start", "charCode", "queryIndex", "getPathNoStrict", "__name", "request", "result", "getPath", "mergePath", "base", "sub", "rest", "checkOptionalParameter", "path", "segments", "results", "basePath", "segment", "optionalSegment", "v", "_decodeURI", "value", "tryDecode", "decodeURIComponent_", "_getQueryParam", "url", "key", "multiple", "encoded", "Line truncated
|
||||
}
|
||||
@@ -116,5 +116,10 @@
|
||||
"Create API Key": "API-Schlüssel erstellen",
|
||||
"Please complete the verification first": "Bitte schließen Sie zuerst die Verifizierung ab",
|
||||
"API Key created successfully": "API-Schlüssel erfolgreich erstellt",
|
||||
"Failed to create API Key": "Fehler beim Erstellen des API-Schlüssels"
|
||||
"Failed to create API Key": "Fehler beim Erstellen des API-Schlüssels",
|
||||
"Site Statistics": "Seitenstatistiken",
|
||||
"Addresses Created": "Erstellte Adressen",
|
||||
"Emails Received": "Empfangene E-Mails",
|
||||
"API Keys Created": "Erstellte API-Schlüssel",
|
||||
"API Calls": "API-Aufrufe"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "Créer une clé API",
|
||||
"Please complete the verification first": "Veuillez d'abord compléter la vérification",
|
||||
"API Key created successfully": "Clé API créée avec succès",
|
||||
"Failed to create API Key": "Échec de la création de la clé API"
|
||||
"Failed to create API Key": "Échec de la création de la clé API",
|
||||
"Site Statistics": "Statistiques du site",
|
||||
"Addresses Created": "Adresses créées",
|
||||
"Emails Received": "Emails reçus",
|
||||
"API Keys Created": "Clés API créées",
|
||||
"API Calls": "Appels API"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "API कुंजी बनाएं",
|
||||
"Please complete the verification first": "कृपया पहले सत्यापन पूरा करें",
|
||||
"API Key created successfully": "API कुंजी सफलतापूर्वक बनाई गई",
|
||||
"Failed to create API Key": "API कुंजी बनाने में विफल"
|
||||
"Failed to create API Key": "API कुंजी बनाने में विफल",
|
||||
"Site Statistics": "साइट आंकड़े",
|
||||
"Addresses Created": "बनाए गए पते",
|
||||
"Emails Received": "प्राप्त ईमेल",
|
||||
"API Keys Created": "बनाई गई API कुंजियाँ",
|
||||
"API Calls": "API कॉल"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "Crea chiave API",
|
||||
"Please complete the verification first": "Per favore completa prima la verifica",
|
||||
"API Key created successfully": "Chiave API creata con successo",
|
||||
"Failed to create API Key": "Impossibile creare la chiave API"
|
||||
"Failed to create API Key": "Impossibile creare la chiave API",
|
||||
"Site Statistics": "Statistiche del sito",
|
||||
"Addresses Created": "Indirizzi creati",
|
||||
"Emails Received": "Email ricevute",
|
||||
"API Keys Created": "Chiavi API create",
|
||||
"API Calls": "Chiamate API"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "API 키 생성",
|
||||
"Please complete the verification first": "먼저 확인을 완료하세요",
|
||||
"API Key created successfully": "API 키가 성공적으로 생성되었습니다",
|
||||
"Failed to create API Key": "API 키 생성 실패"
|
||||
"Failed to create API Key": "API 키 생성 실패",
|
||||
"Site Statistics": "사이트 통계",
|
||||
"Addresses Created": "생성된 주소",
|
||||
"Emails Received": "받은 이메일",
|
||||
"API Keys Created": "생성된 API 키",
|
||||
"API Calls": "API 호출"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "Criar chave de API",
|
||||
"Please complete the verification first": "Por favor, complete a verificação primeiro",
|
||||
"API Key created successfully": "Chave de API criada com sucesso",
|
||||
"Failed to create API Key": "Falha ao criar chave de API"
|
||||
"Failed to create API Key": "Falha ao criar chave de API",
|
||||
"Site Statistics": "Estatísticas do site",
|
||||
"Addresses Created": "Endereços criados",
|
||||
"Emails Received": "Emails recebidos",
|
||||
"API Keys Created": "Chaves de API criadas",
|
||||
"API Calls": "Chamadas de API"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "Создать ключ API",
|
||||
"Please complete the verification first": "Пожалуйста, сначала пройдите верификацию",
|
||||
"API Key created successfully": "Ключ API успешно создан",
|
||||
"Failed to create API Key": "Не удалось создать ключ API"
|
||||
"Failed to create API Key": "Не удалось создать ключ API",
|
||||
"Site Statistics": "Статистика сайта",
|
||||
"Addresses Created": "Созданных адресов",
|
||||
"Emails Received": "Полученных писем",
|
||||
"API Keys Created": "Созданных ключей API",
|
||||
"API Calls": "Вызовов API"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "API Anahtari Olustur",
|
||||
"Please complete the verification first": "Lutfen once dogrulamayi tamamlayin",
|
||||
"API Key created successfully": "API Anahtari basariyla olusturuldu",
|
||||
"Failed to create API Key": "API Anahtari olusturulamadi"
|
||||
"Failed to create API Key": "API Anahtari olusturulamadi",
|
||||
"Site Statistics": "Site Istatistikleri",
|
||||
"Addresses Created": "Olusturulan Adresler",
|
||||
"Emails Received": "Alinan E-postalar",
|
||||
"API Keys Created": "Olusturulan API Anahtarlari",
|
||||
"API Calls": "API Cagrilari"
|
||||
}
|
||||
@@ -115,5 +115,10 @@
|
||||
"Create API Key": "建立 API 金鑰",
|
||||
"Please complete the verification first": "請先完成驗證",
|
||||
"API Key created successfully": "API 金鑰建立成功",
|
||||
"Failed to create API Key": "建立 API 金鑰失敗"
|
||||
"Failed to create API Key": "建立 API 金鑰失敗",
|
||||
"Site Statistics": "站點統計",
|
||||
"Addresses Created": "累計建立信箱",
|
||||
"Emails Received": "累計接收郵件",
|
||||
"API Keys Created": "累計建立 API 金鑰",
|
||||
"API Calls": "累計 API 呼叫"
|
||||
}
|
||||
@@ -90,6 +90,9 @@ const api = app.basePath('/api');
|
||||
api.post('/verify', turnstile, async (c) => {
|
||||
// turnstile 中间件已经完成了验证工作。
|
||||
// 如果代码能执行到这里,说明验证成功。
|
||||
// 增加邮箱创建计数(前端验证成功后会创建邮箱地址)
|
||||
const db = getD1DB(c.env.DB);
|
||||
await incrementAddressesCreated(db);
|
||||
return c.json({ success: true });
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user