2du 4 jaren geleden
bovenliggende
commit
a0c854bde8
9 gewijzigde bestanden met toevoegingen van 94 en 128 verwijderingen
  1. 27 28
      app.py
  2. 1 1
      route/edit.py
  3. 5 4
      route/recent_change.py
  4. 1 1
      route/recent_history_tool.py
  5. 1 1
      route/tool/func.py
  6. 55 43
      route/user_info.py
  7. 0 31
      route/user_tool.py
  8. 4 4
      route/view_diff.py
  9. 0 15
      views/main_css/js/load_something.js

+ 27 - 28
app.py

@@ -351,6 +351,7 @@ conn.close()
 
 conn = get_conn()
 
+# Init-custom
 if os.path.exists('custom.py'):
     from custom import custom_run
 
@@ -495,28 +496,6 @@ def give_delete_admin_group(name = None):
 def recent_block(name = 'Test', tool = 'all'):
     return recent_block_2(conn, name, tool)
 
-# Func-view
-@app.route('/xref/<everything:name>')
-def view_xref(name = None):
-    return view_xref_2(conn, name)
-
-@app.route('/raw/<everything:name>')
-@app.route('/thread/<int:topic_num>/raw/<int:num>')
-def view_raw(name = None, topic_num = None, num = None):
-    return view_raw_2(conn, name, topic_num, num)
-
-@app.route('/diff/<everything:name>')
-def view_diff_data(name = None):
-    return view_diff_data_2(conn, name)
-
-@app.route('/down/<everything:name>')
-def view_down(name = None):
-    return view_down_2(conn, name)
-
-@app.route('/w/<everything:name>')
-def view_read(name = None):
-    return view_read_2(conn, name)
-
 # Func-history
 @app.route('/recent_change')
 @app.route('/recent_changes')
@@ -582,6 +561,29 @@ def search_goto(name = 'test'):
 def search_deep(name = 'test'):
     return search_deep_2(conn, name)
 
+# Func-view
+@app.route('/xref/<everything:name>')
+def view_xref(name = None):
+    return view_xref_2(conn, name)
+
+@app.route('/raw/<everything:name>')
+@app.route('/thread/<int:topic_num>/raw/<int:num>')
+def view_raw(name = None, topic_num = None, num = None):
+    return view_raw_2(conn, name, topic_num, num)
+
+@app.route('/diff/<int:num_a>/<int:num_b>/<everything:name>')
+def view_diff(name = 'Test', num_a = 1, num_b = 1):
+    return view_diff_2(conn, name, num_a, num_b)
+
+@app.route('/down/<everything:name>')
+def view_down(name = None):
+    return view_down_2(conn, name)
+
+@app.route('/w/<int:num>/<everything:name>')
+@app.route('/w/<everything:name>')
+def view_read(name = 'Test', num = 0):
+    return view_read_2(conn, name)
+
 # Func-edit
 @app.route('/revert/<everything:name>', methods = ['POST', 'GET'])
 def edit_revert(name = None):
@@ -654,10 +656,6 @@ def topic_close_list(name = 'test'):
     return topic_close_list_2(conn, name)
 
 # Func-user
-@app.route('/tool/<name>')
-def user_tool(name = None):
-    return user_tool_2(conn, name)
-
 @app.route('/change', methods = ['POST', 'GET'])
 def user_setting():
     return user_setting_2(conn, server_set_var)
@@ -675,8 +673,9 @@ def user_setting_pw_change():
     return user_setting_pw_change_2(conn)
 
 @app.route('/user')
-def user_info():
-    return user_info_2(conn)
+@app.route('/user/<name>')
+def user_info(name = ''):
+    return user_info_2(conn, name)
 
 @app.route('/custom_head', methods=['GET', 'POST'])
 def user_custom_head_view():

+ 1 - 1
route/edit.py

@@ -102,7 +102,7 @@ def edit_2(conn, name):
                 warning_edit += '<a href="/raw/' + url_pas(name) + '">(r' + doc_ver + ')</a>'
             else:
                 warning_edit += '' + \
