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

Handlers based on file extension, rather than MIME #2008

Closed
Tracked by #1
ChristophWurst opened this issue Oct 19, 2023 · 2 comments
Closed
Tracked by #1

Handlers based on file extension, rather than MIME #2008

ChristophWurst opened this issue Oct 19, 2023 · 2 comments
Assignees
Labels
2. developing Work in progress enhancement New feature or request

Comments

@ChristophWurst
Copy link
Member

Is your feature request related to a problem? Please describe.

I would like to extend the Viewer with a new file type. Unfortunately the file doesn't have a standardized MIME type. On Linux it is detected as application/octet-stream.

Describe the solution you'd like

Allow registering handlers based on file extensions as well:

 OCA.Viewer.registerHandler({
     // unique id
     id: 'emf',

    // optional, it will group every view of this group and
    // use the proper view when building the file list
    // of the slideshow.
    // e.g. you open an image/jpeg that have the `media` group
    // you will be able to see the video/mpeg from the `video` handler
    // files that also have the `media` group set.
    group: 'media',

    // the list of mimes your component is able to display
    mimes: [],

    fileExtensions: [
        'emf',
    ],

     // your vue component view
     component: VideoView
 })

Describe alternatives you've considered

N/a

Additional context

nextcloud/files_emfviewer#1 is the feature.

@ChristophWurst ChristophWurst added enhancement New feature or request 0. Needs triage Pending approval or rejection. This issue is pending approval. labels Oct 19, 2023
@skjnldsv
Copy link
Member

skjnldsv commented Oct 19, 2023

For me this would be for Viewer 3.0, where, following the same pattern as FileAction and NewFileEntry APIs, you can register conditional handlers with whatever you need. We would expose this as a library and only allow a Node with optional array of Node

new FileAction({
	...
	enabled(nodes: Node[]) {
		// Only works on single node
		if (nodes.length !== 1) {
			return false
		}

		return (nodes[0].permissions & Permission.UPDATE) !== 0
	},
	...
})

@ChristophWurst ChristophWurst self-assigned this Oct 24, 2023
@ChristophWurst ChristophWurst added 2. developing Work in progress and removed 0. Needs triage Pending approval or rejection. This issue is pending approval. labels Oct 24, 2023
@ChristophWurst
Copy link
Member Author

This is obsolete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants