Skip to content

Commit

Permalink
Move pdfjs on build and directly fetch file
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel committed Sep 12, 2024
1 parent 088dffb commit ed4e1b1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 59 deletions.
5 changes: 5 additions & 0 deletions client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"glob": "**/*",
"input": "node_modules/cm-chessboard/assets/",
"output": "/chess/"
},
{
"glob": "**/*",
"input": "node_modules/pdfjs-dist/legacy/build/",
"output": "/pdfjs/"
}
],
"styles": ["src/styles.scss"],
Expand Down
1 change: 0 additions & 1 deletion client/ngsw-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"version": 2,
"assetGroups": [
{
"name": "app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { IMAGE_MIMETYPES, PDF_MIMETYPES } from 'src/app/site/pages/meetings/pages/mediafiles';

import { BaseSlideComponent } from '../../../base/base-slide-component';
import { SlideMediafileService } from '../../../services/slide-mediafile.service';
import { MediafileSlideData } from '../mediafile-slide-data';

@Component({
Expand All @@ -12,13 +11,7 @@ import { MediafileSlideData } from '../mediafile-slide-data';
})
export class MediafileSlideComponent extends BaseSlideComponent<MediafileSlideData> {
public get url(): string {
if (this.projector && this.projector.id) {
const url = this.slideMediafileService.getMediafileSync(this.projector.id, this.data.data.id);

return url?.data || ``;
}

return ``;
return `/system/media/get/${this.data.data.id}`;
}

public get scroll(): number {
Expand All @@ -45,11 +38,8 @@ export class MediafileSlideComponent extends BaseSlideComponent<MediafileSlideDa
return this.data.options[`fullscreen`] ?? true;
}

public constructor(private slideMediafileService: SlideMediafileService) {
public constructor() {
super();
(window as any).pdfWorkerSrc = new URL(
`pdfjs-dist/legacy/build/pdf.worker.min.mjs`,
import.meta.url
).toString();
(window as any).pdfWorkerSrc = new URL(`pdfjs/pdf.worker.min.mjs`, import.meta.url).toString();
}
}

This file was deleted.

4 changes: 4 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ http {
index index.html index.htm;
include /etc/nginx/mime.types;

types {
application/javascript js mjs;
}

client_max_body_size 100M;

gzip on;
Expand Down

0 comments on commit ed4e1b1

Please sign in to comment.