From 75dd9a310483f99d6b6d1ab8bb73103b1bf4d53e Mon Sep 17 00:00:00 2001 From: the1812 Date: Thu, 19 Nov 2020 17:08:20 +0800 Subject: [PATCH] Update clean params (#974, #981) --- min/url-params-clean.min.js | 2 +- src/utils/url-params-clean.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/min/url-params-clean.min.js b/min/url-params-clean.min.js index f189c2be68..63f9db9af7 100644 --- a/min/url-params-clean.min.js +++ b/min/url-params-clean.min.js @@ -1 +1 @@ -(()=>(t,e)=>{const o=["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","bbid","ts","timestamp","unique_k","rt","tdsourcetag","accept_quality","broadcast_type","current_qn","current_quality","playurl_h264","playurl_h265","quality_description","network","network_status","platform_network_status","p2p_type","referfrom","visit_id"];const s=[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"},{match:/\/\/live\.bilibili\.com\//,param:"session_id"}];const r=[/game\.bilibili\.com\/fgo/];const i=t=>t;const a=["videocard_series"];const c=()=>{const t=location.search.substring(1).split("&");if(t.some((t=>a.some((e=>t.includes(e)))))){return}const e=t.filter((t=>{if(o.some((e=>t.startsWith(`${e}=`)))){return false}if(s.some((({match:e,param:o})=>document.URL.match(e)&&t.startsWith(`${o}=`)))){return false}return true}));const r=e.join("&");const c=i(document.URL.replace(location.search,""));const n=r?"?"+r:"";const m=c+n;if(m!==document.URL){console.log("[URL params clean]",document.URL,m);history.replaceState({},document.title,m)}};fullyLoaded((()=>{if(document.contentType==="text/html"){c();Observer.videoChange((()=>c()))}}))})(); \ No newline at end of file +(()=>(t,e)=>{const o=["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","bbid","ts","timestamp","unique_k","rt","tdsourcetag","accept_quality","broadcast_type","current_qn","current_quality","playurl_h264","playurl_h265","quality_description","network","network_status","platform_network_status","p2p_type","referfrom","visit_id","bsource"];const s=[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"},{match:/\/\/live\.bilibili\.com\//,param:"session_id"},{match:/\/\/www\.bilibili\.com\/bangumi\//,param:"theme"}];const i=[/game\.bilibili\.com\/fgo/];const r=t=>t;const a=["videocard_series"];const c=()=>{const t=location.search.substring(1).split("&");if(t.some((t=>a.some((e=>t.includes(e)))))){return}const e=t.filter((t=>{if(o.some((e=>t.startsWith(`${e}=`)))){return false}if(s.some((({match:e,param:o})=>document.URL.match(e)&&t.startsWith(`${o}=`)))){return false}return true}));const i=e.join("&");const c=r(document.URL.replace(location.search,""));const n=i?"?"+i:"";const m=c+n;if(m!==document.URL){console.log("[URL params clean]",document.URL,m);history.replaceState({},document.title,m)}};fullyLoaded((()=>{if(document.contentType==="text/html"){c();Observer.videoChange((()=>c()))}}))})(); \ No newline at end of file diff --git a/src/utils/url-params-clean.ts b/src/utils/url-params-clean.ts index 4d7e4c4547..2f445e6108 100644 --- a/src/utils/url-params-clean.ts +++ b/src/utils/url-params-clean.ts @@ -27,6 +27,7 @@ const blockParams = [ 'p2p_type', 'referfrom', 'visit_id', + 'bsource', ] const siteSpecifiedParams = [ { @@ -36,7 +37,11 @@ const siteSpecifiedParams = [ { match: /\/\/live\.bilibili\.com\//, param: 'session_id', - } + }, + { + match: /\/\/www\.bilibili\.com\/bangumi\//, + param: 'theme', + }, ] const noNormalizes = [ /game\.bilibili\.com\/fgo/,