update
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#########################################################
|
||||
# python
|
||||
import os
|
||||
import traceback
|
||||
import random
|
||||
import json
|
||||
import string
|
||||
import codecs
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
import traceback
|
||||
|
||||
# third-party
|
||||
import requests
|
||||
from flask import Blueprint, request, Response, send_file, render_template, redirect, jsonify
|
||||
from flask import (Blueprint, Response, jsonify, redirect, render_template,
|
||||
request, send_file)
|
||||
from framework import app, frame, path_app_root
|
||||
from framework.util import Util
|
||||
|
||||
from .model import ModelSetting
|
||||
# 패키지
|
||||
from .plugin import logger, package_name
|
||||
|
||||
# sjva 공용
|
||||
|
||||
from framework import frame, path_app_root, app
|
||||
from framework.util import Util
|
||||
|
||||
# 패키지
|
||||
from .plugin import package_name, logger
|
||||
from .model import ModelSetting
|
||||
|
||||
class SystemLogicAuth(object):
|
||||
@staticmethod
|
||||
@@ -78,7 +80,7 @@ class SystemLogicAuth(object):
|
||||
@staticmethod
|
||||
def check_auth_status(value=None):
|
||||
try:
|
||||
from support.base.aes import SupportAES
|
||||
from support import SupportAES
|
||||
mykey=(codecs.encode(SystemLogicAuth.get_ip().encode(), 'hex').decode() + codecs.encode(ModelSetting.get('auth_apikey').encode(), 'hex').decode()).zfill(32)[:32].encode()
|
||||
logger.debug(mykey)
|
||||
tmp = SupportAES.decrypt(value, mykey=mykey)
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#########################################################
|
||||
# python
|
||||
import os
|
||||
import traceback
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import time
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
|
||||
# third-party
|
||||
from flask import Blueprint, request, Response, send_file, render_template, redirect, jsonify
|
||||
from flask import (Blueprint, Response, jsonify, redirect, render_template,
|
||||
request, send_file)
|
||||
from framework import F, app, celery, path_app_root, path_data
|
||||
|
||||
from .model import ModelSetting
|
||||
# 패키지
|
||||
from .plugin import logger, package_name
|
||||
|
||||
# sjva 공용
|
||||
|
||||
from framework import F, path_app_root, path_data, celery, app
|
||||
|
||||
# 패키지
|
||||
from .plugin import logger, package_name
|
||||
from .model import ModelSetting
|
||||
|
||||
class SystemLogicEnv(object):
|
||||
@staticmethod
|
||||
def load_export():
|
||||
try:
|
||||
from support.base.file import SupportFile
|
||||
from support import SupportFile
|
||||
f = os.path.join(path_app_root, 'export.sh')
|
||||
if os.path.exists(f):
|
||||
return SupportFile.read_file(f)
|
||||
@@ -89,7 +90,7 @@ class SystemLogicEnv(object):
|
||||
def celery_test():
|
||||
if F.config['use_celery']:
|
||||
from celery import Celery
|
||||
from celery.exceptions import TimeoutError, NotRegistered
|
||||
from celery.exceptions import NotRegistered, TimeoutError
|
||||
|
||||
data = {}
|
||||
try:
|
||||
@@ -126,4 +127,4 @@ class SystemLogicEnv(object):
|
||||
return data
|
||||
except Exception as exception:
|
||||
logger.error('Exception:%s', exception)
|
||||
logger.error(traceback.format_exc())
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
@@ -14,7 +14,7 @@ import requests
|
||||
# sjva 공용
|
||||
from framework import app, frame, logger, path_data
|
||||
from framework.util import Util
|
||||
from support.base.process import SupportProcess
|
||||
from support import SupportProcess
|
||||
|
||||
import system
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import platform
|
||||
|
||||
from support.base.util import SupportUtil
|
||||
from support import SupportUtil
|
||||
|
||||
from .setup import *
|
||||
|
||||
|
||||
42
lib/system/mod_plugin.py
Normal file
42
lib/system/mod_plugin.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from support import SupportFile
|
||||
|
||||
from .setup import *
|
||||
|
||||
name = 'plugin'
|
||||
|
||||
class ModulePlugin(PluginModuleBase):
|
||||
db_default = {
|
||||
'plugin_dev_path': os.path.join(F.config['path_data'], 'dev'),
|
||||
}
|
||||
|
||||
def __init__(self, P):
|
||||
super(ModulePlugin, self).__init__(P, name=name, first_menu='list')
|
||||
|
||||
|
||||
def process_menu(self, page, req):
|
||||
arg = P.ModelSetting.to_dict()
|
||||
try:
|
||||
return render_template(f'{__package__}_{name}_{page}.html', arg=arg)
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
return render_template('sample.html', title=f"{__package__}/{name}/{page}")
|
||||
|
||||
|
||||
def process_command(self, command, arg1, arg2, arg3, req):
|
||||
ret = {'ret':'success'}
|
||||
if command == 'plugin_install':
|
||||
ret = F.PluginManager.plugin_install(arg1)
|
||||
|
||||
return jsonify(ret)
|
||||
|
||||
|
||||
def plugin_load(self):
|
||||
try:
|
||||
pass
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import random
|
||||
import string
|
||||
|
||||
from support.base.file import SupportFile
|
||||
from support import SupportDiscord, SupportFile, SupportTelegram
|
||||
|
||||
from .setup import *
|
||||
|
||||
@@ -19,9 +19,9 @@ class ModuleSetting(PluginModuleBase):
|
||||
'use_apikey': 'False',
|
||||
'apikey': ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)),
|
||||
f'restart_interval': f'{random.randint(0,59)} {random.randint(1,23)} * * *',
|
||||
'restart_notify': 'False',
|
||||
'theme' : 'Cerulean',
|
||||
'log_level' : '20',
|
||||
'plugin_dev_path': os.path.join(F.config['path_data'], 'dev'),
|
||||
'system_start_time': '',
|
||||
# notify
|
||||
'notify_telegram_use' : 'False',
|
||||
@@ -31,6 +31,7 @@ class ModuleSetting(PluginModuleBase):
|
||||
'notify_discord_use' : 'False',
|
||||
'notify_discord_webhook' : '',
|
||||
'notify_advaned_use' : 'False',
|
||||
'notify.yaml': '', #직접 사용하지 않으나 저장 편의상.
|
||||
}
|
||||
|
||||
def __init__(self, P):
|
||||
@@ -52,12 +53,17 @@ class ModuleSetting(PluginModuleBase):
|
||||
elif page == 'menu':
|
||||
arg['menu_yaml_filepath'] = F.config['menu_yaml_filepath']
|
||||
arg['menu.yaml'] = SupportFile.read_file(arg['menu_yaml_filepath'])
|
||||
elif page == 'notify':
|
||||
arg['notify_yaml_filepath'] = F.config['notify_yaml_filepath']
|
||||
arg['notify.yaml'] = SupportFile.read_file(arg['notify_yaml_filepath'])
|
||||
|
||||
return render_template(f'{__package__}_{name}_{page}.html', arg=arg)
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
return render_template('sample.html', title=f"{__package__}/{name}/{page}")
|
||||
|
||||
|
||||
def process_command(self, command, arg1, arg2, arg3, req):
|
||||
ret = {'ret':'success'}
|
||||
if command == 'apikey_generate':
|
||||
@@ -80,11 +86,34 @@ class ModuleSetting(PluginModuleBase):
|
||||
F.socketio.emit("refresh", {}, namespace='/framework', broadcast=True)
|
||||
elif command == 'notify_test':
|
||||
if arg1 == 'telegram':
|
||||
pass
|
||||
|
||||
token, chatid, sound, text = arg2.split('||')
|
||||
sound = True if sound == 'true' else False
|
||||
SupportTelegram.send_telegram_message(text, image_url=None, bot_token=token, chat_id=chatid, disable_notification=sound)
|
||||
ret['msg'] = '메시지를 전송했습니다.'
|
||||
elif arg1 == 'discord':
|
||||
SupportDiscord.send_discord_message(arg3, webhook_url=arg2)
|
||||
ret['msg'] = '메시지를 전송했습니다.'
|
||||
elif arg1 == 'advanced':
|
||||
from tool import ToolNotify
|
||||
ToolNotify.send_advanced_message(arg3, message_id=arg2)
|
||||
ret['msg'] = '메시지를 전송했습니다.'
|
||||
elif command == 'ddns_test':
|
||||
try:
|
||||
import requests
|
||||
url = arg1 + '/version'
|
||||
res = requests.get(url)
|
||||
data = res.text
|
||||
ret['msg'] = f"버전: {data}"
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
ret['msg'] = str(e)
|
||||
ret['type'] = 'warning'
|
||||
elif command == 'command_run':
|
||||
ret['msg'] = arg1
|
||||
pass
|
||||
return jsonify(ret)
|
||||
|
||||
|
||||
|
||||
def plugin_load(self):
|
||||
try:
|
||||
@@ -99,18 +128,29 @@ class ModuleSetting(PluginModuleBase):
|
||||
self.__set_scheduler_check_scheduler()
|
||||
F.get_recent_version()
|
||||
|
||||
notify_yaml_filepath = os.path.join(F.config['path_data'], 'db', 'notify.yaml')
|
||||
if os.path.exists(notify_yaml_filepath) == False:
|
||||
import shutil
|
||||
shutil.copy(
|
||||
os.path.join(F.config['path_app'], 'files', 'notify.yaml.template'),
|
||||
notify_yaml_filepath
|
||||
)
|
||||
if SystemModelSetting.get_bool('restart_notify'):
|
||||
from tool import ToolNotify
|
||||
msg = f"시스템이 시작되었습니다.\n재시작: {F.config['arg_repeat']}"
|
||||
ToolNotify.send_message(msg, message_id='system_start')
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
P.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
def setting_save_after(self, change_list):
|
||||
if 'theme' in change_list:
|
||||
F.socketio.emit("refresh", {}, namespace='/framework', broadcast=True)
|
||||
|
||||
elif 'notify.yaml' in change_list:
|
||||
SupportFile.write_file(F.config['notify_yaml_filepath'], SystemModelSetting.get('notify.yaml'))
|
||||
|
||||
|
||||
|
||||
|
||||
def __set_restart_scheduler(self):
|
||||
name = f'{__package__}_restart'
|
||||
if F.scheduler.is_include(name):
|
||||
@@ -132,4 +172,3 @@ class ModuleSetting(PluginModuleBase):
|
||||
scheduler.add_job_instance(job_instance, run=False)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#########################################################
|
||||
# python
|
||||
import os, platform
|
||||
import traceback
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
import traceback
|
||||
|
||||
# third-party
|
||||
import requests
|
||||
from flask import Blueprint, request, Response, send_file, render_template, redirect, jsonify, stream_with_context
|
||||
|
||||
# sjva 공용
|
||||
from framework import frame, app, scheduler, socketio, check_api, path_app_root, path_data, get_logger#, celery
|
||||
from support.base.util import SingletonClass
|
||||
from flask import (Blueprint, Response, jsonify, redirect, render_template,
|
||||
request, send_file, stream_with_context)
|
||||
from flask_login import login_required
|
||||
# sjva 공용
|
||||
from framework import (app, check_api, frame, get_logger, # , celery
|
||||
path_app_root, path_data, scheduler, socketio)
|
||||
from support import SingletonClass
|
||||
|
||||
# 로그
|
||||
package_name = __name__.split('.')[0]
|
||||
@@ -23,19 +25,19 @@ logger = get_logger(__package__)
|
||||
|
||||
# 패키지
|
||||
from .logic import SystemLogic
|
||||
from .model import ModelSetting
|
||||
from .logic_plugin import LogicPlugin
|
||||
from .logic_selenium import SystemLogicSelenium
|
||||
from .logic_auth import SystemLogicAuth
|
||||
from .logic_command import SystemLogicCommand
|
||||
from .logic_command2 import SystemLogicCommand2
|
||||
from .logic_notify import SystemLogicNotify
|
||||
from .logic_telegram_bot import SystemLogicTelegramBot
|
||||
from .logic_auth import SystemLogicAuth
|
||||
from .logic_tool_crypt import SystemLogicToolDecrypt
|
||||
from .logic_terminal import SystemLogicTerminal
|
||||
# celery 때문에 import
|
||||
from .logic_env import SystemLogicEnv
|
||||
from .logic_notify import SystemLogicNotify
|
||||
from .logic_plugin import LogicPlugin
|
||||
from .logic_selenium import SystemLogicSelenium
|
||||
from .logic_site import SystemLogicSite
|
||||
from .logic_telegram_bot import SystemLogicTelegramBot
|
||||
from .logic_terminal import SystemLogicTerminal
|
||||
from .logic_tool_crypt import SystemLogicToolDecrypt
|
||||
from .model import ModelSetting
|
||||
|
||||
#########################################################
|
||||
|
||||
|
||||
@@ -16,7 +16,15 @@ __menu = {
|
||||
|
||||
],
|
||||
},
|
||||
{'uri': 'plugin', 'name': '플러그인'},
|
||||
{
|
||||
'uri': 'plugin',
|
||||
'name': '플러그인',
|
||||
'list': [
|
||||
{'uri': 'setting', 'name': '개발 설정'},
|
||||
{'uri': 'list', 'name': '플러그인 목록'},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
'uri': 'tool',
|
||||
'name': '시스템 툴',
|
||||
@@ -25,6 +33,7 @@ __menu = {
|
||||
{'uri': 'python', 'name': 'Python'},
|
||||
{'uri': 'db', 'name': 'DB'},
|
||||
{'uri': 'crypt', 'name': '암호화'},
|
||||
{'uri': 'upload', 'name': '업로드'},
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -64,10 +73,11 @@ try:
|
||||
|
||||
SystemModelSetting = P.ModelSetting
|
||||
from .mod_home import ModuleHome
|
||||
from .mod_plugin import ModulePlugin
|
||||
from .mod_route import ModuleRoute
|
||||
from .mod_setting import ModuleSetting
|
||||
|
||||
P.set_module_list([ModuleSetting, ModuleHome, ModuleRoute])
|
||||
P.set_module_list([ModuleSetting, ModuleHome, ModuleRoute, ModulePlugin])
|
||||
|
||||
except Exception as e:
|
||||
P.logger.error(f'Exception:{str(e)}')
|
||||
|
||||
30
lib/system/templates/system_plugin_setting.html
Normal file
30
lib/system/templates/system_plugin_setting.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div>
|
||||
{{ macros.m_button_group([['globalSettingSaveBtn', '설정 저장']])}}
|
||||
{{ macros.m_row_start('5') }}
|
||||
{{ macros.m_row_end() }}
|
||||
{{ macros.m_hr() }}
|
||||
<form id='setting' name='setting'>
|
||||
{{ macros.setting_input_text_and_buttons('plugin_dev_path', '개발용 플러그인 경로', [['select_btn', '폴더 선택']], value=arg['plugin_dev_path'], desc=['개발용 플러그인 패키지 폴더가 있는 경로']) }}
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_input_text_and_buttons('_plugin_git', '플러그인 설치', [['plugin_install_btn', '설치']], value='https://github.com/', desc=['플러그인 Git 주소']) }}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("body").on('click', '#select_btn', function(e){
|
||||
e.preventDefault();
|
||||
selectLocalFolder("폴더 선택", $('#plugin_dev_path').val(), function(ret) {
|
||||
$('#plugin_dev_path').val(ret);
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#plugin_install_btn', function(e){
|
||||
e.preventDefault();
|
||||
globalSendCommand('plugin_install', $('#_plugin_git').val());
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -1,420 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<style type="text/css">
|
||||
.my_hover:hover{
|
||||
background-color: #ffff00;
|
||||
transition: all 0.01s ease-in-out;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<nav>
|
||||
{{ macros.m_tab_head_start() }}
|
||||
{{ macros.m_tab_head2('normal', '일반', true) }}
|
||||
{{ macros.m_tab_head2('web', '웹', false) }}
|
||||
{{ macros.m_tab_head2('menu', '메뉴', false) }}
|
||||
{{ macros.m_tab_head2('link', '링크', false) }}
|
||||
{{ macros.m_tab_head2('download', '다운로드', false) }}
|
||||
{{ macros.m_tab_head_end() }}
|
||||
</nav>
|
||||
|
||||
<div class="tab-content" id="nav-tabContent">
|
||||
{{ macros.m_tab_content_start('normal', true) }}
|
||||
<form id='setting' name='setting'>
|
||||
{{ macros.setting_input_int('port', 'Port', value=arg['port'], min='1', placeholder='Port', desc=['포트 번호입니다.', '네이티브 설치 혹은 도커 네트워크 타입이 호스트일 경우 반영됩니다.', '도커 브릿지 모드인 경우는 docker run -p 옵션에서 변경하시기 바랍니다.', '경고 : -p 브릿지 모드로 사용중 일 경우 9999번을 절대 변경하지 마세요.']) }}
|
||||
{{ macros.setting_input_text_and_buttons('ddns', 'DDNS', [['ddns_test_btn', '테스트']], value=arg['ddns'], desc=['외부에서 접근시 사용할 DDNS. http:// 나 https:// 로 시작해야합니다.', 'RSS, Plex Callback, KLive 등에서 URL생성시 사용합니다.', '테스트 버튼 클릭 후 버전을 확인 할 수 있어야 합니다.']) }}
|
||||
{{ macros.setting_input_text('auto_restart_hour', '자동 재시작 시간', value=arg['auto_restart_hour'], col='3', desc=['자동 재시작 간격(시간단위)이나 Cron 설정을 입력합니다.', '0이면 재시작 안함.']) }}
|
||||
{{ macros.setting_select('log_level', '로그 레벨', [['10', 'DEBUG'],['20', 'INFO'],['30', 'WARNING'],['40', 'ERROR'], ['50', 'CRITICAL'] ], value=arg['log_level'], col='3') }}
|
||||
{{ macros.setting_button([['setting_save', '저장']]) }}
|
||||
</form>
|
||||
</form>
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_input_text_and_buttons('command_text', 'Command', [['command_run_btn', 'Run']], value='', desc='') }}
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
|
||||
{{ macros.m_tab_content_start('web', false) }}
|
||||
<form id='setting2' name='setting2'>
|
||||
{{ macros.setting_select('theme', '테마 선택', [['Default','Default'], ['Cerulean','Cerulean'], ['Cosmo','Cosmo'], ['Cyborg','Cyborg'], ['Darkly','Darkly'], ['Flatly','Flatly'], ['Journal','Journal'], ['Litera','Litera'], ['Lumen','Lumen'], ['Lux','Lux'], ['Materia','Materia'], ['Minty','Minty'], ['Morph','Morph'],['Pulse','Pulse'], ['Quartz','Quartz'], ['Sandstone','Sandstone'], ['Simplex','Simplex'], ['Sketchy','Sketchy'], ['Slate','Slate'], ['Solar','Solar'], ['Spacelab','Spacelab'], ['Superhero','Superhero'], ['United','United'], ['Vapor','Vapor'], ['Yeti','Yeti'], ['Zephyr','Zephyr']], value=arg['theme'], desc=['https://bootswatch.com'], col='6') }}
|
||||
{{ macros.setting_input_text('web_title', '웹 타이틀', value=arg['web_title']) }}
|
||||
{{ macros.setting_button([['setting_save2', '저장']]) }}
|
||||
</form>
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
|
||||
{{ macros.m_tab_content_start('menu', false) }}
|
||||
<form id='setting3' name='setting3'>
|
||||
{% if arg['use_category_vod'] == 'True' %}
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_button_with_info([['menu_toggle_btn', 'Toggle', [{'key':'category', 'value':'vod'}]]], left='VOD', desc=None) }}
|
||||
<div id="menu_vod_div" class="collapse">
|
||||
{{ macros.setting_checkbox('use_plugin_ffmpeg', 'FFMPEG', value=arg['use_plugin_ffmpeg']) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if arg['use_category_file_process'] == 'True' %}
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_button_with_info([['menu_toggle_btn', 'Toggle', [{'key':'category', 'value':'file_process'}]]], left='파일처리', desc=None) }}
|
||||
<div id="menu_file_process_div" class="collapse">
|
||||
{{ macros.setting_checkbox('use_plugin_ktv', '국내TV', value=arg['use_plugin_ktv']) }}
|
||||
{{ macros.setting_checkbox('use_plugin_fileprocess_movie', '영화', value=arg['use_plugin_fileprocess_movie']) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if arg['use_category_plex'] == 'True' %}
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_button_with_info([['menu_toggle_btn', 'Toggle', [{'key':'category', 'value':'plex'}]]], left='PLEX', desc=None) }}
|
||||
<div id="menu_plex_div" class="collapse">
|
||||
{{ macros.setting_checkbox('use_plugin_plex', 'PLEX', value=arg['use_plugin_plex']) }}
|
||||
{{ macros.setting_checkbox('use_plugin_gdrive_scan', 'GDrive 스캔', value=arg['use_plugin_gdrive_scan']) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if arg['use_category_tool'] == 'True' %}
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_button_with_info([['menu_toggle_btn', 'Toggle', [{'key':'category', 'value':'tool'}]]], left='툴', desc=None) }}
|
||||
<div id="menu_tool_div" class="collapse">
|
||||
{{ macros.setting_checkbox('use_plugin_rclone', 'RClone', value=arg['use_plugin_rclone']) }}
|
||||
{{ macros.setting_checkbox('use_plugin_daum_tv', 'Daum TV', value=arg['use_plugin_daum_tv']) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ macros.setting_button([['setting_save3', '저장']]) }}
|
||||
</form>
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
|
||||
{{ macros.m_tab_content_start('link', false) }}
|
||||
{{ macros.m_button_group([['link_add_btn', '추가'], ['link_add_divider_btn', 'Divider Line 추가'], ['link_save_btn', '저장'], ['link_reset_btn', '초기화']])}}
|
||||
{{ macros.m_row_start('0') }}
|
||||
{{ macros.m_row_end() }}
|
||||
|
||||
{{ macros.m_hr_head_top() }}
|
||||
{{ macros.m_row_start('0') }}
|
||||
{{ macros.m_col(1, macros.m_strong('Idx')) }}
|
||||
{{ macros.m_col(4, macros.m_strong('Title')) }}
|
||||
{{ macros.m_col(4, macros.m_strong('URL')) }}
|
||||
{{ macros.m_col(3, macros.m_strong('Action')) }}
|
||||
{{ macros.m_row_end() }}
|
||||
{{ macros.m_hr_head_bottom() }}
|
||||
<form id="link_form" name="link_form">
|
||||
<div id="link_list_div"></div>
|
||||
</form>
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
{{ macros.m_tab_content_start('download', false) }}
|
||||
{{ macros.setting_button_with_info([['global_link_btn', '다운로드', [{'key':'url', 'value':'https://github.com/soju6jan/soju6jan.github.io/blob/master/etc/hdhomerun_scan_191214.zip'}]], ['global_link_btn', '매뉴얼', [{'key':'url', 'value':'.'}]]], left='HDHomerun Scan Tool', desc=['HDHomerun 스캔하여 TVH용 프리셋 파일을 만들어주는 Windows용 프로그램', '8VSB 지원 케이블용']) }}
|
||||
<!--
|
||||
{{ macros.setting_button_with_info([['global_link_btn', '다운로드', [{'key':'url', 'value':'https://github.com/soju6jan/soju6jan.github.io/raw/master/etc/sjva_lc_0.1.1.apk'}]], ['global_link_btn', '매뉴얼', [{'key':'url', 'value':'.'}]]], left='SJVA for Live Channels', desc=['Android TV Live Channels 앱에 채널 소스를 제공하는 앱.', 'Klive, Plex 지원']) }}
|
||||
{{ macros.setting_button_with_info([['global_link_btn', '티빙 애드온', [{'key':'url', 'value':'https://github.com/soju6jan/soju6jan.github.io/blob/master/kodi_plugin/plugin.video.tving.zip'}]]], left='KODI', desc=None) }}
|
||||
-->
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
</div><!--tab-content-->
|
||||
</div> <!--전체-->
|
||||
|
||||
<!-- 링크 모달 -->
|
||||
{{ macros.m_modal_start('link_edit_modal', '링크', 'modal-lg') }}
|
||||
<form id="link_form">
|
||||
<input type="hidden" id="link_edit_index" name="link_edit_index"/>
|
||||
{{ macros.setting_input_text('link_edit_title', '제목') }}
|
||||
{{ macros.setting_input_text('link_edit_url', 'URL') }}
|
||||
{{ macros.setting_button([['link_edit_confirm_btn', '확인'], ['link_edit_cancel_btn', '취소']]) }}
|
||||
</form>
|
||||
{{ macros.m_modal_end() }}
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var package_name = 'system';
|
||||
var current_data;
|
||||
var link_data;
|
||||
|
||||
$(document).ready(function(){
|
||||
$(function() {
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/get_link_list',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
link_data = data
|
||||
make_link_data();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function setting_save_func(formData, noti) {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/setting_save_system',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
if (noti) {
|
||||
$.notify('<strong>설정을 저장하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
window.location.href = "/"
|
||||
}
|
||||
} else {
|
||||
$.notify('<strong>설정 저장에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//설정 저장
|
||||
$("#setting_save").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting');
|
||||
setting_save_func(formData, true)
|
||||
});
|
||||
|
||||
//설정 저장
|
||||
$("#setting_save2").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting2');
|
||||
setting_save_func(formData, false)
|
||||
});
|
||||
|
||||
$("#setting_save4").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting4');
|
||||
setting_save_func(formData, true)
|
||||
});
|
||||
|
||||
$("#setting_save3").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting3');
|
||||
setting_save_func(formData, true)
|
||||
$.notify('<strong>재시작해야 적용됩니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("body").on('click', '#ddns_test_btn', function(e){
|
||||
e.preventDefault();
|
||||
ddns = document.getElementById('ddns').value;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/ddns_test',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{ddns:ddns},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data)
|
||||
if (data == 'fail') {
|
||||
$.notify('<strong>접속에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>Version:'+ data+'</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$("body").on('click', '#menu_toggle_btn', function(e){
|
||||
e.preventDefault();
|
||||
category = $(this).data('category')
|
||||
var div_name = '#menu_'+category+'_div'
|
||||
$(div_name).collapse('toggle')
|
||||
});
|
||||
|
||||
$("body").on('click', '#command_run_btn', function(e){
|
||||
e.preventDefault();
|
||||
command_text = document.getElementById('command_text').value;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/command_run',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{command_text:command_text},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.ret == 'success') {
|
||||
$.notify('<strong>성공 : '+ data.log +'</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>실패 : ' + data.log+'</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// 링크
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 화면 상단 버튼 START
|
||||
$("body").on('click', '#link_add_btn', function(e){
|
||||
e.preventDefault();
|
||||
document.getElementById("link_edit_index").value = -1;
|
||||
document.getElementById('link_edit_title').value = '';
|
||||
document.getElementById('link_edit_url').value = '';
|
||||
$('#link_edit_modal').modal();
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_add_divider_btn', function(e){
|
||||
e.preventDefault();
|
||||
tmp = {}
|
||||
tmp['type'] = 'divider'
|
||||
link_data.splice(link_data.length, 0, tmp);
|
||||
make_link_data()
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_save_btn', function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/link_save',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{link_data:JSON.stringify(link_data)},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
$.notify('<strong>저장 후 적용하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_reset_btn', function(e){
|
||||
e.preventDefault();
|
||||
link_data = []
|
||||
make_link_data()
|
||||
});
|
||||
// 화면 상단 버튼 END
|
||||
|
||||
// 리스트 각 항목 별 버튼 START
|
||||
$("body").on('click', '#link_item_up_btn', function(e){
|
||||
e.preventDefault();
|
||||
target_id = $(this).data('index')
|
||||
target = link_data[target_id]
|
||||
if (target_id != 0) {
|
||||
link_data.splice(target_id, 1);
|
||||
link_data.splice(target_id-1, 0, target);
|
||||
}
|
||||
make_link_data()
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_item_down_btn', function(e){
|
||||
e.preventDefault();
|
||||
target_id = $(this).data('index')
|
||||
target = link_data[target_id]
|
||||
if (link_data.length -1 != target_id) {
|
||||
link_data.splice(target_id, 1);
|
||||
link_data.splice(target_id+1, 0, target);
|
||||
}
|
||||
make_link_data()
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_item_delete_btn', function(e){
|
||||
e.preventDefault();
|
||||
target_id = $(this).data('index')
|
||||
target = link_data[target_id]
|
||||
link_data.splice(target_id, 1);
|
||||
make_link_data()
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_item_edit_btn', function(e){
|
||||
e.preventDefault();
|
||||
target_id = $(this).data('index')
|
||||
target = link_data[target_id]
|
||||
document.getElementById('link_edit_index').value = target_id
|
||||
document.getElementById('link_edit_title').value = target.title
|
||||
document.getElementById('link_edit_url').value = target.url
|
||||
$('#link_edit_modal').modal();
|
||||
});
|
||||
// 리스트 각 항목 별 버튼 END
|
||||
|
||||
// START 모달 버튼
|
||||
$("body").on('click', '#link_edit_confirm_btn', function(e){
|
||||
e.preventDefault();
|
||||
edit_index = parseInt(document.getElementById('link_edit_index').value)
|
||||
tmp = {}
|
||||
tmp['type'] = 'link'
|
||||
tmp['title'] = document.getElementById('link_edit_title').value
|
||||
tmp['url'] = document.getElementById('link_edit_url').value
|
||||
if (edit_index == -1) {
|
||||
link_data.splice(link_data.length, 0, tmp);
|
||||
} else {
|
||||
link_data.splice(target_id, 1);
|
||||
link_data.splice(target_id, 0, tmp);
|
||||
}
|
||||
make_link_data()
|
||||
$('#link_edit_modal').modal('hide');
|
||||
});
|
||||
|
||||
$("body").on('click', '#link_edit_cancel_btn', function(e){
|
||||
e.preventDefault();
|
||||
$('#link_edit_modal').modal('hide');
|
||||
});
|
||||
// END 모달 버튼
|
||||
|
||||
|
||||
|
||||
function make_link_data() {
|
||||
str = ''
|
||||
for (i in link_data) {
|
||||
//console.log(link_data[i])
|
||||
str += m_row_start_hover();
|
||||
str += m_col(1, parseInt(i)+1);
|
||||
|
||||
if (link_data[i].type == 'link') {
|
||||
str += m_col(4, link_data[i].title)
|
||||
str += m_col(4, link_data[i].url)
|
||||
} else {
|
||||
str += m_col(8, '---Divider Line---')
|
||||
}
|
||||
tmp = ''
|
||||
tmp += m_button('link_item_up_btn', 'UP', [{'key':'index', 'value':i}]);
|
||||
tmp += m_button('link_item_down_btn', 'DOWN', [{'key':'index', 'value':i}]);
|
||||
tmp += m_button('link_item_delete_btn', '삭제', [{'key':'index', 'value':i}]);
|
||||
if (link_data[i].type == 'link') {
|
||||
tmp += m_button('link_item_edit_btn', '편집', [{'key':'index', 'value':i}]);
|
||||
tmp += m_button('global_link_btn', 'Go', [{'key':'url', 'value':link_data[i].url}]);
|
||||
}
|
||||
tmp = m_button_group(tmp)
|
||||
str += m_col(3, tmp)
|
||||
str += m_row_end();
|
||||
if (i != link_data.length -1) str += m_hr(0);
|
||||
}
|
||||
document.getElementById("link_list_div").innerHTML = str;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$("body").on('click', '#go_filebrowser_btn', function(e){
|
||||
e.preventDefault();
|
||||
url = document.getElementById('url_filebrowser').value
|
||||
window.open(url, "_blank");
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -11,126 +11,22 @@
|
||||
{{ macros.setting_input_int('port', 'Port', value=arg['port'], min='1', placeholder='Port', desc=['포트 번호입니다.', '네이티브 설치 혹은 도커 네트워크 타입이 호스트일 경우 반영됩니다.', '도커 브릿지 모드인 경우는 docker run -p 옵션에서 변경하시기 바랍니다.', '경고 : -p 브릿지 모드로 사용중 일 경우 9999번을 변경하지 마세요.']) }}
|
||||
{{ macros.setting_input_text_and_buttons('ddns', 'DDNS', [['ddns_test_btn', '테스트']], value=arg['ddns'], desc=['외부에서 접근시 사용할 DDNS. http:// 나 https:// 로 시작해야합니다.', 'URL생성시 사용합니다.', '테스트 버튼 클릭 후 버전을 확인 할 수 있어야 합니다.']) }}
|
||||
{{ macros.setting_input_text('restart_interval', '자동 재시작 시간', value=arg['restart_interval'], col='3', desc=['자동 재시작 간격(시간단위)이나 Cron 설정을 입력합니다.', '0이면 재시작 안함.']) }}
|
||||
{{ macros.setting_checkbox('restart_notify', '시작시 알림', value=arg['restart_notify'], desc=['메시지 ID: system_start']) }}
|
||||
{{ macros.setting_select('log_level', '로그 레벨', [['10', 'DEBUG'],['20', 'INFO'],['30', 'WARNING'],['40', 'ERROR'], ['50', 'CRITICAL'] ], value=arg['log_level'], col='3') }}
|
||||
{{ macros.m_hr() }}
|
||||
{{ macros.setting_input_text_and_buttons('command_text', 'Command', [['command_run_btn', 'Run']], value='', desc='') }}
|
||||
</form>
|
||||
</div><!--전체-->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
});
|
||||
|
||||
$("body").on('click', '#ddns_test_btn', function(e){
|
||||
e.preventDefault();
|
||||
globalSendCommand('ddns_test', $('#ddns').val());
|
||||
|
||||
ddns = document.getElementById('ddns').value;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/ddns_test',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{ddns:ddns},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data)
|
||||
if (data == 'fail') {
|
||||
$.notify('<strong>접속에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>Version:'+ data+'</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function setting_save_func(formData, noti) {
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/setting_save_system',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
if (noti) {
|
||||
$.notify('<strong>설정을 저장하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
window.location.href = "/"
|
||||
}
|
||||
} else {
|
||||
$.notify('<strong>설정 저장에 실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//설정 저장
|
||||
$("#setting_save").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting');
|
||||
setting_save_func(formData, true)
|
||||
});
|
||||
|
||||
//설정 저장
|
||||
$("#setting_save2").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting2');
|
||||
setting_save_func(formData, false)
|
||||
});
|
||||
|
||||
$("#setting_save4").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting4');
|
||||
setting_save_func(formData, true)
|
||||
});
|
||||
|
||||
$("#setting_save3").click(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = get_formdata('#setting3');
|
||||
setting_save_func(formData, true)
|
||||
$.notify('<strong>재시작해야 적용됩니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$("body").on('click', '#command_run_btn', function(e){
|
||||
e.preventDefault();
|
||||
command_text = document.getElementById('command_text').value;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/command_run',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{command_text:command_text},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.ret == 'success') {
|
||||
$.notify('<strong>성공 : '+ data.log +'</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>실패 : ' + data.log+'</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
globalSendCommand('command_run', $('#command_text').val());
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -18,24 +18,27 @@
|
||||
<div id="notify_telegram_use_div" class="collapse">
|
||||
{{ macros.setting_input_text('notify_telegram_token', 'Bot Token', value=arg['notify_telegram_token']) }}
|
||||
{{ macros.setting_input_text('notify_telegram_chat_id', 'My Chat ID', value=arg['notify_telegram_chat_id'], col='3') }}
|
||||
{{ macros.setting_input_text_and_buttons('tmp_text_telegram', 'Test', [['tmp_telegram_test_btn', '전송']], value='테스트 메시지입니다.', col='9', desc=['사용자가 먼저 봇과 대화를 시작하여 대화창이 생성된 상태여야 합니다.', '(대화창이 있을 경우에만 알림 수신)']) }}
|
||||
{{ macros.setting_checkbox('notify_telegram_disable_notification', '알람 Disable', value=arg['notify_telegram_disable_notification'], desc='On : 알람 소리 없이 메시지를 수신합니다.') }}
|
||||
{{ macros.setting_input_text_and_buttons('tmp_text_telegram', 'Test', [['tmp_telegram_test_btn', '전송']], value='테스트 메시지입니다.', col='9', desc=['사용자가 먼저 봇과 대화를 시작하여 대화창이 생성된 상태여야 합니다.', '(대화창이 있을 경우에만 알림 수신)']) }}
|
||||
</div>
|
||||
|
||||
{{ macros.m_hr() }}
|
||||
|
||||
{{ macros.setting_checkbox('notify_discord_use', '디스코드 사용', value=arg['notify_discord_use']) }}
|
||||
<div id="notify_discord_use_div" class="collapse">
|
||||
{{ macros.setting_input_text('notify_discord_webhook', '웹훅', value=arg['notify_discord_webhook']) }}
|
||||
{{ macros.setting_input_text_and_buttons('tmp_text_discord', 'Test', [['tmp_discord_test_btn', '전송']], value='테스트 메시지입니다.', col='9') }}
|
||||
|
||||
</div>
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
{{ macros.m_tab_content_start('advanced', false) }}
|
||||
{{ macros.setting_checkbox('notify_advaned_use', '사용', value=arg['notify_advaned_use'], desc=['충분히 내용 숙지하고 사용하세요.', '사용시 기본설정은 무시됩니다.']) }}
|
||||
{{ macros.setting_checkbox('notify_advaned_use', '사용', value=arg['notify_advaned_use'], desc=['사용시 기본설정은 무시됩니다.']) }}
|
||||
<div id="notify_advaned_use_div" class="collapse">
|
||||
{{ macros.setting_input_textarea('_notify_advaned_policy', '정책', value=arg['notify_advaned_policy'], row='30') }}
|
||||
{{ macros.setting_input_text_and_buttons('tmp_text_advanced', 'Test', [['tmp_advanced_test_btn', '전송']], value='테스트 메시지입니다.', col='9', desc=['메시지 ID = 형식', '형식의 구분자 |', '텔레그램 : bot_token,chat_id | 디스코드 : 웹훅 URL', '예) DEFAULT = 794150118:AAEAAAAAAAAAAAAAAA,186485141|https://discordapp.com/api/webhooks/626295849....', '모든 알림을 텔레그램과 디스코드에 보냄']) }}
|
||||
{{ macros.info_text_and_buttons('notify_yaml_filepath', '파일 위치', [['globalEditBtn', '편집기에서 열기', [('file',arg['notify_yaml_filepath'])]]], value=arg['notify_yaml_filepath']) }}
|
||||
{{ macros.setting_input_textarea('notify.yaml', '정책', value=arg['notify.yaml'], row='20') }}
|
||||
{{ macros.setting_input_text('tmp_message_id', 'Test Message ID', value='DEFAULT') }}
|
||||
{{ macros.setting_input_text_and_buttons('tmp_text_advanced', 'Test', [['tmp_advanced_test_btn', '전송']], value='테스트 메시지입니다.', col='9', desc=['저장 후 적용됩니다.']) }}
|
||||
|
||||
</div>
|
||||
{{ macros.m_tab_content_end() }}
|
||||
|
||||
@@ -46,8 +49,6 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var package_name = "{{arg['package_name']}}";
|
||||
var sub = "{{arg['sub'] }}";
|
||||
|
||||
$(document).ready(function(){
|
||||
use_collapse("notify_telegram_use");
|
||||
@@ -70,139 +71,19 @@ $('#notify_advaned_use').change(function() {
|
||||
|
||||
$("body").on('click', '#tmp_telegram_test_btn', function(e){
|
||||
e.preventDefault();
|
||||
bot_token = document.getElementById("notify_telegram_token").value;
|
||||
chat_id = document.getElementById("notify_telegram_chat_id").value;
|
||||
text = document.getElementById("tmp_text_telegram").value;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/'+sub+'/telegram_test',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{bot_token:bot_token, chat_id:chat_id, text:text},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
$.notify('<strong>전송 하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>전송에 실패하였습니다.<br>'+ret+'</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
param = $('#notify_telegram_token').val() + '||' + $('#notify_telegram_chat_id').val() + '||' + $('#notify_telegram_disable_notification').is(":checked") + '||' + $('#tmp_text_telegram').val();
|
||||
globalSendCommand('notify_test', 'telegram', param);
|
||||
});
|
||||
|
||||
$("body").on('click', '#tmp_discord_test_btn', function(e){
|
||||
e.preventDefault();
|
||||
url = document.getElementById("notify_discord_webhook").value;
|
||||
text = document.getElementById("tmp_text_discord").value;
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/'+sub+'/discord_test',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{url:url, text:text},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
$.notify('<strong>전송 하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>전송에 실패하였습니다.<br>'+ret+'</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
globalSendCommand('notify_test', 'discord', $('#notify_discord_webhook').val(), $('#tmp_text_discord').val());
|
||||
});
|
||||
|
||||
$("body").on('click', '#tmp_advanced_test_btn', function(e){
|
||||
e.preventDefault();
|
||||
policy = document.getElementById("notify_advaned_policy").value;
|
||||
text = document.getElementById("tmp_text_advanced").value;
|
||||
message_id = document.getElementById("tmp_message_id").value;
|
||||
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/'+sub+'/advanced_test',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data:{policy:policy, text:text, message_id:message_id},
|
||||
dataType: "json",
|
||||
success: function (ret) {
|
||||
if (ret) {
|
||||
$.notify('<strong>전송 하였습니다.</strong>', {
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
$.notify('<strong>전송에 실패하였습니다.<br>'+ret+'</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
globalSendCommand('notify_test', 'advanced', $('#tmp_message_id').val(), $('#tmp_text_advanced').val());
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$("body").on('click', '#capture_btn', function(e){
|
||||
e.preventDefault();
|
||||
url = document.getElementById('tmp_go_url').value
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/'+sub+'/capture',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {url:url},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.ret == 'success') {
|
||||
tmp = '<img src="' + data.data + '" class="img-fluid">'
|
||||
document.getElementById("image_div").innerHTML = tmp;
|
||||
} else {
|
||||
$.notify('<strong>실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//, ['full_capture_btn', '전체 캡처 이미지 다운']
|
||||
$("body").on('click', '#full_capture_btn', function(e){
|
||||
e.preventDefault();
|
||||
url = document.getElementById('tmp_go_url').value
|
||||
$.ajax({
|
||||
url: '/' + package_name + '/ajax/'+sub+'/full_capture',
|
||||
type: "POST",
|
||||
cache: false,
|
||||
data: {url:url},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.ret == 'success') {
|
||||
console.log('xxx')
|
||||
tmp = '<img src="' + data.data + '" class="img-fluid">'
|
||||
document.getElementById("image_div").innerHTML = tmp;
|
||||
} else {
|
||||
$.notify('<strong>실패하였습니다.</strong>', {
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user