Browse Source

버그 수정, 코드 최적화

잉여개발기 (SPDV) 5 năm trước cách đây
mục cha
commit
a6d31af683
3 tập tin đã thay đổi với 17 bổ sung21 xóa
  1. 2 1
      route/api_topic_sub.py
  2. 13 18
      route/tool/func.py
  3. 2 2
      version.json

+ 2 - 1
route/api_topic_sub.py

@@ -4,6 +4,7 @@ def api_topic_sub_2(conn, topic_num):
     curs = conn.cursor()
 
     topic_num = str(topic_num)
+    get_acl = acl_check('', 'render')
 
     if flask.request.args.get('num', None):
         curs.execute(db_change("select id, data, date, ip, block, top from topic where code = ? and id + 0 = ? + 0 order by id + 0 asc"), [
@@ -63,7 +64,7 @@ def api_topic_sub_2(conn, topic_num):
                 if t_data_f == '':
                     t_data_f = '[br]'
 
-                t_data_f = render_set(data = t_data_f, num = 2, include = 'topic_' + i[0])
+                t_data_f = render_set(data = t_data_f, num = 2, include = 'topic_' + i[0], acl = get_acl)
                 t_plus_data = t_data_f[1]
                 t_data_f = t_data_f[0]
 

+ 13 - 18
route/tool/func.py

@@ -166,8 +166,11 @@ def last_change(data):
 def easy_minify(data, tool = None):
     return last_change(data)
 
-def render_set(title = '', data = '', num = 0, s_data = 0, include = None):
-    if acl_check(title, 'render') == 1:
+def render_set(title = '', data = '', num = 0, s_data = 0, include = None, acl = None):
+    if not acl:
+        acl = acl_check(title, 'render')
+
+    if acl == 1:
         return 'HTTP Request 401.3'
     elif s_data == 1:
         return data
@@ -871,18 +874,13 @@ def acl_check(name = 'test', tool = '', topic_num = '1'):
     if tool == '' and acl_check(name, 'render') == 1:
         return 1
     
-    if tool == '':
+    if tool == '' and tool == 'topic':
         end = 3
-    elif tool == 'topic':
-        if not name:
+
+        if tool == 'topic' and not name:
             curs.execute(db_change("select title from rd where code = ?"), [topic_num])
             topic_data = curs.fetchall()
-            if topic_data:
-                name = topic_data[0][0]
-            else:
-                name = 'test'
-
-        end = 3
+            name = topic_data[0][0] if topic_data else 'test'
     elif tool == 'render':
         end = 2
     else:
@@ -988,13 +986,10 @@ def acl_check(name = 'test', tool = '', topic_num = '1'):
             return 1
         else:
             if i == (end - 1):
-                if tool == 'topic':
-                    if topic_num:
-                        curs.execute(db_change("select title from rd where code = ? and stop != ''"), [topic_num])
-                        if curs.fetchall():
-                            if admin_check(3, 'topic (code ' + topic_num + ')') == 1:
-                                return 0
-                        else:
+                if tool == 'topic' and topic_num:
+                    curs.execute(db_change("select title from rd where code = ? and stop != ''"), [topic_num])
+                    if curs.fetchall():
+                        if admin_check(3, 'topic (code ' + topic_num + ')') == 1:
                             return 0
                     else:
                         return 0

+ 2 - 2
version.json

@@ -1,10 +1,10 @@
 {
     "master" : {
-        "r_ver" : "v3.2.0-master-11",
+        "r_ver" : "v3.2.0-stable-10",
         "c_ver" : "3200900",
         "s_ver" : "9"
     }, "stable" : {
-        "r_ver" : "v3.2.0-stable-09",
+        "r_ver" : "v3.2.0-stable-10",
         "c_ver" : "3200900",
         "s_ver" : "9"
     }