Skip to content

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

:art: 通过域名 `localhost` 加载 https://github.com/siyuan-note/siyuan/issues/6381

Liang Dingcfb13f3b740c
diff --git a/app/appearance/boot/index.html b/app/appearance/boot/index.html
index 6923f5b6cd..7edfb8d1c4 100644
--- a/app/appearance/boot/index.html
+++ b/app/appearance/boot/index.html
@@ -100,7 +100,7 @@
return new Promise(resolve => setTimeout(resolve, ms))
}
const redirect = () => {
- const uri = 'http://siyuan.localhost:' + location.port
+ const uri = 'http://localhost:' + location.port
if (navigator.userAgent.match(/Android/i))
document.location = uri
else
@@ -113,7 +113,7 @@
let progressing = false
while (!progressing) {
try {
- const progressResult = await fetch('http://siyuan.localhost:' + location.port + '/api/system/bootProgress')
+ const progressResult = await fetch('http://localhost:' + location.port + '/api/system/bootProgress')
const progressData = await progressResult.json()
document.getElementById('progress').style.width = progressData.data.progress + '%'
document.getElementById('details').textContent = progressData.data.details
diff --git a/app/electron/main.js b/app/electron/main.js
index b5dcca43bc..eae7f2e4bb 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -43,7 +43,7 @@ let siyuanOpenURL
let firstOpen = false
let resetWindowStateOnRestart = false
let kernelPort = "6806"
-const localhost = "siyuan.localhost"
+const localhost = "localhost"
require('@electron/remote/main').initialize()
if (!app.requestSingleInstanceLock()) {
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy
index a65a8096a5..84b764314a 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20201004194026-s8h2cog.sy
@@ -75,7 +75,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "siyuan.localhost"
+ "TextMarkTextContent": "localhost"
},
{
"Type": "NodeText",
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy
index ed872cd16b..11af643f13 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20201004184819-nj8ibyg.sy
@@ -76,7 +76,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "127.0.0.1"
+ "TextMarkTextContent": "localhost"
},
{
"Type": "NodeText",
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy
index ed99696322..d79581c385 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122523-rl8356a.sy
@@ -75,7 +75,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "code",
- "TextMarkTextContent": "siyuan.localhost"
+ "TextMarkTextContent": "localhost"
},
{
"Type": "NodeText",
diff --git a/app/src/assets/template/app/index.tpl b/app/src/assets/template/app/index.tpl
index dcd8a2a74a..2003018e70 100644
--- a/app/src/assets/template/app/index.tpl
+++ b/app/src/assets/template/app/index.tpl
@@ -40,7 +40,7 @@
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
- gtag('config', 'G-L7WEXVQCR9');
+ gtag('config', 'G-L7WEXVQCR9',{ 'debug_mode':true });
</script>
</body>
</html>
diff --git a/app/src/config/about.ts b/app/src/config/about.ts
index 46737b571e..3e37c016ff 100644
--- a/app/src/config/about.ts
+++ b/app/src/config/about.ts
@@ -55,7 +55,7 @@ export const about = {
<span class="b3-label__text"><code class="fn__code">${window.siyuan.config.localIPs.join("</code> <code class='fn__code'>")}</code></span>
</div>
<div class="fn__space"></div>
- <button data-type="open" data-url="http://${window.siyuan.config.system.networkServe ? window.siyuan.config.localIPs[0] : "siyuan.localhost"}:${location.port}" class="b3-button b3-button--outline fn__size200 fn__flex-center">
+ <button data-type="open" data-url="http://${window.siyuan.config.system.networkServe ? window.siyuan.config.localIPs[0] : "localhost"}:${location.port}" class="b3-button b3-button--outline fn__size200 fn__flex-center">
<svg><use xlink:href="#iconLink"></use></svg>${window.siyuan.languages.about4}
</button>
</label>
diff --git a/app/src/mobile/util/menu.ts b/app/src/mobile/util/menu.ts
index 4b0581cf91..02632bd7c1 100644
--- a/app/src/mobile/util/menu.ts
+++ b/app/src/mobile/util/menu.ts
@@ -177,7 +177,7 @@ ${accountHTML}
closePanel();
if (!window.siyuan.config.localIPs || window.siyuan.config.localIPs.length === 0 ||
(window.siyuan.config.localIPs.length === 1 && window.siyuan.config.localIPs[0] === "")) {
- window.siyuan.config.localIPs = ["siyuan.localhost"];
+ window.siyuan.config.localIPs = ["localhost"];
}
modelElement.style.top = "0";
modelElement.querySelector(".toolbar__icon").innerHTML = '<use xlink:href="#iconInfo"></use>';
@@ -193,7 +193,7 @@ ${accountHTML}
<div class="b3-label">
${window.siyuan.languages.about2}
<div class="fn__hr"></div>
- <input class="b3-text-field fn__block" readonly value="http://${window.siyuan.config.system.networkServe ? window.siyuan.config.localIPs[0] : "siyuan.localhost"}:${location.port}">
+ <input class="b3-text-field fn__block" readonly value="http://${window.siyuan.config.system.networkServe ? window.siyuan.config.localIPs[0] : "localhost"}:${location.port}">
<div class="b3-label__text">${window.siyuan.languages.about3.replace("${port}", location.port)}</div>
<div class="fn__hr"></div>
<span class="b3-label__text"><code class="fn__code">${window.siyuan.config.localIPs.join("</code> <code class='fn__code'>")}</code></span>
diff --git a/app/stage/auth.html b/app/stage/auth.html
index 62adca09a1..738eece787 100644
--- a/app/stage/auth.html
+++ b/app/stage/auth.html
@@ -387,7 +387,7 @@
<div class="b3-snackbar__content"></div>
</div>
<script>
- if (location.hostname !== 'siyuan.localhost' && location.hostname !== '127.0.0.1') {
+ if (location.hostname !== 'localhost' && location.hostname !== '127.0.0.1') {
document.querySelector('.b3-button--white').remove()
}
diff --git a/kernel/server/serve.go b/kernel/server/serve.go
index 679aad83b0..11444619c5 100644
--- a/kernel/server/serve.go
+++ b/kernel/server/serve.go
@@ -103,7 +103,7 @@ func Serve(fastMode bool) {
rewritePortJSON(pid, port)
}
- logging.LogInfof("kernel [pid=%s] is booting [%s]", pid, "http://"+host+":"+port)
+ logging.LogInfof("kernel [pid=%s] is booting [%s]", pid, "http://"+util.LocalHost+":"+port)
util.HttpServing = true
go func() {
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 7b06612094..481a24fc20 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -295,8 +295,8 @@ const (
ContainerAndroid = "android" // Android 端
ContainerIOS = "ios" // iOS 端
- LocalHost = "siyuan.localhost" // 本地域名,由操作系统自动解析到 127.0.0.1
- FixedPort = "6806" // 固定端口
+ LocalHost = "localhost" // 本地域名,由操作系统自动解析到 127.0.0.1
+ FixedPort = "6806" // 固定端口
)
func initPathDir() {