Get certificate info from local file

This commit is contained in:
0xJacky 2022-08-12 00:23:42 +08:00
parent c747390f94
commit e28e46db32
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
11 changed files with 175 additions and 144 deletions

View file

@ -14,8 +14,8 @@ class Domain extends Curd {
return http.get('template')
}
cert_info(domain: string) {
return http.get('cert/' + domain + '/info')
cert_info(path: string) {
return http.get('cert_info?ssl_certificate_path=' + path)
}
add_auto_cert(domain: string) {

View file

@ -1 +1 @@
{"version":"1.5.0","build_id":40,"total_build":110}
{"version":"1.5.0","build_id":41,"total_build":111}

View file

@ -23,6 +23,11 @@ const name = computed(() => {
return props.directivesMap['server_name'][0].params.trim()
})
const ssl_certificate_path = computed(() => {
return props.directivesMap['ssl_certificate']?.[0].params.trim() ?? null
})
const enabled = computed({
get() {
return props.enabled
@ -36,7 +41,7 @@ const enabled = computed({
<template>
<div>
<cert-info ref="info" :domain="name" v-if="name"/>
<cert-info ref="info" :ssl_certificate_path="ssl_certificate_path" v-if="ssl_certificate_path"/>
<issue-cert
:current_server_directives="props.current_server_directives"
:directives-map="props.directivesMap"

View file

@ -4,7 +4,7 @@ import dayjs from 'dayjs'
import {reactive, ref} from 'vue'
import domain from '@/api/domain'
const props = defineProps(['domain'])
const props = defineProps(['ssl_certificate_path'])
const ok = ref(false)
const cert = reactive({issuer_name: '', subject_name: '', not_after: '', not_before: ''})
@ -12,7 +12,7 @@ const cert = reactive({issuer_name: '', subject_name: '', not_after: '', not_bef
get()
function get() {
domain.cert_info(props.domain).then((r: any) => {
domain.cert_info(props.ssl_certificate_path).then((r: any) => {
Object.assign(cert, r)
ok.value = true
}).catch(() => {

View file

@ -1 +1 @@
{"version":"1.5.0","build_id":40,"total_build":110}
{"version":"1.5.0","build_id":41,"total_build":111}