Skip to content

Commit

Permalink
- Edited index.html
Browse files Browse the repository at this point in the history
- Fixes and changes
  • Loading branch information
Koala3353 committed Apr 11, 2024
1 parent 04cee6a commit 3e0d003
Show file tree
Hide file tree
Showing 18 changed files with 1,392 additions and 388 deletions.
838 changes: 838 additions & 0 deletions activitylist.html

Large diffs are not rendered by default.

Binary file added assets/img/hobbies/math.webp
Binary file not shown.
60 changes: 60 additions & 0 deletions assets/js/activitylist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const MUSIC = 1;
const EXPLORER = 2;

fetch("https://ap-southeast-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/data-duebb/auth/providers/anon-user/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => {
const accessToken = data.access_token;
console.log("Access Token:", accessToken);

const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer " + accessToken);

var reflowAuth = localStorage.getItem('reflowAuth');
var parsedReflowAuth = JSON.parse(reflowAuth);
var userId = parsedReflowAuth.profile.id;
const raw = JSON.stringify({
"dataSource": "Cluster0",
"database": "spark",
"collection": "user-data",
"filter": {
"user-id": userId
}
});

const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"};

fetch("https://ap-southeast-1.aws.data.mongodb-api.com/app/data-duebb/endpoint/data/v1/action/findOne", requestOptions)
.then((response) => response.text())
.then((result) => {
const parsedResult = JSON.parse(result);
const owned = parsedResult.document.owned;
if (!owned.includes(EXPLORER)) {
// get all buttons with music-download-restrict as class
$('.hobby-download-restrict').addClass('disabled');
console.log("Explorer");
}

if (!owned.includes(MUSIC)) {
$('.music-download-restrict').addClass('disabled');
console.log("Music");
}
})
.catch((error) => {

Check warning on line 53 in assets/js/activitylist.js

View workflow job for this annotation

GitHub Actions / qodana

Unused local symbol

Unused parameter error
$('#no-tuts').removeAttr('hidden');
});
})
.catch(() => {
$('#no-tuts').removeAttr('hidden');

});
2 changes: 1 addition & 1 deletion assets/js/logincheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ if(document.readyState === 'complete') {
} else {
//add delay
console.log("DELAY");
setTimeout(checkLoginStatus, 3000);
setTimeout(checkLoginStatus, 2000);
}
14 changes: 12 additions & 2 deletions assets/js/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ fetch("https://ap-southeast-1.aws.services.cloud.mongodb.com/api/client/v2.0/app
$('#pencilsSketchingDiv').removeAttr('hidden');
console.log("Pencils Sketching");
}

if (!owned.includes(ARDUINO) && !owned.includes(PENCILS_SKETCHING)) {
$('#no-tuts').removeAttr('hidden');

}
})
.catch((error) => console.error(error));
.catch((error) => {

Check warning on line 57 in assets/js/resources.js

View workflow job for this annotation

GitHub Actions / qodana

Unused local symbol

Unused parameter error
$('#no-tuts').removeAttr('hidden');
});
})
.catch(error => console.error('Error:', error));
.catch(() => {
$('#no-tuts').removeAttr('hidden');

});
52 changes: 52 additions & 0 deletions assets/js/resourcesCheckArduino.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const ARDUINO = 1771530423;

fetch("https://ap-southeast-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/data-duebb/auth/providers/anon-user/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => {
const accessToken = data.access_token;
console.log("Access Token:", accessToken);

const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer " + accessToken);

var reflowAuth = localStorage.getItem('reflowAuth');
var parsedReflowAuth = JSON.parse(reflowAuth);
var userId = parsedReflowAuth.profile.id;
const raw = JSON.stringify({
"dataSource": "Cluster0",
"database": "spark",
"collection": "user-data",
"filter": {
"user-id": userId
}
});

const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"};

fetch("https://ap-southeast-1.aws.data.mongodb-api.com/app/data-duebb/endpoint/data/v1/action/findOne", requestOptions)
.then((response) => response.text())
.then((result) => {
const parsedResult = JSON.parse(result);
const owned = parsedResult.document.owned;
if (!owned.includes(ARDUINO)) {
window.location.href = "./../../../../404.html";
console.log("Arduino");
}
})
.catch((error) => {
window.location.href = "./../../../../404.html";
});
})
.catch(() => {
window.location.href = "./../../../../404.html";
});
52 changes: 52 additions & 0 deletions assets/js/resourcesCheckDrawing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const PENCILS_SKETCHING = 2141514477;

fetch("https://ap-southeast-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/data-duebb/auth/providers/anon-user/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => {
const accessToken = data.access_token;
console.log("Access Token:", accessToken);

const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer " + accessToken);

var reflowAuth = localStorage.getItem('reflowAuth');
var parsedReflowAuth = JSON.parse(reflowAuth);
var userId = parsedReflowAuth.profile.id;
const raw = JSON.stringify({
"dataSource": "Cluster0",
"database": "spark",
"collection": "user-data",
"filter": {
"user-id": userId
}
});

const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"};

fetch("https://ap-southeast-1.aws.data.mongodb-api.com/app/data-duebb/endpoint/data/v1/action/findOne", requestOptions)
.then((response) => response.text())
.then((result) => {
const parsedResult = JSON.parse(result);
const owned = parsedResult.document.owned;
if (!owned.includes(PENCILS_SKETCHING)) {
window.location.href = "./../../../../404.html";
console.log("Pencils/Sketching");
}
})
.catch((error) => {

Check warning on line 46 in assets/js/resourcesCheckDrawing.js

View workflow job for this annotation

GitHub Actions / qodana

Unused local symbol

Unused parameter error
window.location.href = "./../../../../404.html";
});
})
.catch(() => {
window.location.href = "./../../../../404.html";
});
Loading

0 comments on commit 3e0d003

Please sign in to comment.