Răsfoiți Sursa

Merge pull request #752 from 2du/master

버그 수정
잉여개발기 (SPDV) 6 ani în urmă
părinte
comite
f278316cab

+ 9 - 6
.github/ISSUE_TEMPLATE.md

@@ -1,10 +1,13 @@
 ## Environment (환경)
-OS :
-Python version :
-openNAMU version :
-Skin : 
-Skin version : 
+* OS :
+* Python version :
+* openNAMU version :
+* Skin : 
+* Skin version : 
+
+<!-- 무언가 작동 안할 때는 캐시 초기화를 먼저 해보세요. -->
+<!-- Try initializing the cache first when something isn't working. -->
 
 ## Explanation (설명)
 
-## Screenshot (스크린샷)
+## Screenshot (스크린샷)

+ 28 - 65
app.py

@@ -71,28 +71,33 @@ app.jinja_env.filters['cut_100'] = cut_100
 
 app.url_map.converters['everything'] = EverythingConverter
 
-curs.execute('create table if not exists data(test text)')
-curs.execute('create table if not exists cache_data(test text)')
-curs.execute('create table if not exists history(test text)')
-curs.execute('create table if not exists rd(test text)')
-curs.execute('create table if not exists user(test text)')
-curs.execute('create table if not exists user_set(test text)')
-curs.execute('create table if not exists ban(test text)')
-curs.execute('create table if not exists topic(test text)')
-curs.execute('create table if not exists rb(test text)')
-curs.execute('create table if not exists back(test text)')
-curs.execute('create table if not exists custom(test text)')
-curs.execute('create table if not exists other(test text)')
-curs.execute('create table if not exists alist(test text)')
-curs.execute('create table if not exists re_admin(test text)')
-curs.execute('create table if not exists alarm(test text)')
-curs.execute('create table if not exists ua_d(test text)')
-curs.execute('create table if not exists filter(test text)')
-curs.execute('create table if not exists scan(test text)')
-curs.execute('create table if not exists acl(test text)')
-curs.execute('create table if not exists inter(test text)')
-curs.execute('create table if not exists html_filter(test text)')
-curs.execute('create table if not exists oauth_conn(test text)')
+create_data = {}
+create_data['all_data'] = [
+    'data', 
+    'cache_data', 
+    'history', 
+    'rd', 
+    'user',
+    'user_set',
+    'ban', 
+    'topic', 
+    'rb', 
+    'back', 
+    'custom', 
+    'other', 
+    'alist', 
+    're_admin', 
+    'alarm', 
+    'ua_d', 
+    'filter', 
+    'scan', 
+    'acl', 
+    'inter', 
+    'html_filter',
+    'oauth_conn'
+]
+for i in create_data['all_data']:
+    curs.execute('create table if not exists ' + i + '(test longtext)')
 
 if setup_tool == 0:
     try:
@@ -107,32 +112,6 @@ if setup_tool == 0:
         setup_tool = 1
 
 if setup_tool != 0:
-    create_data = {}
-    create_data['all_data'] = [
-        'data', 
-        'cache_data', 
-        'history', 
-        'rd', 
-        'user',
-        'user_set',
-        'ban', 
-        'topic', 
-        'rb', 
-        'back', 
-        'custom', 
-        'other', 
-        'alist', 
-        're_admin', 
-        'alarm', 
-        'ua_d', 
-        'filter', 
-        'scan', 
-        'acl', 
-        'inter', 
-        'html_filter',
-        'oauth_conn'
-    ]
-
     create_data['data'] = ['title', 'data']
     create_data['cache_data'] = ['title', 'data']
     create_data['history'] = ['id', 'title', 'data', 'date', 'ip', 'send', 'leng', 'hide', 'type']
@@ -161,7 +140,7 @@ if setup_tool != 0:
             try:
                 curs.execute('select ' + create + ' from ' + create_table + ' limit 1')
             except:
-                curs.execute("alter table " + create_table + " add " + create + " text default ''")
+                curs.execute("alter table " + create_table + " add " + create + " longtext default ''")
 
     update()
 
@@ -263,22 +242,6 @@ if back_time != 0:
 else:
     print('Back up state : Turn off')
 
