Skip to content

Commit

Permalink
fix: webui
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed May 17, 2024
1 parent 4cc3072 commit 8c91351
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/webui/ui/NapCat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,20 @@ async function onSettingWindowCreated(view: Element) {
doc: Document = document,
inputAttr: any = {}
) => {
type = type.replace(/\./g, "-");//替换操作

const hostContainerDom = doc.body.querySelector(
`#config-ob11-${type}-list`
);
hostContainerDom?.appendChild(
buildHostListItem(
type,
"",
ob11Config[type.split(".")[0]][type.split(".")[1]].length,
ob11Config[type.split("-")[0]][type.split("-")[1]].length,
inputAttr
)
);
ob11Config[type.split(".")[0]][type.split(".")[1]].push("");
ob11Config[type.split("-")[0]][type.split("-")[1]].push("");
};
const initReverseHost = (type: string, doc: Document = document) => {
const hostContainerDom = doc.body?.querySelector(
Expand All @@ -275,15 +277,15 @@ async function onSettingWindowCreated(view: Element) {

initReverseHost("http.postUrls", doc);
initReverseHost("reverseWs.urls", doc);

doc
.querySelector("#config-ob11-http-postUrls-add")
?.addEventListener("click", () =>
addReverseHost("http.postUrls", document, {
placeholder: "如:http://127.0.0.1:5140/onebot",
})
);

doc
.querySelector("#config-ob11-reverseWs-urls-add")
?.addEventListener("click", () =>
Expand Down
5 changes: 3 additions & 2 deletions static/assets/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,19 @@ async function onSettingWindowCreated(view) {
return result;
};
const addReverseHost = (type, doc2 = document, inputAttr = {}) => {
type = type.replace(/\./g, "-");
const hostContainerDom = doc2.body.querySelector(
`#config-ob11-${type}-list`
);
hostContainerDom?.appendChild(
buildHostListItem(
type,
"",
ob11Config[type.split(".")[0]][type.split(".")[1]].length,
ob11Config[type.split("-")[0]][type.split("-")[1]].length,
inputAttr
)
);
ob11Config[type.split(".")[0]][type.split(".")[1]].push("");
ob11Config[type.split("-")[0]][type.split("-")[1]].push("");
};
const initReverseHost = (type, doc2 = document) => {
const hostContainerDom = doc2.body?.querySelector(
Expand Down

0 comments on commit 8c91351

Please sign in to comment.