잉여개발기 (SPDV) 3 سال پیش
والد
کامیت
3694040177

+ 16 - 31
app.py

@@ -317,53 +317,37 @@ app.route('/list/document/old')(list_old_page)
 app.route('/list/document/old/<int:num>')(list_old_page)
 
 # /list/document/acl
-@app.route('/acl_list')
-def list_acl():
-    return list_acl_2()
-
-# /list/document/acl/add
-@app.route('/acl/<everything:name>', methods = ['POST', 'GET'])
-def give_acl(name = None):
-    return give_acl_2(name)
+app.route('/list/document/acl')(list_acl)
+app.route('/list/document/acl/<int:arg_num>')(list_acl)
 
 # /list/document/need
-@app.route('/please')
-def list_please():
-    return list_please_2()
+app.route('/list/document/need')(list_please)
+app.route('/list/document/need/<int:arg_num>')(list_please)
 
 # /list/document/all
 app.route('/list/document/all')(list_title_index)
 app.route('/list/document/all/<int:num>')(list_title_index)
 
 # /list/document/long
-@app.route('/long_page')
-def list_long_page():
-    return list_long_page_2('long_page')
+app.route('/list/document/long')(list_long_page)
 
 # /list/document/short
-@app.route('/short_page')
-def list_short_page():
-    return list_long_page_2('short_page')
+app.route('/list/document/short', defaults = { 'tool' : 'short_page' })(list_long_page)
 
 # /list/file
-@app.route('/image_file_list')
-def list_image_file():
-    return list_image_file_2()
+app.route('/list/file')(list_image_file)
 
 # /list/admin
 # /list/admin/list
-@app.route('/admin_list')
-def list_admin():
-    return list_admin_2()
+app.route('/list/admin')(list_admin)
 
 # /list/admin/auth_use
-app.route('/list/admin/auth_use', methods = ['POST', 'GET'])(list_admin_use)
-app.route('/list/admin/auth_use/<arg_search>/<int:arg_num>', methods = ['POST', 'GET'])(list_admin_use)
+app.route('/list/admin/auth_use', methods = ['POST', 'GET'])(list_admin_auth_use)
+app.route('/list/admin/auth_use/<arg_search>/<int:arg_num>', methods = ['POST', 'GET'])(list_admin_auth_use)
 
 # /list/user
-@app.route('/user_log')
-def list_user():
-    return list_user_2()
+app.route('/list/user')(list_user)
+app.route('/list/user/<int:arg_num>')(list_user)
 
 # /list/user/check
 @app.route('/check/<name>')
@@ -378,9 +362,8 @@ def give_user_check_delete():
 # Func-auth
 # /auth/give
 # /auth/give/<name>
-@app.route('/admin/<name>', methods = ['POST', 'GET'])
-def give_admin(name = None):
-    return give_admin_2(name)
+app.route('/auth/give', methods = ['POST', 'GET'])(give_auth)
+app.route('/auth/give/<name>', methods = ['POST', 'GET'])(give_auth)
 
 # /auth/give
 # /auth/give/<name>
