@@ -47,6 +47,7 @@ import { getSimilarityScore, ScriptUpdateCheck } from "./script_update_check";
4747import { LocalStorageDAO } from "@App/app/repo/localStorage" ;
4848import { CompiledResourceDAO } from "@App/app/repo/resource" ;
4949import { initRegularUpdateCheck } from "./regular_updatecheck" ;
50+ import { createNoCSPRules } from "@App/pkg/utils/dnr" ;
5051
5152export type TCheckScriptUpdateOption = Partial <
5253 { checkType : "user" ; noUpdateCheck ?: number } | ( { checkType : "system" } & Record < string , any > )
@@ -316,32 +317,7 @@ export class ScriptService {
316317
317318 {
318319 type Config = Record < string , any > ;
319- const REMOVE_HEADERS = [
320- `content-security-policy` ,
321- `content-security-policy-report-only` ,
322- `x-webkit-csp` ,
323- `x-content-security-policy` ,
324- `x-frame-options` ,
325- ] ;
326-
327- const { RuleActionType, HeaderOperation, ResourceType } = chrome . declarativeNetRequest ;
328-
329- const rules : chrome . declarativeNetRequest . Rule [ ] = [
330- {
331- id : 2001 ,
332- action : {
333- type : RuleActionType . MODIFY_HEADERS ,
334- responseHeaders : REMOVE_HEADERS . map ( ( header ) => ( {
335- operation : HeaderOperation . REMOVE ,
336- header,
337- } ) ) ,
338- } ,
339- condition : {
340- urlFilter : `|http*` ,
341- resourceTypes : [ ResourceType . MAIN_FRAME , ResourceType . SUB_FRAME ] ,
342- } ,
343- } ,
344- ] ;
320+ const rules = createNoCSPRules ( [ `|http*` ] ) ;
345321
346322 const updateRules = ( newConfig : Config , oldConfig ?: Config ) => {
347323 if ( oldConfig && newConfig . csp_http_disabled === oldConfig ?. csp_http_disabled ) {
0 commit comments