Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/files_pdfviewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/files_pdfviewer-main.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions js/files_pdfviewer-public.js

This file was deleted.

23 changes: 0 additions & 23 deletions js/files_pdfviewer-public.js.license

This file was deleted.

1 change: 0 additions & 1 deletion js/files_pdfviewer-public.js.map

This file was deleted.

1 change: 0 additions & 1 deletion js/files_pdfviewer-public.js.map.license

This file was deleted.

3 changes: 0 additions & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace OCA\Files_PDFViewer\AppInfo;

use OCA\Files_PDFViewer\Listeners\CSPListener;
use OCA\Files_PDFViewer\Listeners\LoadPublicViewerListener;
use OCA\Files_PDFViewer\Listeners\LoadViewerListener;

use OCA\Viewer\Event\LoadViewer;
Expand All @@ -17,7 +16,6 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\Security\CSP\AddContentSecurityPolicyEvent;

class Application extends App implements IBootstrap {
Expand All @@ -29,7 +27,6 @@ public function __construct() {

public function register(IRegistrationContext $context): void {
$context->registerEventListener(LoadViewer::class, LoadViewerListener::class);
$context->registerEventListener(BeforeTemplateRenderedEvent::class, LoadPublicViewerListener::class);
$context->registerEventListener(AddContentSecurityPolicyEvent::class, CSPListener::class);
}

Expand Down
32 changes: 0 additions & 32 deletions lib/Listeners/LoadPublicViewerListener.php

This file was deleted.

78 changes: 0 additions & 78 deletions src/public.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/utils/hideDownload.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/utils/isPdf.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/utils/isPublicPage.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/utils/isSecureViewerAvailable.js

This file was deleted.

21 changes: 7 additions & 14 deletions src/views/PDFView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import { getLanguage } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import logger from '../services/logger.js'
import uploadPdfFile from '../services/uploadPdfFile.js'
import hideDownload from '../utils/hideDownload.js'
import isPdf from '../utils/isPdf.js'
import isPublicPage from '../utils/isPublicPage.js'

export default {
name: 'PDFView',
Expand All @@ -45,6 +42,10 @@ export default {
return this.fileList.find((file) => file.fileid === this.fileid)
},

hideDownload() {
return this.file.hideDownload
},

isDownloadable() {
if (!this.file.shareAttributes) {
return true
Expand All @@ -69,11 +70,11 @@ export default {
},

async mounted() {
if (!this.isDownloadable) {
if (!this.isDownloadable || (this.hideDownload && this.isRichDocumentsAvailable)) {
this.doneLoading()

if (this.isRichDocumentsAvailable) {
console.info('PDF file is not downloadable, but "richdocuments" is available, so falling back to it')
console.info('PDF file is not downloadable or has a hidden download, but "richdocuments" is available, so falling back to it')

// Opening the viewer again overwrites its current state, so the
// current options need to be explicitly passed again.
Expand All @@ -94,14 +95,6 @@ export default {

document.addEventListener('webviewerloaded', this.handleWebviewerloaded)

if (isPublicPage() && isPdf()) {
// Force style for public shares of a single PDF file, as there are
// no CSS selectors that could be used only for that case.
this.$refs.iframe.style.height = '100%'
this.$refs.iframe.style.position = 'absolute'
this.$refs.iframe.style.marginTop = 'unset'
}

this.doneLoading()
this.$nextTick(function() {
this.$el.focus()
Expand Down Expand Up @@ -205,7 +198,7 @@ export default {
}
})

if (hideDownload()) {
if (this.hideDownload) {
const pdfViewer = this.getIframeDocument().querySelector('.pdfViewer')

if (pdfViewer) {
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const { readdirSync } = require('fs')
const l10nContent = readdirSync(path.resolve(__dirname, 'js', 'pdfjs', 'web', 'locale'))

webpackConfig.entry.workersrc = path.resolve(path.join('src', 'workersrc.js'))
webpackConfig.entry.public = path.resolve(path.join('src', 'public.js'))

// keep pdfjs vendor in the js folder
webpackConfig.output.clean = false
Expand Down
Loading