Browse Source

임시 저장

잉여개발기 1 year ago
parent
commit
eaeb96e940

+ 10 - 6
app.py

@@ -478,7 +478,8 @@ app.route('/list/user/check/delete/<name>/<ip>/<time>/<do_type>', methods = ['PO
 
 # Func-auth
 app.route('/auth/give', methods = ['POST', 'GET'])(give_auth)
-app.route('/auth/give/<name>', methods = ['POST', 'GET'])(give_auth)
+app.route('/auth/give_total', methods = ['POST', 'GET'])(give_auth)
+app.route('/auth/give/<user_name>', methods = ['POST', 'GET'])(give_auth)
 
 app.route('/auth/ban', methods = ['POST', 'GET'])(give_user_ban)
 app.route('/auth/ban/multiple', methods = ['POST', 'GET'], defaults = { 'ban_type' : 'multiple' })(give_user_ban)
@@ -739,10 +740,10 @@ app.route('/api/thread/<int:topic_num>/<int:s_num>/<int:e_num>')(api_topic)
 app.route('/api/thread/<int:topic_num>/<tool>')(api_topic)
 app.route('/api/thread/<int:topic_num>')(api_topic)
 
-app.route('/api/search/<everything:name>')(api_search)
-app.route('/api/search_page/<int:num>/<everything:name>')(api_search)
-app.route('/api/search_data/<everything:name>', defaults = { 'search_type' : 'data' })(api_search)
-app.route('/api/search_data_page/<int:num>/<everything:name>', defaults = { 'search_type' : 'data' })(api_search)
+app.route('/api/search/<everything:name>')(api_func_search)
+app.route('/api/search_page/<int:num>/<everything:name>')(api_func_search)
+app.route('/api/search_data/<everything:name>', defaults = { 'search_type' : 'data' })(api_func_search)
+app.route('/api/search_data_page/<int:num>/<everything:name>', defaults = { 'search_type' : 'data' })(api_func_search)
 
 app.route('/api/recent_change')(api_list_recent_change)
 app.route('/api/recent_changes')(api_list_recent_change)
@@ -772,6 +773,8 @@ app.route('/api/v2/recent_block/<set_type>/<int:num>/<user_name>')(api_list_rece
 app.route('/api/v2/list/document/old/<int:num>', defaults = { 'set_type' : 'old' })(api_list_old_page)
 app.route('/api/v2/list/document/new/<int:num>', defaults = { 'set_type' : 'new' })(api_list_old_page)
 app.route('/api/v2/list/document/<int:num>')(api_list_title_index)
+app.route('/api/v2/list/auth')(api_list_auth)
+app.route('/api/v2/list/acl/<data_type>')(api_list_acl)
 
 app.route('/api/v2/topic/<int:num>/<set_type>/<everything:name>')(api_topic_list)
 
@@ -786,13 +789,14 @@ app.route('/api/v2/set_reset/<everything:name>')(api_w_set_reset)
 
 app.route('/api/v2/setting/<name>', methods = ['GET', 'PUT'])(api_setting)
 
+app.route('/api/v2/auth/give', methods = ['PATCH'])(api_give_auth)
+
 app.route('/api/v2/user/rankup', methods = ['GET', 'PATCH'])(api_user_rankup)
 app.route('/api/v2/user/setting/editor', methods = ['GET', 'POST', 'DELETE'])(api_user_setting_editor)
 
 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

+ 7 - 3
route/__init__.py

@@ -35,7 +35,6 @@ from route.filter_all_add import filter_all_add
 from route.filter_all_delete import filter_all_delete
 
 from route.give_admin_groups import give_admin_groups
-from route.give_auth import give_auth
 from route.give_delete_admin_group import give_delete_admin_group_2
 from route.give_user_ban import give_user_ban
 from route.give_user_fix import give_user_fix
@@ -165,6 +164,8 @@ from route.n_list_recent_discuss import list_recent_discuss
 from route.n_list_recent_block import list_recent_block
 from route.n_list_old_page import list_old_page
 from route.n_list_user_check_submit import list_user_check_submit
+from route.go_api_list_acl import api_list_acl
+from route.go_api_list_auth import api_list_auth
 
 from route.n_bbs_in import bbs_in
 from route.n_bbs_set import bbs_set
@@ -175,6 +176,8 @@ from route.n_user_rankup import user_rankup
 
 from route.n_topic_list import topic_list
 
+from route.n_give_auth import give_auth
+
 from route.n_setting_404_page import setting_404_page
 
 from route.n_bbs_main import bbs_main
@@ -187,9 +190,10 @@ 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_acl_list import api_func_acl_list
 
-from route.go_api_search import api_search
+from route.go_api_func_search import api_func_search
+
+from route.go_api_give_auth import api_give_auth
 
 from route.go_api_list_recent_change import api_list_recent_change
 from route.go_api_list_recent_discuss import api_list_recent_discuss

+ 0 - 89
route/give_auth.py

@@ -1,89 +0,0 @@
-from .tool.func import *
-
-def give_auth(name):
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        ip = ip_check()
-        
-        owner_auth = acl_check(tool = 'owner_auth')
-        owner_auth = 1 if owner_auth == 0 else 0
-
-        admin_auth = acl_check(tool = 'give_auth')
-        admin_auth = 1 if admin_auth == 0 else 0
-
-        curs.execute(db_change("select data from user_set where id = ? and name = 'acl'"), [name])
-        user_acl = curs.fetchall()
-        if not user_acl:
-            return re_error(conn, '/error/2')
-        else:
-            user_acl = user_acl[0][0]
-
-        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(conn, '/error/3')
-
-            if ip == name:
-                return re_error(conn, '/error/3')
-
-        if flask.request.method == 'POST':
-            if acl_check(tool = 'give_auth', memo = 'admin (' + name + ')') == 1:
-                return re_error(conn, '/error/3')
-
-            select_data = flask.request.form.get('select', 'X')
-            if select_data == 'X':
-                select_data = 'user'
-
-            curs.execute(db_change('select name from alist where name = ? and acl = "owner"'), [select_data])
-            if owner_auth != 1 and curs.fetchall():
-                return re_error(conn, '/error/3')
-
-            curs.execute(db_change("update user_set set data = ? where id = ? and name = 'acl'"), [select_data, name])
-            curs.execute(db_change('delete from user_set where name = "auth_date" and id = ?'), [name])
-
-            time_limit = flask.request.form.get('date', '')
-            if re.search(r'^[0-9]{4}-[0-9]{2}-[0-9]{2}$', time_limit):
-                curs.execute(db_change("insert into user_set (id, name, data) values (?, 'auth_date', ?)"), [name, time_limit])
-            else:
-                time_limit = ''
-
-            add_alarm(conn, name, ip, 'Auth change to ' + select_data + (' (' + time_limit + ')' if time_limit != '' else ''))
-
-            return redirect(conn, '/auth/give/' + url_pas(name))
-        else:
-            if admin_auth != 1:
-                return re_error(conn, '/error/3')
-
-            div = '<option value="X">' + get_lang(conn, 'normal') + '</option>'
-            div += '<option value="ban">' + get_lang(conn, 'ban') + '</option>'
-
-            curs.execute(db_change('select distinct name from alist order by name asc'))
-            for data in curs.fetchall():
-                if user_acl == data[0]:
-                    div = '<option value="' + data[0] + '">' + data[0] + '</option>' + div
-                else:
-                    div += '<option value="' + data[0] + '">' + data[0] + '</option>'
-                    
-            date_value = ''
-            
-            curs.execute(db_change('select data from user_set where name = "auth_date" and id = ?'), [name])
-            db_data = curs.fetchall()
-            if db_data:
-                date_value = db_data[0][0]
-
-            return easy_minify(conn, flask.render_template(skin_check(conn),
-                imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'authorize') + ')', 0])],
-                data =  '''
-                    <form method="post">
-                        <div id="opennamu_get_user_info">''' + html.escape(name) + '''</div>
-                        <hr class="main_hr">
-                        <select name="select">''' + div + '''</select>
-                        <hr class="main_hr">
-                        <input type="date" value="''' + date_value + '''" name="date" pattern="\\d{4}-\\d{2}-\\d{2}">
-                        <hr class="main_hr">
-                        <button type="submit">''' + get_lang(conn, 'save') + '''</button>
-                    </form>
-                ''',
-                menu = [['manager', get_lang(conn, 'return')]]
-            ))

