Forráskód Böngészése

버그 수정, 편집 속도 제한 설정 추가

Surplus_Up (2DU) 6 éve
szülő
commit
2a7645bcfb

+ 6 - 1
language/en-US.json

@@ -16,6 +16,7 @@
         "skin" : "Skin",
         "skin" : "Skin",
         "save" : "Save",
         "save" : "Save",
         "secret_key" : "Secret key",
         "secret_key" : "Secret key",
+        "public_key" : "Public key",
         "host" : "Host",
         "host" : "Host",
         "port" : "Port",
         "port" : "Port",
         "restart" : "Restart",
         "restart" : "Restart",
@@ -95,6 +96,7 @@
         "icon" : "Icon",
         "icon" : "Icon",
         "view" : "View",
         "view" : "View",
         "content" : "Content",
         "content" : "Content",
+        "off" : "Off",
         "_comment_1.1_" : "Time",
         "_comment_1.1_" : "Time",
             "second" : "Second(s)",
             "second" : "Second(s)",
             "hour" : "Hour(s)",
             "hour" : "Hour(s)",
@@ -236,6 +238,7 @@
                 "email_required" : "Email required",
                 "email_required" : "Email required",
                 "google_imap_required" : "Google IMAP setting required",
                 "google_imap_required" : "Google IMAP setting required",
                 "update_branch" : "Branch to import updates",
                 "update_branch" : "Branch to import updates",
+                "slow_edit" : "Continuous edit limit",
             "_comment_2.2.3_" : "Text",
             "_comment_2.2.3_" : "Text",
                 "register_text" : "Terms of sign-up",
                 "register_text" : "Terms of sign-up",
                 "non_login_alert" : "Non-login alert",
                 "non_login_alert" : "Non-login alert",
@@ -306,6 +309,7 @@
         "defalut_edit_help" : "Describe it here",
         "defalut_edit_help" : "Describe it here",
         "markup_enabled" : "Markup enabled",
         "markup_enabled" : "Markup enabled",
         "many_delete_help" : "Please write down the document name one by one on the line.",
         "many_delete_help" : "Please write down the document name one by one on the line.",
+        "sqlite_only" : "SQLite only",
         "_comment_3.1_" : "Error",
         "_comment_3.1_" : "Error",
             "update_error" : "Auto update is not support.",
             "update_error" : "Auto update is not support.",
             "inter_error" : "Internal error.",
             "inter_error" : "Internal error.",
@@ -331,5 +335,6 @@
             "topic_long_error" : "The discussion name must not exceed 256 characters.",
             "topic_long_error" : "The discussion name must not exceed 256 characters.",
             "email_error" : "No one has this email.",
             "email_error" : "No one has this email.",
             "regex_error" : "There is an error in the regular expression.",
             "regex_error" : "There is an error in the regular expression.",
-            "decument_404_error" : "This document does not exist."
+            "decument_404_error" : "This document does not exist.",
+            "fast_edit_error" : "Editing speed is too fast. Limit (Second(s)) : "
 }
 }

+ 6 - 1
language/ko-KR.json

@@ -309,5 +309,10 @@
     "default_view_acl" : "기본 보기 ACL",
     "default_view_acl" : "기본 보기 ACL",
     "topic_delete" : "토론 삭제",
     "topic_delete" : "토론 삭제",
     "edit_req" : "편집 요청",
     "edit_req" : "편집 요청",
-    "edit_req_check" : "편집 요청 검사"
+    "edit_req_check" : "편집 요청 검사",
+    "sqlite_only" : "SQLite만",
+    "off" : "끄기",
+    "slow_edit" : "연속 편집 제한 시간",
+    "public_key" : "공개키",
+    "fast_edit_error" : "편집 속도가 너무 빠릅니다. 제한 (초) : "
 }
 }

+ 3 - 0
route/edit.py

@@ -40,6 +40,9 @@ def edit_2(conn, tool, name):
         else:
         else:
             captcha_post('', 0)
             captcha_post('', 0)
 
 
+        if slow_edit_check() == 1:
+            return re_error('/error/24')
+
         today = get_time()
         today = get_time()
         if tool == 'edit_req' and get_ver:
         if tool == 'edit_req' and get_ver:
             content = old[0][0]
             content = old[0][0]

+ 3 - 0
route/edit_delete.py

@@ -13,6 +13,9 @@ def edit_delete_2(conn, name, app_var):
         else:
         else:
             captcha_post('', 0)
             captcha_post('', 0)
 
 
+        if slow_edit_check() == 1:
+            return re_error('/error/24')
+
         curs.execute(db_change("select data from data where title = ?"), [name])
         curs.execute(db_change("select data from data where title = ?"), [name])
         data = curs.fetchall()
         data = curs.fetchall()
         if data:
         if data:

+ 3 - 0
route/edit_move.py