-                    '<a href="/diff/' + url_pas(name) + '?first=' + flask.request.form.get('ver', '1') + '&second=' + doc_ver + '">' + \
+                    '<a href="/diff/' + flask.request.form.get('ver', '1') + '/' + doc_ver + '/' + url_pas(name) + '">' + \
                         '(r' + doc_ver + ')' + \
                     '</a>' + \
                 ''

+ 5 - 4
route/recent_change.py

@@ -5,9 +5,10 @@ def recent_change_2(conn, name, tool):
 
     if flask.request.method == 'POST':
         return redirect(
-            '/diff/' + url_pas(name) +
-            '?first=' + flask.request.form.get('b', '1') +
-            '&second=' + flask.request.form.get('a', '1')
+            '/diff' + 
+            '/' + flask.request.form.get('b', '1') +
+            '/' + flask.request.form.get('a', '1') +
+            '/' + url_pas(name)
         )
     else:
         ban = ''
@@ -124,7 +125,7 @@ def recent_change_2(conn, name, tool):
                 if int(data[0]) < 2:
                     title += '<a href="/history/' + url_pas(data[1]) + '">(r' + data[0] + ')</a> '
                 else:
-                    title += '<a href="/diff/' + url_pas(data[1]) + '?first=' + str(int(data[0]) - 1) + '&second=' + data[0] + '">(r' + data[0] + ')</a> '
+                    title += '<a href="/diff/' + str(int(data[0]) - 1) + '/' + data[0] + '/' + url_pas(data[1]) + '">(r' + data[0] + ')</a> '
 
             div += '''
                 <tr ''' + style[0] + '''>

+ 1 - 1
route/recent_history_tool.py

@@ -16,7 +16,7 @@ def recent_history_tool_2(conn, name, rev):
         data += '<li><a href="/revert/' + url_pas(name) + '?num=' + str(rev - 1) + '">' + load_lang('revert') + ' | r' + str(rev - 1) + '</a></li>'
     
     if rev - 1 > 0:
-        data += '<li><a href="/diff/' + url_pas(name) + '?first=' + str(rev - 1) + '&second=' + num + '">' + load_lang('compare') + '</a></li>'
+        data += '<li><a href="/diff/' + str(rev - 1) + '/' + num + '/' + url_pas(name) + '">' + load_lang('compare') + '</a></li>'
 
     data += '<li><a href="/history/' + url_pas(name) + '">' + load_lang('history') + '</a></li>'
     data += '</ul>'

+ 1 - 1
route/tool/func.py

@@ -1319,7 +1319,7 @@ def ip_pas(raw_ip, type_d = 0):
                 ip = '<a href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
                 
             if change_ip == 0:
-                ip += ' <a href="/tool/' + url_pas(raw_ip) + '">(' + load_lang('tool') + ')</a>'
+                ip += ' <a href="/user/' + url_pas(raw_ip) + '">(' + load_lang('tool') + ')</a>'
 
         end_ip[raw_ip] = ip
     

+ 55 - 43
route/user_info.py

@@ -1,64 +1,76 @@
 from .tool.func import *
 
-def user_info_2(conn):
+def user_info_2(conn, name):
     curs = conn.cursor()
 
-    ip = ip_check()
-
-    curs.execute(db_change("select count(*) from alarm where name = ?"), [ip])
-    count = curs.fetchall()
-    if count and count[0][0] != 0:
-        plus2 = '<li><a id="not_thing" href="/alarm">' + load_lang('alarm') + ' (' + str(count[0][0]) + ')</a></li>'
+    if name == '':
+        ip = ip_check()
     else:
-        plus2 = '<li><a href="/alarm">' + load_lang('alarm') + ' (0)</a></li>'
+        ip = name
 
-    if ip_or_user(ip) == 0:
-        plus = '''
-            <li><a href="/logout">''' + load_lang('logout') + '''</a></li>
-            <li><a href="/change">''' + load_lang('user_setting') + '''</a></li>
-        '''
+    login_menu = ''
+    tool_menu = ''
+    
+    if name == '':
+        curs.execute(db_change("select count(*) from alarm where name = ?"), [ip])
+        count = curs.fetchall()
+        if count and count[0][0] != 0:
+            tool_menu += '<li><a id="not_thing" href="/alarm">' + load_lang('alarm') + ' (' + str(count[0][0]) + ')</a></li>'
+        else:
+            tool_menu += '<li><a href="/alarm">' + load_lang('alarm') + '</a></li>'
 
-        plus2 += '<li><a href="/watch_list">' + load_lang('watchlist') + '</a></li>'
-        plus2 += '<li><a href="/star_doc">' + load_lang('star_doc') + '</a></li>'
-        plus3 = '<li><a href="/acl/user:' + url_pas(ip) + '">' + load_lang('user_document_acl') + '</a></li>'
-    else:
-        plus = '''
-            <li><a href="/login">''' + load_lang('login') + '''</a></li>
-            <li><a href="/register">''' + load_lang('register') + '''</a></li>
-            <li><a href="/change">''' + load_lang('user_setting') + '''</a></li>
-        '''
-        plus3 = ''
+        if ip_or_user(ip) == 0:
+            login_menu += '''
+                <li><a href="/logout">''' + load_lang('logout') + '''</a></li>
+                <li><a href="/change">''' + load_lang('user_setting') + '''</a></li>
+            '''
 
-        curs.execute(db_change("select data from other where name = 'email_have'"))
-        test = curs.fetchall()
-        if test and test[0][0] != '':
-            plus += '<li><a href="/pass_find">' + load_lang('password_search') + '</a></li>'
+            tool_menu += '<li><a href="/watch_list">' + load_lang('watchlist') + '</a></li>'
+            tool_menu += '<li><a href="/star_doc">' + load_lang('star_doc') + '</a></li>'
+            tool_menu += '<li><a href="/acl/user:' + url_pas(ip) + '">' + load_lang('user_document_acl') + '</a></li>'
+        else:
+            login_menu += '''
+                <li><a href="/login">''' + load_lang('login') + '''</a></li>
+                <li><a href="/register">''' + load_lang('register') + '''</a></li>
+                <li><a href="/change">''' + load_lang('user_setting') + '''</a></li>
+                <li><a href="/pass_find">''' + load_lang('password_search') + '''</a></li>
+            '''
+            
+        tool_menu += '<li><a href="/custom_head">' + load_lang('user_head') + '</a></li>'
+            
+        login_menu = '<h2>' + load_lang('login') + '</h2><ul class="inside_ul">' + login_menu + '</ul>'
+        tool_menu = '<h2>' + load_lang('tool') + '</h2><ul class="inside_ul">' + tool_menu + '</ul>'
 
+    if admin_check(1) == 1:
+        curs.execute(db_change("select block from rb where block = ? and ongoing = '1'"), [ip])
+        ban_name = load_lang('release') if curs.fetchall() else load_lang('ban')
+        
+        admin_menu = '''
+            <h2>''' + load_lang('admin') + '''</h2>
+            <ul class="inside_ul">
+                <li><a href="/ban/''' + url_pas(ip) + '''">''' + ban_name + '''</a></li>
+                <li><a href="/check/''' + url_pas(ip) + '''">''' + load_lang('check') + '''</a></li>
+            </ul>
+        '''
+    else:
+        admin_menu = ''
+            
     return easy_minify(flask.render_template(skin_check(),
         imp = [load_lang('user_tool'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
         data = '''
             <h2>''' + load_lang('state') + '''</h2>
             <div id="get_user_info"></div>
             <script>load_user_info("''' + ip + '''");</script>
