From 36dac1f889556c8fc3639075dc947a9d4420f064 Mon Sep 17 00:00:00 2001 From: ingalls Date: Mon, 7 Oct 2024 13:19:59 -0600 Subject: [PATCH] Add configure --- api/web/src/components/Configure.vue | 4 +++- .../components/Connection/CertificateP12.vue | 17 ++++++++++++----- api/web/src/components/ConnectionEdit.vue | 12 ++---------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/api/web/src/components/Configure.vue b/api/web/src/components/Configure.vue index 3ae8f32f6..5767af46b 100644 --- a/api/web/src/components/Configure.vue +++ b/api/web/src/components/Configure.vue @@ -58,6 +58,8 @@
diff --git a/api/web/src/components/Connection/CertificateP12.vue b/api/web/src/components/Connection/CertificateP12.vue index 9f14db06d..b2ca6f814 100644 --- a/api/web/src/components/Connection/CertificateP12.vue +++ b/api/web/src/components/Connection/CertificateP12.vue @@ -54,7 +54,6 @@ export default { TablerInput }, emits: [ - 'close', 'certs' ], data: function() { @@ -80,12 +79,20 @@ export default { }); }, methods: { - close: function() { - this.$emit('close'); - }, extract: function() { const certs = convertToPem(atob(this.file.split('base64,')[1]), this.password); - this.$emit('certs', certs); + const cert = certs.pemCertificate + .split('-----BEGIN CERTIFICATE-----') + .join('-----BEGIN CERTIFICATE-----\n') + .split('-----END CERTIFICATE-----') + .join('\n-----END CERTIFICATE-----'); + const key = certs.pemKey + .split('-----BEGIN RSA PRIVATE KEY-----') + .join('-----BEGIN RSA PRIVATE KEY-----\n') + .split('-----END RSA PRIVATE KEY-----') + .join('\n-----END RSA PRIVATE KEY-----'); + + this.$emit('certs', { key, cert }); } } } diff --git a/api/web/src/components/ConnectionEdit.vue b/api/web/src/components/ConnectionEdit.vue index f2af51b00..2c8bd7377 100644 --- a/api/web/src/components/ConnectionEdit.vue +++ b/api/web/src/components/ConnectionEdit.vue @@ -348,16 +348,8 @@ export default { }, p12upload: function(certs) { this.modal.upload = false; - this.connection.auth.cert = certs.pemCertificate - .split('-----BEGIN CERTIFICATE-----') - .join('-----BEGIN CERTIFICATE-----\n') - .split('-----END CERTIFICATE-----') - .join('\n-----END CERTIFICATE-----'); - this.connection.auth.key = certs.pemKey - .split('-----BEGIN RSA PRIVATE KEY-----') - .join('-----BEGIN RSA PRIVATE KEY-----\n') - .split('-----END RSA PRIVATE KEY-----') - .join('\n-----END RSA PRIVATE KEY-----'); + this.connection.auth.cert = certs.cert; + this.connection.auth.key = certs.key; }, create: async function() { for (const field of ['name', 'description' ]) {