Skip to content

Commit

Permalink
FEC-14248-fix-_isAnonimous-base-on-ks-contain-user + remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Roee Dean authored and Roee Dean committed Jan 20, 2025
1 parent 1957f78 commit e2d9b42
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/k-provider/ovp/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,22 @@ export default class OVPProvider extends BaseProvider<OVPProviderMediaInfoObject

this._isAnonymous = !this._ks ? true : undefined;
if (this._isAnonymous === undefined) {
this.initializeUserResponseAsync();
this.initializeUserResponse(OVPConfiguration.serviceUrl, this._ks).catch(err => {
this._logger.error('Failed to initialize user response', err);
});
}
}

public get env(): any {
return OVPConfiguration.get();
}

private async initializeUserResponseAsync(): Promise<void> {
await this.initializeUserResponse(OVPConfiguration.serviceUrl, this._ks);
}

public async initializeUserResponse(serviceUrl: string, ks: string): Promise<void> {
try {
const request = OVPUserService.get(serviceUrl, ks);
request.params = JSON.stringify(request.params);
const response = await request.doHttpRequest();
const userResponse = new KalturaUserGetResponse(response);
this._isAnonymous = userResponse.isAnonymous();
} catch (err) {
this._logger.error('Failed to initialize user response', err);
}
const request = OVPUserService.get(serviceUrl, ks);
request.params = JSON.stringify(request.params);
const response = await request.doHttpRequest();
const userResponse = new KalturaUserGetResponse(response);
this._isAnonymous = userResponse.isAnonymous();
}

/**
Expand Down

0 comments on commit e2d9b42

Please sign in to comment.