Selaa lähdekoodia

Merge pull request #2613 from openNAMU/tmp

버그 수정
잉여개발기 3 kuukautta sitten
vanhempi
sitoutus
ad25616cf1

+ 5 - 3
app.py

@@ -186,7 +186,7 @@ with get_db_connect(init_mode = True) as conn:
 
     app.config['JSON_AS_ASCII'] = False
     app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False
-    app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 3600
+    app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 4233600
     if run_mode == 'dev':
         app.config['TEMPLATES_AUTO_RELOAD'] = True
         app.config['DEBUG'] = True
@@ -752,8 +752,10 @@ app.route('/move/<everything:name>', methods = ['POST', 'GET'])(edit_move)
 app.route('/move_all')(edit_move_all)
 
 # Func-topic
-app.route('/topic/<everything:name>', methods = ['POST', 'GET'])(topic_list)
-app.route('/topic_page/<int:page>/<everything:name>', methods = ['POST', 'GET'])(topic_list)
+app.route('/topic/<everything:name>')(golang_view())
+app.route('/topic_page/<int:page>/<everything:name>')(golang_view())
+app.route('/topic_close/<int:page>/<everything:name>')(golang_view())
+app.route('/topic_agree/<int:page>/<everything:name>')(golang_view())
 
 app.route('/thread/<int:topic_num>', methods = ['POST', 'GET'])(topic)
 app.route('/thread/0/<everything:doc_name>', defaults = { 'topic_num' : '0' }, methods = ['POST', 'GET'])(topic)

+ 0 - 2
route/__init__.py

@@ -149,8 +149,6 @@ from route.vote_select import vote_select
 
 from route.n_list_user_check_submit import list_user_check_submit
 
-from route.n_topic_list import topic_list
-
 from route.n_give_auth import give_auth
 
 from route.n_bbs_w_set import bbs_w_set

+ 0 - 13
route/n_topic_list.py

@@ -1,13 +0,0 @@
-from .tool.func import *
-
-async def topic_list(page = 1, name = 'Test'):
-    return await render_template(
-        name,
-        '' + \
-            '<div id="opennamu_topic_list"></div>' + \
-            '<script defer src="/views/main_css/js/route/topic_list.js' + cache_v() + '"></script>' + \
-            '<script>window.addEventListener("DOMContentLoaded", function() { opennamu_topic_list(); });</script>' + \
-        '',
-        '(' + await get_lang('discussion_list') + ')',
-        [['w/' + url_pas(name), await get_lang('document')]]
-    )

+ 12 - 0
route/tool/func_render_namumark.py

@@ -602,6 +602,14 @@ class class_do_render_namumark:
                     video_code = 'https://tv.naver.com/embed/' + video_code
                 elif name_data == 'nicovideo':
                     video_code = 'https://embed.nicovideo.jp/watch/' + video_code
+                elif name_data == 'twitter':
+                    video_code = video_code.strip()
+                    video_code = re.sub(r'^https?://(www\.)?x\.com/', 'https://twitter.com/', video_code)
+
+                    if re.match(r'^https?:\/\/(www\.)?twitter\.com\/', video_code):
+                        pass
+                    else:
+                        video_code = ''
                 else:
                     video_code = 'https://player.vimeo.com/video/' + video_code
 
@@ -614,6 +622,10 @@ class class_do_render_namumark:
                         '</blockquote>',
                         match_org.group(0)
                     )
+
+                    self.render_data_js += '''
+                        window.twttr && window.twttr.widgets && window.twttr.widgets.load(document.body);\n
+                    '''
                 else:
                     data_name = self.get_tool_data_storage(
                         '<iframe style="width: ' + video_width + '; height: ' + video_height + ';" src="' + video_code + '" frameborder="0" allowfullscreen>',

+ 0 - 45
route/topic_list.py

@@ -1,45 +0,0 @@
-from .tool.func import *
-
-async def topic_list(name = 'Test'):
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        div = ''
-        tool = flask.request.args.get('tool', '')
-
-        plus = ''
-        menu = [['topic/' + url_pas(name), await get_lang('return')]]
-
-        if tool == 'close':
-            curs.execute(db_change("select code, sub from rd where title = ? and stop = 'O' order by sub asc"), [name])
-
-            sub = await get_lang('closed_discussion')
-        elif tool == 'agree':
-            curs.execute(db_change("select code, sub from rd where title = ? and agree = 'O' order by sub asc"), [name])
-
-            sub = await get_lang('agreed_discussion')
-        else:
-            sub = await get_lang('discussion_list')
-            menu = [['w/' + url_pas(name), await get_lang('document')]]
-
-            plus = '''
-                <a href="/topic/''' + url_pas(name) + '?tool=close">(' + await get_lang('closed_discussion') + ''')</a>
-                <a href="/topic/''' + url_pas(name) + '?tool=agree">(' + await get_lang('agreed_discussion') + ''')</a>
-                <hr class="main_hr">
-                <a href="/thread/0/''' + url_pas(name) + '''">(''' + await get_lang('make_new_topic') + ''')</a>
-            '''
-
-            curs.execute(db_change("select code, sub from rd where title = ? and stop != 'O' order by date desc"), [name])
-
-        for data in curs.fetchall():
-            div += '<h2><a href="/thread/' + data[0] + '">' + data[0] + '. ' + html.escape(data[1]) + '</a></h2>'
-
-        if div == '':
-            plus = re.sub(r'^<br>', '', plus)
-
-        return await render_template(
-            name,
-            div + plus,
-            '(' + sub + ')',
-            menu
-        )

+ 2 - 0
route/view_w.py

@@ -362,6 +362,8 @@ async def view_w(name = 'Test', do_type = '', doc_rev = ''):
         other_set = {}
         other_set['doc_name'] = name
 
+        div += '<div class="opennamu_clearfix"></div>'
+
         comment_api = await python_to_golang("api_w_comment", other_set = other_set)
         comment = comment_api['data']
 

+ 2 - 2
version.json

@@ -1,6 +1,6 @@
 {
-    "r_ver" : "v3.6.0-Beta-v50",
-    "c_ver" : "20250523",
+    "r_ver" : "v3.6.0-Beta-v52",
+    "c_ver" : "20250524",
     "s_ver" : "20240426",
     "bin_link" : "https://github.com/openNAMU/GopenNAMU/releases/download/v2025-12-07-Beta-v10/"
 }

+ 4 - 0
views/main_css/css/main.css

@@ -518,4 +518,8 @@
     padding: 20px;
 
     border: 1px solid gainsboro;
+}
+
+.opennamu_main .opennamu_clearfix {
+    clear: both;
 }

