66 lines
2.2 KiB
JavaScript
66 lines
2.2 KiB
JavaScript
|
|
(function() {
|
|
// Every great app starts with a great name (keep it short so that it can fit in the tablet button)
|
|
|
|
// Get some domain data
|
|
DomainInfoFetch();
|
|
|
|
function DomainInfoFetch() {
|
|
|
|
var USER_STORIES_API_URL = Account.metaverseServerURL + '/api/v1/user_stories';
|
|
var request = Script.require('./request.js').request;
|
|
|
|
var MAX_DOMAINS = 1;
|
|
var PROTOCOL = {
|
|
// Q: should this be updated???
|
|
RC65: "jWMeM1PU6wCJjCiLLERaWQ%3D%3D",
|
|
RC66: "Fah%2FlDA1xHOxUYlVAWsiFQ%3D%3D",
|
|
CURRENT: encodeURIComponent(Window.protocolSignature())
|
|
};
|
|
|
|
var DOMAIN_RESTRICTIONS = 'open,hifi';
|
|
var ENCODED_PROTOCOL = PROTOCOL.CURRENT;
|
|
|
|
log("test request");
|
|
|
|
request(USER_STORIES_API_URL + '?now=' + (new Date()).toISOString() +
|
|
'&include_actions=concurrency&restriction=' + DOMAIN_RESTRICTIONS + '&require_online=true' +
|
|
'&protocol=' + ENCODED_PROTOCOL + '&page=1&per_page=' + MAX_DOMAINS, function (error, data) {
|
|
|
|
log("request sent");
|
|
|
|
var counter = 0;
|
|
|
|
data.user_stories.forEach(function(userStory) {
|
|
counter++;
|
|
// if (SKIP_OWN_DOMAIN && Uuid.isEqual(location.domainID, userStory.domain_id)) {
|
|
|
|
// return;
|
|
// }
|
|
|
|
console.log("domain info is:", JSON.stringify(userStory));
|
|
log('Found domain ' + counter );
|
|
log('Domain INFO: ' + userStory.domain_id);
|
|
|
|
}); // end forEach
|
|
}); // end call
|
|
|
|
log("test request complete");
|
|
|
|
} // end main function
|
|
|
|
// ===========================================================================================
|
|
// @function - debug logging
|
|
function log() {
|
|
print('DEBUG | ' + [].slice.call(arguments).join(' '));
|
|
}
|
|
|
|
// Provide a way to "uninstall" the app
|
|
// Here, we write a function called "cleanup" which gets executed when
|
|
// this script stops running. It'll remove the app button from the tablet.
|
|
// function cleanup() {
|
|
// tablet.removeButton(button);
|
|
// }
|
|
|
|
// Script.scriptEnding.connect(cleanup);
|
|
}());
|