diff --git a/components/default/Home.vue b/components/default/Home.vue
index 9b69a1f3..901763bb 100644
--- a/components/default/Home.vue
+++ b/components/default/Home.vue
@@ -34,9 +34,7 @@ const props = defineProps({
-
-
-
+
diff --git a/components/static/Footer.vue b/components/static/Footer.vue
index 83f3d122..d1969b77 100644
--- a/components/static/Footer.vue
+++ b/components/static/Footer.vue
@@ -20,7 +20,7 @@ const goGithub = () => {
}
const goAbout = () => {
- window.open("https://blog.terwer.space/about")
+ window.open("https://terwer.space/about")
}
// methods
diff --git a/composables/useCommonShareType.ts b/composables/useCommonShareType.ts
index 6104e7fb..72914d46 100644
--- a/composables/useCommonShareType.ts
+++ b/composables/useCommonShareType.ts
@@ -74,7 +74,7 @@ export const useCommonShareType = () => {
const isPrivateShare = async () => {
const shareType = await getShareType()
- return shareType === ShareTypeEnum.ShareType_Private
+ return shareType === ShareTypeEnum.ShareType_Static
}
const updateShareType = async (shareType: ShareTypeEnum) => {
diff --git a/composables/useShareType.ts b/composables/useShareType.ts
index f5c214ad..74036c13 100644
--- a/composables/useShareType.ts
+++ b/composables/useShareType.ts
@@ -24,18 +24,33 @@
*/
import { ShareTypeEnum } from "~/enums/ShareTypeEnum"
+import { createAppLogger } from "~/common/appLogger"
/**
* 自定义hook,用于获取分享类型
*/
export const useShareType = () => {
+ const logger = createAppLogger("use-share-type")
+
/**
* 获取分享类型
*/
const getShareType = () => {
+ // const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1"
+ // logger.info(`check isLocalhost => ${isLocalhost}, window.location.hostname = `, window.location.hostname)
+ // // 为安全起见,非 127.0.0.1 分享全部采用静态
+ // // 因为 https://github.com/siyuan-note/siyuan/pull/9634 导致公共分享不可用了
+ // if (!isLocalhost) {
+ // logger.warn(
+ // "当前不是本地环境,无法实现公共分享,将使用静态,详情请参考:https://github.com/siyuan-note/siyuan/pull/9634"
+ // )
+ // }
+
+ // 为安全起见,全部采用静态分享
const win = window.parent as any
- const accessCodeEnabled = win?.siyuan?.config?.accessAuthCode !== ""
- return accessCodeEnabled ? ShareTypeEnum.ShareType_Private : ShareTypeEnum.ShareType_Public
+ const accessAuthCodeEnabled = win?.siyuan?.config?.accessAuthCode !== ""
+ logger.info(`accessAuthCodeEnabled => ${accessAuthCodeEnabled}`)
+ return ShareTypeEnum.ShareType_Static
}
/**
@@ -44,7 +59,7 @@ export const useShareType = () => {
* @returns {boolean} 是否为私有分享
*/
const isPrivateShare = (): boolean => {
- return getShareType() === ShareTypeEnum.ShareType_Private
+ return getShareType() === ShareTypeEnum.ShareType_Static
}
return { getShareType, isPrivateShare }
diff --git a/enums/ShareTypeEnum.ts b/enums/ShareTypeEnum.ts
index 0486db78..b429ec7e 100644
--- a/enums/ShareTypeEnum.ts
+++ b/enums/ShareTypeEnum.ts
@@ -28,12 +28,14 @@
*/
export enum ShareTypeEnum {
/**
- * 公共分享
+ * 公共分享,已废弃,不安全
+ *
+ * @deprecated see ttps://github.com/siyuan-note/siyuan/pull/9634
*/
ShareType_Public = "public",
/**
- * 私有分享
+ * 静态分享
*/
- ShareType_Private = "private",
+ ShareType_Static = "private",
}
diff --git a/locales/zh_CN.ts b/locales/zh_CN.ts
index 27362294..25341fde 100644
--- a/locales/zh_CN.ts
+++ b/locales/zh_CN.ts
@@ -93,6 +93,6 @@ export default {
"form.select": "请选择",
"form.nodata": "暂无数据",
"change.ip.title": "切换IP",
- "share.accessCodeEnabled.tip": "特别提示:检测到您已开启授权码,若文档或者设置有更新,需重新分享,请知悉。",
+ "share.accessCodeEnabled.tip": "特别提示:为安全起见,1.9.0+ 将使用静态分享,若文档有更新,需重新分享,请知悉。",
"share.public.tip": "当前处于公共分享模式",
}
diff --git a/pages/about.vue b/pages/about.vue
deleted file mode 100644
index 556e11ec..00000000
--- a/pages/about.vue
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
👨🏻 关于我
-
大家好,我是 terwer , 一个后端老菜鸟。
-
{{ setting.siteDescription }}
-
-
-
🏹 技能
-
熟悉Java、Spring、Spring Cloud、Vue、React、Python 的拼写
-
了解 Linux、windows、macOS 的开关机方式
-
精通 Git 的 pull 和 push,并注册了 GitHub 帐号刷了一些 star
-
-
-
✉️ 联系
-
WeChat or QQ: 1035136784
-
Email: youweics@163.com
-
GitHub: https://github.com/terwer
-
-
-
-
diff --git a/pages/share.vue b/pages/share.vue
index 405cb742..f8b99890 100644
--- a/pages/share.vue
+++ b/pages/share.vue
@@ -105,6 +105,7 @@ const goHelp = async () => {
const copyWebLink = () => {
handleMethod(() => {
copy(formData.shareLink)
+ ElMessage.info("注意:如果是非 127.0.0.1 环境,请通过 设置->关于->网络伺服 打开伺服")
})
}
@@ -244,7 +245,21 @@ const handleIpChange = (val: string) => {
- {{ t("share.copy.web.link") }}
+ {{ t("share.copy.web.link") }}
+
+
+
+
+ {{ t("change.ip.title") }}
+
+
+
@@ -264,20 +279,6 @@ const handleIpChange = (val: string) => {
-
-
- {{ t("change.ip.title") }}
-
-
-
-
-
{{ t("share.other.option.link.expires") }}
diff --git a/utils/urlUtil.ts b/utils/urlUtil.ts
index 1d0580af..74dd677c 100644
--- a/utils/urlUtil.ts
+++ b/utils/urlUtil.ts
@@ -24,6 +24,9 @@
*/
import { DeviceDetection, DeviceTypeEnum, SiyuanDevice } from "zhi-device"
+import { createAppLogger } from "~/common/appLogger"
+
+const logger = createAppLogger("url-utils")
const getIPv4List = () => {
const win = SiyuanDevice.siyuanWindow()
@@ -58,15 +61,8 @@ const getLocalIp = () => {
}
export const getAllIps = () => {
- if (typeof window === "undefined") {
- return []
- }
- const win = window as any
- if (typeof win.siyuan === "undefined" || typeof win.parent.siyuan === "undefined") {
- return []
- }
const syWin = SiyuanDevice.siyuanWindow()
- const ips = syWin.siyuan.config.localIPs
+ const ips = syWin?.siyuan?.config?.localIPs ?? []
const deviceType = DeviceDetection.getDevice()
if (
@@ -78,7 +74,10 @@ export const getAllIps = () => {
ips.push(...ipv4s)
}
- return ips
+ const v4IPs = ips.filter((ip: string) => !ip.startsWith("[") && !ip.endsWith("]"))
+ const uniqueIPs = Array.from(new Set(v4IPs)) as any[]
+ logger.info("getAll v4Ips =>", uniqueIPs)
+ return uniqueIPs
}
export const getAvailableOrigin = () => {