diff --git a/app/appearance/boot/index.html b/app/appearance/boot/index.html index 75569556d..6923f5b6c 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://127.0.0.1:' + location.port + const uri = 'http://siyuan.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://127.0.0.1:' + location.port + '/api/system/bootProgress') + const progressResult = await fetch('http://siyuan.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/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index b568c6f11..1f119a567 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -689,7 +689,7 @@ "about": "About", "about1": "Copyright (c) 2020-present • Yunnan Liandi Technology Co., Ltd. • Privacy Policy • User Agreement
${port}
, the IP addresses that may be connected are as follows",
+ "about3": "Please use the Chrome browser and keep it in the same network as the computer, port ${port}
, the addresses that may be connected are as follows: ",
"about4": "Open browser",
"about5": "Access Authorization Code",
"about6": "After configuration, it will be used as the access authentication password, leave it blank to close the authentication",
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index 275a00789..fbb9a066e 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -689,7 +689,7 @@
"about": "Acerca de",
"about1": "Copyright (c) 2020-presente • Yunnan Liandi Technology Co., Ltd. • Política de privacidad • Acuerdo de usuario${port}
, las direcciones IP que pueden conectarse son las siguientes",
+ "about3": "Por favor, utilice el navegador Chrome y manténgalo en la misma red que el ordenador, puerto ${port}
, las direcciones que se pueden conectar son las siguientes: ",
"about4": "Abrir el navegador",
"about5": "Código de autorización de acceso",
"about6": "Después de la configuración, se utilizará como contraseña de autenticación de acceso, déjelo en blanco para cerrar la autenticación",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index ce7d1b0be..015bea596 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -689,7 +689,7 @@
"about": "À propos de",
"about1": "Copyright (c) 2020-présent • Yunnan Liandi Technology Co., Ltd. • Politique de confidentialité • Accord de l'utilisateur${port}
, les adresses IP pouvant être connectées sont les suivantes",
+ "about3": "Veuillez utiliser le navigateur Chrome et le garder sur le même réseau que l'ordinateur, port ${port}
, les adresses pouvant être connectées sont les suivantes: ",
"about4": "Ouvrir le navigateur",
"about5": "Accès Code d'autorisation",
"about6": "Configuré comme mot de passe d'authentification d'accès, laisser vide pour désactiver l'authentification.",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index 568a7a797..72b8f2996 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -689,7 +689,7 @@
"about": "關於",
"about1": "版權所有 (c) 2020-現在 • 雲南鏈滴科技有限公司 • 隱私政策 • 用戶協議",
"about2": "在瀏覽器上使用",
- "about3": "請使用 Chrome 瀏覽器並保持和電腦在同一個網路內,端口 ${port}
,可能連通的 IP 地址如下",
+ "about3": "請使用 Chrome 瀏覽器並保持和電腦在同一個網路內,端口 ${port}
,可能連通的網絡地址:",
"about4": "打開瀏覽器",
"about5": "存取授權碼",
"about6": "配置後作為存取鑒權密碼,留空則關閉鑒權",
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index 0c0c1ed09..81c488936 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -689,7 +689,7 @@
"about": "关于",
"about1": "版权所有 (c) 2020-现在 • 云南链滴科技有限公司 • 隐私政策 • 用户协议",
"about2": "在浏览器上使用",
- "about3": "请使用 Chrome 浏览器并保持和电脑在同一个网络内,端口 ${port}
,可能连通的 IP 地址:",
+ "about3": "请使用 Chrome 浏览器并保持和电脑在同一个网络内,端口 ${port}
,可能连通的网络地址:",
"about4": "打开浏览器",
"about5": "访问授权码",
"about6": "配置后作为访问鉴权密码,留空则关闭鉴权",
diff --git a/app/electron/main.js b/app/electron/main.js
index 9ccf9f604..b5dcca43b 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -43,6 +43,7 @@ let siyuanOpenURL
let firstOpen = false
let resetWindowStateOnRestart = false
let kernelPort = "6806"
+const localhost = "siyuan.localhost"
require('@electron/remote/main').initialize()
if (!app.requestSingleInstanceLock()) {
@@ -50,6 +51,10 @@ if (!app.requestSingleInstanceLock()) {
return
}
+const getServer = () => {
+ return "http://" + localhost + ":" + kernelPort
+}
+
const showErrorWindow = (title, content) => {
let errorHTMLPath = path.join(appDir, 'app', 'electron', 'error.html')
if (isDevEnv) {
@@ -266,7 +271,7 @@ const boot = () => {
})
// 加载主界面
- mainWindow.loadURL('http://127.0.0.1:' + kernelPort + '/stage/build/app/index.html?v=' +
+ mainWindow.loadURL(getServer() + '/stage/build/app/index.html?v=' +
new Date().getTime())
// 菜单
@@ -330,7 +335,7 @@ const boot = () => {
Menu.setApplicationMenu(menu)
// 当前页面链接使用浏览器打开
mainWindow.webContents.on('will-navigate', (event, url) => {
- if (url.startsWith('http://127.0.0.1:' + kernelPort)) {
+ if (url.startsWith(getServer())) {
return
}
@@ -399,7 +404,7 @@ const boot = () => {
theme: nativeTheme.shouldUseDarkColors ? 'dark' : 'light',
init: true,
})
- await fetch('http://127.0.0.1:' + kernelPort + '/api/system/uiproc?pid=' + process.pid,
+ await fetch(getServer() + '/api/system/uiproc?pid=' + process.pid,
{method: 'POST'})
})
ipcMain.on('siyuan-hotkey', (event, hotkey) => {
@@ -632,11 +637,11 @@ const initKernel = (initData) => {
writeLog('checking kernel version')
while (!gotVersion) {
try {
- const apiResult = await fetch('http://127.0.0.1:' + kernelPort + '/api/system/version')
+ const apiResult = await fetch(getServer() + '/api/system/version')
apiData = await apiResult.json()
gotVersion = true
bootWindow.setResizable(false)
- bootWindow.loadURL('http://127.0.0.1:' + kernelPort + '/appearance/boot/index.html')
+ bootWindow.loadURL(getServer() + '/appearance/boot/index.html')
bootWindow.show()
} catch (e) {
writeLog('get kernel version failed: ' + e.message)
@@ -656,14 +661,14 @@ const initKernel = (initData) => {
if (!isDevEnv && apiData.data !== appVer) {
writeLog(
`kernel [${apiData.data}] is running, shutdown it now and then start kernel [${appVer}]`)
- fetch('http://127.0.0.1:' + kernelPort + '/api/system/exit', {method: 'POST'})
+ fetch(getServer() + '/api/system/exit', {method: 'POST'})
bootWindow.destroy()
resolve(false)
} else {
let progressing = false
while (!progressing) {
try {
- const progressResult = await fetch('http://127.0.0.1:' + kernelPort + '/api/system/bootProgress')
+ const progressResult = await fetch(getServer() + '/api/system/bootProgress')
const progressData = await progressResult.json()
if (progressData.data.progress >= 100) {
resolve(true)
@@ -673,7 +678,7 @@ const initKernel = (initData) => {
}
} catch (e) {
writeLog('get boot progress failed: ' + e.message)
- fetch('http://127.0.0.1:' + kernelPort + '/api/system/exit', {method: 'POST'})
+ fetch(getServer() + '/api/system/exit', {method: 'POST'})
bootWindow.destroy()
resolve(false)
progressing = true
@@ -804,15 +809,15 @@ const cp = require("child_process");
powerMonitor.on('suspend', () => {
writeLog('system suspend')
- fetch('http://127.0.0.1:' + kernelPort + '/api/sync/performSync', {method: 'POST'})
+ fetch(getServer() + '/api/sync/performSync', {method: 'POST'})
})
powerMonitor.on('resume', () => {
writeLog('system resume')
- fetch('http://127.0.0.1:' + kernelPort + '/api/sync/performSync', {method: 'POST'})
+ fetch(getServer() + '/api/sync/performSync', {method: 'POST'})
})
powerMonitor.on('shutdown', () => {
writeLog('system shutdown')
- fetch('http://127.0.0.1:' + kernelPort + '/api/system/exit', {method: 'POST'})
+ fetch(getServer() + '/api/system/exit', {method: 'POST'})
})
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 a886023d3..a65a8096a 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": "127.0.0.1"
+ "TextMarkTextContent": "siyuan.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 ed872cd16..a2c4285c8 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": "siyuan.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 a176270b6..ed9969632 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": "127.0.0.1"
+ "TextMarkTextContent": "siyuan.localhost"
},
{
"Type": "NodeText",
diff --git a/app/src/assets/template/app/index.tpl b/app/src/assets/template/app/index.tpl
index aac258cd1..dcd8a2a74 100644
--- a/app/src/assets/template/app/index.tpl
+++ b/app/src/assets/template/app/index.tpl
@@ -32,5 +32,15 @@
}
}, 2000)
+
+
+
+