잉여개발기 (SPDV) 3 лет назад
Родитель
Сommit
9d41a94ea5

+ 2 - 3
app.py

@@ -327,9 +327,8 @@ def list_please():
     return list_please_2()
 
 # /list/document/all
-@app.route('/title_index')
-def list_title_index():
-    return list_title_index_2()
+app.route('/list/document/all')(list_title_index)
+app.route('/list/document/all/<int:num>')(list_title_index)
 
 # /list/document/long
 @app.route('/long_page')

+ 2 - 0
lang/en-US.json

@@ -231,6 +231,8 @@
         "dont_move" : "Don't move",
         "file_delete" : "File delete",
         "added_menu" : "Added menu",
+        "document_set" : "Document settings",
+        "move_redirect_make" : "Redirect document generation (Only if possible)",
         "_comment_" : "Edit",
             "load" : "Load another document",
             "turn_off_monaco" : "Turn off monaco editor",

+ 3 - 1
lang/ko-KR.json

@@ -516,5 +516,7 @@
     "force_darkmode": "강제 다크모드",
     "font_size": "글자 크기",
     "image_paste": "이미지 붙여넣기 (컨트롤 C + V로)",
-    "monaco_editor": "모나코 에디터"
+    "monaco_editor": "모나코 에디터",
+    "document_set" : "문서 설정",
+    "move_redirect_make" : "리다이렉트 문서 생성 (가능한 경우에만)"
 }

+ 1 - 1
route/edit_delete_multiple.py

@@ -23,7 +23,7 @@ def edit_delete_multiple():
             for name in all_title:
                 edit_delete.edit_delete(name)
 
