Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Init Tc Manually 2
- // @namespace http://tampermonkey.net/
- // @version 2024-01-27
- // @description Intercepts WebSocket creation for Tinychat
- // @author You
- // @match https://tinychat.com/*
- // @grant none
- // ==/UserScript==
- (function() {
- "use strict";
- // Create a function to append logs to a console div
- function appendToConsole(message) {
- const consoleDiv = document.getElementById("console");
- if (consoleDiv) {
- consoleDiv.innerHTML += message + "<br>";
- }
- }
- // Override WebSocket constructor to intercept WebSocket creation
- const originalWebSocket = window.WebSocket;
- window.WebSocket = function(url, protocol) {
- if (url === "wss://wss1516.tinychat.com:31897/") {
- appendToConsole(`Intercepted WebSocket connection: ${url}`);
- // You can manipulate the WebSocket connection here if needed
- }
- return new originalWebSocket(url, protocol);
- };
- // Method to connect and initialize the console div
- function connectConsole() {
- const consoleDiv = document.createElement("div");
- consoleDiv.id = "console";
- consoleDiv.style.border = "1px solid #ccc";
- consoleDiv.style.overflow = "auto";
- consoleDiv.style.maxHeight = "200px";
- document.body.appendChild(consoleDiv);
- }
- connectConsole();
- })();
Add Comment
Please, Sign In to add comment