feat(plugins/no-track): block /science requests

This commit is contained in:
PalmDevs 2026-05-13 01:54:35 +07:00
parent df01515823
commit 4fd5a28edc
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -185,7 +185,25 @@ registerPlugin(
},
)
cleanup(unsubTI, unsubATAC)
// ../discord_common/js/packages/http-utils/HTTPUtils.tsx
const unsubHTTPUtils = waitForModules(
withProps('HTTP', 'post'),
HTTPUtils => {
unsubHTTPUtils()
logger.log('Patching HTTPUtils...')
// Block analytics requests
instead(HTTPUtils.HTTP, 'post', (args, original) => {
const [{ url }] = args
if (url === '/science') return Promise.resolve()
return original.apply(this, args)
})
},
)
cleanup(unsubTI, unsubATAC, unsubHTTPUtils)
},
stop({ plugin }) {
plugin.flags |= PluginFlags.ReloadRequired