Headers, credentials and base64 certificate#16
Conversation
'certificate' as a base64string 'licenseRequestHeaders' as a function to call to add any headers that might be needed 'withCredentials' so we can send cookies with the license request
licenseRequestHeaders as an object makes more sense.
|
Just switched to an object for the request headers, am looking at passing back some information on the response too :) |
|
Any update on this pull request? Being able to override headers is an extremely handy feature to have |
|
@chris-heathwood-piksel i seriously hope you forked this; idk why i sporadically get emails from github. i am no longer working on video stuff, but i can do a cursory review this week and merge a year later :X |
chemoish
left a comment
There was a problem hiding this comment.
Overall comment, it would be easier to merge and review if the changes were separated and there was a brief description to the reasons behind the changes.
| logToBrowserConsole = value; | ||
| } | ||
|
|
||
| ab2str(buf) { |
| tech.isReady_ = false; | ||
|
|
||
| if (this.protection_.certificate) { | ||
| this.log('Using base64 encoded certificate set on the source protection.'); |
There was a problem hiding this comment.
is there value to log to indicate a parameter has been set?
|
|
||
| if (this.protection_.certificate) { | ||
| this.log('Using base64 encoded certificate set on the source protection.'); | ||
| certificate = base64DecodeUint8Array(this.protection_.certificate); |
There was a problem hiding this comment.
is it worth it to refactor?
// from
let certificate;
// to
if (this.protection._certificate) {
this.setCertificate(this.protection._certificate);
}
setCertificate(certificate) {
// can normalize input later and or just leave it simple—would also need to update references
this.certificate = certificate;
}| } | ||
|
|
||
| return all; | ||
| }, |
| this.onRequestError(event.target, ERROR_TYPE.FETCH_LICENCE); | ||
|
|
||
| // Return response content | ||
| if (licenseResponseErrorContent && typeof licenseResponseErrorContent === 'function') { |
There was a problem hiding this comment.
licenseResponseErrorContent => licenseLoadError is there a better name or something more applicable?
is an inverse needed? licenseLoadSuccess? licenseLoadHeaders?
|
|
||
| // Return response headers here | ||
| if (licenseResponseHeaders && typeof licenseResponseHeaders === 'function') { | ||
| const headers = event.target.getAllResponseHeaders().split('\r\n').reduce((all, part) => { |
There was a problem hiding this comment.
i would chuck this in a method somewhere to facilitate legibility and if its needed in another method.
createHeadersFromResponseHeaders or something.
| // Optional settings | ||
|
|
||
| // Instead of a certificateUrl send the cert in a string | ||
| certificate: 'base64string', |
There was a problem hiding this comment.
i would stick this next to certificateUrl and indicate either or.
| certificate: 'base64string', | ||
|
|
||
| // Object to add any extra license request headers that might be needed | ||
| licenseRequestHeaders: { |
There was a problem hiding this comment.
can this just be headers? is there multiple headers that need to be set to indicate and prefix a type (licenseRequest)?
| }, | ||
|
|
||
| // Function to call back with license response content if it errors | ||
| licenseResponseErrorContent: function (content) { |
There was a problem hiding this comment.
see some of the comments below, ideally I would like to consolidate naming to one specific style.
shooting from the hip;
onLicenseLoad(can be changed if needed)onLicenseError({ error })onLicenseSuccess({ headers })
signatures would be able to be grouped and are conventionally named, they can be enhanced with data as needed.
| certificateUrl: '/path/to/certificate', | ||
| licenseUrl: '/path/to/license', | ||
|
|
||
| // Optional settings |
There was a problem hiding this comment.
Ideally, options would be separated and described in an options section.
See https://github.com/chemoish/videojs-bif#options or whatever similar.
|
Feel free to email me directly if you still need these changes, I will prioritize whatever you need. Again, apologies for not seeing this sooner. |
Hi,
Hope it is ok created the PR with some extra optional settings.
It would be great if this could make it in to npm :)
Thanks
Chris H