站点监控批量导入支持分组和备注

v2
xiaojunnuo 2025-10-21 22:38:02 +08:00
parent 2ed12c429e
commit 77b4a1eaf6
5 changed files with 13 additions and 10 deletions

View File

@ -294,7 +294,7 @@ export default {
}, },
domainList: { domainList: {
title: "Domain List", title: "Domain List",
helper: "Format: domain:port:name, one per line. Port and name are optional.\nExamples:\nwww.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com", helper: "Format: domain:port:name:remark, one per line. Port and name are optional.\nExamples:\nwww.baidu.com:443:Baidu:remarkText\nwww.taobao.com::Taobao\nwww.google.com",
required: "Please enter domains to import", required: "Please enter domains to import",
placeholder: "www.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com\n", placeholder: "www.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com\n",
}, },

View File

@ -299,9 +299,9 @@ export default {
}, },
domainList: { domainList: {
title: "域名列表", title: "域名列表",
helper: "格式【域名:端口:名称】,一行一个,其中端口、名称可以省略\n比如\nwww.baidu.com:443:百度\nwww.taobao.com::淘宝\nwww.google.com", helper: "格式【域名:端口:名称:备注】,一行一个,其中端口、名称、备注可以省略\n比如\nwww.baidu.com:443:百度:备注文本\nwww.taobao.com::淘宝\nwww.google.com",
required: "请输入要导入的域名", required: "请输入要导入的域名",
placeholder: "www.baidu.com:443:百度\nwww.taobao.com::淘宝\nwww.google.com\n", placeholder: "www.baidu.com:443:百度:备注文本\nwww.taobao.com::淘宝\nwww.google.com\n",
}, },
accountInfo: "账号信息", accountInfo: "账号信息",
securitySettings: "认证安全设置", securitySettings: "认证安全设置",

View File

@ -26,13 +26,10 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import { onActivated, onMounted } from "vue";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { siteInfoApi } from "./api";
import { Modal, notification } from "ant-design-vue";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import * as api from "./api";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
name: "SiteCertMonitor", name: "SiteCertMonitor",

View File

@ -119,6 +119,7 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
const userId = this.getUserId(); const userId = this.getUserId();
await this.service.doImport({ await this.service.doImport({
text:body.text, text:body.text,
groupId:body.groupId,
userId userId
}) })
return this.ok(); return this.ok();

View File

@ -393,7 +393,7 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
} }
} }
async doImport(req: { text: string; userId: number }) { async doImport(req: { text: string; userId: number,groupId?:number }) {
if (!req.text) { if (!req.text) {
throw new Error("text is required"); throw new Error("text is required");
} }
@ -421,17 +421,22 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
} catch (e) { } catch (e) {
throw new Error(`${item}格式错误`); throw new Error(`${item}格式错误`);
} }
} }
if (arr.length > 2) { if (arr.length > 2) {
name = arr[2] || domain; name = arr[2] || domain;
} }
let remark:string = "";
if (arr.length > 3) {
remark = arr[3] || "";
}
list.push({ list.push({
domain, domain,
name, name,
httpsPort: port, httpsPort: port,
userId: req.userId userId: req.userId,
remark,
groupId: req.groupId
}); });
} }