Compare commits

...
11 Commits
9 changed files with 20 additions and 10 deletions
+1
View File
@@ -44,6 +44,7 @@ curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_
- [在线文档](https://1panel.cn/docs/)
- [教学视频](https://space.bilibili.com/510493147/channel/collectiondetail?sid=1199760)
- [社区论坛](https://bbs.fit2cloud.com/c/1p/7)
- [如何加入微信交流群?](https://bbs.fit2cloud.com/t/topic/2147)
## 安全说明
+1 -1
View File
@@ -217,12 +217,12 @@ func (u *ImageRepoService) handleRegistries(newHost, delHost, handle string) err
case "create":
registries = common.RemoveRepeatElement(append(registries, newHost))
case "update":
registries = common.RemoveRepeatElement(append(registries, newHost))
for i, regi := range registries {
if regi == delHost {
registries = append(registries[:i], registries[i+1:]...)
}
}
registries = common.RemoveRepeatElement(append(registries, newHost))
case "delete":
for i, regi := range registries {
if regi == delHost {
+5 -2
View File
@@ -196,8 +196,11 @@ func opNginx(containerName, operate string) error {
if operate == constant.NginxCheck {
nginxCmd = fmt.Sprintf("docker exec -i %s %s", containerName, "nginx -t")
}
if out, err := cmd.ExecWithTimeOut(nginxCmd, 2*time.Second); err != nil {
return errors.New(out)
if out, err := cmd.ExecWithTimeOut(nginxCmd, 20*time.Second); err != nil {
if out != "" {
return errors.New(out)
}
return err
}
return nil
}
+1 -1
View File
@@ -220,7 +220,7 @@ func (r *Local) Backup(info BackupInfo) error {
}
outfile, _ := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
global.LOG.Infof("start to mysqldump | gzip > %s.gzip", info.TargetDir+"/"+info.FileName)
cmd := exec.Command("docker", "exec", r.ContainerName, "mysqldump", "-uroot", "-p"+r.Password, info.Name)
cmd := exec.Command("docker", "exec", r.ContainerName, "mysqldump", "-uroot", "-p"+r.Password, "--default-character-set="+info.Format, info.Name)
gzipCmd := exec.Command("gzip", "-cf")
gzipCmd.Stdin, _ = cmd.StdoutPipe()
gzipCmd.Stdout = outfile
@@ -6,7 +6,7 @@
<el-row>
<el-col :span="22" :offset="1" v-loading="loading">
<FileRole :mode="mode" @get-mode="getMode"></FileRole>
<FileRole :mode="mode" @get-mode="getMode" :key="open.toString()"></FileRole>
<el-form ref="fileForm" label-position="left" :model="addForm" label-width="100px" :rules="rules">
<el-form-item :label="$t('commons.table.user')" prop="user">
<el-input v-model.trim="addForm.user" />
@@ -6,7 +6,7 @@
<el-row>
<el-col :span="22" :offset="1">
<FileRole v-loading="loading" :mode="mode" @get-mode="getMode"></FileRole>
<FileRole v-loading="loading" :mode="mode" @get-mode="getMode" :key="open.toString()"></FileRole>
<el-form-item v-if="form.isDir">
<el-checkbox v-model="form.sub">{{ $t('file.containSub') }}</el-checkbox>
</el-form-item>
@@ -44,7 +44,7 @@
<el-checkbox v-if="addForm.isDir" v-model="setRole" :label="$t('file.setRole')"></el-checkbox>
</el-form-item>
</el-form>
<FileRole v-if="setRole" :mode="'0755'" @get-mode="getMode"></FileRole>
<FileRole v-if="setRole" :mode="'0755'" @get-mode="getMode" :key="open.toString()"></FileRole>
</el-col>
</el-row>
@@ -189,6 +189,7 @@ const loginRules = reactive({
password: computed(() => [{ required: true, message: i18n.global.t('commons.rule.password'), trigger: 'blur' }]),
});
let isLoggingIn = false;
const mfaButtonFocused = ref();
const mfaLoginForm = reactive({
name: '',
@@ -223,7 +224,7 @@ function handleCommand(command: string) {
}
const login = (formEl: FormInstance | undefined) => {
if (!formEl) return;
if (!formEl || isLoggingIn) return;
formEl.validate(async (valid) => {
if (!valid) return;
let requestLoginForm = {
@@ -244,6 +245,7 @@ const login = (formEl: FormInstance | undefined) => {
return;
}
try {
isLoggingIn = true;
loading.value = true;
const res = await loginApi(requestLoginForm);
if (res.code === 406) {
@@ -274,18 +276,22 @@ const login = (formEl: FormInstance | undefined) => {
} catch (error) {
loginVerify();
} finally {
isLoggingIn = false;
loading.value = false;
}
});
};
const mfaLogin = async (auto: boolean) => {
if (isLoggingIn) return;
if ((!auto && mfaLoginForm.code) || (auto && mfaLoginForm.code.length === 6)) {
isLoggingIn = true;
mfaLoginForm.name = loginForm.name;
mfaLoginForm.password = loginForm.password;
const res = await mfaLoginApi(mfaLoginForm);
if (res.code === 406) {
errMfaInfo.value = true;
isLoggingIn = false;
return;
}
globalStore.setLogStatus(true);
+2 -2
View File
@@ -1,7 +1,7 @@
sonar.projectKey=1Panel-dev_1Panel
sonar.organization=1panel-dev
sonar.exclusions= frontend/src/lang/modules/*
sonar.exclusions=frontend/src/lang/modules/*,backend/i18n/lang/*
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=1Panel
@@ -12,4 +12,4 @@ sonar.exclusions= frontend/src/lang/modules/*
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
#sonar.sourceEncoding=UTF-8