Show More
@@ -1,50 +1,51 b'' | |||
|
1 | 1 | [Version] |
|
2 | 2 | Version = 4.7.1 Elon |
|
3 | 3 | SiteName = Neboard DEV |
|
4 | 4 | |
|
5 | 5 | [Cache] |
|
6 | 6 | # Timeout for caching, if cache is used |
|
7 | 7 | CacheTimeout = 600 |
|
8 | 8 | |
|
9 | 9 | [Forms] |
|
10 | 10 | # Max post length in characters |
|
11 | 11 | MaxTextLength = 30000 |
|
12 | 12 | MaxFileSize = 8000000 |
|
13 | 13 | LimitFirstPosting = true |
|
14 | 14 | LimitPostingSpeed = false |
|
15 | 15 | PowDifficulty = 0 |
|
16 | 16 | # Delay in seconds |
|
17 | 17 | PostingDelay = 30 |
|
18 | 18 | Autoban = false |
|
19 | 19 | DefaultTag = test |
|
20 | 20 | MaxFileCount = 5 |
|
21 | 21 | AdditionalSpoilerSpaces = false |
|
22 | BanWhitelist = 127.0.0.1 | |
|
22 | 23 | |
|
23 | 24 | [Messages] |
|
24 | 25 | # Thread bumplimit |
|
25 | 26 | MaxPostsPerThread = 10 |
|
26 | 27 | ThreadArchiveDays = 300 |
|
27 | 28 | AnonymousMode = false |
|
28 | 29 | |
|
29 | 30 | [View] |
|
30 | 31 | DefaultTheme = md |
|
31 | 32 | DefaultImageViewer = simple |
|
32 | 33 | LastRepliesCount = 3 |
|
33 | 34 | ThreadsPerPage = 3 |
|
34 | 35 | PostsPerPage = 10 |
|
35 | 36 | ImagesPerPageGallery = 20 |
|
36 | 37 | MaxFavoriteThreads = 20 |
|
37 | 38 | MaxLandingThreads = 20 |
|
38 | 39 | Themes=md:Mystic Dark,md_centered:Mystic Dark (centered),sw:Snow White,pg:Photon Grey,ad:Amanita Dark,iw:Inocibe White |
|
39 | 40 | ImageViewers=simple:Simple,popup:Popup |
|
40 | 41 | |
|
41 | 42 | [Storage] |
|
42 | 43 | # Enable archiving threads instead of deletion when the thread limit is reached |
|
43 | 44 | ArchiveThreads = true |
|
44 | 45 | |
|
45 | 46 | [RSS] |
|
46 | 47 | MaxItems = 20 |
|
47 | 48 | |
|
48 | 49 | [External] |
|
49 | 50 | ImageSearchHost= |
|
50 | 51 | SourceFetcherTripcode= |
@@ -1,29 +1,33 b'' | |||
|
1 | 1 | import configparser |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | CONFIG_DEFAULT_SETTINGS = 'boards/config/default_settings.ini' |
|
5 | 5 | CONFIG_SETTINGS = 'boards/config/settings.ini' |
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | config = configparser.ConfigParser() |
|
9 | 9 | config.read(CONFIG_DEFAULT_SETTINGS) |
|
10 | 10 | config.read(CONFIG_SETTINGS) |
|
11 | 11 | |
|
12 | 12 | |
|
13 | 13 | def get(section, name): |
|
14 | 14 | return config[section][name] |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | def get_int(section, name): |
|
18 | 18 | return int(get(section, name)) |
|
19 | 19 | |
|
20 | 20 | |
|
21 | 21 | def get_bool(section, name): |
|
22 | 22 | return get(section, name) == 'true' |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | def get_list_dict(section, name): |
|
26 | 26 | str_dict = get(section, name) |
|
27 | 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,30 +1,32 b'' | |||
|
1 | 1 | from django.db import transaction |
|
2 | 2 | from django.views.generic import View |
|
3 | 3 | |
|
4 | from boards import utils | |
|
4 | from boards import utils, settings | |
|
5 | 5 | from boards.models.user import Ban |
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | BAN_REASON_SPAM = 'Autoban: spam bot' |
|
9 | 9 | |
|
10 | 10 | CONTEXT_FORM = 'form' |
|
11 | 11 | |
|
12 | 12 | |
|
13 | 13 | class BaseBoardView(View): |
|
14 | 14 | |
|
15 | 15 | def get_context_data(self, **kwargs): |
|
16 | 16 | return dict() |
|
17 | 17 | |
|
18 | 18 | @transaction.atomic |
|
19 | 19 | def _ban_current_user(self, request): |
|
20 | 20 | """ |
|
21 | 21 | Add current user to the IP ban list |
|
22 | 22 | """ |
|
23 | 23 | |
|
24 | 24 | ip = utils.get_client_ip(request) |
|
25 | ban, created = Ban.objects.get_or_create(ip=ip) | |
|
26 | if created: | |
|
27 | ban.can_read = False | |
|
28 | ban.reason = BAN_REASON_SPAM | |
|
29 | ban.save() | |
|
25 | whitelist = settings.get_list('Forms', 'BanWhitelist') | |
|
26 | if not ip in whitelist: | |
|
27 | ban, created = Ban.objects.get_or_create(ip=ip) | |
|
28 | if created: | |
|
29 | ban.can_read = False | |
|
30 | ban.reason = BAN_REASON_SPAM | |
|
31 | ban.save() | |
|
30 | 32 |
General Comments 0
You need to be logged in to leave comments.
Login now