forked from github/dataease
feat: 飞书扫码登录
This commit is contained in:
parent
a8e9cc8843
commit
076e3ced48
22
core/core-frontend/src/utils/RemoteJs.ts
Normal file
22
core/core-frontend/src/utils/RemoteJs.ts
Normal file
@ -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)
|
||||||
|
})
|
||||||
|
}
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
|||||||
Subproject commit 3b92a9102173342ea3d49f9dd5d9bc38f9589257
|
Subproject commit 91e4019972ec96f7f672bb5da2156f54ca9d72ea
|
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.api.lark.api;
|
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.vo.LarkInfoVO;
|
||||||
import io.dataease.api.lark.dto.LarkSettingCreator;
|
import io.dataease.api.lark.dto.LarkSettingCreator;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -14,4 +15,7 @@ public interface LarkApi {
|
|||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
void save(@RequestBody LarkSettingCreator creator);
|
void save(@RequestBody LarkSettingCreator creator);
|
||||||
|
|
||||||
|
@PostMapping("/token")
|
||||||
|
String larkToken(@RequestBody LarkTokenRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
@ -148,7 +148,7 @@ public class HttpClientUtil {
|
|||||||
public static String post(String url, String json, HttpClientConfig config) {
|
public static String post(String url, String json, HttpClientConfig config) {
|
||||||
CloseableHttpClient httpClient = null;
|
CloseableHttpClient httpClient = null;
|
||||||
try {
|
try {
|
||||||
buildHttpClient(url);
|
httpClient = buildHttpClient(url);
|
||||||
HttpPost httpPost = new HttpPost(url);
|
HttpPost httpPost = new HttpPost(url);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
config = new HttpClientConfig();
|
config = new HttpClientConfig();
|
||||||
|
@ -19,6 +19,8 @@ public class WhitelistUtils {
|
|||||||
"/swagger-resources",
|
"/swagger-resources",
|
||||||
"/doc.html",
|
"/doc.html",
|
||||||
"/panel.html",
|
"/panel.html",
|
||||||
|
"/lark/info",
|
||||||
|
"/lark/token",
|
||||||
"/setting/authentication/status",
|
"/setting/authentication/status",
|
||||||
"/");
|
"/");
|
||||||
|
|
||||||
@ -34,6 +36,7 @@ public class WhitelistUtils {
|
|||||||
|| StringUtils.startsWithAny(requestURI, "/static-resource/")
|
|| StringUtils.startsWithAny(requestURI, "/static-resource/")
|
||||||
|| StringUtils.startsWithAny(requestURI, "/share/proxyInfo")
|
|| StringUtils.startsWithAny(requestURI, "/share/proxyInfo")
|
||||||
|| StringUtils.startsWithAny(requestURI, "/xpackComponent/content/")
|
|| StringUtils.startsWithAny(requestURI, "/xpackComponent/content/")
|
||||||
|
|| StringUtils.startsWithAny(requestURI, "/platform/")
|
||||||
|| StringUtils.startsWithAny(requestURI, "/map/");
|
|| StringUtils.startsWithAny(requestURI, "/map/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user