fix(cronjob): fix issue with run cut website log failed (#8144)

This commit is contained in:
zhengkunwang 2025-03-13 18:19:14 +08:00 committed by GitHub
parent 2ed3aaa99b
commit c2dc38f02f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 31 additions and 22 deletions

View file

@ -147,7 +147,7 @@ func (u *CronjobRepo) StartRecords(cronjobID uint, targetPath, cronjobType strin
var record model.JobRecords
record.StartTime = time.Now()
record.CronjobID = cronjobID
if cronjobType != "directory" && cronjobType != "log" {
if cronjobType != "directory" && cronjobType != "log" && cronjobType != "cutWebsiteLog" {
record.TaskID = uuid.New().String()
}
record.Status = constant.StatusWaiting

View file

@ -981,15 +981,13 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
t.LogStart(i18n.GetMsgByKey("SyncAppDetail"))
for _, l := range list.Apps {
app := appsMap[l.AppProperty.Key]
_, iconRes, err := req_helper.HandleRequest(l.Icon, http.MethodGet, constant.TimeOut20s)
if err != nil {
return err
}
iconStr := ""
if !strings.Contains(string(iconRes), "<xml>") {
iconStr = base64.StdEncoding.EncodeToString(iconRes)
_, iconRes, err := req_helper.HandleRequest(l.Icon, http.MethodGet, constant.TimeOut20s)
if err == nil {
if !strings.Contains(string(iconRes), "<xml>") {
iconStr = base64.StdEncoding.EncodeToString(iconRes)
}
}
app.Icon = iconStr
app.TagsKey = l.AppProperty.Tags
if l.AppProperty.Recommend > 0 {
@ -1171,7 +1169,6 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
_ = settingService.Update("AppStoreSyncStatus", constant.StatusSyncSuccess)
_ = settingService.Update("AppStoreLastModified", strconv.Itoa(list.LastModified))
t.Log(i18n.GetMsgByKey("AppStoreSyncSuccess"))
return nil
}, nil)

View file

@ -224,9 +224,6 @@ func (t *Task) Execute() error {
}
if t.Task.Status == constant.StatusExecuting {
t.Task.Status = constant.StatusSuccess
t.Log(i18n.GetWithName("TaskSuccess", t.Name))
} else {
t.Log(i18n.GetWithName("TaskFailed", t.Name))
}
t.Log("[TASK-END]")
t.Task.EndAt = time.Now()

View file

@ -252,7 +252,7 @@ onMounted(() => {
}
.log-container {
height: calc(100vh - 320px);
height: calc(100vh - 350px);
overflow-y: auto;
overflow-x: auto;
position: relative;

View file

@ -26,6 +26,7 @@ const refreshRate = ref<number>(0);
const emit = defineEmits(['search']);
const props = defineProps({
title: String,
rate: Number,
});
let timer: NodeJS.Timer | null = null;
@ -57,10 +58,15 @@ onUnmounted(() => {
});
onMounted(() => {
if (props.title) {
if (props.title && localStorage.getItem(props.title) != null) {
let rate = Number(localStorage.getItem(props.title));
refreshRate.value = rate ? Number(rate) : 0;
changeRefresh();
return;
}
if (props.rate) {
refreshRate.value = props.rate;
changeRefresh();
}
});
</script>

View file

@ -11,7 +11,7 @@
<el-option :label="$t('logs.taskRunning')" value="Executing"></el-option>
</el-select>
<TableRefresh @search="search()" />
<TableSetting title="task-log-refresh" @search="search()" />
<TableSetting @search="search()" :rate="5" />
</template>
<template #main>
<ComplexTable :pagination-config="paginationConfig" :data="data" @search="search" :heightDiff="320">

View file

@ -312,6 +312,7 @@ const message = {
applyerror: 'Apply failed',
systemrestart: 'Interrupted',
starterr: 'Startup failed',
uperr: 'Startup failed',
},
units: {
second: 'Second',
@ -2916,7 +2917,7 @@ const message = {
defaultIpBlackHelper: 'Some malicious IPs collected from the Internet to prevent access',
notFoundCount: '404 Frequency Limit',
matchValue: 'Match value',
headerName: 'Supports English, numbers, -, length 3-30',
headerName: 'Supports non-special characters starting with English, numbers, -, length 3-30',
cdnHelper: 'Websites using CDN can open here to obtain the correct source IP',
clearLogWarn: 'Clearing the log will not be possible, do you want to continue?',
commonRuleHelper: 'Rule is fuzzy matching',

View file

@ -304,6 +304,7 @@ const message = {
applyerror: '適用に失敗しました',
systemrestart: '中断',
starterr: '起動に失敗しました',
uperr: '起動に失敗しました',
},
units: {
second: '2番目|2番目|',
@ -2734,7 +2735,7 @@ const message = {
defaultIpBlackHelper: 'インターネットから収集された悪意のあるIPをアクセス防止のために使用',
notFoundCount: '404頻度制限',
matchValue: '一致する値',
headerName: '数字-をサポート長さは3-30',
headerName: 'このフィールドは特別なキャラクターではなく英語数字-をサポート長さは3-30',
cdnHelper: 'CDNを使用しているウェブサイトはここで正しいソースIPを取得できます',
clearLogWarn: 'ログをクリアすると元に戻せません続けますか',
commonRuleHelper: 'ルールは部分一致です',

View file

@ -306,6 +306,7 @@ const message = {
applyerror: '적용 실패',
systemrestart: '중단됨',
starterr: '시작 실패',
uperr: '실행 실패',
},
units: {
second: ' | | ',
@ -2691,7 +2692,7 @@ const message = {
defaultIpBlackHelper: '인터넷에서 수집된 일부 악성 IP로 접근을 차단합니다.',
notFoundCount: '404 빈도 제한',
matchValue: '매칭 ',
headerName: '영어, 숫자, -, 길이 3-30 지원',
headerName: '필드는 특수 문자로 시작할 없으며,영어, 숫자, -, 길이 3-30 지원',
cdnHelper: 'CDN 사용하는 웹사이트는 여기서 원본 IP를 확인할 있습니다.',
clearLogWarn: '로그를 삭제하면 복구할 없습니다. 계속하시겠습니까?',
commonRuleHelper: '규칙은 유사 매칭 방식입니다.',

View file

@ -312,6 +312,7 @@ const message = {
applyerror: 'Permohonan gagal',
systemrestart: 'Dihentikan',
starterr: 'Permulaan gagal',
uperr: 'Permulaan gagal',
},
units: {
second: 'saat | saat | saat',

View file

@ -310,6 +310,7 @@ const message = {
applyerror: 'Falha na aplicação',
systemrestart: 'Interrompido',
starterr: 'Falha na inicialização',
uperr: 'Falha na inicialização',
},
units: {
second: 'segundo | segundos | segundos',

View file

@ -307,6 +307,7 @@ const message = {
applyerror: 'Ошибка применения',
systemrestart: 'Прервано',
starterr: 'Ошибка запуска',
uperr: 'Ошибка запуска',
},
units: {
second: ' секунда | секунда | секунд',

View file

@ -305,6 +305,7 @@ const message = {
applyerror: '申請失敗',
systemrestart: '中斷',
starterr: '啟動失敗',
uperr: '啟動失敗',
},
units: {
second: '秒',
@ -2703,7 +2704,7 @@ const message = {
defaultIpBlackHelper: '從網路收集的一些惡意 IP阻止其存取',
notFoundCount: '404 頻率限制',
matchValue: '匹配值',
headerName: '英文數字-長度3-30',
headerName: '持非特殊字元開頭英文數字-長度3-30',
cdnHelper: '使用 CDN 的網站可以打開此處來取得正確來源 IP',
clearLogWarn: '清空日誌將無法復原是否繼續',
commonRuleHelper: '規則為模糊匹配',

View file

@ -303,6 +303,7 @@ const message = {
applyerror: '申请失败',
systemrestart: '中断',
starterr: '启动失败',
uperr: '启动失败',
},
units: {
second: '秒',
@ -2691,7 +2692,7 @@ const message = {
defaultIpBlackHelper: '从互联网收集的一些恶意 IP阻止其访问',
notFoundCount: '404 频率限制',
matchValue: '匹配值',
headerName: '支持英文数字-,长度3-30',
headerName: '支持非特殊字符开头英文数字-,长度3-30',
cdnHelper: '使用 CDN 的网站可以打开此处来获取正确来源 IP',
clearLogWarn: '清空日志将无法恢复是否继续',
commonRuleHelper: '规则为模糊匹配',

View file

@ -172,7 +172,7 @@
></highlightjs>
</div>
</el-row>
<el-row v-if="currentRecord?.taskID">
<el-row v-if="currentRecord?.taskID && currentRecord?.taskID != ''">
<LogFile
:defaultButton="false"
class="w-full"
@ -378,6 +378,7 @@ const search = async () => {
if (currentRecord.value?.records) {
loadRecord(currentRecord.value);
}
console.log(currentRecord.value);
};
const forDetail = async (row: Cronjob.Record) => {

View file

@ -86,7 +86,7 @@
</el-row>
</el-form>
</div>
<ContainerLog v-if="activeName === 'log'" :container="containerID" />
<ContainerLog v-if="activeName === 'log'" :container="baseInfo.containerID" />
<SlowLog
@loading="changeLoading"
@refresh="loadBaseInfo"