feat: Add support for options using native messaging#138
Conversation
|
The reason I didn't include options in there it is because it feels risky that any extension can send arbitrary flags that are eval'ed by python. I would propose to add a request to get the profiles. browser.runtime.sendMessage('ff2mpv@yossarian.net', { type: 'getProfiles' })
// returns list of profiles e.g. [{ name: 'foo', id: 'id' }]
// so calling extension can known available profiles
// "id" for identification and "name" for user facing displayThen improve the browser.runtime.sendMessage('ff2mpv@yossarian.net', { type: 'openVideo', url: 'https://someurl.com', profileId: 'id' })We then get the options from the profileId if provided and a matching profile exists. So we guarantee that only the options that the user entered are the only ones passed to python (u other backends). |
|
Yeah, I think this should go through the existing profiles mechanism -- I strongly agree that allowing third-party extensions to pass arbitrary mpv flags without a user having to pre-configure them in a profile would represent a security risk. |
|
I've just resolve the two edge cases and confirm to work as expected from
So now from
@DanSM-5 @woodruffw Thank you for your clarification on the subject in matter. |
DanSM-5
left a comment
There was a problem hiding this comment.
Very minor comments with the formatting but LGTM
| switch (type) { | ||
| case OPEN_VIDEO: | ||
| ff2mpv(url); | ||
| let optionsPromise; |
There was a problem hiding this comment.
Looks like this line requires extra indentation
| optionsPromise = Promise.resolve([]); | ||
| } | ||
| optionsPromise.then((options) => { | ||
| ff2mpv(url, tabId, options); |
There was a problem hiding this comment.
The call to ff2mpv and the return also requires some extra indentation :)




An expansion to woodruffw/ff2mpv#113, to send options through native messaging.
As referenced in gdh1995/vimium-c/issues#1077
Example of use using JS:
Using vimium-c:
1.Add to
Custom key mappings:Custom search engines:This is very useful, as you can now open different video resolutions using various key mappings.
Note: Currently can only send one option, i couldn't find a way to send multiple options. Hopefully someone can help with this.