修复bug
This commit is contained in:
		
							parent
							
								
									139a096c41
								
							
						
					
					
						commit
						b45adebeb8
					
				
							
								
								
									
										16
									
								
								js/qv.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								js/qv.js
									
									
									
									
									
								
							@ -100,7 +100,7 @@ if (!loggedIn || !email) {
 | 
				
			|||||||
                        const userInfoBlob = new Blob([JSON.stringify(verificationData)], { type: 'application/json' });
 | 
					                        const userInfoBlob = new Blob([JSON.stringify(verificationData)], { type: 'application/json' });
 | 
				
			||||||
                        try {
 | 
					                        try {
 | 
				
			||||||
                            await client.put(`user/${email}/qv.json`, userInfoBlob);
 | 
					                            await client.put(`user/${email}/qv.json`, userInfoBlob);
 | 
				
			||||||
                            setVerifiedCookie(email);
 | 
					                            // setVerifiedCookie(email);
 | 
				
			||||||
                            alert("您已完成验证!");
 | 
					                            alert("您已完成验证!");
 | 
				
			||||||
                            window.location.href = "/submission";
 | 
					                            window.location.href = "/submission";
 | 
				
			||||||
                        } catch (err) {
 | 
					                        } catch (err) {
 | 
				
			||||||
@ -117,10 +117,10 @@ if (!loggedIn || !email) {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function setVerifiedCookie(email) {
 | 
					// function setVerifiedCookie(email) {
 | 
				
			||||||
    const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`;
 | 
					//     const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`;
 | 
				
			||||||
    const expires = new Date(Date.now() + 20 * 60 * 1000).toUTCString();  // 20分钟
 | 
					//     const expires = new Date(Date.now() + 20 * 60 * 1000).toUTCString();  // 20分钟
 | 
				
			||||||
    document.cookie = `loggedIn=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
					//     document.cookie = `loggedIn=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
				
			||||||
    document.cookie = `userEmail=${email}; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
					//     document.cookie = `userEmail=${email}; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
				
			||||||
    document.cookie = `verified=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
					//     document.cookie = `verified=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
				
			||||||
}
 | 
					// }
 | 
				
			||||||
							
								
								
									
										2
									
								
								js/qv.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								js/qv.min.js
									
									
									
									
										vendored
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
let client;async function f1(){try{var e=await(await fetch("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json")).json(),t=e.masterKey,o=CryptoJS.SHA256(t),i={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(i)}catch(e){console.error("Failed to fetch or decrypt OSS config:",e)}}function d2(e,t){e=e.replace(/\s/g,"");var e=CryptoJS.enc.Base64.parse(e),o=CryptoJS.lib.WordArray.create(e.words.slice(0,4)),e=CryptoJS.lib.WordArray.create(e.words.slice(4));return CryptoJS.AES.decrypt({ciphertext:e},t,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)}function getCookie(e){var o=e+"=",i=document.cookie.split(";");for(let t=0;t<i.length;t++){let e=i[t];for(;" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(o))return e.substring(o.length,e.length)}return null}document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{client||console.error("Failed to initialize OSS client due to decryption error.")}).catch(e=>{console.log("Error initializing OSS Client:",e)})});let loggedIn=getCookie("loggedIn"),email=getCookie("userEmail");if(loggedIn&&email){let e=async()=>{try{var e=await fetch(`https://download.xn--xhq44jb2fzpc.com/user/${email}/qv.json`);e.ok&&!0===await e.json()&&(alert("您已经完成验证,无需再次验证!"),window.location.href="/submission")}catch(e){console.log("没有找到验证文件,继续验证流程。")}};e(),document.getElementById("verifybtn").addEventListener("click",async()=>{try{if((await(await fetch("https://ipquery.xn--xhq44jb2fzpc.com/api/check-ip")).json()).data.isInNeU){var e=new Blob([JSON.stringify(!0)],{type:"application/json"});try{await client.put(`user/${email}/qv.json`,e),setVerifiedCookie(email),alert("您已完成验证!"),window.location.href="/submission"}catch(e){console.error("OSS写入失败:",e),alert("验证失败,请稍后重试。")}}else alert("您未连接NEU校园网,请连接后重试!")}catch(e){console.error("IP验证失败:",e),alert("验证失败,请稍后重试。")}})}else alert("您未登录,请先登录后操作!"),window.location.href="/submission";function setVerifiedCookie(e){var t=window.location.hostname.includes("localhost")?"localhost":"."+window.location.hostname.split(".").slice(-2).join("."),o=new Date(Date.now()+12e5).toUTCString();document.cookie=`loggedIn=true; domain=${t}; path=/; expires=${o}; SameSite=Lax`,document.cookie=`userEmail=${e}; domain=${t}; path=/; expires=${o}; SameSite=Lax`,document.cookie=`verified=true; domain=${t}; path=/; expires=${o}; SameSite=Lax`}
 | 
					let client;async function f1(){try{var e=await(await fetch("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json")).json(),t=e.masterKey,o=CryptoJS.SHA256(t),n={region:d2(e.encryptedRegion,o),accessKeyId:d2(e.encryptedKeyId,o),accessKeySecret:d2(e.encryptedKeySecret,o),bucket:d2(e.encryptedBucket,o)};client=new OSS(n)}catch(e){console.error("Failed to fetch or decrypt OSS config:",e)}}function d2(e,t){e=e.replace(/\s/g,"");var e=CryptoJS.enc.Base64.parse(e),o=CryptoJS.lib.WordArray.create(e.words.slice(0,4)),e=CryptoJS.lib.WordArray.create(e.words.slice(4));return CryptoJS.AES.decrypt({ciphertext:e},t,{iv:o,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)}function getCookie(e){var o=e+"=",n=document.cookie.split(";");for(let t=0;t<n.length;t++){let e=n[t];for(;" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(o))return e.substring(o.length,e.length)}return null}document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{client||console.error("Failed to initialize OSS client due to decryption error.")}).catch(e=>{console.log("Error initializing OSS Client:",e)})});let loggedIn=getCookie("loggedIn"),email=getCookie("userEmail");if(loggedIn&&email){let e=async()=>{try{var e=await fetch(`https://download.xn--xhq44jb2fzpc.com/user/${email}/qv.json`);e.ok&&!0===await e.json()&&(alert("您已经完成验证,无需再次验证!"),window.location.href="/submission")}catch(e){console.log("没有找到验证文件,继续验证流程。")}};e(),document.getElementById("verifybtn").addEventListener("click",async()=>{try{if((await(await fetch("https://ipquery.xn--xhq44jb2fzpc.com/api/check-ip")).json()).data.isInNeU){var e=new Blob([JSON.stringify(!0)],{type:"application/json"});try{await client.put(`user/${email}/qv.json`,e),alert("您已完成验证!"),window.location.href="/submission"}catch(e){console.error("OSS写入失败:",e),alert("验证失败,请稍后重试。")}}else alert("您未连接NEU校园网,请连接后重试!")}catch(e){console.error("IP验证失败:",e),alert("验证失败,请稍后重试。")}})}else alert("您未登录,请先登录后操作!"),window.location.href="/submission";
 | 
				
			||||||
@ -26,32 +26,14 @@ document.addEventListener('DOMContentLoaded', function() {
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 设置登录状态的 Cookie
 | 
					// 设置登录状态的 Cookie
 | 
				
			||||||
async function setLoginCookie(email) {
 | 
					function setLoginCookie(email) {
 | 
				
			||||||
    const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`;
 | 
					    const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`;
 | 
				
			||||||
    const expires = new Date(Date.now() + 20 * 60 * 1000).toUTCString();  // 20分钟
 | 
					    const expires = new Date(Date.now() + 20 * 60 * 1000).toUTCString();  // 20分钟
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // 设置基本的登录状态和用户邮箱的Cookie
 | 
					 | 
				
			||||||
    document.cookie = `loggedIn=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
					    document.cookie = `loggedIn=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
				
			||||||
    document.cookie = `userEmail=${email}; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
					    document.cookie = `userEmail=${email}; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // 检查是否有验证文件,并且内容为true
 | 
					 | 
				
			||||||
    const verificationFilePath = `https://download.xn--xhq44jb2fzpc.com/user/${email}/qv.json`;
 | 
					 | 
				
			||||||
    try {
 | 
					 | 
				
			||||||
        const response = await fetch(verificationFilePath);
 | 
					 | 
				
			||||||
        if (response.ok) {
 | 
					 | 
				
			||||||
            const data = await response.json();
 | 
					 | 
				
			||||||
            if (data === true) {
 | 
					 | 
				
			||||||
                // 设置verified为true的Cookie
 | 
					 | 
				
			||||||
                document.cookie = `verified=true; domain=${domain}; path=/; expires=${expires}; SameSite=Lax`;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } catch (error) {
 | 
					 | 
				
			||||||
        console.error('Error checking verification status:', error);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
function logout() {
 | 
					function logout() {
 | 
				
			||||||
    const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`;
 | 
					    const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								js/submission.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								js/submission.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -286,7 +286,7 @@
 | 
				
			|||||||
</style>
 | 
					</style>
 | 
				
			||||||
<script src="https://gosspublic.alicdn.com/aliyun-oss-sdk-6.18.0.min.js"></script>
 | 
					<script src="https://gosspublic.alicdn.com/aliyun-oss-sdk-6.18.0.min.js"></script>
 | 
				
			||||||
<script src="https://download.xn--xhq44jb2fzpc.com/password/crypto-js.js"></script>
 | 
					<script src="https://download.xn--xhq44jb2fzpc.com/password/crypto-js.js"></script>
 | 
				
			||||||
<script src="https://download.xn--xhq44jb2fzpc.com/upload/qv.min.js?v=1.0.1"></script>
 | 
					<script src="https://download.xn--xhq44jb2fzpc.com/upload/qv.min.js?v=1.0.2"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
				
			|||||||
@ -587,7 +587,7 @@
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.js"></script>
 | 
					    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -586,7 +586,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.js"></script>
 | 
					    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -586,7 +586,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.js"></script>
 | 
					    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -583,7 +583,7 @@
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.js"></script>
 | 
					    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -583,7 +583,7 @@
 | 
				
			|||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.js"></script>
 | 
					    <script src="https://download.xn--xhq44jb2fzpc.com/upload/loginrequired.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user