@@ -5,6 +5,7 @@ import nodeCrypto from 'node:crypto';
55import { parentPort , threadId } from 'node:worker_threads' ;
66import { defineEventHandler , handleCacheHeaders , splitCookiesString , createEvent , fetchWithEvent , isEvent , eventHandler , setHeaders , sendRedirect , proxyRequest , getRequestHeader , setResponseHeaders , setResponseStatus , send , getRequestHeaders , setResponseHeader , appendResponseHeader , getRequestURL , getResponseHeader , removeResponseHeader , createError , getQuery as getQuery$1 , readBody , createApp , createRouter as createRouter$1 , toNodeListener , lazyEventHandler , getResponseStatus , getRouterParam , getResponseStatusText } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/h3/dist/index.mjs' ;
77import { escapeHtml } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/@vue/shared/dist/shared.cjs.js' ;
8+ import { promises , readFileSync , writeFileSync } from 'node:fs' ;
89import { createRenderer , getRequestDependencies , getPreloadLinks , getPrefetchLinks } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/vue-bundle-renderer/dist/runtime.mjs' ;
910import { parseURL , withoutBase , joinURL , getQuery , withQuery , withTrailingSlash , decodePath , withLeadingSlash , withoutTrailingSlash , joinRelativeURL } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/ufo/dist/index.mjs' ;
1011import { renderToString } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/vue/server-renderer/index.mjs' ;
@@ -32,7 +33,6 @@ import { AsyncLocalStorage } from 'node:async_hooks';
3233import { getContext } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/unctx/dist/index.mjs' ;
3334import { captureRawStackTrace , parseRawStackTrace } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/errx/dist/index.js' ;
3435import _wH6JrtIxmaSoA8lCPWFnE9z4lQeXW6H5z3l5aymEQw from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/@nuxt/vite-builder/dist/fix-stacktrace.mjs' ;
35- import { promises } from 'node:fs' ;
3636import { fileURLToPath } from 'node:url' ;
3737import { dirname as dirname$1 , resolve as resolve$1 } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/pathe/dist/index.mjs' ;
3838import { walkResolver } from 'file://D:/Code/Project/Github/ContentForest/content-forest-front/node_modules/unhead/dist/utils.mjs' ;
@@ -2591,10 +2591,12 @@ async function getIslandContext(event) {
25912591 } ;
25922592}
25932593
2594+ const _lazy_yH2PCJ = ( ) => Promise . resolve ( ) . then ( function ( ) { return waitlist_post$1 ; } ) ;
25942595const _lazy_YXzf4B = ( ) => Promise . resolve ( ) . then ( function ( ) { return renderer ; } ) ;
25952596
25962597const handlers = [
25972598 { route : '' , handler : _v_EJsZ , lazy : false , middleware : true , method : undefined } ,
2599+ { route : '/api/waitlist' , handler : _lazy_yH2PCJ , lazy : true , middleware : false , method : "post" } ,
25982600 { route : '/__nuxt_error' , handler : _lazy_YXzf4B , lazy : true , middleware : false , method : undefined } ,
25992601 { route : '/__nuxt_island/**' , handler : handler$1 , lazy : false , middleware : false , method : undefined } ,
26002602 { route : '/**' , handler : _lazy_YXzf4B , lazy : true , middleware : false , method : undefined }
@@ -2937,6 +2939,36 @@ const styles$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
29372939 default : styles
29382940} , Symbol . toStringTag , { value : 'Module' } ) ) ;
29392941
2942+ const DATA_PATH = resolve ( "./server/data/waitlist.json" ) ;
2943+ function isValidEmail ( email ) {
2944+ return / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / . test ( email ) ;
2945+ }
2946+ const waitlist_post = defineEventHandler ( async ( event ) => {
2947+ var _a ;
2948+ const body = await readBody ( event ) ;
2949+ const email = ( ( _a = body == null ? void 0 : body . email ) != null ? _a : "" ) . trim ( ) . toLowerCase ( ) ;
2950+ if ( ! email || ! isValidEmail ( email ) ) {
2951+ return { success : false , message : "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740" } ;
2952+ }
2953+ let list = [ ] ;
2954+ try {
2955+ list = JSON . parse ( readFileSync ( DATA_PATH , "utf-8" ) ) ;
2956+ } catch {
2957+ list = [ ] ;
2958+ }
2959+ if ( list . some ( ( item ) => item . email === email ) ) {
2960+ return { success : true , message : "\u4F60\u5DF2\u7ECF\u5728\u5019\u8865\u540D\u5355\u4E2D\u4E86" } ;
2961+ }
2962+ list . push ( { email, joinedAt : ( /* @__PURE__ */ new Date ( ) ) . toISOString ( ) } ) ;
2963+ writeFileSync ( DATA_PATH , JSON . stringify ( list , null , 2 ) , "utf-8" ) ;
2964+ return { success : true , message : "\u5DF2\u6210\u529F\u52A0\u5165\u5019\u8865\u540D\u5355" } ;
2965+ } ) ;
2966+
2967+ const waitlist_post$1 = /*#__PURE__*/ Object . freeze ( /*#__PURE__*/ Object . defineProperty ( {
2968+ __proto__ : null ,
2969+ default : waitlist_post
2970+ } , Symbol . toStringTag , { value : 'Module' } ) ) ;
2971+
29402972function renderPayloadResponse ( ssrContext ) {
29412973 return {
29422974 body : encodeForwardSlashes ( stringify ( splitPayload ( ssrContext ) . payload , ssrContext [ "~payloadReducers" ] ) ) ,
0 commit comments