This commit is contained in:
flaskfarm
2022-10-06 14:39:43 +09:00
parent 435c5c9c36
commit b4e737a6b2
19 changed files with 378 additions and 248 deletions

View File

@@ -97,13 +97,13 @@ class Framework:
#if frame.config['use_celery'] == False or platform.system() == 'Windows':
if self.config['use_celery'] == False:
raise Exception('no celery')
try:
redis_port = os.environ['REDIS_PORT']
except:
try:
redis_port = self.config['redis_port']
except:
redis_port = '6379'
redis_port = os.environ.get('REDIS_PORT', None)
if redis_port == None:
redis_port = self.config.get('redis_port', None)
if redis_port == None:
redis_port = '6379'
self.app.config['CELERY_BROKER_URL'] = 'redis://localhost:%s/0' % redis_port
self.app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost:%s/0' % redis_port
@@ -183,7 +183,7 @@ class Framework:
if self.config['run_flask']:
if self.config.get('port') == None:
self.config['port'] = SP.SystemModelSetting.get_int('port')
self.config['port'] = self.SystemModelSetting.get_int('port')
from . import init_route, log_viewer
@@ -216,9 +216,12 @@ class Framework:
self.config['path_working'] = os.getcwd()
if os.environ.get('RUNNING_TYPE') == 'docker':
self.config['running_type'] = 'docker'
self.config['export_filepath'] = os.path.join(self.config['path_app'], 'export.sh')
self.config['exist_export'] = os.path.exists(self.config['export_filepath'])
self.__process_args()
self.__load_config()
self.__init_define()
self.config['menu_yaml_filepath'] = os.path.join(self.config['path_data'], 'db', 'menu.yaml')
elif mode == "flask":
self.app.secret_key = os.urandom(24)
#self.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data/db/system.db?check_same_thread=False'
@@ -298,7 +301,22 @@ class Framework:
# 예외적으로 현재폴더가 app일 경우 지저분해지는 것을 방지하기 위해 data 로 지정
if self.config['path_data'] == self.config['path_working']:
self.config['path_data'] = os.path.join(self.config['path_working'], 'data')
self.path_data = self.config['path_data']
self.path_data = self.config['path_data']
if self.config.get('use_gevent') == None:
self.config['use_gevent'] = True
if self.config.get('use_celery') == None:
self.config['use_celery'] = True
if self.config.get('debug') == None:
self.config['debug'] = False
if self.config.get('plugin_update') == None:
self.config['plugin_update'] = True
if self.config.get('plugin_loading_only_devpath') == None:
self.config['plugin_loading_only_devpath'] = False
if self.config.get('plugin_loading_list') == None:
self.config['plugin_loading_list'] = []
if self.config.get('plugin_except_list') == None:
self.config['plugin_except_list'] = []
@@ -399,7 +417,7 @@ class Framework:
for i in range(10):
try:
#self.logger.debug(d(self.config))
self.socketio.run(self.app, host=host, port=self.config['port'], debug=self.config['debug'], use_reloader=self.config['use_reloader'])
self.socketio.run(self.app, host=host, port=self.config['port'], debug=self.config['debug'], use_reloader=self.config['debug'])
self.logger.warning(f"EXIT CODE : {self.__exit_code}")
# 2021-05-18
if self.config['running_type'] in ['termux', 'entware']:

View File

@@ -86,9 +86,6 @@ class MenuManager:
#F.logger.warning(d(cls.menu_map))
@classmethod
def get_menu_map(cls):

View File

@@ -63,7 +63,7 @@ class PluginManager:
# plugin_loading_list
try:
plugin_loading_list = F.config.get('plugin_loading_list', None)
if plugin_loading_list != None and type(plugin_loading_list) == type([]):
if plugin_loading_list != None and (type(plugin_loading_list) == type([]) and len(plugin_loading_list)) > 0:
new_plugins = []
for _ in plugins:
if _ in plugin_loading_list:
@@ -76,7 +76,7 @@ class PluginManager:
# plugin_except_list
try:
plugin_except_list = F.config.get('plugin_except_list', None)
if plugin_except_list != None and type(plugin_except_list) == type([]):
if plugin_except_list != None and (type(plugin_except_list) == type([]) and len(plugin_except_list)) > 0:
new_plugins = []
for _ in plugins:
if _ not in plugin_except_list:

View File

@@ -146,6 +146,13 @@ function globalSendCommand(command, arg1, arg2, arg3, modal_title, callback) {
});
}
function shutdown_confirm() {
$("#confirm_title").html("종료 확인");
$("#confirm_body").html("종료 하시겠습니까?");
$('#confirm_button').attr('onclick', 'window.location.href = "/system/shutdown";');
$("#confirm_modal").modal();
}
///////////////////////////////////////
// 파일 선택 모달

View File

@@ -166,12 +166,7 @@ function global_relay_test(remote) {
function shutdown_confirm() {
document.getElementById("confirm_title").innerHTML = "종료 확인";
document.getElementById("confirm_body").innerHTML = "종료 하시겠습니까?";
$('#confirm_button').attr('onclick', 'window.location.href = "/system/shutdown";');
$("#confirm_modal").modal();
}
$("#video_modal").on('hidden.bs.modal', function () {
document.getElementById("video_modal_video").pause();

View File

@@ -19,13 +19,10 @@
{% if 'uri' in category and category['uri'].startswith('http') %}
<li class="nav-item"> <a class="nav-link" href="{{ category['uri']}}" target="_blank">{{category['name']}}</a></li>
{% else %}
<!--{{ category }}-->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{category['name']}}</a>
<ul class="dropdown-menu">
{% for category_child in category['list'] %}
{% if category_child['uri'] == 'setting' %}
<li><a class="dropdown-item" href="#" style="font-size: .850rem; font-weight:bold">{{category_child['name']}}</a>
@@ -35,8 +32,6 @@
{% endfor %}
</ul>
</li>
{% elif category_child['uri'] == '-' %}
<div class="dropdown-divider"></div>
{% elif 'uri' in category_child and category_child['uri'].startswith('http') %}
@@ -45,6 +40,8 @@
{% else %}
<a class="dropdown-item" href="{{ category_child['uri'] }}" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>
{% endif %}
{% elif 'uri' in category_child and category_child['uri'].startswith('javascript') %}
<a class="dropdown-item" href="{{ category_child['uri'] }}" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>
{% else %}
{% if category_child['uri'] == menu[0] %}
<a class="dropdown-item active" href="/{{ category_child['uri'] }}" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>