소스 검색

파괴는 창조의 어머니

잉여개발기 11 달 전
부모
커밋
a1bd5297b7
43개의 변경된 파일3개의 추가작업 그리고 756개의 파일을 삭제
  1. 0 54
      app.py
  2. 2 0
      requirements.txt
  3. 1 49
      route/__init__.py
  4. 0 8
      route/go_api_bbs.py
  5. 0 4
      route/go_api_bbs_list.py
  6. 0 11
      route/go_api_bbs_w.py
  7. 0 12
      route/go_api_bbs_w_comment.py
  8. 0 12
      route/go_api_bbs_w_comment_one.py
  9. 0 13
      route/go_api_bbs_w_set.py
  10. 0 11
      route/go_api_bbs_w_tabom.py
  11. 0 7
      route/go_api_func_auth.py
  12. 0 18
      route/go_api_func_email.py
  13. 0 23
      route/go_api_func_ip.py
  14. 0 8
      route/go_api_func_ip_menu.py
  15. 0 15
      route/go_api_func_language.py
  16. 0 10
      route/go_api_func_llm.py
  17. 0 12
      route/go_api_func_search.py
  18. 0 7
      route/go_api_func_sha224.py
  19. 0 15
      route/go_api_give_auth.py
  20. 0 7
      route/go_api_list_acl.py
  21. 0 6
      route/go_api_list_auth.py
  22. 0 12
      route/go_api_list_history.py
  23. 0 4
      route/go_api_list_markup.py
  24. 0 11
      route/go_api_list_old_page.py
  25. 0 10
      route/go_api_list_recent_block.py
  26. 0 19
      route/go_api_list_recent_change.py
  27. 0 16
      route/go_api_list_recent_discuss.py
  28. 0 12
      route/go_api_list_recent_edit_request.py
  29. 0 7
      route/go_api_list_title_index.py
  30. 0 22
      route/go_api_setting.py
  31. 0 136
      route/go_api_topic.py
  32. 0 9
      route/go_api_topic_list.py
  33. 0 10
      route/go_api_user_rankup.py
  34. 0 14
      route/go_api_user_setting_editor.py
  35. 0 7
      route/go_api_w_page_view.py
  36. 0 7
      route/go_api_w_random.py
  37. 0 12
      route/go_api_w_raw.py
  38. 0 70
      route/go_api_w_render.py
  39. 0 7
      route/go_api_w_set_reset.py
  40. 0 9
      route/go_api_w_watch_list.py
  41. 0 9
      route/go_api_w_xref.py
  42. 0 19
      route/go_main_func_easter_egg.py
  43. 0 32
      route/tool/func.py

+ 0 - 54
app.py

@@ -242,60 +242,6 @@ with get_db_connect(init_mode = True) as conn:
 for for_a in server_set:
     global_some_set_do('setup_' + for_a, server_set[for_a])
 
-###
-
-if platform.system() == 'Linux':
-    if platform.machine() in ["AMD64", "x86_64"]:
-        cmd = [os.path.join(".", "route_go", "bin", "main.amd64.bin")]
-    else:
-        cmd = [os.path.join(".", "route_go", "bin", "main.arm64.bin")]
-elif platform.system() == 'Darwin':
-    cmd = [os.path.join(".", "route_go", "bin", "main.mac.arm64.bin")]
-else:
-    if platform.machine() in ["AMD64", "x86_64"]:
-        cmd = [os.path.join(".", "route_go", "bin", "main.amd64.exe")]
-    else:
-        cmd = [os.path.join(".", "route_go", "bin", "main.arm64.exe")]
-        
-cmd += [server_set["golang_port"]]
-if run_mode != '':
-    cmd += [run_mode]
-
-async def golang_process_check():
-    while True:
-        try:
-            other_set_temp = {}
-            for k in data_db_set:
-                other_set_temp["db_" + k] = data_db_set[k]
-
-            other_set = {
-                "url" : "test",
-                "data" : json_dumps(other_set_temp),
-                "session" : "{}",
-                "cookie" : "",
-                "ip" : "127.0.0.1"
-            }
-
-            response = requests.post('http://localhost:' + server_set["golang_port"] + '/', data = json_dumps(other_set))
-            if response.status_code == 200:
-                print('Golang turn on')
-                break
-        except requests.ConnectionError:
-            print('Wait golang...')
-            time.sleep(1)
-
-golang_process = subprocess.Popen(cmd)
-
-try:
-    loop = asyncio.get_running_loop()
-    loop.create_task(golang_process_check())
-except RuntimeError:
-    loop = asyncio.new_event_loop()
-    asyncio.set_event_loop(loop)
-    loop.run_until_complete(golang_process_check())
-
-###
-
 def back_up(data_db_set):
     with get_db_connect() as conn:
         curs = conn.cursor()

+ 2 - 0
requirements.txt

@@ -4,6 +4,8 @@ flask
 flask[async]
 hypercorn
 
+aiosqlite
+aiomysql
 aiohttp
 asyncio
 requests

+ 1 - 49
route/__init__.py

@@ -172,52 +172,4 @@ from route.n_bbs_main import bbs_main
 from route.n_bbs_in import bbs_in
 from route.n_bbs_w_set import bbs_w_set
 
-from route.n_edit_move_all import edit_move_all
-
-from route.go_api_func_llm import api_func_llm
-from route.go_api_func_language import api_func_language, api_func_language_exter
-from route.go_api_func_sha224 import api_func_sha224
-from route.go_api_func_ip import api_func_ip
-from route.go_api_func_ip_menu import api_func_ip_menu
-from route.go_api_func_auth import api_func_auth
-from route.go_api_func_email import api_func_email, api_func_email_exter
-from route.go_api_func_search import api_func_search, api_func_search_exter
-
-from route.go_api_give_auth import api_give_auth
-
-from route.go_api_list_recent_change import api_list_recent_change, api_list_recent_change_exter
-from route.go_api_list_recent_discuss import api_list_recent_discuss
-from route.go_api_list_recent_block import api_list_recent_block
-from route.go_api_list_recent_edit_request import api_list_recent_edit_request, api_list_recent_edit_request_exter
-from route.go_api_list_old_page import api_list_old_page, api_list_old_page_exter
-from route.go_api_list_title_index import api_list_title_index
-from route.go_api_list_acl import api_list_acl
-from route.go_api_list_auth import api_list_auth
-from route.go_api_list_markup import api_list_markup
-from route.go_api_list_history import api_list_history, api_list_history_exter
-
-from route.go_api_bbs import api_bbs
-from route.go_api_bbs_list import api_bbs_list
-from route.go_api_bbs_w import api_bbs_w
-from route.go_api_bbs_w_set import api_bbs_w_set
-from route.go_api_bbs_w_tabom import api_bbs_w_tabom
-from route.go_api_bbs_w_comment import api_bbs_w_comment, api_bbs_w_comment_exter
-from route.go_api_bbs_w_comment_one import api_bbs_w_comment_one, api_bbs_w_comment_one_exter
-
-from route.go_api_setting import api_setting, api_setting_exter
-
-from route.go_api_topic import api_topic
-from route.go_api_topic_list import api_topic_list
-
-from route.go_api_user_rankup import api_user_rankup
-from route.go_api_user_setting_editor import api_user_setting_editor
-
-from route.go_api_w_raw import api_w_raw, api_w_raw_exter
-from route.go_api_w_random import api_w_random, api_w_random_exter
-from route.go_api_w_xref import api_w_xref
-from route.go_api_w_watch_list import api_w_watch_list
-from route.go_api_w_render import api_w_render, api_w_render_exter
-from route.go_api_w_set_reset import api_w_set_reset
-from route.go_api_w_page_view import api_w_page_view
-
-from route.go_main_func_easter_egg import main_func_easter_egg
+from route.n_edit_move_all import edit_move_all

+ 0 - 8
route/go_api_bbs.py

@@ -1,8 +0,0 @@
-from .tool.func import *
-
-async def api_bbs(bbs_num = "", page = 1):
-    other_set = {}
-    other_set["bbs_num"] = str(bbs_num)
-    other_set["page"] = str(page)
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 4
route/go_api_bbs_list.py

@@ -1,4 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_list():
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name))

+ 0 - 11
route/go_api_bbs_w.py

@@ -1,11 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_w(sub_code = '', legacy = 'on'):
-    other_set = {}
-    other_set["legacy"] = legacy
-    other_set['sub_code'] = sub_code
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_bbs_w_exter(sub_code = '', legacy = 'on'):
-    return flask.jsonify(await api_bbs_w(sub_code, legacy))

+ 0 - 12
route/go_api_bbs_w_comment.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_w_comment(sub_code = '', tool = "", legacy = 'on'):
-    other_set = {}
-    other_set["sub_code"] = sub_code
-    other_set["tool"] = tool
-    other_set["legacy"] = legacy
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_bbs_w_comment_exter(sub_code = '', tool = "", legacy = 'on'):
-    return flask.jsonify(await api_bbs_w_comment(sub_code, tool, legacy))

+ 0 - 12
route/go_api_bbs_w_comment_one.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_w_comment_one(sub_code = '', legacy = 'on', tool = ''):
-    other_set = {}
-    other_set["sub_code"] = sub_code
-    other_set["legacy"] = legacy
-    other_set["tool"] = tool
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_bbs_w_comment_one_exter(sub_code = '', legacy = 'on', tool = ''):
-    return flask.jsonify(await api_bbs_w_comment_one(sub_code, legacy, tool))

+ 0 - 13
route/go_api_bbs_w_set.py

@@ -1,13 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_w_set(name = 'Test', bbs_num = 1):
-    other_set = {}
-    other_set["set_name"] = name
-    other_set["set_id"] = str(bbs_num)
-
-    func_name = sys._getframe().f_code.co_name
-    if flask.request.method == 'PUT':
-        func_name += '_put'
-        other_set['data'] = flask.request.form.get('data', 'Test')
-    
-    return flask.jsonify(await python_to_golang(func_name, other_set))

+ 0 - 11
route/go_api_bbs_w_tabom.py

@@ -1,11 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_w_tabom(sub_code = ''):
-    other_set = {}
-    other_set["sub_code"] = sub_code
-
-    func_name = sys._getframe().f_code.co_name
-    if flask.request.method == 'POST':
-        func_name += '_post'
-
-    return flask.jsonify(await python_to_golang(func_name, other_set))

+ 0 - 7
route/go_api_func_auth.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_func_auth(user_name = ''):
-    other_set = {}
-    other_set["ip"] = ip_check() if user_name == '' else user_name
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 18
route/go_api_func_email.py

@@ -1,18 +0,0 @@
-from .tool.func import *
-
-async def api_func_email():
-    if flask.request.method == 'POST':
-        func_name = sys._getframe().f_code.co_name
-        func_name += '_post'
-
-        other_set = {}
-        other_set["who"] = flask.request.form.get('email', '')
-        other_set["title"] = flask.request.form.get('title', '')
-        other_set["data"] = flask.request.form.get('data', '')
-
-        return await python_to_golang(func_name, other_set)
-    else:
-        return {}
-
-async def api_func_email_exter():
-    return flask.jsonify(await api_func_email())

+ 0 - 23
route/go_api_func_ip.py

@@ -1,23 +0,0 @@
-from .tool.func import *
-
-async def api_func_ip(data = 'Test'):
-    other_set = {}
-
-    func_name = sys._getframe().f_code.co_name
-    if flask.request.method == 'POST':
-        func_name += '_post'
-
-        for_a = 1
-        while 1:
-            data = flask.request.form.get('data_' + str(for_a), '')
-            
-            if data == '':
-                break
-            else:
-                other_set['data_' + str(for_a)] = data
-
-            for_a += 1
-    else:
-        other_set["data"] = data
-
-    return flask.jsonify(await python_to_golang(func_name, other_set))

+ 0 - 8
route/go_api_func_ip_menu.py

@@ -1,8 +0,0 @@
-from .tool.func import *
-
-async def api_func_ip_menu(ip = "Test", option = ""):
-    other_set = {}
-    other_set["ip"] = ip
-    other_set["option"] = option
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 15
route/go_api_func_language.py

@@ -1,15 +0,0 @@
-from .tool.func import *
-
-async def api_func_language(legacy = 'on', data = 'Test'):
-    other_set = {}
-    if flask.request.method == 'POST':
-        other_set["data"] = flask.request.form.get('data', '')
-    else:
-        other_set["data"] = data
-
-    other_set["legacy"] = legacy
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_func_language_exter(legacy = 'on', data = 'Test'):
-    return flask.jsonify(await api_func_language(legacy, data))

+ 0 - 10
route/go_api_func_llm.py

@@ -1,10 +0,0 @@
-from .tool.func import *
-
-async def api_func_llm():
-    if flask.request.method == 'POST':
-        other_set = {}
-        other_set["prompt"] = flask.request.form.get('prompt', '')
-
-        return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))
-    else:
-        return flask.jsonify({})

+ 0 - 12
route/go_api_func_search.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def api_func_search(name = 'Test', search_type = 'title', num = 1):
-    other_set = {}
-    other_set["name"] = name
-    other_set["search_type"] = search_type
-    other_set["num"] = str(num)
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_func_search_exter(name = 'Test', search_type = 'title', num = 1):
-    return flask.jsonify(await api_func_search(name, search_type, num))

+ 0 - 7
route/go_api_func_sha224.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_func_sha224(data = 'Test'):
-    other_set = {}
-    other_set["data"] = data
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 15
route/go_api_give_auth.py

@@ -1,15 +0,0 @@
-from .tool.func import *
-
-async def api_give_auth():
-    if flask.request.method == 'PATCH':
-        func_name = sys._getframe().f_code.co_name
-        func_name += '_patch'
-
-        other_set = {}
-        other_set["user_name"] = flask.request.form.get('user_name', '')
-        other_set['auth'] = flask.request.form.get('auth', '')
-        other_set['change_auth'] = flask.request.form.get('change_auth', '')
-
-        return flask.jsonify(await python_to_golang(func_name, other_set))
-    else:
-        return flask.jsonify({}) 

+ 0 - 7
route/go_api_list_acl.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_list_acl(data_type = ''):
-    other_set = {}
-    other_set = data_type
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 6
route/go_api_list_auth.py

@@ -1,6 +0,0 @@
-from .tool.func import *
-
-async def api_list_auth():
-    other_set = {}
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 12
route/go_api_list_history.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def api_list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
-    other_set = {}
-    other_set["num"] = str(num)
-    other_set["doc_name"] = doc_name
-    other_set["set_type"] = set_type
-    
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_list_history_exter(num = 1, set_type = 'normal', doc_name = 'Test'):
-    return flask.jsonify(await api_list_history(num, set_type, doc_name))

+ 0 - 4
route/go_api_list_markup.py

@@ -1,4 +0,0 @@
-from .tool.func import *
-
-async def api_list_markup():
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name))

+ 0 - 11
route/go_api_list_old_page.py

@@ -1,11 +0,0 @@
-from .tool.func import *
-
-async def api_list_old_page(num = 1, set_type = 'old'):
-    other_set = {}
-    other_set["num"] = str(num)
-    other_set["set_type"] = set_type
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_list_old_page_exter(num = 1, set_type = 'old'):
-    return flask.jsonify(await api_list_old_page(num, set_type))

+ 0 - 10
route/go_api_list_recent_block.py

@@ -1,10 +0,0 @@
-from .tool.func import *
-
-async def api_list_recent_block(num = 1, set_type = 'all', user_name = 'Test', why = ''):
-    other_set = {}
-    other_set["num"] = str(num)
-    other_set["set_type"] = set_type
-    other_set["user_name"] = user_name
-    other_set["why"] = why
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 19
route/go_api_list_recent_change.py