+ 1 - 1
route/go_api_search.py → route/go_api_func_search.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-async def api_search(name = 'Test', search_type = 'title', num = 1):
+async def api_func_search(name = 'Test', search_type = 'title', num = 1):
     other_set = {}
     other_set["name"] = name
     other_set["search_type"] = search_type

+ 16 - 0
route/go_api_give_auth.py

@@ -0,0 +1,16 @@
+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["ip"] = ip_check()
+        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.Response(response = (await python_to_golang(func_name, other_set)), status = 200, mimetype = 'application/json')
+    else:
+        return flask.jsonify({}) 

+ 1 - 1
route/go_api_func_acl_list.py → route/go_api_list_acl.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-async def api_func_acl_list(data_type = ''):
+async def api_list_acl(data_type = ''):
     other_set = {}
     other_set = data_type
 

+ 6 - 0
route/go_api_list_auth.py

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

+ 6 - 9
route/go_api_w_raw.py

@@ -1,13 +1,10 @@
 from .tool.func import *
 
 async def api_w_raw(name = 'Test', rev = '', exist_check = ''):
-    with get_db_connect() as conn:
-        if acl_check(name, 'render') != 1:
-            other_set = {}
-            other_set["name"] = name
-            other_set["rev"] = str(rev)
-            other_set["exist_check"] = exist_check
+    other_set = {}
+    other_set["name"] = name
+    other_set["rev"] = str(rev)
+    other_set["exist_check"] = exist_check
+    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')
-        else:
-            return flask.jsonify({})
+    return flask.Response(response = (await python_to_golang(sys._getframe().f_code.co_name, other_set)), status = 200, mimetype = 'application/json')

