2du il y a 5 ans
Parent
commit
9f49bc455f

+ 32 - 10
route/api_w.py

@@ -3,28 +3,42 @@ from .tool.func import *
 def api_w_2(conn, name):
     curs = conn.cursor()
 
-    if flask.request.args.get('exist', None):
+    data_arg_exist = flask.request.args.get('exist', '')
+    if data_arg_exist != '':
         curs.execute(db_change("select title from data where title = ?"), [name])
         if curs.fetchall():
             return flask.jsonify({ "exist" : "1" })
     else:
         if acl_check(name, 'render') != 1:
             if flask.request.method == 'POST':
-                g_data = flask.request.form.get('data', '')
-                g_data = render_set(title = name, data = g_data, num = 2)
+                data_org = flask.request.form.get('data', '')
+                data_pas = render_set(
+                    title = name, 
+                    data = data_org, 
+                    num = 2
+                )
 
-                return flask.jsonify({ "title" : name, "data" : g_data[0], "js_data" : g_data[1] })
+                return flask.jsonify({
+                    "data" : data_pas[0], 
+                    "js_data" : data_pas[1]
+                })
             else:
-                rev = flask.request.args.get('num', '')
-                if rev != '':
+                data_arg_rev = flask.request.args.get('num', '')
+                if data_arg_rev != '':
                     curs.execute(db_change("select data from history where title = ? and id = ?"), [name, rev])
                 else:
                     curs.execute(db_change("select data from data where title = ?"), [name])
+                
                 data = curs.fetchall()
                 if data:
+                    name_org = flask.request.args.get('name_org', '')
+                    if name_org == '':
+                        name_org = name
+                        
                     json_data = data[0][0]
-                    include_data = flask.request.args.get('include', None)
-                    if include_data:
+                    
+                    include_data = flask.request.args.get('include', '')
+                    if include_data != '':
                         get_all_change_1 = []
                         find_replace_moment = re.findall(r'(@([^=@]+)=([^=@]+)@|@([^=@]+)@)', json_data)
                         for i in find_replace_moment:
@@ -43,8 +57,16 @@ def api_w_2(conn, name):
                                 1
                             )
                         
-                    g_data = render_set(title = name, data = json_data, num = 2, include = include_data)
+                    data_pas = render_set(
+                        title = name_org, 
+                        data = json_data, 
+                        num = 2, 
+                        include = include_data
+                    )
 
-                    return flask.jsonify({ "title" : name, "data" : g_data[0], "js_data" : g_data[1] })
+                    return flask.jsonify({
+                        "data" : data_pas[0], 
+                        "js_data" : data_pas[1]
+                    })
 
     return flask.jsonify({})

+ 0 - 1
route/give_user_ban.py

@@ -19,7 +19,6 @@ def give_user_ban_2(conn, name):
         regex_get = flask.request.form.get('regex', None)
         login = flask.request.form.get('login', '')
         why = flask.request.form.get('why', '')
-        print([end])
 
         if regex_get or band != '':
             type_d = 'regex' if regex_get else band

+ 3 - 2
route/tool/func.py

@@ -297,7 +297,8 @@ def update(ver_num, set_data):
         if get_data and get_data[0][0] == 'master':
             curs.execute(db_change("update other set data = 'beta' where name = 'update'"), [])
 
-    if ver_num < 3202500:
+    # 캐시 초기화
+    if ver_num < 3206000:
         curs.execute(db_change('delete from cache_data'))
 
     if ver_num < 3202600:
@@ -586,7 +587,7 @@ def next_fix(link, num, page, end = 50):
 
 def other2(data):
     global req_list
-    main_css_ver = '78'
+    main_css_ver = '79'
     data += ['' for _ in range(0, 3 - len(data))]
 
     if req_list == '':

+ 2 - 3
route/tool/mark.py

@@ -1,6 +1,5 @@
-from .set_mark.namumark import namumark
-
-from .set_mark.tool import *
+from .namumark import namumark
+from .tool import *
 
 import re
 import os

+ 8 - 1
route/tool/set_mark/namumark.py → route/tool/namumark.py

@@ -656,7 +656,14 @@ def namumark(conn, data, title, include_num):
                     else:
                         break
 
-                plus_data += 'load_include("' + include_link + '", "' + include_name + 'include_' + str(i) + '", ' + str(include_plus_data) + ');\n'
+                plus_data += '' + \
+                    'load_include(' + \
+                        '"' + include_link + '", '+ \
+                        '"' + include_name + 'include_' + str(i) + '", ' + \
+                        str(include_plus_data) + ', ' + \
+                        '"' + title + '"' + \
+                    ');\n' + \
+                ''
             else:
                 break
     else:

+ 0 - 0
route/tool/set_mark/tool.py → route/tool/tool.py


+ 1 - 1
version.json

@@ -1,7 +1,7 @@
 {
     "beta" : {
         "r_ver" : "v3.2.0-stable-13 (beta-60) (dev-2021-03-26-01)",
-        "c_ver" : "3205500",
+        "c_ver" : "3206000",
         "s_ver" : "11"
     }
 }

+ 18 - 11
views/main_css/js/render_namumark.js

@@ -115,29 +115,36 @@ function get_file_state(data, i = 0) {
     }
 }
 
-function load_include(title, name, p_data) {
+function load_include(name_doc, name_ob, data_include, name_org = '') {
     var change = '';
-    for(key in p_data) {
-        change += '@' + p_data[key][0].replace('&', '<amp>') + '@,' + p_data[key][1].replace(',', '<comma>').replace('&', '<amp>') + ','
+    for(var key in data_include) {
+        change += '' +
+            '@' + data_include[key][0].replace('&', '<amp>') + '@,' + 
+            data_include[key][1].replace(',', '<comma>').replace('&', '<amp>') + ',' +
+        ''
     }
     
-    var url = "/api/w/" + encodeURI(title) + "?include=" + name + "&change=" + change;
+    var url = '' +
+        "/api/w/" + encodeURI(name_doc) + 
+        "?include=" + name_ob + 
+        "&change=" + change +
+        '&name_org=' + name_org +
+    '';
 
     var xhr = new XMLHttpRequest();
     xhr.open("GET", url);
     xhr.send();
 
-    console.log(url);
     xhr.onreadystatechange = function() {
         if(this.readyState === 4 && this.status === 200) {
             if(this.responseText === "{}\n") {
-                document.getElementById(name).innerHTML = "";
-                document.getElementsByClassName(name)[0].href = "/w/" + do_url_change(title); 
-                document.getElementsByClassName(name)[0].id = "not_thing";
+                document.getElementById(name_ob).innerHTML = "";
+                document.getElementsByClassName(name_ob)[0].href = "/w/" + do_url_change(name_doc); 
+                document.getElementsByClassName(name_ob)[0].id = "not_thing";
             } else {
-                var o_p_data = JSON.parse(this.responseText);
-                document.getElementById(name).innerHTML = o_p_data['data'];
-                eval(o_p_data['js_data']);
+                var data_load = JSON.parse(this.responseText);
+                document.getElementById(name_ob).innerHTML = data_load['data'];
+                eval(data_load['js_data']);
             }
         }
     }