-curs.execute('select data from other where name = "s_ver"')
-ver_set_data = curs.fetchall()
-if not ver_set_data:
-    curs.execute('insert into other (name, data) values ("s_ver", ?)', [s_ver])
-
-    if setup_tool == 0:
-        print('----')
-        print('Skin update required')
-else:
-    if int(ver_set_data[0][0]) < int(s_ver):
-        curs.execute('delete from other where name = "s_ver"')
-        curs.execute('insert into other (name, data) values ("s_ver", ?)', [s_ver])
-
-        print('----')
-        print('Skin update required')
-
 conn.commit()
 
 def count_all_title():

+ 1 - 1
language/en-US.json

@@ -175,6 +175,7 @@
         "direct_input" : "Direct input",
         "acl_record" : "ACL record",
         "last_edit_time" : "Last edited time",
+        "admin_group" : "Admin group",
         "_comment_2.1_" : "Filter",
             "_comment_2.1.1_" : "List",
                 "interwiki_list" : "Interwiki(s) list",
@@ -253,7 +254,6 @@
                 "acl_document_list" : "ACL document(s) list",
                 "acl_required" : "Required ACL",
             "_comment_2.3.2_" : "ACL List",
-                "admin_group_add" : "Authorize Administrators Group",
                 "ban_authority" : "Block authority",
                 "discussion_authority" : "Discussion manage authority",
                 "user_check_authority" : "User check authority",

+ 1 - 1
language/ko-KR.json

@@ -158,7 +158,7 @@
     "admin": "관리자",
     "edit_filter_list": "편집 필터 목록",
     "wiki_skin": "위키 스킨",
-    "admin_group_add": "관리자 그룹 권한 부여",
+    "admin_group" : "관리자 그룹",
     "all": "전체",
     "skin_error": "이 스킨은 설정을 지원하지 않습니다.",
     "member": "가입자",

+ 1 - 1
readme-en.md

@@ -1,6 +1,6 @@
 openNAMU
 ====
