Created
December 19, 2024 13:19
-
-
Save gulitsky/e7784a94d934ac0be1ca6c17af591718 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export const init = async () => { | |
const lp = retrieveLaunchParams(); | |
const isDebug = lp.startParam === "debug"; | |
$debug.set(isDebug); | |
if (isDebug && ["android", "ios"].includes(lp.platform)) { | |
try { | |
const eruda = await import("eruda"); | |
eruda.default.init({ | |
tool: ["console", "elements", "network", "resources", "info"], | |
}); | |
const info = eruda.default.get("info"); | |
info.remove("Location"); | |
info.remove("User Agent"); | |
info.remove("Device"); | |
info.remove("System"); | |
info.remove("Backers"); | |
let html = ` | |
<table> | |
<tbody> | |
<tr> | |
<th class="eruda-system-key">platform</th> | |
<td>${lp.platform}</td> | |
</tr> | |
<tr> | |
<th>version</th> | |
<td>${lp.version}</td> | |
</tr> | |
<tr> | |
<th>auth date</th> | |
<td>${lp.initData?.authDate.toLocaleString()}</td> | |
</tr> | |
<tr> | |
<th>hash</th> | |
<td>${lp.initData?.hash}</td> | |
</tr> | |
<tr> | |
<th>start param</th> | |
<td>${lp.initData?.startParam}</td> | |
</tr> | |
<tr> | |
<th>chat type</th> | |
<td>${lp.initData?.chatType}</td> | |
</tr> | |
<tr> | |
<th>chat instance</th> | |
<td>${lp.initData?.chatInstance}</td> | |
</tr> | |
</tbody> | |
</table> | |
` | |
info.add("Init Data", html); | |
html = ` | |
<table> | |
<tbody> | |
<tr> | |
<th class="eruda-system-key">id</th> | |
<td>${lp.initData?.user?.id}</td> | |
</tr> | |
<tr> | |
<th>first name</th> | |
<td>${lp.initData?.user?.firstName}</td> | |
</tr> | |
<tr> | |
<th>last name</th> | |
<td>${lp.initData?.user?.lastName}</td> | |
</tr> | |
<tr> | |
<th>username</th> | |
<td>${lp.initData?.user?.username}</td> | |
</tr> | |
<tr> | |
<th>language code</th> | |
<td>${lp.initData?.user?.languageCode}</td> | |
</tr> | |
<tr> | |
<th>is premium?</th> | |
<td>${lp.initData?.user?.isPremium}</td> | |
</tr> | |
<tr> | |
<th>allows write to pm?</th> | |
<td>${lp.initData?.user?.allowsWriteToPm}</td> | |
</tr> | |
<tr> | |
<th>photo</th> | |
<td><a href="${lp.initData?.user?.photoUrl}">url</a></td> | |
</tr> | |
</tbody> | |
</table> | |
`; | |
info.add("User", html); | |
} catch (error) { | |
console.error("Failed to load Eruda:", error) | |
} | |
} | |
initSDK(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment