-
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.
Basis for console stats. 0.0.5 build test.
- Loading branch information
1 parent
b9db626
commit 2a7c86e
Showing
5 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,54 @@ | ||
"use strict"; | ||
import {ics} from "./ics"; | ||
ics.level = 3; | ||
{ | ||
console.info | ||
// Constants | ||
const selectorSkip = ["id", "class"], | ||
EL = Symbol(), // Event listeners | ||
ELs = {}, // Tracking overall event listeners | ||
TSt = Symbol(), // The real toString | ||
UID = Symbol(); // Unique ID for tracked objects | ||
const fakeNativeCode = Function.toString().replace("function Function(", "function FuncName("); | ||
// Namespace for Minuette | ||
let Minuet = {}; | ||
// Allow hiding real code | ||
let noToStr = function () { | ||
return fakeNativeCode.replace("FuncName", this.name); | ||
}; | ||
let hideCode = function (func) { | ||
if (!func[TSt]) { | ||
func[TSt] = func.toString; | ||
func.toString = noToStr; | ||
}; | ||
}; | ||
// Extension channel message | ||
let extChannel = new BroadcastChannel("-ReplaceMeWithSomethingUnique-"); | ||
extChannel.onmessage = function (msg) { | ||
switch (msg.e) { | ||
case "apiExpose": { | ||
self.Minuette = new Proxy(Minuet, {}); | ||
ics.debug("API exposed."); | ||
break; | ||
}; | ||
case "apiHide": { | ||
delete self.Minuette; | ||
ics.debug("API hidden."); | ||
}; | ||
default: { | ||
ics.debug(msg); | ||
}; | ||
}; | ||
}; | ||
// Original API exposure | ||
Minuet.console = console; | ||
// Console hijack | ||
{ | ||
self.console = {}; | ||
for (let name in Minuet.console) { | ||
self.console[name] = function () { | ||
extChannel.postMessage({e: "console", level: name}); | ||
Minuet.console[name](...arguments); | ||
}; | ||
}; | ||
}; | ||
}; | ||
ics.debug("Minuette launched."); |
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