-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixes and changes
- Loading branch information
Showing
18 changed files
with
1,392 additions
and
388 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { | ||
$('#no-tuts').removeAttr('hidden'); | ||
}); | ||
}) | ||
.catch(() => { | ||
$('#no-tuts').removeAttr('hidden'); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { | ||
window.location.href = "./../../../../404.html"; | ||
}); | ||
}) | ||
.catch(() => { | ||
window.location.href = "./../../../../404.html"; | ||
}); |
Oops, something went wrong.