ソースを参照

redirect JS도 Python으로 통합

잉여개발기 1 年間 前
コミット
487716cdc5

+ 0 - 1
app.py

@@ -901,7 +901,6 @@ 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_redirect)
 app.route('/manager/<int:num>/<everything:add_2>', methods = ['POST', 'GET'])(main_tool_redirect)
-app.route('/redirect_to/<int:n>')(main_redirect)
 
 app.route('/search', methods=['POST'])(main_search)
 app.route('/search/<everything:name>', methods = ['POST', 'GET'])(main_search_deep)

+ 0 - 2
route/__init__.py

@@ -167,8 +167,6 @@ from route.n_topic_list import topic_list
 
 from route.n_give_auth import give_auth
 
-from route.n_main_redirect import main_redirect
-
 from route.n_setting_404_page import setting_404_page
 
 from route.n_bbs_main import bbs_main

+ 1 - 0
route/main_tool_redirect.py

@@ -20,6 +20,7 @@ async def main_tool_redirect(num = 1, add_2 = ''):
             13 : [get_lang(conn, 'document_name'), '/edit', get_lang(conn, 'load')],
             14 : [get_lang(conn, 'document_name'), '/star_doc', get_lang(conn, 'add_star_doc')],
             16 : [0, '/auth/give/fix', get_lang(conn, 'user_fix')],
+            17 : [get_lang(conn, 'search'), '/recent_block/all/1', get_lang(conn, 'search')],
         }
         
         if num == 1:

+ 1 - 1
route/n_list_recent_block.py

@@ -13,7 +13,7 @@ async def list_recent_block(user_name = 'Test', tool = 'all', num = 1, why = '')
             sub = '(' + get_lang(conn, 'cidr') + ')'
         elif tool == 'private':
             sub = '(' + get_lang(conn, 'private') + ')'
-        else:
+        elif tool == 'admin':
             sub = '(' + get_lang(conn, 'admin') + ')'
 
         return easy_minify(conn, flask.render_template(skin_check(conn),

+ 0 - 13
route/n_main_redirect.py

@@ -1,13 +0,0 @@
-from .tool.func import *
-
-async def main_redirect(n = 1):
-    with get_db_connect() as conn:
-        return easy_minify(conn, flask.render_template(skin_check(conn),
-            imp = [get_lang(conn, 'redirect'), wiki_set(conn), await wiki_custom(conn), wiki_css([0, 0])],
-            data = '' + \
-                '<div id="opennamu_main_redirect"></div>' + \
-                '<script defer src="/views/main_css/js/route/main_redirect.js' + cache_v() + '"></script>' + \
-                '<script>window.addEventListener("DOMContentLoaded", function() { opennamu_main_redirect(); });</script>' + \
-            '',
-            menu = [['manager', get_lang(conn, 'return')]]
-        ))

+ 1 - 1
views/main_css/js/route/list_recent_block.js

@@ -47,7 +47,7 @@ function opennamu_list_recent_block() {
             data_html += '<a href="/recent_block/' + option_list[for_a][0] + '">(' + lang[option_list[for_a][1]] + ')</a> ';
         }
 
-        option_list = [['/manager/11', 'blocked'], ['/manager/12', 'admin'], ['/redirect_to/1', 'why']];
+        option_list = [['/manager/11', 'blocked'], ['/manager/12', 'admin'], ['/manager/19', 'why']];
         for(let for_a = 0; for_a < option_list.length; for_a++) {
             data_html += '<a href="' + option_list[for_a][0] + '">(' + lang[option_list[for_a][1]] + ')</a> ';
         }

+ 0 - 65
views/main_css/js/route/main_redirect.js

@@ -1,65 +0,0 @@
-"use strict";
-
-function opennamu_main_redirect() {
-    const url = window.location.pathname;
-    const url_split = url.split('/');
-
-    const post_n = [];
-    const n = url_split[2];
-    
-    if(post_n.includes(n)) {
-        opennamu_main_redirect_post(n);
-    } else {
-        opennamu_main_redirect_get(n);
-    }
-}
-
-function opennamu_main_redirect_send() {
-    const url = window.location.pathname;
-    const url_split = url.split('/');
-
-    const n = url_split[2];
-    const data = document.getElementById('opennamu_main_redirect_input').value;
-
-    if(n === '1') {
-        window.location.pathname = '/recent_block/all/1/' + opennamu_do_url_encode(data);
-    }
-}
-
-function opennamu_main_redirect_get(n) {
-    let lang_data = new FormData();
-    lang_data.append('data', 'send search');
-    
-    fetch('/api/lang', {
-        method : 'POST',
-        body : lang_data,
-    }).then(function(res) {
-        return res.json();
-    }).then(function(lang) {
-        lang = lang["data"];
-
-        let data_html = '';
-        
-        if(n === '1') {
-            data_html += '<input id="opennamu_main_redirect_input" placeholder="' + lang[1] + '">';
-        } else {
-            data_html += '<input id="opennamu_main_redirect_input">';
-        }
-
-        data_html += '<hr class="main_hr">';
-        data_html += '<button onclick="opennamu_main_redirect_send();">' + lang[0] + '</button>';
-
-        document.getElementById('opennamu_main_redirect').innerHTML = data_html;
-    });
-}
-
-function opennamu_main_redirect_post(n) {
-    let url = '';
-    let input = '';
-
-    let data_html = '<form action="' + url + '">';
-    data_html += input;
-    data_html += '</form>';
-
-    document.getElementById('opennamu_main_redirect').innerHTML = '';
-}