2du 5 лет назад
Родитель
Сommit
e87f7f596a

+ 5 - 6
app.py

@@ -1,9 +1,6 @@
 # Init
 from route import *
 
-# 전반적으로 전부 수정 필요
-raise
-
 # Init-Version
 version_list = json.loads(open('version.json', encoding = 'utf8').read())
 
@@ -124,9 +121,11 @@ create_data['data'] = ['title', 'data', 'type']
 create_data['history'] = ['id', 'title', 'data', 'date', 'ip', 'send', 'leng', 'hide', 'type']
 create_data['rc'] = ['id', 'title', 'date', 'type']
 create_data['rd'] = ['title', 'sub', 'code', 'date', 'band', 'stop', 'agree', 'acl']
+# 제거 완료
 # create_data['user'] = ['id', 'pw', 'acl', 'date', 'encode']
 create_data['user_set'] = ['name', 'id', 'data']
-create_data['user_application'] = ['id', 'pw', 'date', 'encode', 'question', 'answer', 'ip', 'ua', 'token', 'email']
+# 제거 완료
+# create_data['user_application'] = ['id', 'pw', 'date', 'encode', 'question', 'answer', 'ip', 'ua', 'token', 'email']
 create_data['topic'] = ['id', 'data', 'date', 'ip', 'block', 'top', 'code']
 create_data['rb'] = ['block', 'end', 'today', 'blocker', 'why', 'band', 'login', 'ongoing']
 create_data['back'] = ['title', 'link', 'type']
@@ -674,7 +673,7 @@ def api_search(name = ''):
 def api_recent_change():
     return api_recent_change_2(conn)
 
-@app.route('/api/sha224/<everything:name>')
+@app.route('/api/sha224/<everything:name>', methods=['POST', 'GET'])
 def api_sha224(name = 'test'):
     return api_sha224_2(conn, name)
 
@@ -682,7 +681,7 @@ def api_sha224(name = 'test'):
 def api_title_index():
     return api_title_index_2(conn)
 
-@app.route('/api/image/<everything:name>')
+@app.route('/api/image/<everything:name>', methods=['POST', 'GET'])
 def api_image_view(name = ''):
     return api_image_view_2(conn, name)
 

+ 26 - 14
emergency_tool.py

@@ -70,7 +70,10 @@ if data_db_load == 'Y':
     if set_data['db_type'] == 'mysql':
         if not os.path.exists(os.path.join('data', 'mysql.json')):
             db_set_list = ['user', 'password', 'host', 'port']
-            set_data = json.loads(open(os.path.join('data', 'mysql.json'), encoding = 'utf8').read())
+            set_data = json.loads(open(
+                os.path.join('data', 'mysql.json'), 
+                encoding = 'utf8'
+            ).read())
             for i in db_set_list:
                 if not i in set_data:
                     print('Please delete mysql.json')
@@ -164,7 +167,12 @@ if what_i_do == '1':
     print('----')
     print('Load...')
 
-    curs.execute(db_change("select title from data d where not exists (select title from back where link = d.title limit 1)"))
+    curs.execute(db_change("" + \
+        "select title from data d " + \
+        "where not exists (" + \
+            "select title from back where link = d.title limit 1" + \
+        ")" + \
+    ""))
     title = curs.fetchall()
 
     print('----')
@@ -192,8 +200,11 @@ elif what_i_do == '3':
     print('IP or Name : ', end = '')
     user_data = input()
 
