Ver Fonte

스레드 대기 시간 기능 추가

https://github.com/openNAMU/openNAMU/issues/1744
잉여개발기 (SPDV) há 2 anos atrás
pai
commit
55830e3321
5 ficheiros alterados com 22 adições e 9 exclusões
  1. 1 0
      route/main_setting.py
  2. 0 3
      route/main_setting_main.py
  3. 17 5
      route/tool/func.py
  4. 3 0
      route/topic.py
  5. 1 1
      version.json

+ 1 - 0
route/main_setting.py

@@ -13,6 +13,7 @@ def main_setting():
             ['sitemap', load_lang('sitemap_management')],
             ['top_menu', load_lang('top_menu_setting')],
             ['skin_set', load_lang('main_skin_set_default')],
+            ['acl', load_lang('main_acl_setting')]
         ]
 
         li_data = ''.join(['<li><a href="/setting/' + str(li[0]) + '">' + li[1] + '</a></li>' for li in li_list])

+ 0 - 3
route/main_setting_main.py

@@ -226,9 +226,6 @@ def main_setting_main(db_set):
                         </span>
 
                         <h2>''' + load_lang('edit_set') + '''</h2>
-                        <span><a href="/setting/acl">(''' + load_lang('main_acl_setting') + ''')</a></span>
-                        <hr class="main_hr">
-
                         <span>''' + load_lang('slow_edit') + ''' (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')</span>
                         <hr class="main_hr">
                         <input name="slow_edit" value="''' + html.escape(d_list[19]) + '''">

+ 17 - 5
route/tool/func.py

@@ -2260,18 +2260,25 @@ def do_edit_send_check(data):
     
     return 0
 
-def do_edit_slow_check():
+def do_edit_slow_check(do_type = 'edit'):
     curs = conn.cursor()
 
-    curs.execute(db_change("select data from other where name = 'slow_edit'"))
+    if do_type == 'edit':
+        curs.execute(db_change("select data from other where name = 'slow_edit'"))
+    else:
+        # do_type == 'thread'
+        curs.execute(db_change("select data from other where name = 'slow_thread'"))
+    
     slow_edit = curs.fetchall()
     if slow_edit and slow_edit[0][0] != '':
         if acl_check(None, 'slow_edit') == 1:
             slow_edit = int(number_check(slow_edit[0][0]))
 
-            curs.execute(db_change(
-                "select date from history where ip = ? order by date desc limit 1"
-            ), [ip_check()])
+            if do_type == 'edit':
+                curs.execute(db_change("select date from history where ip = ? order by date desc limit 1"), [ip_check()])
+            else:
+                curs.execute(db_change("select date from topic where ip = ? order by date desc limit 1"), [ip_check()])
+            
             last_edit_data = curs.fetchall()
             if last_edit_data:
                 last_edit_data = int(re.sub(' |:|-', '', last_edit_data[0][0]))
@@ -2711,6 +2718,11 @@ def re_error(data):
             db_data = curs.fetchall()
             db_data = '' if not db_data else db_data[0][0]
             data = load_lang('timeout_error') + db_data
+        elif num == 42:
+            curs.execute(db_change("select data from other where name = 'slow_thread'"))
+            db_data = curs.fetchall()
+            db_data = '' if not db_data else db_data[0][0]
+            data = load_lang('fast_edit_error') + db_data
         else:
             data = '???'
 

+ 3 - 0
route/topic.py

@@ -13,6 +13,9 @@ def topic(topic_num = 0, do_type = '', doc_name = 'Test'):
             return re_error('/ban')
 
         if flask.request.method == 'POST' and do_type == '':
+            if do_edit_slow_check('thread') == 1:
+                return re_error('/error/42')
+
             name = flask.request.form.get('topic', 'Test')
             sub = flask.request.form.get('title', 'Test')
             

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC3-dev199",
+        "r_ver" : "v3.4.6-RC3-dev200",
         "c_ver" : "3500361",
         "s_ver" : "3500111"
     }