diff --git a/backend/app/service/backup.go b/backend/app/service/backup.go
index e91915b8d..9375a2cff 100644
--- a/backend/app/service/backup.go
+++ b/backend/app/service/backup.go
@@ -5,14 +5,14 @@ import (
"encoding/json"
"fmt"
"os"
- "path"
+ "os/exec"
+ "strings"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/cloud_storage"
- "github.com/1Panel-dev/1Panel/backend/utils/files"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
)
@@ -205,7 +205,7 @@ func (u *BackupService) Update(req dto.BackupOperate) error {
if err != nil {
return constant.ErrRecordNotFound
}
- varMap := make(map[string]string)
+ varMap := make(map[string]interface{})
if err := json.Unmarshal([]byte(req.Vars), &varMap); err != nil {
return err
}
@@ -218,10 +218,12 @@ func (u *BackupService) Update(req dto.BackupOperate) error {
}
if backup.Type == "LOCAL" {
if dir, ok := varMap["dir"]; ok {
- if err := updateBackupDir(dir); err != nil {
- upMap["vars"] = backup.Vars
- _ = backupRepo.Update(req.ID, upMap)
- return err
+ if dirStr, isStr := dir.(string); isStr {
+ if err := updateBackupDir(dirStr); err != nil {
+ upMap["vars"] = backup.Vars
+ _ = backupRepo.Update(req.ID, upMap)
+ return err
+ }
}
}
}
@@ -295,20 +297,19 @@ func loadLocalDir() (string, error) {
func updateBackupDir(dir string) error {
oldDir := global.CONF.System.Backup
- fileOp := files.NewFileOp()
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
if err = os.MkdirAll(dir, os.ModePerm); err != nil {
return err
}
}
- global.Viper.Set("system.backup", path.Join(dir, "backup"))
- if err := global.Viper.WriteConfig(); err != nil {
- return err
+ if strings.HasSuffix(oldDir, "/") {
+ oldDir = oldDir[:strings.LastIndex(oldDir, "/")]
}
- if err := fileOp.CopyDir(oldDir, dir); err != nil {
- global.Viper.Set("system.backup", oldDir)
- _ = global.Viper.WriteConfig()
- return err
+ cmd := exec.Command("cp", "-r", oldDir+"/*", dir)
+ stdout, err := cmd.CombinedOutput()
+ if err != nil {
+ return errors.New(string(stdout))
}
+ global.CONF.System.Backup = dir
return nil
}
diff --git a/frontend/src/views/setting/about/index.vue b/frontend/src/views/setting/about/index.vue
index 201e894d3..2d0833512 100644
--- a/frontend/src/views/setting/about/index.vue
+++ b/frontend/src/views/setting/about/index.vue
@@ -15,7 +15,11 @@
{{ $t('setting.upgrading') }}
-
+
+
+ {{ $t('setting.doc') }}
+
+
{{ $t('setting.project') }}
@@ -23,10 +27,6 @@
{{ $t('setting.issue') }}
-
-
- {{ $t('setting.chat') }}
-
{{ $t('setting.star') }}
@@ -66,7 +66,7 @@ import 'md-editor-v3/lib/style.css';
import { ElMessageBox } from 'element-plus';
import i18n from '@/lang';
import DrawerHeader from '@/components/drawer-header/index.vue';
-import { MsgInfo, MsgSuccess } from '@/utils/message';
+import { MsgSuccess } from '@/utils/message';
const version = ref();
const upgradeInfo = ref();
@@ -79,15 +79,15 @@ const search = async () => {
version.value = res.data.systemVersion;
};
+const toDoc = () => {
+ window.open('https://1panel.cn/docs/', '_blank');
+};
const toGithub = () => {
window.open('https://github.com/1Panel-dev/1Panel', '_blank');
};
const toIssue = () => {
window.open('https://github.com/1Panel-dev/1Panel/issues', '_blank');
};
-const toTalk = () => {
- window.open('https://github.com/1Panel-dev/1Panel', '_blank');
-};
const toGithubStar = () => {
window.open('https://github.com/1Panel-dev/1Panel', '_blank');
};
@@ -102,7 +102,7 @@ const onLoadUpgradeInfo = async () => {
.then((res) => {
loading.value = false;
if (!res.data) {
- MsgInfo(i18n.global.t('setting.noUpgrade'));
+ MsgSuccess(i18n.global.t('setting.noUpgrade'));
return;
}
upgradeInfo.value = res.data;
diff --git a/frontend/src/views/setting/backup-account/operate/index.vue b/frontend/src/views/setting/backup-account/operate/index.vue
index 6bb4a283e..6ebf6ce03 100644
--- a/frontend/src/views/setting/backup-account/operate/index.vue
+++ b/frontend/src/views/setting/backup-account/operate/index.vue
@@ -82,14 +82,10 @@
-
+
-
+
-
+
@@ -167,6 +163,9 @@ const acceptParams = (params: DialogProps): void => {
dialogData.value.rowData!.varsJson['endpoint'].split('://')[1];
}
}
+ if (dialogData.value.title === 'create' && dialogData.value.rowData!.type === 'SFTP') {
+ dialogData.value.rowData.varsJson['port'] = 22;
+ }
title.value = i18n.global.t('commons.button.' + dialogData.value.title);
drawerVisiable.value = true;
};
@@ -186,6 +185,9 @@ const getBuckets = async () => {
loading.value = true;
let item = deepCopy(dialogData.value.rowData!.varsJson);
if (dialogData.value.rowData!.type === 'MINIO') {
+ dialogData.value.rowData!.varsJson['endpointItem'] = dialogData.value
+ .rowData!.varsJson['endpointItem'].replace('https://', '')
+ .replace('http://', '');
item['endpoint'] = endpoints.value + '://' + dialogData.value.rowData!.varsJson['endpointItem'];
item['endpointItem'] = undefined;
}
@@ -211,6 +213,7 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
if (!valid) return;
if (!dialogData.value.rowData) return;
if (dialogData.value.rowData!.type === 'MINIO') {
+ dialogData.value.rowData!.varsJson['endpointItem'].replace('https://', '').replace('http://', '');
dialogData.value.rowData!.varsJson['endpoint'] =
endpoints.value + '://' + dialogData.value.rowData!.varsJson['endpointItem'];
dialogData.value.rowData!.varsJson['endpointItem'] = undefined;
diff --git a/frontend/src/views/setting/panel/index.vue b/frontend/src/views/setting/panel/index.vue
index ae910de6c..5a7cefc6b 100644
--- a/frontend/src/views/setting/panel/index.vue
+++ b/frontend/src/views/setting/panel/index.vue
@@ -105,7 +105,7 @@
>
{{ $t('commons.button.sync') }}
- {{ count }} S
+ {{ count }} {{ $t('setting.second') }}
@@ -129,6 +129,8 @@ import { useI18n } from 'vue-i18n';
import { useTheme } from '@/hooks/use-theme';
import { MsgError, MsgSuccess } from '@/utils/message';
import Password from '@/views/setting/panel/password/index.vue';
+import router from '@/routers';
+import { logOutApi } from '@/api/modules/auth';
const loading = ref(false);
const i18n = useI18n();
@@ -214,7 +216,15 @@ const onSave = async (formEl: FormInstance | undefined, key: string, val: any) =
value: val + '',
};
await updateSetting(param)
- .then(() => {
+ .then(async () => {
+ loading.value = false;
+ MsgSuccess(i18n.t('commons.msg.operationSuccess'));
+ if (param.key === 'UserName') {
+ await logOutApi();
+ router.push({ name: 'login', params: { code: '' } });
+ globalStore.setLogStatus(false);
+ return;
+ }
loading.value = false;
MsgSuccess(i18n.t('commons.msg.operationSuccess'));
search();
diff --git a/frontend/src/views/setting/panel/password/index.vue b/frontend/src/views/setting/panel/password/index.vue
index f5efe1c1b..f5e789a92 100644
--- a/frontend/src/views/setting/panel/password/index.vue
+++ b/frontend/src/views/setting/panel/password/index.vue
@@ -59,6 +59,7 @@ import { GlobalStore } from '@/store';
import { reactive, ref } from 'vue';
import { updatePassword } from '@/api/modules/setting';
import DrawerHeader from '@/components/drawer-header/index.vue';
+import { logOutApi } from '@/api/modules/auth';
const globalStore = GlobalStore();
const passFormRef = ref();
@@ -113,10 +114,11 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
}
loading.value = true;
await updatePassword({ oldPassword: passForm.oldPassword, newPassword: password })
- .then(() => {
+ .then(async () => {
loading.value = false;
passwordVisiable.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
+ await logOutApi();
router.push({ name: 'login', params: { code: '' } });
globalStore.setLogStatus(false);
})