From 139a096c412e9955821af9097f82c2a69f5fc2a8 Mon Sep 17 00:00:00 2001 From: Ember Date: Sat, 31 Aug 2024 02:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AA=8C=E8=AF=81=E7=B3=BB?= =?UTF-8?q?=E7=BB=9Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/qv.js | 9 +++++++++ js/qv.min.js | 2 +- js/submission.js | 22 ++++++++++++++++++++-- js/submission.min.js | 2 +- loginrequired/index.html | 4 ++-- qualification_verify/index.html | 2 +- resources/c语言/index.html | 22 +--------------------- resources/习概课本/index.html | 22 +--------------------- resources/公路交通ppt/index.html | 22 +--------------------- resources/大化/index.html | 22 +--------------------- resources/大物活页/index.html | 22 +--------------------- resources/数值分析/index.html | 22 +--------------------- resources/数值分析课本/index.html | 22 +--------------------- resources/新通用教师用书1/index.html | 22 +--------------------- resources/概率论/index.html | 22 +--------------------- resources/概率论习题/index.html | 22 +--------------------- resources/概率论课本/index.html | 22 +--------------------- resources/线性代数/index.html | 22 +--------------------- resources/马原课本/index.html | 22 +--------------------- resources/高数/index.html | 22 +--------------------- resources/高数习题/index.html | 22 +--------------------- submission/index.html | 2 +- 22 files changed, 50 insertions(+), 323 deletions(-) diff --git a/js/qv.js b/js/qv.js index 2e9404d..d3fb789 100644 --- a/js/qv.js +++ b/js/qv.js @@ -100,6 +100,7 @@ if (!loggedIn || !email) { const userInfoBlob = new Blob([JSON.stringify(verificationData)], { type: 'application/json' }); try { await client.put(`user/${email}/qv.json`, userInfoBlob); + setVerifiedCookie(email); alert("您已完成验证!"); window.location.href = "/submission"; } catch (err) { @@ -114,4 +115,12 @@ if (!loggedIn || !email) { alert("验证失败,请稍后重试。"); } }); +} + +function setVerifiedCookie(email) { + 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分钟 + document.cookie = `loggedIn=true; 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`; } \ No newline at end of file diff --git a/js/qv.min.js b/js/qv.min.js index 5afccf3..f57bd84 100644 --- a/js/qv.min.js +++ b/js/qv.min.js @@ -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),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{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"; \ No newline at end of file +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{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`} \ No newline at end of file diff --git a/js/submission.js b/js/submission.js index 20d5197..c2da42e 100644 --- a/js/submission.js +++ b/js/submission.js @@ -26,14 +26,32 @@ document.addEventListener('DOMContentLoaded', function() { }); // 设置登录状态的 Cookie -function setLoginCookie(email) { +async function setLoginCookie(email) { 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分钟 + + // 设置基本的登录状态和用户邮箱的Cookie document.cookie = `loggedIn=true; 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() { const domain = window.location.hostname.includes('localhost') ? 'localhost' : `.${window.location.hostname.split('.').slice(-2).join('.')}`; @@ -160,7 +178,7 @@ async function checkqv(curemail) { const data = await response.json(); if (data === true) { // 用户已经完成NEU校园网认证 - console.log("NEU校园网认证已完成"); + // console.log("NEU校园网认证已完成"); } else { // 文件存在但内容不是true showCustomModal(); diff --git a/js/submission.min.js b/js/submission.min.js index 126efb1..0fc47d0 100644 --- a/js/submission.min.js +++ b/js/submission.min.js @@ -1,4 +1,4 @@ -let client,s=!1;var curemail="",submitted=0;function getCookie(e){var n=e+"=",o=document.cookie.split(";");for(let t=0;t{window.location.href="/qualification_verify"}),document.getElementById("logoutButton").addEventListener("click",()=>{logout()})}async function f1(){try{var e=await(await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json")).json(),t=e.masterKey,n=CryptoJS.SHA256(t),o={region:d2(e.encryptedRegion,n),accessKeyId:d2(e.encryptedKeyId,n),accessKeySecret:d2(e.encryptedKeySecret,n),bucket:d2(e.encryptedBucket,n)};client=new OSS(o)}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),n=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:n,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)}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 buttons=document.querySelectorAll(".navButton");function showSubmission(){document.getElementById("submission-area").style.display="block",document.getElementById("myinfo").style.display="none",document.getElementById("mysubmission").style.display="none"}function showMyInfo(){document.getElementById("submission-area").style.display="none",document.getElementById("myinfo").style.display="block",document.getElementById("mysubmission").style.display="none"}function showMySubmissions(){document.getElementById("submission-area").style.display="none",document.getElementById("myinfo").style.display="none",fetchSubmissionData(curemail,submitted),document.getElementById("mysubmission").style.display="block"}async function updateUserInfo(){if(s){var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{var t=await fetchNoCache(e);if(!t.ok)throw new Error("p.json not found");var n=await t.json();n&&n.nickname?(document.getElementById("nickname").innerText=n.nickname,console.log("Nickname has been successfully updated.")):(document.getElementById("nickname").innerText="Default Nickname",console.log("Default nickname set due to missing 'nickname' field in response."))}catch(e){console.error("Error loading p.json:",e),document.getElementById("nickname").innerText="Default Nickname"}}else console.log("User is not logged in.")}async function checkAndLoadAvatar(){if(s){var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`,t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/avatar`,n="https://download.xn--xhq44jb2fzpc.com/avatar/default.png";try{var o,i=await fetchNoCache(e);if(!i.ok)throw new Error("p.json not found");(await i.json()).hasAvatar?(o=t+"?t="+Date.now(),document.getElementById("myinfoavatar").src=o,console.log("Custom avatar loaded.")):(document.getElementById("myinfoavatar").src=n,console.log("Default avatar loaded due to `hasAvatar` being false."))}catch(e){document.getElementById("myinfoavatar").src=n,console.error("Error loading p.json. Using default avatar:",e)}}else console.log("User is not logged in.")}function showTooltip(e,t,n){var o=document.getElementById("tooltip"),i=document.getElementById("tooltip-title"),a=document.getElementById("tooltip-content");i.textContent=t,a.textContent=n,o.classList.add("show")}function hideTooltip(){document.getElementById("tooltip").classList.remove("show")}async function checkVerifiedStatus(t){if(t){let e=document.getElementById("verified-icon");try{var n=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/verified-email/verified-email.json");if(!n.ok)throw new Error("Failed to fetch verified-email.json");(await n.json()).includes(t)?(e.style.display="inline-flex",console.log("Email is verified."),e.addEventListener("mouseenter",()=>fetchVerificationDetails(t,e)),e.addEventListener("mouseleave",hideTooltip),e.addEventListener("click",()=>fetchVerificationDetails(t,e))):console.log("Email is not verified.")}catch(e){console.error("Error loading or parsing verified-email.json:",e)}}else console.log("Email not provided, skipping verified status check.")}async function fetchVerificationDetails(e,t){e=`https://download.xn--xhq44jb2fzpc.com/user/${e}/verified.json`;try{var n=await fetchNoCache(e);n.ok?showTooltip(t,"认证作者",(await n.json()).description):404===n.status&&showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}catch(e){console.error("Error fetching verification details:",e),showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}}async function checkInvitedStatus(t){if(t){let e=document.getElementById("invited-icon");try{var n=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/invited-email/invited-email.json");if(!n.ok)throw new Error("Failed to fetch invited-email.json");(await n.json()).includes(t)?(e.style.display="inline-flex",console.log("Email is an invited author."),e.addEventListener("mouseenter",()=>fetchInvitedInfo(t,e)),e.addEventListener("mouseleave",hideTooltip),e.addEventListener("click",()=>fetchInvitedInfo(t,e))):console.log("Email is not an invited author.")}catch(e){console.error("Error loading or parsing invited-email.json:",e)}}else console.log("Email not provided, skipping invited author status check.")}async function fetchInvitedInfo(e,t){e=`https://download.xn--xhq44jb2fzpc.com/user/${e}/invited.json`;try{var n=await fetchNoCache(e);n.ok?showTooltip(t,"特邀作者",(await n.json()).description||"无详细信息"):showTooltip(t,"特邀作者","无法获取信息")}catch(e){console.error("Error fetching invited info:",e),showTooltip(t,"特邀作者","无法加载信息")}}async function editNickname(){if(s){let e=prompt("请输入新的昵称:");if(null!==e)if(""===e.trim())alert("昵称不能为空!");else{var t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{var n=await fetchNoCache(t);if(!n.ok)throw new Error("Failed to fetch p.json");var o=await n.json(),i=(o.nickname=e,new Blob([JSON.stringify(o)],{type:"application/json"}));await client.put(`user/${curemail}/p.json`,i),console.log("p.json has been successfully updated with new nickname."),setTimeout(()=>{document.getElementById("nickname").innerText=e,console.log("Nickname has been updated on the page.")},1e3)}catch(e){console.error("Error updating nickname:",e)}}}else alert("您尚未登录,请登录后再尝试修改昵称。")}async function uploadAvatar(t){t=t.target.files[0];if(t&&t.size<=1048576)if(!0===s){var n=`user/${curemail}/p.json`,o=`user/${curemail}/avatar`;try{var i,a=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/"+n);let e;e=a.ok?await a.json():{h:[hashedPassword],nickname:"默认昵称",hasAvatar:!1},await client.put(o,t),console.log("Avatar has been successfully uploaded."),e.hasAvatar?setTimeout(()=>{document.getElementById("myinfoavatar").src+="?"+(new Date).getTime(),console.log("Forced reload of the existing avatar.")},2e3):(e.hasAvatar=!0,i=new Blob([JSON.stringify(e)],{type:"application/json"}),await client.put(n,i),console.log("p.json has been successfully uploaded."),setTimeout(()=>{document.getElementById("myinfoavatar").src="https://download.xn--xhq44jb2fzpc.com/"+o,console.log("myinfoavatar's src has been updated to the new avatar.")},2e3))}catch(e){console.error("Failed to upload new avatar or update p.json:",e)}}else alert("You are not logged in, please log in before attempting to upload an avatar.");else alert("头像必须小于 1MB!")}buttons.forEach(e=>{e.addEventListener("click",function(){buttons.forEach(e=>e.classList.remove("selected")),this.classList.add("selected")})}),document.body.addEventListener("click",e=>{var t=document.getElementById("tooltip"),n=document.getElementById("verified-icon"),o=document.getElementById("invited-icon");n.contains(e.target)||o.contains(e.target)||t.contains(e.target)||hideTooltip()}),document.getElementById("editNicknameBtn").addEventListener("click",editNickname),document.querySelector(".overlay").addEventListener("click",function(){document.getElementById("fileInput").click()});let input=document.getElementById("input");async function fetchSubmittedCount(e){e=`https://download.xn--xhq44jb2fzpc.com/upload/${e}/submitted.json`;try{var t=await fetchNoCache(e);if(!t.ok)throw new Error("File not found or access error");var n=await t.json();submitted=n,console.log("Submitted count updated:",submitted)}catch(e){submitted=0,console.log("Error fetching submitted count:",e)}}async function fetchSubmissionData(t,n){let o=` +let client,s=!1;var curemail="",submitted=0;function getCookie(e){var n=e+"=",o=document.cookie.split(";");for(let t=0;t{window.location.href="/qualification_verify"}),document.getElementById("logoutButton").addEventListener("click",()=>{logout()})}async function f1(){try{var e=await(await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/json/s.json")).json(),t=e.masterKey,n=CryptoJS.SHA256(t),o={region:d2(e.encryptedRegion,n),accessKeyId:d2(e.encryptedKeyId,n),accessKeySecret:d2(e.encryptedKeySecret,n),bucket:d2(e.encryptedBucket,n)};client=new OSS(o)}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),n=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:n,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)}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 buttons=document.querySelectorAll(".navButton");function showSubmission(){document.getElementById("submission-area").style.display="block",document.getElementById("myinfo").style.display="none",document.getElementById("mysubmission").style.display="none"}function showMyInfo(){document.getElementById("submission-area").style.display="none",document.getElementById("myinfo").style.display="block",document.getElementById("mysubmission").style.display="none"}function showMySubmissions(){document.getElementById("submission-area").style.display="none",document.getElementById("myinfo").style.display="none",fetchSubmissionData(curemail,submitted),document.getElementById("mysubmission").style.display="block"}async function updateUserInfo(){if(s){var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{var t=await fetchNoCache(e);if(!t.ok)throw new Error("p.json not found");var n=await t.json();n&&n.nickname?(document.getElementById("nickname").innerText=n.nickname,console.log("Nickname has been successfully updated.")):(document.getElementById("nickname").innerText="Default Nickname",console.log("Default nickname set due to missing 'nickname' field in response."))}catch(e){console.error("Error loading p.json:",e),document.getElementById("nickname").innerText="Default Nickname"}}else console.log("User is not logged in.")}async function checkAndLoadAvatar(){if(s){var e=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`,t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/avatar`,n="https://download.xn--xhq44jb2fzpc.com/avatar/default.png";try{var o,i=await fetchNoCache(e);if(!i.ok)throw new Error("p.json not found");(await i.json()).hasAvatar?(o=t+"?t="+Date.now(),document.getElementById("myinfoavatar").src=o,console.log("Custom avatar loaded.")):(document.getElementById("myinfoavatar").src=n,console.log("Default avatar loaded due to `hasAvatar` being false."))}catch(e){document.getElementById("myinfoavatar").src=n,console.error("Error loading p.json. Using default avatar:",e)}}else console.log("User is not logged in.")}function showTooltip(e,t,n){var o=document.getElementById("tooltip"),i=document.getElementById("tooltip-title"),a=document.getElementById("tooltip-content");i.textContent=t,a.textContent=n,o.classList.add("show")}function hideTooltip(){document.getElementById("tooltip").classList.remove("show")}async function checkVerifiedStatus(t){if(t){let e=document.getElementById("verified-icon");try{var n=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/verified-email/verified-email.json");if(!n.ok)throw new Error("Failed to fetch verified-email.json");(await n.json()).includes(t)?(e.style.display="inline-flex",console.log("Email is verified."),e.addEventListener("mouseenter",()=>fetchVerificationDetails(t,e)),e.addEventListener("mouseleave",hideTooltip),e.addEventListener("click",()=>fetchVerificationDetails(t,e))):console.log("Email is not verified.")}catch(e){console.error("Error loading or parsing verified-email.json:",e)}}else console.log("Email not provided, skipping verified status check.")}async function fetchVerificationDetails(e,t){e=`https://download.xn--xhq44jb2fzpc.com/user/${e}/verified.json`;try{var n=await fetchNoCache(e);n.ok?showTooltip(t,"认证作者",(await n.json()).description):404===n.status&&showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}catch(e){console.error("Error fetching verification details:",e),showTooltip(t,"认证作者","本作者为经过网站认证的优质内容分享者。")}}async function checkInvitedStatus(t){if(t){let e=document.getElementById("invited-icon");try{var n=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/upload/invited-email/invited-email.json");if(!n.ok)throw new Error("Failed to fetch invited-email.json");(await n.json()).includes(t)?(e.style.display="inline-flex",console.log("Email is an invited author."),e.addEventListener("mouseenter",()=>fetchInvitedInfo(t,e)),e.addEventListener("mouseleave",hideTooltip),e.addEventListener("click",()=>fetchInvitedInfo(t,e))):console.log("Email is not an invited author.")}catch(e){console.error("Error loading or parsing invited-email.json:",e)}}else console.log("Email not provided, skipping invited author status check.")}async function fetchInvitedInfo(e,t){e=`https://download.xn--xhq44jb2fzpc.com/user/${e}/invited.json`;try{var n=await fetchNoCache(e);n.ok?showTooltip(t,"特邀作者",(await n.json()).description||"无详细信息"):showTooltip(t,"特邀作者","无法获取信息")}catch(e){console.error("Error fetching invited info:",e),showTooltip(t,"特邀作者","无法加载信息")}}async function editNickname(){if(s){let e=prompt("请输入新的昵称:");if(null!==e)if(""===e.trim())alert("昵称不能为空!");else{var t=`https://download.xn--xhq44jb2fzpc.com/user/${curemail}/p.json`;try{var n=await fetchNoCache(t);if(!n.ok)throw new Error("Failed to fetch p.json");var o=await n.json(),i=(o.nickname=e,new Blob([JSON.stringify(o)],{type:"application/json"}));await client.put(`user/${curemail}/p.json`,i),console.log("p.json has been successfully updated with new nickname."),setTimeout(()=>{document.getElementById("nickname").innerText=e,console.log("Nickname has been updated on the page.")},1e3)}catch(e){console.error("Error updating nickname:",e)}}}else alert("您尚未登录,请登录后再尝试修改昵称。")}async function uploadAvatar(t){t=t.target.files[0];if(t&&t.size<=1048576)if(!0===s){var n=`user/${curemail}/p.json`,o=`user/${curemail}/avatar`;try{var i,a=await fetchNoCache("https://download.xn--xhq44jb2fzpc.com/"+n);let e;e=a.ok?await a.json():{h:[hashedPassword],nickname:"默认昵称",hasAvatar:!1},await client.put(o,t),console.log("Avatar has been successfully uploaded."),e.hasAvatar?setTimeout(()=>{document.getElementById("myinfoavatar").src+="?"+(new Date).getTime(),console.log("Forced reload of the existing avatar.")},2e3):(e.hasAvatar=!0,i=new Blob([JSON.stringify(e)],{type:"application/json"}),await client.put(n,i),console.log("p.json has been successfully uploaded."),setTimeout(()=>{document.getElementById("myinfoavatar").src="https://download.xn--xhq44jb2fzpc.com/"+o,console.log("myinfoavatar's src has been updated to the new avatar.")},2e3))}catch(e){console.error("Failed to upload new avatar or update p.json:",e)}}else alert("You are not logged in, please log in before attempting to upload an avatar.");else alert("头像必须小于 1MB!")}buttons.forEach(e=>{e.addEventListener("click",function(){buttons.forEach(e=>e.classList.remove("selected")),this.classList.add("selected")})}),document.body.addEventListener("click",e=>{var t=document.getElementById("tooltip"),n=document.getElementById("verified-icon"),o=document.getElementById("invited-icon");n.contains(e.target)||o.contains(e.target)||t.contains(e.target)||hideTooltip()}),document.getElementById("editNicknameBtn").addEventListener("click",editNickname),document.querySelector(".overlay").addEventListener("click",function(){document.getElementById("fileInput").click()});let input=document.getElementById("input");async function fetchSubmittedCount(e){e=`https://download.xn--xhq44jb2fzpc.com/upload/${e}/submitted.json`;try{var t=await fetchNoCache(e);if(!t.ok)throw new Error("File not found or access error");var n=await t.json();submitted=n,console.log("Submitted count updated:",submitted)}catch(e){submitted=0,console.log("Error fetching submitted count:",e)}}async function fetchSubmissionData(t,n){let o=` ## 投稿记录 | 标题 | 板块 | 审核状态 | 审核备注 | diff --git a/loginrequired/index.html b/loginrequired/index.html index 9b38d33..a2dff6d 100644 --- a/loginrequired/index.html +++ b/loginrequired/index.html @@ -7,7 +7,7 @@ NEU小站 - +
-
此资源需要登录后才能查看!
+
此资源需要经过验证的账户才能查看!
正在跳转到登录页面,请稍后……
- + diff --git a/resources/c语言/index.html b/resources/c语言/index.html index ff76cc0..4fea178 100644 --- a/resources/c语言/index.html +++ b/resources/c语言/index.html @@ -587,27 +587,7 @@ - + diff --git a/resources/习概课本/index.html b/resources/习概课本/index.html index fb55a94..470292e 100644 --- a/resources/习概课本/index.html +++ b/resources/习概课本/index.html @@ -586,27 +586,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/公路交通ppt/index.html b/resources/公路交通ppt/index.html index 61c21a6..0b8df20 100644 --- a/resources/公路交通ppt/index.html +++ b/resources/公路交通ppt/index.html @@ -586,27 +586,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/大化/index.html b/resources/大化/index.html index 8ce7648..5cdfebc 100644 --- a/resources/大化/index.html +++ b/resources/大化/index.html @@ -583,27 +583,7 @@ - + diff --git a/resources/大物活页/index.html b/resources/大物活页/index.html index 893f0dc..b5ff93e 100644 --- a/resources/大物活页/index.html +++ b/resources/大物活页/index.html @@ -583,27 +583,7 @@ - + diff --git a/resources/数值分析/index.html b/resources/数值分析/index.html index 5581f1d..7f63f9e 100644 --- a/resources/数值分析/index.html +++ b/resources/数值分析/index.html @@ -643,27 +643,7 @@ - + diff --git a/resources/数值分析课本/index.html b/resources/数值分析课本/index.html index 100cd71..8370431 100644 --- a/resources/数值分析课本/index.html +++ b/resources/数值分析课本/index.html @@ -592,27 +592,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/新通用教师用书1/index.html b/resources/新通用教师用书1/index.html index b4ab14f..b9bde03 100644 --- a/resources/新通用教师用书1/index.html +++ b/resources/新通用教师用书1/index.html @@ -586,27 +586,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/概率论/index.html b/resources/概率论/index.html index 7ff7408..d09990a 100644 --- a/resources/概率论/index.html +++ b/resources/概率论/index.html @@ -598,27 +598,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/概率论习题/index.html b/resources/概率论习题/index.html index 184dca0..1b2aa8b 100644 --- a/resources/概率论习题/index.html +++ b/resources/概率论习题/index.html @@ -583,27 +583,7 @@ - + diff --git a/resources/概率论课本/index.html b/resources/概率论课本/index.html index e23dc90..d529e28 100644 --- a/resources/概率论课本/index.html +++ b/resources/概率论课本/index.html @@ -592,27 +592,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/线性代数/index.html b/resources/线性代数/index.html index cd6f63b..2679d66 100644 --- a/resources/线性代数/index.html +++ b/resources/线性代数/index.html @@ -839,27 +839,7 @@ - + diff --git a/resources/马原课本/index.html b/resources/马原课本/index.html index 68ad112..ae90c9f 100644 --- a/resources/马原课本/index.html +++ b/resources/马原课本/index.html @@ -582,27 +582,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/高数/index.html b/resources/高数/index.html index 3f4676b..4120b7d 100644 --- a/resources/高数/index.html +++ b/resources/高数/index.html @@ -615,27 +615,7 @@ document.addEventListener("DOMContentLoaded",function(){f1().then(()=>{if(client - + diff --git a/resources/高数习题/index.html b/resources/高数习题/index.html index cd34dce..8601433 100644 --- a/resources/高数习题/index.html +++ b/resources/高数习题/index.html @@ -589,27 +589,7 @@ - + diff --git a/submission/index.html b/submission/index.html index d298d64..2bee407 100644 --- a/submission/index.html +++ b/submission/index.html @@ -985,7 +985,7 @@ async function fetchNoCache(url) { - +