This commit is contained in:
Tomas Mirchev 2025-06-27 01:10:58 +00:00
parent 8ba181d1fa
commit 7fda18edd7
5 changed files with 34 additions and 13 deletions

View File

@ -151,4 +151,4 @@ Please report this to https://github.com/markedjs/marked.`,a){const r="<p>An err
${f} ${f}
</body> </body>
</html> </html>
`,[f,u,r,s]),[b,h]=M.useState(!0),[g,w]=M.useState(null),E=Ce(U=>U.config.contentZoomLevel);return M.useEffect(()=>{o.current&&o.current.contentDocument&&(o.current.contentDocument.body.style.zoom=`${E}%`)},[E]),M.useEffect(()=>{(async()=>{try{h(!0);let k=(await km.get(`/${a.filename}`)).data;k===""&&(k="**No Data!**"),k=be.parse(k),p(k),w(null)}catch(T){console.error("Error loading file:",T),w(T.message)}finally{h(!1)}})()},[a]),g?R.jsxs("div",{className:"text-red-500 p-4 border border-red-300 rounded",children:["Error: ",g]}):b?R.jsx(Gx,{}):R.jsx("div",{className:"w-full h-full overflow-hidden",children:R.jsx("iframe",{ref:o,srcDoc:m,title:`File: ${a.id}`,className:"w-full h-full border-0",allow:"fullscreen",onLoad:()=>{var U,T;(T=(U=o.current)==null?void 0:U.contentDocument)!=null&&T.body&&(o.current.contentDocument.body.style.zoom=`${E}%`)}},a.id)})}const Gx=({delayMs:a=2e3,className:u="p-4 flex justify-center items-center h-40",text:s="Loading..."})=>{const[r,o]=M.useState(!1);return M.useEffect(()=>{const f=setTimeout(()=>{o(!0)},a);return()=>clearTimeout(f)},[]),r?R.jsx("div",{className:u,children:R.jsx("div",{className:"animate-pulse",children:s})}):null};Sy.createRoot(document.getElementById("root")).render(R.jsx(M.StrictMode,{children:R.jsx(Ux,{})})); `,[f,u,r,s]),[b,h]=M.useState(!0),[g,w]=M.useState(null),E=Ce(U=>U.config.contentZoomLevel);return M.useEffect(()=>{o.current&&o.current.contentDocument&&(o.current.contentDocument.body.style.zoom=`${E}%`)},[E]),M.useEffect(()=>{(async()=>{try{h(!0);let k=(await km.get(`/${a.filename}`)).data;k===""&&(k="**No Data!**"),k=be.parse(k),p(k),w(null)}catch(T){console.error("Error loading file:",T),w(T.message)}finally{h(!1)}})()},[a]),g?R.jsxs("div",{className:"text-red-500 p-4 border border-red-300 rounded",children:["Error: ",g]}):b?R.jsx(Gx,{}):R.jsx("div",{className:"w-full h-full overflow-hidden",children:R.jsx("iframe",{ref:o,srcDoc:m,title:`File: ${a.id}`,className:"w-full h-full border-0",sandbox:"allow-same-origin",allow:"fullscreen",onLoad:()=>{var U,T;(T=(U=o.current)==null?void 0:U.contentDocument)!=null&&T.body&&(o.current.contentDocument.body.style.zoom=`${E}%`)}},a.id)})}const Gx=({delayMs:a=2e3,className:u="p-4 flex justify-center items-center h-40",text:s="Loading..."})=>{const[r,o]=M.useState(!1);return M.useEffect(()=>{const f=setTimeout(()=>{o(!0)},a);return()=>clearTimeout(f)},[]),r?R.jsx("div",{className:u,children:R.jsx("div",{className:"animate-pulse",children:s})}):null};Sy.createRoot(document.getElementById("root")).render(R.jsx(M.StrictMode,{children:R.jsx(Ux,{})}));

View File

@ -4,10 +4,9 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Конспект</title> <title>Конспект</title>
<script type="module" crossorigin src="/assets/index-4n2TtMCZ.js"></script> <script type="module" crossorigin src="/assets/index-uQMIeWPE.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D8a8nrqF.css"> <link rel="stylesheet" crossorigin href="/assets/index-D8a8nrqF.css">
</head> </head>

View File

@ -4,8 +4,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Конспект</title> <title>Конспект</title>
</head> </head>

View File

@ -4,15 +4,37 @@ server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
# Handle React Router (SPA) # Never cache HTML files - ADD THIS
location ~* \.html$ {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
}
# Special handling for root index.html - ADD THIS
location = / {
try_files /index.html =404;
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
}
# Handle React Router (SPA) - MODIFY THIS
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ @fallback;
} }
# Cache static assets # Fallback for SPA routing - ADD THIS
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { location @fallback {
rewrite ^.*$ /index.html last;
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
}
# Cache static assets with hashes - EXPAND THIS
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y; expires 1y;
add_header Cache-Control "public, immutable"; add_header Cache-Control "public, immutable" always;
} }
} }

View File

@ -468,6 +468,7 @@ export function PDFViewer({ file, compact, zoomFactor, justifyText }) {
title={`File: ${file.id}`} title={`File: ${file.id}`}
className="w-full h-full border-0" className="w-full h-full border-0"
key={file.id} key={file.id}
sandbox="allow-same-origin"
allow="fullscreen" allow="fullscreen"
onLoad={() => { onLoad={() => {
if (iframeRef.current?.contentDocument?.body) { if (iframeRef.current?.contentDocument?.body) {