create-wenuts-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +168 -0
  3. package/package.json +35 -0
  4. package/template/default/.env.development +19 -0
  5. package/template/default/README.md +36 -0
  6. package/template/default/envConfig/.env.development +26 -0
  7. package/template/default/envConfig/.env.production +23 -0
  8. package/template/default/eslint.config.mjs +15 -0
  9. package/template/default/next.config.ts +10 -0
  10. package/template/default/package.json +40 -0
  11. package/template/default/postcss.config.mjs +17 -0
  12. package/template/default/public/file.svg +1 -0
  13. package/template/default/public/globe.svg +1 -0
  14. package/template/default/public/next.svg +1 -0
  15. package/template/default/public/vercel.svg +1 -0
  16. package/template/default/public/window.svg +1 -0
  17. package/template/default/src/api/user.ts +149 -0
  18. package/template/default/src/app/[local]/(default-layout)/layout.tsx +5 -0
  19. package/template/default/src/app/[local]/(default-layout)/page.tsx +5 -0
  20. package/template/default/src/app/[local]/(no-layout)/home/page.tsx +16 -0
  21. package/template/default/src/app/[local]/(no-layout)/login/components/LoginHandle/index.tsx +55 -0
  22. package/template/default/src/app/[local]/(no-layout)/login/page.tsx +41 -0
  23. package/template/default/src/app/[local]/(no-layout)/login/style.module.css +4 -0
  24. package/template/default/src/app/[local]/layout.tsx +54 -0
  25. package/template/default/src/app/api/auth/[...nextauth]/route.ts +54 -0
  26. package/template/default/src/app/favicon.ico +0 -0
  27. package/template/default/src/app/globals.css +27 -0
  28. package/template/default/src/app/layout.tsx +26 -0
  29. package/template/default/src/appConfig.ts +37 -0
  30. package/template/default/src/components/System/ClientLayout/index.tsx +69 -0
  31. package/template/default/src/components/System/LoginModal/index.tsx +61 -0
  32. package/template/default/src/components/System/ThemeProvider/index.tsx +55 -0
  33. package/template/default/src/config/CookieMap.ts +3 -0
  34. package/template/default/src/config/LocalStorageMap.ts +11 -0
  35. package/template/default/src/i18n/request.ts +17 -0
  36. package/template/default/src/i18n/routing.ts +15 -0
  37. package/template/default/src/lang/en.json +6 -0
  38. package/template/default/src/libs/casdoor_provider.ts +39 -0
  39. package/template/default/src/libs/dataAnalytics.ts +176 -0
  40. package/template/default/src/libs/fetch.ts +176 -0
  41. package/template/default/src/libs/fetchCookie/clientCookies.ts +5 -0
  42. package/template/default/src/libs/fetchCookie/getCookie.ts +15 -0
  43. package/template/default/src/libs/fetchCookie/serverCookies.ts +10 -0
  44. package/template/default/src/libs/localCache.ts +28 -0
  45. package/template/default/src/libs/nextauth.ts +49 -0
  46. package/template/default/src/libs/seo.ts +89 -0
  47. package/template/default/src/middleware.ts +11 -0
  48. package/template/default/src/store/useUserStore.ts +42 -0
  49. package/template/default/src/types/payment.ts +163 -0
  50. package/template/default/src/types/user.ts +137 -0
  51. package/template/default/tsconfig.json +27 -0
