Skip to content

Commit

Permalink
测试广告拦截功能
Browse files Browse the repository at this point in the history
  • Loading branch information
YLWS-4617 committed Oct 26, 2017
1 parent e236949 commit 75563cb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
29 changes: 29 additions & 0 deletions changead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import json
import readjson
import writejson

rules = readjson.ConfRouting[u"settings"][u"rules"]

if rules[0][u"outboundTag"] == "direct":
if_open_ad_function = "广告拦截功能: 未开启"
else:
if_open_ad_function = "广告拦截功能: 开启"

print("")
print(if_open_ad_function)

print("")
print("1. 开启")
print("2. 关闭")

choice = raw_input("请选择: ")

if choice == "1":
writejson.WriteAD("on")
else:
writejson.WriteAD("off")

8 changes: 8 additions & 0 deletions writejson.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,11 @@ def WriteTLS(action,domain):
config[u"inbound"][u"streamSettings"][u"security"] = ""
config[u"inbound"][u"streamSettings"][u"tlsSettings"] = {}
Write()

#更改广告拦截功能
def WriteAD(action):
if action == "on":
config[u"routing"][u"settings"][u"rules"][0][u"outboundTag"] == "blocked"
else:
config[u"routing"][u"settings"][u"rules"][0][u"outboundTag"] == "direct"
Write()

0 comments on commit 75563cb

Please sign in to comment.