Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Commit

Permalink
Passing fingerprint through cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
Woyken committed Oct 13, 2019
1 parent 584dea1 commit 8cbddc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/chunkCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export class ChunkCache {
public constructor(fingerprint: string) {
axiosCookiejarSupport(axios);

this.cookieJar.setCookieSync(
`__cfduid=${fingerprint}`,
'https://pixelplanet.fun',
{ secure: true },
);
this.fingerprint = fingerprint;

this.ws = new WebSocketHandler(this.fingerprint);
Expand Down Expand Up @@ -92,7 +97,6 @@ export class ChunkCache {
x,
y,
a: x + y - 8,
fingerprint: this.fingerprint,
token: null,
};

Expand Down
4 changes: 3 additions & 1 deletion src/guid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export class Guid {

public static validateGuid(guid: string): boolean {
const matched = guid.match(
/^[0-9a-f]{8}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{12}$/i,
// Change in PixelPlanet, fingerprint no longer follows guid standart. Seem to be longer
// When validating, removed $ from the end. For now, allow longer values than before.
/^[0-9a-f]{8}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{12}/i,
);
return matched !== null;
}
Expand Down

0 comments on commit 8cbddc1

Please sign in to comment.