+ 0 - 71
views/main_css/js/route/topic_list.js

@@ -1,71 +0,0 @@
-"use strict";
-
-function opennamu_topic_list() {
-    const url = window.location.pathname;
-    const url_split = url.split('/');
-
-    let num;
-    if(url_split[1] === 'topic') {
-        num = '1';
-    } else {
-        num = url_split[2];
-    }
-    
-    let doc_name;
-    if(url_split[1] === 'topic') {
-        doc_name = url_split.slice(2, undefined).join('/');
-    } else {
-        doc_name = url_split.slice(3, undefined).join('/');
-    }
-
-    let lang_data = new FormData();
-    lang_data.append('data', 'closed stop agreed_discussion make_new_topic');
-
-    fetch('/api/v2/lang', {
-        method : 'POST',
-        body : lang_data,
-    }).then(function(res) {
-        return res.json();
-    }).then(function(lang) {
-        lang = lang["data"];
-
-        fetch('/api/v2/topic/' + num + '/normal/' + doc_name).then(function(res) {
-            return res.json();
-        }).then(function(data) {
-            data = data['data'];
-
-            let data_html = '';
-
-            for(let for_a = 0; for_a < data.length; for_a++) {
-                let left = '<a href="/thread/' + data[for_a][0] + '">' + opennamu_xss_filter(data[for_a][1]) + '</a>';
-                
-                let right = '';
-                if(data[for_a][2] === 'O') {
-                    right += lang['closed'] + ' | ';
-                } else if(data[for_a][2] === 'S') {
-                    right += lang['stop'] + ' | ';
-                }
-
-                if(data[for_a][3] !== '') {
-                    right += lang['agreed_discussion'] + ' | ';
-                }
-
-                right += '<a href="/thread/' + data[for_a][0] + '#' + data[for_a][7] + '">#' + data[for_a][7] + '</a> | ';
-                right += data[for_a][5] + ' | ';
-                right += data[for_a][6];
-
-                data_html += opennamu_make_list(left, right);
-            }
-
-            if(data_html !== '') {
-                data_html += '<hr class="main_hr">';
-            }
-
-            data_html += '<a href="/thread/0/' + doc_name + '">(' + lang['make_new_topic'] + ')</a>';
-
-            data_html += opennamu_page_control('/topic_page/{}/normal/' + doc_name, Number(num), data.length);
-
-            document.getElementById('opennamu_topic_list').innerHTML = data_html;
-        });
-    });
-}

+ 3 - 3
views/ringo/css/main.css

@@ -3,7 +3,7 @@ html {
 }
 
 body {
-    font-family: 'SUIT', sans-serif;
+    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", sans-serif;
     font-size: 14px;
     font-feature-settings: "ss18";
     text-size-adjust: 100%;
@@ -18,12 +18,12 @@ h1, h2, h3, h4, h5, h6 {
 }
 
 select {
-    font-family: 'SUIT', sans-serif;
+    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", sans-serif;
     font-feature-settings: "ss18";
 }
 
 textarea {
-    font-family: 'SUIT', monospace;
+    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Nanum Gothic", monospace;
     font-feature-settings: "ss18";
 }
 

+ 0 - 1
views/ringo/index.html

@@ -10,7 +10,6 @@
             <title>{{title}} - {{wiki_name}}</title>
         {% endif %}
         {{main_head|safe}}
-        <link href="https://cdn.jsdelivr.net/gh/sun-typeface/SUIT/fonts/static/woff2/SUIT.css" rel="stylesheet">
         <script defer src="https://code.iconify.design/1/1.0.3/iconify.min.js"></script>
         <script defer src="/views/ringo/js/main.js.cache_v3"></script>
         <script defer src="/views/ringo/js/sidebar.js.cache_v7"></script>

+ 1 - 1
views/ringo/info.json

@@ -1,5 +1,5 @@
 {
     "name" : "Ringo",
-    "skin_ver" : "v1.1.8",
+    "skin_ver" : "v1.2.0",
     "require_ver" : "20240426"
 }