diff --git a/README.md b/README.md index a6ee239..4d64558 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,10 @@ API에선 직접 비트레이트를 설정할 수 있습니다. 물론 해당 정보가 없으면 null입니다. ## Changelog +v1.6.10 +* CORS 허용 설정이 작동하지 않는 문제 수정 + Thanks to [dbswnschl](https://github.com/dbswnschl) + v1.6.9 * 일부 동영상 사이트에서 다운로드 실패하는 문제 수정 diff --git a/info.json b/info.json index 490ca9d..0a315c6 100644 --- a/info.json +++ b/info.json @@ -1 +1 @@ -{"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "1.6.9", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} \ No newline at end of file +{"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "1.6.10", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"} \ No newline at end of file diff --git a/logic.py b/logic.py index c5153fe..2f760b7 100644 --- a/logic.py +++ b/logic.py @@ -53,11 +53,6 @@ class Logic(object): except ImportError: logger.debug('glob2 install') logger.debug(subprocess.check_output([sys.executable, '-m', 'pip', 'install', 'glob2'], universal_newlines=True)) - try: - import flask_cors - except ImportError: - logger.debug('flask-cors install') - logger.debug(subprocess.check_output([sys.executable, '-m', 'pip', 'install', 'flask-cors'], universal_newlines=True)) # youtube-dl 업데이트 logger.debug('youtube-dl upgrade') diff --git a/plugin.py b/plugin.py index 163efd9..f52dc8d 100644 --- a/plugin.py +++ b/plugin.py @@ -2,6 +2,7 @@ ######################################################### # python import os +import sys import traceback import subprocess @@ -24,6 +25,14 @@ from .model import ModelSetting # 플러그인 공용 ######################################################### blueprint = Blueprint(package_name, package_name, url_prefix='/%s' % package_name, template_folder=os.path.join(os.path.dirname(__file__), 'templates')) +if ModelSetting.get_bool('activate_cors'): + try: + from flask_cors import CORS + except ImportError: + logger.debug('flask-cors install') + logger.debug(subprocess.check_output([sys.executable, '-m', 'pip', 'install', 'flask-cors'], universal_newlines=True)) + from flask_cors import CORS + CORS(blueprint, resources={r"/youtube-dl/api/*": {"origins": "*"}}) menu = { 'main': [package_name, 'youtube-dl'], @@ -34,7 +43,7 @@ menu = { } plugin_info = { - 'version': '1.6.9', + 'version': '1.6.10', 'name': 'youtube-dl', 'category_name': 'vod', 'developer': 'joyfuI', @@ -45,9 +54,6 @@ plugin_info = { def plugin_load(): Logic.plugin_load() - if ModelSetting.get_bool('activate_cors'): - import flask_cors - flask_cors.CORS(blueprint) def plugin_unload(): Logic.plugin_unload()