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>
80 lines
2.7 KiB
Vue
80 lines
2.7 KiB
Vue
<template>
|
|
<BaseModal id="profileDetailsModal" title="Profile Details" ref="modal">
|
|
<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>
|
|
<StatusBadge v-if="profile" :profile="profile" />
|
|
</div>
|
|
</template>
|
|
<template #body>
|
|
<div v-if="profile">
|
|
<dl class="profile-meta">
|
|
<dt>Created</dt>
|
|
<dd>{{ formatDate(profile.created_at) }}</dd>
|
|
<dt>Expires</dt>
|
|
<dd>{{ formatDate(profile.expiration_date) }}<span v-if="daysLabel" class="text-muted"> ({{ daysLabel }})</span></dd>
|
|
<template v-if="profile.revoked_at">
|
|
<dt>Revoked</dt>
|
|
<dd>{{ formatDate(profile.revoked_at) }}</dd>
|
|
</template>
|
|
<dt>File</dt>
|
|
<dd class="certificate-file text-muted small text-break mt-0">{{ profile.file_path || 'N/A' }}</dd>
|
|
</dl>
|
|
|
|
<label for="profileNote" class="form-label small text-muted text-uppercase fw-bold">Note</label>
|
|
<textarea class="form-control" id="profileNote" rows="3" maxlength="1000" v-model="note" placeholder="Add a note about this profile..."></textarea>
|
|
<div class="form-text text-end">{{ note.length }} / 1000</div>
|
|
</div>
|
|
</template>
|
|
<template #footer>
|
|
<button type="button" class="btn-action btn-action-secondary" @click="close">Close</button>
|
|
<button type="button" class="btn-action btn-action-save" @click="save" :disabled="!dirty">Save</button>
|
|
</template>
|
|
</BaseModal>
|
|
</template>
|
|
|
|
<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);
|
|
const profile = ref(null);
|
|
const note = ref('');
|
|
|
|
const dirty = computed(() => note.value !== (profile.value?.note || ''));
|
|
|
|
const daysLabel = computed(() => {
|
|
const days = profile.value?.days_remaining;
|
|
if (days == null) return '';
|
|
return days > 0 ? `${days} d` : 'expired';
|
|
});
|
|
|
|
// YYYY-MM-DD HH:mm (local time)
|
|
const formatDate = (dateStr) => {
|
|
if (!dateStr) return 'N/A';
|
|
const d = new Date(dateStr);
|
|
if (isNaN(d)) return dateStr;
|
|
const pad = (n) => String(n).padStart(2, '0');
|
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
};
|
|
|
|
const open = (p) => {
|
|
profile.value = p;
|
|
note.value = p.note || '';
|
|
modal.value.show();
|
|
};
|
|
|
|
const close = () => {
|
|
modal.value.hide();
|
|
};
|
|
|
|
const save = () => {
|
|
emit('save', { id: profile.value.id, note: note.value });
|
|
close();
|
|
};
|
|
|
|
defineExpose({ open, close });
|
|
</script>
|