diff --git a/core/core-frontend/src/utils/RemoteJs.ts b/core/core-frontend/src/utils/RemoteJs.ts new file mode 100644 index 0000000000..289fca8935 --- /dev/null +++ b/core/core-frontend/src/utils/RemoteJs.ts @@ -0,0 +1,22 @@ +export const loadScript = (url: string, jsId?: string) => { + return new Promise(function (resolve, reject) { + const scriptId = jsId || 'de-fit2cloud-script-id' + let dom = document.getElementById(scriptId) + if (dom) { + dom.parentElement?.removeChild(dom) + dom = null + } + const script = document.createElement('script') + + script.id = scriptId + script.onload = function () { + return resolve(null) + } + script.onerror = function () { + return reject(new Error('Load script from '.concat(url, ' failed'))) + } + script.src = url + const head = document.head || document.getElementsByTagName('head')[0] + ;(document.body || head).appendChild(script) + }) +} diff --git a/de-xpack b/de-xpack index 3b92a91021..91e4019972 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 3b92a9102173342ea3d49f9dd5d9bc38f9589257 +Subproject commit 91e4019972ec96f7f672bb5da2156f54ca9d72ea diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/lark/api/LarkApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/lark/api/LarkApi.java index a4af5935f5..c608ee94a6 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/lark/api/LarkApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/lark/api/LarkApi.java @@ -1,5 +1,6 @@ package io.dataease.api.lark.api; +import io.dataease.api.lark.dto.LarkTokenRequest; import io.dataease.api.lark.vo.LarkInfoVO; import io.dataease.api.lark.dto.LarkSettingCreator; import org.springframework.web.bind.annotation.GetMapping; @@ -14,4 +15,7 @@ public interface LarkApi { @PostMapping("/create") void save(@RequestBody LarkSettingCreator creator); + @PostMapping("/token") + String larkToken(@RequestBody LarkTokenRequest request); + } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/lark/dto/LarkTokenRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/lark/dto/LarkTokenRequest.java new file mode 100644 index 0000000000..cb7ac21437 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/lark/dto/LarkTokenRequest.java @@ -0,0 +1,13 @@ +package io.dataease.api.lark.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class LarkTokenRequest implements Serializable { + + private String code; + + private String state; +} diff --git a/sdk/common/src/main/java/io/dataease/utils/HttpClientUtil.java b/sdk/common/src/main/java/io/dataease/utils/HttpClientUtil.java index 9fd9e1e168..6f6f0125e2 100755 --- a/sdk/common/src/main/java/io/dataease/utils/HttpClientUtil.java +++ b/sdk/common/src/main/java/io/dataease/utils/HttpClientUtil.java @@ -148,7 +148,7 @@ public class HttpClientUtil { public static String post(String url, String json, HttpClientConfig config) { CloseableHttpClient httpClient = null; try { - buildHttpClient(url); + httpClient = buildHttpClient(url); HttpPost httpPost = new HttpPost(url); if (config == null) { config = new HttpClientConfig(); diff --git a/sdk/common/src/main/java/io/dataease/utils/WhitelistUtils.java b/sdk/common/src/main/java/io/dataease/utils/WhitelistUtils.java index 0284021338..c56e56197a 100644 --- a/sdk/common/src/main/java/io/dataease/utils/WhitelistUtils.java +++ b/sdk/common/src/main/java/io/dataease/utils/WhitelistUtils.java @@ -19,6 +19,8 @@ public class WhitelistUtils { "/swagger-resources", "/doc.html", "/panel.html", + "/lark/info", + "/lark/token", "/setting/authentication/status", "/"); @@ -34,6 +36,7 @@ public class WhitelistUtils { || StringUtils.startsWithAny(requestURI, "/static-resource/") || StringUtils.startsWithAny(requestURI, "/share/proxyInfo") || StringUtils.startsWithAny(requestURI, "/xpackComponent/content/") + || StringUtils.startsWithAny(requestURI, "/platform/") || StringUtils.startsWithAny(requestURI, "/map/"); } }