-    curs.execute(db_change("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)"),
-        [user_data,
+    curs.execute(db_change("" + \
+        "insert into rb (block, end, today, blocker, why, band) " + \
+        "values (?, ?, ?, ?, ?, ?)"
+    ), [
+        user_data,
         'release',
         get_time(),
         'tool:emergency',
@@ -259,10 +270,8 @@ elif what_i_do == '8':
 
     curs.execute(db_change("update other set data = ? where name = 'ver'"), [new_ver])
 elif what_i_do == '9':
-    try:
-        os.remove('data/set.json')
-    except:
-        pass
+    if os.path.exists(os.path.join('data', 'set.json')):
+        os.remove(os.path.join('data', 'set.json'))
 elif what_i_do == '10':
     print('----')
     print('User name : ', end = '')
@@ -272,12 +281,13 @@ elif what_i_do == '10':
     print('New name : ', end = '')
     new_name = input()
 
-    curs.execute(db_change("update user_set set id = ? where id = ?"), [new_name, user_name])
+    curs.execute(db_change("update user_set set id = ? where id = ?"), [
+        new_name, 
+        user_name
+    ])
 elif what_i_do == '11':
-    try:
-        os.remove('data/mysql.json')
-    except:
-        pass
+    if os.path.exists(os.path.join('data', 'mysql.json')):
+        os.remove(os.path.join('data', 'mysql.json'))
 elif what_i_do == '12':
     curs.execute(db_change("select count(*) from data"))
     count_data = curs.fetchall()
@@ -287,7 +297,9 @@ elif what_i_do == '12':
         count_data = 0
 
     curs.execute(db_change('delete from other where name = "count_all_title"'))
-    curs.execute(db_change('insert into other (name, data) values ("count_all_title", ?)'), [str(count_data)])
+    curs.execute(db_change('insert into other (name, data) values ("count_all_title", ?)'), [
+        str(count_data)
+    ])
 elif what_i_do == '13':
     curs.execute(db_change('delete from cache_data'))
 elif what_i_do == '14':

+ 0 - 1
requirements.txt

@@ -1,5 +1,4 @@
 flask
-flask-reggie
 
 requests
 

+ 17 - 3
route/api_image_view.py

@@ -3,7 +3,21 @@ from .tool.func import *
 def api_image_view_2(conn, name):
     curs = conn.cursor()
 
-    if os.path.exists(os.path.join(load_image_url(), name)):
-        return flask.jsonify({ "exist" : "1" })
+    if flask.request.method == 'POST':
+        try:
+            title_list = json.loads(flask.request.form.get('title_list', ''))
+            title_list = list(set(title_list))
+        except:
+            title_list = []
+        
+        data_list = {}
+        for i in title_list:
+            if os.path.exists(os.path.join(load_image_url(), i)):
+                data_list[i] = '1'
+        
+        return flask.jsonify(data_list)
     else:
-        return flask.jsonify({ "exist" : "0" })
+        if os.path.exists(os.path.join(load_image_url(), name)):
+            return flask.jsonify({ "exist" : "1" })
+        else:
+            return flask.jsonify({})

+ 14 - 1
route/api_sha224.py

@@ -3,4 +3,17 @@ from .tool.func import *
 def api_sha224_2(conn, data):
     curs = conn.cursor()
 
-    return flask.jsonify({ "data" : sha224_replace(data) })
+    if flask.request.method == 'POST':
+        try:
+            title_list = json.loads(flask.request.form.get('title_list', ''))
+            title_list = list(set(title_list))
+        except:
+            title_list = []
+        
+        data_list = {}
+        for i in title_list:
+            data_list[i] = sha224_replace(i)
+        
+        return flask.jsonify(data_list)
+    else:
+        return flask.jsonify({ "data" : sha224_replace(data) })

+ 86 - 53
route/api_w.py

@@ -3,70 +3,103 @@ from .tool.func import *
 def api_w_2(conn, name):
     curs = conn.cursor()
 
-    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':
-                data_org = flask.request.form.get('data', '')
-                data_pas = render_set(
-                    doc_name = name, 
-                    doc_data = data_org, 
-                    data_type = 'api_view'
-                )
+    data_arg_v = flask.request.args.get('v', '')
+    if flask.request.method == 'POST':
+        if data_arg_v == '' or data_arg_v == 'preview':
+            data_org = flask.request.form.get('data', '')
+            data_pas = render_set(
+                doc_name = name, 
+                doc_data = data_org, 
+                data_type = 'api_view'
+            )
+
+            return flask.jsonify({
+                "data" : data_pas[0], 
+                "js_data" : data_pas[1]
+            })
+        elif data_arg_v == 'include':
+            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', '')
+            if include_data != '':
+                get_all_change_1 = []
+                find_replace_moment = re.findall(r'(@([^=@]+)=([^=@]+)@|@([^=@]+)@)', json_data)
+                for i in find_replace_moment:
+                    if i[1] != '':
+                        get_all_change_1 += [['@' + i[1] + '@', i[2]]]
+
+                        json_data = json_data.replace(i[0], '@' + i[1] + '@', 1)
+                    else:
+                        json_data = json_data.replace(i[0], '@' + i[3] + '@', 1)
+
+                get_all_change_2 = re.findall(r'(@(?:[^@]*)@),([^,]*),', flask.request.args.get('change', '')) + get_all_change_1
+                for i in get_all_change_2:
+                    json_data = json_data.replace(
+                        i[0].replace('<amp>', '&'), 
+                        i[1].replace('<amp>', '&').replace('<comma>', ','), 
+                        1
+                    )
+
+            data_pas = render_set(
+                doc_name = name_org, 
+                doc_data = json_data, 
+                data_type = 'api_view',
+                data_in = include_data
+            )
 
-                return flask.jsonify({
-                    "data" : data_pas[0], 
-                    "js_data" : data_pas[1]
-                })
+            return flask.jsonify({
+                "data" : data_pas[0], 
+                "js_data" : data_pas[1]
+            })
+        elif data_arg_v == 'exist':
+            try:
+                title_list = json.loads(flask.request.form.get('title_list', ''))
+                title_list = list(set(title_list))
+            except:
+                title_list = []
+            
+            data_exist = {}
+            for i in title_list:
+                curs.execute(db_change("select title from data where title = ?"), [i])
+                if curs.fetchall():
+                    data_exist[i] = '1'
+                    
+            return flask.json_data(data_exist)
+        else:
+            return flask.jsonify({})
+    else:
+        data_arg_exist = flask.request.args.get('exist', '')
+        if data_arg_v == 'exist' or data_arg_exist != '':
+            curs.execute(db_change("select title from data where title = ?"), [name])
+            if curs.fetchall():
+                return flask.jsonify({ "exist" : "1" })
+            else:
+                return flask.jsonify({})
+        else:
+            if acl_check(name, 'render') == 1:
+                return flask.jsonify({})
             else:
                 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', '')
-                    if include_data != '':
-                        get_all_change_1 = []
-                        find_replace_moment = re.findall(r'(@([^=@]+)=([^=@]+)@|@([^=@]+)@)', json_data)
-                        for i in find_replace_moment:
-                            if i[1] != '':
-                                get_all_change_1 += [['@' + i[1] + '@', i[2]]]
 
-                                json_data = json_data.replace(i[0], '@' + i[1] + '@', 1)
-                            else:
-                                json_data = json_data.replace(i[0], '@' + i[3] + '@', 1)
-
-                        get_all_change_2 = re.findall(r'(@(?:[^@]*)@),([^,]*),', flask.request.args.get('change', '')) + get_all_change_1
-                        for i in get_all_change_2:
-                            json_data = json_data.replace(
-                                i[0].replace('<amp>', '&'), 
-                                i[1].replace('<amp>', '&').replace('<comma>', ','), 
-                                1
-                            )
-                        
+                sql_data = curs.fetchall()
+                if not sql_data:
+                    return flask.jsonify({})
+                else:
                     data_pas = render_set(
-                        doc_name = name_org, 
-                        doc_data = json_data, 
-                        data_type = 'api_view',
-                        data_in = include_data
+                        doc_name = name, 
+                        doc_data = sql_data[0][0], 
+                        data_type = 'api_view'
                     )
 
                     return flask.jsonify({
                         "data" : data_pas[0], 
                         "js_data" : data_pas[1]
-                    })
-
-    return flask.jsonify({})
+                    })

+ 91 - 46
route/applications.py

@@ -1,6 +1,7 @@
 from .tool.func import *
 
 def applications_2(conn):
+    # 만들다만 느낌이니 수정 필요
     curs = conn.cursor()
 
     div = ''
@@ -14,21 +15,28 @@ def applications_2(conn):
         div += '<p>' + load_lang('approval_requirement_disabled') + '</p>'
 
     if flask.request.method == 'GET':
-        curs.execute(db_change('select id, date, question, answer, token, email from user_application'))
+        curs.execute(db_change(
+            'select data from user_set where name = "application"'
+        ))
         db_data = curs.fetchall()
         if db_data:
-            div += '<p>' + load_lang('all_register_num') + ' : ' + str(len(db_data)) + '</p><br>'
+            div += '' + \
+                '<p>' + load_lang('all_register_num') + ' : ' + str(len(db_data)) + '</p>' + \
+                '<hr class="main_hr">' + \
+            ''
 
             for application in db_data:
-                question = application[2]
-                answer = application[3]
-                email = application[5]
+                application = json.loads(application)
+                
+                question = application['question']
                 if not question:
                     question = ''
-
+                    
+                answer = application['answer']
                 if not answer:
                     answer = ''
                 
+                email = application['email']
                 if not email:
                     email = ''
                 
@@ -37,24 +45,37 @@ def applications_2(conn):
                         <table>
                             <tbody>
                                 <tr>
-                                    <td>''' + load_lang('id') + '''</td><td>''' + application[0] + '''</td>
+                                    <td>''' + load_lang('id') + '''</td>
+                                    <td>''' + application['id'] + '''</td>
                                 </tr>
                                 <tr>
-                                    <td>''' + load_lang('application_time') + '''</td><td>''' + application[1] + '''</td>
+                                    <td>''' + load_lang('application_time') + '''</td>
+                                    <td>''' + application['date'] + '''</td>
                                 </tr>
                                 <tr>
-                                    <td>''' + load_lang('approval_question') + '''</td><td>''' + html.escape(question) + '''</td>
+                                    <td>''' + load_lang('approval_question') + '''</td>
+                                    <td>''' + html.escape(question) + '''</td>
                                 </tr>
                                 <tr>
-                                    <td>''' + load_lang('answer') + '''</td><td>''' + html.escape(answer) + '''</td>
+                                    <td>''' + load_lang('answer') + '''</td>
+                                    <td>''' + html.escape(answer) + '''</td>
                                 </tr>
                                 <tr>
-                                    <td>''' + load_lang('email') + '''</td><td>''' + html.escape(email) + '''</td>
+                                    <td>''' + load_lang('email') + '''</td>
+                                    <td>''' + html.escape(email) + '''</td>
                                 </tr>
                                 <tr>
-                                    <td colspan=\"2\" style=\"text-align: center;\">
-                                        <button type=\"submit\" name=\"approve\" value=\"''' + application[4] + '''\">''' + load_lang('approve') + '''</button>
-                                        <button type=\"submit\" name=\"decline\" value=\"''' + application[4] + '''\">''' + load_lang('decline') + '''</button>
+                                    <td colspan="2" style="text-align: center;">
+                                        <button type="submit" 
+                                                name="approve" 
+                                                value="''' + application['id'] + '''">
+                                            ''' + load_lang('approve') + '''
+                                        </button>
+                                        <button type="submit" 
+                                                name="decline" 
+                                                value="''' + application['id'] + '''">
+                                            ''' + load_lang('decline') + '''
+                                        </button>
                                     </td>
                                 </tr>
                             </tbody>
@@ -72,55 +93,79 @@ def applications_2(conn):
         ))
     else:
         if flask.request.form.get('approve', '') != '':
