-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackground.5fadff2f.js
1 lines (1 loc) · 4.27 KB
/
background.5fadff2f.js
1
(()=>{var n=async(e,t)=>{const{id:a}=e.body;fetch("https://api.juejin.cn/content_api/v1/article_draft/update?aid=2608&uuid=7047406144038618639",{headers:{accept:"*/*","accept-language":"zh-CN,zh;q=0.9","cache-control":"no-cache","content-type":"application/json",pragma:"no-cache","sec-ch-ua":'"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-forwarded-for":"4.2.2.2","x-secsdk-csrf-token":"000100000001f7e435c3177b79f0284fe6406007b92e492541780aa07eb5f1bc8f1ffc8ced86174d27df3672452e"},body:'{"id":"7211409997111705656","category_id":"6809637767543259144","tag_ids":["6809640407484334093"],"link_url":"","cover_image":"","title":"222255555","brief_content":"![image.png](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/7189a0a867b84d7f8d3f3b8c1cb914f6~tplv","edit_type":10,"html_content":"deprecated","mark_content":"\\n![image.png](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/7189a0a867b84d7f8d3f3b8c1cb914f6~tplv-k3u1fbpfcp-watermark.image?)\\n\\n![image.png](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/5d19f1b15fdd420a8acec070c88ada7b~tplv-k3u1fbpfcp-watermark.image?)\\n"}',method:"POST",mode:"cors",credentials:"omit"})};globalThis.__plasmoInternalPortMap=new Map,chrome.runtime.onMessage.addListener((e,t,a)=>{switch(e.name){case"juejin":n({sender:t,...e},{send:r=>a(r)});break;default:break}return!0}),chrome.runtime.onConnect.addListener(function(e){globalThis.__plasmoInternalPortMap.set(e.name,e),e.onMessage.addListener(function(t){e.name})}),chrome.runtime.onInstalled.addListener(()=>{o()});const i=[{urlFilter:"https://api.juejin.cn/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://juejin.cn/editor/drafts/6857487746525888520"},{header:"Origin",operation:"set",value:"https://juejin.cn"}]},{urlFilter:"https://imagex.bytedanceapi.com/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://juejin.cn"},{header:"Origin",operation:"set",value:"https://juejin.cn"}]},{urlFilter:"https://tos-d-x-lf.snssdk.com/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://juejin.cn"},{header:"Origin",operation:"set",value:"https://juejin.cn"}]},{urlFilter:"https://juejin.cn/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://juejin.cn/editor/drafts/7217267332657971260"},{header:"Origin",operation:"set",value:"https://juejin.cn"}]},{urlFilter:"https://bizapi.csdn.net/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://editor.csdn.net/"}]},{urlFilter:"https://imgservice.csdn.net/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://editor.csdn.net/"},{header:"Origin",operation:"set",value:"https://editor.csdn.net/"}]},{urlFilter:"https://zhuanlan.zhihu.com/api/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://zhuanlan.zhihu.com/write"},{header:"Origin",operation:"set",value:"https://zhuanlan.zhihu.com"}]},{urlFilter:"https://api.zhihu.com/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://zhuanlan.zhihu.com/p/621059053/edit"},{header:"Origin",operation:"set",value:"https://zhuanlan.zhihu.com"}]},{urlFilter:"https://zhihu-pics-upload.zhimg.com/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://zhuanlan.zhihu.com/p/621059053/edit"},{header:"Origin",operation:"set",value:"https://zhuanlan.zhihu.com"}]},{urlFilter:"https://www.jianshu.com/author/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://www.jianshu.com/writer"},{header:"Origin",operation:"set",value:"https://www.jianshu.com"}]},{urlFilter:"https://upload.qiniup.com/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://www.jianshu.com/writer"},{header:"Origin",operation:"set",value:"https://www.jianshu.com"}]},{urlFilter:"https://segmentfault.com/gateway/*",requestHeaders:[{header:"Referer",operation:"set",value:"https://segmentfault.com/write"},{header:"Origin",operation:"set",value:"https://segmentfault.com"}]}],o=()=>{const e=i.map((r,s)=>s+1),t=i.map((r,s)=>({id:s+1,priority:1,condition:{urlFilter:r.urlFilter},action:{type:"modifyHeaders",requestHeaders:r.requestHeaders}})),a={removeRuleIds:e,addRules:t};chrome.declarativeNetRequest.updateDynamicRules(a,()=>{chrome.runtime.lastError&&console.error(chrome.runtime.lastError)})}})();