Add files via upload

This commit is contained in:
nuttylmao
2025-03-23 22:04:07 +11:00
committed by GitHub
parent f133722899
commit 6c53d973f7
97 changed files with 15625 additions and 0 deletions
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<head>
<title>Configure</title>
<meta charset="UTF-8">
<link rel="shortcut icon" href="#" />
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div id="mainContainer">
<div id="connectBox">
<img src="logo.png" width="60%">
<label>
<br><br>
<button onclick="RequestToken()">Connect</button>
<br><br>
<button id="instructionsButton" onclick="OpenInstructions()">Instructions</button>
</label>
</div>
<div id="authorizationBox">
<label id="authorizationCode">
2305
</label>
<label id="authorizationComplete">
<img src="logo.png" width="60%">
<br><br>
<span style="font-weight: 500; font-size: 30px;">Authorization complete</span>
<br><br>
You now owe me money for all of my hard work.
</label>
<button id="copyURLButton" onclick="CopyToURL()" disabled="true">Awaiting approval</button>
<br><br>
<button id="donateButton" onclick="OpenDonationPage()" style="display: none;">Donate out of guilt</button>
</div>
<div id="errorBox">
<label style="font-size: 30px; font-weight: 600;">Error <span id="errorCode">69</span></label>
<br>
<span id="errorMessage">You died lmao. You died lmao. You died lmao. You died lmao. You died lmao. You died lmao.You died lmao. You died lmao.</span>
<br><br>
<button id="closeErrorBox" onclick="CloseErrorBox()">Okay</button>
</div>
</div>
</body>
<script src="./script.js"></script>
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

@@ -0,0 +1,110 @@
const appId = "nuttys-ytmdesktop-widget";
const appName = "nuttys YouTube Music Widget";
const appVersion = "1.0.0";
const baseURL = "http://nuttylmao.github.io/youtube-music-widget-compact";
let browserSourceURL = ""
// Request a four digit authentication code
async function RequestCode() {
const response = await fetch("http://localhost:9863/api/v1/auth/requestcode", {
method: "POST",
body: JSON.stringify({
"appId": appId,
"appName": appName,
"appVersion": appVersion
}),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
})
const responseData = await response.json();
console.debug(responseData);
if (responseData.hasOwnProperty("statusCode"))
{
document.getElementById("errorCode").innerText = responseData.statusCode;
document.getElementById("errorMessage").innerText = responseData.message;
document.getElementById("errorBox").style.display = 'inline';
}
else
return await responseData;
}
// Wait for the user to accept the code and return them an access token
async function RequestToken() {
const requestCode = await RequestCode();
const authCode = requestCode.code;
console.debug(`Auth Code: ${authCode}`);
document.getElementById("authorizationCode").innerText = authCode;
// Show the authorize popup
document.getElementById("authorizationBox").style.display = 'inline';
const response = await fetch("http://localhost:9863/api/v1/auth/request", {
method: "POST",
body: JSON.stringify({
"appId": appId,
"code": authCode
}),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
})
const responseData = await response.json();
if (responseData.hasOwnProperty("statusCode"))
{
document.getElementById("errorCode").innerText = responseData.statusCode;
document.getElementById("errorMessage").innerText = responseData.message;
document.getElementById("errorBox").style.display = 'inline';
// Hide the authorize popup
document.getElementById("authorizationBox").style.display = 'none';
}
else
{
const token = responseData.token;
console.debug(`Token: ${token}`);
browserSourceURL = `${baseURL}?token=${token}`;
// Enable the Copy URL Button
document.getElementById("copyURLButton").disabled = false;
document.getElementById("copyURLButton").innerText = "Click to copy URL";
// Show the donation button
document.getElementById("authorizationCode").style.display = 'none';
// Show the donation button and confirmation text
document.getElementById("donateButton").style.display = 'block';
document.getElementById("authorizationComplete").style.display = 'block';
}
return await responseData;
}
function CopyToURL() {
navigator.clipboard.writeText(browserSourceURL);
document.getElementById("copyURLButton").innerText = "Copied to clipboard";
document.getElementById("copyURLButton").style.backgroundColor = "#00dd63"
document.getElementById("copyURLButton").style.color = "#ffffff";
setTimeout(() => {
document.getElementById("copyURLButton").innerText = "Click to copy URL";
document.getElementById("copyURLButton").style.backgroundColor = "#ffffff";
document.getElementById("copyURLButton").style.color = "#181818";
}, 3000);
}
function OpenInstructions() {
window.open("https://nuttylmao.notion.site/YouTube-Music-Widget-Compact-Edition-1ac19969b23780fb938deaeb00d90800", '_blank').focus();
}
function OpenDonationPage() {
window.open("http://nutty.gg/pages/donate", '_blank').focus();
}
function CloseErrorBox() {
document.getElementById("errorBox").style.display = 'none';
}
@@ -0,0 +1,115 @@
* {
--corner-radius: 10px;
--padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
body {
margin: 0px;
color: white;
font-size: 24px;
}
#mainContainer {
position: absolute;
width: 100vw;
height: 100vh;
margin: 0px;
background-color: #282828;
}
#errorBox {
background-color: #6d0b0b;
border-radius: var(--corner-radius);
padding: calc(var(--padding)) calc(var(--padding)*2);
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 1));
display: none;
}
#connectBox{
background-color: #181818;
border-radius: var(--corner-radius);
padding: calc(var(--padding)*3) calc(var(--padding)*3);
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 1));
width: 400px;
text-align: center;
}
#authorizationBox {
background-color: #252525;
border-radius: var(--corner-radius);
padding: calc(var(--padding)*3) calc(var(--padding)*3);
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 1));
width: 400px;
display: none;
}
#authorizationCode {
display: block;
text-align: center;
font-size: 80px;
font-weight: 700;
padding-left: 30px;
padding-bottom: 40px;
letter-spacing: 30px;
color: #f44336;
}
#authorizationComplete {
display: block;
text-align: center;
padding-bottom: 40px;
display: none;
}
button {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
font-size: 24px;
font-weight: 500;
background-color: #f44336;
color: white;
opacity: 0.8;
border-width: 0;
border-radius: var(--corner-radius);
padding: calc(var(--padding)/2) var(--padding);
width: 100%;
}
button:hover {
opacity: 1;
cursor: pointer;
}
#instructionsButton, #donateButton {
background-color: #2e2e2e;
}
#copyURLButton {
background-color: #ffffff;
color: #181818;
width: 100%;
transition: all 0.2s ease;
}
#copyURLButton:disabled {
background-color: #636363;
opacity: 0.8;
cursor: inherit;
}
#closeErrorBox {
background-color: #ffffff;
color: #181818;
}