v0.6.20: GDM integration fixes and app context error resolution

This commit is contained in:
2026-01-07 22:35:46 +09:00
parent 7cfdfde446
commit c4cba97a7f
6 changed files with 529 additions and 412 deletions

View File

@@ -25,7 +25,9 @@
<form id="setting" class="mt-4">
<div class="tab-content" id="nav-tabContent">
{{ macros.m_tab_content_start('normal', true) }}
{{ macros.setting_input_text_and_buttons('anilife_url', '애니라이프 URL', [['go_btn', 'GO']], value=arg['anilife_url']) }}\n {{ macros.setting_input_text('anilife_proxy_url', '프록시 URL', col='4', value=arg.get('anilife_proxy_url', ''), desc='차단 시 프록시 서버를 입력하세요. 예: http://IP:PORT') }}\n {{ macros.setting_input_int('anilife_cache_ttl', 'HTTP 캐시 TTL (초)', value=arg.get('anilife_cache_ttl', 300), desc='HTTP 응답 캐시 유지 시간 (초 단위, 기본: 300초 = 5분)') }}
{{ macros.setting_input_text_and_buttons('anilife_url', '애니라이프 URL', [['go_btn', 'GO']], value=arg['anilife_url']) }}
{{ macros.setting_input_text('anilife_proxy_url', '프록시 URL', col='4', value=arg.get('anilife_proxy_url', ''), desc='차단 시 프록시 서버를 입력하세요. 예: http://IP:PORT') }}
{{ macros.setting_input_int('anilife_cache_ttl', 'HTTP 캐시 TTL (초)', value=arg.get('anilife_cache_ttl', 300), desc='HTTP 응답 캐시 유지 시간 (초 단위, 기본: 300초 = 5분)') }}
<!-- 저장 폴더 (탐색 버튼 포함) -->
<div class="row" style="padding-top: 10px; padding-bottom:10px; align-items: center;">
@@ -59,6 +61,7 @@
{{ macros.setting_checkbox('anilife_auto_make_season_folder', '시즌 폴더 생성', value=arg['anilife_auto_make_season_folder'], desc=['On : Season 번호 폴더를 만듭니다.']) }}
</div>
{{ macros.setting_checkbox('anilife_uncompleted_auto_enqueue', '자동으로 다시 받기', value=arg['anilife_uncompleted_auto_enqueue'], desc=['On : 플러그인 로딩시 미완료인 항목은 자동으로 다시 받습니다.']) }}
{{ macros.setting_select('anilife_cache_minutes', 'HTML 캐시 시간', [['0', '캐시 없음'], ['5', '5분'], ['10', '10분'], ['15', '15분'], ['30', '30분'], ['60', '1시간']], value=arg.get('anilife_cache_minutes', '5'), desc=['브라우징(요청, 검색) 페이지의 HTML을 캐시합니다.', '0으로 설정하면 캐시를 사용하지 않습니다.']) }}
{{ macros.m_tab_content_end() }}
{{ macros.m_tab_content_start('auto', false) }}
@@ -69,6 +72,46 @@
{{ macros.setting_checkbox('anilife_auto_mode_all', '에피소드 모두 받기', value=arg['anilife_auto_mode_all'], desc=['On : 이전 에피소드를 모두 받습니다.', 'Off : 최신 에피소드만 받습니다.']) }}
{{ macros.m_tab_content_end() }}
{{ macros.m_tab_content_start('action', false) }}
<div class="p-3" style="background: rgba(0,0,0,0.2); border-radius: 8px;">
<h5 class="text-info mb-3"><i class="bi bi-lightning-charge-fill mr-2"></i>Actions</h5>
{{ macros.setting_buttons([['global_one_execute_btn', '1회 실행']], left='1회 실행' ) }}
<hr style="border-color: rgba(255,255,255,0.1);">
{{ macros.setting_buttons([['global_reset_db_btn', 'DB 초기화']], left='DB정리' ) }}
<hr style="border-color: rgba(255,255,255,0.1);">
<h5 class="text-info mb-3"><i class="bi bi-cpu-fill mr-2"></i>시스템 상태 및 의존성</h5>
<div id="system_check_result" class="mb-3 p-3 rounded" style="background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05);">
<div class="d-flex align-items-center mb-2">
<span class="mr-2">Chromium/Chrome:</span>
<span id="browser_status_badge" class="badge badge-secondary">확인 중...</span>
</div>
<div id="browser_path_display" class="small text-muted mb-2" style="font-family: monospace;"></div>
<div id="install_guide_section" style="display:none;">
<p class="small text-warning mb-2"><i class="bi bi-exclamation-triangle-fill mr-1"></i>브라우저가 발견되지 않았습니다. Zendriver 기능을 위해 설치가 필요합니다.</p>
<div id="auto_install_div" style="display:none;">
<button type="button" id="auto_install_btn" class="btn btn-sm btn-outline-info mb-2">
<i class="bi bi-download mr-1"></i>자동 설치 (Ubuntu/Docker)
</button>
</div>
<div class="mt-2">
<small class="d-block text-muted mb-1">수동 설치 명령어:</small>
<div class="input-group input-group-sm">
<input type="text" id="manual_install_cmd" class="form-control form-control-sm bg-dark border-secondary text-info" readonly value="apt-get update && apt-get install -y chromium-browser">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="copy_cmd_btn"><i class="bi bi-clipboard"></i></button>
</div>
</div>
</div>
</div>
</div>
<hr style="border-color: rgba(255,255,255,0.1);">
<h5 class="text-info mb-3"><i class="bi bi-browser-chrome mr-2"></i>Zendriver 설정</h5>
{{ macros.setting_input_text('anilife_zendriver_browser_path', '브라우저 경로', value=arg.get('anilife_zendriver_browser_path', ''), desc=['Zendriver가 사용할 Chrome/Chromium 실행 파일 경로입니다.', '위의 시스템 상태에서 자동으로 찾은 경우 비워두셔도 됩니다 (수동 설정 시 우선 적용).']) }}
</div>
{{ macros.m_tab_content_end() }}
</div><!--tab-content-->
</form>
</div>
@@ -424,6 +467,129 @@ $('#folder_select_btn').on('click', function() {
});
function escapeHtml(text) { var div = document.createElement('div'); div.appendChild(document.createTextNode(text)); return div.innerHTML; }
// ======================================
// 1회 실행 버튼
// ======================================
$("body").on('click', '#global_one_execute_btn', function(e){
e.preventDefault();
$.ajax({
url: '/'+package_name+'/ajax/'+sub+'/immediately_execute',
type: "POST",
cache: false,
dataType: "json",
success: function(ret) {
if (ret.ret == 'success') {
$.notify('스케줄러 1회 실행을 시작합니다.', {type:'success'});
} else {
$.notify(ret.msg || '실행 실패', {type:'danger'});
}
},
error: function(xhr, status, error) {
$.notify('에러: ' + error, {type:'danger'});
}
});
});
// ======================================
// DB 초기화 버튼
// ======================================
$("body").on('click', '#global_reset_db_btn', function(e){
e.preventDefault();
if (!confirm('정말 DB를 초기화하시겠습니까?')) return;
$.ajax({
url: '/'+package_name+'/ajax/'+sub+'/reset_db',
type: "POST",
cache: false,
dataType: "json",
success: function(ret) {
if (ret.ret == 'success') {
$.notify('DB가 초기화되었습니다.', {type:'success'});
} else {
$.notify(ret.msg || '초기화 실패', {type:'danger'});
}
},
error: function(xhr, status, error) {
$.notify('에러: ' + error, {type:'danger'});
}
});
});
// ======================================
// 시스템 체크 및 브라우저 설치
// ======================================
function runSystemCheck() {
$.ajax({
url: '/' + package_name + '/ajax/' + sub + '/system_check',
type: 'POST',
success: function(ret) {
if (ret.browser_found) {
$('#browser_status_badge').removeClass('badge-secondary badge-danger badge-warning').addClass('badge-success').text('발견됨');
$('#browser_path_display').text('경로: ' + ret.browser_path);
$('#install_guide_section').hide();
} else {
if (ret.snap_error) {
$('#browser_status_badge').removeClass('badge-secondary badge-success badge-danger').addClass('badge-warning').text('스냅 오류');
$('#browser_path_display').html('<span class="text-warning">발견되었으나 Snap 버전입니다. 도커에서 작동하지 않습니다.</span>');
} else {
$('#browser_status_badge').removeClass('badge-secondary badge-success badge-warning').addClass('badge-danger').text('미설치');
$('#browser_path_display').text('');
}
$('#install_guide_section').show();
$('#manual_install_cmd').val(ret.install_cmd);
if (ret.can_install) {
$('#auto_install_div').show();
} else {
$('#auto_install_div').hide();
}
}
}
});
}
// 자동 설치 버튼
$('#auto_install_btn').on('click', function() {
if (!confirm('시스템 브라우저 설치를 시작하시겠습니까?\n(Ubuntu/Debian 기반 도커 환경에서만 작동합니다)')) return;
var btn = $(this);
btn.prop('disabled', true).html('<i class="bi bi-arrow-repeat spin mr-1"></i>설치 중 (최대 10분 소요)...');
$.ajax({
url: '/' + package_name + '/ajax/' + sub + '/install_browser',
type: 'POST',
success: function(ret) {
if (ret.ret === 'success') {
$.notify(ret.msg, {type: 'success'});
if (ret.path) {
$('#anilife_zendriver_browser_path').val(ret.path);
}
runSystemCheck();
} else {
$.notify(ret.msg, {type: 'danger'});
}
},
error: function() {
$.notify('설치 요청 중 오류가 발생했습니다.', {type: 'danger'});
},
complete: function() {
btn.prop('disabled', false).html('<i class="bi bi-download mr-1"></i>자동 설치 (Ubuntu/Docker)');
}
});
});
// 명령어 복사 버튼
$('#copy_cmd_btn').on('click', function() {
var copyText = document.getElementById("manual_install_cmd");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
$.notify('명령어가 복사되었습니다.', {type: 'info'});
});
// 초기 실행 - Action 탭 로드시 시스템 체크
$(document).ready(function() {
runSystemCheck();
});
</script>
<style>