diff --git a/README.md b/README.md index 545e22c..f38cb64 100644 --- a/README.md +++ b/README.md @@ -131,8 +131,12 @@ API에선 직접 비트레이트를 설정할 수 있습니다. 물론 해당 정보가 없으면 null입니다. ## Changelog +v1.4.1 +* CORS 허용 설정 추가 + Thanks to [dbswnschl](https://github.com/dbswnschl) + v1.4.0 -* socketio 적용 +* socketio 적용 목록 페이지에서 목록이 실시간으로 업데이트됩니다. v1.3.5 diff --git a/info.json b/info.json index e9e9b59..8728f53 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.4.0", "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.4.1", "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 0c97271..8923fae 100644 --- a/logic.py +++ b/logic.py @@ -23,7 +23,7 @@ class Logic(object): 'temp_path': os.path.join(path_data, 'download_tmp'), 'save_path': os.path.join(path_data, 'download'), 'default_filename': '%(title)s-%(id)s.%(ext)s', - 'activate_cors': True + 'activate_cors': False } @staticmethod @@ -53,8 +53,9 @@ class Logic(object): try: import flask_cors except Exception as e: - logger.debug('flask_cors install') - logger.debug(subprocess.check_output([sys.executable, '-m', 'pip', 'install', 'flask_cors'], universal_newlines=True)) + # flask-cors 설치 + 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 cab0f97..8075a0b 100644 --- a/plugin.py +++ b/plugin.py @@ -7,7 +7,6 @@ import traceback # third-party from flask import Blueprint, request, render_template, redirect, jsonify, abort from flask_login import login_required -import flask_cors # sjva 공용 from framework.logger import get_logger @@ -25,8 +24,7 @@ from .my_youtube_dl import Youtube_dl # 플러그인 공용 ######################################################### 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') == True: - flask_cors.CORS(blueprint) + menu = { 'main': [package_name, 'youtube-dl'], 'sub': [ @@ -36,7 +34,7 @@ menu = { } plugin_info = { - 'version': '1.4.0', + 'version': '1.4.1', 'name': 'youtube-dl', 'category_name': 'vod', 'developer': 'joyfuI', @@ -47,6 +45,9 @@ 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() diff --git a/templates/youtube-dl_setting.html b/templates/youtube-dl_setting.html index b2cce24..8db949e 100644 --- a/templates/youtube-dl_setting.html +++ b/templates/youtube-dl_setting.html @@ -7,7 +7,7 @@ {{ macros.setting_input_text('temp_path', '임시 폴더', value=arg['temp_path'], placeholder='임시 폴더 경로', desc='다운로드 파일이 임시로 저장될 폴더 입니다.') }} {{ macros.setting_input_text('save_path', '저장 폴더', value=arg['save_path'], placeholder='저장 폴더 경로', desc='정상적으로 완료된 파일이 이동할 폴더 입니다.') }} {{ macros.setting_input_text('default_filename', '기본 파일명', value=arg['default_filename'], placeholder='저장 폴더 경로', desc=['템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template 참고', '기본값은 "%(title)s-%(id)s.%(ext)s"입니다.']) }} - {{ macros.setting_checkbox('activate_cors', 'CORS 허용', value=arg['activate_cors'], desc='api로의 크로스 도메인요청 허용 유무 입니다. 설정 저장후 재시작이 필요합니다.') }} + {{ macros.setting_checkbox('activate_cors', 'CORS 허용', value=arg['activate_cors'], desc='API로의 크로스 도메인 요청을 허용합니다. 설정 저장 후 재시작이 필요합니다.') }} {{ macros.setting_button([['setting_save', '저장']]) }}