siyuan/app/stage/auth.html

227 lines
35 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
<title>SiYuan Auth</title>
<style>
.b3-button {
margin: 16px 0;
width: 240px;
cursor: pointer;
color: #fff;
border-radius: 4px;
line-height: 20px;
padding: 4px 8px;
background-color: #4285f4;
white-space: nowrap;
display: inline-flex;
align-items: center;
justify-content: center;
transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
border: 0;
box-sizing: border-box;
text-align: center;
}
.b3-button svg {
height: 16px;
width: 16px;
margin-right: 4px;
}
.b3-button:hover, .b3-button:focus {
outline: none;
text-decoration: none;
box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
}
.b3-button:active {
outline: none;
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
}
.b3-text-filed {
text-align: center;
width: 240px;
border: 1px solid #5f6368;
border-radius: 4px;
padding: 4px 8px;
line-height: 20px;
box-sizing: border-box;
color: #202124;
transition: border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1), box-shadow 120ms 0ms cubic-bezier(0, 0, 0.2, 1);
background-color: #f8f9fa;
}
.b3-text-filed:hover {
border-color: #202124;
}
.b3-text-filed:focus {
outline: none;
border-color: #4285f4;
box-shadow: 0 0 0 3px rgb(66 133 244 / 12%);
}
.b3-code {
font-style: initial;
font-family: JetBrainsMono-Regular, mononoki, Consolas, 'Liberation Mono', Menlo, Courier, monospace;
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
border-radius: 3px;
word-break: break-word;
background-size: 20px 20px;
white-space: pre-wrap;
background-color: rgb(27 31 35 / 5%);
}
.b3-snackbar {
position: fixed;
top: 0;
z-index: 502;
transform: translate3d(0, -100px, 0);
opacity: 0;
transition: opacity 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms, transform 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms;
width: 100%;
align-items: center;
justify-content: center;
height: 0;
display: flex;
font-size: 14px;
}
.b3-snackbar--show {
transform: translate3d(0, 0, 0);
opacity: 1;
}
.b3-snackbar--show .b3-snackbar__content {
transform: none;
}
.b3-snackbar__content {
line-height: 20px;
border-radius: 4px;
padding: 8px 16px;
color: #fff;
font-size: inherit;
background-color: #4285F4;
box-sizing: border-box;
box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
transition: transform 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms;
transform: scale(0.8);
top: 16px;
position: absolute;
word-break: break-word;
max-width: 80vw;
}
a {
outline: 0;
text-decoration: none;
color: #4285f4;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body style="margin: 0;
display: flex;
align-items: center;
height: 100%;
justify-content: center;
">
<div style="-webkit-app-region: drag;height: 32px;width: 100%;position: absolute;top: 0;"></div>
<div style="position: relative;z-index: 2;text-align: center">
<h1 style="margin-bottom: 48px;">思源 SiYuan</h1>
<input class="b3-text-filed" id="authCode" type="password" placeholder="授权码 Auth code"/><br>
<button class="b3-button" id="submit" onclick="submitAuth()">解锁 Unlock</button>
<div style="color: #5f6368;font-size: 14px;margin-top: 16px;">
如果你在使用中遇到问题,请到<a href="https://ld246.com/domain/siyuan" target="_blank">社区</a>进行反馈<br>
If you encounter problems, please report it on <a href="https://github.com/siyuan-note/siyuan/issues" target="_blank">GitHub</a>
</div>
</div>
<div style="overflow: hidden;
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;">
<svg style="
top: 50%;
left: 50%;
width: 200%;
transform: translate(-50%, -50%);
position: absolute;
z-index: 1;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" height="1602" viewBox="0 0 2769 1602" width="2769">
<filter id="a" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="1044" width="1044" x="1682" y="558">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
<feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
</filter>
<filter id="b" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="1044" width="1044" x="1725" y="0">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
<feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
</filter>
<filter id="c" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="858" width="982" x="0" y="23">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
<feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
</filter>
<filter id="d" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="646" width="982" x="279" y="58">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
<feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
</filter>
<g filter="url(#a)" opacity=".34">
<circle cx="2204" cy="1080" fill="#db469f" r="322"/>
</g>
<g filter="url(#b)" opacity=".7">
<circle cx="2247" cy="522" fill="#043a8a" r="322"/>
</g>
<g filter="url(#c)" opacity=".9">
<ellipse cx="491" cy="452" fill="#043a8a" rx="291" ry="229"/>
</g>
<g filter="url(#d)" opacity=".43">
<ellipse cx="770" cy="381" fill="#043a8a" rx="291" ry="123"/>
</g>
</svg>
<svg style="width: 100%;height: auto" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1764" height="1351" viewBox="0 0 1764 1351"><title>star-bg</title><defs><path id="a" d="M6.23.067V5.69H.61V.066h5.62z"/><path id="c" d="M.67.697h9.937v9.938H.67z"/><path id="e" d="M6.23.067V5.69H.61V.066h5.62z"/></defs><g fill="none" fill-rule="evenodd"><path d="M717.978 92.117l2.756 1.507a.394.394 0 0 1 0 .69l-2.756 1.508a.4.4 0 0 0-.156.156l-1.507 2.756a.393.393 0 0 1-.69 0l-1.508-2.755a.395.395 0 0 0-.157-.16l-2.755-1.505a.394.394 0 0 1 0-.69l2.755-1.508a.393.393 0 0 0 .157-.157l1.507-2.754a.393.393 0 0 1 .69 0l1.508 2.754c.036.067.09.12.156.157" fill="#D15D64" style="mix-blend-mode:lighten"/><path d="M239.057 166.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156" fill="#FCD05C" style="mix-blend-mode:lighten"/><path d="M409.472 108L408 109.47M413.47 104l-1.47 1.472M409.543 108.163a1.852 1.852 0 1 0 2.62-2.62 1.852 1.852 0 1 0-2.62 2.62z" stroke="#7B63AB" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/><path d="M961.978 138.117l2.756 1.507a.394.394 0 0 1 0 .69l-2.756 1.507a.4.4 0 0 0-.156.16l-1.507 2.754a.393.393 0 0 1-.69 0l-1.508-2.756a.395.395 0 0 0-.157-.157l-2.755-1.505a.394.394 0 0 1 0-.69l2.755-1.508a.393.393 0 0 0 .157-.156l1.507-2.755a.393.393 0 0 1 .69 0l1.508 2.755c.036.066.09.12.156.156" fill="#D15D64" style="mix-blend-mode:lighten"/><path d="M1144.978 177.117l2.755 1.507a.394.394 0 0 1 0 .69l-2.755 1.508a.397.397 0 0 0-.156.156l-1.506 2.756a.393.393 0 0 1-.692 0l-1.506-2.756a.402.402 0 0 0-.16-.156l-2.753-1.507a.393.393 0 0 1 0-.69l2.755-1.508a.402.402 0 0 0 .158-.156l1.506-2.755a.394.394 0 0 1 .69 0l1.508 2.756c.037.066.09.12.157.157" fill="#E98333" style="mix-blend-mode:lighten"/><path d="M1083.057 100.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156" fill="#FCD05C" style="mix-blend-mode:lighten"/><path d="M1206.813 253.907a2.907 2.907 0 1 1-5.815-.003 2.907 2.907 0 0 1 5.815.003M114.978 319.116l2.756 1.507a.394.394 0 0 1 0 .692l-2.756 1.507a.4.4 0 0 0-.156.156l-1.507 2.755a.393.393 0 0 1-.69 0l-1.508-2.755a.395.395 0 0 0-.157-.156l-2.755-1.507a.394.394 0 0 1 0-.692l2.755-1.507a.393.393 0 0 0 .157-.155l1.507-2.755a.393.393 0 0 1 .69 0l1.508 2.756c.036.067.09.12.156.156" fill="#D15D64" style="mix-blend-mode:lighten"/><path d="M206.057 452.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156" fill="#FCD05C" style="mix-blend-mode:lighten"/><path d="M1661.978 527.116l2.755 1.508a.395.395 0 0 1 0 .692l-2.755 1.506a.39.39 0 0 0-.156.157l-1.506 2.754a.393.393 0 0 1-.692 0l-1.506-2.755a.39.39 0 0 0-.16-.158l-2.753-1.506a.394.394 0 0 1 0-.692l2.755-1.508a.39.39 0 0 0 .158-.155l1.506-2.755a.393.393 0 0 1 .69 0l1.508 2.755a.39.39 0 0 0 .157.156M1376.877 100.645l1.3.71c.26.144.26.52 0 .66l-1.3.713a.38.38 0 0 0-.15.148l-.71 1.3a.377.377 0 0 1-.66 0l-.71-1.3a.386.386 0 0 0-.152-.148l-1.3-.712a.377.377 0 0 1 0-.66l1.3-.71a.39.39 0 0 0 .15-.15l.71-1.3a.376.376 0 0 1 .662 0l.71 1.3a.384.384 0 0 0 .15.15" fill="#D15D64" style="mix-blend-mode:lighten"/><path d="M1634.057 382.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156" fill="#FCD05C" style="mix-blend-mode:lighten"/><path stroke="#E98333" stroke-width="1.097" stroke-lineca
</div>
<div class="b3-snackbar" id="message"><div class="b3-snackbar__content">ssss</div></div>
<script>
const inputElement = document.getElementById("authCode")
inputElement.focus()
inputElement.addEventListener("keydown", (event) => {
if (event.key === "Enter") {
submitAuth();
}
})
const submitAuth = () => {
fetch("/api/system/loginAuth", {
method: "POST",
body: JSON.stringify({'authCode': inputElement.value})
}).then((response) => {
return response.json();
}).then((response) => {
if (0 === response.code) {
window.location.href = '/'
} else {
document.querySelector("#message").classList.add("b3-snackbar--show")
document.querySelector("#message").firstElementChild.textContent = response.msg;
inputElement.value = ''
setTimeout(() => {
document.querySelector("#message").classList.remove("b3-snackbar--show")
document.querySelector("#message").firstElementChild.textContent = "";
}, 6000)
}
})
}
</script>
</body>
</html>