Various fixes
This commit is contained in:
parent
54f026e262
commit
8c80870d30
5 changed files with 64 additions and 36 deletions
|
@ -529,7 +529,7 @@ const images=[];
|
|||
const imageshtml=[];
|
||||
function createunknown(fname,fsize,src){
|
||||
const div=document.createElement("table");
|
||||
div.classList.add("unkownfile");
|
||||
div.classList.add("unknownfile");
|
||||
const nametr=document.createElement("tr");
|
||||
div.append(nametr);
|
||||
const fileicon=document.createElement("td");
|
||||
|
|
|
@ -10,40 +10,41 @@ function setTheme(){
|
|||
document.body.className=name+"-theme";
|
||||
}
|
||||
setTheme();
|
||||
{
|
||||
const instancein=document.getElementById("instancein");
|
||||
let timeout=0;
|
||||
async function check(e){
|
||||
try{
|
||||
verify.innerText="Checking Instance"
|
||||
instanceinfo=await setInstance(instancein.value)
|
||||
localStorage.setItem("instanceinfo",JSON.stringify(instanceinfo));
|
||||
verify.innerText="Instance is all good"
|
||||
setTimeout(_=>{
|
||||
console.log(verify.innerText)
|
||||
verify.innerText="";
|
||||
},3000);
|
||||
|
||||
}catch(e){
|
||||
console.log("catch")
|
||||
verify.innerText="Invalid Instance, try again"
|
||||
}
|
||||
}
|
||||
if(instancein){
|
||||
console.log(instancein)
|
||||
instancein.addEventListener("keydown",e=>{
|
||||
const verify=document.getElementById("verify");
|
||||
verify.innerText="Waiting to check Instance"
|
||||
clearTimeout(timeout);
|
||||
timeout=setTimeout(check,1000);
|
||||
});
|
||||
}
|
||||
if(localStorage.getItem("instanceinfo")){
|
||||
instancein.value=localStorage.getItem("instanceinfo").wellKnown
|
||||
}else{
|
||||
check("https://spacebar.chat/");
|
||||
const instancein=document.getElementById("instancein");
|
||||
let timeout=0;
|
||||
async function checkInstance(e){
|
||||
try{
|
||||
verify.innerText="Checking Instance"
|
||||
instanceinfo=await setInstance(instancein.value)
|
||||
localStorage.setItem("instanceinfo",JSON.stringify(instanceinfo));
|
||||
verify.innerText="Instance is all good"
|
||||
if(checkInstance.alt){checkInstance.alt();}
|
||||
setTimeout(_=>{
|
||||
console.log(verify.innerText)
|
||||
verify.innerText="";
|
||||
},3000);
|
||||
|
||||
}catch(e){
|
||||
console.log("catch")
|
||||
verify.innerText="Invalid Instance, try again"
|
||||
}
|
||||
}
|
||||
if(instancein){
|
||||
console.log(instancein)
|
||||
instancein.addEventListener("keydown",e=>{
|
||||
const verify=document.getElementById("verify");
|
||||
verify.innerText="Waiting to check Instance"
|
||||
clearTimeout(timeout);
|
||||
timeout=setTimeout(checkInstance,1000);
|
||||
});
|
||||
}
|
||||
if(localStorage.getItem("instanceinfo")){
|
||||
instancein.value=JSON.parse(localStorage.getItem("instanceinfo")).wellknown
|
||||
}else{
|
||||
checkInstance("https://spacebar.chat/");
|
||||
}
|
||||
|
||||
async function login(username, password){
|
||||
const options={
|
||||
method: "POST",
|
||||
|
|
|
@ -23,8 +23,12 @@
|
|||
<input type="password" placeholder="Enter Password Again" name="psw2" required><br><br>
|
||||
|
||||
<label for="date"><b>Date of birth:</b></label><br>
|
||||
<input type="date" id="start" name="trip-start" name="date"/><br><br><br><br>
|
||||
<p class="wrongred" id="wrong"></p>
|
||||
<input type="date" id="start" name="date"/><br><br>
|
||||
|
||||
|
||||
<b id="TOSbox">I agree to the <a href="" id="TOSa">TOS</a>:</b>
|
||||
<input type="checkbox" id="TOS" name="TOS"/><br>
|
||||
<p class="wrongred" id="wrong"></p><br>
|
||||
<button type="submit">Create account</button>
|
||||
</form>
|
||||
<a href="/login.html">Already have an account?</a>
|
||||
|
|
|
@ -9,6 +9,7 @@ async function registertry(e){
|
|||
const username=elements[2].value;
|
||||
if(elements[3].value!==elements[4].value){
|
||||
document.getElementById("wrong").innerText="Passwords don't match";
|
||||
return;
|
||||
}
|
||||
const password=elements[3].value;
|
||||
const dateofbirth=elements[5].value;
|
||||
|
@ -20,7 +21,7 @@ async function registertry(e){
|
|||
email:email,
|
||||
username:username,
|
||||
password:password,
|
||||
consent:true,
|
||||
consent:elements[5].checked,
|
||||
}),
|
||||
headers:{
|
||||
"content-type": "application/json"
|
||||
|
@ -40,3 +41,20 @@ async function registertry(e){
|
|||
//document.getElementById("wrong").innerText=h;
|
||||
// console.log(h);
|
||||
}
|
||||
let TOSa=document.getElementById("TOSa");
|
||||
async function tosLogic(){
|
||||
const apiurl=new URL(JSON.parse(localStorage.getItem("instanceinfo")).api)
|
||||
const tosPage=(await (await fetch(apiurl.toString()+"/ping")).json()).instance.tosPage;
|
||||
if(tosPage){
|
||||
document.getElementById("TOSbox").innerHTML="I agree to the <a href=\"\" id=\"TOSa\">TOS</a>:";
|
||||
TOSa=document.getElementById("TOSa");
|
||||
TOSa.href=tosPage;
|
||||
}else{
|
||||
document.getElementById("TOSbox").innerText="This instance has no TOS, accept TOS anyways:";
|
||||
TOSa=null;
|
||||
}
|
||||
console.log(tosPage);
|
||||
}
|
||||
tosLogic();
|
||||
|
||||
checkInstance.alt=tosLogic;
|
||||
|
|
|
@ -8,7 +8,12 @@ body {
|
|||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#TOS{
|
||||
width: fit-content !important;
|
||||
}
|
||||
.unkownfile{
|
||||
background:var(--unknown-file-bg) ;
|
||||
}
|
||||
.imgfit {
|
||||
max-width: 80vw;
|
||||
max-height: 80vh;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue