@eclipse-docks/extension-utils 0.7.130 → 0.7.133
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/{commands-CvhhmqU3.js → commands-B5QrGERn.js} +2 -2
- package/dist/{commands-CvhhmqU3.js.map → commands-B5QrGERn.js.map} +1 -1
- package/dist/{i18n.de-DpWotOVv.js → i18n.de-BeTB4qPD.js} +1 -1
- package/dist/{i18n.de-DpWotOVv.js.map → i18n.de-BeTB4qPD.js.map} +1 -1
- package/dist/{i18n.en-4j7sK8PT.js → i18n.en-DV96x3ri.js} +1 -1
- package/dist/{i18n.en-4j7sK8PT.js.map → i18n.en-DV96x3ri.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{p12splitter-CFxn-nyT.js → p12splitter-D0v8d_dX.js} +1 -1
- package/dist/p12splitter-D0v8d_dX.js.map +1 -0
- package/package.json +1 -1
- package/dist/p12splitter-CFxn-nyT.js.map +0 -1
|
@@ -35,7 +35,7 @@ registerAll({
|
|
|
35
35
|
const pyEnv = new PyEnv();
|
|
36
36
|
await pyEnv.init(workspace);
|
|
37
37
|
await pyEnv.loadPackages(["cryptography"]);
|
|
38
|
-
const pyModule = await import("./p12splitter-
|
|
38
|
+
const pyModule = await import("./p12splitter-D0v8d_dX.js");
|
|
39
39
|
const pyScript = pyModule.default ?? pyModule;
|
|
40
40
|
await pyEnv.execCode(pyScript);
|
|
41
41
|
await pyEnv.runFunction("p12splitter", {
|
|
@@ -120,4 +120,4 @@ registerAll({
|
|
|
120
120
|
});
|
|
121
121
|
//#endregion
|
|
122
122
|
|
|
123
|
-
//# sourceMappingURL=commands-
|
|
123
|
+
//# sourceMappingURL=commands-B5QrGERn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands-
|
|
1
|
+
{"version":3,"file":"commands-B5QrGERn.js","names":[],"sources":["../src/commands/p12split.ts","../src/commands/unzip.ts"],"sourcesContent":["import { workspaceService, taskService, toastError, toastInfo, registerAll } from \"@eclipse-docks/core\";\nimport { PyEnv } from \"@eclipse-docks/extension-python-runtime/api\";\n\nregisterAll({\n command: {\n id: \"p12split\",\n name: \".p12 file splitter\",\n description: \"Splits a .p12 file into private/public and additional .pem files\",\n parameters: [\n {\n name: \"p12_path\",\n description: \"Path of the .p12 file to split\",\n required: true\n },\n {\n name: \"password\",\n description:\n \"The password of the .p12 file, will prompt for input if not specified, use empty string for no password\",\n required: false\n },\n {\n name: \"output_path\",\n description:\n \"Directory path of the files to write to, if not provided, will be parent directory of p12_path\",\n required: false\n }\n ]\n },\n handler: {\n execute: async ({ params: { p12_path, password, output_path } }: any) => {\n const workspace = await workspaceService.getWorkspace();\n if (!workspace) {\n toastError(\"No Workspace selected!\");\n return;\n }\n\n await taskService.runAsync(\"Splitting .p12 certificate file\", async () => {\n const pyEnv = new PyEnv();\n await pyEnv.init(workspace);\n await pyEnv.loadPackages([\"cryptography\"]);\n const pyModule = await import(\"../p12splitter.py?raw\");\n const pyScript = (pyModule as any).default ?? pyModule;\n await pyEnv.execCode(pyScript as string);\n await pyEnv.runFunction(\"p12splitter\", {\n p12_path,\n password: password === '\"\"' ? undefined : password,\n output_path: output_path === '\"\"' ? \"\" : output_path\n });\n toastInfo(\".p12 file successfully splitted\");\n });\n }\n }\n});\n\n","import JSZip from \"jszip\";\nimport {\n registerAll,\n activeSelectionSignal,\n File,\n FileContentType,\n workspaceService,\n taskService,\n toastError,\n toastInfo,\n} from \"@eclipse-docks/core\";\n\nregisterAll({\n command: {\n id: \"unzip\",\n name: \"Unzip Archive\",\n description: \"Extract a zip archive from the workspace\",\n parameters: [\n {\n name: \"file\",\n description: \"the zip file to extract, if not provided, the current selection will be used\",\n required: false,\n },\n {\n name: \"target\",\n description: \"target folder to extract into, defaults to the zip filename without extension\",\n required: false,\n },\n ],\n },\n handler: {\n canExecute: (context: any) => {\n let filePath: string = context.params?.file;\n if (!filePath) {\n const selectedItem = activeSelectionSignal.get() as any;\n if (!selectedItem || !(\"path\" in selectedItem)) return false;\n filePath = selectedItem.path;\n }\n return filePath.toLowerCase().endsWith(\".zip\");\n },\n execute: async (context: any) => {\n let filePath: string = context.params?.file;\n if (!filePath) {\n const selectedItem = activeSelectionSignal.get() as any;\n filePath = selectedItem.path;\n }\n\n const workspaceDir = await workspaceService.getWorkspace();\n if (!workspaceDir) {\n toastError(\"No workspace selected.\");\n return;\n }\n\n await taskService.runAsync(\"Extracting archive\", async (progress: any) => {\n try {\n const fileResource = await workspaceDir.getResource(filePath);\n if (!fileResource) {\n toastError(\"File not found: \" + filePath);\n return;\n }\n\n let targetFolder = context.params?.target;\n if (!targetFolder) {\n const fileName = filePath.split(\"/\").pop() || \"extracted\";\n targetFolder = fileName.replace(/\\.zip$/i, \"\") + \"/\";\n }\n\n progress.message = \"Loading archive...\";\n progress.progress = 0;\n await workspaceDir.getResource(targetFolder, { create: true });\n\n const file = fileResource as File;\n const blob = await file.getContents({ blob: true });\n const zip = await JSZip.loadAsync(blob);\n const totalFiles = Object.values(zip.files).filter((entry) => !entry.dir).length;\n let extractedCount = 0;\n\n progress.message = `Extracting to ${targetFolder.replace(/\\/$/, \"\")}...`;\n\n for (const [relativePath, zipEntry] of Object.entries(zip.files)) {\n if (zipEntry.dir) continue;\n\n const entryBlob = await zipEntry.async(\"blob\");\n const fullPath = `${targetFolder}${relativePath}`;\n const entryResource = await workspaceDir.getResource(fullPath, { create: true });\n const newFile = entryResource as File;\n await newFile.saveContents(entryBlob, { contentType: FileContentType.BINARY });\n\n extractedCount++;\n progress.progress = Math.round((extractedCount / totalFiles) * 100);\n progress.message = `Extracting ${extractedCount}/${totalFiles} files...`;\n }\n\n progress.progress = 100;\n toastInfo(`Archive extracted to ${targetFolder.replace(/\\/$/, \"\")}: ${extractedCount} file(s)`);\n } catch (err: any) {\n toastError(\"Failed to extract archive: \" + err);\n throw err;\n }\n });\n },\n },\n});\n"],"mappings":";;;;AAGA,YAAY;CACV,SA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S,WAAW;KACpB,UAAU,wBAAwB,aAAa,QAAQ,OAAO,EAAE,EAAE,IAAI,eAAe,SAAS;IAChG,SAAS,KAAU;KACjB,WAAW,gCAAgC,GAAG;KAC9C,MAAM;IACR;GACF,CAAC;EACH;CACF;AACF,CAAC"}
|
|
@@ -28,4 +28,4 @@ var i18n_de_default = {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
export { CMD_P12SPLIT_DESC, CMD_P12SPLIT_NAME, CMD_UNZIP_DESC, CMD_UNZIP_NAME, CMD_WGET_DESC, CMD_WGET_NAME, CREATE_FILE, CREATE_FOLDER, DELETE, EXT_UTILS_DESC, EXT_UTILS_NAME, RENAME, i18n_de_default as default };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=i18n.de-
|
|
31
|
+
//# sourceMappingURL=i18n.de-BeTB4qPD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.de-
|
|
1
|
+
{"version":3,"file":"i18n.de-BeTB4qPD.js","names":[],"sources":["../src/i18n.de.json"],"sourcesContent":["{\n \"EXT_UTILS_NAME\": \"Dienstprogramme\",\n \"EXT_UTILS_DESC\": \"Hilfsbefehle wie wget, unzip und Zertifikatstools.\",\n \"CMD_WGET_NAME\": \"wget\",\n \"CMD_WGET_DESC\": \"Datei von einer URL in den Arbeitsbereich herunterladen.\",\n \"CMD_UNZIP_NAME\": \"Archiv entpacken\",\n \"CMD_UNZIP_DESC\": \"Ein Zip-Archiv im Arbeitsbereich entpacken.\",\n \"CMD_P12SPLIT_NAME\": \".p12-Datei aufteilen\",\n \"CMD_P12SPLIT_DESC\": \"Eine .p12-Zertifikatsdatei in separate PEM-Dateien aufteilen.\",\n \"CREATE_FILE\": \"Datei erstellen...\",\n \"CREATE_FOLDER\": \"Ordner erstellen...\",\n \"RENAME\": \"Umbenennen\",\n \"DELETE\": \"Löschen\"\n}\n"],"mappings":""}
|
|
@@ -28,4 +28,4 @@ var i18n_en_default = {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
export { CMD_P12SPLIT_DESC, CMD_P12SPLIT_NAME, CMD_UNZIP_DESC, CMD_UNZIP_NAME, CMD_WGET_DESC, CMD_WGET_NAME, CREATE_FILE, CREATE_FOLDER, DELETE, EXT_UTILS_DESC, EXT_UTILS_NAME, RENAME, i18n_en_default as default };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=i18n.en-
|
|
31
|
+
//# sourceMappingURL=i18n.en-DV96x3ri.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.en-
|
|
1
|
+
{"version":3,"file":"i18n.en-DV96x3ri.js","names":[],"sources":["../src/i18n.en.json"],"sourcesContent":["{\n \"EXT_UTILS_NAME\": \"Utilities\",\n \"EXT_UTILS_DESC\": \"Utility commands such as wget, unzip and certificate tools.\",\n \"CMD_WGET_NAME\": \"wget\",\n \"CMD_WGET_DESC\": \"Download a file from a URL to the workspace.\",\n \"CMD_UNZIP_NAME\": \"Unzip Archive\",\n \"CMD_UNZIP_DESC\": \"Extract a zip archive from the workspace.\",\n \"CMD_P12SPLIT_NAME\": \".p12 file splitter\",\n \"CMD_P12SPLIT_DESC\": \"Split a .p12 certificate file into separate PEM files.\",\n \"CREATE_FILE\": \"Create File...\",\n \"CREATE_FOLDER\": \"Create Folder...\",\n \"RENAME\": \"Rename\",\n \"DELETE\": \"Delete\"\n}\n"],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { extensionRegistry, i18n } from "@eclipse-docks/core";
|
|
2
2
|
import pkg from "../package.json";
|
|
3
3
|
//#region src/index.ts
|
|
4
|
-
var t = await i18n(/*
|
|
5
|
-
"./i18n.de.json": () => import("./i18n.de-
|
|
6
|
-
"./i18n.en.json": () => import("./i18n.en-
|
|
4
|
+
var t = await i18n(/* #__PURE__ */ Object.assign({
|
|
5
|
+
"./i18n.de.json": () => import("./i18n.de-BeTB4qPD.js"),
|
|
6
|
+
"./i18n.en.json": () => import("./i18n.en-DV96x3ri.js")
|
|
7
7
|
}), true);
|
|
8
8
|
extensionRegistry.registerExtension({
|
|
9
9
|
id: pkg.name,
|
|
10
10
|
name: t.EXT_UTILS_NAME,
|
|
11
11
|
description: t.EXT_UTILS_DESC,
|
|
12
|
-
loader: () => import("./commands-
|
|
12
|
+
loader: () => import("./commands-B5QrGERn.js"),
|
|
13
13
|
icon: "toolbox",
|
|
14
14
|
dependencies: ["@eclipse-docks/extension-python-runtime"]
|
|
15
15
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18n } from \"@eclipse-docks/core\";\nimport pkg from \"../package.json\";\n\nconst t = await i18n(import.meta.glob(\"./i18n*.json\"), true);\n\nextensionRegistry.registerExtension({\n id: pkg.name,\n name: t.EXT_UTILS_NAME,\n description: t.EXT_UTILS_DESC,\n loader: () => import(\"./commands\"),\n icon: \"toolbox\",\n dependencies: [\"@eclipse-docks/extension-python-runtime\"]\n});\n\n"],"mappings":";;;AAGA,IAAM,IAAI,MAAM,KAAK,uBAAA,OAAA;CAAA,wBAAA,OAAA;CAAA,wBAAA,OAAA;CAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18n } from \"@eclipse-docks/core\";\nimport pkg from \"../package.json\";\n\nconst t = await i18n(import.meta.glob(\"./i18n*.json\"), true);\n\nextensionRegistry.registerExtension({\n id: pkg.name,\n name: t.EXT_UTILS_NAME,\n description: t.EXT_UTILS_DESC,\n loader: () => import(\"./commands\"),\n icon: \"toolbox\",\n dependencies: [\"@eclipse-docks/extension-python-runtime\"]\n});\n\n"],"mappings":";;;AAGA,IAAM,IAAI,MAAM,KAAK,uBAAA,OAAA;CAAA,wBAAA,OAAA;CAAA,wBAAA,OAAA;AAAA,CAAA,GAAkC,IAAI;AAE3D,kBAAkB,kBAAkB;CAClC,IAAI,IAAI;CACR,MAAM,EAAE;CACR,aAAa,EAAE;CACf,cAAc,OAAO;CACrB,MAAM;CACN,cAAc,CAAC,yCAAyC;AAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p12splitter-D0v8d_dX.js","names":[],"sources":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p12splitter-CFxn-nyT.js","names":[],"sources":["../src/p12splitter.py?raw"],"sourcesContent":["export default \"import os\\n\\nfrom cryptography.hazmat.primitives.serialization import pkcs12, Encoding, PrivateFormat, NoEncryption\\n\\n\\ndef p12splitter(p12_path, password=None, output_path=None):\\n if output_path is None:\\n output_path = os.path.dirname(p12_path)\\n\\n if p12_path is None:\\n return\\n\\n cert_name = os.path.basename(p12_path)\\n\\n # Read the .p12 file\\n with open(p12_path, \\\"rb\\\") as f:\\n p12_data = f.read()\\n\\n if password is not None:\\n password = password.encode(\\\"utf-8\\\")\\n\\n # Load the PKCS#12 container\\n private_key, certificate, additional_certs = pkcs12.load_key_and_certificates(p12_data, password)\\n\\n # Write the private key\\n with open(os.path.join(output_path, f\\\"{cert_name}.key.pem\\\"), \\\"wb\\\") as key_file:\\n key_file.write(private_key.private_bytes(\\n encoding=Encoding.PEM,\\n format=PrivateFormat.TraditionalOpenSSL,\\n encryption_algorithm=NoEncryption()\\n ))\\n\\n # Write the main certificate\\n with open(os.path.join(output_path, f\\\"{cert_name}.cert.pem\\\"), \\\"wb\\\") as cert_file:\\n cert_file.write(certificate.public_bytes(Encoding.PEM))\\n\\n # Optionally, write any additional certs (CA chain/intermediates)\\n if additional_certs:\\n with open(os.path.join(output_path, f\\\"{cert_name}.chain.pem\\\"), \\\"wb\\\") as ca_file:\\n for ac in additional_certs:\\n ca_file.write(ac.public_bytes(Encoding.PEM))\\n\\n\""],"mappings":";AAAA,IAAA,sBAAe"}
|