Skip to content

Commit

Permalink
Add configure
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Oct 7, 2024
1 parent b03c649 commit 36dac1f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
4 changes: 3 additions & 1 deletion api/web/src/components/Configure.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<div class='mb-2'>
<label class='mx-2'>Admin Certificate</label>
<CertificateP12
@certs='body.certs = $event'
@err='err = $event'
/>
</div>
<div class='form-footer'>
Expand All @@ -66,7 +68,7 @@
class='btn btn-primary w-100'
@click='updateServer'
>
Create Admin
Configure Server
</button>
</div>
</template>
Expand Down
17 changes: 12 additions & 5 deletions api/web/src/components/Connection/CertificateP12.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default {
TablerInput
},
emits: [
'close',
'certs'
],
data: function() {
Expand All @@ -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 });
}
}
}
Expand Down
12 changes: 2 additions & 10 deletions api/web/src/components/ConnectionEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]) {
Expand Down

0 comments on commit 36dac1f

Please sign in to comment.