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
21 changes: 13 additions & 8 deletions cypress/e2e/single-file-share.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import { randHash } from '../utils/'
import { randHash } from '../utils/index.js'
const randUser = randHash()

describe('See shared folder with link share', function() {
Expand All @@ -30,27 +30,32 @@ describe('See shared folder with link share', function() {
before(function() {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')

cy.uploadFile('image1.jpg', 'image/jpeg')
cy.uploadFile('video1.mp4', 'video/mp4')
cy.createLinkShare('/image1.jpg').then(token => imageToken = token)
cy.createLinkShare('/video1.mp4').then(token => videoToken = token)
cy.createLinkShare('/image1.jpg').then(token => { imageToken = token })
cy.createLinkShare('/video1.mp4').then(token => { videoToken = token })

cy.logout()
})


it('opens the shared image in the viewer', function() {
it('Opens the shared image in the viewer', function() {
cy.visit(`/s/${imageToken}`)

cy.get('#imgframe img').should('be.visible')
cy.get('#imgframe > #viewer').should('be.visible')
cy.scrollTo('bottom')

cy.scrollTo('bottom', { ensureScrollable: false })
cy.get('a#downloadFile').should('be.visible')
})

it('opens the shared video in the viewer', function() {
it('Opens the shared video in the viewer', function() {
cy.visit(`/s/${videoToken}`)

cy.get('#imgframe .plyr').should('be.visible')
cy.get('#imgframe > #viewer').should('be.visible')
cy.scrollTo('bottom')

cy.scrollTo('bottom', { ensureScrollable: false })
cy.get('a#downloadFile').should('be.visible')
})
})
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image2-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/non-dav-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/video-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

62 changes: 38 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "viewer",
"description": "Simple file viewer with slideshow for media",
"version": "1.9.0",
"version": "2.0.0",
"author": "John Molakvoæ <[email protected]>",
"contributors": [
"John Molakvoæ <[email protected]>"
Expand Down Expand Up @@ -48,7 +48,7 @@
"@nextcloud/logger": "^2.3.0",
"@nextcloud/paths": "^2.1.0",
"@nextcloud/router": "^2.0.0",
"@nextcloud/vue": "^6.0.0-beta.4",
"@nextcloud/vue": "^7.0.0-beta.4",
"@skjnldsv/vue-plyr": "^7.3.0",
"camelcase": "^7.0.0",
"debounce": "^1.2.1",
Expand Down Expand Up @@ -77,7 +77,7 @@
"@nextcloud/stylelint-config": "^2.2.0",
"@nextcloud/webpack-vue-config": "^5.3.0",
"babel-loader-exclude-node-modules-except": "^1.2.1",
"cypress": "^10.6.0",
"cypress": "^10.8.0",
"cypress-visual-regression": "^1.7.0",
"eslint-plugin-cypress": "^2.12.1",
"jest": "^28.1.3",
Expand Down
16 changes: 8 additions & 8 deletions src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ export default {

asyncComputed: {
data() {
if (this.mime === 'image/svg+xml') {
return this.getBase64FromImage()
}

if (this.source) {
return this.source
}

switch (this.mime) {
case 'image/svg+xml':
return this.getBase64FromImage()
case 'image/gif':
return this.davPath
default:
return this.previewpath
if (this.mime === 'image/gif') {
return this.src
}
return this.previewPath
},
},
watch: {
Expand Down Expand Up @@ -137,7 +137,7 @@ export default {
* @return {string}
*/
async getBase64FromImage() {
const file = await axios.get(this.davPath)
const file = await axios.get(this.src)
return `data:${this.mime};base64,${btoa(file.data)}`
},

Expand Down
2 changes: 1 addition & 1 deletion src/mixins/PreviewUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
*
* @return {string}
*/
previewpath() {
previewPath() {
return this.getPreviewIfAny({
fileid: this.fileid,
source: this.source,
Expand Down
2 changes: 1 addition & 1 deletion src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export default {
return this.Viewer.loadMore
},
canLoop() {
return false
return this.Viewer.canLoop
},
canZoom() {
return !this.Viewer.el
Expand Down