mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 通过域名 localhost 加载 https://github.com/siyuan-note/siyuan/issues/6381
This commit is contained in:
parent
0bc997051e
commit
cfb13f3b74
11 changed files with 14 additions and 14 deletions
|
|
@ -100,7 +100,7 @@
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
}
|
}
|
||||||
const redirect = () => {
|
const redirect = () => {
|
||||||
const uri = 'http://siyuan.localhost:' + location.port
|
const uri = 'http://localhost:' + location.port
|
||||||
if (navigator.userAgent.match(/Android/i))
|
if (navigator.userAgent.match(/Android/i))
|
||||||
document.location = uri
|
document.location = uri
|
||||||
else
|
else
|
||||||
|
|
@ -113,7 +113,7 @@
|
||||||
let progressing = false
|
let progressing = false
|
||||||
while (!progressing) {
|
while (!progressing) {
|
||||||
try {
|
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()
|
const progressData = await progressResult.json()
|
||||||
document.getElementById('progress').style.width = progressData.data.progress + '%'
|
document.getElementById('progress').style.width = progressData.data.progress + '%'
|
||||||
document.getElementById('details').textContent = progressData.data.details
|
document.getElementById('details').textContent = progressData.data.details
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ let siyuanOpenURL
|
||||||
let firstOpen = false
|
let firstOpen = false
|
||||||
let resetWindowStateOnRestart = false
|
let resetWindowStateOnRestart = false
|
||||||
let kernelPort = "6806"
|
let kernelPort = "6806"
|
||||||
const localhost = "siyuan.localhost"
|
const localhost = "localhost"
|
||||||
require('@electron/remote/main').initialize()
|
require('@electron/remote/main').initialize()
|
||||||
|
|
||||||
if (!app.requestSingleInstanceLock()) {
|
if (!app.requestSingleInstanceLock()) {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
{
|
{
|
||||||
"Type": "NodeTextMark",
|
"Type": "NodeTextMark",
|
||||||
"TextMarkType": "code",
|
"TextMarkType": "code",
|
||||||
"TextMarkTextContent": "siyuan.localhost"
|
"TextMarkTextContent": "localhost"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "NodeText",
|
"Type": "NodeText",
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
{
|
{
|
||||||
"Type": "NodeTextMark",
|
"Type": "NodeTextMark",
|
||||||
"TextMarkType": "code",
|
"TextMarkType": "code",
|
||||||
"TextMarkTextContent": "127.0.0.1"
|
"TextMarkTextContent": "localhost"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "NodeText",
|
"Type": "NodeText",
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
{
|
{
|
||||||
"Type": "NodeTextMark",
|
"Type": "NodeTextMark",
|
||||||
"TextMarkType": "code",
|
"TextMarkType": "code",
|
||||||
"TextMarkTextContent": "siyuan.localhost"
|
"TextMarkTextContent": "localhost"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "NodeText",
|
"Type": "NodeText",
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'G-L7WEXVQCR9');
|
gtag('config', 'G-L7WEXVQCR9',{ 'debug_mode':true });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -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>
|
<span class="b3-label__text"><code class="fn__code">${window.siyuan.config.localIPs.join("</code> <code class='fn__code'>")}</code></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="fn__space"></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}
|
<svg><use xlink:href="#iconLink"></use></svg>${window.siyuan.languages.about4}
|
||||||
</button>
|
</button>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ ${accountHTML}
|
||||||
closePanel();
|
closePanel();
|
||||||
if (!window.siyuan.config.localIPs || window.siyuan.config.localIPs.length === 0 ||
|
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.length === 1 && window.siyuan.config.localIPs[0] === "")) {
|
||||||
window.siyuan.config.localIPs = ["siyuan.localhost"];
|
window.siyuan.config.localIPs = ["localhost"];
|
||||||
}
|
}
|
||||||
modelElement.style.top = "0";
|
modelElement.style.top = "0";
|
||||||
modelElement.querySelector(".toolbar__icon").innerHTML = '<use xlink:href="#iconInfo"></use>';
|
modelElement.querySelector(".toolbar__icon").innerHTML = '<use xlink:href="#iconInfo"></use>';
|
||||||
|
|
@ -193,7 +193,7 @@ ${accountHTML}
|
||||||
<div class="b3-label">
|
<div class="b3-label">
|
||||||
${window.siyuan.languages.about2}
|
${window.siyuan.languages.about2}
|
||||||
<div class="fn__hr"></div>
|
<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="b3-label__text">${window.siyuan.languages.about3.replace("${port}", location.port)}</div>
|
||||||
<div class="fn__hr"></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>
|
<span class="b3-label__text"><code class="fn__code">${window.siyuan.config.localIPs.join("</code> <code class='fn__code'>")}</code></span>
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@
|
||||||
<div class="b3-snackbar__content"></div>
|
<div class="b3-snackbar__content"></div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<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()
|
document.querySelector('.b3-button--white').remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func Serve(fastMode bool) {
|
||||||
rewritePortJSON(pid, port)
|
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
|
util.HttpServing = true
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
||||||
|
|
@ -295,8 +295,8 @@ const (
|
||||||
ContainerAndroid = "android" // Android 端
|
ContainerAndroid = "android" // Android 端
|
||||||
ContainerIOS = "ios" // iOS 端
|
ContainerIOS = "ios" // iOS 端
|
||||||
|
|
||||||
LocalHost = "siyuan.localhost" // 本地域名,由操作系统自动解析到 127.0.0.1
|
LocalHost = "localhost" // 本地域名,由操作系统自动解析到 127.0.0.1
|
||||||
FixedPort = "6806" // 固定端口
|
FixedPort = "6806" // 固定端口
|
||||||
)
|
)
|
||||||
|
|
||||||
func initPathDir() {
|
func initPathDir() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue