Created
April 4, 2026 05:27
-
-
Save aadishv/e04cecb2afde317f4ac191f6c03e7871 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
| // ==UserScript== | |
| // @name Pronto offline | |
| // @author aadishv | |
| // @namespace https://aadishv.dev/ | |
| // @version 2.0 | |
| // @description Blocks presence pusher subscription and fake sub success to make you appear offline on Pronto. Use in conjunction with uBlock Origin rules in rules.txt | |
| // @match *://stanfordohs.pronto.io/* | |
| // @run-at document-start | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| const blockedChannels = new Map(); // Track blocked channels to fake events | |
| function shouldBlock(data) { | |
| try { | |
| const parsed = typeof data === 'string' ? JSON.parse(data) : data; | |
| if (parsed?.event !== 'pusher:subscribe') return false; | |
| const channel = parsed?.data?.channel; | |
| const channelData = parsed?.data?.channel_data; | |
| // Check if it's a presence channel | |
| if (channel?.startsWith('presence-user.')) { | |
| console.log('[Presence Block] Blocking subscription to', channel); | |
| return { block: true, channel }; | |
| } | |
| // Also block if it has user_id in channel_data | |
| if (channelData) { | |
| const cd = typeof channelData === 'string' ? JSON.parse(channelData) : channelData; | |
| if (cd?.user_id !== undefined) { | |
| console.log('[Presence Block] Blocking subscription with user_id to', channel); | |
| return { block: true, channel }; | |
| } | |
| } | |
| } catch { | |
| return false; | |
| } | |
| return false; | |
| } | |
| window.WebSocket = new Proxy(window.WebSocket, { | |
| construct(Target, args) { | |
| const ws = new Target(...args); | |
| const originalSend = ws.send.bind(ws); | |
| const originalAddEventListener = ws.addEventListener.bind(ws); | |
| ws.send = function (data) { | |
| const blockResult = shouldBlock(data); | |
| if (blockResult && blockResult.block) { | |
| console.warn('[WS Blocked]', data); | |
| // Store the websocket and channel for later event faking | |
| blockedChannels.set(blockResult.channel, ws); | |
| // Fake the subscription_succeeded event after a short delay | |
| setTimeout(() => { | |
| console.log('[Presence Block] Faking pusher:subscription_succeeded for', blockResult.channel); | |
| const fakeEvent = { | |
| event: 'pusher:subscription_succeeded', | |
| channel: blockResult.channel, | |
| data: '{}' | |
| }; | |
| // Dispatch as a MessageEvent | |
| const messageEvent = new MessageEvent('message', { | |
| data: JSON.stringify(fakeEvent), | |
| origin: ws.url | |
| }); | |
| ws.dispatchEvent(messageEvent); | |
| }, 100); | |
| return; // Don't actually send the subscription | |
| } | |
| return originalSend(data); | |
| }; | |
| return ws; | |
| } | |
| }); | |
| console.log('[Presence Block] Loaded - will block presence and fake success'); | |
| })(); |
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
| https://stanfordohs.pronto.io/api/v1/device.update | |
| https://stanfordohs.pronto.io/api/v1/device.ping | |
| https://stanfordohs.pronto.io/api/clients/users/presence |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
may i suggest a client...