-            curs.execute(db_change('select id, pw, date, encode, question, answer, ip, ua, email from user_application where token = ?'), [
+            curs.execute(db_change(
+                'select data from user_set where id = ? and name = "application"'
+            ), [
                 flask.request.form.get('approve', '')
             ])
             application = curs.fetchall()
             if not application:
                 return re_error('/error/26')
+            else:
+                application = json.loads(application[0][0])
             
-            application = application[0]
-
-            curs.execute(db_change("select id from user_set where id = ?"), [application[0]])
-            if curs.fetchall():
-                return re_error('/error/6')
-            
-            curs.execute(db_change("insert into user_set (id, name, data) values (?, 'pw', ?)"), [
-                application[0],
-                application[1]
+            curs.execute(db_change(
+                "insert into user_set (id, name, data) values (?, 'pw', ?)"
+            ), [
+                application['id'],
+                application['pw']
             ])
-            curs.execute(db_change("insert into user_set (id, name, data) values (?, 'acl', 'user')"), [
-                application[0]
+            curs.execute(db_change(
+                "insert into user_set (id, name, data) values (?, 'acl', 'user')"
+            ), [
+                application['id']
             ])
-            curs.execute(db_change("insert into user_set (id, name, data) values (?, 'date', ?)"), [
-                application[0],
-                application[2]
+            curs.execute(db_change(
+                "insert into user_set (id, name, data) values (?, 'date', ?)"
+            ), [
+                application['id'],
+                application['date']
             ])
-            curs.execute(db_change("insert into user_set (id, name, data) values (?, 'encode', ?)"), [
-                application[0],
-                application[3]
+            curs.execute(db_change(
+                "insert into user_set (id, name, data) values (?, 'encode', ?)"
+            ), [
+                application['id'],
+                application['encode']
             ])
-            curs.execute(db_change("insert into user_set (name, id, data) values ('approval_question', ?, ?)"), [
-                application[0], 
-                application[4]
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) values ('approval_question', ?, ?)"
+            ), [
+                application['id'], 
+                application['question']
             ])
-            curs.execute(db_change("insert into user_set (name, id, data) values ('approval_question_answer', ?, ?)"), [
-                application[0], 
-                application[5]
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) " + \
+                "values ('approval_question_answer', ?, ?)"
+            ), [
+                application['id'], 
+                application['answer']
             ])
-            ua_plus(application[0], application[6], application[7], application[2])
-            if application[8] and application[8] != '':
-                curs.execute(db_change("insert into user_set (name, id, data) values ('email', ?, ?)"), [
-                    application[0], 
-                    application[8]
+            
+            ua_plus(
+                application['id'], 
+                application['ip'], 
+                application['ua'], 
+                application['date']
+            )
+            
+            if application['email'] != '':
+                curs.execute(db_change(
+                    "insert into user_set (name, id, data) values ('email', ?, ?)"
+                ), [
+                    application['id'], 
+                    application['email']
                 ])
             
-            curs.execute(db_change('delete from user_application where token = ?'), [
-                flask.request.form.get('approve', '')
+            curs.execute(db_change(
+                'delete from user_set where id = ? and name = "application"'
+            ), [
+                application['id']
             ])
             conn.commit()
         elif flask.request.form.get('decline', '') != '':
-            curs.execute(db_change('delete from user_application where token = ?'), [
+             curs.execute(db_change(
+                'delete from user_set where id = ? and name = "application"'
+            ), [
                 flask.request.form.get('decline', '')
             ])
             conn.commit()

+ 20 - 14
route/login_check_key.py

@@ -59,31 +59,37 @@ def login_check_key_2(conn, tool):
 
                     return re_error('/error/6')
             
-                curs.execute(db_change("select id from user_application where id = ?"), [flask.session['c_id']])
+                curs.execute(db_change("select id from user_set where id = ? and name = 'application'"), [
+                    flask.session['c_id']
+                ])
                 if curs.fetchall():
                     for i in re_set_list:
                         flask.session.pop(i, None)
 
                     return re_error('/error/6')
 
-                curs.execute(db_change('select data from other where name = "requires_approval"'))
+                curs.execute(db_change(
+                    'select data from other where name = "requires_approval"'
+                ))
                 requires_approval = curs.fetchall()
                 if requires_approval and requires_approval[0][0] == 'on':
-                    application_token = load_random_key(32)
+                    user_app_data = {}
+                    user_app_data['id'] = flask.session['c_id']
+                    user_app_data['pw'] = flask.session['c_pw']
+                    user_app_data['date'] = get_time()
+                    user_app_data['encode'] = db_data[0][0]
+                    user_app_data['question'] = flask.session['c_que']
+                    user_app_data['answer'] = flask.session['c_ans']
+                    user_app_data['ip'] = ip
+                    user_app_data['ua'] = user_agent
+                    user_app_data['email'] = flask.session['c_email']
+                    
                     curs.execute(db_change(
-                        "insert into user_application (id, pw, date, encode, question, answer, token, ip, ua, email) " + \
-                        "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+                        "insert into user_set (id, name, data) values (?, ?, ?)"
                     ), [
                         flask.session['c_id'],
-                        flask.session['c_pw'],
-                        get_time(),
-                        db_data[0][0],
-                        flask.session['c_que'],
-                        flask.session['c_ans'],
-                        application_token,
-                        ip,
-                        user_agent,
-                        flask.session['c_email']
+                        'application',
+                        json.dumps(user_app_data)
                     ])
                     conn.commit()
     

+ 0 - 4
route/login_register.py

@@ -48,10 +48,6 @@ def login_register_2(conn):
         curs.execute(db_change("select id from user_set where id = ?"), [user_id])
         if curs.fetchall():
             return re_error('/error/6')
-    
-        curs.execute(db_change("select id from user_application where id = ?"), [user_id])
-        if curs.fetchall():
-            return re_error('/error/6')
 
         hashed = pw_encode(user_pw)
         ans_q = flask.request.form.get('approval_question_answer', '')

+ 39 - 6
route/tool/func.py

@@ -290,21 +290,54 @@ def update(ver_num, set_data):
             curs.execute(db_change("insert into acl (title, data, type) values (?, ?, ?)"), [i[0], i[2], 'dis'])
             curs.execute(db_change("insert into acl (title, data, type) values (?, ?, ?)"), [i[0], i[3], 'view'])
             curs.execute(db_change("insert into acl (title, data, type) values (?, ?, ?)"), [i[0], i[4], 'why'])
-          
-    # 캐시 초기화
+
     if ver_num < 3300101:
+        # 캐시 초기화
         curs.execute(db_change('delete from cache_data'))
     
     if ver_num < 3300301:
+        # regex_filter 오류 해결
         curs.execute(db_change('delete from html_filter where kind = "regex_filter" and html is null'))
         
     if ver_num < 3302302:
+        # user이랑 user_set 테이블의 통합
         curs.execute(db_change('select id, pw, acl, date, encode from user'))
         for i in curs.fetchall():
-            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['pw', i[0], i[1]])
-            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['acl', i[0], i[2]])
-            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['date', i[0], i[3]])
-            curs.execute(db_change("insert into user_set (name, id, data) values (?, ?, ?)"), ['encode', i[0], i[4]])
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) values (?, ?, ?)"
+            ), ['pw', i[0], i[1]])
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) values (?, ?, ?)"
+            ), ['acl', i[0], i[2]])
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) values (?, ?, ?)"
+            ), ['date', i[0], i[3]])
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) values (?, ?, ?)"
+            ), ['encode', i[0], i[4]])
+            
+    if ver_num < 3400101:
+        # user_set이랑 user_application 테이블의 통합
+        curs.execute(db_change('' + \
+            'select id, pw, date, encode, question, answer, ip, ua, email ' + \
+            'from user_application' + \
+        ''))
+        for i in curs.fetchall():
+            sql_data = {}
+            sql_data['id'] = i[0]
+            sql_data['pw'] = i[1]
+            sql_data['date'] = i[2]
+            sql_data['encode'] = i[3]
+            sql_data['question'] = i[4]
+            sql_data['answer'] = i[5]
+            sql_data['ip'] = i[6]
+            sql_data['ua'] = i[7]
+            sql_data['email'] = i[8]
+            
+            curs.execute(db_change(
+                "insert into user_set (name, id, data) values (?, ?, ?)"
+            ), ['application', i[0], json.dumps(sql_data)])
+            
     
     conn.commit()
 

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "beta" : {
-        "r_ver" : "v3.3.0-stable-01b (beta-05b) (dev-2021-06-23-01)",
-        "c_ver" : "3302302",
+        "r_ver" : "v3.4.0-stable-01b (beta-01b) (dev-2021-06-27-01)",
+        "c_ver" : "3400101",
         "s_ver" : "12"
     }
 }

