tetrons 2.3.98 → 2.3.100
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.
- package/dist/app/HomeClient.d.ts +1 -0
- package/dist/app/layout.d.ts +7 -0
- package/dist/app/page.d.ts +1 -0
- package/dist/app/view/page.d.ts +1 -0
- package/dist/chunk-EO6RXFIC.mjs +79 -0
- package/dist/components/Editor/AIModal.d.ts +8 -0
- package/dist/components/Editor/Editor.d.ts +3 -0
- package/dist/components/Editor/LinkPreviewPopup.d.ts +14 -0
- package/dist/components/Editor/TetronsEditor.d.ts +8 -0
- package/dist/components/Editor/config/versionConfig.d.ts +3 -0
- package/dist/components/Editor/toolbar/BasicToolbar.d.ts +12 -0
- package/dist/components/Editor/toolbar/CodeEditor.d.ts +13 -0
- package/dist/components/Editor/toolbar/Converter.d.ts +3 -0
- package/dist/components/Editor/toolbar/FaqSection.d.ts +2 -0
- package/dist/components/Editor/toolbar/FindReplaceModal.d.ts +9 -0
- package/dist/components/Editor/toolbar/HelpModal.d.ts +8 -0
- package/dist/components/Editor/toolbar/ImageToTextModal.d.ts +7 -0
- package/dist/components/Editor/toolbar/MathEquation.d.ts +10 -0
- package/dist/components/Editor/toolbar/SecondRow.d.ts +18 -0
- package/dist/components/Editor/toolbar/ShareEmailModal.d.ts +5 -0
- package/dist/components/Editor/toolbar/ShareLinkModal.d.ts +7 -0
- package/dist/components/Editor/toolbar/Tabs.d.ts +6 -0
- package/dist/components/Editor/toolbar/ThirdRow.d.ts +9 -0
- package/dist/components/Editor/toolbar/TopMenu.d.ts +24 -0
- package/dist/components/Editor/toolbar/Translator.d.ts +3 -0
- package/dist/components/Editor/toolbar/UserGuideSection.d.ts +2 -0
- package/dist/components/Editor/toolbar/VersionDiffModal.d.ts +6 -0
- package/dist/components/Editor/toolbar/VersionHistoryModal.d.ts +12 -0
- package/dist/components/Editor/toolbar/VersionInfoSection.d.ts +2 -0
- package/dist/components/Editor/toolbar/VersionRollbackModal.d.ts +6 -0
- package/dist/components/Editor/toolbar/VirtualKeyboard.d.ts +11 -0
- package/dist/components/Editor/toolbar/VoiceModal.d.ts +7 -0
- package/dist/components/Editor/toolbar/extensions/Audio.d.ts +2 -0
- package/dist/components/Editor/toolbar/extensions/BetterListItem.d.ts +1 -0
- package/dist/components/Editor/toolbar/extensions/Comment.d.ts +17 -0
- package/dist/components/Editor/toolbar/extensions/Embed.d.ts +7 -0
- package/dist/components/Editor/toolbar/extensions/FontFamily.d.ts +10 -0
- package/dist/components/Editor/toolbar/extensions/FontSize.d.ts +10 -0
- package/dist/components/Editor/toolbar/extensions/FontStyleCommands.d.ts +2 -0
- package/dist/components/Editor/toolbar/extensions/LineHeightExtension.d.ts +2 -0
- package/dist/components/Editor/toolbar/extensions/MathBlock.d.ts +12 -0
- package/dist/components/Editor/toolbar/extensions/MathBlockView.d.ts +3 -0
- package/dist/components/Editor/toolbar/extensions/MathNode.d.ts +10 -0
- package/dist/components/Editor/toolbar/extensions/ResizableEmbed.d.ts +9 -0
- package/dist/components/Editor/toolbar/extensions/ResizableImage.d.ts +2 -0
- package/dist/components/Editor/toolbar/extensions/ResizableVideo.d.ts +2 -0
- package/dist/components/Editor/toolbar/extensions/WordCount.d.ts +2 -0
- package/dist/components/Editor/toolbar/groups/AlignGroup.d.ts +8 -0
- package/dist/components/Editor/toolbar/groups/ClipboardGroup.d.ts +8 -0
- package/dist/components/Editor/toolbar/groups/ColorGroup.d.ts +8 -0
- package/dist/components/Editor/toolbar/groups/FileGroup.d.ts +12 -0
- package/dist/components/Editor/toolbar/groups/InsertGroup.d.ts +6 -0
- package/dist/components/Editor/toolbar/groups/ListGroup.d.ts +8 -0
- package/dist/components/Editor/toolbar/groups/PlatinumGroup.d.ts +19 -0
- package/dist/components/Editor/toolbar/groups/PreviewModal.d.ts +8 -0
- package/dist/components/Editor/toolbar/groups/TextFormattingGroup.d.ts +8 -0
- package/dist/components/Editor/toolbar/groups/UtilityGroup.d.ts +10 -0
- package/dist/components/Editor/toolbar/useFileActions.d.ts +6 -0
- package/dist/components/Editor/toolbar/useUtilityActions.d.ts +8 -0
- package/dist/components/Editor/types/TetronsEditorProps.d.ts +100 -0
- package/dist/components/Editor/types/ValidationResponse.d.ts +10 -0
- package/dist/components/ui/Button.d.ts +12 -0
- package/dist/components/ui/ConfirmModal.d.ts +10 -0
- package/dist/components/ui/Dropdown.d.ts +14 -0
- package/dist/index.css +4888 -0
- package/dist/index.d.ts +6 -16
- package/dist/index.mjs +14802 -14936
- package/dist/lib/indianKeyboardLayouts.d.ts +1 -0
- package/dist/lib/languages.d.ts +1 -0
- package/dist/server/dictionary.d.ts +1 -0
- package/dist/tiptap/extensions/SpellCheck.d.ts +2 -0
- package/dist/types/VersionEntry.d.ts +6 -0
- package/dist/typescript-A2I22B6E.mjs +210768 -0
- package/package.json +88 -109
- package/dist/app/api/ai-action/route.cjs +0 -61
- package/dist/app/api/ai-action/route.d.mts +0 -9
- package/dist/app/api/ai-action/route.d.ts +0 -9
- package/dist/app/api/ai-action/route.mjs +0 -36
- package/dist/app/api/execute/route.cjs +0 -55
- package/dist/app/api/execute/route.d.mts +0 -8
- package/dist/app/api/execute/route.d.ts +0 -8
- package/dist/app/api/execute/route.mjs +0 -30
- package/dist/app/api/export/route.cjs +0 -33
- package/dist/app/api/export/route.d.mts +0 -3
- package/dist/app/api/export/route.d.ts +0 -3
- package/dist/app/api/export/route.mjs +0 -8
- package/dist/app/api/register/route.cjs +0 -120
- package/dist/app/api/register/route.d.mts +0 -10
- package/dist/app/api/register/route.d.ts +0 -10
- package/dist/app/api/register/route.mjs +0 -85
- package/dist/app/api/save/route.cjs +0 -53
- package/dist/app/api/save/route.d.mts +0 -9
- package/dist/app/api/save/route.d.ts +0 -9
- package/dist/app/api/save/route.mjs +0 -18
- package/dist/app/api/transcribe/route.cjs +0 -72
- package/dist/app/api/transcribe/route.d.mts +0 -10
- package/dist/app/api/transcribe/route.d.ts +0 -10
- package/dist/app/api/transcribe/route.mjs +0 -46
- package/dist/app/api/validate/route.cjs +0 -143
- package/dist/app/api/validate/route.d.mts +0 -13
- package/dist/app/api/validate/route.d.ts +0 -13
- package/dist/app/api/validate/route.mjs +0 -107
- package/dist/components/UI/Dropdown.tsx +0 -0
- package/dist/components/tetrons/EditorContent.tsx +0 -272
- package/dist/components/tetrons/ResizableImageComponent.tsx +0 -112
- package/dist/components/tetrons/ResizableVideoComponent.tsx +0 -56
- package/dist/dictionaries/index.aff +0 -205
- package/dist/dictionaries/index.dic +0 -49569
- package/dist/index.cjs +0 -17652
- package/dist/index.d.mts +0 -16
- package/dist/styles/tetrons.css +0 -981
- package/public/dictionaries/index.aff +0 -205
- package/public/dictionaries/index.dic +0 -49569
- /package/dist/components/{UI/Button.tsx → Editor/config/featureConfig.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,126 +1,105 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tetrons",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "2.3.100",
|
|
4
|
+
"description": "Tetrons is a fully-featured, modern WYSIWYG rich text editor built on TipTap.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.mjs",
|
|
6
7
|
"module": "dist/index.mjs",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"packageManager": "npm@10.9.0",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18.0.0"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"*.css",
|
|
20
|
+
"dist/styles/*.css"
|
|
21
|
+
],
|
|
8
22
|
"scripts": {
|
|
9
|
-
"
|
|
10
|
-
"build": "tsup
|
|
11
|
-
"
|
|
12
|
-
"
|
|
23
|
+
"build": "npm run build:js && npm run build:types",
|
|
24
|
+
"build:js": "tsup",
|
|
25
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
26
|
+
"prepublishOnly": "npm run build",
|
|
27
|
+
"lint": "eslint",
|
|
28
|
+
"deps:check": "ncu",
|
|
29
|
+
"deps:update": "ncu -u && npm install",
|
|
30
|
+
"deps:update:safe": "ncu -u \"/^(?!react$|react-dom$|next$).*/\" && npm install"
|
|
13
31
|
},
|
|
14
32
|
"dependencies": {
|
|
15
|
-
"@emoji-mart/react": "1.1.1",
|
|
16
33
|
"@monaco-editor/react": "^4.7.0",
|
|
17
|
-
"@tiptap/core": "
|
|
18
|
-
"@tiptap/extension-
|
|
19
|
-
"@tiptap/extension-color": "
|
|
20
|
-
"@tiptap/extension-highlight": "
|
|
21
|
-
"@tiptap/extension-
|
|
22
|
-
"@tiptap/extension-
|
|
23
|
-
"@tiptap/extension-
|
|
24
|
-
"@tiptap/extension-
|
|
25
|
-
"@tiptap/extension-
|
|
26
|
-
"@tiptap/extension-
|
|
27
|
-
"@tiptap/extension-
|
|
28
|
-
"@tiptap/extension-
|
|
29
|
-
"@tiptap/extension-
|
|
30
|
-
"@tiptap/
|
|
31
|
-
"@tiptap/
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
34
|
+
"@tiptap/core": "^3.13.0",
|
|
35
|
+
"@tiptap/extension-bullet-list": "^3.13.0",
|
|
36
|
+
"@tiptap/extension-color": "^3.13.0",
|
|
37
|
+
"@tiptap/extension-highlight": "^3.13.0",
|
|
38
|
+
"@tiptap/extension-history": "^3.13.0",
|
|
39
|
+
"@tiptap/extension-image": "^3.13.0",
|
|
40
|
+
"@tiptap/extension-list-item": "^3.13.0",
|
|
41
|
+
"@tiptap/extension-ordered-list": "^3.13.0",
|
|
42
|
+
"@tiptap/extension-subscript": "^3.13.0",
|
|
43
|
+
"@tiptap/extension-superscript": "^3.13.0",
|
|
44
|
+
"@tiptap/extension-table-cell": "^3.13.0",
|
|
45
|
+
"@tiptap/extension-table-header": "^3.13.0",
|
|
46
|
+
"@tiptap/extension-table-row": "^3.13.0",
|
|
47
|
+
"@tiptap/extension-task-item": "^3.13.0",
|
|
48
|
+
"@tiptap/extension-task-list": "^3.13.0",
|
|
49
|
+
"@tiptap/extension-text-align": "^3.13.0",
|
|
50
|
+
"@tiptap/extension-text-style": "^3.13.0",
|
|
51
|
+
"@tiptap/extension-underline": "^3.13.0",
|
|
52
|
+
"@tiptap/react": "^3.13.0",
|
|
53
|
+
"@tiptap/starter-kit": "^3.13.0",
|
|
54
|
+
"axios": "^1.13.2",
|
|
55
|
+
"cheerio": "^1.1.2",
|
|
56
|
+
"clsx": "^2.1.1",
|
|
57
|
+
"dayjs": "^1.11.19",
|
|
58
|
+
"dictionary-en": "^4.0.0",
|
|
59
|
+
"diff": "^8.0.2",
|
|
60
|
+
"docx": "^9.5.1",
|
|
61
|
+
"emoji-picker-element": "^1.28.0",
|
|
62
|
+
"file-saver": "^2.0.5",
|
|
63
|
+
"html2canvas": "^1.4.1",
|
|
64
|
+
"jspdf": "^3.0.4",
|
|
65
|
+
"katex": "^0.16.27",
|
|
66
|
+
"lucide-react": "^0.561.0",
|
|
67
|
+
"monaco-editor": "^0.55.1",
|
|
68
|
+
"nspell": "^2.1.5",
|
|
69
|
+
"re-resizable": "^6.11.2",
|
|
70
|
+
"react-icons": "^5.5.0",
|
|
71
|
+
"tesseract.js": "^6.0.1"
|
|
50
72
|
},
|
|
51
73
|
"peerDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"react": "
|
|
54
|
-
"
|
|
74
|
+
"react": ">=18",
|
|
75
|
+
"react-dom": ">=18",
|
|
76
|
+
"next": ">=13"
|
|
55
77
|
},
|
|
56
78
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@types/
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/
|
|
61
|
-
"@types/
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
79
|
+
"@tiptap/extension-table": "^3.13.0",
|
|
80
|
+
"@types/file-saver": "^2.0.7",
|
|
81
|
+
"@types/katex": "^0.16.7",
|
|
82
|
+
"@types/node": "^25",
|
|
83
|
+
"@types/nodemailer": "^7.0.4",
|
|
84
|
+
"@types/react": "^19",
|
|
85
|
+
"@types/react-dom": "^19",
|
|
86
|
+
"babel-plugin-react-compiler": "1.0.0",
|
|
87
|
+
"baseline-browser-mapping": "^2.9.7",
|
|
88
|
+
"eslint": "^9",
|
|
89
|
+
"eslint-config-next": "16.0.10",
|
|
90
|
+
"tsup": "^8.5.1",
|
|
91
|
+
"typescript": "^5"
|
|
68
92
|
},
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
93
|
+
"optionalDependencies": {
|
|
94
|
+
"mongoose": "^9.0.1",
|
|
95
|
+
"nodemailer": "^7.0.11",
|
|
96
|
+
"openai": "^6.10.0"
|
|
72
97
|
},
|
|
73
|
-
"keywords": [
|
|
74
|
-
"nextjs",
|
|
75
|
-
"typescript",
|
|
76
|
-
"react",
|
|
77
|
-
"web"
|
|
78
|
-
],
|
|
79
|
-
"author": "Your Name",
|
|
80
|
-
"license": "MIT",
|
|
81
98
|
"exports": {
|
|
82
99
|
".": {
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
},
|
|
86
|
-
"./style.css": "./dist/styles/tetrons.css",
|
|
87
|
-
"./app/api/ai-action/route": {
|
|
88
|
-
"import": "./dist/app/api/ai-action/route.mjs",
|
|
89
|
-
"require": "./dist/app/api/ai-action/route.cjs"
|
|
90
|
-
},
|
|
91
|
-
"./app/api/export/route": {
|
|
92
|
-
"import": "./dist/app/api/export/route.mjs",
|
|
93
|
-
"require": "./dist/app/api/export/route.cjs"
|
|
100
|
+
"types": "./dist/index.d.ts",
|
|
101
|
+
"import": "./dist/index.mjs"
|
|
94
102
|
},
|
|
95
|
-
"./
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
"./app/api/save/route": {
|
|
100
|
-
"import": "./dist/app/api/save/route.mjs",
|
|
101
|
-
"require": "./dist/app/api/save/route.cjs"
|
|
102
|
-
},
|
|
103
|
-
"./app/api/transcribe/route": {
|
|
104
|
-
"import": "./dist/app/api/transcribe/route.mjs",
|
|
105
|
-
"require": "./dist/app/api/transcribe/route.cjs"
|
|
106
|
-
},
|
|
107
|
-
"./app/api/validate/route": {
|
|
108
|
-
"import": "./dist/app/api/validate/route.mjs",
|
|
109
|
-
"require": "./dist/app/api/validate/route.cjs"
|
|
110
|
-
},
|
|
111
|
-
"./app/api/execute/route": {
|
|
112
|
-
"import": "./dist/app/api/execute/route.mjs",
|
|
113
|
-
"require": "./dist/app/api/execute/route.cjs"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"files": [
|
|
117
|
-
"dist",
|
|
118
|
-
"dist/styles/tetrons.css",
|
|
119
|
-
"dist/components",
|
|
120
|
-
"public/dictionaries"
|
|
121
|
-
],
|
|
122
|
-
"bugs": {
|
|
123
|
-
"url": "https://github.com/Finapsys/Tetrons/issues"
|
|
124
|
-
},
|
|
125
|
-
"homepage": "https://github.com/Finapsys/Tetrons#readme"
|
|
126
|
-
}
|
|
103
|
+
"./style.css": "./dist/index.css"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/app/api/ai-action/route.ts
|
|
21
|
-
var route_exports = {};
|
|
22
|
-
__export(route_exports, {
|
|
23
|
-
POST: () => POST
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(route_exports);
|
|
26
|
-
var import_server = require("next/server");
|
|
27
|
-
async function POST(req) {
|
|
28
|
-
try {
|
|
29
|
-
const { content } = await req.json();
|
|
30
|
-
const response = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
31
|
-
method: "POST",
|
|
32
|
-
headers: {
|
|
33
|
-
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
34
|
-
"Content-Type": "application/json"
|
|
35
|
-
},
|
|
36
|
-
body: JSON.stringify({
|
|
37
|
-
model: "gpt-4",
|
|
38
|
-
messages: [{ role: "user", content }],
|
|
39
|
-
temperature: 0.7
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
const data = await response.json();
|
|
43
|
-
if (!response.ok) {
|
|
44
|
-
return import_server.NextResponse.json({ error: data.error.message }, { status: 500 });
|
|
45
|
-
}
|
|
46
|
-
return import_server.NextResponse.json({ response: data.choices[0].message.content });
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error("AI generation error:", error);
|
|
49
|
-
if (error instanceof Error) {
|
|
50
|
-
return import_server.NextResponse.json({ error: error.message }, { status: 500 });
|
|
51
|
-
}
|
|
52
|
-
return import_server.NextResponse.json(
|
|
53
|
-
{ error: "Unknown error occurred." },
|
|
54
|
-
{ status: 500 }
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
-
0 && (module.exports = {
|
|
60
|
-
POST
|
|
61
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// src/app/api/ai-action/route.ts
|
|
2
|
-
import { NextResponse } from "next/server";
|
|
3
|
-
async function POST(req) {
|
|
4
|
-
try {
|
|
5
|
-
const { content } = await req.json();
|
|
6
|
-
const response = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
7
|
-
method: "POST",
|
|
8
|
-
headers: {
|
|
9
|
-
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
10
|
-
"Content-Type": "application/json"
|
|
11
|
-
},
|
|
12
|
-
body: JSON.stringify({
|
|
13
|
-
model: "gpt-4",
|
|
14
|
-
messages: [{ role: "user", content }],
|
|
15
|
-
temperature: 0.7
|
|
16
|
-
})
|
|
17
|
-
});
|
|
18
|
-
const data = await response.json();
|
|
19
|
-
if (!response.ok) {
|
|
20
|
-
return NextResponse.json({ error: data.error.message }, { status: 500 });
|
|
21
|
-
}
|
|
22
|
-
return NextResponse.json({ response: data.choices[0].message.content });
|
|
23
|
-
} catch (error) {
|
|
24
|
-
console.error("AI generation error:", error);
|
|
25
|
-
if (error instanceof Error) {
|
|
26
|
-
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
27
|
-
}
|
|
28
|
-
return NextResponse.json(
|
|
29
|
-
{ error: "Unknown error occurred." },
|
|
30
|
-
{ status: 500 }
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
POST
|
|
36
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/app/api/execute/route.ts
|
|
21
|
-
var route_exports = {};
|
|
22
|
-
__export(route_exports, {
|
|
23
|
-
POST: () => POST
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(route_exports);
|
|
26
|
-
var import_server = require("next/server");
|
|
27
|
-
async function POST(req) {
|
|
28
|
-
const { language, code } = await req.json();
|
|
29
|
-
console.log(language, code);
|
|
30
|
-
const res = await fetch("https://emkc.org/api/v2/piston/execute", {
|
|
31
|
-
method: "POST",
|
|
32
|
-
headers: { "Content-Type": "application/json" },
|
|
33
|
-
body: JSON.stringify({
|
|
34
|
-
language,
|
|
35
|
-
version: "*",
|
|
36
|
-
files: [
|
|
37
|
-
{
|
|
38
|
-
name: `main.${language === "cpp" ? "cpp" : language}`,
|
|
39
|
-
content: code
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
args: [],
|
|
43
|
-
stdin: ""
|
|
44
|
-
})
|
|
45
|
-
});
|
|
46
|
-
const data = await res.json();
|
|
47
|
-
return import_server.NextResponse.json({
|
|
48
|
-
stdout: data.run?.stdout ?? "",
|
|
49
|
-
stderr: data.run?.stderr ?? ""
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
POST
|
|
55
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/app/api/execute/route.ts
|
|
2
|
-
import { NextResponse } from "next/server";
|
|
3
|
-
async function POST(req) {
|
|
4
|
-
const { language, code } = await req.json();
|
|
5
|
-
console.log(language, code);
|
|
6
|
-
const res = await fetch("https://emkc.org/api/v2/piston/execute", {
|
|
7
|
-
method: "POST",
|
|
8
|
-
headers: { "Content-Type": "application/json" },
|
|
9
|
-
body: JSON.stringify({
|
|
10
|
-
language,
|
|
11
|
-
version: "*",
|
|
12
|
-
files: [
|
|
13
|
-
{
|
|
14
|
-
name: `main.${language === "cpp" ? "cpp" : language}`,
|
|
15
|
-
content: code
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
args: [],
|
|
19
|
-
stdin: ""
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
const data = await res.json();
|
|
23
|
-
return NextResponse.json({
|
|
24
|
-
stdout: data.run?.stdout ?? "",
|
|
25
|
-
stderr: data.run?.stderr ?? ""
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
POST
|
|
30
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/app/api/export/route.ts
|
|
21
|
-
var route_exports = {};
|
|
22
|
-
__export(route_exports, {
|
|
23
|
-
GET: () => GET
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(route_exports);
|
|
26
|
-
function GET(req) {
|
|
27
|
-
console.log(req.method);
|
|
28
|
-
return new Response("Hello, world!", { status: 200 });
|
|
29
|
-
}
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
GET
|
|
33
|
-
});
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/app/api/register/route.ts
|
|
31
|
-
var route_exports = {};
|
|
32
|
-
__export(route_exports, {
|
|
33
|
-
POST: () => POST
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(route_exports);
|
|
36
|
-
var import_server = require("next/server");
|
|
37
|
-
|
|
38
|
-
// src/lib/db.js
|
|
39
|
-
var import_mongoose = __toESM(require("mongoose"));
|
|
40
|
-
var MONGO_URL = process.env.MONGO_URL;
|
|
41
|
-
var connectDB = async () => {
|
|
42
|
-
if (import_mongoose.default.connection.readyState >= 1) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
await import_mongoose.default.connect(MONGO_URL);
|
|
47
|
-
console.log("Connected to MongoDB \u{1F44D}");
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error("MongoDB connection failed \u274C", error);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/models/ApiKey.ts
|
|
55
|
-
var import_mongoose2 = __toESM(require("mongoose"));
|
|
56
|
-
var ApiKeySchema = new import_mongoose2.default.Schema({
|
|
57
|
-
email: { type: String, required: true },
|
|
58
|
-
organization: { type: String, required: true },
|
|
59
|
-
version: {
|
|
60
|
-
type: String,
|
|
61
|
-
enum: ["free", "pro", "premium", "platinum"],
|
|
62
|
-
required: true
|
|
63
|
-
},
|
|
64
|
-
apiKey: { type: String, required: true, unique: true },
|
|
65
|
-
createdAt: { type: Date, default: Date.now },
|
|
66
|
-
expiresAt: { type: Date }
|
|
67
|
-
});
|
|
68
|
-
var ApiKey = import_mongoose2.default.models.ApiKey || import_mongoose2.default.model("ApiKey", ApiKeySchema);
|
|
69
|
-
|
|
70
|
-
// src/utils/apiKeyUtils.ts
|
|
71
|
-
var import_crypto = __toESM(require("crypto"));
|
|
72
|
-
var FREE_API_KEY = process.env.TETRONS_FREE_KEY || "TETRONS_FREE_KEY";
|
|
73
|
-
var SECRET_KEY = process.env.API_KEY_SECRET || "default-secret-key";
|
|
74
|
-
function getFreeApiKey() {
|
|
75
|
-
return FREE_API_KEY;
|
|
76
|
-
}
|
|
77
|
-
var VERSION_PREFIXES = {
|
|
78
|
-
pro: "PRO",
|
|
79
|
-
premium: "PREMIUM",
|
|
80
|
-
platinum: "PLATINUM"
|
|
81
|
-
};
|
|
82
|
-
function generateUserApiKey(email, organization, version) {
|
|
83
|
-
const input = `${email.trim().toLowerCase()}:${organization.trim().toLowerCase()}`;
|
|
84
|
-
const hash = import_crypto.default.createHmac("sha256", SECRET_KEY).update(input).digest("hex").toUpperCase();
|
|
85
|
-
const prefix = VERSION_PREFIXES[version];
|
|
86
|
-
return `${prefix}${hash.slice(0, 48 - prefix.length)}`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/app/api/register/route.ts
|
|
90
|
-
async function POST(req) {
|
|
91
|
-
const body = await req.json();
|
|
92
|
-
const { email, organization, version } = body;
|
|
93
|
-
if (!email || !organization || !version) {
|
|
94
|
-
return import_server.NextResponse.json({ error: "Missing fields" }, { status: 400 });
|
|
95
|
-
}
|
|
96
|
-
await connectDB();
|
|
97
|
-
const lowerEmail = email.trim().toLowerCase();
|
|
98
|
-
const lowerOrg = organization.trim().toLowerCase();
|
|
99
|
-
await ApiKey.deleteMany({ email: lowerEmail, version });
|
|
100
|
-
let apiKey;
|
|
101
|
-
let expiresAt = null;
|
|
102
|
-
if (version === "free") {
|
|
103
|
-
apiKey = getFreeApiKey();
|
|
104
|
-
expiresAt = new Date(Date.now() + 14 * 24 * 60 * 60 * 1e3);
|
|
105
|
-
} else {
|
|
106
|
-
apiKey = generateUserApiKey(lowerEmail, lowerOrg, version);
|
|
107
|
-
}
|
|
108
|
-
await ApiKey.create({
|
|
109
|
-
email: lowerEmail,
|
|
110
|
-
organization: lowerOrg,
|
|
111
|
-
version,
|
|
112
|
-
apiKey,
|
|
113
|
-
expiresAt
|
|
114
|
-
});
|
|
115
|
-
return import_server.NextResponse.json({ apiKey, expiresAt });
|
|
116
|
-
}
|
|
117
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
-
0 && (module.exports = {
|
|
119
|
-
POST
|
|
120
|
-
});
|