Show More
@@ -19,6 +19,7 b' Autoban = false' | |||||
19 | DefaultTag = test |
|
19 | DefaultTag = test | |
20 | MaxFileCount = 5 |
|
20 | MaxFileCount = 5 | |
21 | AdditionalSpoilerSpaces = false |
|
21 | AdditionalSpoilerSpaces = false | |
|
22 | BanWhitelist = 127.0.0.1 | |||
22 |
|
23 | |||
23 | [Messages] |
|
24 | [Messages] | |
24 | # Thread bumplimit |
|
25 | # Thread bumplimit |
@@ -27,3 +27,7 b' def get_list_dict(section, name):' | |||||
27 | return [item.split(':') for item in str_dict.split(',')] |
|
27 | return [item.split(':') for item in str_dict.split(',')] | |
28 |
|
28 | |||
29 |
|
29 | |||
|
30 | def get_list(section, name): | |||
|
31 | str_list = get(section, name) | |||
|
32 | return str_list.split(',') | |||
|
33 |
@@ -1,7 +1,7 b'' | |||||
1 | from django.db import transaction |
|
1 | from django.db import transaction | |
2 | from django.views.generic import View |
|
2 | from django.views.generic import View | |
3 |
|
3 | |||
4 | from boards import utils |
|
4 | from boards import utils, settings | |
5 | from boards.models.user import Ban |
|
5 | from boards.models.user import Ban | |
6 |
|
6 | |||
7 |
|
7 | |||
@@ -22,6 +22,8 b' class BaseBoardView(View):' | |||||
22 | """ |
|
22 | """ | |
23 |
|
23 | |||
24 | ip = utils.get_client_ip(request) |
|
24 | ip = utils.get_client_ip(request) | |
|
25 | whitelist = settings.get_list('Forms', 'BanWhitelist') | |||
|
26 | if not ip in whitelist: | |||
25 | ban, created = Ban.objects.get_or_create(ip=ip) |
|
27 | ban, created = Ban.objects.get_or_create(ip=ip) | |
26 | if created: |
|
28 | if created: | |
27 | ban.can_read = False |
|
29 | ban.can_read = False |
General Comments 0
You need to be logged in to leave comments.
Login now