Explorar o código

Merge pull request #1996 from openNAMU/dev

Dev
잉여개발기 %!s(int64=2) %!d(string=hai) anos
pai
achega
e37a6da8f6
Modificáronse 7 ficheiros con 12 adicións e 6 borrados
  1. 1 1
      app.py
  2. 2 0
      requirements.txt
  3. 1 1
      route/main_func_error_404.py
  4. 1 0
      route/tool/func.py
  5. 1 3
      route/topic.py
  6. 5 0
      route/view_read.py
  7. 1 1
      version.json

+ 1 - 1
app.py

@@ -348,7 +348,7 @@ app.route('/list/document/short/<int:arg_num>', defaults = { 'tool' : 'short_pag
 app.route('/list/file')(list_image_file)
 app.route('/list/file/<int:arg_num>')(list_image_file)
 app.route('/list/image', defaults = { 'do_type' : 1 })(list_image_file)
-app.route('/list/image/int:arg_num', defaults = { 'do_type' : 1 })(list_image_file)
+app.route('/list/image/<int:arg_num>', defaults = { 'do_type' : 1 })(list_image_file)
 
 app.route('/list/admin')(list_admin)
 

+ 2 - 0
requirements.txt

@@ -6,4 +6,6 @@ waitress
 requests
 diff-match-patch
 
+pillow
+
 pymysql

+ 1 - 1
route/main_func_error_404.py

@@ -11,4 +11,4 @@ def main_func_error_404(e = ''):
             db_data = curs.fetchall()
             db_data = db_data[0][0] if db_data and db_data[0][0] != '' else 'FrontPage'
             
-            return '<script>window.location.href = "/w/' + url_pas(db_data) + '";</script>'
+            return redirect('/w/' + url_pas(db_data))

+ 1 - 0
route/tool/func.py

@@ -81,6 +81,7 @@ import werkzeug.debug
 import flask
 
 import requests
+from PIL import Image
 
 try:
     import mysqlclient as pymysql

+ 1 - 3
route/topic.py

@@ -123,9 +123,7 @@ def topic(topic_num = 0, do_type = '', doc_name = 'Test'):
             name_display = 'display: none;' if topic_num != '0' else ''
 
             shortcut = '<div class="opennamu_thread_shortcut" id="thread_shortcut">'
-            curs.execute(db_change(
-                "select id from topic where code = ? order by id + 0 asc"
-            ), [topic_num])
+            curs.execute(db_change("select id from topic where code = ? order by id + 0 asc"), [topic_num])
             db_data = curs.fetchall()
             for for_a in db_data:
                 shortcut += '<a href="#' + for_a[0] + '">#' + for_a[0] + '</a> '

+ 5 - 0
route/view_read.py

@@ -135,13 +135,18 @@ def view_read(name = 'Test', doc_rev = '', doc_from = '', do_type = ''):
             file_all_name = sha224_replace(file_name) + '.' + mime_type
             file_path_name = os.path.join(load_image_url(), file_all_name)
             if os.path.exists(file_path_name):
+                img = Image.open(file_path_name)
+                width, height = img.size
+                
                 file_size = str(round(os.path.getsize(file_path_name) / 1000, 1))
+                
                 file_data = '''
                     <img src="/image/''' + url_pas(file_all_name) + '''.cache_v''' + rev + '''">
                     <h2>''' + load_lang('data') + '''</h2>
                     <table>
                         <tr><td>URL</td><td><a href="/image/''' + url_pas(file_all_name) + '''">''' + load_lang('link') + '''</a></td></tr>
                         <tr><td>''' + load_lang('volume') + '''</td><td>''' + file_size + '''KB</td></tr>
+                        <tr><td>''' + load_lang('resolution') + '''</td><td>''' + str(width) + 'x' + str(height) + '''</td></tr>
                     </table>
                     <h2>''' + load_lang('content') + '''</h2>
                 '''

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC5-dev49",
+        "r_ver" : "v3.4.6-RC5-dev52",
         "c_ver" : "3500373",
         "s_ver" : "3500112"
     }