|
|
@@ -4,7 +4,6 @@ import sys
|
|
|
import platform
|
|
|
import orjson
|
|
|
import smtplib
|
|
|
-import random
|
|
|
import shutil
|
|
|
import datetime
|
|
|
import ipaddress
|
|
|
@@ -150,6 +149,9 @@ def python_to_golang_sync(func_name, other_set = {}):
|
|
|
|
|
|
time.sleep(0.01)
|
|
|
|
|
|
+ if data == '':
|
|
|
+ data = '{}'
|
|
|
+
|
|
|
return data
|
|
|
|
|
|
async def python_to_golang(func_name, other_set = {}):
|
|
|
@@ -190,6 +192,9 @@ async def python_to_golang(func_name, other_set = {}):
|
|
|
|
|
|
await asyncio.sleep(0.01)
|
|
|
|
|
|
+ if data == '':
|
|
|
+ data = '{}'
|
|
|
+
|
|
|
return data
|
|
|
|
|
|
# Func-init
|
|
|
@@ -741,6 +746,17 @@ def update(conn, ver_num, set_data):
|
|
|
if ver_num < 20240513:
|
|
|
curs.execute(db_change("update user_set set data = '☑️' where name = 'user_title' and data = '✅'"))
|
|
|
|
|
|
+ if ver_num < 20240732:
|
|
|
+ curs.execute(db_change("select distinct name from alist where acl = 'owner'"))
|
|
|
+ for for_a in curs.fetchall():
|
|
|
+ curs.execute(db_change("select distinct id from user_set where name = 'acl' and data = ?"), [for_a[0]])
|
|
|
+ for for_b in curs.fetchall():
|
|
|
+ lang_name = get_lang_name(conn, tool = 'inter')
|
|
|
+ if lang_name == 'ko-KR':
|
|
|
+ add_alarm(for_b[0], 'tool:system', '메인 ACL이 권한으로 개편되면서 기존 설정 값이 날라갔으니 권한으로 재설정 해주세요.')
|
|
|
+ else:
|
|
|
+ add_alarm(for_b[0], 'tool:system', 'As the main ACL has been reorganized into the auth, the existing setting values have been lost, so please reset it to the auth.')
|
|
|
+
|
|
|
print('Update completed')
|
|
|
|
|
|
def set_init_always(conn, ver_num, run_mode):
|
|
|
@@ -756,14 +772,17 @@ def set_init_always(conn, ver_num, run_mode):
|
|
|
curs.execute(db_change('delete from alist where name = "owner"'))
|
|
|
curs.execute(db_change('insert into alist (name, acl) values ("owner", "owner")'))
|
|
|
|
|
|
- curs.execute(db_change('delete from alist where name = "user"'))
|
|
|
- curs.execute(db_change('insert into alist (name, acl) values ("user", "user")'))
|
|
|
+ curs.execute(db_change("select name from alist where name = 'user' limit 1"))
|
|
|
+ if not curs.fetchall():
|
|
|
+ curs.execute(db_change('insert into alist (name, acl) values ("user", "user")'))
|
|
|
|
|
|
- curs.execute(db_change('delete from alist where name = "ip"'))
|
|
|
- curs.execute(db_change('insert into alist (name, acl) values ("ip", "ip")'))
|
|
|
+ curs.execute(db_change("select name from alist where name = 'ip' limit 1"))
|
|
|
+ if not curs.fetchall():
|
|
|
+ curs.execute(db_change('insert into alist (name, acl) values ("ip", "ip")'))
|
|
|
|
|
|
- curs.execute(db_change('delete from alist where name = "ban"'))
|
|
|
- curs.execute(db_change('insert into alist (name, acl) values ("ban", "view")'))
|
|
|
+ curs.execute(db_change("select name from alist where name = 'ban' limit 1"))
|
|
|
+ if not curs.fetchall():
|
|
|
+ curs.execute(db_change('insert into alist (name, acl) values ("ban", "view")'))
|
|
|
|
|
|
# 이미지 폴더 없으면 생성
|
|
|
if not os.path.exists(load_image_url(conn)):
|
|
|
@@ -793,6 +812,11 @@ def set_init_always(conn, ver_num, run_mode):
|
|
|
if db_data:
|
|
|
m_curs.execute('insert into temp (name, data) values ("wiki_access_password", ?)', [db_data[0][0]])
|
|
|
|
|
|
+ curs.execute(db_change('select data from other where name = "load_ip_select"'))
|
|
|
+ db_data = curs.fetchall()
|
|
|
+ if db_data and db_data[0][0] != '':
|
|
|
+ m_curs.execute('insert into temp (name, data) values ("load_ip_select", ?)', [db_data[0][0]])
|
|
|
+
|
|
|
# OS마다 실행 파일 설정
|
|
|
exe_type = linux_exe_chmod()
|
|
|
if run_mode == '':
|
|
|
@@ -941,7 +965,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"]
|
|
|
@@ -1132,11 +1156,10 @@ def pw_check(conn, data, data2, type_d = 'no', id_d = ''):
|
|
|
def easy_minify(conn, data, tool = None):
|
|
|
return data
|
|
|
|
|
|
-def get_lang(conn, data, safe = 0):
|
|
|
- with class_temp_db() as m_conn:
|
|
|
- m_curs = m_conn.cursor()
|
|
|
- curs = conn.cursor()
|
|
|
+def get_lang_name(conn, tool = ''):
|
|
|
+ curs = conn.cursor()
|
|
|
|
|
|
+ if tool != 'inter':
|
|
|
ip = ip_check()
|
|
|
if ip_or_user(ip) == 0:
|
|
|
curs.execute(db_change('select data from user_set where name = "lang" and id = ?'), [ip])
|
|
|
@@ -1146,16 +1169,27 @@ def get_lang(conn, data, safe = 0):
|
|
|
else:
|
|
|
curs.execute(db_change("select data from other where name = 'language'"))
|
|
|
rep_data = curs.fetchall()
|
|
|
+ else:
|
|
|
+ curs.execute(db_change("select data from other where name = 'language'"))
|
|
|
+ rep_data = curs.fetchall()
|
|
|
|
|
|
- if not rep_data or rep_data[0][0] in ('', 'default'):
|
|
|
- curs.execute(db_change("select data from other where name = 'language'"))
|
|
|
- rep_data = curs.fetchall()
|
|
|
+ if not rep_data or rep_data[0][0] in ('', 'default'):
|
|
|
+ curs.execute(db_change("select data from other where name = 'language'"))
|
|
|
+ rep_data = curs.fetchall()
|
|
|
|
|
|
- if rep_data:
|
|
|
- lang_name = rep_data[0][0]
|
|
|
- else:
|
|
|
- lang_name = 'en-US'
|
|
|
-
|
|
|
+ if rep_data:
|
|
|
+ lang_name = rep_data[0][0]
|
|
|
+ else:
|
|
|
+ lang_name = 'en-US'
|
|
|
+
|
|
|
+ return lang_name
|
|
|
+
|
|
|
+def get_lang(conn, data, safe = 0):
|
|
|
+ with class_temp_db() as m_conn:
|
|
|
+ m_curs = m_conn.cursor()
|
|
|
+
|
|
|
+ lang_name = get_lang_name(conn)
|
|
|
+
|
|
|
m_curs.execute('select data from temp where name = ?', ['lang_' + lang_name + '_' + data])
|
|
|
db_data = m_curs.fetchall()
|
|
|
if db_data:
|
|
|
@@ -1222,7 +1256,7 @@ def skin_check(conn, set_n = 0):
|
|
|
return skin
|
|
|
|
|
|
def cache_v():
|
|
|
- return '.cache_v270'
|
|
|
+ return '.cache_v274'
|
|
|
|
|
|
def wiki_css(data):
|
|
|
with class_temp_db() as m_conn:
|
|
|
@@ -2052,7 +2086,7 @@ def do_edit_filter(conn, data):
|
|
|
curs = conn.cursor()
|
|
|
|
|
|
ip = ip_check()
|
|
|
- if acl_check(tool = 'ban_auth') == 1:
|
|
|
+ if acl_check(tool = 'edit_filter_pass') == 1:
|
|
|
curs.execute(db_change("select plus, plus_t from html_filter where kind = 'regex_filter' and plus != ''"))
|
|
|
for data_list in curs.fetchall():
|
|
|
match = re.compile(data_list[0], re.I)
|
|
|
@@ -2132,20 +2166,14 @@ def do_reload_recent_thread(conn, topic_num, date, name = None, sub = None):
|
|
|
else:
|
|
|
curs.execute(db_change("insert into rd (title, sub, code, date, band, stop, agree, acl) values (?, ?, ?, ?, '', '', '', '')"), [name, sub, topic_num, date])
|
|
|
|
|
|
-def add_alarm(conn, to_user, from_user, context):
|
|
|
- curs = conn.cursor()
|
|
|
-
|
|
|
- if to_user != from_user:
|
|
|
- context = from_user + ' | ' + context
|
|
|
+def add_alarm(to_user, from_user, context):
|
|
|
+ other_set = {}
|
|
|
+ other_set['to'] = to_user
|
|
|
+ other_set['from'] = from_user
|
|
|
+ other_set['data'] = context
|
|
|
|
|
|
- count = '1'
|
|
|
- curs.execute(db_change("select id from user_notice where name = ? order by id + 0 desc"), [to_user])
|
|
|
- db_data = curs.fetchall()
|
|
|
- if db_data:
|
|
|
- count = str(int(db_data[0][0]) + 1)
|
|
|
+ python_to_golang_sync('api_func_alarm_post', other_set)
|
|
|
|
|
|
- curs.execute(db_change('insert into user_notice (id, name, data, date, readme) values (?, ?, ?, ?, "")'), [count, to_user, context, get_time()])
|
|
|
-
|
|
|
def add_user(conn, user_name, user_pw, user_email = '', user_encode = ''):
|
|
|
curs = conn.cursor()
|
|
|
|
|
|
@@ -2294,7 +2322,7 @@ def history_plus(conn, title, data, date, ip, send, leng, t_check = '', mode = '
|
|
|
def re_error(conn, data):
|
|
|
curs = conn.cursor()
|
|
|
|
|
|
- if data == '/ban':
|
|
|
+ if data == 0:
|
|
|
if ban_check()[0] == 1:
|
|
|
end = '<div id="opennamu_get_user_info">' + html.escape(ip_check()) + '</div>'
|
|
|
else:
|
|
|
@@ -2310,7 +2338,7 @@ def re_error(conn, data):
|
|
|
sub_title = title
|
|
|
return_code = 400
|
|
|
|
|
|
- num = int(number_check(data.replace('/error/', '')))
|
|
|
+ num = data
|
|
|
if num == 1:
|
|
|
data = get_lang(conn, 'no_login_error')
|
|
|
elif num == 2:
|
|
|
@@ -2427,6 +2455,10 @@ def re_error(conn, data):
|
|
|
data = get_lang(conn, 'func_404_error')
|
|
|
title = '404'
|
|
|
return_code = 404
|
|
|
+ elif num == 47:
|
|
|
+ data = get_lang(conn, 'still_use_auth_error')
|
|
|
+ elif num == 48:
|
|
|
+ data = get_lang(conn, 'xss_data_include_error')
|
|
|
else:
|
|
|
data = '???'
|
|
|
|