Finished up with internet archive api utility.

This commit is contained in:
rainbow napkin 2025-01-12 16:39:03 -05:00
parent 4c1d3c9db5
commit b443840c29
9 changed files with 241 additions and 43 deletions

View file

@ -31,7 +31,7 @@ class canopyAdminUtils{
body: JSON.stringify({permissionsMap: Object.fromEntries(permMap)})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -49,7 +49,7 @@ class canopyAdminUtils{
body: JSON.stringify({channelPermissionsMap: Object.fromEntries(permMap)})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -67,7 +67,7 @@ class canopyAdminUtils{
body: JSON.stringify({user, rank})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -79,7 +79,7 @@ class canopyAdminUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -97,7 +97,7 @@ class canopyAdminUtils{
body: JSON.stringify({user, permanent, ipBan, expirationDays})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -115,7 +115,7 @@ class canopyAdminUtils{
body: JSON.stringify({user})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -127,7 +127,7 @@ class canopyAdminUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -145,7 +145,7 @@ class canopyAdminUtils{
body: JSON.stringify({command})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -163,7 +163,7 @@ class canopyAdminUtils{
body: JSON.stringify({command})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -175,7 +175,7 @@ class canopyAdminUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -193,7 +193,7 @@ class canopyAdminUtils{
body: JSON.stringify({name, link})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -211,7 +211,7 @@ class canopyAdminUtils{
body: JSON.stringify({name})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -229,7 +229,7 @@ class canopyAdminUtils{
body: JSON.stringify({user})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());

View file

@ -22,7 +22,7 @@ class channel{
this.defineListeners();
//Scrape channel name off URL
this.channelName = window.location.pathname.split('/c/')[`1`];
this.channelName = window.location.pathname.split('/c/')[1].split('/')[0];
//Create the Video Player Object
this.player = new player(this);

View file

@ -501,7 +501,7 @@ class canopyAjaxUtils{
body: JSON.stringify(email ? {user, pass, passConfirm, email, verification} : {user, pass, passConfirm, verification})
});
if(response.status == 200){
if(response.ok){
location = "/";
}else{
utils.ux.displayResponseError(await response.json());
@ -518,7 +518,7 @@ class canopyAjaxUtils{
body: JSON.stringify(verification ? {user, pass, verification} : {user, pass})
});
if(response.status == 200){
if(response.ok){
location.reload();
}else if(response.status == 429){
location = `/login?user=${user}`;
@ -535,7 +535,7 @@ class canopyAjaxUtils{
}
});
if(response.status == 200){
if(response.ok){
location.reload();
}else{
utils.ux.displayResponseError(await response.json());
@ -552,7 +552,7 @@ class canopyAjaxUtils{
body: JSON.stringify(update)
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -564,7 +564,7 @@ class canopyAjaxUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return (await response.json())
}else{
utils.ux.displayResponseError(await response.json());
@ -581,7 +581,7 @@ class canopyAjaxUtils{
body: JSON.stringify({pass})
});
if(response.status == 200){
if(response.ok){
window.location.pathname = '/';
}else{
utils.ux.displayResponseError(await response.json());
@ -599,7 +599,7 @@ class canopyAjaxUtils{
});
//If we received a successful response
if(response.status == 200){
if(response.ok){
//Create pop-up
const popup = new canopyUXUtils.popup("A password reset link has been sent to the email associated with the account requested assuming it has one!");
//Go to home-page on pop-up closure
@ -621,7 +621,7 @@ class canopyAjaxUtils{
});
//If we received a successful response
if(response.status == 200){
if(response.ok){
//Create pop-up
const popup = new canopyUXUtils.popup("Your password has been reset, and all devices have been logged out of your account!");
//Go to home-page on pop-up closure
@ -643,7 +643,7 @@ class canopyAjaxUtils{
});
//If we received a successful response
if(response.status == 200){
if(response.ok){
const popup = new canopyUXUtils.popup("A confirmation link has been sent to the new email address.");
//Otherwise
}else{
@ -662,7 +662,7 @@ class canopyAjaxUtils{
body: JSON.stringify(thumbnail ? {name, description, thumbnail, verification} : {name, description, verification})
});
if(response.status == 200){
if(response.ok){
location = "/";
}else{
utils.ux.displayResponseError(await response.json());
@ -680,7 +680,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, settingsMap: Object.fromEntries(settingsMap)})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -698,7 +698,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, channelPermissionsMap: Object.fromEntries(permissionsMap)})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -710,7 +710,7 @@ class canopyAjaxUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return (await response.json())
}else{
utils.ux.displayResponseError(await response.json());
@ -727,7 +727,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, user, rank})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -742,7 +742,7 @@ class canopyAjaxUtils{
}
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -759,7 +759,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, user, expirationDays, banAlts})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -776,7 +776,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, user})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -791,7 +791,7 @@ class canopyAjaxUtils{
}
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -809,7 +809,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, command})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -826,7 +826,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, command})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -841,7 +841,7 @@ class canopyAjaxUtils{
}
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -858,7 +858,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, emoteName, link})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -875,7 +875,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, emoteName})
});
if(response.status == 200){
if(response.ok){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
@ -892,7 +892,7 @@ class canopyAjaxUtils{
body: JSON.stringify({chanName, confirm})
});
if(response.status == 200){
if(response.ok){
location = "/";
}else{
utils.ux.displayResponseError(await response.json());
@ -906,7 +906,7 @@ class canopyAjaxUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return (await response.text())
}else{
utils.ux.displayResponseError(await response.json());
@ -919,7 +919,7 @@ class canopyAjaxUtils{
method: "GET"
});
if(response.status == 200){
if(response.ok){
return (await response.text())
}else{
utils.ux.displayResponseError(await response.json());