@@ -12,6 +12,9 @@ def edit_move_2(conn, name):
         else:
         else:
             captcha_post('', 0)
             captcha_post('', 0)
 
 
+        if slow_edit_check() == 1:
+            return re_error('/error/24')
+
         curs.execute(db_change("select title from history where title = ?"), [flask.request.form.get('title', None)])
         curs.execute(db_change("select title from history where title = ?"), [flask.request.form.get('title', None)])
         if curs.fetchall():
         if curs.fetchall():
             if admin_check(None, 'merge documents') == 1:
             if admin_check(None, 'merge documents') == 1:

+ 3 - 0
route/edit_revert.py

@@ -17,6 +17,9 @@ def edit_revert_2(conn, name):
             return re_error('/error/13')
             return re_error('/error/13')
         else:
         else:
             captcha_post('', 0)
             captcha_post('', 0)
+
+        if slow_edit_check() == 1:
+            return re_error('/error/24')
     
     
         curs.execute(db_change("select data from history where title = ? and id = ?"), [name, str(num)])
         curs.execute(db_change("select data from history where title = ? and id = ?"), [name, str(num)])
         data = curs.fetchall()
         data = curs.fetchall()

+ 16 - 11
route/setting.py

@@ -50,7 +50,8 @@ def setting_2(conn, num):
             15 : 'encode', 
             15 : 'encode', 
             16 : 'host',
             16 : 'host',
             17 : 'upload_acl',
             17 : 'upload_acl',
-            18 : 'all_view_acl'
+            18 : 'all_view_acl',
+            19 : 'slow_edit'
         }
         }
         n_list = {
         n_list = {
             0 : 'Wiki', 
             0 : 'Wiki', 
@@ -71,7 +72,8 @@ def setting_2(conn, num):
             15 : 'sha3', 
             15 : 'sha3', 
             16 : '0.0.0.0',
             16 : '0.0.0.0',
             17 : '',
             17 : '',
-            18 : ''
+            18 : '',
+            19 : '0'
         }
         }
         
         
         if flask.request.method == 'POST':
         if flask.request.method == 'POST':
@@ -162,11 +164,11 @@ def setting_2(conn, num):
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <input type="text" name="license" value="''' + html.escape(d_list[3]) + '''">
                         <input type="text" name="license" value="''' + html.escape(d_list[3]) + '''">
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
-                        <span>''' + load_lang('max_file_size') + ''' [MB]</span>
+                        <span>''' + load_lang('max_file_size') + ''' (MB)</span>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <input type="text" name="upload" value="''' + html.escape(d_list[4]) + '''">
                         <input type="text" name="upload" value="''' + html.escape(d_list[4]) + '''">
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
-                        <span>''' + load_lang('backup_interval') + ' [' + load_lang('hour') + '''] (off : 0) {restart}</span>
+                        <span>''' + load_lang('backup_interval') + ' (' + load_lang('hour') + ' | ' + load_lang('off') + ' : 0 | ' + load_lang('sqlite_only') + ' | ' + load_lang('restart_required') + ''')</span>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <input type="text" name="back_up" value="''' + html.escape(d_list[9]) + '''">
                         <input type="text" name="back_up" value="''' + html.escape(d_list[9]) + '''">
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
@@ -194,7 +196,7 @@ def setting_2(conn, num):
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <input type="checkbox" name="ip_view" ''' + check_box_div[1] + '''> ''' + load_lang('hide_ip') + '''
                         <input type="checkbox" name="ip_view" ''' + check_box_div[1] + '''> ''' + load_lang('hide_ip') + '''
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
-                        <input type="checkbox" name="email_have" ''' + check_box_div[2] + '''> ''' + load_lang('email_required') + ' <a href="/setting/6">{' + load_lang('google_imap_required') + '''}</a>
+                        <input type="checkbox" name="email_have" ''' + check_box_div[2] + '''> ''' + load_lang('email_required') + ' <a href="/setting/6">(' + load_lang('google_imap_required') + ''')</a>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <span>''' + load_lang('wiki_host') + '''</span>
                         <span>''' + load_lang('wiki_host') + '''</span>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
@@ -216,6 +218,10 @@ def setting_2(conn, num):
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <select name="encode">''' + acl_div[3] + '''</select>
                         <select name="encode">''' + acl_div[3] + '''</select>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
+                        <span>''' + load_lang('slow_edit') + ' (' + load_lang('second') + ' | ' + load_lang('off') + ''' : 0)</span>
+                        <hr class=\"main_hr\">
+                        <input name="''' + i_list[19] + '''" value="''' + html.escape(d_list[19]) + '''">
+                        <hr class=\"main_hr\">
                         <button id="save" type="submit">''' + load_lang('save') + '''</button>
                         <button id="save" type="submit">''' + load_lang('save') + '''</button>
                     </form>
                     </form>
                 ''',
                 ''',
