forked from ulixee/unblocked
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
769f965
commit f15de75
Showing
28 changed files
with
658 additions
and
379 deletions.
There are no files selected for viewing
17 changes: 12 additions & 5 deletions
17
plugins/default-browser-emulator/injected-scripts/Document.prototype.cookie.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
const triggerName = args.callbackName; | ||
export type Args = { | ||
callbackName: string; | ||
}; | ||
const typedArgs = args as Args; | ||
const triggerName = typedArgs.callbackName; | ||
|
||
if (!self[triggerName]) throw new Error('No cookie trigger'); | ||
const cookieTrigger = ((self[triggerName] as unknown) as Function).bind(self); | ||
const cookieTrigger = (self[triggerName] as unknown as Function).bind(self); | ||
|
||
delete self[triggerName]; | ||
|
||
proxySetter(Document.prototype, 'cookie', (target, thisArg, cookie) => { | ||
cookieTrigger(JSON.stringify({ cookie, origin: self.location.origin })); | ||
return ProxyOverride.callOriginal; | ||
proxySetter(Document.prototype, 'cookie', (target, thisArg, argArray) => { | ||
const cookie = argArray.at(0); | ||
if (cookie) { | ||
cookieTrigger(JSON.stringify({ cookie, origin: self.location.origin })); | ||
} | ||
return ReflectCached.apply(target, thisArg, argArray!); | ||
}); |
8 changes: 3 additions & 5 deletions
8
plugins/default-browser-emulator/injected-scripts/JSON.stringify.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
proxyFunction(JSON, 'stringify', (target, thisArg, argArray) => { | ||
argArray[1] = null; | ||
argArray[2] = 2; | ||
export type Args = {}; | ||
|
||
const result = target.apply(thisArg, argArray); | ||
proxyFunction(JSON, 'stringify', (target, thisArg, argArray) => { | ||
const result = ReflectCached.apply(target, thisArg, [argArray.at(0), null, 2]); | ||
console.log(result); | ||
|
||
return result; | ||
}); |
10 changes: 8 additions & 2 deletions
10
plugins/default-browser-emulator/injected-scripts/MediaDevices.prototype.enumerateDevices.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
plugins/default-browser-emulator/injected-scripts/RTCRtpSender.getCapabilities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.