|
|
@ -112,14 +112,6 @@
|
|
|
|
</el-descriptions-item>
|
|
|
|
</el-descriptions-item>
|
|
|
|
</el-descriptions>
|
|
|
|
</el-descriptions>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<el-form-item v-if="form.sslType !== 'import'">
|
|
|
|
|
|
|
|
<el-checkbox true-value="enable" false-value="disable" v-model="form.autoRestart">
|
|
|
|
|
|
|
|
{{ $t('setting.sslAutoRestart') }}
|
|
|
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
|
|
|
<span v-if="form.autoRestart === 'disable'" class="input-help">
|
|
|
|
|
|
|
|
{{ $t('setting.sslChangeHelper1') }}
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
@ -143,7 +135,7 @@ import i18n from '@/lang';
|
|
|
|
import { MsgSuccess } from '@/utils/message';
|
|
|
|
import { MsgSuccess } from '@/utils/message';
|
|
|
|
import { downloadSSL, updateSSL } from '@/api/modules/setting';
|
|
|
|
import { downloadSSL, updateSSL } from '@/api/modules/setting';
|
|
|
|
import { Rules } from '@/global/form-rules';
|
|
|
|
import { Rules } from '@/global/form-rules';
|
|
|
|
import { ElMessageBox, FormInstance } from 'element-plus';
|
|
|
|
import { FormInstance } from 'element-plus';
|
|
|
|
import { Setting } from '@/api/interface/setting';
|
|
|
|
import { Setting } from '@/api/interface/setting';
|
|
|
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
|
|
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
|
|
|
import { GlobalStore } from '@/store';
|
|
|
|
import { GlobalStore } from '@/store';
|
|
|
@ -162,7 +154,6 @@ const form = reactive({
|
|
|
|
key: '',
|
|
|
|
key: '',
|
|
|
|
rootPath: '',
|
|
|
|
rootPath: '',
|
|
|
|
timeout: '',
|
|
|
|
timeout: '',
|
|
|
|
autoRestart: 'disable',
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const rules = reactive({
|
|
|
|
const rules = reactive({
|
|
|
@ -179,7 +170,6 @@ const itemSSL = ref();
|
|
|
|
interface DialogProps {
|
|
|
|
interface DialogProps {
|
|
|
|
sslType: string;
|
|
|
|
sslType: string;
|
|
|
|
sslInfo?: Setting.SSLInfo;
|
|
|
|
sslInfo?: Setting.SSLInfo;
|
|
|
|
autoRestart: string;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const acceptParams = async (params: DialogProps): Promise<void> => {
|
|
|
|
const acceptParams = async (params: DialogProps): Promise<void> => {
|
|
|
|
if (params.sslType.indexOf('-') !== -1) {
|
|
|
|
if (params.sslType.indexOf('-') !== -1) {
|
|
|
@ -202,7 +192,6 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
loadSSLs();
|
|
|
|
loadSSLs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
form.autoRestart = params.autoRestart;
|
|
|
|
|
|
|
|
drawerVisible.value = true;
|
|
|
|
drawerVisible.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const emit = defineEmits<{ (e: 'search'): void }>();
|
|
|
|
const emit = defineEmits<{ (e: 'search'): void }>();
|
|
|
@ -243,41 +232,31 @@ const onSaveSSL = async (formEl: FormInstance | undefined) => {
|
|
|
|
if (!formEl) return;
|
|
|
|
if (!formEl) return;
|
|
|
|
formEl.validate(async (valid) => {
|
|
|
|
formEl.validate(async (valid) => {
|
|
|
|
if (!valid) return;
|
|
|
|
if (!valid) return;
|
|
|
|
let msg = !form.autoRestart
|
|
|
|
let itemType = form.sslType;
|
|
|
|
? i18n.global.t('setting.sslChangeHelper1') + '\n\n\n' + 'qwdqwdqwd'
|
|
|
|
if (form.sslType === 'import') {
|
|
|
|
: i18n.global.t('setting.sslChangeHelper2');
|
|
|
|
itemType = form.itemSSLType === 'paste' ? 'import-paste' : 'import-local';
|
|
|
|
ElMessageBox.confirm(msg, i18n.global.t('setting.panelSSL'), {
|
|
|
|
}
|
|
|
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
|
|
|
let param = {
|
|
|
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
|
|
|
ssl: 'enable',
|
|
|
|
type: 'info',
|
|
|
|
sslType: itemType,
|
|
|
|
}).then(async () => {
|
|
|
|
domain: '',
|
|
|
|
let itemType = form.sslType;
|
|
|
|
sslID: form.sslID,
|
|
|
|
if (form.sslType === 'import') {
|
|
|
|
cert: form.cert,
|
|
|
|
itemType = form.itemSSLType === 'paste' ? 'import-paste' : 'import-local';
|
|
|
|
key: form.key,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let param = {
|
|
|
|
let href = window.location.href;
|
|
|
|
ssl: 'enable',
|
|
|
|
param.domain = href.split('//')[1].split(':')[0];
|
|
|
|
sslType: itemType,
|
|
|
|
await updateSSL(param).then(() => {
|
|
|
|
domain: '',
|
|
|
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
|
|
sslID: form.sslID,
|
|
|
|
|
|
|
|
cert: form.cert,
|
|
|
|
|
|
|
|
key: form.key,
|
|
|
|
|
|
|
|
autoRestart: form.autoRestart,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
let href = window.location.href;
|
|
|
|
let href = window.location.href;
|
|
|
|
param.domain = href.split('//')[1].split(':')[0];
|
|
|
|
globalStore.isLogin = false;
|
|
|
|
await updateSSL(param).then(() => {
|
|
|
|
let address = href.split('://')[1];
|
|
|
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
|
|
if (globalStore.entrance) {
|
|
|
|
let href = window.location.href;
|
|
|
|
address = address.replaceAll('settings/safe', globalStore.entrance);
|
|
|
|
globalStore.isLogin = false;
|
|
|
|
} else {
|
|
|
|
let address = href.split('://')[1];
|
|
|
|
address = address.replaceAll('settings/safe', 'login');
|
|
|
|
if (globalStore.entrance) {
|
|
|
|
}
|
|
|
|
address = address.replaceAll('settings/safe', globalStore.entrance);
|
|
|
|
window.open(`https://${address}`, '_self');
|
|
|
|
} else {
|
|
|
|
|
|
|
|
address = address.replaceAll('settings/safe', 'login');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
window.open(`https://${address}`, '_self');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|