2
0
Эх сурвалжийг харах

전체 ACL 추가 및 일부 기능 Golang 이전 및 버그 수정

https://github.com/openNAMU/openNAMU/issues/2236
잉여개발기 (SPDV) 2 жил өмнө
parent
commit
b16ab1cdbb
41 өөрчлөгдсөн 412 нэмэгдсэн , 239 устгасан
  1. 4 3
      app.py
  2. 1 1
      route/__init__.py
  3. 1 1
      route/api_user_info.py
  4. 2 2
      route/bbs_w.py
  5. 4 4
      route/bbs_w_post.py
  6. 0 9
      route/go_api_bbs_set.py
  7. 7 0
      route/go_api_func_acl_list.py
  8. 18 2
      route/go_api_func_ip.py
  9. 3 1
      route/go_api_func_language.py
  10. 1 1
      route/list_admin.py
  11. 11 8
      route/list_admin_auth_use.py
  12. 1 1
      route/list_user.py
  13. 1 1
      route/n_bbs_main.py
  14. 1 1
      route/recent_change.py
  15. 1 1
      route/recent_record_topic.py
  16. 90 96
      route/tool/func.py
  17. 1 1
      route/topic_comment_tool.py
  18. 1 1
      route/user_alarm.py
  19. 1 1
      route/vote_end.py
  20. BIN
      route_go/bin/main.amd64.bin
  21. BIN
      route_go/bin/main.amd64.exe
  22. BIN
      route_go/bin/main.arm64.bin
  23. BIN
      route_go/bin/main.arm64.exe
  24. 4 0
      route_go/main.go
  25. 0 16
      route_go/route/api_bbs_set_update.go
  26. 20 0
      route_go/route/api_func_acl_list.go
  27. 2 1
      route_go/route/api_func_ip.go
  28. 1 0
      route_go/route/api_func_ip_menu.go
  29. 35 0
      route_go/route/api_func_ip_post.go
  30. 24 8
      route_go/route/api_func_language.go
  31. 4 3
      route_go/route/api_func_sha224.go
  32. 15 4
      route_go/route/api_setting.go
  33. 0 54
      route_go/route/api_setting_edit.go
  34. 64 0
      route_go/route/api_setting_put.go
  35. 9 0
      route_go/route/tool/acl.go
  36. 1 1
      version.json
  37. 76 16
      views/main_css/js/route/bbs_set.js
  38. 2 0
      views/main_css/js/route/edit_move_all.js
  39. 2 0
      views/main_css/js/route/list_user_check_submit.js
  40. 2 0
      views/main_css/js/route/main_sys_restart.js
  41. 2 1
      views/main_css/js/route/topic_list.js

+ 4 - 3
app.py

