From a448e8d832b0e4138ac54e17b45807a8dfa87f9a Mon Sep 17 00:00:00 2001 From: the1812 Date: Wed, 18 Nov 2020 20:40:38 +0800 Subject: [PATCH] Update clean params (#1207) --- min/url-params-clean.min.js | 2 +- src/utils/url-params-clean.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/min/url-params-clean.min.js b/min/url-params-clean.min.js index 45f6cf08d..f189c2be6 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"];const r=[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"}];const s=[/game\.bilibili\.com\/fgo/];const a=t=>t;const c=["videocard_series"];const i=()=>{const t=location.search.substring(1).split("&");if(t.some((t=>c.some((e=>t.includes(e)))))){return}const e=t.filter((t=>{if(o.some((e=>t.startsWith(`${e}=`)))){return false}if(r.some((({match:e,param:o})=>document.URL.match(e)&&t.startsWith(`${o}=`)))){return false}return true}));const s=e.join("&");const i=a(document.URL.replace(location.search,""));const n=s?"?"+s:"";const m=i+n;if(m!==document.URL){console.log("[URL params clean]",document.URL,m);history.replaceState({},document.title,m)}};fullyLoaded((()=>{if(document.contentType==="text/html"){i();Observer.videoChange((()=>i()))}}))})(); \ 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"];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 diff --git a/src/utils/url-params-clean.ts b/src/utils/url-params-clean.ts index 905be3a38..4d7e4c454 100644 --- a/src/utils/url-params-clean.ts +++ b/src/utils/url-params-clean.ts @@ -26,11 +26,16 @@ const blockParams = [ 'platform_network_status', 'p2p_type', 'referfrom', + 'visit_id', ] const siteSpecifiedParams = [ { match: /\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/, param: 'type', + }, + { + match: /\/\/live\.bilibili\.com\//, + param: 'session_id', } ] const noNormalizes = [