@@ -1,19 +0,0 @@
-from .tool.func import *
-
-async def api_list_recent_change(num = 1, set_type = 'normal', limit = 10, legacy = 'on'):
-    other_set = {}
-    other_set["num"] = str(num)
-    other_set["limit"] = str(limit)
-    other_set["set_type"] = set_type
-    other_set["legacy"] = legacy
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_list_recent_change_exter(num = 1, set_type = 'normal', limit = 10, legacy = 'on'):
-    response = flask.make_response(flask.jsonify(await api_list_recent_change(num, set_type, limit, legacy)))
-    
-    response.headers.add("Access-Control-Allow-Origin", "*")
-    response.headers.add('Access-Control-Allow-Headers', "Content-Type")
-    response.headers.add('Access-Control-Allow-Methods', "GET")
-
-    return response

+ 0 - 16
route/go_api_list_recent_discuss.py

@@ -1,16 +0,0 @@
-from .tool.func import *
-
-async def api_list_recent_discuss(num = 1, set_type = 'normal', limit = 10, legacy = 'on'):
-    other_set = {}
-    other_set["num"] = str(num)
-    other_set["limit"] = str(limit)
-    other_set["set_type"] = set_type
-    other_set["legacy"] = legacy
-
-    response = flask.make_response(flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set)))
-    
-    response.headers.add("Access-Control-Allow-Origin", "*")
-    response.headers.add('Access-Control-Allow-Headers', "Content-Type")
-    response.headers.add('Access-Control-Allow-Methods', "GET")
-
-    return response

+ 0 - 12
route/go_api_list_recent_edit_request.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def api_list_recent_edit_request(num = 1, set_type = 'normal', limit = 50):
-    other_set = {}
-    other_set["num"] = str(num)
-    other_set["limit"] = str(limit)
-    other_set["set_type"] = set_type
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_list_recent_edit_request_exter(num = 1, set_type = 'normal', limit = 50):
-    return flask.jsonify(await api_list_recent_edit_request_exter(num, set_type, limit))

+ 0 - 7
route/go_api_list_title_index.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_list_title_index(num = 1):
-    other_set = {}
-    other_set["num"] = str(num)
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 22
route/go_api_setting.py

@@ -1,22 +0,0 @@
-from .tool.func import *
-
-async def api_setting(name = 'Test', method = '', data = ''):
-    other_set = {}
-    other_set["set_name"] = name
-
-    if method == '':
-        method = flask.request.method
-
-    func_name = sys._getframe().f_code.co_name
-    if method == 'PUT':
-        func_name += '_put'
-
-        if data == '':
-            other_set['data'] = flask.request.form.get('data', 'Test')
-        else:
-            other_set['data'] = data
-
-    return await python_to_golang(func_name, other_set)
-
-async def api_setting_exter(name = 'Test'):
-    return flask.jsonify(await api_setting(name))

+ 0 - 136
route/go_api_topic.py

