|
|
@@ -56,6 +56,10 @@ public class StandardDeviceIdService implements DeviceIdService { |
|
|
|
// used in dnscrypt-proxy to determine how to respond to blocked requests |
|
|
|
public static final String REDIS_KEY_DEVICE_REJECT_WITH = "bubble_device_reject_with_"; |
|
|
|
|
|
|
|
// used in mitmproxy to optimize passthru requests |
|
|
|
// we flush keys with this prefix when changing showBlockStats flag |
|
|
|
public static final String REDIS_KEY_CHUNK_FILTER_PASS = "__chunk_filter_pass__"; |
|
|
|
|
|
|
|
@Autowired private DeviceDAO deviceDAO; |
|
|
|
@Autowired private AccountDAO accountDAO; |
|
|
|
@Autowired private RedisService redis; |
|
|
@@ -154,6 +158,7 @@ public class StandardDeviceIdService implements DeviceIdService { |
|
|
|
|
|
|
|
public void initBlockStats (Account account) { |
|
|
|
redis.set_plaintext(REDIS_KEY_ACCOUNT_SHOW_BLOCK_STATS+account.getUuid(), Boolean.toString(account.showBlockStats())); |
|
|
|
redis.del_withPrefix(REDIS_KEY_CHUNK_FILTER_PASS); |
|
|
|
for (Device device : deviceDAO.findByAccount(account.getUuid())) { |
|
|
|
if (account.showBlockStats()) { |
|
|
|
showBlockStats(device); |
|
|
|