-            <br>
-            <h2>''' + load_lang('login') + '''</h2>
-            <ul class="inside_ul">
-                ''' + plus + '''
-            </ul>
-            <br>
-            <h2>''' + load_lang('tool') + '''</h2>
-            <ul class="inside_ul">
-                ''' + plus3 + '''
-                <li><a href="/custom_head">''' + load_lang('user_head') + '''</a></li>
-            </ul>
-            <br>
+            ''' + login_menu + '''
+            ''' + tool_menu + '''
             <h2>''' + load_lang('other') + '''</h2>
             <ul class="inside_ul">
-            ''' + plus2 + '''
-            <li>
-                <a href="/count">''' + load_lang('count') + '''</a>
-            </li>
+                <li><a href="/record/''' + url_pas(ip) + '''">''' + load_lang('record') + '''</a></li>
+                <li><a href="/record/topic/''' + url_pas(ip) + '''">''' + load_lang('discussion_record') + '''</a></li>
+                <li><a href="/topic/user:''' + url_pas(ip) + '''">''' + load_lang('user_discussion') + '''</a></li>
+                <li><a href="/count/''' + url_pas(ip) + '''">''' + load_lang('count') + '''</a></li>
             </ul>
+            ''' + admin_menu + '''
         ''',
         menu = 0
     ))

+ 0 - 31
route/user_tool.py

@@ -1,31 +0,0 @@
-from .tool.func import *
-
-def user_tool_2(conn, name):
-    curs = conn.cursor()
-
-    data = '''
-        <h2>''' + load_lang('tool') + '''</h2>
-        <ul class="inside_ul">
-            <li><a href="/record/''' + url_pas(name) + '''">''' + load_lang('record') + '''</a></li>
-            <li><a href="/record/topic/''' + url_pas(name) + '''">''' + load_lang('discussion_record') + '''</a></li>
-            <li><a href="/topic/user:''' + url_pas(name) + '''">''' + load_lang('user_discussion') + '''</a></li>
-        </ul>
-    '''
-
-    if admin_check(1) == 1:
-        curs.execute(db_change("select block from rb where block = ? and ongoing = '1'"), [name])
-        ban_name = load_lang('release') if curs.fetchall() else load_lang('ban')
-        
-        data += '''
-            <h2>''' + load_lang('admin') + '''</h2>
-            <ul class="inside_ul">
-                <li><a href="/ban/''' + url_pas(name) + '''">''' + ban_name + '''</a></li>
-                <li><a href="/check/''' + url_pas(name) + '''">''' + load_lang('check') + '''</a></li>
-            </ul>
-        '''
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('tool') + ')', 0])],
-        data = data,
-        menu = 0
-    ))

+ 4 - 4
route/view_diff_data.py → route/view_diff.py

@@ -1,14 +1,14 @@
 from .tool.func import *
 
-def view_diff_data_2(conn, name):
+def view_diff_2(conn, name, num_a, num_b):
     curs = conn.cursor()
+    
+    first = str(num_a)
+    second = str(num_b)
 
     if acl_check(name, 'render') == 1:
         return re_error('/ban')
 
-    first = number_check(flask.request.args.get('first', '1'))
-    second = number_check(flask.request.args.get('second', '1'))
-
     curs.execute(db_change("select title from history where title = ? and (id = ? or id = ?) and hide = 'O'"), [name, first, second])
     if curs.fetchall() and admin_check(6) != 1:
         return re_error('/error/3')

+ 0 - 15
views/main_css/js/load_something.js

@@ -65,21 +65,6 @@ function do_twofa_check(init = 0) {
     }
 }
 
-function do_ip_pas(i = 0) {
-    var get_class = document.getElementsByClassName('need_ip_pas')[i];
-    if(undefined) {
-        // 완성해야함
-        do_ip_pas(i + 1);
-        
-        var ip = get_class.innerHTML;
-        
-        ip = '<a href="' + encodeURIComponent(ip) + '">' + ip + '</a>';
-        ip += ' <a href="/tool/' + encodeURIComponent(ip) + '">(T)</a>';
-        
-        document.getElementsByClassName('need_ip_pas')[i].innerHTML = ip;
-    }
-}
-
 function send_render(i = 0) {
     var get_class = document.getElementsByClassName('send_content')[i];
     if(get_class) {