2du 4 年 前
コミット
f59e5c02e0

+ 3 - 9
app.py

@@ -686,13 +686,8 @@ def user_info(name = ''):
 def user_count_edit(name = None):
     return user_count_edit_2(load_db.db_get(), name)
     
-@app.route('/alarm')
-def user_alarm():
-    return user_alarm_2(load_db.db_get())
-
-@app.route('/alarm/delete')
-def user_alarm_del():
-    return user_alarm_del_2(load_db.db_get())
+app.route('/alarm')(user_alarm)
+app.route('/alarm/delete')(user_alarm_del)
     
 @app.route('/watch_list')
 def user_watch_list():
@@ -815,8 +810,7 @@ app.route('/api/sitemap.xml')(api_sitemap)
 app.route('/other')(main_tool_other)
 app.route('/manager', methods = ['POST', 'GET'])(main_tool_admin)
 app.route('/manager/<int:num>', methods = ['POST', 'GET'])(main_tool_admin)
-app.route('/manager/<int:num>/<add_1>', methods = ['POST', 'GET'])(main_tool_admin)
-app.route('/manager/<int:num>/<add_1>/<add_2>', methods = ['POST', 'GET'])(main_tool_admin)
+app.route('/manager/<int:num>/<add_2>', methods = ['POST', 'GET'])(main_tool_admin)
 
 app.route('/random')(main_func_random)
 app.route('/upload', methods = ['POST', 'GET'])(main_func_upload)

+ 5 - 5
route/main_tool_admin.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def main_tool_admin(num = 1, add_1 = '', add_2 = ''):
+def main_tool_admin(num = 1, add_2 = ''):
     title_list = {
         0 : [load_lang('document_name'), 'acl', load_lang('acl')],
         1 : [0, 'check', load_lang('check')],
@@ -77,12 +77,12 @@ def main_tool_admin(num = 1, add_1 = '', add_2 = ''):
         ))
     elif not num - 1 > len(title_list):
         num -= 2
+        
+        add_1 = flask.request.form.get('name', 'test')
         if flask.request.method == 'POST':
             if add_2 != '':
-                return redirect(
-                    '/' + title_list[num][1] + '/' + url_pas(add_2) + '?plus=' + url_pas(add_1)
-                )
-            elif flask.request.form.get('regex', None):
+                return redirect('/' + title_list[num][1] + '/' + url_pas(add_2) + '?plus=' + url_pas(add_1))
+            elif flask.request.form.get('regex', '') != '':
                 return redirect('/' + title_list[num][1] + '/' + url_pas(add_1) + '?type=regex')
             else:
                 return redirect('/' + title_list[num][1] + '/' + url_pas(add_1))

+ 37 - 23
route/user_alarm.py

@@ -1,25 +1,39 @@
 from .tool.func import *
 
-def user_alarm_2(conn):
-    curs = conn.cursor()
-
-    num = int(number_check(flask.request.args.get('num', '1')))
-    sql_num = (num * 50 - 50) if num * 50 > 0 else 0
-
-    data = '<ul class="inside_ul">'
-
-    curs.execute(db_change("select data, date from alarm where name = ? order by date desc limit ?, 50"), [ip_check(), sql_num])
-    data_list = curs.fetchall()
-    if data_list:
-        data = '<a href="/alarm/delete">(' + load_lang('delete') + ')</a><hr class=\"main_hr\">' + data
-
-        for data_one in data_list:
-            data += '<li>' + html.escape(data_one[0]) + ' (' + data_one[1] + ')</li>'
-
-    data += '</ul>' + next_fix('/alarm?num=', num, data_list)
-
-    return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('notice'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
-        data = data,
-        menu = [['user', load_lang('return')]]
-    ))
+def user_alarm():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+    
+        num = int(number_check(flask.request.args.get('num', '1')))
+        sql_num = (num * 50 - 50) if num * 50 > 0 else 0
+    
+        data = '<ul class="inside_ul">'
+    
+        curs.execute(db_change("select data, date from alarm where name = ? order by date desc limit ?, 50"), [ip_check(), sql_num])
+        data_list = curs.fetchall()
+        if data_list:
+            data = '' + \
+                '<a href="/alarm/delete">(' + load_lang('delete') + ')</a>' + \
+                '<hr class="main_hr">' + \
+                data + \
+            ''
+    
+            for data_one in data_list:
+                data += '' + \
+                    '<li>' + \
+                        '<span class="send_content">' + html.escape(data_one[0]) + '</span> ' + \
+                        '(' + data_one[1] + ')' + \
+                    '</li>' + \
+                ''
+    
+        data += '' + \
+            '</ul>' + \
+            '<script>send_render();</script>' + \
+            next_fix('/alarm?num=', num, data_list) + \
+        ''
+    
+        return easy_minify(flask.render_template(skin_check(),
+            imp = [load_lang('notice'), wiki_set(), wiki_custom(), wiki_css([0, 0])],
+            data = data,
+            menu = [['user', load_lang('return')]]
+        ))

