}
});
app.on('login', function(event, webContents, request, authInfo, callback) {
- console.log('Login info is required');
+ console.log(`Login info is required, isproxy: ${authInfo.isProxy}`);
event.preventDefault();
- const id = ++self.pendingID;
- console.log(`Raising a login info request with id: ${id}`);
- self.pendingCallbacks.set(id, callback);
- wrt.handleAuthRequest(id, webContents);
+ let usrname = '';
+ let passwd = '';
+ if (self.isTVProfile && authInfo.isProxy) {
+ let vconfProxy = wrt.getProxy();
+ if (vconfProxy) {
+ let proxyInfo = new URL(vconfProxy);
+ usrname = proxyInfo.username;
+ passwd = proxyInfo.password;
+ }
+ }
+ if (usrname && passwd) {
+ callback(usrname, passwd);
+ } else {
+ const id = ++self.pendingID;
+ console.log(`Raising a login info request with id: ${id}`);
+ self.pendingCallbacks.set(id, callback);
+ wrt.handleAuthRequest(id, webContents);
+ }
});
if (this.isTVProfile) {
// TODO. This logic in only for QA verification
});
}
if (this.accessiblePath) {
- console.log('accessiblePath : ' + this.accessiblePath);
+ console.log(`accessiblePath: ${this.accessiblePath}`);
protocol.interceptFileProtocol('file', (request, callback) => {
- const url = require('url');
- let access_path, parsed_info = url.parse(request.url);
- access_path = parsed_info.host + parsed_info.pathname;
- console.log("check path: " + access_path);
-
- for (let p in self.accessiblePath) {
- if (access_path.startsWith(self.accessiblePath[p])) {
+ if (request.url) {
+ let access_path, parsed_info = new URL(request.url);
+ access_path = parsed_info.host + parsed_info.pathname;
+ console.log(`check path: : ${access_path}`);
+ for (let p in self.accessiblePath) {
+ if (access_path.startsWith(self.accessiblePath[p])) {
+ callback(access_path);
+ return;
+ }
+ }
+ if (access_path.indexOf("/shared/res/") > -1) {
callback(access_path);
return;
}
- }
- if (access_path.indexOf("/shared/res/") > -1) {
- callback(access_path);
- return;
- }
- else {
- console.log("invalid access: " + access_path);
+ else {
+ console.log(`invalid accesspath: ${access_path}`);
+ callback(403);
+ }
+ } else {
+ console.log('request url is empty');
callback(403);
}
}, (error) => {