diff --git a/frontend/src/services/apis/instance.ts b/frontend/src/services/apis/instance.ts index 57ab6393..ee34e70c 100644 --- a/frontend/src/services/apis/instance.ts +++ b/frontend/src/services/apis/instance.ts @@ -266,3 +266,20 @@ export const getConfigFile = useDefineApi< method: "GET", url: "/api/protected_instance/process_config/file" }); + +// 更新配置文件内容 +export const updateConfigFile = useDefineApi< + { + params: { + uuid: string; + remote_uuid: string; + fileName: string; + type: string; + }; + data: any; + }, + boolean +>({ + method: "PUT", + url: "/api/protected_instance/process_config/file" +}); diff --git a/frontend/src/tools/common.ts b/frontend/src/tools/common.ts index fc575be1..aae16039 100644 --- a/frontend/src/tools/common.ts +++ b/frontend/src/tools/common.ts @@ -79,3 +79,24 @@ export function jsonToMap(json: JsonData, topTitle = "", map = {}) { } return map; } + +export function toUnicode(str: string) { + let value = ""; + for (let i = 0; i < str.length; i++) { + if (/([\u4E00-\u9FA5]|[\uFE30-\uFFA0])/g.test(str[i])) { + value += "\\u" + leftZero4(parseInt(str.charCodeAt(i).toString(16)).toString()); + } else { + value += str[i]; + } + } + return value; +} + +function leftZero4(str: string) { + if (str != null && str !== "" && str !== "undefined") { + if (str.length == 2) { + return "00" + str; + } + } + return str || ""; +} diff --git a/frontend/src/widgets/instance/ServerConfigFile.vue b/frontend/src/widgets/instance/ServerConfigFile.vue index 993acfaf..decf8158 100644 --- a/frontend/src/widgets/instance/ServerConfigFile.vue +++ b/frontend/src/widgets/instance/ServerConfigFile.vue @@ -1,14 +1,13 @@