Browse Source

Merge pull request #2140 from openNAMU/dev

UI 통일 계획 진행 및 최적화 진행
잉여개발기 2 years ago
parent
commit
d68e88ec1b

+ 7 - 6
app.py

@@ -461,7 +461,6 @@ app.route('/auth/give/fix/<user_name>', methods = ['POST', 'GET'])(give_user_fix
 app.route('/app_submit', methods = ['POST', 'GET'])(recent_app_submit_2)
 app.route('/app_submit', methods = ['POST', 'GET'])(recent_app_submit_2)
 
 
 # /auth/history
 # /auth/history
-# ongoing 반영 필요
 app.route('/block_log')(recent_block)
 app.route('/block_log')(recent_block)
 app.route('/block_log/<int:num>')(recent_block)
 app.route('/block_log/<int:num>')(recent_block)
 app.route('/block_log/user/<name>', defaults = { 'tool' : 'user' })(recent_block)
 app.route('/block_log/user/<name>', defaults = { 'tool' : 'user' })(recent_block)
@@ -476,7 +475,7 @@ app.route('/block_log/ongoing/<int:num>', defaults = { 'tool' : 'ongoing' })(rec
 # Func-history
 # Func-history
 app.route('/recent_change')(list_recent_change)
 app.route('/recent_change')(list_recent_change)
 app.route('/recent_changes')(list_recent_change)
 app.route('/recent_changes')(list_recent_change)
-app.route('/recent_change/<int:num>/<set_type>', defaults = { 'tool' : 'recent' })(recent_change)
+app.route('/recent_change/<int:num>/<set_type>')(list_recent_change)
 
 
 app.route('/recent_edit_request', defaults = { 'db_set' : db_set_str })(recent_edit_request)
 app.route('/recent_edit_request', defaults = { 'db_set' : db_set_str })(recent_edit_request)
 
 
@@ -643,7 +642,7 @@ app.route('/vote/list/close/<int:num>', defaults = { 'list_type' : 'close' })(vo
 app.route('/vote/add', methods = ['POST', 'GET'])(vote_add)
 app.route('/vote/add', methods = ['POST', 'GET'])(vote_add)
 
 
 # Func-bbs
 # Func-bbs
-app.route('/bbs/main', defaults = { 'tool' : 'main' })(bbs_w)
+app.route('/bbs/main')(bbs_main)
 app.route('/bbs/make', methods = ['POST', 'GET'])(bbs_make)
 app.route('/bbs/make', methods = ['POST', 'GET'])(bbs_make)
 # app.route('/bbs/main/set')
 # app.route('/bbs/main/set')
 app.route('/bbs/w/<int:bbs_num>')(bbs_w)
 app.route('/bbs/w/<int:bbs_num>')(bbs_w)
@@ -679,6 +678,7 @@ app.route('/api/xref_this/<int:num>/<everything:name>', defaults = { 'xref_type'
 
 
 app.route('/api/random', defaults = { 'db_set' : db_set_str })(api_w_random)
 app.route('/api/random', defaults = { 'db_set' : db_set_str })(api_w_random)
 
 
+app.route('/api/bbs', defaults = { 'db_set' : db_set_str })(api_bbs_list)
 app.route('/api/bbs/main', defaults = { 'db_set' : db_set_str })(api_bbs)
 app.route('/api/bbs/main', defaults = { 'db_set' : db_set_str })(api_bbs)
 app.route('/api/bbs/w/<int:bbs_num>', defaults = { 'db_set' : db_set_str })(api_bbs)
 app.route('/api/bbs/w/<int:bbs_num>', defaults = { 'db_set' : db_set_str })(api_bbs)
 app.route('/api/bbs/w/<int:bbs_num>/<int:page>', defaults = { 'db_set' : db_set_str })(api_bbs)
 app.route('/api/bbs/w/<int:bbs_num>/<int:page>', defaults = { 'db_set' : db_set_str })(api_bbs)
@@ -693,6 +693,9 @@ app.route('/api/skin_info/<name>')(api_skin_info)
 app.route('/api/user_info/<user_name>')(api_user_info)
 app.route('/api/user_info/<user_name>')(api_user_info)
 app.route('/api/setting/<name>')(api_setting)
 app.route('/api/setting/<name>')(api_setting)
 
 
+app.route('/api/auth_list', defaults = { 'db_set' : db_set_str })(api_func_auth_list)
+app.route('/api/auth_list/<user_name>', defaults = { 'db_set' : db_set_str })(api_func_auth_list)
+
 app.route('/api/thread/<int:topic_num>/<int:s_num>/<int:e_num>', defaults = { 'db_set' : db_set_str })(api_topic)
 app.route('/api/thread/<int:topic_num>/<int:s_num>/<int:e_num>', defaults = { 'db_set' : db_set_str })(api_topic)
 app.route('/api/thread/<int:topic_num>/<tool>', defaults = { 'db_set' : db_set_str })(api_topic)
 app.route('/api/thread/<int:topic_num>/<tool>', defaults = { 'db_set' : db_set_str })(api_topic)
 app.route('/api/thread/<int:topic_num>', defaults = { 'db_set' : db_set_str })(api_topic)
 app.route('/api/thread/<int:topic_num>', defaults = { 'db_set' : db_set_str })(api_topic)
@@ -707,8 +710,6 @@ app.route('/api/recent_changes', defaults = { 'db_set' : db_set_str })(api_list_
 app.route('/api/recent_change/<int:limit>', defaults = { 'db_set' : db_set_str })(api_list_recent_change)
 app.route('/api/recent_change/<int:limit>', defaults = { 'db_set' : db_set_str })(api_list_recent_change)
 app.route('/api/recent_change/<int:limit>/<set_type>/<int:num>', defaults = { 'db_set' : db_set_str })(api_list_recent_change)
 app.route('/api/recent_change/<int:limit>/<set_type>/<int:num>', defaults = { 'db_set' : db_set_str })(api_list_recent_change)
 
 
-app.route('/api/history_tool/<int(signed = True):rev>/<everything:name>', defaults = { 'db_set' : db_set_str })(api_list_history_tool)
-
 app.route('/api/recent_edit_request', defaults = { 'db_set' : db_set_str })(api_list_recent_edit_request)
 app.route('/api/recent_edit_request', defaults = { 'db_set' : db_set_str })(api_list_recent_edit_request)
 app.route('/api/recent_edit_request/<int:limit>/<set_type>/<int:num>', defaults = { 'db_set' : db_set_str })(api_list_recent_edit_request)
 app.route('/api/recent_edit_request/<int:limit>/<set_type>/<int:num>', defaults = { 'db_set' : db_set_str })(api_list_recent_edit_request)
 
 
@@ -764,7 +765,7 @@ app.route('/view/<path:name>')(main_view)
 app.route('/views/<path:name>')(main_view)
 app.route('/views/<path:name>')(main_view)
 app.route('/image/<path:name>')(main_view_image)
 app.route('/image/<path:name>')(main_view_image)
 # 조정 계획 중
 # 조정 계획 중
-app.route('/<regex("[^.]+\\.(?:txt|xml)"):data>')(main_view_file)
+app.route('/<regex("[^.]+\\.(?:txt|xml|ico)"):data>')(main_view_file)
 
 
 app.route('/shutdown', methods = ['POST', 'GET'])(main_sys_shutdown)
 app.route('/shutdown', methods = ['POST', 'GET'])(main_sys_shutdown)
 app.route('/restart', methods = ['POST', 'GET'])(main_sys_restart)
 app.route('/restart', methods = ['POST', 'GET'])(main_sys_restart)

+ 4 - 1
route/__init__.py

@@ -170,19 +170,22 @@ from route.n_list_recent_discuss import list_recent_discuss
 
 
 from route.n_w_watch_list import w_watch_list
 from route.n_w_watch_list import w_watch_list
 
 
+from route.n_bbs_main import bbs_main
+
 from route.go_api_func_llm import api_func_llm
 from route.go_api_func_llm import api_func_llm
 from route.go_api_func_language import api_func_language
 from route.go_api_func_language import api_func_language
 from route.go_api_func_sha224 import api_func_sha224
 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 import api_func_ip
+from route.go_api_func_auth_list import api_func_auth_list
 
 
 from route.go_api_search import api_search
 from route.go_api_search import api_search
 
 
-from route.go_api_list_history_tool import api_list_history_tool
 from route.go_api_list_recent_change import api_list_recent_change
 from route.go_api_list_recent_change import api_list_recent_change
 from route.go_api_list_recent_discuss import api_list_recent_discuss
 from route.go_api_list_recent_discuss import api_list_recent_discuss
 from route.go_api_list_recent_edit_request import api_list_recent_edit_request
 from route.go_api_list_recent_edit_request import api_list_recent_edit_request
 
 
 from route.go_api_bbs import api_bbs
 from route.go_api_bbs import api_bbs
+from route.go_api_bbs_list import api_bbs_list
 
 
 from route.go_api_topic import api_topic
 from route.go_api_topic import api_topic
 
 

+ 0 - 1
route/bbs_make.py

@@ -8,7 +8,6 @@ def bbs_make():
             return re_error(conn, '/error/3')
             return re_error(conn, '/error/3')
         
         
         if flask.request.method == 'POST':
         if flask.request.method == 'POST':
-            
             curs.execute(db_change('select set_id from bbs_set where set_name = "bbs_name" order by set_id + 0 desc'))
             curs.execute(db_change('select set_id from bbs_set where set_name = "bbs_name" order by set_id + 0 desc'))
             db_data = curs.fetchall()
             db_data = curs.fetchall()
 
 

+ 17 - 0
route/go_api_bbs_list.py

@@ -0,0 +1,17 @@
+from .tool.func import *
+
+def api_bbs_list(db_set):
+    if platform.system() == 'Linux':
+        if platform.machine() in ["AMD64", "x86_64"]:
+            data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.amd64.bin"), sys._getframe().f_code.co_name, db_set], stdout = subprocess.PIPE).communicate()[0]
+        else:
+            data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.arm64.bin"), sys._getframe().f_code.co_name, db_set], stdout = subprocess.PIPE).communicate()[0]
+    else:
+        if platform.machine() in ["AMD64", "x86_64"]:
+            data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.amd64.exe"), sys._getframe().f_code.co_name, db_set], stdout = subprocess.PIPE).communicate()[0]
+        else:
+            data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.arm64.exe"), sys._getframe().f_code.co_name, db_set], stdout = subprocess.PIPE).communicate()[0]
+
+    data = data.decode('utf8')
+
+    return flask.Response(response = data, status = 200, mimetype = 'application/json')

+ 6 - 4
route/go_api_list_history_tool.py → route/go_api_func_auth_list.py

@@ -1,10 +1,12 @@
 from .tool.func import *
 from .tool.func import *
 
 
-def api_list_history_tool(db_set, rev = 1, name = 'Test'):
+def api_func_auth_list(db_set, user_name = ''):
     other_set = {}
     other_set = {}
-    other_set["doc_name"] = name
-    other_set["rev"] = str(rev)
-    other_set["ip"] = ip_check()
+    if user_name == '':
+        other_set["ip"] = ip_check()
+    else:
+        other_set["ip"] = user_name
+
     other_set = json.dumps(other_set)
     other_set = json.dumps(other_set)
 
 
     if platform.system() == 'Linux':
     if platform.system() == 'Linux':

+ 1 - 3
route/main_view.py

@@ -1,12 +1,10 @@
 from .tool.func import *
 from .tool.func import *
 
 
-from .main_func_error_404 import main_func_error_404
-
 def main_view(name = ''):
 def main_view(name = ''):
     with get_db_connect() as conn:
     with get_db_connect() as conn:
         file_name = re.search(r'([^/]+)$', name)
         file_name = re.search(r'([^/]+)$', name)
         if not file_name:
         if not file_name:
-            return main_func_error_404()
+            return ''
         else:
         else:
             file_name = file_name.group(1)
             file_name = file_name.group(1)
             dir_name = './views/' + re.sub(r'\.{2,}', '', name[:-len(file_name)])
             dir_name = './views/' + re.sub(r'\.{2,}', '', name[:-len(file_name)])

+ 1 - 2
route/main_view_file.py

@@ -1,5 +1,4 @@
 from .tool.func import *
 from .tool.func import *
-from .main_func_error_404 import main_func_error_404
 
 
 def main_view_file(data = ''):
 def main_view_file(data = ''):
     with get_db_connect() as conn:
     with get_db_connect() as conn:
@@ -23,4 +22,4 @@ def main_view_file(data = ''):
             else:
             else:
                 return flask.send_from_directory('./', data, mimetype = 'text/xml')
                 return flask.send_from_directory('./', data, mimetype = 'text/xml')
         else:
         else:
-            return main_func_error_404()
+            return ''

+ 1 - 2
route/main_view_image.py

@@ -1,5 +1,4 @@
 from .tool.func import *
 from .tool.func import *
-from .main_func_error_404 import main_func_error_404
 
 
 def main_view_image(name = ''):
 def main_view_image(name = ''):
     with get_db_connect() as conn:
     with get_db_connect() as conn:
@@ -13,6 +12,6 @@ def main_view_image(name = ''):
 
 
                 return flask.send_from_directory('./' + load_image_url(conn), name, mimetype = 'image/' + mime_type)
                 return flask.send_from_directory('./' + load_image_url(conn), name, mimetype = 'image/' + mime_type)
             else:
             else:
-                return main_func_error_404()
+                return ''
         else:
         else:
             return re_error(conn, '/ban')
             return re_error(conn, '/ban')

+ 13 - 0
route/n_bbs_main.py

@@ -0,0 +1,13 @@
+from .tool.func import *
+
+def bbs_main():
+    with get_db_connect() as conn:
+        return easy_minify(conn, flask.render_template(skin_check(conn),
+            imp = [get_lang(conn, 'bbs_main'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+            data = '' + \
+                '<div id="opennamu_bbs_main"></div>' + \
+                '<script src="/views/main_css/js/route/bbs_main.js' + cache_v() + '"></script>' + \
+                '<script>opennamu_bbs_main();</script>' + \
+            '',
+            menu = [['other', get_lang(conn, 'other_tool')]] + ([['bbs/make', get_lang(conn, 'add')]] if admin_check(conn) == 1 else [])
+        ))

+ 7 - 4
route/n_list_recent_change.py

@@ -1,13 +1,16 @@
 from .tool.func import *
 from .tool.func import *
 
 
-def list_recent_change():
+def list_recent_change(num = 1, set_type = 'normal'):
     with get_db_connect() as conn:
     with get_db_connect() as conn:
+        if not set_type in ('normal', 'edit', 'move', 'delete', 'revert', 'r1', 'edit_request', 'user'):
+            set_type = 'normal'
+
         return easy_minify(conn, flask.render_template(skin_check(conn),
         return easy_minify(conn, flask.render_template(skin_check(conn),
-            imp = [get_lang(conn, 'recent_change'), wiki_set(conn), wiki_custom(conn), wiki_css([0, 0])],
+            imp = [get_lang(conn, 'recent_change'), wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, set_type) + ')', 0])],
             data = '' + \
             data = '' + \
                 '<div id="opennamu_list_recent_change"></div>' + \
                 '<div id="opennamu_list_recent_change"></div>' + \
                 '<script src="/views/main_css/js/route/list_recent_change.js' + cache_v() + '"></script>' + \
                 '<script src="/views/main_css/js/route/list_recent_change.js' + cache_v() + '"></script>' + \
-                '<script>opennamu_list_recent_change();</script>' + \
+                '<script>opennamu_list_recent_change(' + str(num) + ', "' + set_type + '");</script>' + \
             '',
             '',
-            menu = [['other', get_lang(conn, 'return')]]
+            menu = [['other', get_lang(conn, 'return')], ['recent_edit_request', get_lang(conn, 'edit_request')]]
         ))
         ))

+ 1 - 1
route/tool/func.py

@@ -1043,7 +1043,7 @@ def skin_check(conn, set_n = 0):
         return skin
         return skin
     
     
 def cache_v():
 def cache_v():
-    return '.cache_v227'
+    return '.cache_v231'
 
 
 def wiki_css(data):
 def wiki_css(data):
     global global_wiki_set
     global global_wiki_set

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


+ 9 - 2
route_go/main.go

@@ -1,6 +1,7 @@
 package main
 package main
 
 
 import (
 import (
+	"log"
 	"opennamu/route"
 	"opennamu/route"
 	"os"
 	"os"
 )
 )
@@ -8,6 +9,8 @@ import (
 func main() {
 func main() {
 	call_arg := os.Args[1:]
 	call_arg := os.Args[1:]
 
 
+	log.SetFlags(log.LstdFlags | log.Lshortfile)
+
 	if call_arg[0] == "main_func_easter_egg" {
 	if call_arg[0] == "main_func_easter_egg" {
 		route.Main_func_easter_egg()
 		route.Main_func_easter_egg()
 	} else if call_arg[0] == "api_w_raw" {
 	} else if call_arg[0] == "api_w_raw" {
@@ -40,9 +43,13 @@ func main() {
 		route.Api_func_llm(call_arg[1:])
 		route.Api_func_llm(call_arg[1:])
 	} else if call_arg[0] == "api_func_language" {
 	} else if call_arg[0] == "api_func_language" {
 		route.Api_func_language(call_arg[1:])
 		route.Api_func_language(call_arg[1:])
-	} else if call_arg[0] == "api_list_history_tool" {
-		route.Api_list_history_tool(call_arg[1:])
+	} else if call_arg[0] == "api_func_auth_list" {
+		route.Api_func_auth_list(call_arg[1:])
 	} else if call_arg[0] == "api_list_recent_discuss" {
 	} else if call_arg[0] == "api_list_recent_discuss" {
 		route.Api_list_recent_discuss(call_arg[1:])
 		route.Api_list_recent_discuss(call_arg[1:])
+	} else if call_arg[0] == "api_bbs_list" {
+		route.Api_bbs_list(call_arg[1:])
+	} else {
+		log.Fatal("404")
 	}
 	}
 }
 }

+ 22 - 1
route_go/route/api_bbs.go

@@ -51,6 +51,7 @@ func Api_bbs(call_arg []string) {
 	defer rows.Close()
 	defer rows.Close()
 
 
 	var data_list []map[string]string
 	var data_list []map[string]string
+	ip_parser_temp := map[string][]string{}
 
 
 	for rows.Next() {
 	for rows.Next() {
 		temp_data := make(map[string]string)
 		temp_data := make(map[string]string)
@@ -87,7 +88,27 @@ func Api_bbs(call_arg []string) {
 				log.Fatal(err)
 				log.Fatal(err)
 			}
 			}
 
 
-			temp_data[set_name] = set_data
+			if set_name == "user_id" {
+				var ip_pre string
+				var ip_render string
+
+				if _, ok := ip_parser_temp[set_data]; ok {
+					ip_pre = ip_parser_temp[set_data][0]
+					ip_render = ip_parser_temp[set_data][1]
+				} else {
+					ip_pre = tool.IP_preprocess(db, db_set, set_data, other_set["ip"])[0]
+					ip_render = tool.IP_parser(db, db_set, set_data, other_set["ip"])
+
+					ip_parser_temp[set_data] = []string{ip_pre, ip_render}
+				}
+
+				set_data = ip_pre
+				temp_data["user_id_render"] = ip_render
+			}
+
+			if set_name != "data" {
+				temp_data[set_name] = set_data
+			}
 		}
 		}
 
 
 		data_list = append(data_list, temp_data)
 		data_list = append(data_list, temp_data)

+ 53 - 0
route_go/route/api_bbs_list.go

@@ -0,0 +1,53 @@
+package route
+
+import (
+	"database/sql"
+	"encoding/json"
+	"fmt"
+	"log"
+	"opennamu/route/tool"
+)
+
+func bbs_list(db *sql.DB, db_set map[string]string) map[string]string {
+	rows, err := db.Query(tool.DB_change(db_set, "select set_data, set_id from bbs_set where set_name = 'bbs_name'"))
+	if err != nil {
+		log.Fatal(err)
+	}
+	defer rows.Close()
+
+	data_list := map[string]string{}
+
+	for rows.Next() {
+		var name string
+		var id string
+
+		err := rows.Scan(&name, &id)
+		if err != nil {
+			log.Fatal(err)
+		}
+
+		data_list[name] = id
+	}
+
+	return data_list
+}
+
+func Api_bbs_list(call_arg []string) {
+	db_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[0]), &db_set)
+
+	db := tool.DB_connect(db_set)
+	if db == nil {
+		return
+	}
+	defer db.Close()
+
+	data_list := bbs_list(db, db_set)
+
+	if len(data_list) == 0 {
+		fmt.Print("{}")
+	} else {
+		json_data, _ := json.Marshal(data_list)
+		fmt.Print(string(json_data))
+	}
+}

+ 27 - 0
route_go/route/api_func_auth_list.go

@@ -0,0 +1,27 @@
+package route
+
+import (
+	"encoding/json"
+	"fmt"
+	"opennamu/route/tool"
+)
+
+func Api_func_auth_list(call_arg []string) {
+	db_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[0]), &db_set)
+
+	other_set := map[string]string{}
+	json.Unmarshal([]byte(call_arg[1]), &other_set)
+
+	db := tool.DB_connect(db_set)
+	if db == nil {
+		return
+	}
+	defer db.Close()
+
+	auth_name := tool.Get_user_auth(db, db_set, other_set["ip"])
+	auth_info := tool.Get_auth_group_info(db, db_set, auth_name)
+
+	json_data, _ := json.Marshal(auth_info)
+	fmt.Print(string(json_data))
+}

+ 0 - 108
route_go/route/api_list_history_tool.go

@@ -1,108 +0,0 @@
-package route
-
-import (
-	"encoding/json"
-	"fmt"
-	"log"
-	"opennamu/route/tool"
-	"strconv"
-)
-
-func Api_list_history_tool(call_arg []string) {
-	db_set := map[string]string{}
-	json.Unmarshal([]byte(call_arg[0]), &db_set)
-
-	other_set := map[string]string{}
-	json.Unmarshal([]byte(call_arg[1]), &other_set)
-
-	db := tool.DB_connect(db_set)
-	if db == nil {
-		return
-	}
-	defer db.Close()
-
-	main_dict := [][]string{}
-
-	main_dict = append(
-		main_dict,
-		[]string{
-			"/raw_rev/" + other_set["rev"] + "/" + tool.Url_parser(other_set["doc_name"]),
-			tool.Get_language(db, db_set, "raw", false),
-		},
-	)
-	main_dict = append(
-		main_dict,
-		[]string{
-			"/revert/" + other_set["rev"] + "/" + tool.Url_parser(other_set["doc_name"]),
-			tool.Get_language(db, db_set, "revert", false) + " (r" + other_set["rev"] + ")",
-		},
-	)
-
-	rev_int, err := strconv.Atoi(other_set["rev"])
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	if rev_int > 1 {
-		rev_str := strconv.Itoa(rev_int - 1)
-
-		main_dict = append(
-			main_dict,
-			[]string{
-				"/revert/" + rev_str + "/" + tool.Url_parser(other_set["doc_name"]),
-				tool.Get_language(db, db_set, "revert", false) + " (r" + rev_str + ")",
-			},
-		)
-		main_dict = append(
-			main_dict,
-			[]string{
-				"/diff/" + rev_str + "/" + other_set["rev"] + "/" + tool.Url_parser(other_set["doc_name"]),
-				tool.Get_language(db, db_set, "compare", false),
-			},
-		)
-	}
-
-	main_dict = append(
-		main_dict,
-		[]string{
-			"/history/" + tool.Url_parser(other_set["doc_name"]),
-			tool.Get_language(db, db_set, "history", false),
-		},
-	)
-
-	auth_name := tool.Get_user_auth(db, db_set, other_set["ip"])
-	auth_info := tool.Get_auth_group_info(db, db_set, auth_name)
-
-	_, ok := auth_info["hidel"]
-	_, ok2 := auth_info["owner"]
-
-	if ok || ok2 {
-		main_dict = append(
-			main_dict,
-			[]string{
-				"/history_hidden/" + other_set["rev"] + "/" + tool.Url_parser(other_set["doc_name"]),
-				tool.Get_language(db, db_set, "hide", false),
-			},
-		)
-	}
-
-	if ok2 {
-		main_dict = append(
-			main_dict,
-			[]string{
-				"/history_delete/" + other_set["rev"] + "/" + tool.Url_parser(other_set["doc_name"]),
-				tool.Get_language(db, db_set, "history_delete", false),
-			},
-		)
-		main_dict = append(
-			main_dict,
-			[]string{
-				"/history_send/" + other_set["rev"] + "/" + tool.Url_parser(other_set["doc_name"]),
-				tool.Get_language(db, db_set, "send_edit", false),
-			},
-		)
-	}
-
-	json_data, _ := json.Marshal(main_dict)
-	fmt.Print(string(json_data))
-}

+ 14 - 2
route_go/route/api_list_recent_change.go

@@ -36,19 +36,31 @@ func Api_list_recent_change(call_arg []string) {
 		limit_int = 50
 		limit_int = 50
 	}
 	}
 
 
-	stmt, err := db.Prepare(tool.DB_change(db_set, "select id, title from rc where type = ? order by date desc limit ?"))
+	page_int, err := strconv.Atoi(other_set["num"])
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	if page_int > 0 {
+		page_int = (page_int * limit_int) - limit_int
+	} else {
+		page_int = 0
+	}
+
+	stmt, err := db.Prepare(tool.DB_change(db_set, "select id, title from rc where type = ? order by date desc limit ?, ?"))
 	if err != nil {
 	if err != nil {
 		log.Fatal(err)
 		log.Fatal(err)
 	}
 	}
 	defer stmt.Close()
 	defer stmt.Close()
 
 
-	rows, err := stmt.Query(set_type, limit_int)
+	rows, err := stmt.Query(set_type, page_int, limit_int)
 	if err != nil {
 	if err != nil {
 		log.Fatal(err)
 		log.Fatal(err)
 	}
 	}
 	defer rows.Close()
 	defer rows.Close()
 
 
 	var data_list [][]string
 	var data_list [][]string
+
 	admin_auth := tool.Get_user_auth(db, db_set, other_set["ip"])
 	admin_auth := tool.Get_user_auth(db, db_set, other_set["ip"])
 	ip_parser_temp := map[string][]string{}
 	ip_parser_temp := map[string][]string{}
 
 

+ 5 - 3
route_go/route/api_list_recent_discuss.go

@@ -39,7 +39,7 @@ func Api_list_recent_discuss(call_arg []string) {
 	} else if set_type == "close" {
 	} else if set_type == "close" {
 		stmt, err = db.Prepare(tool.DB_change(db_set, "select title, sub, date, code, stop from rd where stop = 'O' order by date desc limit ?"))
 		stmt, err = db.Prepare(tool.DB_change(db_set, "select title, sub, date, code, stop from rd where stop = 'O' order by date desc limit ?"))
 	} else {
 	} else {
-		stmt, err = db.Prepare(tool.DB_change(db_set, "select title, sub, date, code, stop from rd where stop != 'O' order by date asc limit ?"))
+		stmt, err = db.Prepare(tool.DB_change(db_set, "select title, sub, date, code, stop from rd where stop != 'O' order by date desc limit ?"))
 	}
 	}
 
 
 	if err != nil {
 	if err != nil {
@@ -68,15 +68,16 @@ func Api_list_recent_discuss(call_arg []string) {
 			log.Fatal(err)
 			log.Fatal(err)
 		}
 		}
 
 
-		stmt, err := db.Prepare(tool.DB_change(db_set, "select ip from topic where code = ? order by id + 0 desc limit 1"))
+		stmt, err := db.Prepare(tool.DB_change(db_set, "select ip, id from topic where code = ? order by id + 0 desc limit 1"))
 		if err != nil {
 		if err != nil {
 			log.Fatal(err)
 			log.Fatal(err)
 		}
 		}
 		defer stmt.Close()
 		defer stmt.Close()
 
 
 		var ip string
 		var ip string
+		var id string
 
 
-		err = stmt.QueryRow(code).Scan(&ip)
+		err = stmt.QueryRow(code).Scan(&ip, &id)
 		if err != nil {
 		if err != nil {
 			if err == sql.ErrNoRows {
 			if err == sql.ErrNoRows {
 				ip = ""
 				ip = ""
@@ -106,6 +107,7 @@ func Api_list_recent_discuss(call_arg []string) {
 			stop,
 			stop,
 			ip_pre,
 			ip_pre,
 			ip_render,
 			ip_render,
+			id,
 		})
 		})
 	}
 	}
 
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
 {
     "beta" : {
     "beta" : {
-        "r_ver" : "v3.5.0-dev71",
+        "r_ver" : "v3.5.0-dev76",
         "c_ver" : "3500376",
         "c_ver" : "3500376",
         "s_ver" : "3500113"
         "s_ver" : "3500113"
     }
     }

+ 55 - 20
views/main_css/js/func/func.js

@@ -1,5 +1,39 @@
 "use strict";
 "use strict";
 
 
+function opennamu_xss_filter(str) {
+    return str.replace(/[&<>"']/g, function(match) {
+        switch(match) {
+            case '&':
+                return '&amp;';
+            case '<':
+                return '&lt;';
+            case '>':
+                return '&gt;';
+            case "'":
+                return '&#x27;';
+            case '"':
+                return '&quot;';
+        }
+    });
+}
+
+function opennamu_xss_filter_decode(str) {
+    return str.replace(/&amp;|&lt;|&gt;|&#x27;|&quot;/g, function(match) {
+        switch(match) {
+            case '&amp;':
+                return '&';
+            case '&lt;':
+                return '<';
+            case '&gt;':
+                return '>';
+            case '&#x27;':
+                return "'";
+            case '&quot;':
+                return '"';
+        }
+    });
+}
+
 function opennamu_do_id_check(data) {
 function opennamu_do_id_check(data) {
     if(data.match(/\.|\:/)) {
     if(data.match(/\.|\:/)) {
         return 0;
         return 0;
@@ -51,6 +85,26 @@ function opennamu_get_main_skin_set(set_name) {
     });
     });
 }
 }
 
 
