Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[full-ci] Support audio formats in MediaViewer App & rename it to Preview #6514

Merged
merged 12 commits into from
Apr 6, 2022
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
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ labels:
color: "#d4c5f9"
- name: feature:pdf-viewer
color: "#d4c5f9"
- name: feature:media-viewer
- name: feature:preview
color: "#d4c5f9"

...
5 changes: 5 additions & 0 deletions changelog/unreleased/enhancement-preview-audio-support
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Audio support in preview app

We've added support for audio file playback into the preview app (namely flac, mp3, wav and ogg).

https://github.com/owncloud/web/pull/6514
7 changes: 7 additions & 0 deletions changelog/unreleased/enhancement-rename-mediaviewer
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Rename mediaviewer to preview

We've renamed the media-viewer app to preview because that describes the purpose of the app better and doesn't mislead users into thinking that it's a full blown media viewer.

For the time being we've added an app alias handling to ownCloud Web which prints a deprecation warning if the preview app is tried to be loaded as `media-viewer`.

https://github.com/owncloud/web/pull/6514
4 changes: 2 additions & 2 deletions config/config.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"apps" : [
"files",
"draw-io",
"media-viewer",
"preview",
"user-management",
"pdf-viewer",
"pdf-viewer",
"search"
],
"applications" : []
Expand Down
2 changes: 1 addition & 1 deletion config/config.json.sample-oc10
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"apps": [
"files",
"media-viewer",
"preview",
"pdf-viewer",
"search"
],
Expand Down
2 changes: 1 addition & 1 deletion config/config.json.sample-ocis
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"apps": [
"files",
"media-viewer",
"preview",
"pdf-viewer",
"search",
"external",
Expand Down
2 changes: 1 addition & 1 deletion dev/docker/oc10.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"apps": [
"files",
"media-viewer",
"preview",
"markdown-editor",
"pdf-viewer",
"search"
Expand Down
2 changes: 1 addition & 1 deletion dev/docker/ocis.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"apps": [
"files",
"markdown-editor",
"media-viewer",
"preview",
"pdf-viewer",
"search",
"external",
Expand Down
2 changes: 1 addition & 1 deletion docs/custom-apps/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ To be defined/documented (Bundling, CDN, app store, ...)
```
To be defined/documented
- Application (renderable), e.g. iFrame
- Extension, e.g. media-viewer
- Extension, e.g. preview
- Quick action, e.g. based on WOPI/Appserver
- ...
```
Expand Down
2 changes: 1 addition & 1 deletion docs/deployments/oc10-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ There are a few config values which need to be set in order for ownCloud Web to
},
"apps" : [
"files",
"media-viewer",
"preview",
"draw-io"
],
"applications" : [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"packages/web-app-external",
"packages/web-app-files",
"packages/web-app-markdown-editor",
"packages/web-app-media-viewer",
"packages/web-app-preview",
"packages/web-app-user-management",
"packages/web-app-pdf-viewer",
"packages/web-app-search",
Expand Down
20 changes: 19 additions & 1 deletion packages/web-app-files/src/mixins/fileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export default {
.map((editor) => {
return {
label: () => {
if (editor.label) {
return this.$gettext(editor.label)
}
const translated = this.$gettext('Open in %{app}')
return this.$gettextInterpolate(
translated,
Expand All @@ -77,6 +80,9 @@ export default {
)
},
icon: this.apps.meta[editor.app].icon,
...(this.apps.meta[editor.app].iconFillType && {
iconFillType: this.apps.meta[editor.app].iconFillType
}),
img: this.apps.meta[editor.app].img,
handler: ({ resources }) =>
this.$_fileActions_openEditor(
Expand All @@ -90,7 +96,19 @@ export default {
return false
}

return resources[0].extension.toLowerCase() === editor.extension.toLowerCase()
if (resources[0].extension && editor.extension) {
return resources[0].extension.toLowerCase() === editor.extension.toLowerCase()
}

if (resources[0].mimeType && editor.mimeType) {
return (
resources[0].mimeType.toLowerCase() === editor.mimeType.toLowerCase() ||
resources[0].mimeType.split('/')[0].toLowerCase() ===
editor.mimeType.toLowerCase()
)
}

return false
},
canBeDefault: editor.canBeDefault,
componentType: 'oc-button',
Expand Down
20 changes: 10 additions & 10 deletions packages/web-app-files/tests/__fixtures__/fileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const meta = {
id: 'files',
icon: 'folder'
},
mediaviewer: {
name: 'Mediaviewer',
id: 'mediaviewer',
preview: {
name: 'Preview',
id: 'preview',
icon: 'image'
},
'draw-io': {
Expand Down Expand Up @@ -40,12 +40,12 @@ const editors = [
routes
},
{
app: 'mediaviewer',
app: 'preview',
extension: 'png',
handler: null,
icon: null,
newTab: false,
routeName: 'mediaviewer-media',
routeName: 'preview-media',
routes
},
{
Expand Down Expand Up @@ -145,11 +145,11 @@ const fileActions = {
selector: '.oc-files-actions-draw-io-trigger',
opensInNewWindow: true
},
mediaviewer: {
preview: {
handler: jest.fn(),
label: () => 'Open in MediaViewer',
class: 'oc-files-actions-mediaviewer-trigger',
selector: '.oc-files-actions-mediaviewer-trigger'
label: () => 'Open in Preview',
class: 'oc-files-actions-preview-trigger',
selector: '.oc-files-actions-preview-trigger'
},
navigate: {
name: 'navigate',
Expand All @@ -165,7 +165,7 @@ const fileActions = {
exports.fileActions = fileActions

exports.getActions = function (actions = []) {
const defaultActions = ['download', 'markdown-editor', 'draw-io', 'mediaviewer', 'navigate']
const defaultActions = ['download', 'markdown-editor', 'draw-io', 'preview', 'navigate']

const res = []
for (const key of actions) {
Expand Down
6 changes: 0 additions & 6 deletions packages/web-app-media-viewer/package.json

This file was deleted.

69 changes: 0 additions & 69 deletions packages/web-app-media-viewer/src/index.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/web-app-pdf-viewer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const routes = [
const appInfo = {
name: $gettext('PDF Viewer'),
id: 'pdf-viewer',
icon: 'eye',
icon: 'resource-type-pdf',
iconFillType: 'fill',
extensions: [
{
extension: 'pdf',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[main]
host = https://www.transifex.com

[owncloud-web.media-viewer]
[owncloud-web.preview]
file_filter = locale/<lang>/LC_MESSAGES/app.po
minimum_perc = 0
source_file = template.pot
Expand Down
6 changes: 6 additions & 0 deletions packages/web-app-preview/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "preview",
"version": "0.0.0",
"description": "ownCloud Web Preview",
"license": "AGPL-3.0"
}
Loading