ci: Improve Docker build workflow and update dependencies
- Add release type detection to distinguish between version tags and edge builds - Implement separate Docker build steps for release and edge builds with appropriate tags - Add edge and SHA-based image tags for main branch builds - Update nginx configuration to support Vietnamese (vi) language routing - Simplify nginx location block to handle static files and fallback to index.html - Remove javascript-obfuscator and ts-migrate from dependencies - Update README with simplified self-hosting instructions using npx http-server - Consolidate multiple server setup examples into single recommended approach - Update build preview command to use npm run preview instead of npx serve - Improve localization files for German, English, Vietnamese, and Chinese - Update worker files and TypeScript logic files for improved functionality - Enhance PDF tool pages with better structure and internationalization support
This commit is contained in:
@@ -14,6 +14,7 @@ const viewerCard = document.getElementById('viewer-card') as HTMLDivElement | nu
|
||||
const saveStampedBtn = document.getElementById('save-stamped-btn') as HTMLButtonElement
|
||||
const backToToolsBtn = document.getElementById('back-to-tools') as HTMLButtonElement | null
|
||||
const toolUploader = document.getElementById('tool-uploader') as HTMLDivElement | null
|
||||
const usernameInput = document.getElementById('stamp-username') as HTMLInputElement | null
|
||||
|
||||
function resetState() {
|
||||
selectedFile = null
|
||||
@@ -158,8 +159,11 @@ async function loadPdfInViewer(file: File) {
|
||||
iframe.className = 'w-full h-full border-0'
|
||||
iframe.allowFullscreen = true
|
||||
|
||||
const viewerUrl = new URL('/pdfjs-annotation-viewer/web/viewer.html', window.location.origin)
|
||||
iframe.src = `${viewerUrl.toString()}?file=${encodeURIComponent(currentBlobUrl)}`
|
||||
const viewerUrl = new URL(import.meta.env.BASE_URL + 'pdfjs-annotation-viewer/web/viewer.html', window.location.origin)
|
||||
const stampUserName = usernameInput?.value?.trim() || ''
|
||||
// ae_username is the hash parameter used by pdfjs-annotation-extension to set the username
|
||||
const hashParams = stampUserName ? `#ae_username=${encodeURIComponent(stampUserName)}` : ''
|
||||
iframe.src = `${viewerUrl.toString()}?file=${encodeURIComponent(currentBlobUrl)}${hashParams}`
|
||||
|
||||
iframe.addEventListener('load', () => {
|
||||
setupAnnotationViewer(iframe)
|
||||
|
||||
@@ -2065,7 +2065,7 @@ async function renderCanvas(): Promise<void> {
|
||||
const blobUrl = URL.createObjectURL(blob)
|
||||
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.src = `/pdfjs-viewer/viewer.html?file=${encodeURIComponent(blobUrl)}#page=${currentPageIndex + 1}&toolbar=0`
|
||||
iframe.src = `${import.meta.env.BASE_URL}pdfjs-viewer/viewer.html?file=${encodeURIComponent(blobUrl)}#page=${currentPageIndex + 1}&toolbar=0`
|
||||
iframe.style.width = '100%'
|
||||
iframe.style.height = `${canvasHeight}px`
|
||||
iframe.style.border = 'none'
|
||||
|
||||
@@ -156,7 +156,7 @@ async function setupFormViewer() {
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
viewerIframe = document.createElement('iframe');
|
||||
viewerIframe.src = `/pdfjs-viewer/viewer.html?file=${encodeURIComponent(blobUrl)}`;
|
||||
viewerIframe.src = `${import.meta.env.BASE_URL}pdfjs-viewer/viewer.html?file=${encodeURIComponent(blobUrl)}`;
|
||||
viewerIframe.style.width = '100%';
|
||||
viewerIframe.style.height = '100%';
|
||||
viewerIframe.style.border = 'none';
|
||||
|
||||
@@ -320,7 +320,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (rotateAllLeft) {
|
||||
rotateAllLeft.addEventListener('click', function () {
|
||||
for (let i = 0; i < pageState.rotations.length; i++) {
|
||||
pageState.rotations[i] = pageState.rotations[i] - 90;
|
||||
pageState.rotations[i] = pageState.rotations[i] + 90;
|
||||
}
|
||||
updateAllRotationDisplays();
|
||||
});
|
||||
@@ -329,7 +329,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (rotateAllRight) {
|
||||
rotateAllRight.addEventListener('click', function () {
|
||||
for (let i = 0; i < pageState.rotations.length; i++) {
|
||||
pageState.rotations[i] = pageState.rotations[i] + 90;
|
||||
pageState.rotations[i] = pageState.rotations[i] - 90;
|
||||
}
|
||||
updateAllRotationDisplays();
|
||||
});
|
||||
|
||||
@@ -181,7 +181,7 @@ async function setupSignTool() {
|
||||
localStorage.setItem('pdfjs.preferences', JSON.stringify(newPrefs));
|
||||
} catch { }
|
||||
|
||||
const viewerUrl = new URL('/pdfjs-viewer/viewer.html', window.location.origin);
|
||||
const viewerUrl = new URL(`${import.meta.env.BASE_URL}pdfjs-viewer/viewer.html`, window.location.origin);
|
||||
const query = new URLSearchParams({ file: signState.blobUrl });
|
||||
iframe.src = `${viewerUrl.toString()}?${query.toString()}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user