B 站开始在页面加载后利用 replaceState 向地址栏添加追踪标识,可以看到 History API 被 Sentry 库篡改。由于发生在 replaceState 时,地址清理插件 Neat URL 等工具无法对此进行自动移除。
在 uBlockOrigin 中自定义静态规则添加
可以避免篡改
(没叔叔 Premium 放不下了,只能压缩一下了)
在 uBlockOrigin 中自定义静态规则添加
//s1.hdslb.com/bfs/static/jinkela/long/js/sentry/
然后需要通过 User Script 添加 (function() {
'use strict';
unsafeWindow.Sentry = {
init: () => {},
Integrations: { Vue: class {constructor() {}}}
}
var ops = unsafeWindow.history.pushState;
var ors = unsafeWindow.history.replaceState;
var callOriginal = (stateObj, title, url, calling) => {
if (new URL(`https://example.com${url}`).searchParams.get('vd_source') === null) {
calling(stateObj, title, url);
}
}
unsafeWindow.history.pushState = (stateObj, title, url) => callOriginal(stateObj, title, url, ops)
unsafeWindow.history.replaceState = (stateObj, title, url) => callOriginal(stateObj, title, url, ors)
})();
记得 @grant unsafeWindow
进行占位可以避免篡改
(没叔叔 Premium 放不下了,只能压缩一下了)
👍11
神奇的笔记
实际还是不行...
草 我发现原因了,我屋里的交换机的交换表好像发生了什么奇怪的问题,特定网口会挂掉,我完全断电重开了交换机就好了