修复#6903,升级xxl-job 至2.4.1版本,规避CVE-2024-24113

This commit is contained in:
EightMonth
2024-08-09 15:27:19 +08:00
parent d51127a9b7
commit 1d2b10c2a5
63 changed files with 1503 additions and 757 deletions

View File

@ -123,7 +123,7 @@ $(function() {
var id = $(this).attr("_id");
var row = tableData['key'+id];
var html = '<div>';
/*var html = '<div>';
if (row.registryList) {
for (var index in row.registryList) {
html += (parseInt(index)+1) + '. <span class="badge bg-green" >' + row.registryList[index] + '</span><br>';
@ -135,8 +135,19 @@ $(function() {
title: I18n.jobinfo_opt_registryinfo ,
btn: [ I18n.system_ok ],
content: html
});
});*/
var html = '<table class="table table-bordered"><tbody>';
if (row.registryList) {
for (var index in row.registryList) {
html += '<tr><th>' + (parseInt(index)+1) + '</th>';
html += '<th><span class="badge bg-green" >' + row.registryList[index] + '</span></th><tr>';
}
}
html += '</tbody></table>';
$('#showRegistryListModal .data').html(html);
$('#showRegistryListModal').modal({backdrop: false, keyboard: false}).modal('show');
});

View File

@ -48,6 +48,18 @@ $(function() {
"visible" : true,
"width":'25%'
},
{
"data": 'scheduleType',
"visible" : true,
"width":'13%',
"render": function ( data, type, row ) {
if (row.scheduleConf) {
return row.scheduleType + ''+ row.scheduleConf;
} else {
return row.scheduleType;
}
}
},
{
"data": 'glueType',
"width":'25%',
@ -62,11 +74,6 @@ $(function() {
}
},
{ "data": 'executorParam', "visible" : false},
{
"data": 'jobCron',
"visible" : true,
"width":'13%'
},
{
"data": 'addTime',
"visible" : false,
@ -111,10 +118,16 @@ $(function() {
start_stop_div = '<li><a href="javascript:void(0);" class="job_operate" _type="job_resume" >'+ I18n.jobinfo_opt_start +'</a></li>\n';
}
// job_next_time_html
var job_next_time_html = '';
if (row.scheduleType == 'CRON' || row.scheduleType == 'FIX_RATE') {
job_next_time_html = '<li><a href="javascript:void(0);" class="job_next_time" >' + I18n.jobinfo_opt_next_time + '</a></li>\n';
}
// log url
var logHref = base_url +'/joblog?jobId='+ row.id;
// log url
// code url
var codeBtn = "";
if ('BEAN' != row.glueType) {
var codeUrl = base_url +'/jobcode?jobId='+ row.id;
@ -136,7 +149,7 @@ $(function() {
' <li><a href="javascript:void(0);" class="job_trigger" >'+ I18n.jobinfo_opt_run +'</a></li>\n' +
' <li><a href="'+ logHref +'">'+ I18n.jobinfo_opt_log +'</a></li>\n' +
' <li><a href="javascript:void(0);" class="job_registryinfo" >' + I18n.jobinfo_opt_registryinfo + '</a></li>\n' +
' <li><a href="javascript:void(0);" class="job_next_time" >' + I18n.jobinfo_opt_next_time + '</a></li>\n' +
job_next_time_html +
' <li class="divider"></li>\n' +
codeBtn +
start_stop_div +
@ -322,17 +335,16 @@ $(function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
var jobCron = row.jobCron;
$.ajax({
type : 'POST',
url : base_url + "/jobinfo/nextTriggerTime",
data : {
"cron" : jobCron
"scheduleType" : row.scheduleType,
"scheduleConf" : row.scheduleConf
},
dataType : "json",
success : function(data){
if (data.code != 200) {
layer.open({
title: I18n.jobinfo_opt_next_time ,
@ -364,8 +376,14 @@ $(function() {
$(".add").click(function(){
// init-cronGen
$("#addModal .form input[name='jobCron']").show().siblings().remove();
$("#addModal .form input[name='jobCron']").cronGen({});
$("#addModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#addModal .form input[name='schedule_conf_CRON']").cronGen({});
// 》init scheduleType
$("#updateModal .form select[name=scheduleType]").change();
// 》init glueType
$("#updateModal .form select[name=glueType]").change();
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
});
@ -378,35 +396,29 @@ $(function() {
required : true,
maxlength: 50
},
jobCron : {
required : true
},
author : {
required : true
},
}/*,
executorTimeout : {
digits:true
},
executorFailRetryCount : {
digits:true
}
}*/
},
messages : {
jobDesc : {
required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
jobCron : {
required : I18n.system_please_input + "Cron"
},
author : {
required : I18n.system_please_input + I18n.jobinfo_field_author
},
}/*,
executorTimeout : {
digits: I18n.system_please_input + I18n.system_digits
},
executorFailRetryCount : {
digits: I18n.system_please_input + I18n.system_digits
}
}*/
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
@ -420,7 +432,7 @@ $(function() {
},
submitHandler : function(form) {
// process
// process executorTimeout+executorFailRetryCount
var executorTimeout = $("#addModal .form input[name='executorTimeout']").val();
if(!/^\d+$/.test(executorTimeout)) {
executorTimeout = 0;
@ -432,8 +444,17 @@ $(function() {
}
$("#addModal .form input[name='executorFailRetryCount']").val(executorFailRetryCount);
// process-cronGen
$("#addModal .form input[name='jobCron']").val( $("#addModal .form input[name='cronGen_display']").val() );
// process schedule_conf
var scheduleType = $("#addModal .form select[name='scheduleType']").val();
var scheduleConf;
if (scheduleType == 'CRON') {
scheduleConf = $("#addModal .form input[name='cronGen_display']").val();
} else if (scheduleType == 'FIX_RATE') {
scheduleConf = $("#addModal .form input[name='schedule_conf_FIX_RATE']").val();
} else if (scheduleType == 'FIX_DELAY') {
scheduleConf = $("#addModal .form input[name='schedule_conf_FIX_DELAY']").val();
}
$("#addModal .form input[name='scheduleConf']").val( scheduleConf );
$.post(base_url + "/jobinfo/add", $("#addModal .form").serialize(), function(data, status) {
if (data.code == "200") {
@ -468,6 +489,13 @@ $(function() {
$("#addModal .form input[name='executorHandler']").removeAttr("readonly");
});
// scheduleType change
$(".scheduleType").change(function(){
var scheduleType = $(this).val();
$(this).parents("form").find(".schedule_conf").hide();
$(this).parents("form").find(".schedule_conf_" + scheduleType).show();
});
// glueType change
$(".glueType").change(function(){
@ -508,27 +536,46 @@ $(function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
// base data
// fill base
$("#updateModal .form input[name='id']").val( row.id );
$('#updateModal .form select[name=jobGroup] option[value='+ row.jobGroup +']').prop('selected', true);
$("#updateModal .form input[name='jobDesc']").val( row.jobDesc );
$("#updateModal .form input[name='jobCron']").val( row.jobCron );
$("#updateModal .form input[name='author']").val( row.author );
$("#updateModal .form input[name='alarmEmail']").val( row.alarmEmail );
$("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
$('#updateModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
// fill trigger
$('#updateModal .form select[name=scheduleType] option[value='+ row.scheduleType +']').prop('selected', true);
$("#updateModal .form input[name='scheduleConf']").val( row.scheduleConf );
if (row.scheduleType == 'CRON') {
$("#updateModal .form input[name='schedule_conf_CRON']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_RATE') {
$("#updateModal .form input[name='schedule_conf_FIX_RATE']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_DELAY') {
$("#updateModal .form input[name='schedule_conf_FIX_DELAY']").val( row.scheduleConf );
}
// 》init scheduleType
$("#updateModal .form select[name=scheduleType]").change();
// fill job
$('#updateModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#updateModal .form input[name='executorHandler']").val( row.executorHandler );
$("#updateModal .form textarea[name='executorParam']").val( row.executorParam );
$("#updateModal .form input[name='childJobId']").val( row.childJobId );
// 》init glueType
$("#updateModal .form select[name=glueType]").change();
// 》init-cronGen
$("#updateModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#updateModal .form input[name='schedule_conf_CRON']").cronGen({});
// fill advanced
$('#updateModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
$("#updateModal .form input[name='childJobId']").val( row.childJobId );
$('#updateModal .form select[name=misfireStrategy] option[value='+ row.misfireStrategy +']').prop('selected', true);
$('#updateModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$('#updateModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#updateModal .form select[name=glueType]").change();
// init-cronGen
$("#updateModal .form input[name='jobCron']").show().siblings().remove();
$("#updateModal .form input[name='jobCron']").cronGen({});
$("#updateModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#updateModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
// show
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
@ -543,35 +590,17 @@ $(function() {
required : true,
maxlength: 50
},
jobCron : {
required : true
},
author : {
required : true
},
executorTimeout : {
digits:true
},
executorFailRetryCount : {
digits:true
}
}
},
messages : {
jobDesc : {
required : I18n.system_please_input + I18n.jobinfo_field_jobdesc
},
jobCron : {
required : I18n.system_please_input + "Cron"
},
author : {
required : I18n.system_please_input + I18n.jobinfo_field_author
},
executorTimeout : {
digits: I18n.system_please_input + I18n.system_digits
},
executorFailRetryCount : {
digits: I18n.system_please_input + I18n.system_digits
}
}
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
@ -585,7 +614,7 @@ $(function() {
},
submitHandler : function(form) {
// process
// process executorTimeout + executorFailRetryCount
var executorTimeout = $("#updateModal .form input[name='executorTimeout']").val();
if(!/^\d+$/.test(executorTimeout)) {
executorTimeout = 0;
@ -597,8 +626,18 @@ $(function() {
}
$("#updateModal .form input[name='executorFailRetryCount']").val(executorFailRetryCount);
// process-cronGen
$("#updateModal .form input[name='jobCron']").val( $("#updateModal .form input[name='cronGen_display']").val() );
// process schedule_conf
var scheduleType = $("#updateModal .form select[name='scheduleType']").val();
var scheduleConf;
if (scheduleType == 'CRON') {
scheduleConf = $("#updateModal .form input[name='cronGen_display']").val();
} else if (scheduleType == 'FIX_RATE') {
scheduleConf = $("#updateModal .form input[name='schedule_conf_FIX_RATE']").val();
} else if (scheduleType == 'FIX_DELAY') {
scheduleConf = $("#updateModal .form input[name='schedule_conf_FIX_DELAY']").val();
}
$("#updateModal .form input[name='scheduleConf']").val( scheduleConf );
// post
$.post(base_url + "/jobinfo/update", $("#updateModal .form").serialize(), function(data, status) {
@ -653,27 +692,45 @@ $(function() {
var id = $(this).parents('ul').attr("_id");
var row = tableData['key'+id];
// base data
//$("#addModal .form input[name='id']").val( row.id );
// fill base
$('#addModal .form select[name=jobGroup] option[value='+ row.jobGroup +']').prop('selected', true);
$("#addModal .form input[name='jobDesc']").val( row.jobDesc );
$("#addModal .form input[name='jobCron']").val( row.jobCron );
$("#addModal .form input[name='author']").val( row.author );
$("#addModal .form input[name='alarmEmail']").val( row.alarmEmail );
$("#addModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#addModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
$('#addModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
// fill trigger
$('#addModal .form select[name=scheduleType] option[value='+ row.scheduleType +']').prop('selected', true);
$("#addModal .form input[name='scheduleConf']").val( row.scheduleConf );
if (row.scheduleType == 'CRON') {
$("#addModal .form input[name='schedule_conf_CRON']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_RATE') {
$("#addModal .form input[name='schedule_conf_FIX_RATE']").val( row.scheduleConf );
} else if (row.scheduleType == 'FIX_DELAY') {
$("#addModal .form input[name='schedule_conf_FIX_DELAY']").val( row.scheduleConf );
}
// 》init scheduleType
$("#addModal .form select[name=scheduleType]").change();
// fill job
$('#addModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
$("#addModal .form input[name='executorHandler']").val( row.executorHandler );
$("#addModal .form textarea[name='executorParam']").val( row.executorParam );
$("#addModal .form input[name='childJobId']").val( row.childJobId );
$('#addModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$('#addModal .form select[name=glueType] option[value='+ row.glueType +']').prop('selected', true);
// 》init glueType
$("#addModal .form select[name=glueType]").change();
// init-cronGen
$("#addModal .form input[name='jobCron']").show().siblings().remove();
$("#addModal .form input[name='jobCron']").cronGen({});
// init-cronGen
$("#addModal .form input[name='schedule_conf_CRON']").show().siblings().remove();
$("#addModal .form input[name='schedule_conf_CRON']").cronGen({});
// fill advanced
$('#addModal .form select[name=executorRouteStrategy] option[value='+ row.executorRouteStrategy +']').prop('selected', true);
$("#addModal .form input[name='childJobId']").val( row.childJobId );
$('#addModal .form select[name=misfireStrategy] option[value='+ row.misfireStrategy +']').prop('selected', true);
$('#addModal .form select[name=executorBlockStrategy] option[value='+ row.executorBlockStrategy +']').prop('selected', true);
$("#addModal .form input[name='executorTimeout']").val( row.executorTimeout );
$("#addModal .form input[name='executorFailRetryCount']").val( row.executorFailRetryCount );
// show
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');

View File

@ -25,8 +25,6 @@ $(function() {
async: false, // sync, make log ordered
url : base_url + '/joblog/logDetailCat',
data : {
"executorAddress":executorAddress,
"triggerTime":triggerTime,
"logId":logId,
"fromLineNum":fromLineNum
},

View File

@ -116,7 +116,7 @@ $(function() {
"data": 'triggerTime',
"width":'20%',
"render": function ( data, type, row ) {
return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
return data?moment(data).format("YYYY-MM-DD HH:mm:ss"):"";
}
},
{
@ -145,7 +145,7 @@ $(function() {
"data": 'handleTime',
"width":'20%',
"render": function ( data, type, row ) {
return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
return data?moment(data).format("YYYY-MM-DD HH:mm:ss"):"";
}
},
{
@ -187,6 +187,12 @@ $(function() {
}*/
//return temp;
var logKillDiv = '';
if(row.handleCode == 0){
logKillDiv = ' <li class="divider"></li>\n' +
' <li><a href="javascript:void(0);" class="logKill" _id="'+ row.id +'" >'+ I18n.joblog_kill_log +'</a></li>\n';
}
var html = '<div class="btn-group">\n' +
' <button type="button" class="btn btn-primary btn-sm">'+ I18n.system_opt +'</button>\n' +
' <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">\n' +
@ -195,8 +201,7 @@ $(function() {
' </button>\n' +
' <ul class="dropdown-menu" role="menu" _id="'+ row.id +'" >\n' +
' <li><a href="javascript:void(0);" class="logDetail" _id="'+ row.id +'" >'+ I18n.joblog_rolling_log +'</a></li>\n' +
' <li class="divider"></li>\n' +
' <li><a href="javascript:void(0);" class="logKill" _id="'+ row.id +'" >'+ I18n.joblog_kill_log +'</a></li>\n' +
logKillDiv +
' </ul>\n' +
' </div>';

View File

@ -50,7 +50,7 @@ $(function(){
if (data.code == "200") {
layer.msg( I18n.login_success );
setTimeout(function(){
window.location.href = base_url;
window.location.href = base_url + "/";
}, 500);
} else {
layer.open({

View File

@ -33,7 +33,7 @@ $(function() {
},
{
"data": 'password',
"visible" : true,
"visible" : false,
"width":'20%',
"render": function ( data, type, row ) {
return '*********';

View File

@ -10,7 +10,7 @@
options = $.extend({}, $.fn.cronGen.defaultOptions, options);
//create top menu
var cronContainer = $("<div/>", { id: "CronContainer", style: "display:none;width:300px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:420px;" });
var topMenu = $("<ul/>", { "class": "nav nav-tabs", id: "CronGenTabs" });
$('<li/>', { 'class': 'active' }).html($('<a id="SecondlyTab" href="#Secondly"></a>')).appendTo(topMenu);
$('<li/>').html($('<a id="MinutesTab" href="#Minutes">分钟</a>')).appendTo(topMenu);
@ -318,9 +318,12 @@
// resultsName = $(this).prop("id");
// $(this).prop("name", resultsName);
var runTime = '<br style="padding-top: 10px"><label>最近运行时间: </label></br><textarea id="runTime" rows="6" style="width: 90%;resize: none;background: none;border: none;outline: none;" readonly = readonly></textarea></div>';
$(span12).appendTo(row);
$(row).appendTo(container);
$(container).appendTo(mainDiv);
$(runTime).appendTo(mainDiv);
$(cronContainer).append(mainDiv);
var that = $(this);
@ -351,9 +354,13 @@
return $(cronContainer).html();
},
template: '<div class="popover" style="max-width:500px !important; width:425px;left:-341.656px;"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>',
sanitize:false,
placement: options.direction
}).on('click', function (e) {
if (inputElement.val().trim() !== '') {
refreshRunTime();
}
e.preventDefault();
//fillDataOfMinutesAndHoursSelectOptions();
@ -374,6 +381,7 @@
});
$("#CronGenMainDiv select,input").change(function (e) {
generate();
refreshRunTime();
});
$("#CronGenMainDiv input").focus(function (e) {
generate();
@ -628,6 +636,25 @@
displayElement.val(results);
};
var refreshRunTime = function () {
$.ajax({
type : 'GET',
url : base_url + "/jobinfo/nextTriggerTime",
data : {
"scheduleType" : 'CRON',
"scheduleConf" : inputElement.val()
},
dataType : "json",
success : function(data){
if (data.code === 200) {
$('#runTime').val(data.content.join("\n"));
} else {
$('#runTime').val(data.msg);
}
}
});
};
})(jQuery);
(function($) {
@ -1011,12 +1038,12 @@
//获取参数中表达式的值
if (cronExpress) {
var regs = cronExpress.split(' ');
$("input[name=secondHidden]").val(regs[0]);
$("input[name=minHidden]").val(regs[1]);
$("input[name=hourHidden]").val(regs[2]);
$("input[name=dayHidden]").val(regs[3]);
$("input[name=monthHidden]").val(regs[4]);
$("input[name=weekHidden]").val(regs[5]);
$("#secondHidden").val(regs[0]);
$("#minHidden").val(regs[1]);
$("#hourHidden").val(regs[2]);
$("#dayHidden").val(regs[3]);
$("#monthHidden").val(regs[4]);
$("#weekHidden").val(regs[5]);
$.fn.cronGen.tools.initObj(regs[0], "second");
$.fn.cronGen.tools.initObj(regs[1], "min");

View File

@ -10,7 +10,7 @@
options = $.extend({}, $.fn.cronGen.defaultOptions, options);
//create top menu
var cronContainer = $("<div/>", { id: "CronContainer", style: "display:none;width:300px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:300px;" });
var mainDiv = $("<div/>", { id: "CronGenMainDiv", style: "width:410px;height:420px;" });
var topMenu = $("<ul/>", { "class": "nav nav-tabs", id: "CronGenTabs" });
$('<li/>', { 'class': 'active' }).html($('<a id="SecondlyTab" href="#Secondly"></a>')).appendTo(topMenu);
$('<li/>').html($('<a id="MinutesTab" href="#Minutes">Minute</a>')).appendTo(topMenu);
@ -318,9 +318,12 @@
// resultsName = $(this).prop("id");
// $(this).prop("name", resultsName);
var runTime = '<br style="padding-top: 10px"><label>Recent Run Time: </label></br><textarea id="runTime" rows="6" style="width: 90%;resize: none;background: none;border: none;outline: none;" readonly = readonly></textarea></div>';
$(span12).appendTo(row);
$(row).appendTo(container);
$(container).appendTo(mainDiv);
$(runTime).appendTo(mainDiv);
$(cronContainer).append(mainDiv);
var that = $(this);
@ -351,9 +354,13 @@
return $(cronContainer).html();
},
template: '<div class="popover" style="max-width:500px !important; width:425px;left:-341.656px;"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>',
sanitize:false,
placement: options.direction
}).on('click', function (e) {
if (inputElement.val().trim() !== '') {
refreshRunTime();
}
e.preventDefault();
//fillDataOfMinutesAndHoursSelectOptions();
@ -374,6 +381,7 @@
});
$("#CronGenMainDiv select,input").change(function (e) {
generate();
refreshRunTime();
});
$("#CronGenMainDiv input").focus(function (e) {
generate();
@ -628,6 +636,25 @@
displayElement.val(results);
};
var refreshRunTime = function () {
$.ajax({
type : 'GET',
url : base_url + "/jobinfo/nextTriggerTime",
data : {
"scheduleType" : 'CRON',
"scheduleConf" : inputElement.val()
},
dataType : "json",
success : function(data){
if (data.code === 200) {
$('#runTime').val(data.content.join("\n"));
} else {
$('#runTime').val(data.msg);
}
}
});
};
})(jQuery);
(function($) {
@ -1011,12 +1038,12 @@
//获取参数中表达式的值
if (cronExpress) {
var regs = cronExpress.split(' ');
$("input[name=secondHidden]").val(regs[0]);
$("input[name=minHidden]").val(regs[1]);
$("input[name=hourHidden]").val(regs[2]);
$("input[name=dayHidden]").val(regs[3]);
$("input[name=monthHidden]").val(regs[4]);
$("input[name=weekHidden]").val(regs[5]);
$("#secondHidden").val(regs[0]);
$("#minHidden").val(regs[1]);
$("#hourHidden").val(regs[2]);
$("#dayHidden").val(regs[3]);
$("#monthHidden").val(regs[4]);
$("#weekHidden").val(regs[5]);
$.fn.cronGen.tools.initObj(regs[0], "second");
$.fn.cronGen.tools.initObj(regs[1], "min");