Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type correction #255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions packages/fingerprint-generator/src/fingerprint-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,34 @@
hasHDR: boolean;
}

export type Brand = {
brand: string;
version: string;
}

export type UserAgentData = {
brands: Brand[];
mobile: boolean;
platform: string;
architecture: string;
bitness: string;
fullVersionList: Brand[];
model: string;
platformVersion: string;
uaFullVersion: string;
}

export interface ExtraProperties {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally speaking, we prefer interfaces over types for objects, but since all the other object types here are types, lets stay consistent and change only this one to be a type

vendorFlavors: string[];
isBluetoothSupported: boolean;
globalPrivacyControl: null;
pdfViewerEnabled: boolean;
installedApps: any[];
}

export type NavigatorFingerprint = {
userAgent: string;
userAgentData: Record<string, string>;
userAgentData: UserAgentData;
doNotTrack: string;
appCodeName: string;
appName: string;
Expand All @@ -43,8 +68,8 @@
vendor: string;
vendorSub: string;
maxTouchPoints?: number;
extraProperties: Record<string, string>;
}
extraProperties: ExtraProperties;
};

export type VideoCard = {
renderer: string;
Expand Down Expand Up @@ -144,7 +169,7 @@
}
})();

while (true) {

Check warning on line 172 in packages/fingerprint-generator/src/fingerprint-generator.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected constant condition
// Generate headers consistent with the inputs to get input-compatible user-agent and accept-language headers needed later
const headers = super.getHeaders(options, requestDependentHeaders, partialCSP?.userAgent);
const userAgent = 'User-Agent' in headers ? headers['User-Agent'] : headers['user-agent'];
Expand Down
Loading