-            return redirect('/recent_changes')
+            return redirect('/recent_change')
         else:
             return easy_minify(flask.render_template(skin_check(),
                 imp = [load_lang('many_delete'), wiki_set(), wiki_custom(), wiki_css([0, 0])],

+ 72 - 6
route/edit_move.py

@@ -25,10 +25,15 @@ def edit_move(name):
             
             send = flask.request.form.get('send', '')
             agree = flask.request.form.get('copyright_agreement', '')
+
             time = get_time()
             ip = ip_check()
-            move_option = flask.request.form.get('move_option', 'none')
+            
             has_error = 0
+
+            move_option = flask.request.form.get('move_option', 'none')
+            move_option_topic = flask.request.form.get('move_topic_option', 'none')
+            document_set_option = flask.request.form.get('document_set_option', 'none')
             
             if do_edit_send_check(send) == 1:
                 return re_error('/error/37')
@@ -169,8 +174,6 @@ def edit_move(name):
             # 문서 이동 파트 E
             
             # 토론 이동 파트 S
-            
-            move_option_topic = flask.request.form.get('move_topic_option', 'none')
             if (
                 move_option_topic == 'merge' and
                 admin_check(None, 'merge document\'s topics (' + name + ') (' + move_title + ')') == 1
@@ -197,6 +200,54 @@ def edit_move(name):
                     curs.execute(db_change("update rd set title = ? where title = ?"), [move_title, name])
 
             # 토론 이동 파트 E
+
+            # data_set 이동 파트 S
+            if document_set_option == 'reverse':
+                i = 0
+                var_name = ''
+                while var_name == '':
+                    curs.execute(db_change("select title from rd where title = ?"), ['test ' + str(i)])
+                    if not curs.fetchall():
+                        var_name = 'test ' + str(i)
+                    else:
+                        i += 1
+                
+                # create_data['data_set'] = ['doc_name', 'doc_rev', 'set_name', 'set_data']
+                # create_data['acl'] = ['title', 'data', 'type']
+                curs.execute(db_change("update data_set set doc_name = ? where doc_name = ?"), [var_name, move_title])
+                curs.execute(db_change("update data_set set doc_name = ? where doc_name = ?"), [move_title, name])
+                curs.execute(db_change("update data_set set doc_name = ? where doc_name = ?"), [name, var_name])
+
+                curs.execute(db_change("update acl set title = ? where title = ?"), [var_name, move_title])
+                curs.execute(db_change("update acl set title = ? where title = ?"), [move_title, name])
+                curs.execute(db_change("update acl set title = ? where title = ?"), [name, var_name])
+            elif document_set_option == 'normal':
+                curs.execute(db_change("delete from data_set where doc_name = ?"), [move_title])
+                curs.execute(db_change("update data_set set doc_name = ? where doc_name = ?"), [move_title, name])
+
+                curs.execute(db_change("delete from acl where title = ?"), [move_title])
+                curs.execute(db_change("update acl set title = ? where title = ?"), [move_title, name])
+
+            if document_set_option != 'reverse':
+                curs.execute(db_change("select data from data where title = ?"), [name])
+                db_data = curs.fetchall()
+                if db_data:
+                    render_set(
+                        doc_name = name,
+                        doc_data = db_data[0][0],
+                        data_type = 'backlink'
+                    )
+
+                curs.execute(db_change("select data from data where title = ?"), [move_title])
+                db_data = curs.fetchall()
+                if db_data:
+                    render_set(
+                        doc_name = move_title,
+                        doc_data = db_data[0][0],
+                        data_type = 'backlink'
+                    )
+
+            # data_set 이동 파트 E
                 
             conn.commit()
 
@@ -205,6 +256,8 @@ def edit_move(name):
             else:
                 return re_error('/error/19')
         else:
+            owner_auth = admin_check()
+
             return easy_minify(flask.render_template(skin_check(),
                 imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
                 data = '''
@@ -222,19 +275,32 @@ def edit_move(name):
                             <option value="none"> ''' + load_lang('dont_move') + '''</option>
                             <option value="normal"> ''' + load_lang('normal') + '''</option>
                             <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
-                            ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if admin_check() == 1 else '') + '''
+                            ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if owner_auth == 1 else '') + '''
                         </select>
                         <hr class="main_hr">
+                        <!-- <input type="checkbox" name="move_redirect_make"> ''' + load_lang('move_redirect_make') + '''
+                        <hr class="main_hr"> -->
                         
                         <h2>''' + load_lang('discussion') + '''</h2>
                         <select name="move_topic_option">
                             <option value="none"> ''' + load_lang('dont_move') + '''</option>
                             <option value="normal"> ''' + load_lang('normal') + '''</option>
                             <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
-                            ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if admin_check() == 1 else '') + '''
+                            ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if owner_auth == 1 else '') + '''
                         </select>
                         <hr class="main_hr">
-                        
+
+                        ''' + ((
+                            '''<h2>''' + load_lang('document_set') + '''</h2>
+                            <select name="document_set_option">
+                                <option value="none"> ''' + load_lang('dont_move') + '''</option>
+                                <option value="normal"> ''' + load_lang('normal') + '''</option>
+                                <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
+                            </select>
+                            <hr class="main_hr">
+                            '''
+                        ) if owner_auth == 1 else '') + '''
+
                         ''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
                         
                         <button type="submit">''' + load_lang('move') + '''</button>

+ 3 - 1
route/edit_upload.py

@@ -91,7 +91,9 @@ def edit_upload():
                     ''
 
                 curs.execute(db_change("insert into data (title, data) values (?, ?)"), ['file:' + name, file_d])
-                curs.execute(db_change("insert into acl (title, data, type) values (?, 'admin', 'decu')"), ['file:' + name])
+
+                curs.execute(db_change('select data from other where name = "count_all_title"'))
+                curs.execute(db_change("update other set data = ? where name = 'count_all_title'"), [str(int(curs.fetchall()[0][0]) + 1)])
 
                 render_set(
                     doc_name = 'file:' + name,

+ 1 - 1
route/give_acl.py

@@ -73,7 +73,7 @@ def give_acl_2(name):
                     name, markup_data
                 ])
 
-            if db_data[0][0] != markup_data:
+            if not db_data or db_data[0][0] != markup_data:
                 curs.execute(db_change("select data from data where title = ?"), [name])
                 db_data_2 = curs.fetchall()
                 if db_data_2:

+ 1 - 1
route/list_old_page.py

@@ -12,7 +12,7 @@ def list_old_page(num = 1):
         
         div = '<ul class="opennamu_ul">'
         
-        curs.execute(db_change("select doc_name, set_data from data_set where set_name = 'last_edit' order by set_data asc"))
+        curs.execute(db_change("select doc_name, set_data from data_set where set_name = 'last_edit' and doc_rev = '' order by set_data asc limit ?, 50"), [sql_num])
         n_list = curs.fetchall()
         for data in n_list:
             div += '<li>' + data[1] + ' | <a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'

+ 6 - 12
route/list_title_index.py

@@ -1,21 +1,15 @@
 from .tool.func import *
 
-def list_title_index_2():
+def list_title_index(num = 1):
     with get_db_connect() as conn:
         curs = conn.cursor()
 
-        page = int(number_check(flask.request.args.get('page', '1')))
-        num = int(number_check(flask.request.args.get('num', '100')))
-        sql_num = (page * num - num) if page * num > 0 else 0
+        sql_num = (num * 50 - 50) if num * 50 > 0 else 0
 
         all_list = sql_num + 1
+        data = ''
 
-        if num > 1000:
-            return re_error('/error/3')
-
-        data = '<a href="/title_index?num=250">(250)</a> <a href="/title_index?num=500">(500)</a> <a href="/title_index?num=1000">(1000)</a>'
-
-        curs.execute(db_change("select title from data order by title asc limit ?, ?"), [sql_num, num])
+        curs.execute(db_change("select title from data asc limit ?, 50"), [sql_num])
         title_list = curs.fetchall()
         if title_list:
             data += '<hr class="main_hr"><ul class="opennamu_ul">'
@@ -24,7 +18,7 @@ def list_title_index_2():
             data += '<li>' + str(all_list) + '. <a href="/w/' + url_pas(list_data[0]) + '">' + html.escape(list_data[0]) + '</a></li>'
             all_list += 1
 
-        if page == 1:
+        if num == 1:
             count_end = []
 
             curs.execute(db_change('select data from other where name = "count_all_title"'))
@@ -61,7 +55,7 @@ def list_title_index_2():
                         <li>''' + load_lang('all') + ' : ' + all_title[0][0] + '''</li>
                 '''
 
-        data += '</ul>' + next_fix('/title_index?num=' + str(num) + '&page=', page, title_list, num)
+        data += '</ul>' + next_fix('/list/document/all/', num, title_list, num)
         sub = ' (' + str(num) + ')'
 
         return easy_minify(flask.render_template(skin_check(),

+ 13 - 9
route/main_func_easter_egg.py

@@ -6,14 +6,18 @@ def main_func_easter_egg():
         
         random_n = random.randrange(0, 8)
         select_list = [
-            'https://www.youtube.com/embed/PWD0ZbR7AOY', # TH06   - Shanghai Teahouse ~ Chinese Tea
-            'https://www.youtube.com/embed/HoU29ljOmTE', # TH10.5 - Flawless Clothing of Celestials
-            'https://www.youtube.com/embed/PR2vUm-Ald8', # TH06   - U.N. Owen Was Her
-            'https://www.youtube.com/embed/opZoEmsu_Lo', # TH09   - Flowering Night
-            'https://www.youtube.com/embed/txZFFTusSvw', # TH08   - Reach for the Moon ~ Immortal Smoke
-            'https://www.youtube.com/embed/Ixq9xL2tvRU', # TH07   - Phantom Ensemble
-            'https://www.youtube.com/embed/-3IAx_r4Au0', # TH17   - Entrusting This World to Idols ~ Idolatrize World
-            'https://www.youtube.com/embed/wObZkycA6sc', # TH11   - Last Remote
+            'PWD0ZbR7AOY', # TH06   - Shanghai Teahouse ~ Chinese Tea
+            'HoU29ljOmTE', # TH10.5 - Flawless Clothing of Celestials
+            'PR2vUm-Ald8', # TH06   - U.N. Owen Was Her
+            'opZoEmsu_Lo', # TH09   - Flowering Night
+            'txZFFTusSvw', # TH08   - Reach for the Moon ~ Immortal Smoke
+            'Ixq9xL2tvRU', # TH07   - Phantom Ensemble
+            '-3IAx_r4Au0', # TH17   - Entrusting This World to Idols ~ Idolatrize World
+            'wObZkycA6sc', # TH11   - Last Remote
+            'hZxYLa97gDg', # TH12   - Emotional Skyscraper ~ Cosmic Mind
+            'hwn2kw4eFJM', # TH07   - Border of Life
+            'wX2t_8HOtiY', # TH08   - Voyage 1969
+            'tLQjcf45fKE', # TH07   - Necrofantasia
             # Remix by NyxTheShield
         ]
 
@@ -26,6 +30,6 @@ def main_func_easter_egg():
 
         return easy_minify(flask.render_template(skin_check(),
             imp = ['Easter Egg', wiki_set(), wiki_custom(), wiki_css([0, 0])],
-            data = '<iframe width="640" height="360" src="' + select_list[random_n] + '" frameborder="0" allowfullscreen></iframe>',
+            data = '<iframe width="640" height="360" src="https://www.youtube.com/embed/' + select_list[random_n] + '" frameborder="0" allowfullscreen></iframe>',
             menu = [['manager', load_lang('return')]]
         ))

+ 2 - 2
route/main_tool_other.py

@@ -22,8 +22,8 @@ def main_tool_other():
                 </ul>
                 <h3>''' + load_lang('document') + '''</h3>
                 <ul class="opennamu_ul">
-                    <li><a href="/recent_changes">''' + load_lang('recent_change') + '''</a></li>
-                    <li><a href="/title_index">''' + load_lang('all_document_list') + '''</a></li>
+                    <li><a href="/recent_change">''' + load_lang('recent_change') + '''</a></li>
+                    <li><a href="/list/document/all">''' + load_lang('all_document_list') + '''</a></li>
                     <li><a href="/acl_list">''' + load_lang('acl_document_list') + '''</a></li>
                     <li><a href="/please">''' + load_lang('need_document') + '''</a></li>
                     <li><a href="/long_page">''' + load_lang('long_page') + '''</a></li>

+ 18 - 3
route/tool/func.py

@@ -639,10 +639,12 @@ def update(ver_num, set_data):
         curs.execute(db_change("drop index history_index"))
         curs.execute(db_change("create index history_index on history (title, ip)"))
 
-    if ver_num < 3500359:
+    if ver_num < 3500360:
         # 마지막 편집 따로 기록하도록
         # create_data['data_set'] = ['doc_name', 'doc_rev', 'set_name', 'set_data']
-        print("Update 3500359...")
+        print("Update 3500360...")
+
+        curs.execute(db_change('delete from data_set where set_name = "last_edit"'))
 
         curs.execute(db_change("select title from data"))
         db_data = curs.fetchall()
@@ -652,7 +654,11 @@ def update(ver_num, set_data):
             if db_data_2:
                 curs.execute(db_change("insert into data_set (doc_name, doc_rev, set_name, set_data) values (?, '', 'last_edit', ?)"), [for_a[0], db_data_2[0][0]])
 
-        print("Update 3500359 complete")
+        curs.execute(db_change(
+            'delete from acl where title like "file:%" and data = "admin" and type like "decu%"'
+        ))
+
+        print("Update 3500360 complete")
 
     conn.commit()
     
@@ -2435,6 +2441,15 @@ def history_plus(title, data, date, ip, send, leng, t_check = '', mode = ''):
         mode
     ])
 
+    data_set_exist = '' if t_check != 'delete' else '1'
+
+    curs.execute(db_change("select doc_name from data_set where doc_name = ? and set_name = 'last_edit'"), [title])
+    db_data = curs.fetchall()
+    if db_data:
+        curs.execute(db_change("update data_set set set_data = ?, doc_rev = ? where doc_name = ? and set_name = 'last_edit'"), [date, data_set_exist, title])
+    else:
+        curs.execute(db_change("insert into data_set (doc_name, doc_rev, set_name, set_data) values (?, ?, 'last_edit', ?)"), [title, data_set_exist, date])
+
 # Func-error
 def re_error(data):
     curs = conn.cursor()

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC3-dev138",
-        "c_ver" : "3500359",
+        "r_ver" : "v3.4.6-RC3-dev139",
+        "c_ver" : "3500360",
         "s_ver" : "3500111"
     }
 }