+ 1 - 1
views/main_css/js/load_editor.js

@@ -127,7 +127,7 @@ function load_preview(name) {
 
     var xhr_2 = new XMLHttpRequest();
     xhr_2.open("GET", url_2, true);
-    xhr_2.send(null);
+    xhr_2.send();
 
     xhr.onreadystatechange = function() {
         if(xhr.readyState === 4 && xhr.status === 200) {

+ 170 - 97
views/main_css/js/render_namumark.js

@@ -1,17 +1,34 @@
-function get_link_state(data, i = 0) {    
-    var get_class = document.getElementsByClassName(data + 'link_finder')[i];
-    if(get_class) {
-        get_link_state(data, i + 1);
-        
-        if(!get_class.href.match(/^#/)) {
-            var xhr = new XMLHttpRequest();
-            xhr.open("GET", get_class.href.replace('/w/', '/api/w/').replace(/#([^#]*)$/, '') + "?exist=1");
-            xhr.send();
+function get_link_state(data) {
+    var link_list = [];
+    var link_list_2 = {}
+    for(var i = 0; document.getElementsByClassName(data + 'link_finder')[i]; i++) {
+        var data_class = document.getElementsByClassName(data + 'link_finder')[i];
+        if(!data_class.href.match(/^#/)) {            
+            link_list.push(data_class.title);
             
-            xhr.onreadystatechange = function() {
-                if(this.readyState === 4 && this.status === 200) {
-                    if(JSON.parse(this.responseText)['exist'] !== '1') {
-                        document.getElementsByClassName(data + 'link_finder')[i].id = "not_thing";
+            if(!link_list_2[data_class.title]) {
+                link_list_2[data_class.title] = [i];
+            } else {
+                link_list_2[data_class.title].push(i);
+            }
+        }
+    }
+    
+    var data_form = new FormData();
+    data_form.append('title_list', JSON.stringify(link_list));
+    
+    var xhr = new XMLHttpRequest();
+    xhr.open("POST", "/api/w/test?exist=1");
+    xhr.send(data_form);
+
+    xhr.onreadystatechange = function() {
+        if(this.readyState === 4 && this.status === 200) {
+            var data_xhr = JSON.parse(this.responseText);
+            
+            for(var key in link_list_2) {
+                if(!data_xhr[key]) {
+                    for(var key_2 in link_list_2[key]) {
+                        document.getElementsByClassName(data + 'link_finder')[link_list_2[key][key_2]].id = "not_thing";
                     }
                 }
             }
@@ -27,99 +44,152 @@ function load_image_link(data) {
     '';
 }
 
-function get_file_state_extermal(data, i) {
-    var get_class = document.getElementsByClassName(data + 'file_finder')[i];
-    if(
-        document.cookie.match(main_css_regex_data('main_css_image_set')) &&
-        document.cookie.match(main_css_regex_data('main_css_image_set'))[1] === '1'
-    ) {
-        document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-            '<a href="' + get_class.getAttribute('under_src') + '" ' +
-                'title="' + get_class.getAttribute('under_src') + '">' + 
-                '(External image link)' + 
-            '</a>' +
-        '';
-    } else if(
-        document.cookie.match(main_css_regex_data('main_css_image_set')) &&
-        document.cookie.match(main_css_regex_data('main_css_image_set'))[1] === '2'
-    ) {
-        document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-            '<a href="javascript:void(0);" ' +
-                'onclick="load_image_link(this); this.onclick = \'\';" ' + 
-                'under_style="' + get_class.getAttribute('under_style') + '" ' +
-                'under_alt="' + get_class.getAttribute('under_alt') + '" ' +
-                'under_src="' + get_class.getAttribute('under_src') + '" ' +
-                'title="' + get_class.getAttribute('under_src') + '">' + 
-                '(External image load)' + 
-            '</a>' +
-        '';
+function get_file_state_extermal(data, data_exter) {
+    if(document.cookie.match(main_css_regex_data('main_css_image_set'))) {
+        var data_image_set = document.cookie.match(main_css_regex_data('main_css_image_set'))[1];
     } else {
-        document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-            '<img   style="' + get_class.getAttribute('under_style') + '" ' + 
-                    'alt="' + get_class.getAttribute('under_alt') + '" ' + 
-                    'src="' + get_class.getAttribute('under_src') + '">' +
-        '';
+        var data_image_set = '0';
+    }
+    
+    var data_class = document.getElementsByClassName(data + 'file_finder');
+    for(var key in data_exter) {
+        var key = data_exter[key];
+        
+        if(data_image_set === '1') {
+            document.getElementsByClassName(data + 'file_finder')[key].innerHTML = '' +
+                '<a href="' + data_class[key].getAttribute('under_src') + '" ' +
+                    'title="' + data_class[key].getAttribute('under_src') + '">' + 
+                    '(External image link)' + 
+                '</a>' +
+            '';
+        } else if(data_image_set === '2') {
+            document.getElementsByClassName(data + 'file_finder')[key].innerHTML = '' +
+                '<a href="javascript:void(0);" ' +
+                    'onclick="load_image_link(this); this.onclick = \'\';" ' + 
+                    'under_style="' + data_class[key].getAttribute('under_style') + '" ' +
+                    'under_alt="' + data_class[key].getAttribute('under_alt') + '" ' +
+                    'under_src="' + data_class[key].getAttribute('under_src') + '" ' +
+                    'title="' + data_class[key].getAttribute('under_src') + '">' + 
+                    '(External image load)' + 
+                '</a>' +
+            '';
+        } else {
+            document.getElementsByClassName(data + 'file_finder')[key].innerHTML = '' +
+                '<img   style="' + data_class[key].getAttribute('under_style') + '" ' + 
+                        'alt="' + data_class[key].getAttribute('under_alt') + '" ' + 
+                        'src="' + data_class[key].getAttribute('under_src') + '">' +
+            '';
+        }
     }
 }
 
-function get_file_state_intermal(data, i) {
-    var get_class = document.getElementsByClassName(data + 'file_finder')[i];
+function get_file_state_intermal(data, data_inter) {
+    var data_dict = {};
+    var data_list = [];
+    for(var key in data_inter) {
+        var data_class = document.getElementsByClassName(data + 'file_finder')[key];
+    
+        var file_org = data_class.getAttribute('under_src');
+        var file_type = file_org.split('.');
+        var file_name = file_type.slice(0, file_type.length - 1).join('.');
+        file_type = file_type[file_type.length - 1];
+        
+        if(!data_dict[file_org]) {
+            data_dict[file_org] = {};
+        }
+        
+        data_dict[file_org]['file_name'] = file_name;
+        data_dict[file_org]['file_type'] = file_type;
+        
+        data_list.push(file_name);
+        
+        if(!data_dict[file_org]['list']) {
+            data_dict[file_org]['list'] = [key];
+        } else {
+            data_dict[file_org]['list'].push(key);
+        }
+    }
     
-    var file_type = get_class.getAttribute('under_src').split('.');
-    var file_name = file_type.slice(0, file_type.length - 1).join('.');
-    file_type = file_type[file_type.length - 1];
+    if(document.cookie.match(main_css_regex_data('main_css_image_set'))) {
+        var data_image_set = document.cookie.match(main_css_regex_data('main_css_image_set'))[1];
+    } else {
+        var data_image_set = '0';
+    }
+    
+    var data_form = new FormData();
+    data_form.append('title_list', JSON.stringify(data_list));
 
     var xhr = new XMLHttpRequest();
-    xhr.open("GET", '/api/sha224/' + file_name);
-    xhr.send();
+    xhr.open("POST", '/api/sha224/test');
+    xhr.send(data_form);
 
     xhr.onreadystatechange = function() {
         if(this.readyState === 4 && this.status === 200) {
-            file_name = JSON.parse(this.responseText)['data'];
+            var file_sha224 = JSON.parse(this.responseText);
+            var data_list_2 = [];
+            for(var key in data_dict) {
+                data_dict[key]['file_sha224'] = file_sha224[data_dict[key]['file_name']]
 
+                data_list_2.push(data_dict[key]['file_sha224'] + '.' + data_dict[key]['file_type'])
+            }
+            
+            var data_form_2 = new FormData();
+            data_form_2.append('title_list', JSON.stringify(data_list_2));
+            
             var xhr_2 = new XMLHttpRequest();
-            xhr_2.open("GET", '/api/image/' + file_name + '.' + file_type);
-            xhr_2.send();
+            xhr_2.open("POST", '/api/image/test');
+            xhr_2.send(data_list_2);
 
             xhr_2.onreadystatechange = function() {
                 if(this.readyState === 4 && this.status === 200) {
-                    if(JSON.parse(this.responseText)['exist'] !== '1') {
-                        document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-                            '<a href="' + get_class.getAttribute('under_href') + '" ' + 
-                                'id="not_thing">' +
-                                '(' + get_class.getAttribute('under_alt') + ')' +
-                            '</a>' +
-                        '';
-                    } else {
-                        if(
-                            document.cookie.match(main_css_regex_data('main_css_image_set')) &&
-                            document.cookie.match(main_css_regex_data('main_css_image_set'))[1] === '1'
-                        ) {
-                            document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-                                '<a href="/image/' + file_name + '.' + file_type + '">' +
-                                    '(' + get_class.getAttribute('under_alt') + ')' +
-                                '</a>' +
-                            '';
-                        } else if(
-                            document.cookie.match(main_css_regex_data('main_css_image_set')) &&
-                            document.cookie.match(main_css_regex_data('main_css_image_set'))[1] === '2'
-                        ) {
-                            document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-                                '<a href="javascript:void(0);" ' +
-                                    'onclick="load_image_link(this); this.onclick = \'\';" ' + 
-                                    'under_style="' + get_class.getAttribute('under_style') + '" ' +
-                                    'under_alt="' + get_class.getAttribute('under_alt') + '" ' +
-                                    'under_src="/image/' + file_name + '.' + file_type + '">' + 
-                                    '(' + get_class.getAttribute('under_alt') + ' load)' +
-                                '</a>' +
-                            '';
+                    var file_data = JSON.parse(this.responseText);
+                    var data_class = document.getElementsByClassName(data + 'file_finder');
+                    for(var key_3 in data_dict) {
+                        if(!file_data[data_dict[key_3]['file_sha224'] + '.' + data_dict[key_3]['file_type']]) {
+                            for(var key_4 in data_dict[key_3]['list']) {
+                                var key_4 = data_dict[key_3]['list'][key_4];
+                                document.getElementsByClassName(data + 'file_finder')[key_4].innerHTML = '' +
+                                    '<a href="' + data_class[key_4].getAttribute('under_href') + '" ' + 
+                                        'id="not_thing">' +
+                                        '(' + data_class[key_4].getAttribute('under_alt') + ')' +
+                                    '</a>' +
+                                '';
+                            }
                         } else {
-                            document.getElementsByClassName(data + 'file_finder')[i].innerHTML = '' +
-                                '<img   style="' + get_class.getAttribute('under_style') + '" ' + 
-                                        'alt="' + get_class.getAttribute('under_alt') + '" ' + 
-                                        'src="/image/' + file_name + '.' + file_type + '">' +
-                            '';
-                        }
+                            if(data_image_set === '1') {
+                                for(var key_4 in data_dict[key_3]['list']) {
+                                    var key_4 = data_dict[key_3]['list'][key_4];
+                                    document.getElementsByClassName(data + 'file_finder')[key_4].innerHTML = '' +
+                                        '<a href="/image/' + data_dict[key_3]['file_sha224'] + '.' + data_dict[key_3]['file_type'] + '">' +
+                                            '(' + data_class[key_4].getAttribute('under_alt') + ')' +
+                                        '</a>' +
+                                    '';
+                                }
+                            } else if(data_image_set === '2') {
+                                for(var key_4 in data_dict[key_3]['list']) {
+                                    var key_4 = data_dict[key_3]['list'][key_4];
+                                    document.getElementsByClassName(data + 'file_finder')[key_4].innerHTML = '' +
+                                        '<a href="javascript:void(0);" ' +
+                                            'onclick="load_image_link(this); this.onclick = \'\';" ' + 
+                                            'under_style="' + data_class[key_4].getAttribute('under_style') + '" ' +
+                                            'under_alt="' + data_class[key_4].getAttribute('under_alt') + '" ' +
+                                            'under_src="/image/' + data_dict[key_3]['file_sha224'] + '.' + data_dict[key_3]['file_type'] + '">' + 
+                                            '(' + data_class[key_4].getAttribute('under_alt') + ' load)' +
+                                        '</a>' +
+                                    '';
+                                }
+                            } else {
+                                for(var key_4 in data_dict[key_3]['list']) {
+                                    var key_4 = data_dict[key_3]['list'][key_4];
+                                    document.getElementsByClassName(data + 'file_finder')[key_4].innerHTML = '' +
+                                        '<img   style="' + data_class[key_4].getAttribute('under_style') + '" ' + 
+                                                'alt="' + data_class[key_4].getAttribute('under_alt') + '" ' + 
+                                                'src="/image/' + data_dict[key_3]['file_sha224'] + '.' + data_dict[key_3]['file_type'] + '">' +
+                                        '' +
+                                    '';
+                                }
+                            }
+                        }   
                     }
                 }
             }
@@ -128,16 +198,19 @@ function get_file_state_intermal(data, i) {
 }
 
 function get_file_state(data, i = 0) {
-    var get_class = document.getElementsByClassName(data + 'file_finder')[i];
-    if(get_class) {
-        get_file_state(data, i + 1);
-        
-        if(get_class.getAttribute('under_href') === 'out_link') {
-            get_file_state_extermal(data, i);
+    var data_exter = [];
+    var data_inter = [];
+    for(var i = 0; document.getElementsByClassName(data + 'file_finder')[i]; i++) {
+        var data_class = document.getElementsByClassName(data + 'file_finder')[i];
+        if(data_class.getAttribute('under_href') === 'out_link') {
+            data_exter.push(i);
         } else {
-            get_file_state_intermal(data, i);
+            data_inter.push(i);
         }
     }
+    
+    get_file_state_extermal(data, data_exter);
+    get_file_state_intermal(data, data_inter);
 }
 
 function load_include(name_doc, name_ob, data_include, name_org = '') {