57 lines
1.5 KiB
HTML

<html>
<head>
<meta charset="UTF-8">
<title>Envision</title>
<style>
.loading {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5em;
/* Adjust font size for mobile */
}
@media (max-width: 600px) {
.loading {
font-size: 1em;
/* Smaller font size for smaller screens */
}
}
</style>
</head>
<body>
<div class="loading">Loading...</div>
<script type="module">
import { config } from './config.js'
import { closePage } from './is-wechat.js'
const demo = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect`
const appid = config.appid
const redirect_uri = encodeURIComponent(config.redirect_uri)
const scope = `snsapi_userinfo`
const url = new URL(window.location.href)
const state = url.searchParams.get('state')
if (!state) {
alert('Invalid state. Please try again later.');
closePage();
}
const link = demo.replace('APPID', appid).replace('REDIRECT_URI', redirect_uri).replace('SCOPE', scope).replace('STATE', state);
window.location.href = link
// Add a timeout for loading
setTimeout(() => {
alert('Loading timeout. Please try again later.');
closePage()
}, 60000); // 60 seconds timeout
</script>
</body>
</html>