@@ -512,17 +518,16 @@ def setting_2(conn, num):
                 imp = ['Google', wiki_set(), custom(), other2([0, 0])],
                 imp = ['Google', wiki_set(), custom(), other2([0, 0])],
                 data = '''
                 data = '''
                     <form method="post">
                     <form method="post">
-                        <h2><a href="https://www.google.com/recaptcha/admin">recaptcha</a></h2>
-                        <hr class=\"main_hr\">
-                        <span>''' + load_lang('recaptcha') + ''' (HTML)</span>
+                        <h2><a href="https://www.google.com/recaptcha/admin">''' + load_lang('recaptcha') + '''</a></h2>
+                        <span>HTML</span>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
-                        <input name="recaptcha" placeholder='&lt;div class="g-recaptcha" data-sitekey="your_site_key"&gt;&lt;/div&gt;' value="''' + html.escape(d_list[0]) + '''">
+                        <input name="recaptcha" placeholder='&lt;div class="g-recaptcha" data-sitekey="''' + load_lang('public_key') + '''"&gt;&lt;/div&gt;' value="''' + html.escape(d_list[0]) + '''">
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
-                        <span>''' + load_lang('recaptcha') + ' (' + load_lang('secret_key') + ''')</span>
+                        <span>''' + load_lang('secret_key') + '''</span>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <input name="sec_re" value="''' + html.escape(d_list[1]) + '''">
                         <input name="sec_re" value="''' + html.escape(d_list[1]) + '''">
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
-                        <h2><a href="https://support.google.com/mail/answer/7126229">''' + load_lang('google_imap') + '</a> {' + load_lang('restart_required') + '''}</h1>
+                        <h2><a href="https://support.google.com/mail/answer/7126229">''' + load_lang('google_imap') + '</a> (' + load_lang('restart_required') + ''')</h1>
                         <span>''' + load_lang('google_email') + '''</span>
                         <span>''' + load_lang('google_email') + '''</span>
                         <hr class=\"main_hr\">
                         <hr class=\"main_hr\">
                         <input name="g_email" value="''' + html.escape(d_list[2]) + '''">
                         <input name="g_email" value="''' + html.escape(d_list[2]) + '''">

+ 22 - 1
route/tool/func.py

@@ -765,6 +765,23 @@ def load_skin(data = '', set_n = 0):
 
 
     return skin_return_data
     return skin_return_data
 
 
+def slow_edit_check():
+    curs.execute(db_change("select data from other where name = 'slow_edit'"))
+    slow_edit = curs.fetchall()
+    if slow_edit and slow_edit != '0' and admin_check(5) != 1:
+        slow_edit = slow_edit[0][0]
+
+        curs.execute(db_change("select date from history 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]))
+            now_edit_data = int((datetime.datetime.now() - datetime.timedelta(seconds = int(slow_edit))).strftime("%Y%m%d%H%M%S"))
+
+            if last_edit_data > now_edit_data:
+                return 1
+
+    return 0
+
 def acl_check(name = 'test', tool = '', sub = 'test'):
 def acl_check(name = 'test', tool = '', sub = 'test'):
     ip = ip_check()
     ip = ip_check()
     
     
@@ -993,7 +1010,7 @@ def history_plus(title, data, date, ip, send, leng, t_check = '', d_type = ''):
         curs.execute(db_change("select title from history where title = ? and id = ? and type = 'req'"), [title, id_data])
         curs.execute(db_change("select title from history where title = ? and id = ? and type = 'req'"), [title, id_data])
         if curs.fetchall():
         if curs.fetchall():
             curs.execute(db_change("update history set type = 'req_close' where title = ? and id = ? and type = 'req'"), [
             curs.execute(db_change("update history set type = 'req_close' where title = ? and id = ? and type = 'req'"), [
-                name,
+                title,
                 id_data
                 id_data
             ])
             ])
 
 
@@ -1116,6 +1133,10 @@ def re_error(data):
                 data = load_lang('file_name_error')
                 data = load_lang('file_name_error')
             elif num == 23:
             elif num == 23:
                 data = load_lang('regex_error')
                 data = load_lang('regex_error')
+            elif num == 24:
+                curs.execute(db_change("select data from other where name = 'slow_edit'"))
+                slow_data = curs.fetchall()
+                data = load_lang('fast_edit_error') + slow_data[0][0]
             else:
             else:
                 data = '???'
                 data = '???'
 
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
 {
     "master" : {
     "master" : {
-        "r_ver" : "v3.1.5-master-36",
+        "r_ver" : "v3.1.5-master-37",
         "c_ver" : "400007",
         "c_ver" : "400007",
         "s_ver" : "7"
         "s_ver" : "7"
     }, "stable" : {
     }, "stable" : {