@@ -750,7 +750,6 @@ app.route('/api/v2/topic/<int:num>/<set_type>/<everything:name>')(api_topic_list
 
 app.route('/api/v2/bbs')(api_bbs_list)
 app.route('/api/v2/bbs/main')(api_bbs)
-app.route('/api/v2/bbs/set', methods = ['PUT'])(api_bbs_set)
 app.route('/api/v2/bbs/in/<int:bbs_num>/<int:page>')(api_bbs)
 app.route('/api/v2/bbs/w/comment/<int:bbs_num>/<int:post_num>/<tool>')(api_bbs_w_comment_n)
 
@@ -762,9 +761,11 @@ app.route('/api/v2/setting/<name>', methods = ['GET', 'PUT'])(api_setting)
 
 app.route('/api/v2/user/setting/editor', methods = ['GET', 'POST', 'DELETE'])(api_user_setting_editor)
 
-app.route('/api/v2/ip/<everything:data>')(api_func_ip)
-app.route('/api/v2/ip_menu/<everything:ip>', defaults = { 'option' : 'user' })(api_func_ip_menu)
+app.route('/api/v2/ip/<everything:data>', methods = ['GET', 'POST'])(api_func_ip)
+app.route('/api/v2/ip_menu/<everything:ip>', defaults = { 'option' : 'user' }, methods = ['GET', 'POST'])(api_func_ip_menu)
 app.route('/api/v2/user_menu/<everything:ip>')(api_func_ip_menu)
+app.route('/api/v2/acl_list/<data_type>')(api_func_acl_list)
+app.route('/api/v2/lang', defaults = { 'legacy' : '' }, methods = ['POST'])(api_func_language)
 
 # Func-main
 # 여기도 전반적인 조정 시행 예정

+ 1 - 1
route/__init__.py

@@ -186,6 +186,7 @@ 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_list import api_func_auth_list
+from route.go_api_func_acl_list import api_func_acl_list
 
 from route.go_api_search import api_search
 
@@ -197,7 +198,6 @@ from route.go_api_list_old_page import api_list_old_page
 from route.go_api_list_title_index import api_list_title_index
 
 from route.go_api_bbs import api_bbs
-from route.go_api_bbs_set import api_bbs_set
 from route.go_api_bbs_list import api_bbs_list
 from route.go_api_bbs_w_comment import api_bbs_w_comment_n
 

+ 1 - 1
route/api_user_info.py

@@ -7,7 +7,7 @@ def api_user_info(user_name = ''):
         data_result = {}
         
         # name part
-        data_result['render'] = ip_pas(conn, user_name)
+        data_result['render'] = ip_pas(user_name)
         
         # auth part
         curs.execute(db_change("select data from user_set where id = ? and name = 'acl'"), [user_name])

+ 2 - 2
route/bbs_w.py

@@ -150,7 +150,7 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
                     
                 data += '''
                     <tr>
-                        <td>''' + ip_pas(conn, temp_dict['comment_user_id']) + '''</td>
+                        <td>''' + ip_pas(temp_dict['comment_user_id']) + '''</td>
                         <td>''' + temp_dict['comment_date'] + '''</td>
                         <td>''' + ('#' + comment_link) + '''</td>
                     </tr>
@@ -172,7 +172,7 @@ def bbs_w(bbs_num = '', tool = 'bbs', page = 1, name = ''):
             
                 data += '''
                     <tr class="''' + ('opennamu_comment_color_red' if notice == 1 else '') + '''">
-                        <td>''' + ip_pas(conn, temp_dict['user_id']) + '''</td>
+                        <td>''' + ip_pas(temp_dict['user_id']) + '''</td>
                         <td>''' + temp_dict['date'] + '''</td>
                         <td>''' + last_comment_date + '''</td>
                     </tr>

+ 4 - 4
route/bbs_w_post.py

@@ -35,7 +35,7 @@ def bbs_w_post_comment(conn, user_id, sub_code, comment_num, bbs_num_str, post_n
 
             comment_data += '<span style="padding-left: 20px;"></span>' * margin_count
             comment_data += api_topic_thread_make(
-                ip_pas(conn, temp_dict['comment_user_id']),
+                ip_pas(temp_dict['comment_user_id']),
                 date,
                 render_set(conn, doc_data = temp_dict['comment']),
                 sub_code_check,
@@ -126,7 +126,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 data = ''
                 data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
                 data += api_topic_thread_make(
-                    ip_pas(conn, temp_dict['user_id']),
+                    ip_pas(temp_dict['user_id']),
                     date,
                     render_set(conn, doc_data = temp_dict['data'], data_type = 'thread'),
                     '0',
@@ -149,7 +149,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                     date += temp_dict['comment_date']
 
                     data += api_topic_thread_make(
-                        ip_pas(conn, temp_dict['comment_user_id']),
+                        ip_pas(temp_dict['comment_user_id']),
                         date,
                         render_set(conn, doc_data = temp_dict['comment'], data_type = 'thread'),
                         str(count),
@@ -246,7 +246,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
                 data = ''
                 data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
                 data += api_topic_thread_make(
-                    ip_pas(conn, temp_dict['user_id']),
+                    ip_pas(temp_dict['user_id']),
                     date,
                     render_set(conn, doc_data = temp_dict['data']),
                     '0',

+ 0 - 9
route/go_api_bbs_set.py

@@ -1,9 +0,0 @@
-from .tool.func import *
-
-async def api_bbs_set():
-    other_set = {}
-
-    func_name = sys._getframe().f_code.co_name
-    func_name += '_put'
-
-    return flask.Response(response = (await python_to_golang(func_name, other_set)), status = 200, mimetype = 'application/json')

+ 7 - 0
route/go_api_func_acl_list.py

@@ -0,0 +1,7 @@
+from .tool.func import *
+
+async def api_func_acl_list(data_type = ''):
+    other_set = {}
+    other_set = data_type
+
+    return flask.Response(response = (await python_to_golang(sys._getframe().f_code.co_name, other_set)), status = 200, mimetype = 'application/json')

+ 18 - 2
route/go_api_func_ip.py

@@ -2,7 +2,23 @@ from .tool.func import *
 
 async def api_func_ip(data = 'Test'):
     other_set = {}
-    other_set["data"] = data
     other_set["ip"] = ip_check()
 
-    return flask.Response(response = (await python_to_golang(sys._getframe().f_code.co_name, other_set)), status = 200, mimetype = 'application/json')
+    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.Response(response = (await python_to_golang(func_name, other_set)), status = 200, mimetype = 'application/json')

+ 3 - 1
route/go_api_func_language.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-async def api_func_language(data = 'Test'):
+async def api_func_language(legacy = 'on', data = 'Test'):
     other_set = {}
     if flask.request.method == 'POST':
         other_set["data"] = flask.request.form.get('data', '')
@@ -8,4 +8,6 @@ async def api_func_language(data = 'Test'):
     else:
         other_set["data"] = [data]
 
+    other_set["legacy"] = legacy
+
     return flask.Response(response = (await python_to_golang(sys._getframe().f_code.co_name, other_set)), status = 200, mimetype = 'application/json')

+ 1 - 1
route/list_admin.py

@@ -11,7 +11,7 @@ def list_admin():
         ))
         for data in curs.fetchall():
             name = '' + \
-                ip_pas(conn, data[0]) + ' ' + \
+                ip_pas(data[0]) + ' ' + \
                 '<a href="/auth/list/add/' + url_pas(data[1]) + '">(' + data[1] + ')</a>' + \
             ''
 

+ 11 - 8
route/list_admin_auth_use.py

@@ -22,14 +22,17 @@ def list_admin_auth_use(arg_num = 1, arg_search = 'normal'):
             for data in get_list:
                 do_data = data[1]
 
-                if ip_pas(conn, '127.0.0.1', 1) != '127.0.0.1': 
-                    do_data = do_data.split(' ')
-                    if do_data[0] in ('ban'):
-                        do_data = do_data[0]
-                    else:
-                        do_data = data[1]
-
-                list_data += '<li>' + ip_pas(conn, data[0]) + ' | ' + html.escape(do_data) + ' | ' + data[2] + '</li>'
+                if ip_or_user(data[0]) != 0:
+                    curs.execute(db_change("select data from other where name = 'ip_view'"))
+                    db_data = curs.fetchall()
+                    ip_view = db_data[0][0] if db_data else ''
+                    ip_view = '' if admin_check(conn, 1) == 1 else ip_view
+                    
+                    if ip_view != '':
+                        do_data = do_data.split(' ')
+                        do_data = do_data[0] if do_data[0] in ('ban') else data[1]
+
+                list_data += '<li>' + ip_pas(data[0]) + ' | ' + html.escape(do_data) + ' | ' + data[2] + '</li>'
 
             list_data += '</ul>'
             list_data += get_next_page_bottom(conn, '/list/admin/auth_use_page/{}/' + url_pas(arg_search), arg_num, get_list)

+ 1 - 1
route/list_user.py

@@ -13,7 +13,7 @@ def list_user(arg_num = 1):
         for data in user_list:
             list_data += '' + \
                 '<li>' + \
-                    ip_pas(conn, data[0]) + (' (' + data[1] + ')' if data[1] != '' else '') + \
+                    ip_pas(data[0]) + (' (' + data[1] + ')' if data[1] != '' else '') + \
                 '</li>' + \
             ''
 

+ 1 - 1
route/n_bbs_main.py

@@ -9,5 +9,5 @@ def bbs_main():
                 '<script defer src="/views/main_css/js/route/bbs_main.js' + cache_v() + '"></script>' + \
                 '<script>window.addEventListener("DOMContentLoaded", function() { opennamu_bbs_main(); });</script>' + \
             '',
-            menu = [['other', get_lang(conn, 'other_tool')]] + ([['bbs/make', get_lang(conn, 'add')]] if admin_check(conn) == 1 else [])
+            menu = [['other', get_lang(conn, 'other_tool')]] + ([['bbs/make', get_lang(conn, 'add')], ['bbs/set', get_lang(conn, 'bbs_set')]] if admin_check(conn) == 1 else [])
         ))

+ 1 - 1
route/recent_change.py

@@ -116,7 +116,7 @@ def recent_change(name = '', tool = '', num = 1, set_type = 'normal'):
 
             div += '</tr>'
 
-            all_ip = ip_pas(conn, [i[3] for i in data_list])
+            all_ip = ip_pas([i[3] for i in data_list])
             for data in data_list:
                 select += '<option value="' + data[0] + '">' + data[0] + '</option>'
                 send = data[4]

+ 1 - 1
route/recent_record_topic.py

@@ -16,7 +16,7 @@ def recent_record_topic(name = 'Test'):
                 </tr>
         '''
         sub = '(' + html.escape(name) + ')'
-        pas_name = ip_pas(conn, name)
+        pas_name = ip_pas(name)
 
         curs.execute(db_change("select code, id, date from topic where ip = ? order by date desc limit ?, 50"), [name, sql_num])
         data_list = curs.fetchall()

+ 90 - 96
route/tool/func.py

@@ -113,7 +113,7 @@ def do_db_set(db_set):
         for for_a in db_set:
             m_curs.execute('insert into temp (name, data) values (?, ?)', ['db_' + for_a, db_set[for_a]])
 
-async def python_to_golang(func_name, other_set = {}):
+def python_to_golang_sync(func_name, other_set = {}):
     if other_set == {}:
         other_set = '{}'
     else:
@@ -130,14 +130,57 @@ async def python_to_golang(func_name, other_set = {}):
         else:
             cmd = [os.path.join(".", "route_go", "bin", "main.arm64.exe"), func_name, other_set]
 
-    process = await asyncio.create_subprocess_exec(
-        *cmd,
-        stdout = asyncio.subprocess.PIPE,
+    process = subprocess.Popen(
+        cmd,
+        stdout = subprocess.PIPE,
         stderr = asyncio.subprocess.PIPE
     )
-
-    stdout, stderr = await process.communicate()
+    stdout, stderr = process.communicate()
+    
     data = stdout.decode('utf8')
+    err = stderr.decode('utf8')
+    if err != '':
+        print(err)
+
+    return data
+
+async def python_to_golang(func_name, other_set = {}):
+    if other_set == {}:
+        other_set = '{}'
+    else:
+        other_set = json.dumps(other_set)
+
+    if platform.system() == 'Linux':
+        if platform.machine() in ["AMD64", "x86_64"]:
+            cmd = [os.path.join(".", "route_go", "bin", "main.amd64.bin"), func_name, other_set]
+        else:
+            cmd = [os.path.join(".", "route_go", "bin", "main.arm64.bin"), func_name, other_set]
+    else:
+        if platform.machine() in ["AMD64", "x86_64"]:
+            cmd = [os.path.join(".", "route_go", "bin", "main.amd64.exe"), func_name, other_set]
+        else:
+            cmd = [os.path.join(".", "route_go", "bin", "main.arm64.exe"), func_name, other_set]
+
+    while 1:
+        try:
+            process = await asyncio.create_subprocess_exec(
+                *cmd,
+                stdout = asyncio.subprocess.PIPE,
+                stderr = asyncio.subprocess.PIPE
+            )
+            stdout, stderr = await process.communicate()
+
+            data = stdout.decode('utf8')
+            err = stderr.decode('utf8')
+            if err != '':
+                if 'database is locked' in err:
+                    raise
+                else:
+                    print(err)
+
+            break
+        except:
+            await asyncio.sleep(0.1)
 
     return data
 
@@ -855,11 +898,18 @@ def number_check(data, f = 0):
 def redirect(conn, data = '/'):
     return flask.redirect(load_domain(conn, 'full') + data)
     
-def get_acl_list(type_d = 'normal'):
-    if type_d == 'user':
-        return ['', 'user', 'all']
-    else:
-        return ['', 'all', 'user', 'admin', 'owner', '50_edit', 'email', 'ban', 'before', '30_day', '90_day', 'ban_admin', 'not_all', 'up_to_level_3', 'up_to_level_10']
+# Golang 의존
+def get_acl_list(type_data = 'normal'):
+    if type_data == 'user':
+        type_data = 'user_document'
+
+    other_set = {}
+    other_set['type'] = type_data
+
+    data_str = python_to_golang_sync('api_func_acl_list', other_set)
+    data = json.loads(data_str)
+
+    return data["data"]
 
 ## Func-simple-with_DB
 def get_user_title_list(conn, ip = ''):
@@ -1151,7 +1201,7 @@ def skin_check(conn, set_n = 0):
         return skin
     
 def cache_v():
-    return '.cache_v262'
+    return '.cache_v263'
 
 def wiki_css(data):
     with class_temp_db() as m_conn:
@@ -1971,9 +2021,11 @@ def acl_check(conn, name = '', tool = '', topic_num = ''):
             name = curs.fetchall()
             name = name[0][0] if name else 'test'
 
-    if tool in ['topic']:
+    if tool in ['bbs_edit', 'bbs_comment']:
+        end = 4
+    elif tool in ['topic']:
         end = 3
-    elif tool in ['render', 'vote', '', 'document_edit', 'document_edit_request', 'document_move', 'document_delete', 'document_edit', 'bbs_edit', 'bbs_comment']:
+    elif tool in ['render', 'vote', '', 'document_edit', 'document_edit_request', 'document_move', 'document_delete', 'document_edit', 'bbs_view']:
         end = 2
     else:
         end = 1
@@ -2054,19 +2106,30 @@ def acl_check(conn, name = '', tool = '', topic_num = ''):
         elif tool == 'bbs_edit':
             if i == 0:
                 curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_edit_acl" and set_id = ?'), [name])
-            else:
+            elif i == 1:
                 curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_acl" and set_id = ?'), [name])
+            elif i == 2:
+                curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_edit_acl_all" and set_id = ?'), [name])
+            else:
+                curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_acl_all" and set_id = ?'), [name])
 
             num = 'all'
         elif tool == 'bbs_comment':
             if i == 0:
                 curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_comment_acl" and set_id = ?'), [name])
-            else:
+            elif i == 1:
                 curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_acl" and set_id = ?'), [name])
+            elif i == 2:
+                curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_comment_acl_all" and set_id = ?'), [name])
+            else:
+                curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_acl_all" and set_id = ?'), [name])
 
             num = 'all'
         elif tool == 'bbs_view':
-            curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_view_acl" and set_id = ?'), [name])
+            if i == 0:
+                curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_view_acl" and set_id = ?'), [name])
+            else:
+                curs.execute(db_change('select set_data from bbs_set where set_name = "bbs_view_acl_all" and set_id = ?'), [name])
 
             num = 'all'
         elif tool == 'recaptcha':
@@ -2263,12 +2326,10 @@ def ban_check(conn, ip = None, tool = ''):
 
     return [0, '']
 
-def ip_pas(conn, raw_ip, type_data = 0):
-    curs = conn.cursor()
-
-    end_ip = {}
-    my_ip = ip_check()
-
+def ip_pas(raw_ip):
+    other_set = {}
+    other_set["ip"] = ip_check()
+    
     return_data = 0
     if type(raw_ip) != type([]):
         get_ip = [raw_ip]
@@ -2276,83 +2337,16 @@ def ip_pas(conn, raw_ip, type_data = 0):
     else:
         get_ip = raw_ip
 
-    admin_auth = admin_check(conn, 1)
-
-    curs.execute(db_change("select data from other where name = 'ip_view'"))
-    db_data = curs.fetchall()
-    ip_view = db_data[0][0] if db_data else ''
-    ip_view = '' if admin_auth == 1 else ip_view
-
-    curs.execute(db_change("select data from other where name = 'user_name_view'"))
-    db_data = curs.fetchall()
-    user_name_view = db_data[0][0] if db_data else ''
-    user_name_view = '' if admin_auth == 1 else user_name_view
-    
-    get_ip = list(set(get_ip))
-    
-    for raw_ip in get_ip:
-        if re.search(r"^tool:", raw_ip):
-            end_ip[raw_ip] = raw_ip
-
-            continue
-
-        change_ip = 0
-        is_this_ip = ip_or_user(raw_ip)
-        if is_this_ip != 0:
-            # ip user
-            if ip_view != '' and my_ip != raw_ip:
-                ip = pw_encode(conn, raw_ip)[:10]
-
-                change_ip = 1
-            else:
-                ip = raw_ip
-        else:
-            # not ip user
-            if user_name_view != '':
-                curs.execute(db_change("select data from user_set where id = ? and name = 'sub_user_name'"), [raw_ip])
-                db_data = curs.fetchall()
-                if db_data and db_data[0][0] != '':
-                    ip = db_data[0][0]
-                else:
-                    ip = get_lang(conn, 'member')
-
-                change_ip = 1
-            else:
-                curs.execute(db_change('select data from user_set where name = "user_name" and id = ?'), [raw_ip])
-                db_data = curs.fetchall()
-                ip = db_data[0][0] if db_data and db_data[0][0] != '' else raw_ip
-            
-        if type_data == 0 and change_ip == 0:
-            if is_this_ip == 0:
-                curs.execute(db_change("select data from other where name = 'user_name_level'"))
-                db_data = curs.fetchall()
-                if db_data and db_data[0][0] != '':
-                    level_data = level_check(conn, raw_ip)
-
-                    ip += '<sup>' + level_data[0] + '</sup>'
-
-                ip = '<a href="/w/' + url_pas('user:' + raw_ip) + '">' + ip + '</a>'
-                
-                if admin_check(conn, 'all', None, raw_ip) == 1:
-                    ip = '<b>' + ip + '</b>'
-
-                curs.execute(db_change('select data from user_set where name = "user_title" and id = ?'), [raw_ip])
-                db_data = curs.fetchall()
-                if db_data:
-                    ip = db_data[0][0] + ip
+    for for_a in range(1, len(get_ip) + 1):
+        other_set["data_" + str(for_a)] = get_ip[for_a - 1]
 
-            ban = ban_check(conn, raw_ip)
-            if ban[0] == 1:
-                ip = '<sup>' + ban[1] + '</sup><s>' + ip + '</s>'
+    data_str = python_to_golang_sync('api_func_ip_post', other_set)
+    data = json.loads(data_str)
 
-            ip = ip + ' <a href="/user/' + url_pas(raw_ip) + '">(' + get_lang(conn, 'tool') + ')</a>'
-
-        end_ip[raw_ip] = ip
-    
     if return_data == 1:
-        return end_ip[raw_ip]
+        return data["data"][raw_ip]
     else:
-        return end_ip
+        return data["data"]
         
 # Func-edit
 def get_edit_text_bottom(conn) :

+ 1 - 1
route/topic_comment_tool.py

@@ -18,7 +18,7 @@ def topic_comment_tool(topic_num = 1, num = 1):
         ban = '''
             <h2>''' + get_lang(conn, 'state') + '''</h2>
             <ul class="opennamu_ul">
-                <li>''' + get_lang(conn, 'writer') + ' : ''' + ip_pas(conn, data[0][1]) + '''</li>
+                <li>''' + get_lang(conn, 'writer') + ' : ''' + ip_pas(data[0][1]) + '''</li>
                 <li>''' + get_lang(conn, 'time') + ' : ' + data[0][2] + '''</li>
             </ul>
             <h2>''' + get_lang(conn, 'other_tool') + '''</h2>

+ 1 - 1
route/user_alarm.py

@@ -28,7 +28,7 @@ def user_alarm():
                 
                 data += '' + \
                     '<li style="' + data_style + '">' + \
-                        ip_pas(conn, data_split[0]) + (' | ' + ' | '.join(data_split[1:]) if len(data_split) > 1 else '') + \
+                        ip_pas(data_split[0]) + (' | ' + ' | '.join(data_split[1:]) if len(data_split) > 1 else '') + \
                         ' | ' + data_one[1] + \
                         ' <a href="/alarm/delete/' + url_pas(data_one[3]) + '">(' + get_lang(conn, 'delete') + ')</a>' + \
                     '</li>' + \

+ 1 - 1
route/vote_end.py

@@ -35,7 +35,7 @@ def vote_end(num = 1):
             curs.execute(db_change('select user from vote where id = ? and user != "" and data = ?'), [num, str(i)])
             data_list_2 = curs.fetchall()
             if data_list[0][3] == 'open' or data_list[0][3] == 'close':
-                all_ip = ip_pas(conn, [j[0] for j in data_list_2])
+                all_ip = ip_pas([j[0] for j in data_list_2])
                 for j in data_list_2:
                     data += '<li>' + all_ip[j[0]] + '</li>'
 

BIN
route_go/bin/main.amd64.bin


BIN
route_go/bin/main.amd64.exe


BIN
route_go/bin/main.arm64.bin


BIN
route_go/bin/main.arm64.exe


+ 4 - 0
route_go/main.go

@@ -77,6 +77,10 @@ func main() {
 		route_data = route.Api_setting_put(call_arg[1:])
 	} else if call_arg[0] == "api_func_ip_menu" {
 		route_data = route.Api_func_ip_menu(call_arg[1:])
+	} else if call_arg[0] == "api_func_ip_post" {
+		route_data = route.Api_func_ip_post(call_arg[1:])
+	} else if call_arg[0] == "api_func_acl_list" {
+		route_data = route.Api_func_acl_list(call_arg[1:])
 	} else {
 		log.Fatal(call_arg[0] + " is 404")
 	}

+ 0 - 16
route_go/route/api_bbs_set_update.go

@@ -1,16 +0,0 @@
-package route
-
-import (
-	"encoding/json"
-	"opennamu/route/tool"
-)
-
-func Api_bbs_set_update(call_arg []string) string {
-	other_set := map[string]string{}
-	json.Unmarshal([]byte(call_arg[0]), &other_set)
-
-	db := tool.DB_connect()
-	defer db.Close()
-
-	return ""
-}

+ 20 - 0
route_go/route/api_func_acl_list.go

@@ -0,0 +1,20 @@
+package route
+
+import (
+	"encoding/json"
+	"opennamu/route/tool"
+)
+
+func Api_func_acl_list(call_arg []string) string {
+	other_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[0]), &other_set)
+
+	data := tool.List_acl(other_set["type"])
+
+	return_data := make(map[string]interface{})
+	return_data["response"] = "ok"
+	return_data["data"] = data
+
+	json_data, _ := json.Marshal(return_data)
+	return string(json_data)
+}

+ 2 - 1
route_go/route/api_func_ip.go

@@ -15,7 +15,8 @@ func Api_func_ip(call_arg []string) string {
 
 	ip_data := tool.IP_parser(db, other_set["data"], other_set["ip"])
 
-	new_data := map[string]string{}
+	new_data := make(map[string]interface{})
+	new_data["response"] = "ok"
 	new_data["data"] = ip_data
 
 	json_data, _ := json.Marshal(new_data)

+ 1 - 0
route_go/route/api_func_ip_menu.go

@@ -16,6 +16,7 @@ func Api_func_ip_menu(call_arg []string) string {
 	ip_data := tool.IP_menu(db, other_set["ip"], other_set["my_ip"], other_set["option"])
 
 	new_data := make(map[string]interface{})
+	new_data["response"] = "ok"
 	new_data["data"] = ip_data
 
 	json_data, _ := json.Marshal(new_data)

+ 35 - 0
route_go/route/api_func_ip_post.go

@@ -0,0 +1,35 @@
+package route
+
+import (
+	"encoding/json"
+	"strconv"
+
+	"opennamu/route/tool"
+)
+
+func Api_func_ip_post(call_arg []string) string {
+	other_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[0]), &other_set)
+
+	db := tool.DB_connect()
+	defer db.Close()
+
+	ip_data := map[string]string{}
+
+	for for_a := 1; ; for_a++ {
+		for_a_str := strconv.Itoa(for_a)
+
+		if val, ok := other_set["data_"+for_a_str]; ok {
+			ip_data[val] = tool.IP_parser(db, val, other_set["ip"])
+		} else {
+			break
+		}
+	}
+
+	new_data := make(map[string]interface{})
+	new_data["response"] = "ok"
+	new_data["data"] = ip_data
+
+	json_data, _ := json.Marshal(new_data)
+	return string(json_data)
+}

+ 24 - 8
route_go/route/api_func_language.go

@@ -12,15 +12,31 @@ func Api_func_language(call_arg []string) string {
 	db := tool.DB_connect()
 	defer db.Close()
 
-	data_list := map[string][]string{}
-	data_list["data"] = []string{}
-
 	temp_list := other_set["data"].([]interface{})
 
-	for for_a := 0; for_a < len(temp_list); for_a++ {
-		data_list["data"] = append(data_list["data"], tool.Get_language(db, temp_list[for_a].(string), false))
-	}
+	if other_set["legacy"] != "" {
+		data_list := map[string][]string{}
+		data_list["data"] = []string{}
+
+		for for_a := 0; for_a < len(temp_list); for_a++ {
+			data_list["data"] = append(data_list["data"], tool.Get_language(db, temp_list[for_a].(string), false))
+		}
+
+		json_data, _ := json.Marshal(data_list)
+		return string(json_data)
+	} else {
+		new_data := make(map[string]interface{})
+		new_data["response"] = "ok"
 
-	json_data, _ := json.Marshal(data_list)
-	return string(json_data)
+		data_list := map[string]string{}
+
+		for for_a := 0; for_a < len(temp_list); for_a++ {
+			data_list[temp_list[for_a].(string)] = tool.Get_language(db, temp_list[for_a].(string), false)
+		}
+
+		new_data["data"] = data_list
+
+		json_data, _ := json.Marshal(new_data)
+		return string(json_data)
+	}
 }

+ 4 - 3
route_go/route/api_func_sha224.go

@@ -12,9 +12,10 @@ func Api_func_sha224(call_arg []string) string {
 
 	hash_str := tool.Sha224(other_set["data"])
 
-	new_data := map[string]string{}
-	new_data["data"] = hash_str
+	return_data := make(map[string]interface{})
+	return_data["response"] = "ok"
+	return_data["data"] = hash_str
 
-	json_data, _ := json.Marshal(new_data)
+	json_data, _ := json.Marshal(return_data)
 	return string(json_data)
 }

+ 15 - 4
route_go/route/api_setting.go

@@ -7,6 +7,20 @@ import (
 	"opennamu/route/tool"
 )
 
+func Setting_list() map[string]string {
+	setting_acl := map[string]string{}
+
+	setting_acl["manage_404_page"] = ""
+	setting_acl["manage_404_page_content"] = ""
+
+	setting_acl["bbs_view_acl_all"] = ""
+	setting_acl["bbs_acl_all"] = ""
+	setting_acl["bbs_edit_acl_all"] = ""
+	setting_acl["bbs_comment_acl_all"] = ""
+
+	return setting_acl
+}
+
 func Api_setting(call_arg []string) string {
 	other_set := map[string]string{}
 	json.Unmarshal([]byte(call_arg[0]), &other_set)
@@ -14,10 +28,7 @@ func Api_setting(call_arg []string) string {
 	db := tool.DB_connect()
 	defer db.Close()
 
-	setting_acl := map[string]string{}
-
-	setting_acl["manage_404_page"] = ""
-	setting_acl["manage_404_page_content"] = ""
+	setting_acl := Setting_list()
 
 	if val, ok := setting_acl[other_set["set_name"]]; ok {
 		if val != "" {

+ 0 - 54
route_go/route/api_setting_edit.go

@@ -1,54 +0,0 @@
-package route
-
-import (
-	"encoding/json"
-	"log"
-	"opennamu/route/tool"
-)
-
-func Api_setting_put(call_arg []string) string {
-	other_set := map[string]string{}
-	json.Unmarshal([]byte(call_arg[0]), &other_set)
-
-	db := tool.DB_connect()
-	defer db.Close()
-
-	auth_name := tool.Get_user_auth(db, other_set["ip"])
-	auth_info := tool.Get_auth_group_info(db, auth_name)
-
-	if _, ok := auth_info["owner"]; ok {
-		stmt, err := db.Prepare(tool.DB_change("delete from other where name = ?"))
-		if err != nil {
-			log.Fatal(err)
-		}
-		defer stmt.Close()
-
-		_, err = stmt.Exec(other_set["set_name"])
-		if err != nil {
-			log.Fatal(err)
-		}
-
-		stmt, err = db.Prepare(tool.DB_change("insert into other (name, data, coverage) values (?, ?, '')"))
-		if err != nil {
-			log.Fatal(err)
-		}
-		defer stmt.Close()
-
-		_, err = stmt.Exec(other_set["set_name"], other_set["data"])
-		if err != nil {
-			log.Fatal(err)
-		}
-
-		return_data := make(map[string]interface{})
-		return_data["response"] = "ok"
-
-		json_data, _ := json.Marshal(return_data)
-		return string(json_data)
-	} else {
-		return_data := make(map[string]interface{})
-		return_data["response"] = "require auth"
-
-		json_data, _ := json.Marshal(return_data)
-		return string(json_data)
-	}
-}

+ 64 - 0
route_go/route/api_setting_put.go

@@ -0,0 +1,64 @@
+package route
+
+import (
+	"encoding/json"
+	"log"
+	"opennamu/route/tool"
+)
+
+func Api_setting_put(call_arg []string) string {
+	other_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[0]), &other_set)
+
+	db := tool.DB_connect()
+	defer db.Close()
+
+	auth_name := tool.Get_user_auth(db, other_set["ip"])
+	auth_info := tool.Get_auth_group_info(db, auth_name)
+
+	setting_acl := Setting_list()
+
+	if _, ok := setting_acl[other_set["set_name"]]; ok {
+		if _, ok := auth_info["owner"]; ok {
+			stmt, err := db.Prepare(tool.DB_change("delete from other where name = ?"))
+			if err != nil {
+				log.Fatal(err)
+			}
+			defer stmt.Close()
+
+			_, err = stmt.Exec(other_set["set_name"])
+			if err != nil {
+				log.Fatal(err)
+			}
+
+			stmt, err = db.Prepare(tool.DB_change("insert into other (name, data, coverage) values (?, ?, '')"))
+			if err != nil {
+				log.Fatal(err)
+			}
+			defer stmt.Close()
+
+			_, err = stmt.Exec(other_set["set_name"], other_set["data"])
+			if err != nil {
+				log.Fatal(err)
+			}
+
+			return_data := make(map[string]interface{})
+			return_data["response"] = "ok"
+
+			json_data, _ := json.Marshal(return_data)
+			return string(json_data)
+		} else {
+			return_data := make(map[string]interface{})
+			return_data["response"] = "require auth"
+
+			json_data, _ := json.Marshal(return_data)
+			return string(json_data)
+		}
+	} else {
+		return_data := make(map[string]interface{})
+		return_data["response"] = "not exist"
+
+		json_data, _ := json.Marshal(return_data)
+		return string(json_data)
+	}
+}

+ 9 - 0
route_go/route/tool/acl.go

@@ -0,0 +1,9 @@
+package tool
+
+func List_acl(func_type string) []string {
+	if func_type == "user_document" {
+		return []string{"", "user", "all"}
+	} else {
+		return []string{"", "all", "user", "admin", "owner", "50_edit", "email", "ban", "before", "30_day", "90_day", "ban_admin", "not_all", "up_to_level_3", "up_to_level_10"}
+	}
+}

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.5.0-v143",
+        "r_ver" : "v3.5.0-v144",
         "c_ver" : "20240513",
         "s_ver" : "20240426"
     }

+ 76 - 16
views/main_css/js/route/bbs_set.js

@@ -1,31 +1,91 @@
-function opennamu_bbs_set_post() {
-    let post_data = new FormData();
-    post_data.append('data', '');
+"use strict";
 
-    fetch('/api/v2/bbs/set', {
-        method : 'put',
-        body : post_data,
-    }).then(function(res) {
-        return res.json();
-    }).then(function(data) {
+function opennamu_bbs_set_post() {
+    let acl_set_list = [
+        "bbs_view_acl_all",
+        "bbs_acl_all",
+        "bbs_edit_acl_all",
+        "bbs_comment_acl_all"
+    ];
 
-    });
+    for(let for_a = 0; for_a < acl_set_list.length; for_a++) {
+        let post_data = new FormData();
+        post_data.append('data', document.getElementById('opennamu_' + acl_set_list[for_a]).value);
+        
+        fetch('/api/v2/setting/' + acl_set_list[for_a], {
+            method : 'put',
+            body : post_data,
+        }).then(function(res) {
+            return res.json();
+        }).then(function(data) {
+            history.go(0);
+        });
+    }
 }
 
 function opennamu_bbs_set() {
+    let acl_set_list = [
+        "bbs_view_acl_all",
+        "bbs_acl_all",
+        "bbs_edit_acl_all",
+        "bbs_comment_acl_all"
+    ];
+    
+    let lang_str = 'save';
+    for(let for_a = 0; for_a < acl_set_list.length; for_a++) {
+        lang_str += ' ' + acl_set_list[for_a];
+    }
+
     let lang_data = new FormData();
-    lang_data.append('data', 'title_start_document title_end_document title_include_document move document_name');
+    lang_data.append('data', lang_str);
 
-    fetch('/api/lang', {
+    fetch('/api/v2/lang', {
         method : 'post',
         body : lang_data,
     }).then(function(res) {
         return res.json();
     }).then(function(lang) {
         lang = lang["data"];
-    
-        document.getElementById('opennamu_bbs_set').innerHTML = '' +
-            '<button onclick="opennamu_bbs_set_post();"></button>' +
-        '';
+
+        fetch('/api/v2/acl_list/normal').then(function(res) {
+            return res.json();
+        }).then(function(acl_list) {
+            acl_list = acl_list["data"];
+
+            let acl_set_html = '';
+
+            for(let for_b = 0; for_b < acl_set_list.length; for_b++) {
+                acl_set_html += '<h2>' + lang[acl_set_list[for_b]] + '</h2>';
+                acl_set_html += '<select id="opennamu_' + acl_set_list[for_b] + '">';
+                
+                let select = '';
+                for(let for_a = 0; for_a < acl_list.length; for_a++) {
+                    let acl_list_view = acl_list[for_a];
+                    acl_list_view = acl_list_view == "" ? "normal" : acl_list_view;
+
+                    select += '<option value="' + acl_list[for_a] + '">' + acl_list_view + '</option>';
+                }
+
+                acl_set_html += select;
+                acl_set_html += '</select>';
+            }
+
+            document.getElementById('opennamu_bbs_set').innerHTML = '' +
+                acl_set_html +
+                '<hr class="main_hr">' + 
+                '<button onclick="opennamu_bbs_set_post();">' + lang['save'] + '</button>' +
+            '';
+
+            for(let for_a = 0; for_a < acl_set_list.length; for_a++) {
+                fetch('/api/v2/setting/' + acl_set_list[for_a]).then(function(res) {
+                    return res.json();
+                }).then(function(data) {
+                    data = data["data"];
+
+                    let select_element = document.getElementById('opennamu_' + acl_set_list[for_a]);
+                    select_element.querySelector('option[value="' + data + '"]').selected = true;
+                });
+            }
+        });
     });
 }

+ 2 - 0
views/main_css/js/route/edit_move_all.js

@@ -1,3 +1,5 @@
+"use strict";
+
 function opennamu_edit_move_all() {
     let lang_data = new FormData();
     lang_data.append('data', 'title_start_document title_end_document title_include_document move document_name');

+ 2 - 0
views/main_css/js/route/list_user_check_submit.js

@@ -1,3 +1,5 @@
+"use strict";
+
 function opennamu_list_user_check_submit_post() {
     window.location.pathname = window.location.pathname.replace('/check_submit/', '/check/');
 }

+ 2 - 0
views/main_css/js/route/main_sys_restart.js

@@ -1,3 +1,5 @@
+"use strict";
+
 function opennamu_main_sys_restart() {
     let lang_data = new FormData();
     lang_data.append('data', 'restart');

+ 2 - 1
views/main_css/js/route/topic_list.js

@@ -1,3 +1,5 @@
+"use strict";
+
 function opennamu_topic_list() {
     const url = window.location.pathname;
     const url_split = url.split('/');
@@ -8,7 +10,6 @@ function opennamu_topic_list() {
     } else {
         num = url_split[2];
     }
-
     
     let doc_name;
     if(url_split[1] === 'topic') {