Surplus_Up (2DU) 6 лет назад
Родитель
Сommit
7dc4a0204d
6 измененных файлов с 33 добавлено и 39 удалено
  1. 1 0
      app.py
  2. 9 13
      emergency_tool.py
  3. 1 1
      language/ko-KR.json
  4. 1 4
      route/api_user_info.py
  5. 19 19
      route/tool/func.py
  6. 2 2
      version.json

+ 1 - 0
app.py

@@ -244,6 +244,7 @@ if not os.path.exists(app_var['path_data_image']):
 if not os.path.exists('views'):
     os.makedirs('views')
 
+print('----')
 import route.tool.init as server_init
 
 dislay_set_key = ['Host', 'Port', 'Language', 'Markup', 'Encryption method']

+ 9 - 13
emergency_tool.py

@@ -186,19 +186,15 @@ elif what_i_do == '3':
     print('IP or Name : ', end = '')
     user_data = input()
 
-    if re.search(r"^([0-9]{1,3}\.[0-9]{1,3})$", user_data):
-        band = 'O'
-    else:
-        band = ''
-
-        curs.execute(db_change("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)"),
-            [user_data,
-            'release',
-            get_time(),
-            'tool:emergency',
-            '',
-            band
-        ])
+    curs.execute(db_change("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)"),
+        [user_data,
+        'release',
+        get_time(),
+        'tool:emergency',
+        '',
+        ''
+    ])
+
     curs.execute(db_change("delete from ban where block = ?"), [user_data])
 elif what_i_do == '4':
     print('----')

+ 1 - 1
language/ko-KR.json

@@ -107,7 +107,7 @@
     "reset_user_ok": "검사 성공",
     "in_progress": "진행 중",
     "under_category": "하위 분류",
-    "range": "범위",
+    "range": "대역",
     "edit_filter_rule": "편집 필터 규칙",
     "oauth_connection": "Oauth 연결",
     "hide_ip": "IP 주소 숨기기",

+ 1 - 4
route/api_user_info.py

@@ -47,9 +47,6 @@ def api_user_info_2(conn, name):
             plus_t += [load_lang('normal')]
         else:
             plus_t += [load_lang('blocked') + '<br>']
-
-            match = re.search(r"^([0-9]{1,3}\.[0-9]{1,3})", name)
-            match = match.group(1) if match else '-'
             regex_ban = 0
 
             curs.execute(db_change("select login, block, end, why from ban where band = 'regex'"))
@@ -62,7 +59,7 @@ def api_user_info_2(conn, name):
                     regex_ban = 1
 
             if regex_ban == 0:
-                curs.execute(db_change("select end, login, band, why from ban where block = ? or block = ?"), [name, match])
+                curs.execute(db_change("select end, login, band, why from ban where block = ?"), [name])
                 block_data = curs.fetchall()
                 if block_data:
                     plus_t[1] += load_lang('type') + ' : ' + (load_lang('band_blocked') if block_data[0][2] == 'O' else load_lang('normal'))

+ 19 - 19
route/tool/func.py

@@ -210,7 +210,25 @@ def update(ver_num, set_data):
     if ver_num < 3182000:
         curs.execute(db_change('delete from cache_data'))
 
+    if ver_num < 3183603:
+        curs.execute(db_change("select block from ban where band = 'O'"))
+        change_band = curs.fetchall()
+        for i in change_band:
+            curs.execute(db_change("update ban set block = ?, band = 'regex' where block = ? and band = 'O'"), [
+                '^' + i[0].replace('.', '\\.'),
+                i[0]
+            ])
+
+        curs.execute(db_change("select block from rb where band = 'O'"))
+        change_band = curs.fetchall()
+        for i in change_band:
+            curs.execute(db_change("update rb set block = ?, band = 'regex' where block = ? and band = 'O'"), [
+                '^' + i[0].replace('.', '\\.'),
+                i[0]
+            ])
+
     conn.commit()
+
     print('Update pass')
 
 def set_init():
@@ -970,12 +988,6 @@ def ban_check(ip = None, tool = None):
     if admin_check(None, None, ip) == 1:
         return 0
 
-    band = re.search(r"^([0-9]{1,3}\.[0-9]{1,3})", ip)
-    if band:
-        band_it = band.group(1)
-    else:
-        band_it = '-'
-
     curs.execute(db_change("delete from ban where (end < ? and end like '2%')"), [get_time()])
     conn.commit()
 
@@ -990,15 +1002,6 @@ def ban_check(ip = None, tool = None):
             else:
                 return 1
 
-    curs.execute(db_change("select login from ban where ((end > ? and end like '2%') or end = '') and block = ? and band = 'O'"), [get_time(), band_it])
-    band_d = curs.fetchall()
-    if band_d:
-        if tool and tool == 'login':
-            if band_d[0][0] != 'O':
-                return 1
-        else:
-            return 1
-
     curs.execute(db_change("select login from ban where ((end > ? and end like '2%') or end = '') and block = ? and band = ''"), [get_time(), ip])
     ban_d = curs.fetchall()
     if ban_d:
@@ -1016,10 +1019,7 @@ def ban_insert(name, end, why, login, blocker, type_d = None):
     if type_d:
         band = type_d
     else:
-        if re.search(r"^([0-9]{1,3}\.[0-9]{1,3})$", name):
-            band = 'O'
-        else:
-            band = ''
+        band = ''
 
     curs.execute(db_change("delete from ban where (end < ? and end like '2%')"), [get_time()])
 

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "master" : {
-        "r_ver" : "v3.1.8-master-35",
-        "c_ver" : "3183000",
+        "r_ver" : "v3.1.8-master-36",
+        "c_ver" : "3183603",
         "s_ver" : "8"
     }, "stable" : {
         "r_ver" : "v3.1.7-stable-04",