Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:recycle: https://github.com/siyuan-note/siyuan/pull/7089/files

Vanessaf49ebee0e81e
diff --git a/app/src/util/functions.ts b/app/src/util/functions.ts
index f7a437fb11..c93031ca3b 100644
--- a/app/src/util/functions.ts
+++ b/app/src/util/functions.ts
@@ -14,10 +14,20 @@ export const getRandom = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值
};
-export const getSearch: (key: string, link?: string) => string | null = (key: string, link = window.location.search) => {
- // REF https://developer.mozilla.org/zh-CN/docs/Web/API/URLSearchParams
- const urlSearchParams = new URLSearchParams(link);
- return urlSearchParams.get(key);
+export const getSearch = (key: string, link = window.location.search) => {
+ if (link.indexOf("?") === -1) {
+ return "";
+ }
+ let value = "";
+ const data = link.split("?")[1].split("&");
+ data.find(item => {
+ const keyValue = item.split("=");
+ if (keyValue[0] === key) {
+ value = keyValue[1];
+ return true;
+ }
+ });
+ return value;
};
export const isBrowser = () => {