+ 2 - 2
route/main_search_deep.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-from .go_api_search import api_search
+from .go_api_func_search import api_func_search
 
 async def main_search_deep(name = 'Test', search_type = 'title', num = 1):
     with get_db_connect() as conn:
@@ -51,7 +51,7 @@ async def main_search_deep(name = 'Test', search_type = 'title', num = 1):
                 <ul>
             '''
 
-            all_list = orjson.loads((await api_search(name, search_type, num)).get_data(as_text = True))
+            all_list = orjson.loads((await api_func_search(name, search_type, num)).get_data(as_text = True))
             for data in all_list:
                 div += '<li><a href="/w/' + url_pas(data) + '">' + data + '</a></li>'
 

+ 19 - 0
route/n_give_auth.py

@@ -0,0 +1,19 @@
+from .tool.func import *
+
+def give_auth(user_name = ''):
+    with get_db_connect() as conn:
+        if user_name == '':
+            user_name = get_lang(conn, 'authorize')
+            sub = 0
+        else:
+            sub = '(' + get_lang(conn, 'authorize') + ')'
+
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [user_name, wiki_set(conn), wiki_custom(conn), wiki_css([sub, 0])],
+            data = '' + \
+                '<div id="opennamu_give_auth"></div>' + \
+                '<script defer src="/views/main_css/js/route/give_auth.js' + cache_v() + '"></script>' + \
+                '<script>window.addEventListener("DOMContentLoaded", function() { opennamu_give_auth(); });</script>' + \
+            '',
+            menu = [['manager', get_lang(conn, 'return')]]
+        ))

+ 1 - 1
route/tool/func.py

@@ -946,7 +946,7 @@ def get_acl_list(type_data = 'normal'):
     other_set = {}
     other_set['type'] = type_data
 
-    data_str = python_to_golang_sync('api_func_acl_list', other_set)
+    data_str = python_to_golang_sync('api_list_acl', other_set)
     data = orjson.loads(data_str)
 
     return data["data"]

BIN
route_go/bin/main.amd64.exe


+ 8 - 4
route_go/main.go

@@ -21,8 +21,8 @@ func main() {
 		route_data = route.Api_func_sha224(call_arg[1:])
 	} else if call_arg[0] == "api_w_random" {
 		route_data = route.Api_w_random(call_arg[1:])
-	} else if call_arg[0] == "api_search" {
-		route_data = route.Api_search(call_arg[1:])
+	} else if call_arg[0] == "api_func_search" {
+		route_data = route.Api_func_search(call_arg[1:])
 	} else if call_arg[0] == "api_topic" {
 		route_data = route.Api_topic(call_arg[1:])
 	} else if call_arg[0] == "api_func_ip" {
@@ -79,8 +79,8 @@ func main() {
 		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 if call_arg[0] == "api_list_acl" {
+		route_data = route.Api_list_acl(call_arg[1:])
 	} else if call_arg[0] == "api_user_rankup" {
 		route_data = route.Api_user_rankup(call_arg[1:])
 	} else if call_arg[0] == "api_func_acl" {
@@ -89,6 +89,10 @@ func main() {
 		route_data = route.Api_func_ban(call_arg[1:])
 	} else if call_arg[0] == "api_func_auth_post" {
 		route_data = route.Api_func_auth_post(call_arg[1:])
+	} else if call_arg[0] == "api_give_auth_patch" {
+		route_data = route.Api_give_auth_patch(call_arg[1:])
+	} else if call_arg[0] == "api_list_auth" {
+		route_data = route.Api_list_auth(call_arg[1:])
 	} else {
 		log.Fatal(call_arg[0] + " is 404")
 	}

+ 0 - 19
route_go/route/api_func_auth_move_patch.go

@@ -1,19 +0,0 @@
-package route
-
-import (
-	"opennamu/route/tool"
-
-	jsoniter "github.com/json-iterator/go"
-)
-
-func Api_func_auth_move_patch(call_arg []string) string {
-	var json = jsoniter.ConfigCompatibleWithStandardLibrary
-
-	other_set := map[string]string{}
-	json.Unmarshal([]byte(call_arg[0]), &other_set)
-
-	db := tool.DB_connect()
-	defer db.Close()
-
-	return ""
-}

+ 1 - 1
route_go/route/api_search.go → route_go/route/api_func_search.go

@@ -10,7 +10,7 @@ import (
 	jsoniter "github.com/json-iterator/go"
 )
 
-func Api_search(call_arg []string) string {
+func Api_func_search(call_arg []string) string {
 	var json = jsoniter.ConfigCompatibleWithStandardLibrary
 
 	other_set := map[string]string{}

+ 134 - 0
route_go/route/api_give_auth_patch.go

@@ -0,0 +1,134 @@
+package route
+
+import (
+	"log"
+	"opennamu/route/tool"
+
+	jsoniter "github.com/json-iterator/go"
+)
+
+func Api_give_auth_patch(call_arg []string) string {
+	var json = jsoniter.ConfigCompatibleWithStandardLibrary
+
+	other_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[0]), &other_set)
+
+	db := tool.DB_connect()
+	defer db.Close()
+
+	new_data := make(map[string]interface{})
+
+	ip := other_set["ip"]
+	user_name := other_set["user_name"]
+
+	if user_name != "" {
+		auth_check := false
+		auth_name := tool.Get_user_auth(db, user_name)
+		auth_data := tool.Get_auth_group_info(db, auth_name)
+
+		if tool.Auth_include_upper_auth(auth_data) {
+			if tool.Check_acl(db, "", "", "owner_auth", ip) {
+				auth_check = true
+			}
+		} else {
+			if tool.Check_acl(db, "", "", "give_auth", ip) {
+				auth_check = true
+			}
+		}
+
+		if !auth_check {
+			new_data["response"] = "require auth"
+		} else {
+			auth_check = false
+			auth_data = tool.Get_auth_group_info(db, other_set["change_auth"])
+
+			if tool.Auth_include_upper_auth(auth_data) {
+				if tool.Check_acl(db, "", "", "owner_auth", ip) {
+					auth_check = true
+				}
+			} else {
+				if tool.Check_acl(db, "", "", "give_auth", ip) {
+					auth_check = true
+				}
+			}
+
+			if !auth_check {
+				new_data["response"] = "require auth"
+			} else {
+				stmt, err := db.Prepare(tool.DB_change("delete from user_set where id = ? and name = 'acl'"))
+				if err != nil {
+					log.Fatal(err)
+				}
+				defer stmt.Close()
+
+				_, err = stmt.Exec()
+				if err != nil {
+					log.Fatal(err)
+				}
+
+				stmt, err = db.Prepare(tool.DB_change("insert into user_set (id, name, data) values (?, 'acl', ?)"))
+				if err != nil {
+					log.Fatal(err)
+				}
+				defer stmt.Close()
+
+				_, err = stmt.Exec(user_name, other_set["change_auth"])
+				if err != nil {
+					log.Fatal(err)
+				}
+
+				new_data["response"] = "ok"
+			}
+		}
+	} else {
+		auth_check := false
+		auth_data := tool.Get_auth_group_info(db, other_set["auth"])
+
+		if tool.Auth_include_upper_auth(auth_data) {
+			if tool.Check_acl(db, "", "", "owner_auth", other_set["ip"]) {
+				auth_check = true
+			}
+		} else {
+			if tool.Check_acl(db, "", "", "give_auth", other_set["ip"]) {
+				auth_check = true
+			}
+		}
+
+		if !auth_check {
+			new_data["response"] = "require auth"
+		} else {
+			auth_check = false
+			auth_data = tool.Get_auth_group_info(db, other_set["change_auth"])
+
+			if tool.Auth_include_upper_auth(auth_data) {
+				if tool.Check_acl(db, "", "", "owner_auth", other_set["ip"]) {
+					auth_check = true
+				}
+			} else {
+				if tool.Check_acl(db, "", "", "give_auth", other_set["ip"]) {
+					auth_check = true
+				}
+			}
+
+			if !auth_check {
+				new_data["response"] = "require auth"
+			} else {
+				stmt, err := db.Prepare(tool.DB_change("update user_set set data = ? where name = 'acl' and data = ?"))
+				if err != nil {
+					log.Fatal(err)
+				}
+				defer stmt.Close()
+
+				_, err = stmt.Exec(other_set["change_auth"], other_set["auth"])
+				if err != nil {
+					log.Fatal(err)
+				}
+
+				new_data["response"] = "ok"
+			}
+		}
+	}
+
+	json_data, _ := json.Marshal(new_data)
+	return string(json_data)
+}

+ 1 - 1
route_go/route/api_func_acl_list.go → route_go/route/api_list_acl.go

@@ -6,7 +6,7 @@ import (
 	jsoniter "github.com/json-iterator/go"
 )
 
-func Api_func_acl_list(call_arg []string) string {
+func Api_list_acl(call_arg []string) string {
 	var json = jsoniter.ConfigCompatibleWithStandardLibrary
 
 	other_set := map[string]string{}

+ 20 - 0
route_go/route/api_list_auth.go

@@ -0,0 +1,20 @@
+package route
+
+import (
+	"encoding/json"
+	"opennamu/route/tool"
+)
+
+func Api_list_auth(call_arg []string) string {
+	db := tool.DB_connect()
+	defer db.Close()
+
+	data := tool.List_auth(db)
+
+	return_data := make(map[string]interface{})
+	return_data["response"] = "ok"
+	return_data["data"] = data
+
+	json_data, _ := json.Marshal(return_data)
+	return string(json_data)
+}

+ 38 - 27
route_go/route/api_w_raw.go

@@ -18,72 +18,83 @@ func Api_w_raw(call_arg []string) string {
 	db := tool.DB_connect()
 	defer db.Close()
 
-	if other_set["exist_check"] != "" {
+	new_data := make(map[string]interface{})
+
+	if !tool.Check_acl(db, other_set["name"], "", "render", other_set["ip"]) {
+		new_data["response"] = "require auth"
+	} else if other_set["exist_check"] != "" {
 		stmt, err := db.Prepare(tool.DB_change("select title from data where title = ?"))
 		if err != nil {
 			log.Fatal(err)
 		}
 		defer stmt.Close()
 
-		new_data := map[string]string{}
 		var title string
 
 		err = stmt.QueryRow(other_set["name"]).Scan(&title)
 		if err != nil {
 			if err == sql.ErrNoRows {
+				new_data["exist"] = false
 			} else {
 				log.Fatal(err)
 			}
 		} else {
-			new_data["exist"] = "1"
+			new_data["exist"] = true
 		}
 
-		json_data, _ := json.Marshal(new_data)
-		return string(json_data)
+		new_data["response"] = "ok"
 	} else {
-		new_data := map[string]string{}
 		var data string
+		hide := ""
+
+		var stmt *sql.Stmt
+		var err error
 
 		if other_set["rev"] != "" {
-			stmt, err := db.Prepare(tool.DB_change("select data from history where title = ? and id = ?"))
+			stmt, err = db.Prepare(tool.DB_change("select data, hide from history where title = ? and id = ?"))
 			if err != nil {
 				log.Fatal(err)
 			}
 			defer stmt.Close()
 
-			err = stmt.QueryRow(other_set["name"], other_set["rev"]).Scan(&data)
-			if err != nil {
-				if err == sql.ErrNoRows {
-				} else {
-					log.Fatal(err)
-				}
-			} else {
-				new_data["title"] = other_set["name"]
-				new_data["data"] = data
-			}
-
-			json_data, _ := json.Marshal(new_data)
-			return string(json_data)
+			err = stmt.QueryRow(other_set["name"], other_set["rev"]).Scan(&data, &hide)
 		} else {
-			stmt, err := db.Prepare(tool.DB_change("select data from data where title = ?"))
+			stmt, err = db.Prepare(tool.DB_change("select data from data where title = ?"))
 			if err != nil {
 				log.Fatal(err)
 			}
 			defer stmt.Close()
 
 			err = stmt.QueryRow(other_set["name"]).Scan(&data)
-			if err != nil {
-				if err == sql.ErrNoRows {
+		}
+
+		if err != nil {
+			if err == sql.ErrNoRows {
+				new_data["response"] = "not exist"
+			} else {
+				log.Fatal(err)
+			}
+		} else {
+			check_pass := false
+			if hide != "" {
+				if tool.Check_acl(db, "", "", "hidel_auth", other_set["ip"]) {
+					check_pass = true
 				} else {
-					log.Fatal(err)
+					new_data["response"] = "require auth"
 				}
 			} else {
+				check_pass = true
+			}
+
+			if check_pass == true {
 				new_data["title"] = other_set["name"]
 				new_data["data"] = data
-			}
 
-			json_data, _ := json.Marshal(new_data)
-			return string(json_data)
+				new_data["response"] = "ok"
+			}
 		}
 	}
+
+	json_data, _ := json.Marshal(new_data)
+	return string(json_data)
 }

+ 57 - 18
route_go/route/tool/acl_and_auth.go

@@ -37,6 +37,35 @@ func List_acl(func_type string) []string {
 	}
 }
 
+func List_auth(db *sql.DB) []string {
+	stmt, err := db.Prepare(DB_change("select distinct name from alist"))
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer stmt.Close()
+
+	rows, err := stmt.Query()
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer rows.Close()
+
+	data_list := []string{}
+
+	for rows.Next() {
+		var name string
+
+		err := rows.Scan(&name)
+		if err != nil {
+			log.Fatal(err)
+		}
+
+		data_list = append(data_list, name)
+	}
+
+	return data_list
+}
+
 func Do_insert_auth_history(db *sql.DB, ip string, what string) {
 	var log_off string
 
@@ -66,32 +95,28 @@ func Do_insert_auth_history(db *sql.DB, ip string, what string) {
 }
 
 func Get_user_auth(db *sql.DB, ip string) string {
-	if !IP_or_user(ip) {
-		var auth string
+	stmt, err := db.Prepare(DB_change("select data from user_set where id = ? and name = 'acl'"))
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer stmt.Close()
 
-		stmt, err := db.Prepare(DB_change("select data from user_set where id = ? and name = 'acl'"))
-		if err != nil {
-			log.Fatal(err)
-		}
-		defer stmt.Close()
+	var auth string
 
-		err = stmt.QueryRow(ip).Scan(&auth)
-		if err != nil {
-			if err == sql.ErrNoRows {
+	err = stmt.QueryRow(ip).Scan(&auth)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			if !IP_or_user(ip) {
 				auth = "user"
 			} else {
-				log.Fatal(err)
+				auth = "ip"
 			}
-		}
-
-		if auth != "user" && auth != "ban" {
-			return auth
 		} else {
-			return ""
+			log.Fatal(err)
 		}
 	}
 
-	return ""
+	return auth
 }
 
 func Get_auth_group_info(db *sql.DB, auth string) map[string]bool {
@@ -120,7 +145,21 @@ func Get_auth_group_info(db *sql.DB, auth string) map[string]bool {
 		data_list[name] = true
 	}
 
-	return Check_auth(data_list)
+	if len(data_list) == 0 {
+		data_list["not_exist"] = true
+
+		return data_list
+	} else {
+		return Check_auth(data_list)
+	}
+}
+
+func Auth_include_upper_auth(auth_info map[string]bool) bool {
+	if auth_info["owner"] {
+		return true
+	}
+
+	return false
 }
 
 func Check_auth(auth_info map[string]bool) map[string]bool {

+ 1 - 1
views/main_css/js/func/editor.js

@@ -12,7 +12,7 @@ function do_insert_data(data) {
             sel.text = data;
         } else if(
             document.getElementById(name).selectionStart || 
-            document.getElementById(name).selectionStart == '0'
+            document.getElementById(name).selectionStart === '0'
         ) {
             let startPos = document.getElementById(name).selectionStart;
             let endPos = document.getElementById(name).selectionEnd;

+ 1 - 1
views/main_css/js/func/func.js

@@ -193,7 +193,7 @@ function opennamu_get_main_skin_set(set_name) {
 }
 
 function opennamu_send_render(data) {
-    if(data == '&lt;br&gt;' || data == '' || data.match(/^ +$/)) {
+    if(data === '&lt;br&gt;' || data === '' || data.match(/^ +$/)) {
         data = '<br>';
     } else {
         data = data.replace(/( |^)(https?:\/\/(?:[^ ]+))/g, function(m0, m1, m2) {

+ 2 - 2
views/main_css/js/func/render.js

@@ -310,11 +310,11 @@ function opennamu_do_toc() {
         let toc_string = '';
         let add_on = false;
         for(let for_b = 5; for_b >= 0; for_b--) {
-            if(add_on == false && toc_count[for_b] != 0) {
+            if(add_on === false && toc_count[for_b] != 0) {
                 add_on = true;
             }
 
-            if(add_on == true) {
+            if(add_on === true) {
                 toc_string = String(toc_count[for_b]) + '.' + toc_string;
             }
         }

+ 2 - 2
views/main_css/js/route/bbs_set.js

@@ -43,7 +43,7 @@ function opennamu_bbs_set() {
     }).then(function(lang) {
         lang = lang["data"];
 
-        fetch('/api/v2/acl_list/normal').then(function(res) {
+        fetch('/api/v2/list/acl/normal').then(function(res) {
             return res.json();
         }).then(function(acl_list) {
             acl_list = acl_list["data"];
@@ -57,7 +57,7 @@ function opennamu_bbs_set() {
                 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;
+                    acl_list_view = acl_list_view === "" ? "normal" : acl_list_view;
 
                     select += '<option value="' + acl_list[for_a] + '">' + acl_list_view + '</option>';
                 }

+ 33 - 0
views/main_css/js/route/give_auth.js

@@ -0,0 +1,33 @@
+"use strict";
+
+function opennamu_give_auth() {
+    const url = window.location.pathname;
+    const url_split = url.split('/');
+
+    let mode = 0;
+    if(url_split.length === 3) {
+        if(url_split[2] === 'auth_total') {
+            mode = 1;
+        }
+    }
+
+    let html_data = '';
+    if(mode === 0) {
+        if(url_split.length === 3) {
+            html_data += '<textarea></textarea>';
+        }
+
+
+    } else {
+        
+    }
+
+    fetch('/api/v2/list/auth').then(function(res) {
+        return res.json();
+    }).then(function(data) {
+        let data_list = data["data"];
+        console.log(data_list);
+
+        document.getElementById('opennamu_give_auth').innerHTML = html_data;
+    });
+}

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

@@ -6,7 +6,7 @@ function opennamu_list_old_page() {
     
     let set_type = '';
     let num = '';
-    if(url_split.length == 4) {
+    if(url_split.length === 4) {
         set_type = url_split[3];
         num = '1';
     } else {

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

@@ -16,7 +16,7 @@ function opennamu_list_recent_change() {
     
     let set_type = '';
     let num = '';
-    if(url_split.length == 2) {
+    if(url_split.length === 2) {
         set_type = 'normal';
         num = '1';
     } else {

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

@@ -6,7 +6,7 @@ function opennamu_list_recent_discuss() {
     
     let set_type = '';
     let num = '';
-    if(url_split.length == 2) {
+    if(url_split.length === 2) {
         set_type = 'normal';
         num = '1';
     } else {

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

@@ -17,9 +17,9 @@ function opennamu_main_sys_restart() {
         document.getElementById('opennamu_main_sys_restart_button').addEventListener('click', function() {
             fetch('/restart', {
                 method: 'post'
-            }).catch(function(e) {
-                window.location.href = '/';
             });
+
+            window.location.href = '/';
         });
     });
 }

+ 2 - 2
views/main_css/js/route/topic.js

@@ -75,8 +75,8 @@ function opennamu_thread_blind() {
 
 function opennamu_get_thread_ui(user_id, date, data, code, color = '', blind = '', add_style = '', topic_num = '') {
     let color_b, class_b;
-    if(blind == 'O') {
-        color_b = data == '' ? 'opennamu_comment_blind' : 'opennamu_comment_blind_admin';
+    if(blind === 'O') {
+        color_b = data === '' ? 'opennamu_comment_blind' : 'opennamu_comment_blind_admin';
         class_b = 'opennamu_comment_blind_js';
     } else {
         color_b = 'opennamu_comment_blind_not';

+ 2 - 2
views/ringo/js/main.js

@@ -16,7 +16,7 @@ function ringo_opening(data) {
         }
     }
 
-    if((document.getElementById(element[0]).style.display == 'none' && ringo_open == 0) || ringo_save_data !== data) {
+    if((document.getElementById(element[0]).style.display === 'none' && ringo_open === 0) || ringo_save_data !== data) {
         document.getElementById(element[0]).style.display = 'block';
 
         for(for_a in element) {
@@ -44,7 +44,7 @@ document.addEventListener("click", function() {
         cel_list.push(document.getElementById(ringo_menu_list[for_a]));
     }
 
-    if(ringo_save_data !== '' && ringo_open == 2) {
+    if(ringo_save_data !== '' && ringo_open === 2) {
         document.getElementById(ringo_save_data).style.display = 'none';
 
         setTimeout(function() { ringo_open = 0; }, 100);