@@ -0,0 +1,163 @@
1
+ interface IPackageDesc {
2
+ text: string;
3
+ state: number; // 1 || 0
4
+ tip: string;
5
+ }
6
+
7
+ interface IPackageFeature {
8
+ name: string;
9
+ value: string; // 'yes' || 'no' || 'text'
10
+ }
11
+
12
+ interface IPackageBenefit {
13
+ name: string;
14
+ features: IPackageFeature[];
15
+ }
16
+
17
+ export interface IPackage {
18
+ id: string;
19
+ name: string;
20
+ code: string;
21
+ price: number;
22
+ credit: number;
23
+ descs: IPackageDesc[] | null;
24
+ discount: number;
25
+ oldPrice: number;
26
+ benefits: IPackageBenefit[] | null;
27
+ }
28
+
29
+ export interface IPackageListResponse {
30
+ item: IPackage[];
31
+ }
32
+
33
+ export interface IPayOrderEntity {
34
+ payType: string;
35
+ pkgCode: string;
36
+ money: number;
37
+ reason: string;
38
+ status: number;
39
+ }
40
+
41
+ /**
42
+ * 付费原因集合
43
+ * 点数不足,key - 以 Notoken 结尾;value - 以 _noken 结尾;
44
+ */
45
+ export enum PaymentReason {
46
+ None = "",
47
+ OldUser = "old_user", // 老用户弹框
48
+ BuyMoreToken = "buy_more_token", // 购买更多点数(打开加油包弹框)
49
+
50
+ // 图片,key - 以 I 开头;value - 以 i_ 开头;
51
+ IFaceRestore = "i_face_restore", // 图片脸部修复
52
+ IFaceRestoreNotoken = "i_face_restore_notoken", // 点数不足 - 图片脸部修复
53
+ IClarityUpcaler = "i_clarity_upcaler", // 图片智能超分
54
+ IClarityUpcalerNotoken = "i_clarity_upcaler_notoken", // 点数不足 - 图片智能超分
55
+ IFastUpcalerNotoken = "i_fast_upcaler_notoken", // 点数不足 - 图片快速超分
56
+ IGenerativeUpscale = "i_generative_upscale", // 生成式超分
57
+ IGenerativeUpscaleNotoken = "i_generative_upscale_notoken", // 点数不足 - 生成式超分
58
+ IGeneratorModel = "i_generator_model", // 图片生成付费模型(包含 Basic 和 LoRA 模型)
59
+ IGeneratorPerformance = "i_generator_performance", // 图片生成质量
60
+ IGeneratorCount = "i_generator_count", // 图片生成数量
61
+ IGeneratorPrivate = "i_generator_private", // 图片生成隐私模式
62
+ IGeneratorLossless = "i_generator_lossless", // 图片生成无损生成
63
+ IGeneratorNotoken = "", // 点数不足 - 图片生成
64
+ IDownloadAll = "i_download_all", // 图片批量下载
65
+ IDownloadAllOriginal = "i_download_all_original", // 图片批量下载原图
66
+ IMakePrivate = "i_make_private", // 生成图片结果设置成私密
67
+ IFastEditNotoken = "i_fast_edit_notoken", // 点数不足 - 图片快速编辑
68
+ IMJVary = "i_mj_vary", // Midjourney 模型结果独有变体(20250611 Midjourney 模型现在全是付费模型)
69
+ IMJVaryNotoken = "i_mj_vary_notoken", // 点数不足 - Midjourney 模型结果独有变体(20250611 Midjourney 模型现在全是付费模型)
70
+ IMJUpsample = "i_mj_upsample", // Midjourney 模型结果独有放大(20250611 Midjourney 模型现在全是付费模型)
71
+ IMJUpsampleNotoken = "i_mj_upsample_notoken", // 点数不足 - Midjourney 模型结果独有放大(20250611 Midjourney 模型现在全是付费模型)
72
+ IFluxOutpaint = "i_flux_outpaint", // Flux 模型结果独有扩图
73
+ IFluxOutpaintNotoken = "i_flux_outpaint_notoken", // 点数不足 - Flux 模型结果独有扩图
74
+ IFluxInpaint = "i_flux_inpaint", // Flux 模型结果独有修复
75
+ IFluxInpaintNotoken = "i_flux_inpaint_notoken", // 点数不足 - Flux 模型结果独有修复
76
+ IEffectGeneratorModel = "i_effect_generator_model", // 图片付费特效
77
+ IEffectGeneratorPrivate = "i_effect_generator_private", // 图片特效生成隐私模式
78
+ IEffectGeneratorNotoken = "i_effect_generator_notoken", // 点数不足 - 图片特效生成
79
+
80
+ // 视频,key - 以 V 开头;value - 以 v_ 开头;
81
+ VGeneratorModel = "v_generator_model", // 视频生成付费模型(20250611 只有付费模型)
82
+ VGeneratorDuration = "v_generator_duration", // 视频生成时长(20250611 只有付费模型,时长还没有定义付费模型)
83
+ VGeneratorPrivate = "v_generator_private", // 视频生成隐私模式
84
+ VGeneratorNotoken = "v_generator_notoken", // 点数不足 - 视频生成
85
+ VUpcaler = "v_upcaler", // 视频超分
86
+ VUpcalerNotoken = "v_upcaler_notoken", // 点数不足 - 视频超分
87
+ VEffectGeneratorModel = "v_effect_generator_model", // 视频付费特效
88
+ VEffectGeneratorPrivate = "v_effect_generator_private", // 视频特效生成隐私模式
89
+ VEffectGeneratorNotoken = "v_effect_generator_notoken", // 点数不足 - 视频特效生成
90
+ VEffectMakePrivate = "v_effect_make_private", // 视频特效结果设置成私密
91
+
92
+ // 音乐,key - 以 M 开头;value - 以 m_ 开头;
93
+ MGeneratorModel = "m_generator_model", // 音乐生成付费模型
94
+ MExtendedLyricsNotoken = "m_extended_lyrics_notoken", // 点数不足 - 扩展歌词
95
+ MGeneratorNotoken = "m_generator_notoken", // 点数不足 - 音乐生成
96
+ MStems = "m_stems", // 乐器分离
97
+ MStemsNotoken = "m_stems_notoken", // 点数不足 - 乐器分离
98
+ MDownloadWAV = "m_download_wav", // 音乐下载 WAV 格式
99
+ MDownloadWAVNotoken = "m_download_wav_notoken", // 点数不足 - 音乐下载 WAV 格式
100
+ MChangeCover = "m_change_cover", // 改变音乐封面
101
+ MGeneratorVideoNotoken = "m_generator_video_notoken", // 点数不足 - 音乐生成视频
102
+ MGeneratorVideo = "m_generator_video", // 音乐生成视频
103
+ MProofOfCreation = "m_proof_of_creation", // 音乐证明创作
104
+
105
+ // Headshot
106
+ HeadshotStyle = "headshot_style", // 头像生成的付费风格
107
+ HeadshotGeneratorNotoken = "headshot_generator_notoken", // 点数不足 - 头像生成
108
+
109
+ // ImageUpscaler
110
+ ImageUpscalerClarity = "image_upscaler_clarity", // 图片智能超分(超分页面
111
+ ImageUpscalerNotoken = "image_upscaler_notoken", // 点数不足 - 图片超分(超分页面
112
+ ImageUpscalerFaceRestore = "image_upscaler_face_restore", // 图片快速超分人脸修复
113
+
114
+ // Phantom
115
+ PhantomGeneratorImage = "phantom_generator_image", // Phantom 的其他付费类型
116
+ PhantomGeneratorPrivate = "phantom_generator_private", // Phantom 生成隐私模式
117
+ PhantomGeneratorNotoken = "phantom_generator_notoken", // 点数不足 - Phantom 生成
118
+ PhantomMakePrivate = "phantom_make_private", // Phantom 结果设置成私密
119
+ PhantomDownloadAll = "phantom_download_all", // Phantom 下载单个任务中所有图片
120
+ PhantomDownloadAllOrigin = "phantom_download_all_origin", // Phantom 下载单个任务中所有原图
121
+ PhantomOpenNsfwMask = "phantom_open_nsfw_mask", // Phantom 打开 NSFW 蒙层
122
+ PhantomClarityUpscale = "phantom_clarity_upscale", // Phantom 智能超分
123
+ PhantomClarityUpscaleNotoken = "phantom_clarity_upscale_notoken", // 点数不足 - Phantom 智能超分
124
+ PhantomUpscaleNotoken = "phantom_upscale_notoken", // 点数不足 - Phantom 超分
125
+ PhantomGeneratorModel = "phantom_generator_model", // Phantom 使用付费模型生成
126
+ PhantomSelectModel = "phantom_select_model", // Phantom 选择付费模型
127
+
128
+ // Background Remover
129
+ BgRemoverHDNotoken = "bg_remover_hd_notoken", // 点数不足 - 去背景结果高清下载
130
+
131
+ // Image Face Swap
132
+ IFaceSwapNotoken = "i_face_swap_notoken", // 点数不足 - 图片换脸
133
+
134
+ // Video Face Swap
135
+ VFaceSwapEnhance = "v_face_swap_enhance", // 视频换脸视频增强
136
+ VFaceSwapNotoken = "v_face_swap_notoken", // 点数不足 - 视频换脸
137
+ VFaceSwapDuration = "v_face_swap_duration", // 时长 - 视频换脸
138
+ VFaceSwapRestore = "v_face_swap_restore", // 增强 - 视频换脸
139
+
140
+ // AI Dnace
141
+ DanceGeneratorNotoken = "dance_generator_notoken", // 点数不足 - AI Dance 生成
142
+
143
+ // AI Editor
144
+ EditorNotoken = "editor_notoken", // 点数不足 - 图片编辑
145
+
146
+ // Talking Avatar
147
+ AvatarNotoken = "avatar_notoken", // 点数不足 - Avatar 生成
148
+
149
+ // AI Chat
150
+ ChatCharacter = "chat_character", // AI 聊天付费角色
151
+ ChatNotoken = "chat_notoken", // AI 聊天点数不足
152
+
153
+ // AI Assistant
154
+ AssistantModel = "assistant_model", // 智能助理付费模型
155
+ AssistantNotoken = "assistant_notoken", // 点数不足 - 智能助理聊天
156
+
157
+ // Profile
158
+ ProfileNSFW = "profile_nsfw", // 设置 NSFW 内容显示
159
+ ProfilePrivateGenerate = "profile_private_generate", // 设置私密生成设置
160
+
161
+ // NSFW Click
162
+ NsfwClick = "nsfw_click", // NSFW 点击
163
+ }
@@ -0,0 +1,137 @@
1
+ /** 用户登录 **/
2
+ export type TSrcType =
3
+ | "casdoor"
4
+ | "discord"
5
+ | "facebook"
6
+ | "google"
7
+ | "googleOneTap"
8
+ | "twitter";
9
+
10
+ export enum UserCenterTabEnum {
11
+ Profile = "Profile",
12
+ Subscription = "Subscription",
13
+ Setting = "Setting",
14
+ Affiliate = "Affiliate",
15
+ Cloud = "Cloud",
16
+ ApiKey = "Api Key",
17
+ Logout = "Logout",
18
+ }
19
+
20
+ export enum ELoginTypeMap {
21
+ google = "Google",
22
+ discord = "Discord",
23
+ facebook = "Facebook",
24
+ twitter = "Twitter",
25
+ }
26
+
27
+ export interface IUserLoginArgs {
28
+ srcType: TSrcType;
29
+ code?: string;
30
+ token?: string;
31
+ credential?: string;
32
+ }
33
+
34
+ export interface IUserLoginState {
35
+ name: string;
36
+ avatar: string;
37
+ token: string;
38
+ email: string;
39
+ }
40
+
41
+ /** 用户信息 **/
42
+ export interface IUserProfile {
43
+ autoSendCommunity?: boolean;
44
+ avatar: string;
45
+ credit: number;
46
+ discord: boolean;
47
+ displayNSFW: boolean;
48
+ email: string;
49
+ id: string;
50
+ isCheckin?: boolean; // 当天是否签到
51
+ name: string;
52
+ phone: string;
53
+ subCredit?: number;
54
+ [key: string]: any;
55
+ pkgCode: string;
56
+ createdAt: string;
57
+ total: number;
58
+ expiry?: string;
59
+ rebateTime?: string;
60
+ checkinDays?: number;
61
+ }
62
+
63
+ // 用户详情接口返回的数据类型
64
+ export interface IUserDetailResp {
65
+ id: string;
66
+ name: string;
67
+ avatar: string;
68
+ follow: boolean;
69
+ pkgCode: string;
70
+ total: number;
71
+ }
72
+
73
+ export interface IUpdateUserNameParams {
74
+ username: string;
75
+ }
76
+
77
+ export interface IManageSubscriptionResult {
78
+ url: string;
79
+ }
80
+
81
+ export interface FeedBackReqParams {
82
+ type: string;
83
+ desc: string;
84
+ email: string;
85
+ images?: string[];
86
+ }
87
+
88
+ export interface INoticeInfo {
89
+ id: string;
90
+ order: number;
91
+ page: string;
92
+ startTime: string;
93
+ endTime: string;
94
+ panels: {
95
+ title: string;
96
+ content: string;
97
+ cover: string;
98
+ link: string;
99
+ options: any;
100
+ }[];
101
+ }
102
+
103
+ // 更新弹窗接口返回信息
104
+ export interface INoticeResult {
105
+ domain: string;
106
+ notices: INoticeInfo[];
107
+ }
108
+
109
+ export interface IApiKey {
110
+ id: string;
111
+ key: string;
112
+ createdAt: string;
113
+ latestUse: string;
114
+ }
115
+
116
+ // 创建支付凭证接口返回信息
117
+ export interface CreateInvoiceResult {
118
+ domain: string;
119
+ url: string;
120
+ }
121
+
122
+ export interface IChargeParams {
123
+ type: string;
124
+ payType?: string;
125
+ packageCode?: string;
126
+ payId?: string;
127
+ receipt?: string;
128
+ productId?: string;
129
+ bizId?: string; // paypal 必填
130
+ }
131
+
132
+ export interface IChargeResult {
133
+ credit: number;
134
+ chargedCredit: number;
135
+ packageCode: string;
136
+ resetTime: number; // 距离下次签到间隔的秒数
137
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./src/*"]
23
+ }
24
+ },
25
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26
+ "exclude": ["node_modules"]
27
+ }