+function opennamu_send_render(data) {
+    if(data == '&lt;br&gt;' || data == '' || data.match(/^ +$/)) {
+        data = '<br>';
+    } else {
+        data = data.replace(/( |^)(https?:\/\/(?:[^ ]+))/g, function(m0, m1, m2) {
+            let link_main = m2;
+            link_main = link_main.replace('"', '&quot;');
+
+            return m1 + '<a href="' + link_main + '">' + link_main + '</a>';
+        });
+        data = data.replace(/&lt;a(?:(?:(?!&gt;).)*)&gt;((?:(?!&lt;\/a&gt;).)+)&lt;\/a&gt;/g, function(m0, m1) {
+            let data_unescape = opennamu_xss_filter_decode(m1)
+
+            return '<a href="/w/' + opennamu_do_url_encode(data_unescape) + '">' + m1 + '</a>'
+        })
+    }
+
+    return data;
+}
+
 function opennamu_insert_v(name, data) {
 function opennamu_insert_v(name, data) {
     document.getElementById(name).value = data;
     document.getElementById(name).value = data;
 }
 }
@@ -96,7 +150,7 @@ function opennamu_do_render(to_obj, data, name = '', do_type = '', option = '')
 function opennamu_page_control(url, page, data_length, data_length_max = 50) {
 function opennamu_page_control(url, page, data_length, data_length_max = 50) {
     let next = function() {
     let next = function() {
         if(data_length_max === data_length) {
         if(data_length_max === data_length) {
-            return '<a href="' + url.replace('{}', String(page + 1)) + '">(-)</a>';
+            return '<a href="' + url.replace('{}', String(page + 1)) + '">(+)</a>';
         } else {
         } else {
             return '';
             return '';
         }
         }
@@ -111,23 +165,4 @@ function opennamu_page_control(url, page, data_length, data_length_max = 50) {
     };
     };
 
 
     return (next() + ' ' + back()).replace(/^ /, '');
     return (next() + ' ' + back()).replace(/^ /, '');
-}
-
-function opennamu_xss_filter(str) {
-    return str.replace(/[&<>"'\/]/g, function(match) {
-        switch(match) {
-            case '&':
-                return '&amp;';
-            case '<':
-                return '&lt;';
-            case '>':
-                return '&gt;';
-            case "'":
-                return '&#x27;';
-            case '"':
-                return '&quot;';
-            case '/':
-                return '&#x2F;';
-        }
-    });
 }
 }

+ 39 - 0
views/main_css/js/route/bbs_main.js

@@ -0,0 +1,39 @@
+"use strict";
+
+function opennamu_bbs_main() {
+    fetch('/api/bbs').then(function(res) {
+        return res.json();
+    }).then(function(bbs_list) {
+        fetch('/api/bbs/main').then(function(res) {
+            return res.json();
+        }).then(function(data) {
+            let data_html = '<ul class="opennamu_ul">';
+
+            for(let key in bbs_list) {
+                data_html += '<li><a href="/bbs/w/' + bbs_list[key] + '">' + opennamu_xss_filter(key) + '</a></li>';
+            }
+    
+            data_html += '</ul>';
+            data_html += '<hr class="main_hr">';
+
+            for(let for_a = 0; for_a < data.length; for_a++) {
+                data_html += '<div class="opennamu_recent_change">';
+
+                data_html += '<a href="/bbs/w/' + data[for_a]['set_id'] + '/' + data[for_a]['set_code'] + '">' + opennamu_xss_filter(data[for_a]['title']) + '</a>';
+
+                data_html += '<div style="float: right;">';
+
+                data_html += data[for_a]['user_id_render'] + ' | ';
+                data_html += data[for_a]['date'];
+
+                data_html += '</div>'
+                data_html += '<div style="clear: both;"></div>';
+
+                data_html += '</div>';
+                data_html += '<hr class="main_hr">';
+            }
+            
+            document.getElementById('opennamu_bbs_main').innerHTML = data_html;
+        });
+    })
+}

+ 100 - 90
views/main_css/js/route/list_recent_change.js

@@ -1,8 +1,9 @@
 "use strict";
 "use strict";
 
 
-function opennamu_list_recent_change() {
+function opennamu_list_recent_change(num, set_type) {
     let lang_data = new FormData();
     let lang_data = new FormData();
-    lang_data.append('data', 'tool normal edit move delete revert new_doc edit_request user_document')
+    // user_document -> 8
+    lang_data.append('data', 'tool normal edit move delete revert new_doc edit_request user_document raw revert compare history hide history_delete send_edit');
 
 
     fetch('/api/lang', {
     fetch('/api/lang', {
         method : 'post',
         method : 'post',
@@ -11,110 +12,119 @@ function opennamu_list_recent_change() {
         return res.json();
         return res.json();
     }).then(function(lang) {
     }).then(function(lang) {
         lang = lang["data"];
         lang = lang["data"];
-
-        fetch('/api/recent_change/50').then(function(res) {
+        
+        fetch('/api/auth_list').then(function(res) {
             return res.json();
             return res.json();
-        }).then(function(data) {
-            let data_html = '';
-
-            let option_list = [
-                ['normal', lang[1]],
-                ['edit', lang[2]],
-                ['move', lang[3]],
-                ['delete', lang[4]],
-                ['revert', lang[5]],
-                ['r1', lang[6]],
-                ['edit_request', lang[7]],
-                ['user', lang[8]]
-            ];
-            for(let for_a = 0; for_a < option_list.length; for_a++) {
-                data_html += '<a href="/recent_change/1/' + option_list[for_a][0] + '">(' + option_list[for_a][1] + ')</a> ';
-            }
-
-            data_html += '<hr class="main_hr">'
-
-            for(let for_a = 0; for_a < data.length; for_a++) {
-                if(data[for_a][6] !== "" && data[for_a][1] === "") {
-                    data_html += '<div class="opennamu_recent_change">----</div>';
-                    data_html += '<hr class="main_hr">';
-
-                    continue;
+        }).then(function(auth) {
+            fetch('/api/recent_change/50/' + set_type + '/' + String(num)).then(function(res) {
+                return res.json();
+            }).then(function(data) {
+                let data_html = '';
+
+                let option_list = [
+                    ['normal', lang[1]],
+                    ['edit', lang[2]],
+                    ['move', lang[3]],
+                    ['delete', lang[4]],
+                    ['revert', lang[5]],
+                    ['r1', lang[6]],
+                    ['edit_request', lang[7]],
+                    ['user', lang[8]]
+                ];
+                for(let for_a = 0; for_a < option_list.length; for_a++) {
+                    data_html += '<a href="/recent_change/1/' + option_list[for_a][0] + '">(' + option_list[for_a][1] + ')</a> ';
                 }
                 }
 
 
-                let doc_name = opennamu_do_url_encode(data[for_a][1]);
+                data_html += '<hr class="main_hr">'
 
 
-                data_html += '<div class="opennamu_recent_change">';
-                data_html += '<a href="/w/' + doc_name + '">' + opennamu_xss_filter(data[for_a][1]) + '</a> ';
+                for(let for_a = 0; for_a < data.length; for_a++) {
+                    if(data[for_a][6] !== "" && data[for_a][1] === "") {
+                        data_html += '<div class="opennamu_recent_change">----</div>';
+                        data_html += '<hr class="main_hr">';
 
 
-                data_html += '<div style="float: right;">';
+                        continue;
+                    }
 
 
-                data_html += '<span id="opennamu_list_recent_change_' + String(for_a) + '_over">';
-                data_html += '<a id="opennamu_list_recent_change_' + String(for_a) + '" href="javascript:void(0);">';
-                data_html += '⚒️'
-                data_html += '</a>';
-                data_html += '<span class="opennamu_popup_footnote" id="opennamu_list_recent_change_' + String(for_a) + '_load" style="display: none;"></span>';
-                data_html += '</span>';
-                data_html += ' | '
+                    let doc_name = opennamu_do_url_encode(data[for_a][1]);
 
 
-                if(data[for_a][6] !== "") {
-                    data_html += '<span style="color: red;">(r' + data[for_a][0] + ')</span> ';
-                } else {
-                    data_html += '(r' + data[for_a][0] + ') ';
-                }
-                
-                if(data[for_a][5] === '0') {
-                    data_html += '<span style="color: gray;">(' + data[for_a][5] + ')</span>';
-                } else if(data[for_a][5].match(/\+/)) {
-                    data_html += '<span style="color: green;">(' + data[for_a][5] + ')</span>';
-                } else {
-                    data_html += '<span style="color: red;">(' + data[for_a][5] + ')</span>';
-                }
-                data_html += ' | ';
-                
-                data_html += data[for_a][7] + ' | ';
-                data_html += data[for_a][2];
-                
-                data_html += '<span style="display: none;" id="opennamu_history_tool_' + String(for_a) + '"></span>';
-                
-                data_html += '</div>'
-                data_html += '<div style="clear: both;"></div>';
-
-                if(data[for_a][4] !== "") {
-                    data_html += '<hr>'
-                    data_html += opennamu_xss_filter(data[for_a][4]);
-                }
+                    data_html += '<div class="opennamu_recent_change">';
+                    data_html += '<a href="/w/' + doc_name + '">' + opennamu_xss_filter(data[for_a][1]) + '</a> ';
+
+                    data_html += '<div style="float: right;">';
+
+                    data_html += '<span id="opennamu_list_recent_change_' + String(for_a) + '_over">';
+                    data_html += '<a id="opennamu_list_recent_change_' + String(for_a) + '" href="javascript:void(0);">';
+                    data_html += '⚒️';
+                    data_html += '</a>';
+                    data_html += '<span class="opennamu_popup_footnote" id="opennamu_list_recent_change_' + String(for_a) + '_load" style="display: none;"></span>';
+                    data_html += '</span>';
+                    data_html += ' | '
+
+                    if(data[for_a][6] !== "") {
+                        data_html += '<span style="color: red;">r' + data[for_a][0] + '</span>';
+                    } else {
+                        data_html += 'r' + data[for_a][0];
+                    }
+                    data_html += ' | '
+                    
+                    if(data[for_a][5] === '0') {
+                        data_html += '<span style="color: gray;">' + data[for_a][5] + '</span>';
+                    } else if(data[for_a][5].match(/\+/)) {
+                        data_html += '<span style="color: green;">' + data[for_a][5] + '</span>';
+                    } else {
+                        data_html += '<span style="color: red;">' + data[for_a][5] + '</span>';
+                    }
+                    data_html += ' | ';
+                    
+                    data_html += data[for_a][7] + ' | ';
+                    data_html += data[for_a][2];
+                    
+                    data_html += '<span style="display: none;" id="opennamu_history_tool_' + String(for_a) + '">';
+
+                    data_html += '<a href="/raw_rev/' + data[for_a][0] + '/' + doc_name + '">' + lang[9] + '</a>';
+                    data_html += ' | <a href="/revert/' + data[for_a][0] + '/' + doc_name + '">' + lang[10] + ' (r' + data[for_a][0] + ')</a>';
+                    if(Number(data[for_a][0]) > 1) {
+                        let before_rev = String(Number(data[for_a][0]) - 1);
+                        data_html += ' | <a href="/revert/' + before_rev + '/' + doc_name + '">' + lang[10] + ' (r' + before_rev + ')</a>';
+                        data_html += ' | <a href="/diff/' + before_rev + '/' + data[for_a][0] + '/' + doc_name + '">' + lang[11] + '</a>';
+                    }
+                    data_html += ' | <a href="/history/' + doc_name + '">' + lang[12] + '</a>';
 
 
-                data_html += '</div>';
-                data_html += '<hr class="main_hr">';
-            }
+                    if(auth["owner"] === true || auth["hidel"] === true) {
+                        data_html += ' | <a href="/history_hidden/' + data[for_a][0] + '/' + doc_name + '">' + lang[13] + '</a>';
+                    }
 
 
-            document.getElementById('opennamu_list_recent_change').innerHTML = data_html;
+                    if(auth["owner"] === true) {
+                        data_html += ' | <a href="/history_delete/' + data[for_a][0] + '/' + doc_name + '">' + lang[14] + '</a>';
+                        data_html += ' | <a href="/history_send/' + data[for_a][0] + '/' + doc_name + '">' + lang[15] + '</a>';
+                    }
 
 
-            for(let for_a = 0; for_a < data.length; for_a++) {
-                if(data[for_a][6] !== "" && data[for_a][1] === "") {
-                    data_html += '<li>----</li>';
+                    data_html += '</span>';
+                    
+                    data_html += '</div>'
+                    data_html += '<div style="clear: both;"></div>';
 
 
-                    continue;
+                    if(data[for_a][4] !== "") {
+                        data_html += '<hr>'
+                        data_html += opennamu_send_render(opennamu_xss_filter(data[for_a][4]));
+                    }
+
+                    data_html += '</div>';
+                    data_html += '<hr class="main_hr">';
                 }
                 }
 
 
-                let doc_name = opennamu_do_url_encode(data[for_a][1]);
+                data_html += opennamu_page_control('/recent_change/{}/' + set_type, num, data.length);
+
+                document.getElementById('opennamu_list_recent_change').innerHTML = data_html;
 
 
-                fetch('/api/history_tool/' + data[for_a][0] + '/' + doc_name).then(function(res) {
-                    return res.json();
-                }).then(function(tool_list) {
-                    let tool_html = '';
-                    for(let for_b = 0; for_b < tool_list.length; for_b++) {
-                        tool_html += '<a href="' + tool_list[for_b][0] + '">' + tool_list[for_b][1] + '</a> | ';
+                for(let for_a = 0; for_a < data.length; for_a++) {
+                    if(data[for_a][6] !== "" && data[for_a][1] === "") {
+                        continue;
                     }
                     }
 
 
-                    tool_html = tool_html.replace(/ \| $/, '');
-                    
-                    document.getElementById('opennamu_history_tool_' + String(for_a)).innerHTML = tool_html;
-                    
-                    document.getElementById('opennamu_list_recent_change_' + String(for_a) + "_over").addEventListener("mouseenter", function() { opennamu_do_footnote_popover('opennamu_list_recent_change_' + String(for_a), '', 'opennamu_history_tool_' + String(for_a)); });
-                    document.getElementById('opennamu_list_recent_change_' + String(for_a) + "_over").addEventListener("mouseleave", function() { opennamu_do_footnote_popover('opennamu_list_recent_change_' + String(for_a), '', 'opennamu_history_tool_' + String(for_a)); });
-                });
-            }
+                    document.getElementById('opennamu_list_recent_change_' + String(for_a)).addEventListener("click", function() { opennamu_do_footnote_popover('opennamu_list_recent_change_' + String(for_a), '', 'opennamu_history_tool_' + String(for_a)); });
+                }
+            });
         });
         });
     });
     });
 }
 }

+ 8 - 2
views/main_css/js/route/list_recent_discuss.js

@@ -2,7 +2,7 @@
 
 
 function opennamu_list_recent_discuss(tool = 'normal') {
 function opennamu_list_recent_discuss(tool = 'normal') {
     let lang_data = new FormData();
     let lang_data = new FormData();
-    lang_data.append('data', 'tool normal close_discussion open_discussion_list')
+    lang_data.append('data', 'tool normal close_discussion open_discussion_list closed')
 
 
     fetch('/api/lang', {
     fetch('/api/lang', {
         method : 'post',
         method : 'post',
@@ -37,7 +37,13 @@ function opennamu_list_recent_discuss(tool = 'normal') {
 
 
                 data_html += '<div style="float: right;">';
                 data_html += '<div style="float: right;">';
 
 
-                data_html += data[for_a][6];
+                if(data[for_a][4] === 'O') {
+                    data_html += lang[4] + ' | ';
+                }
+
+                data_html += '<a href="/thread/' + data[for_a][3] + '#' + data[for_a][7] + '">#' + data[for_a][7] + '</a> | ';
+                data_html += data[for_a][6] + ' | ';
+                data_html += data[for_a][2];
 
 
                 data_html += '</div>';
                 data_html += '</div>';
                 data_html += '<div style="clear: both;"></div>';
                 data_html += '<div style="clear: both;"></div>';