+ 7 - 6
route/user_alarm_del.py

@@ -1,9 +1,10 @@
 from .tool.func import *
 
-def user_alarm_del_2(conn):
-    curs = conn.cursor()
+def user_alarm_del():
+    with get_db_connect() as conn:
+        curs = conn.cursor()
+    
+        curs.execute(db_change("delete from alarm where name = ?"), [ip_check()])
+        conn.commit()
 
-    curs.execute(db_change("delete from alarm where name = ?"), [ip_check()])
-    conn.commit()
-
-    return redirect('/alarm')
+        return redirect('/alarm')

+ 6 - 7
route/user_watch_list.py

@@ -4,7 +4,7 @@ def user_watch_list_2(conn, tool):
     curs = conn.cursor()
 
     if tool == 'watch_list':
-        div = load_lang("msg_whatchlist_lmt") + ' : 10 <hr class=\"main_hr\">'
+        div = load_lang("msg_whatchlist_lmt") + ' : 10 <hr class="main_hr">'
     else:
         div = ''
 
@@ -13,10 +13,6 @@ def user_watch_list_2(conn, tool):
     if ip_or_user(ip) != 0:
         return redirect('/login')
 
-
-    curs.execute(db_change("delete from scan where user = ? and title = ''"), [ip])
-    conn.commit()
-
     if tool == 'watch_list':
         curs.execute(db_change("select title from scan where type = '' and user = ?"), [ip])
 
@@ -40,14 +36,17 @@ def user_watch_list_2(conn, tool):
 
         div += '' + \
             '<li>' + \
-                '<a href="/w/' + url_pas(data_list[0]) + '">' + data_list[0] + '</a> ' + \
+                '<a href="/w/' + url_pas(data_list[0]) + '">' + html.escape(data_list[0]) + '</a> ' + \
                 plus + \
                 '<a href="/' + ('star_doc' if tool == 'star_doc' else 'watch_list') + '/' + url_pas(data_list[0]) + '">(' + load_lang('delete') + ')</a>' + \
             '</li>' + \
         ''
 
     if data:
-        div = '<ul class="inside_ul">' + div + '</ul><hr class=\"main_hr\">'
+        div = '' + \
+            '<ul class="inside_ul">' + div + '</ul>' + \
+            '<hr class="main_hr">' + \
+        ''
 
     div += '<a href="/manager/' + ('13' if tool == 'watch_list' else '16') + '">(' + load_lang('add') + ')</a>'
 

+ 2 - 0
route/user_watch_list_name.py

@@ -2,6 +2,8 @@ from .tool.func import *
 
 def user_watch_list_name_2(conn, tool, name):
     curs = conn.cursor()
+    
+    print(tool, name)
 
     ip = ip_check()
     if ip_or_user(ip) != 0:

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.5.0-stable (stable1) (beta12) (dev21)",
+        "r_ver" : "v3.5.0-stable (stable1) (beta12) (dev22)",
         "c_ver" : "3500101",
         "s_ver" : "3500110"
     }

+ 5 - 6
views/main_css/js/load_something.js

@@ -69,19 +69,18 @@ function do_twofa_check(init = 0) {
 }
 
 function send_render(i = 0) {
-    var get_class = document.getElementsByClassName('send_content')[i];
+    let get_class = document.getElementsByClassName('send_content')[i];
     if(get_class) {
         send_render(i + 1);
         
-        var data = get_class.innerHTML;
-        
+        let data = get_class.innerHTML;
         if(data === '&lt;br&gt;') {
             document.getElementsByClassName('send_content')[i].innerHTML = '<br>';
         } else {
             data = data.replace(/javascript:/i, '');
-            
-            data = data.replace(/&lt;a&gt;((?:(?!&lt;\/a&gt;).)+)&lt;\/a&gt;/g, function(x, x_1) {
-                return '<a href="/w/' + encodeURIComponent(x_1) + '">' + x_1 + '</a>';
+            data = data.replace(/&lt;a(?:(?:(?!&gt;).)+)&gt;((?:(?!&lt;\/a&gt;).)+)&lt;\/a&gt;/g, function(x, x_1) {
+                x_1_org = x_1.replace('&lt;', '<').replace('&gt;', '>');
+                return '<a href="/w/' + encodeURIComponent(x_1_org) + '">' + x_1 + '</a>';
             });
             
             document.getElementsByClassName('send_content')[i].innerHTML = data;