feat: attachments panel, file previews, print preview and history (#34)
Documents need to show, upload and generate their files from the interface, and users need to see who changed a record. This adds the attachment list (upload, preview, download, lock, trash and restore, older versions, ZIP, generate/regenerate), in-app previews for PDF, images, XML, text, CSV and XLSX, an A4 print preview with "save as attachment", and an audit history list read through a permission-checked AuditTrailService. Files are served by /files endpoints that require a signed-in user and the company permissions; only PDF and images open inline, with their own CSP that allows framing by this site only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f415dc37a8
commit
8198e0a754
20 files changed
+1786
-24
No files matched your search
@@ -20,12 +20,18 @@ internal static class KhaemhatMiddleware
|
||||
{
|
||||
context.Response.OnStarting(() =>
|
||||
{
|
||||
// A file shown in the preview of the attachments sets its own, narrower policy that allows this site only
|
||||
// to frame it (FileEndpoints); every other response gets the default.
|
||||
var headers = context.Response.Headers;
|
||||
headers.ContentSecurityPolicy =
|
||||
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; " +
|
||||
"connect-src 'self'; frame-ancestors 'none'; form-action 'self'; base-uri 'self'; object-src 'none'";
|
||||
if (headers.ContentSecurityPolicy != FileEndpoints.InlinePolicy)
|
||||
{
|
||||
headers.ContentSecurityPolicy =
|
||||
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; " +
|
||||
"connect-src 'self'; frame-ancestors 'none'; form-action 'self'; base-uri 'self'; object-src 'none'";
|
||||
headers.XFrameOptions = "DENY";
|
||||
}
|
||||
|
||||
headers.XContentTypeOptions = "nosniff";
|
||||
headers.XFrameOptions = "DENY";
|
||||
headers["Referrer-Policy"] = "same-origin";
|
||||
headers["Permissions-Policy"] = "camera=(), microphone=(), geolocation=(), payment=()";
|
||||
headers["Cross-Origin-Opener-Policy"] = "same-origin";
|
||||
|
||||
Reference in new issue
Block a user