Show More
@@ -3,6 +3,7 b' from boards.models import Tag, TagAlias,' | |||||
3 | from boards.models.attachment import AttachmentSticker |
|
3 | from boards.models.attachment import AttachmentSticker | |
4 | from boards.models.thread import FAV_THREAD_NO_UPDATES |
|
4 | from boards.models.thread import FAV_THREAD_NO_UPDATES | |
5 | from boards.models.tag import DEFAULT_LOCALE |
|
5 | from boards.models.tag import DEFAULT_LOCALE | |
|
6 | from boards.settings import SECTION_VIEW | |||
6 |
|
7 | |||
7 | MAX_TRIPCODE_COLLISIONS = 50 |
|
8 | MAX_TRIPCODE_COLLISIONS = 50 | |
8 |
|
9 | |||
@@ -135,7 +136,7 b' class SettingsManager:' | |||||
135 | def add_or_read_fav_thread(self, opening_post): |
|
136 | def add_or_read_fav_thread(self, opening_post): | |
136 | threads = self.get_fav_threads() |
|
137 | threads = self.get_fav_threads() | |
137 |
|
138 | |||
138 |
max_fav_threads = settings.get_int( |
|
139 | max_fav_threads = settings.get_int(SECTION_VIEW, 'MaxFavoriteThreads') | |
139 | if (str(opening_post.id) in threads) or (len(threads) < max_fav_threads): |
|
140 | if (str(opening_post.id) in threads) or (len(threads) < max_fav_threads): | |
140 | thread = opening_post.get_thread() |
|
141 | thread = opening_post.get_thread() | |
141 | # Don't check for new posts if the thread is archived already |
|
142 | # Don't check for new posts if the thread is archived already |
@@ -27,8 +27,8 b' from boards.models.attachment.viewers im' | |||||
27 | from boards.models.post import TITLE_MAX_LENGTH |
|
27 | from boards.models.post import TITLE_MAX_LENGTH | |
28 | from boards.utils import validate_file_size, get_file_mimetype, \ |
|
28 | from boards.utils import validate_file_size, get_file_mimetype, \ | |
29 | FILE_EXTENSION_DELIMITER, get_tripcode_from_text |
|
29 | FILE_EXTENSION_DELIMITER, get_tripcode_from_text | |
|
30 | from boards.settings import SECTION_FORMS | |||
30 |
|
31 | |||
31 | SECTION_FORMS = 'Forms' |
|
|||
32 |
|
32 | |||
33 | POW_HASH_LENGTH = 16 |
|
33 | POW_HASH_LENGTH = 16 | |
34 | POW_LIFE_MINUTES = 5 |
|
34 | POW_LIFE_MINUTES = 5 |
@@ -6,6 +6,7 b" CONFIG_SETTINGS = 'boards/config/setting" | |||||
6 |
|
6 | |||
7 |
|
7 | |||
8 | SECTION_FORMS = 'Forms' |
|
8 | SECTION_FORMS = 'Forms' | |
|
9 | SECTION_VIEW = 'View' | |||
9 |
|
10 | |||
10 | VALUE_TRUE = 'true' |
|
11 | VALUE_TRUE = 'true' | |
11 |
|
12 |
@@ -17,7 +17,7 b' from django.utils.translation import uge' | |||||
17 | import boards |
|
17 | import boards | |
18 | from neboard import settings |
|
18 | from neboard import settings | |
19 | from boards.abstracts.constants import FILE_DIRECTORY |
|
19 | from boards.abstracts.constants import FILE_DIRECTORY | |
20 | from boards.settings import get_bool |
|
20 | from boards.settings import get_bool, SECTION_FORMS | |
21 |
|
21 | |||
22 | CACHE_KEY_DELIMITER = '_' |
|
22 | CACHE_KEY_DELIMITER = '_' | |
23 |
|
23 | |||
@@ -103,7 +103,7 b' def get_file_hash(file) -> str:' | |||||
103 |
|
103 | |||
104 |
|
104 | |||
105 | def validate_file_size(size: int): |
|
105 | def validate_file_size(size: int): | |
106 |
max_size = boards.settings.get_int( |
|
106 | max_size = boards.settings.get_int(SECTION_FORMS, 'MaxFileSize') | |
107 | if 0 < max_size < size: |
|
107 | if 0 < max_size < size: | |
108 | raise forms.ValidationError( |
|
108 | raise forms.ValidationError( | |
109 | _('Total file size must be less than %s but is %s.') |
|
109 | _('Total file size must be less than %s but is %s.') |
@@ -14,6 +14,7 b' from boards.models import Post, Thread' | |||||
14 | from boards.views.base import BaseBoardView, CONTEXT_FORM |
|
14 | from boards.views.base import BaseBoardView, CONTEXT_FORM | |
15 | from boards.views.mixins import FileUploadMixin, PaginatedMixin, \ |
|
15 | from boards.views.mixins import FileUploadMixin, PaginatedMixin, \ | |
16 | DispatcherMixin, PARAMETER_METHOD |
|
16 | DispatcherMixin, PARAMETER_METHOD | |
|
17 | from boards.settings import SECTION_VIEW, SECTION_FORMS | |||
17 |
|
18 | |||
18 | FORM_TAGS = 'tags' |
|
19 | FORM_TAGS = 'tags' | |
19 | FORM_TEXT = 'text' |
|
20 | FORM_TEXT = 'text' | |
@@ -68,7 +69,7 b' class AllThreadsView(FileUploadMixin, Ba' | |||||
68 | threads = threads.distinct() |
|
69 | threads = threads.distinct() | |
69 |
|
70 | |||
70 | paginator = get_paginator(threads, |
|
71 | paginator = get_paginator(threads, | |
71 |
settings.get_int( |
|
72 | settings.get_int(SECTION_VIEW, 'ThreadsPerPage')) | |
72 | paginator.current_page = int(page) |
|
73 | paginator.current_page = int(page) | |
73 |
|
74 | |||
74 | try: |
|
75 | try: | |
@@ -80,7 +81,7 b' class AllThreadsView(FileUploadMixin, Ba' | |||||
80 | params[CONTEXT_FORM] = form |
|
81 | params[CONTEXT_FORM] = form | |
81 | params[PARAMETER_MAX_FILE_SIZE] = self.get_max_upload_size() |
|
82 | params[PARAMETER_MAX_FILE_SIZE] = self.get_max_upload_size() | |
82 | params[PARAMETER_RSS_URL] = self.get_rss_url() |
|
83 | params[PARAMETER_RSS_URL] = self.get_rss_url() | |
83 |
params[PARAMETER_MAX_FILES] = settings.get_int( |
|
84 | params[PARAMETER_MAX_FILES] = settings.get_int(SECTION_FORMS, 'MaxFileCount') | |
84 |
|
85 | |||
85 | paginator.set_url(self.get_reverse_url(), request.GET.dict()) |
|
86 | paginator.set_url(self.get_reverse_url(), request.GET.dict()) | |
86 | params.update(self.get_page_context(paginator, page)) |
|
87 | params.update(self.get_page_context(paginator, page)) |
General Comments 0
You need to be logged in to leave comments.
Login now