Revert "Fix: respect baseURI for pdfjs worker URL"
This reverts commit b91c7db3e004cf981f0b2782d4bab1bf82bab742.
This commit is contained in:
parent
a4d6cab03b
commit
594226d5a4
@ -33,7 +33,6 @@ import type {
|
||||
ZoomScale,
|
||||
} from './typings'
|
||||
import { PDFSinglePageViewer } from 'pdfjs-dist/web/pdf_viewer'
|
||||
import { environment } from 'src/environments/environment'
|
||||
|
||||
PDFJS['verbosity'] = PDFJS.VerbosityLevel.ERRORS
|
||||
|
||||
@ -232,8 +231,7 @@ export class PdfViewerComponent
|
||||
private element: ElementRef<HTMLElement>,
|
||||
private ngZone: NgZone
|
||||
) {
|
||||
PDFJS.GlobalWorkerOptions['workerSrc'] =
|
||||
`${environment.baseUrl}assets/js/pdf.worker.min.js`
|
||||
PDFJS.GlobalWorkerOptions['workerSrc'] = '/assets/js/pdf.worker.min.js'
|
||||
}
|
||||
|
||||
ngAfterViewChecked(): void {
|
||||
|
@ -194,19 +194,20 @@ describe('ShareLinksDropdownComponent', () => {
|
||||
})
|
||||
|
||||
it('should correctly generate share URLs', () => {
|
||||
environment.baseUrl = 'http://example.com/'
|
||||
environment.apiBaseUrl = 'http://example.com/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.com/share/123abc123'
|
||||
)
|
||||
environment.baseUrl = 'http://example.domainwithapiinit.com/'
|
||||
environment.apiBaseUrl = 'http://example.domainwithapiinit.com/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.domainwithapiinit.com/share/123abc123'
|
||||
)
|
||||
environment.baseUrl = 'http://example.domainwithapiinit.com:1234/'
|
||||
environment.apiBaseUrl = 'http://example.domainwithapiinit.com:1234/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.domainwithapiinit.com:1234/share/123abc123'
|
||||
)
|
||||
environment.baseUrl = 'http://example.domainwithapiinit.com:1234/subpath/'
|
||||
environment.apiBaseUrl =
|
||||
'http://example.domainwithapiinit.com:1234/subpath/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.domainwithapiinit.com:1234/subpath/share/123abc123'
|
||||
)
|
||||
|
@ -80,7 +80,10 @@ export class ShareLinksDropdownComponent implements OnInit {
|
||||
}
|
||||
|
||||
getShareUrl(link: PaperlessShareLink): string {
|
||||
return `${environment.baseUrl}share/${link.slug}`
|
||||
const apiURL = new URL(environment.apiBaseUrl)
|
||||
return `${apiURL.origin}${apiURL.pathname.replace(/\/api\/$/, '/share/')}${
|
||||
link.slug
|
||||
}`
|
||||
}
|
||||
|
||||
getDaysRemaining(link: PaperlessShareLink): string {
|
||||
|
@ -2,8 +2,7 @@ const base_url = new URL(document.baseURI)
|
||||
|
||||
export const environment = {
|
||||
production: true,
|
||||
baseUrl: base_url,
|
||||
apiBaseUrl: `${base_url}api/`,
|
||||
apiBaseUrl: document.baseURI + 'api/',
|
||||
apiVersion: '3',
|
||||
appTitle: 'Paperless-ngx',
|
||||
version: '2.1.0-dev',
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
baseUrl: 'http://localhost:8000/',
|
||||
apiBaseUrl: 'http://localhost:8000/api/',
|
||||
apiVersion: '3',
|
||||
appTitle: 'Paperless-ngx',
|
||||
|
Loading…
x
Reference in New Issue
Block a user