mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-18 05:19:19 +08:00
feat: Adapt script library for offline mode. (#10436)
This commit is contained in:
parent
dfaa6e3694
commit
1a963f9dab
4 changed files with 20 additions and 7 deletions
|
|
@ -20,6 +20,9 @@ func Init() {
|
|||
}
|
||||
|
||||
func syncApp() {
|
||||
if global.CONF.Base.IsOffLine {
|
||||
return
|
||||
}
|
||||
_ = service.NewISettingService().Update("AppStoreSyncStatus", constant.StatusSyncSuccess)
|
||||
if err := service.NewIAppService().SyncAppListFromRemote(""); err != nil {
|
||||
global.LOG.Errorf("App Store synchronization failed")
|
||||
|
|
|
|||
|
|
@ -168,6 +168,9 @@ func LoadScriptInfo(id uint) (model.ScriptLibrary, error) {
|
|||
}
|
||||
|
||||
func (u *ScriptService) Sync(req dto.OperateByTaskID) error {
|
||||
if global.CONF.Base.IsOffLine {
|
||||
return nil
|
||||
}
|
||||
syncTask, err := task.NewTaskWithOps(i18n.GetMsgByKey("ScriptLibrary"), task.TaskSync, task.TaskScopeScript, req.TaskID, 0)
|
||||
if err != nil {
|
||||
global.LOG.Errorf("create sync task failed %v", err)
|
||||
|
|
|
|||
|
|
@ -19,9 +19,12 @@ func Init() {
|
|||
global.LOG.Errorf("[core] can not add backup token refresh corn job: %s", err.Error())
|
||||
}
|
||||
|
||||
if !global.CONF.Base.IsOffLine {
|
||||
scriptJob := job.NewScriptJob()
|
||||
if _, err := global.Cron.AddJob(fmt.Sprintf("%v %v * * *", mathRand.Intn(60), mathRand.Intn(3)), scriptJob); err != nil {
|
||||
global.LOG.Errorf("[core] can not add script sync corn job: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
global.Cron.Start()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,17 @@
|
|||
{{ version }}
|
||||
</el-link>
|
||||
<el-badge is-dot class="-mt-0.5" :hidden="version === 'Waiting' || !globalStore.hasNewVersion">
|
||||
<el-link class="ml-2" underline="never" type="primary" @click="onLoadUpgradeInfo">
|
||||
<el-link
|
||||
class="ml-2"
|
||||
underline="never"
|
||||
type="primary"
|
||||
@click="onLoadUpgradeInfo"
|
||||
v-if="!globalStore.isOffLine"
|
||||
>
|
||||
{{ $t('commons.button.update') }}
|
||||
</el-link>
|
||||
</el-badge>
|
||||
<el-tag v-if="version === 'Waiting'" round class="ml-2.5">
|
||||
{{ $t('setting.upgrading') }}
|
||||
</el-tag>
|
||||
<el-tag v-if="version === 'Waiting'" round class="ml-2.5">{{ $t('setting.upgrading') }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue