소스 검색

https://github.com/openNAMU/openNAMU/issues/1558

잉여개발기 (SPDV) 2 년 전
부모
커밋
427f93b930
5개의 변경된 파일24개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 0
      route/edit.py
  2. 6 0
      route/edit_revert.py
  3. 6 0
      route/main_setting_main.py
  4. 5 1
      route/tool/func.py
  5. 1 1
      version.json

+ 6 - 0
route/edit.py

@@ -177,6 +177,12 @@ def edit(name = 'Test', section = 0, do_type = ''):
             else:
                 leng = '+' + str(len(content))
 
+            curs.execute(db_change("select data from other where name = 'document_content_max_length'"))
+            db_data_3 = curs.fetchall()
+            if db_data_3 and db_data_3[0][0] != '':
+                if int(number_check(db_data_3[0][0])) < len(content):
+                    return re_error('/error/44')
+
             curs.execute(db_change("select data from other where name = 'edit_timeout'"))
             db_data_2 = curs.fetchall()
             db_data_2 = '' if not db_data_2 else number_check(db_data_2[0][0])

+ 6 - 0
route/edit_revert.py

@@ -36,6 +36,12 @@ def edit_revert(name, num):
 
             if do_edit_filter(data[0][0]) == 1:
                 return re_error('/error/21')
+            
+            curs.execute(db_change("select data from other where name = 'document_content_max_length'"))
+            db_data = curs.fetchall()
+            if db_data and db_data[0][0] != '':
+                if int(number_check(db_data[0][0])) < len(data[0][0]):
+                    return re_error('/error/44')
 
             curs.execute(db_change("select data from data where title = ?"), [name])
             data_old = curs.fetchall()

+ 6 - 0
route/main_setting_main.py

@@ -41,6 +41,7 @@ def main_setting_main(db_set):
             37 : ['move_with_redirect', ''],
             38 : ['slow_thread', ''],
             39 : ['edit_timeout', '5'],
+            40 : ['document_content_max_length', '']
         }
 
         if flask.request.method == 'POST':
@@ -260,6 +261,11 @@ def main_setting_main(db_set):
                         <input name="edit_timeout" value="''' + html.escape(d_list[39]) + '''">
                         <hr class="main_hr">
 
+                        <span>''' + load_lang('document_content_max_length') + '''</span> (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')
+                        <hr class="main_hr">
+                        <input name="document_content_max_length" value="''' + html.escape(d_list[40]) + '''">
+                        <hr class="main_hr">
+
                         <button id="opennamu_save_button" type="submit">''' + load_lang('save') + '''</button>
                     </form>
                 '''),

+ 5 - 1
route/tool/func.py

@@ -2655,8 +2655,12 @@ def re_error(data):
             elif num == 43:
                 title = load_lang('application_submitted')
                 sub_title = title
-
                 data = load_lang('waiting_for_approval')
+            elif num == 44:
+                curs.execute(db_change("select data from other where name = 'document_content_max_length'"))
+                db_data = curs.fetchall()
+                db_data = '' if not db_data else db_data[0][0]
+                data = load_lang('error_content_length_too_long') + db_data
             else:
                 data = '???'
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC5-dev41",
+        "r_ver" : "v3.4.6-RC5-dev42",
         "c_ver" : "3500373",
         "s_ver" : "3500112"
     }