Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
caad111457 | ||
|
|
dda6ac68dc | ||
|
|
8982011155 | ||
|
|
af309ca8d6 | ||
|
|
811f732495 | ||
|
|
6b83d7df0f | ||
|
|
c35396f906 | ||
|
|
9e9439eec9 | ||
|
|
dd6995bfc7 |
@@ -0,0 +1,77 @@
|
||||
# .gitea/workflows/deploy.yml
|
||||
name: Deploy Media Server
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency:
|
||||
group: deploy-media-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends rsync openssh-client
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Publish
|
||||
run: dotnet publish -c Release -o ./publish
|
||||
|
||||
- name: Prepare SSH
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.MEDIA_SSH_KEY }}
|
||||
SSH_HOST: ${{ secrets.MEDIA_SSH_HOST }}
|
||||
SSH_PORT: ${{ secrets.MEDIA_SSH_PORT }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PORT="${SSH_PORT:-22}"
|
||||
install -m 700 -d ~/.ssh
|
||||
printf '%s\n' "$SSH_KEY" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -p "$PORT" "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
# Staged through /tmp because the deploy user can't write /var/www directly.
|
||||
# /usr/local/sbin/deploy-media (root-owned, the only command in deploy's
|
||||
# sudoers) moves it into place with --exclude=App_Data, so the uploaded
|
||||
# media and its encrypted store are never touched by --delete.
|
||||
- name: Stage publish output
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.MEDIA_SSH_HOST }}
|
||||
SSH_PORT: ${{ secrets.MEDIA_SSH_PORT }}
|
||||
SSH_USER: ${{ secrets.MEDIA_SSH_USER }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PORT="${SSH_PORT:-22}"
|
||||
SSH_OPTS="-p $PORT -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=yes"
|
||||
ssh $SSH_OPTS "$SSH_USER@$SSH_HOST" \
|
||||
"rm -rf /tmp/media-app-stage && mkdir -p /tmp/media-app-stage"
|
||||
rsync -az --delete -e "ssh $SSH_OPTS" \
|
||||
publish/ "$SSH_USER@$SSH_HOST:/tmp/media-app-stage/"
|
||||
|
||||
- name: Install and restart
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.MEDIA_SSH_HOST }}
|
||||
SSH_PORT: ${{ secrets.MEDIA_SSH_PORT }}
|
||||
SSH_USER: ${{ secrets.MEDIA_SSH_USER }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PORT="${SSH_PORT:-22}"
|
||||
ssh -p "$PORT" -i "$HOME/.ssh/deploy_key" "$SSH_USER@$SSH_HOST" \
|
||||
"sudo -n /usr/local/sbin/deploy-media && rm -rf /tmp/media-app-stage"
|
||||
@@ -217,7 +217,7 @@
|
||||
<div class="add-form-collapsible">
|
||||
<div class="inline-form-row">
|
||||
<input type="text" id="newRxMedication" placeholder="Medication name *" class="form-input" />
|
||||
<input type="text" id="newRxNumber" placeholder="RX#" class="form-input" style="max-width:120px" />
|
||||
<input type="text" id="newRxNumber" placeholder="RX#" class="form-input rx-number-input" />
|
||||
<input type="text" id="newRxDosage" placeholder="Dosage" class="form-input" />
|
||||
<input type="text" id="newRxFrequency" placeholder="Frequency" class="form-input" />
|
||||
<select id="newRxDoctor" class="form-input">
|
||||
@@ -273,6 +273,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Document Viewer Modal -->
|
||||
<div class="doc-viewer-overlay" id="docViewerOverlay" style="display:none" onclick="medDocsCloseViewer(event)">
|
||||
<div class="doc-viewer-modal" onclick="event.stopPropagation()">
|
||||
<div class="doc-viewer-header">
|
||||
<span class="doc-viewer-title" id="docViewerTitle"></span>
|
||||
<button class="doc-viewer-close" onclick="medDocsCloseViewer()" title="Close">×</button>
|
||||
</div>
|
||||
<div class="doc-viewer-body" id="docViewerBody">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script src="~/js/medical-docs/state.js" asp-append-version="true"></script>
|
||||
<script src="~/js/medical-docs/tabs.js" asp-append-version="true"></script>
|
||||
|
||||
@@ -773,6 +773,10 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rx-number-input {
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.inline-edit-form {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1365,11 +1369,140 @@
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* ======================== */
|
||||
/* Document Viewer Modal */
|
||||
/* ======================== */
|
||||
|
||||
.doc-viewer-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
backdrop-filter: blur(4px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.doc-viewer-modal {
|
||||
background: var(--bg-primary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
width: auto;
|
||||
min-width: 300px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.doc-viewer-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.doc-viewer-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.doc-viewer-close {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0 4px;
|
||||
flex-shrink: 0;
|
||||
margin-left: 12px;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.doc-viewer-close:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.doc-viewer-body {
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.doc-viewer-loading,
|
||||
.doc-viewer-error {
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
padding: 40px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.doc-viewer-error {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.doc-viewer-image {
|
||||
max-width: 100%;
|
||||
max-height: calc(90vh - 80px);
|
||||
object-fit: contain;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.doc-viewer-audio {
|
||||
width: 100%;
|
||||
min-width: 300px;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.doc-viewer-pdf {
|
||||
width: 80vw;
|
||||
height: calc(90vh - 80px);
|
||||
max-width: 100%;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.doc-viewer-text {
|
||||
font-family: inherit;
|
||||
font-size: 14px;
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: 6px;
|
||||
padding: 16px;
|
||||
max-height: calc(90vh - 120px);
|
||||
overflow-y: auto;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* ======================== */
|
||||
/* Responsive (<=768px) */
|
||||
/* ======================== */
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.dashboard-container {
|
||||
padding: 16px 12px;
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
@@ -1377,8 +1510,18 @@
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.quick-actions {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.quick-actions .btn {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.medical-layout {
|
||||
flex-direction: column;
|
||||
min-height: unset;
|
||||
}
|
||||
|
||||
.medical-sidebar {
|
||||
@@ -1409,7 +1552,7 @@
|
||||
}
|
||||
|
||||
.summary-cards {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
.upload-fields {
|
||||
@@ -1424,9 +1567,24 @@
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.doc-type-icon,
|
||||
.doc-info {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.doc-info {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.doc-actions {
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.doc-actions button {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.inline-form-row {
|
||||
@@ -1438,6 +1596,10 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inline-form-row .btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.doctor-card,
|
||||
.condition-item {
|
||||
flex-wrap: wrap;
|
||||
@@ -1454,22 +1616,40 @@
|
||||
|
||||
.main-tabs {
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.main-tabs::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cost-aggregation {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.filter-bar {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.filter-bar .form-input {
|
||||
min-width: unset;
|
||||
width: 100%;
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.filter-bar input[type="date"] {
|
||||
width: 100%;
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.filter-search {
|
||||
flex: 1 1 100% !important;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
padding: 8px 14px;
|
||||
}
|
||||
|
||||
.doc-detail-row-inline {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
@@ -1477,4 +1657,48 @@
|
||||
.doc-detail-row-inline > div[style*="grid-column"] {
|
||||
grid-column: auto !important;
|
||||
}
|
||||
|
||||
.doc-viewer-overlay {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.doc-viewer-modal {
|
||||
max-width: 100vw;
|
||||
max-height: 100vh;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.doc-viewer-pdf {
|
||||
width: 100%;
|
||||
height: calc(100vh - 80px);
|
||||
}
|
||||
}
|
||||
|
||||
/* ======================== */
|
||||
/* Responsive (<=480px) */
|
||||
/* ======================== */
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.summary-cards {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.welcome-section h1 {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.doc-item {
|
||||
padding: 10px 12px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
padding: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,18 @@
|
||||
select.value = currentVal;
|
||||
};
|
||||
|
||||
// --- Viewer ---
|
||||
|
||||
app.getViewerType = function (doc) {
|
||||
if (doc.documentType === 'note') return 'text';
|
||||
const mime = (doc.mimeType || '').toLowerCase();
|
||||
if (mime.startsWith('image/')) return 'image';
|
||||
if (mime.startsWith('audio/')) return 'audio';
|
||||
if (mime.startsWith('text/')) return 'text';
|
||||
if (mime === 'application/pdf') return 'pdf';
|
||||
return null;
|
||||
};
|
||||
|
||||
// --- Documents ---
|
||||
|
||||
app.loadDocuments = async function () {
|
||||
@@ -135,6 +147,11 @@
|
||||
|
||||
const aiStatusBadge = app.getAiStatusBadge(doc);
|
||||
|
||||
const viewerType = app.getViewerType(doc);
|
||||
const viewBtn = viewerType
|
||||
? `<button onclick="event.stopPropagation(); medDocsView(${doc.id})">View</button>`
|
||||
: '';
|
||||
|
||||
const downloadBtn = doc.documentType === 'file'
|
||||
? `<button onclick="event.stopPropagation(); medDocsDownload(${doc.id}, '${app.escapeAttr(doc.fileName || 'download')}')">Download</button>`
|
||||
: '';
|
||||
@@ -166,6 +183,7 @@
|
||||
</div>
|
||||
<div class="doc-actions" onclick="event.stopPropagation()">
|
||||
${processBtn}
|
||||
${viewBtn}
|
||||
${downloadBtn}
|
||||
<button class="delete-btn" onclick="medDocsDelete(${doc.id})">Delete</button>
|
||||
</div>
|
||||
@@ -293,6 +311,79 @@
|
||||
document.body.removeChild(a);
|
||||
};
|
||||
|
||||
// --- Document Viewer ---
|
||||
|
||||
let currentBlobUrl = null;
|
||||
|
||||
window.medDocsView = async function (id) {
|
||||
const doc = state.currentDocuments.find(d => d.id === id);
|
||||
if (!doc) return;
|
||||
|
||||
const viewerType = app.getViewerType(doc);
|
||||
if (!viewerType) return;
|
||||
|
||||
const overlay = document.getElementById('docViewerOverlay');
|
||||
const title = document.getElementById('docViewerTitle');
|
||||
const body = document.getElementById('docViewerBody');
|
||||
|
||||
title.textContent = doc.title || doc.fileName || 'Untitled';
|
||||
body.innerHTML = '<div class="doc-viewer-loading">Loading...</div>';
|
||||
overlay.style.display = '';
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
if (doc.documentType === 'note') {
|
||||
body.innerHTML = `<pre class="doc-viewer-text">${app.escapeHtml(doc.description || '')}</pre>`;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch(`${app.API}/documents/${id}/download`);
|
||||
if (!res.ok) {
|
||||
body.innerHTML = '<div class="doc-viewer-error">Failed to load document.</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
const blob = await res.blob();
|
||||
currentBlobUrl = URL.createObjectURL(blob);
|
||||
|
||||
if (viewerType === 'image') {
|
||||
body.innerHTML = `<img class="doc-viewer-image" src="${currentBlobUrl}" alt="${app.escapeAttr(doc.title || doc.fileName || '')}" />`;
|
||||
} else if (viewerType === 'audio') {
|
||||
body.innerHTML = `<audio class="doc-viewer-audio" controls src="${currentBlobUrl}"></audio>`;
|
||||
} else if (viewerType === 'pdf') {
|
||||
body.innerHTML = `<iframe class="doc-viewer-pdf" src="${currentBlobUrl}"></iframe>`;
|
||||
} else if (viewerType === 'text') {
|
||||
const text = await blob.text();
|
||||
body.innerHTML = `<pre class="doc-viewer-text">${app.escapeHtml(text)}</pre>`;
|
||||
URL.revokeObjectURL(currentBlobUrl);
|
||||
currentBlobUrl = null;
|
||||
}
|
||||
} catch {
|
||||
body.innerHTML = '<div class="doc-viewer-error">Error loading document.</div>';
|
||||
}
|
||||
};
|
||||
|
||||
window.medDocsCloseViewer = function (event) {
|
||||
if (event && event.target !== event.currentTarget) return;
|
||||
const overlay = document.getElementById('docViewerOverlay');
|
||||
overlay.style.display = 'none';
|
||||
document.getElementById('docViewerBody').innerHTML = '';
|
||||
document.body.style.overflow = '';
|
||||
if (currentBlobUrl) {
|
||||
URL.revokeObjectURL(currentBlobUrl);
|
||||
currentBlobUrl = null;
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape') {
|
||||
const overlay = document.getElementById('docViewerOverlay');
|
||||
if (overlay && overlay.style.display !== 'none') {
|
||||
window.medDocsCloseViewer();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.medDocsDelete = async function (id) {
|
||||
if (!confirm('Delete this document? This cannot be undone.')) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user