-[![Python 3.5 or later Required](https://img.shields.io/badge/python-3.5%20or%20higher-blue.svg)](https://python.org)
+[![Up to Python 3.5](https://img.shields.io/badge/python->=%203.5-blue.svg)](https://python.org)
 [![LICENSE](https://img.shields.io/badge/license-BSD%203--Clause-lightgrey.svg)](./LICENSE)
 
 ![](https://raw.githubusercontent.com/2du/openNAMU/master/.github/logo.png)

+ 3 - 5
readme.md

@@ -1,6 +1,6 @@
 오픈나무
 ====
-[![Python 3.5 이상의 버전 필요](https://img.shields.io/badge/python-3.5%20or%20higher-blue.svg)](https://python.org)
+[![Python 3.5 이상](https://img.shields.io/badge/python->=%203.5-blue.svg)](https://python.org)
 [![라이선스](https://img.shields.io/badge/license-BSD%203--Clause-lightgrey.svg)](./LICENSE)
 
 ![](https://raw.githubusercontent.com/2du/openNAMU/master/.github/logo.png)
@@ -29,11 +29,9 @@
  * `git clone -b master https://github.com/2du/openNAMU.git`
 
 ## 기여
-오픈나무에는 검증되지 않은 몇가지 버그가 존재할 수 있습니다. 당신의 오픈나무 사용과 버그 발견은 오픈나무의 발전을 돕습니다.
-[이슈 생성하기](https://github.com/2du/openNAMU/issues/new)
+오픈나무에는 검증되지 않은 몇가지 버그가 존재할 수 있습니다. 당신의 오픈나무 사용과 버그 발견은 오픈나무의 발전을 돕습니다. [(이슈 생성하기)](https://github.com/2du/openNAMU/issues/new)
 
-오픈나무는 완전한 오픈소스 프로젝트입니다. 새로운 기능을 추가하고 Pull Request를 생성해보세요.
-[Pull Request 생성하기](https://github.com/2du/openNAMU/compare)
+오픈나무는 완전한 오픈소스 프로젝트입니다. 새로운 기능을 추가하고 Pull Request를 생성해보세요. [(Pull Request 생성하기)](https://github.com/2du/openNAMU/compare)
 
 ## 라이선스
 오픈나무 프로젝트는 [BSD 3-Clause License](./LICENSE)(이하 이용허락)의 보호를 받고 있으며, 오픈나무 프로젝트를 사용하고자 한다면 라이선스를 준수해야 합니다. 본 이용허락를 위반할 경우 개발자는 DMCA Takedown 등 관련 제재를 관계자에게 요청할 권리가 있으며, 그 책임은 모두 이용허락 위반 사용자에게 있습니다. 자세한 내용은 문서를 참고하세요.

+ 0 - 16
route/api_topic_sub.py

@@ -55,28 +55,12 @@ def api_topic_sub_2(conn, name, sub, time):
                     t_color = 'toron_color'
                     
                 ip = ip_pas(i[3])
-                plus_ip = ''
-                
-                curs.execute('select acl from user where id = ?', [i[3]])
-                u_acl = curs.fetchall()
-                if u_acl and u_acl[0][0] != 'user':
-                    plus_ip = '<b>' + i[3] + '</b>'
 
                 if admin == 1 or b_color != 'toron_color_grey':
                     ip += ' <a href="/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '/admin/' + i[0] + '">(' + load_lang('discussion_tool') + ')</a>'
-
-                curs.execute("select end from ban where block = ?", [i[3]])
-                if curs.fetchall():
-                    if plus_ip != '':
-                        plus_ip = '<s>' + plus_ip + '</s>'
-                    else:
-                        plus_ip = '<s>' + i[3] + '</s>'
                     
                 if t_data_f == '':
                     t_data_f = '[br]'
-                    
-                if plus_ip != '':
-                    ip = ip.replace('>' + i[3] + '<', '>' + plus_ip + '<')
             
                 all_data = '''
                     <table id="toron">

+ 1 - 0
route/give_acl.py

@@ -111,6 +111,7 @@ def give_acl_2(conn, name):
                 
             data += '''
                 </select>
+                <hr class=\"main_hr\">
                 <h2>''' + load_lang('explanation') + '''</h2>
                 <ul>
                     <li>normal : ''' + load_lang('default') + '''</li>

+ 20 - 13
route/give_admin_groups.py

@@ -61,25 +61,32 @@ def give_admin_groups_2(conn, name):
         else:
             state = ''
 
-        data += '''
-                <li><input type="checkbox" ''' + state +  ' name="ban" ' + exist_list[0] + '> ' + load_lang('ban_authority') + '''</li>
-                <li><input type="checkbox" ''' + state +  ' name="toron" ' + exist_list[2] + '> ' + load_lang('discussion_authority') + '''</li>
-                <li><input type="checkbox" ''' + state +  ' name="check" ' + exist_list[3] + '> ' + load_lang('user_check_authority') + '''</li>
-                <li><input type="checkbox" ''' + state +  ' name="acl" ' + exist_list[4] + '> ' + load_lang('document_acl_authority') + '''</li>
-                <li><input type="checkbox" ''' + state +  ' name="hidel" ' + exist_list[5] + '> ' + load_lang('history_hide_authority') + '''</li>
-                <li><input type="checkbox" ''' + state +  ' name="give" ' + exist_list[6] + '> ' + load_lang('authorization_authority') + '''</li>
-                <li><input type="checkbox" ''' + state +  ' name="owner" ' + exist_list[7] + '> ' + load_lang('owner_authority') + '''</li>
-            </ul>
-        '''
+        acl_name_list = ['ban', 'nothing', 'toron', 'check', 'acl', 'hidel', 'give', 'owner']
+        for i in range(0, 8):
+            if i != 2:
+                data += '<li><input type="checkbox" ''' + state +  ' name="' + acl_name_list[i] + '" ' + exist_list[i] + '> ' + acl_name_list[i] + '</li>'
+
+        data += '</ul>'
 
         return easy_minify(flask.render_template(skin_check(), 
-            imp = [load_lang('admin_group_add'), wiki_set(), custom(), other2([0, 0])],
+            imp = [name, wiki_set(), custom(), other2(['(' + load_lang('admin_group') + ')', 0])],
             data =  '''
                 <form method="post">
                     ''' + data + '''
                     <hr class=\"main_hr\">
-                    <button id="save" ''' + state +  ''' type="submit">''' + load_lang('save') + '''</button>
+                    <h2>''' + load_lang('explanation') + '''</h2>
+                    <ul>
+                        <li>ban : ''' + load_lang('ban_authority') + '''</li>
+                        <li>toron : ''' + load_lang('discussion_authority') + '''</li>
+                        <li>check : ''' + load_lang('user_check_authority') + '''</li>
+                        <li>acl : ''' + load_lang('document_acl_authority') + '''</li>
+                        <li>hidel : ''' + load_lang('history_hide_authority') + '''</li>
+                        <li>give : ''' + load_lang('authorization_authority') + '''</li>
+                        <li>owner : ''' + load_lang('owner_authority') + '''</li>
+                    </ul>
+                    <hr class=\"main_hr\">
+                    <button ''' + state +  ''' type="submit">''' + load_lang('save') + '''</button>
                 </form>
             ''',
-            menu = [['manager', load_lang('return')]]
+            menu = [['give_log', load_lang('return')]]
         ))     

+ 1 - 1
route/list_give.py

@@ -18,5 +18,5 @@ def list_give_2(conn):
     return easy_minify(flask.render_template(skin_check(), 
         imp = [load_lang('admin_group_list'), wiki_set(), custom(), other2([0, 0])],
         data = list_data,
-        menu = [['other', load_lang('return')]]
+        menu = [['manager', load_lang('return')]]
     ))    

+ 1 - 2
route/main_manager.py

@@ -31,12 +31,11 @@ def main_manager_2(conn, num, r_ver):
                         <li><a href="/ban">''' + load_lang('ban') + '''</a></li>
                         <li><a href="/manager/5">''' + load_lang('authorize') + '''</a></li>
                         <li><a href="/edit_filter">''' + load_lang('edit_filter_list') + '''</a></li>
-                        <li><a href="/give_log">''' + load_lang('admin_group_list') + '''</a></li>
                     </ul>
                     <br>
                     <h2>''' + load_lang('owner') + '''</h2>
                     <ul>
-                        <li><a href="/manager/8">''' + load_lang('admin_group_add') + '''</a></li>
+                        <li><a href="/give_log">''' + load_lang('admin_group_list') + '''</a></li>
                         <li><a href="/setting">''' + load_lang('setting') + '''</a></li>
                     </ul>
                     <h3>''' + load_lang('filter') + '''</h3>

+ 11 - 33
route/main_views.py

@@ -2,40 +2,18 @@ from .tool.func import *
 
 def main_views_2(conn, name):
     curs = conn.cursor()
-
-    m = re.search('\.([^.]+)$', name)
-    if m:
-        g = m.groups()
-    else:
-        g = ['']
-
-    if g[0] == 'css':
-        c_open = open('./views/' + name, encoding='utf-8')
-        f_open = c_open.read()
-        c_open.close()
-        return flask.Response(easy_minify(f_open, 'css'), mimetype = "text/css")
-    elif g[0] == 'js':
-        c_open = open('./views/' + name, encoding='utf-8')
-        f_open = c_open.read()
-        c_open.close()
-        return flask.Response(easy_minify(f_open, 'js'), mimetype = "text/js")
-    elif g[0] == 'html':
-        c_open = open('./views/' + name, encoding='utf-8')
-        f_open = c_open.read()
-        c_open.close()
-        return flask.Response(easy_minify(f_open), mimetype = "text/html")
-    else:
-        if re.search('\/', name):
-            m = re.search('^(.*)\/(.*)$', name)
-            if m:
-                n = m.groups()
-                plus = '/' + n[0]
-                rename = n[1]
-            else:
-                plus = ''
-                rename = name
+    
+    if re.search('\/', name):
+        m = re.search('^(.*)\/(.*)$', name)
+        if m:
+            n = m.groups()
+            plus = '/' + n[0]
+            rename = n[1]
         else:
             plus = ''
             rename = name
+    else:
+        plus = ''
+        rename = name
 
-        return flask.send_from_directory('./views' + plus, rename)
+    return flask.send_from_directory('./views' + plus, rename)

+ 29 - 4
route/tool/func.py

@@ -392,6 +392,7 @@ def other2(data):
     
     js_filter = {
         'load_include.js' : '2',
+        'render_html.js' : '2',
         'do_open_foot.js' : '4'
     }
     for i_data in os.listdir(os.path.join("views", "main_css", "js")):
@@ -528,8 +529,11 @@ def diff(seqm):
             
     return sub
            
-def admin_check(num = None, what = None):
-    ip = ip_check() 
+def admin_check(num = None, what = None, name = ''):
+    if name == '':
+        ip = ip_check()
+    else:
+        ip = name
 
     curs.execute("select acl from user where id = ?", [ip])
     user = curs.fetchall()
@@ -580,7 +584,7 @@ def admin_check(num = None, what = None):
 def ip_pas(raw_ip):
     hide = 0
 
-    if re.search("(\.|:)", raw_ip):    
+    if ip_or_user(raw_ip) != 0:    
         curs.execute("select data from other where name = 'ip_view'")
         data = curs.fetchall()
         if data and data[0][0] != '':
@@ -596,6 +600,12 @@ def ip_pas(raw_ip):
             ip = '<a href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
         else:
             ip = '<a id="not_thing" href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
+
+        if admin_check('all', None, raw_ip) == 1:
+            ip = '<b>' + ip + '</b>'
+
+    if ban_check(raw_ip) == 1:
+        ip = '<s>' + ip + '</s>'
          
     if hide == 0:
         ip += ' <a href="/tool/' + url_pas(raw_ip) + '">(' + load_lang('tool') + ')</a>'
@@ -634,8 +644,23 @@ def custom():
         
     if admin_check('all') == 1:
         user_admin = '1'
+
+        curs.execute("select acl from user where id = ?", [ip])
+        user_acl = curs.fetchall()
+
+        user_acl_list = []
+        curs.execute('select acl from alist where name = ?', [user_acl[0][0]])
+        user_acl = curs.fetchall()
+        for i in user_acl:
+            user_acl_list += [i[0]]
+
+        if user_acl != []:
+            user_acl_list = user_acl_list
+        else:
+            user_acl_list = '0'
     else:
         user_admin = '0'
+        user_acl_list = '0'
         
     if ban_check() == 1:
         user_ban = '1'
@@ -652,7 +677,7 @@ def custom():
     else:
         user_notice = '0'
 
-    return ['', '', user_icon, user_head, email, user_name, user_admin, user_ban, user_notice]
+    return ['', '', user_icon, user_head, email, user_name, user_admin, user_ban, user_notice, user_acl_list]
 
 def load_skin(data = '', set_n = 0):
     div2 = ''

+ 2 - 2
route/topic_admin.py

@@ -40,8 +40,8 @@ def topic_admin_2(conn, name, sub, num):
                     </a>
                 </li>
                 <li>
-                    <a href="/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '/b/' + str(num) + '">
-                    ''' + (load_lang('hide_release') if data[0][0] == 'O' else load_lang('hide')) + '''
+                    <a href="/topic/''' + url_pas(name) + '/sub/' + url_pas(sub) + '/b/' + str(num) + '''">
+                        ''' + (load_lang('hide_release') if data[0][0] == 'O' else load_lang('hide')) + '''
                     </a>
                 </li>
                 <li>

+ 4 - 4
version.json

@@ -1,11 +1,11 @@
 {
     "master" : {
-        "r_ver" : "v3.1.3-stable-01",
+        "r_ver" : "v3.1.3-stable-02",
         "c_ver" : "400003",
-        "s_ver" : "2"
+        "s_ver" : "3"
     }, "stable" : {
-        "r_ver" : "v3.1.3-stable-01",
+        "r_ver" : "v3.1.3-stable-02",
         "c_ver" : "400003",
-        "s_ver" : "2"
+        "s_ver" : "3"
     }
 }

+ 3 - 2
views/main_css/js/render_html.js

@@ -12,10 +12,11 @@ function render_html(name = '') {
             }
             
             src_list = {
-                'www.youtube.com' : '1'
+                'www.youtube.com' : '1',
+                'www.google.com' : '1'
             }
             data = data.replace(/&lt;iframe( (?:(?:(?!&gt;).)+))&gt;&lt;\/iframe&gt;/g, function(full, in_data) {
-                src_data = data.match(/ src=['"]https:\/\/([^/'"]+)(?:[^'"]+)['"](?: |$)/);
+                src_data = in_data.match(/ src=['"]https:\/\/([^/'"]+)(?:[^'"]+)['"](?: |$)/);
                 if(src_data) {
                     if(src_list[src_data[1]]) {
                         return '<iframe' + in_data + '></iframe>';