UI review, stage 2: nginx security headers, gzip, cache; npm ci; no v-html
default.conf.template: X-Content-Type-Options, X-Frame-Options, Referrer-Policy, CSP, gzip, immutable cache for /assets/, no-cache for index.html and config.json, server_tokens off, drop proxy_pass_header. Dockerfile uses npm ci, .dockerignore added (nginx stays root: the image entrypoint and port 80 need it). Status badge is a component instead of v-html. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b78de98f26
commit
600119cdd1
6 files changed
+76
-32
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<template #header>
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
<h5 class="modal-title fw-bold mb-0" style="color: var(--text-heading);">{{ profile?.username }}</h5>
|
||||
<span v-if="profile" class="status-badge" :class="status.cls">{{ status.label }}</span>
|
||||
<StatusBadge v-if="profile" :profile="profile" />
|
||||
</div>
|
||||
</template>
|
||||
<template #body>
|
||||
@@ -36,6 +36,7 @@
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import BaseModal from './BaseModal.vue';
|
||||
import StatusBadge from './StatusBadge.vue';
|
||||
|
||||
const emit = defineEmits(['save']);
|
||||
const modal = ref(null);
|
||||
@@ -44,14 +45,6 @@ const note = ref('');
|
||||
|
||||
const dirty = computed(() => note.value !== (profile.value?.note || ''));
|
||||
|
||||
const status = computed(() => {
|
||||
const p = profile.value;
|
||||
if (p?.is_revoked) return { label: 'Revoked', cls: 'status-expired' };
|
||||
if (p?.is_expired) return { label: 'Expired', cls: 'status-expired' };
|
||||
if (p?.days_remaining != null && p.days_remaining <= 30) return { label: 'Expiring Soon', cls: 'status-warning' };
|
||||
return { label: 'Active', cls: 'status-valid' };
|
||||
});
|
||||
|
||||
const daysLabel = computed(() => {
|
||||
const days = profile.value?.days_remaining;
|
||||
if (days == null) return '';
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<span class="status-badge" :class="badge.cls">
|
||||
<i class="fas me-1" :class="badge.icon"></i>{{ badge.label }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
// Profile as returned by GET /profiles
|
||||
profile: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
const badge = computed(() => {
|
||||
const p = props.profile;
|
||||
if (p.is_revoked) return { label: 'Revoked', cls: 'status-expired', icon: 'fa-ban' };
|
||||
if (p.is_expired) return { label: 'Expired', cls: 'status-expired', icon: 'fa-times-circle' };
|
||||
if (p.days_remaining != null && p.days_remaining <= 30) {
|
||||
return { label: 'Expiring Soon', cls: 'status-warning', icon: 'fa-exclamation-triangle' };
|
||||
}
|
||||
return { label: 'Active', cls: 'status-valid', icon: 'fa-check-circle' };
|
||||
});
|
||||
</script>
|
||||
@@ -102,7 +102,7 @@
|
||||
<td class="fw-semibold" :class="getDaysClass(cert.days_remaining)">
|
||||
{{ cert.days_remaining }}
|
||||
</td>
|
||||
<td v-html="getStatusBadgeHTML(cert)"></td>
|
||||
<td><StatusBadge :profile="cert" /></td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-link text-warning p-0 me-2" title="Download Config" @click.stop="downloadConfig(cert)">
|
||||
<i class="fas fa-download"></i>
|
||||
@@ -131,7 +131,7 @@
|
||||
<td class="fw-semibold text-muted">
|
||||
{{ cert.days_remaining }}
|
||||
</td>
|
||||
<td v-html="getStatusBadgeHTML(cert)"></td>
|
||||
<td><StatusBadge :profile="cert" /></td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-link text-danger p-0" title="Revoke" @click.stop="revokeClient(cert)" :disabled="cert.is_revoked">
|
||||
<i class="fas fa-ban"></i>
|
||||
@@ -156,6 +156,7 @@ import { useApi } from '../composables/useApi';
|
||||
import NewClientModal from '../components/NewClientModal.vue';
|
||||
import ConfirmModal from '../components/ConfirmModal.vue';
|
||||
import ProfileDetailsModal from '../components/ProfileDetailsModal.vue';
|
||||
import StatusBadge from '../components/StatusBadge.vue';
|
||||
import vNoteTooltip from '../directives/noteTooltip';
|
||||
import { useToast } from '../composables/useToast';
|
||||
import { usePkiStatus } from '../composables/usePkiStatus';
|
||||
@@ -190,23 +191,6 @@ const getDaysClass = (days) => {
|
||||
return 'text-success';
|
||||
};
|
||||
|
||||
const getStatusBadgeHTML = (cert) => {
|
||||
if (cert.is_revoked) {
|
||||
return '<span class="status-badge status-expired"><i class="fas fa-ban me-1"></i>Revoked</span>';
|
||||
}
|
||||
if (cert.is_expired) {
|
||||
return '<span class="status-badge status-expired"><i class="fas fa-times-circle me-1"></i>Expired</span>';
|
||||
}
|
||||
|
||||
// Days check logic for expiring soon warning
|
||||
if (cert.days_remaining !== null && cert.days_remaining <= 30) {
|
||||
return '<span class="status-badge status-warning"><i class="fas fa-exclamation-triangle me-1"></i>Expiring Soon</span>';
|
||||
}
|
||||
|
||||
return '<span class="status-badge status-valid"><i class="fas fa-check-circle me-1"></i>Active</span>';
|
||||
};
|
||||
|
||||
|
||||
// Data Processing
|
||||
const filteredData = computed(() => {
|
||||
let data = allProfiles.value;
|
||||
|
||||
Reference in new issue
Block a user