@@ -447,6 +430,8 @@ app.route('/diff/<int(signed = True):num_a>/<int(signed = True):num_b>/<everythi
 
 app.route('/down/<everything:name>')(view_down)
 
+app.route('/acl/<everything:name>', methods = ['POST', 'GET'])(view_acl)
+
 # everything 다음에 추가 붙은 경우에 대해서 재검토 필요 (진행중)
 app.route('/w_rev/<int(signed = True):doc_rev>/<everything:name>')(view_read)
 app.route('/w_from/<everything:name>', defaults = { 'do_type' : 'from' })(view_read)

+ 4 - 2
emergency_tool.py

@@ -239,14 +239,16 @@ elif what_i_do == '20':
     print('----')
     domain = input('Domain (EX : 2du.pythonanywhere.com) : ')
 
-    curs.execute(db_change("update other set data = ? where name = 'domain'"), [domain])
+    curs.execute(db_change('delete from other where name = "domain"'))
+    curs.execute(db_change('insert into other (name, data, coverage) values ("domain", ?, "")'), [domain])
 elif what_i_do == '21':
     print('----')
     tls_v = input('TLS (http) [http, https] : ')
     if not tls_v in ['http', 'https']:
         tls_v = 'http'
 
-    curs.execute(db_change("update other set data = ? where name = 'http_select'"), [tls_v])
+    curs.execute(db_change('delete from other where name = "http_select"'))
+    curs.execute(db_change('insert into other (name, data, coverage) values ("http_select", ?, "")'), [tls_v])
 else:
     raise ValueError(what_i_do)
 

+ 4 - 4
lang/ko-KR.json

@@ -1,6 +1,6 @@
 {
     "language_tag": "ko-KR",
-    "delete_admin_group": "관리자 그룹 삭제",
+    "delete_admin_group": "권한 그룹 삭제",
     "document_name": "문서명",
     "non_login_alert": "비로그인 알림",
     "hide": "숨김",
@@ -153,7 +153,7 @@
     "admin": "관리자",
     "edit_filter_list": "편집 필터 목록",
     "wiki_skin": "위키 스킨",
-    "admin_group": "관리자 그룹",
+    "admin_group": "권한 그룹",
     "all": "전체",
     "error_skin_set": "사용 중인 스킨은 스킨 설정 기능을 지원하지 않습니다.",
     "error_skin_set_old": "일부 오래된 스킨은 구버전 링크를 이용해야만 작동할 수도 있습니다.",
@@ -200,7 +200,7 @@
     "topic_long_error": "토론 제목은 256자를 넘을 수 없습니다.",
     "error_401": "ACL 읽기 제한 문서 문구",
     "history": "역사",
-    "admin_group_list": "관리자 그룹 목록",
+    "admin_group_list": "권한 그룹 목록",
     "time": "시간",
     "password_search_text": "비밀번호 찾기 문구",
     "agreed_discussion": "합의된 토론",
@@ -325,7 +325,7 @@
     "all_register_num": "모든 가입 신청자의 수",
     "replace_move": "서로 바꾸기",
     "merge_move": "문서 병합",
-    "add_admin_group": "관리자 그룹 추가",
+    "add_admin_group": "권한 그룹 추가",
     "add_watchlist": "주시 문서 추가",
     "blocked_user": "차단된 사용자",
     "blocked_admin": "차단한 관리자",

+ 8 - 7
route/give_admin.py → route/give_auth.py

@@ -1,10 +1,11 @@
 from .tool.func import *
 
-def give_admin_2(name):
+def give_auth(name):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        owner = admin_check()
+        owner_auth = admin_check()
+        admin_auth = admin_check(7)
 
         curs.execute(db_change("select data from user_set where id = ? and name = 'acl'"), [name])
         user_acl = curs.fetchall()
@@ -13,7 +14,7 @@ def give_admin_2(name):
         else:
             user_acl = user_acl[0][0]
 
-        if owner != 1:
+        if owner_auth != 1:
             curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [user_acl])
             if curs.fetchall():
                 return re_error('/error/3')
@@ -31,7 +32,7 @@ def give_admin_2(name):
                 select_data = flask.request.form.get('select', 'X')
 
             curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [select_data])