@@ -1,136 +0,0 @@
-from .tool.func import *
-
-def api_topic_thread_make(user_id, date, data, code, color = '', blind = '', add_style = '', admin_check = 1, topic_num = ''):
-    if blind == 'O':
-        if data == '':
-            color_b = 'opennamu_comment_blind'
-        else:
-            color_b = 'opennamu_comment_blind_admin'
-
-        class_b = 'opennamu_comment_blind_js opennamu_list_hidden'
-    else:
-        color_b = 'opennamu_comment_blind_not'
-        class_b = ''
-
-    admin_check_box = ''
-    if admin_check == 1 and topic_num != '':
-        admin_check_box = '<input type="checkbox" class="opennamu_blind_button" id="opennamu_blind_' + topic_num + '_' + code + '">'
-
-    return '''
-        <span class="''' + class_b + '''">
-            <table class="opennamu_comment" style="''' + add_style + '''">
-                <tr>
-                    <td class="opennamu_comment_color_''' + color + '''">
-                        ''' + admin_check_box + '''
-                        <a href="#thread_shortcut" id="''' + code + '''">#''' + code + '''</a>
-                        ''' + user_id + '''
-                        <span style="float: right;">''' + date + '''</span>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="''' + color_b + ''' opennamu_comment_data_main" id="thread_''' + code + '''">
-                        ''' + data + '''
-                        <div id="opennamu_topic_req_''' + code + '''"></div>
-                    </td>
-                </tr>
-            </table>
-            <hr class="main_hr">
-        </span>
-    '''
-
-async def api_topic_thread_pre_render(conn, data, num, ip, topic_num = '', name = '', sub = '', do_type = 'thread'):
-    curs = conn.cursor()
-
-    # 이거 좀 엉성해서 언젠간 손 보고 싶음
-    call_thread_regex = r"( |\n|^)(?:#([0-9]+)(?:-([0-9]+))?)( |\n|$)"
-    call_thread_count = len(re.findall(call_thread_regex, data)) * 3
-    while 1:
-        rd_data = re.search(call_thread_regex, data)
-        if call_thread_count < 0:
-            break
-        elif not rd_data:
-            break
-        else:
-            rd_data = rd_data.groups()
-
-            view_data = rd_data[1]
-            send_topic_num = topic_num
-            if rd_data[2]:
-                view_data += '-' + rd_data[2]
-                if do_type == 'thread':
-                    send_topic_num = rd_data[2]
-                else:
-                    set_id = topic_num.split('-')
-
-                    send_topic_num = set_id[0] + '-' + rd_data[2]
-                    view_data += '-' + set_id[0]
-
-            if do_type == 'thread':
-                curs.execute(db_change("select ip from topic where code = ? and id = ?"), [send_topic_num, rd_data[1]])
-            else:
-                if rd_data[1] == '0':
-                    set_id = send_topic_num.split('-')
-                    set_id = ['', ''] if len(set_id) < 2 else set_id
-
-                    curs.execute(db_change('select set_data from bbs_data where set_name = "user_id" and set_id = ? and set_code = ?'), [set_id[0], set_id[1]])
-                else:
-                    curs.execute(db_change('select set_data from bbs_data where set_name = "comment_user_id" and set_id = ? and set_code = ?'), [send_topic_num, rd_data[1]])
-
-            ip_data = curs.fetchall()
-            if ip_data and ip_or_user(ip_data[0][0]) == 0:
-                if do_type == 'thread':
-                    await add_alarm(ip_data[0][0], ip, '<a href="/thread/' + topic_num + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
-                else:
-                    set_id = topic_num.split('-')
-                    set_id = ['', ''] if len(set_id) < 2 else set_id
-
-                    await add_alarm(ip_data[0][0], ip, 'BBS <a href="/bbs/w/' + set_id[0] + '/' + set_id[1] + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
-
-            data = re.sub(call_thread_regex, rd_data[0] + '<topic_a_' + do_type + '>#' + view_data + '</topic_a_' + do_type + '>' + rd_data[3], data, 1)
-
-        call_thread_count -= 1
-
-    call_user_regex = r"( |\n|^)(?:@([^ \n]+))( |\n|$)"
-    call_user_count = len(re.findall(call_user_regex, data)) * 3
-    while 1:
-        rd_data = re.search(call_user_regex, data)
-        if call_user_count < 0:
-            break
-        elif not rd_data:
-            break
-        else:
-            rd_data = rd_data.groups()
-
-            curs.execute(db_change("select ip from history where ip = ? limit 1"), [rd_data[1]])
-            ip_data = curs.fetchall()
-            if not ip_data:
-                curs.execute(db_change("select ip from topic where ip = ? limit 1"), [rd_data[1]])
-                ip_data = curs.fetchall()
-
-            if ip_data and ip_or_user(ip_data[0][0]) == 0:
-                if do_type == 'thread':
-                    await add_alarm(ip_data[0][0], ip, '<a href="/thread/' + topic_num + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
-                else:
-                    set_id = topic_num.split('-')
-                    await add_alarm(ip_data[0][0], ip, 'BBS <a href="/bbs/w/' + set_id[0] + '/' + set_id[1] + '#' + num + '">' + html.escape(name) + ' - ' + html.escape(sub) + '#' + num + '</a>')
-
-            data = re.sub(call_user_regex, rd_data[0] + '<topic_call>@' + rd_data[1] + '</topic_call>' + rd_data[2], data, 1)
-
-        call_user_count -= 1
-
-    return data
-
-async def api_topic(topic_num = 1, tool = 'normal', s_num = '', e_num = ''):
-    with get_db_connect() as conn:
-        topic_num = str(topic_num)
-
-        if await acl_check('', 'topic_view', topic_num) != 1:
-            other_set = {}
-            other_set["topic_num"] = topic_num
-            other_set["tool"] = tool
-            other_set["s_num"] = str(s_num)
-            other_set["e_num"] = str(e_num)
-
-            return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))
-        else:
-            return flask.jsonify({})

+ 0 - 9
route/go_api_topic_list.py

@@ -1,9 +0,0 @@
-from .tool.func import *
-
-async def api_topic_list(name = 'Test', set_type = 'normal', num = 1):
-    other_set = {}
-    other_set["name"] = str(name)
-    other_set["set_type"] = set_type
-    other_set["num"] = str(num)
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 10
route/go_api_user_rankup.py

@@ -1,10 +0,0 @@
-from .tool.func import *
-
-async def api_user_rankup():
-    other_set = {}
-    
-    func_name = sys._getframe().f_code.co_name
-    if flask.request.method == 'PATCH':
-        func_name += '_patch'
-
-    return flask.jsonify(await python_to_golang(func_name, other_set))

+ 0 - 14
route/go_api_user_setting_editor.py

@@ -1,14 +0,0 @@
-from .tool.func import *
-
-async def api_user_setting_editor():
-    other_set = {}
-    
-    func_name = sys._getframe().f_code.co_name
-    if flask.request.method == 'POST':
-        func_name += '_post'
-        other_set['data'] = flask.request.form.get('data', 'Test')
-    elif flask.request.method == 'DELETE':
-        func_name += '_delete'
-        other_set['data'] = flask.request.form.get('data', 'Test')
-
-    return flask.jsonify(await python_to_golang(func_name, other_set))

+ 0 - 7
route/go_api_w_page_view.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_w_page_view(name = 'Test'):
-    other_set = {}
-    other_set["doc_name"] = name
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 7
route/go_api_w_random.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_w_random():
-    return await python_to_golang(sys._getframe().f_code.co_name)
-
-async def api_w_random_exter():
-    return flask.jsonify(await api_w_random())

+ 0 - 12
route/go_api_w_raw.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def api_w_raw(name = 'Test', rev = '', exist_check = ''):
-    other_set = {}
-    other_set["name"] = name
-    other_set["rev"] = str(rev)
-    other_set["exist_check"] = exist_check
-
-    return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-
-async def api_w_raw_exter(name = 'Test', rev = '', exist_check = ''):
-    return flask.jsonify(await api_w_raw(name, rev, exist_check))

+ 0 - 70
route/go_api_w_render.py

@@ -1,70 +0,0 @@
-from .tool.func import *
-
-from .go_api_w_raw import api_w_raw
-
-async def api_w_render(name = '', tool = '', request_method = '', request_data = {}):
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        flask_data = flask_data_or_variable(flask.request.form, request_data)
-        request_method = flask.request.method if request_method == '' else request_method
-
-        if request_method == 'POST':
-            name = flask_data.get('name', '')
-            data_org = flask_data.get('data', '')
-            data_option = flask_data.get('option', '')
-
-            markup = ''
-            if tool in ('', 'from', 'include'):
-                curs.execute(db_change("select set_data from data_set where doc_name = ? and set_name = 'document_markup'"), [name])
-                db_data = curs.fetchall()
-                if db_data and db_data[0][0] != '' and db_data[0][0] != 'normal':
-                    markup = db_data[0][0]
-
-                if markup == '':
-                    curs.execute(db_change('select data from other where name = "markup"'))
-                    db_data = curs.fetchall()
-                    markup = db_data[0][0] if db_data else 'namumark'
-
-            data_type = ''
-            if tool == '':
-                data_type = 'api_view'
-            elif tool == 'from':
-                data_type = 'api_from'
-            elif tool == 'include':
-                data_type = 'api_include'
-            elif tool == 'backlink':
-                data_type = 'backlink'
-            else:
-                data_type = 'api_thread'
-
-            if markup in ('', 'namumark', 'namumark_beta') and data_option != '':
-                data_option = json_loads(data_option)
-
-                # remove end br
-                data_org = re.sub('^\n+', '', data_org)
-
-            if markup in ('', 'namumark'):
-                data_pas = render_set(conn, 
-                    doc_name = name, 
-                    doc_data = data_org, 
-                    data_type = data_type,
-                    parameter = data_option
-                )
-
-                return {
-                    "data" : data_pas[0], 
-                    "js_data" : data_pas[1]
-                }
-            else:
-                other_set = {}
-                other_set["doc_name"] = name
-                other_set["render_type"] = data_type
-                other_set["data"] = data_org
-
-                return await python_to_golang(sys._getframe().f_code.co_name, other_set)
-        else:
-            return {}
-
-async def api_w_render_exter(name = '', tool = '', request_method = '', request_data = {}):
-    return flask.jsonify(await api_w_render(name, tool, request_method, request_data))

+ 0 - 7
route/go_api_w_set_reset.py

@@ -1,7 +0,0 @@
-from .tool.func import *
-
-async def api_w_set_reset(name = 'Test'):
-    other_set = {}
-    other_set["name"] = name
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 9
route/go_api_w_watch_list.py

@@ -1,9 +0,0 @@
-from .tool.func import *
-
-async def api_w_watch_list(name = 'Test', do_type = 'watch_list', num = 1):
-    other_set = {}
-    other_set["name"] = name
-    other_set["do_type"] = do_type
-    other_set["num"] = str(num)
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 9
route/go_api_w_xref.py

@@ -1,9 +0,0 @@
-from .tool.func import *
-
-async def api_w_xref(name = 'Test', page = 1, xref_type = '1'):
-    other_set = {}
-    other_set["name"] = name
-    other_set["page"] = str(page)
-    other_set["do_type"] = xref_type
-
-    return flask.jsonify(await python_to_golang(sys._getframe().f_code.co_name, other_set))

+ 0 - 19
route/go_main_func_easter_egg.py

@@ -1,19 +0,0 @@
-from .tool.func import *
-
-async def main_func_easter_egg():
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        ip = ip_check()
-        if ip_or_user(ip) == 0:
-            curs.execute(db_change('select name from user_set where id = ? and name = ?'), [ip, 'get_🥚'])
-            if not curs.fetchall():
-                curs.execute(db_change('insert into user_set (name, id, data) values ("get_🥚", ?, "Y")'), [ip])
-    
-        data = ''
-
-        return easy_minify(conn, flask.render_template(skin_check(conn),
-            imp = ['Easter Egg', await wiki_set(), await wiki_custom(conn), wiki_css([0, 0])],
-            data = data,
-            menu = 0
-        ))

+ 0 - 32
route/tool/func.py

@@ -139,38 +139,6 @@ def global_some_set_do(set_name, data = None):
         return global_some_set[set_name]
     else:
         return None
-
-async def python_to_golang(func_name, other_set = {}):    
-    other_set = {
-        "url" : func_name,
-        "data" : json_dumps(other_set)
-    }
-
-    if flask.has_request_context():
-        other_set["session"] = json_dumps(dict(flask.session))
-
-        if "Cookie" in flask.request.headers:
-            other_set["cookie"] = flask.request.headers["Cookie"]
-        else:
-            other_set["cookie"] = ""
-
-        other_set["ip"] = ip_check()
-    else:
-        other_set["session"] = "{}"
-        other_set["cookie"] = ""
-        other_set["ip"] = "127.0.0.1"
-
-    port_data = global_some_set_do("setup_golang_port")
-
-    async with aiohttp.ClientSession() as session:
-        while 1:
-            async with session.post('http://localhost:' + port_data + '/', data = json_dumps(other_set)) as res:
-                data = await res.json()
-
-                if "response" in data and data["response"] == "error":
-                    raise Exception(f"API returned error: {data}")
-                else:
-                    return data
                 
 async def opennamu_make_list(left = '', right = '', bottom = '', class_name = ''):
     data_html = f'<span class="{class_name}">'