Skip to content

Commit

Permalink
refactor(referrerPolicy): enable custom referrerPolicy
Browse files Browse the repository at this point in the history
Fixes peers#955
  • Loading branch information
jonasgloning committed May 17, 2022
1 parent 510c974 commit c32d1d6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class API {
url.searchParams.set("ts", `${Date.now()}${Math.random()}`);
url.searchParams.set("version", version);
return fetch(url.href, {
referrerPolicy: "strict-origin-when-cross-origin",
referrerPolicy: this._options.referrerPolicy,
});
}

Expand Down
1 change: 1 addition & 0 deletions lib/optionInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface PeerJSOption {
token?: string;
config?: RTCConfiguration;
debug?: number;
referrerPolicy?: ReferrerPolicy;
}

export interface PeerConnectOption {
Expand Down
2 changes: 2 additions & 0 deletions lib/peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class PeerOptions implements PeerJSOption {
config?: any;
secure?: boolean;
pingInterval?: number;
referrerPolicy?: ReferrerPolicy;
logFunction?: (logLevel: LogLevel, ...rest: any[]) => void;
}

Expand Down Expand Up @@ -164,6 +165,7 @@ export class Peer extends EventEmitter<PeerEvents> {
key: Peer.DEFAULT_KEY,
token: util.randomToken(),
config: util.defaultConfig,
referrerPolicy: "strict-origin-when-cross-origin",
...options,
};
this._options = options;
Expand Down

0 comments on commit c32d1d6

Please sign in to comment.