-            if owner != 1 and curs.fetchall():
+            if owner_auth != 1 and curs.fetchall():
                 return re_error('/error/3')
 
             curs.execute(db_change("update user_set set data = ? where id = ? and name = 'acl'"), [
@@ -41,12 +42,12 @@ def give_admin_2(name):
 
             conn.commit()
 
-            return redirect('/admin/' + url_pas(name))
+            return redirect('/auth/give/' + url_pas(name))
         else:
-            if admin_check(7) != 1:
+            if admin_auth != 1:
                 return re_error('/error/3')
 
-            div = '<option value="X">X</option>'
+            div = '<option value="X">' + load_lang('normal') + '</option>'
 
             curs.execute(db_change('select distinct name from alist order by name asc'))
             for data in curs.fetchall():

+ 4 - 4
route/list_acl.py

@@ -1,11 +1,11 @@
 from .tool.func import *
 
-def list_acl_2():
+def list_acl(arg_num = 1):
     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
+        sql_num = (arg_num * 50 - 50) if arg_num * 50 > 0 else 0
+
         div = '<ul class="opennamu_ul">'
 
         curs.execute(db_change(
@@ -30,7 +30,7 @@ def list_acl_2():
             ''
 
         div += '</ul>'
-        div += next_fix('/acl_list?num=', num, list_data)
+        div += next_fix('/list/document/acl/', num, list_data)
 
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('acl_document_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],

+ 1 - 1
route/list_admin.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def list_admin_2():
+def list_admin():
     with get_db_connect() as conn:
         curs = conn.cursor()
 

+ 1 - 1
route/list_admin_use.py → route/list_admin_auth_use.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def list_admin_use(arg_num = 1, arg_search = 'normal'):
+def list_admin_auth_use(arg_num = 1, arg_search = 'normal'):
     with get_db_connect() as conn:
         curs = conn.cursor()
 

+ 2 - 2
route/list_image_file.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def list_image_file_2():
+def list_image_file():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
@@ -15,7 +15,7 @@ def list_image_file_2():
         for data in data_list:
             list_data += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
 
-        list_data += next_fix('/image_file_list?num=', num, data_list)
+        list_data += next_fix('/list/file/', num, data_list)
 
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('image_file_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],

+ 1 - 1
route/list_long_page.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def list_long_page_2(tool):
+def list_long_page(tool = 'long_page'):
     with get_db_connect() as conn:
         curs = conn.cursor()
 

+ 3 - 4
route/list_please.py

@@ -1,11 +1,10 @@
 from .tool.func import *
 
-def list_please_2():
+def list_please(arg_num = 1):
     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
+        sql_num = (arg_num * 50 - 50) if arg_num * 50 > 0 else 0
 
         curs.execute(db_change('select data from other where name = "count_all_title"'))
         if int(curs.fetchall()[0][0]) > 30000:
@@ -23,7 +22,7 @@ def list_please_2():
                 '</li>' + \
             ''
 
-        div += '</ul>' + next_fix('/please?num=', num, data_list)
+        div += '</ul>' + next_fix('/list/document/need/', num, data_list)
 
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('need_document'), wiki_set(), wiki_custom(), wiki_css([0, 0])],

+ 3 - 4
route/list_user.py

@@ -1,11 +1,10 @@
 from .tool.func import *
 
-def list_user_2():
+def list_user(arg_num = 1):
     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
+        sql_num = (arg_num * 50 - 50) if arg_num * 50 > 0 else 0
 
         list_data = '<ul class="opennamu_ul">'
 
@@ -18,7 +17,7 @@ def list_user_2():
                 '</li>' + \
             ''
 
-        list_data += '</ul>' + next_fix('/user_log?num=', num, user_list)
+        list_data += '</ul>' + next_fix('/list/user/', num, user_list)
 
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('member_list'), wiki_set(), wiki_custom(), wiki_css([0, 0])],

+ 7 - 7
route/main_tool_other.py

@@ -13,7 +13,7 @@ def main_tool_other():
                 <h2>''' + load_lang('list') + '''</h2>
                 <h3>''' + load_lang('admin') + '''</h3>
                 <ul class="opennamu_ul">               
-                    <li><a href="/admin_list">''' + load_lang('admin_list') + '''</a></li>
+                    <li><a href="/list/admin">''' + load_lang('admin_list') + '''</a></li>
                     <li><a href="/list/admin/auth_use">''' + load_lang('authority_use_list') + '''</a></li>
                 </ul>
                 <h3>''' + load_lang('discussion') + '''</h3>
@@ -24,20 +24,20 @@ def main_tool_other():
                 <ul class="opennamu_ul">
                     <li><a href="/recent_change">''' + load_lang('recent_change') + '''</a></li>
                     <li><a href="/list/document/all">''' + load_lang('all_document_list') + '''</a></li>
-                    <li><a href="/acl_list">''' + load_lang('acl_document_list') + '''</a></li>
-                    <li><a href="/please">''' + load_lang('need_document') + '''</a></li>
-                    <li><a href="/long_page">''' + load_lang('long_page') + '''</a></li>
-                    <li><a href="/short_page">''' + load_lang('short_page') + '''</a></li>
+                    <li><a href="/list/document/acl">''' + load_lang('acl_document_list') + '''</a></li>
+                    <li><a href="/list/document/need">''' + load_lang('need_document') + '''</a></li>
+                    <li><a href="/list/document/long">''' + load_lang('long_page') + '''</a></li>
+                    <li><a href="/list/document/short">''' + load_lang('short_page') + '''</a></li>
                     <li><a href="/list/document/old">''' + load_lang('old_page') + '''</a></li>
                 </ul>
                 <h3>''' + load_lang('user') + '''</h3>
                 <ul class="opennamu_ul">
                     <li><a href="/block_log">''' + load_lang('recent_ban') + '''</a></li>
-                    <li><a href="/user_log">''' + load_lang('member_list') + '''</a></li>
+                    <li><a href="/list/user">''' + load_lang('member_list') + '''</a></li>
                 </ul>
                 <h3>''' + load_lang('other') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/image_file_list">''' + load_lang('image_file_list') + '''</a></li>
+                    <li><a href="/list/file">''' + load_lang('image_file_list') + '''</a></li>
                     <li><a href="/vote">''' + load_lang('vote_list') + '''</a></li>
                     <li><a href="/bbs/main">''' + load_lang('bbs_main') + '''</a></li>
                 </ul>

+ 19 - 19
route/main_tool_redirect.py

@@ -3,28 +3,28 @@ from .tool.func import *
 def main_tool_redirect(num = 1, add_2 = ''):
     with get_db_connect() as conn:
         title_list = {
-            0 : [load_lang('document_name'), 'acl', load_lang('acl')],
-            1 : [0, 'check', load_lang('check')],
-            2 : [load_lang('file_name'), 'file_filter/add', load_lang('file_filter_add')],
-            3 : [0, 'admin', load_lang('authorize')],
-            4 : [0, 'record', load_lang('edit_record')],
-            5 : [0, 'record/topic', load_lang('discussion_record')],
-            6 : [load_lang('name'), 'admin_plus', load_lang('add_admin_group')],
-            7 : [load_lang('name'), 'edit_filter/add', load_lang('edit_filter_add')],
-            8 : [load_lang('document_name'), 'search', load_lang('search')],
-            9 : [0, 'block_log/user', load_lang('blocked_user')],
-            10 : [0, 'block_log/admin', load_lang('blocked_admin')],
-            11 : [load_lang('document_name'), 'watch_list', load_lang('add_watchlist')],
-            12 : [load_lang('compare_target'), 'check', load_lang('compare_target')],
-            13 : [load_lang('document_name'), 'edit', load_lang('load')],
-            14 : [load_lang('document_name'), 'star_doc', load_lang('add_star_doc')],
-            15 : [load_lang('name_or_ip_or_regex'), 'auth/give/ban', load_lang('release')],
-            16 : [0, 'auth/give/fix', load_lang('user_fix')],
+            0 : [load_lang('document_name'), '/acl', load_lang('acl')],
+            1 : [0, '/check', load_lang('check')],
+            2 : [load_lang('file_name'), '/file_filter/add', load_lang('file_filter_add')],
+            3 : [0, '/auth/give', load_lang('authorize')],
+            4 : [0, '/record', load_lang('edit_record')],
+            5 : [0, '/record/topic', load_lang('discussion_record')],
+            6 : [load_lang('name'), '/admin_plus', load_lang('add_admin_group')],
+            7 : [load_lang('name'), '/edit_filter/add', load_lang('edit_filter_add')],
+            8 : [load_lang('document_name'), '/search', load_lang('search')],
+            9 : [0, '/block_log/user', load_lang('blocked_user')],
+            10 : [0, '/block_log/admin', load_lang('blocked_admin')],
+            11 : [load_lang('document_name'), '/watch_list', load_lang('add_watchlist')],
+            12 : [load_lang('compare_target'), '/check', load_lang('compare_target')],
+            13 : [load_lang('document_name'), '/edit', load_lang('load')],
+            14 : [load_lang('document_name'), '/star_doc', load_lang('add_star_doc')],
+            15 : [load_lang('name_or_ip_or_regex'), '/auth/give/ban', load_lang('release')],
+            16 : [0, '/auth/give/fix', load_lang('user_fix')],
         }
         
         if num == 1:
             return redirect('/manager')
-        elif not num - 1 > len(title_list):
+        elif num - 1 <= len(title_list):
             num -= 2
 
             add_1 = flask.request.form.get('name', 'test')
@@ -35,7 +35,7 @@ def main_tool_redirect(num = 1, add_2 = ''):
                 elif flask.request.form.get('regex', '') != '':
                     return redirect('/auth/give/ban_regex/' + url_pas(add_1))
                 else:
-                    return redirect('/' + title_list[num][1] + '/' + url_pas(add_1))
+                    return redirect(title_list[num][1] + '/' + url_pas(add_1))
             else:
                 if title_list[num][0] == 0:
                     placeholder = load_lang('user_name')

+ 1 - 1
route/give_acl.py → route/view_acl.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def give_acl_2(name):
+def view_acl(name):
     with get_db_connect() as conn:
         curs = conn.cursor()