mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 18:13:29 +02:00
Merge pull request #7644 from birarda/sandbox-ds-settings
replace Sandbox default content set with Home
This commit is contained in:
commit
b0084926c0
5 changed files with 54 additions and 27 deletions
|
@ -195,6 +195,7 @@ void Agent::requestScript() {
|
|||
// then wait for the nodeConnected signal to fire off the request
|
||||
|
||||
auto assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||
|
||||
if (!assetServer || !assetServer->getActiveSocket()) {
|
||||
qDebug() << "Waiting to connect to Asset Server for ATP script download.";
|
||||
_pendingScriptRequest = request;
|
||||
|
@ -209,7 +210,7 @@ void Agent::requestScript() {
|
|||
}
|
||||
|
||||
void Agent::nodeActivated(SharedNodePointer activatedNode) {
|
||||
if (_pendingScriptRequest) {
|
||||
if (_pendingScriptRequest && activatedNode->getType() == NodeType::AssetServer) {
|
||||
qInfo() << "Requesting script at URL" << qPrintable(_pendingScriptRequest->getUrl().toString());
|
||||
|
||||
_pendingScriptRequest->send();
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
],
|
||||
"devDependencies": {
|
||||
"electron-compilers": "^1.0.1",
|
||||
"electron-packager": "^5.2.1",
|
||||
"electron-prebuilt": "0.35.4"
|
||||
"electron-packager": "^6.0.2",
|
||||
"electron-prebuilt": "0.37.5"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -30,9 +30,9 @@
|
|||
"fs-extra": "^0.26.4",
|
||||
"node-notifier": "^4.4.0",
|
||||
"os-homedir": "^1.0.1",
|
||||
"request": "2.67.0",
|
||||
"request": "^2.67.0",
|
||||
"request-progress": "1.0.2",
|
||||
"unzip": "0.1.11",
|
||||
"tar-fs": "^1.12.0",
|
||||
"yargs": "^3.30.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ var iconName = argv.production ? "console" : "console-beta";
|
|||
var options = {
|
||||
dir: __dirname,
|
||||
name: "server-console",
|
||||
version: "0.35.4",
|
||||
version: "0.37.5",
|
||||
overwrite: true,
|
||||
prune: true,
|
||||
arch: "x64",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</div>
|
||||
|
||||
<div id="state-installing" class="state">
|
||||
<h1>Installing<span class="one">.</span><span class="two">.</span><span class="three">.</span></h1>
|
||||
<h1>Extracting<span class="one">.</span><span class="two">.</span><span class="three">.</span></h1>
|
||||
<em>Just a moment</em>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ const path = require('path');
|
|||
const fs = require('fs-extra');
|
||||
const Tail = require('always-tail');
|
||||
const http = require('http');
|
||||
const unzip = require('unzip');
|
||||
const zlib = require('zlib');
|
||||
const tar = require('tar-fs');
|
||||
|
||||
const request = require('request');
|
||||
const progress = require('request-progress');
|
||||
|
@ -90,6 +91,10 @@ function getRootHifiDataDirectory() {
|
|||
}
|
||||
}
|
||||
|
||||
function getDomainServerClientResourcesDirectory() {
|
||||
return path.join(getRootHifiDataDirectory(), '/domain-server');
|
||||
}
|
||||
|
||||
function getAssignmentClientResourcesDirectory() {
|
||||
return path.join(getRootHifiDataDirectory(), '/assignment-client');
|
||||
}
|
||||
|
@ -477,18 +482,34 @@ function updateTrayMenu(serverState) {
|
|||
const httpStatusPort = 60332;
|
||||
|
||||
function maybeInstallDefaultContentSet(onComplete) {
|
||||
// Check for existing AC data
|
||||
// Check for existing data
|
||||
const acResourceDirectory = getAssignmentClientResourcesDirectory();
|
||||
|
||||
console.log("Checking for existence of " + acResourceDirectory);
|
||||
var userHasExistingServerData = true;
|
||||
|
||||
var userHasExistingACData = true;
|
||||
try {
|
||||
fs.accessSync(acResourceDirectory);
|
||||
console.log("Found directory " + acResourceDirectory);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
userHasExistingServerData = false;
|
||||
userHasExistingACData = false;
|
||||
}
|
||||
|
||||
if (userHasExistingServerData) {
|
||||
const dsResourceDirectory = getDomainServerClientResourcesDirectory();
|
||||
|
||||
console.log("checking for existence of " + dsResourceDirectory);
|
||||
|
||||
var userHasExistingDSData = true;
|
||||
try {
|
||||
fs.accessSync(dsResourceDirectory);
|
||||
console.log("Found directory " + dsResourceDirectory);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
userHasExistingDSData = false;
|
||||
}
|
||||
|
||||
if (userHasExistingACData || userHasExistingDSData) {
|
||||
console.log("User has existing data, suppressing downloader");
|
||||
onComplete();
|
||||
return;
|
||||
|
@ -514,16 +535,19 @@ function maybeInstallDefaultContentSet(onComplete) {
|
|||
|
||||
electron.ipcMain.on('ready', function() {
|
||||
console.log("got ready");
|
||||
var currentState = '';
|
||||
|
||||
function sendStateUpdate(state, args) {
|
||||
// console.log(state, window, args);
|
||||
window.webContents.send('update', { state: state, args: args });
|
||||
currentState = state;
|
||||
}
|
||||
|
||||
var aborted = false;
|
||||
|
||||
// Start downloading content set
|
||||
var req = progress(request.get({
|
||||
url: "https://s3.amazonaws.com/hifi-public/homeset/ContentSet-Lounge.zip"
|
||||
url: "http://cachefly.highfidelity.com/home.tgz"
|
||||
}, function(error, responseMessage, responseData) {
|
||||
if (aborted) {
|
||||
return;
|
||||
|
@ -537,33 +561,35 @@ function maybeInstallDefaultContentSet(onComplete) {
|
|||
sendStateUpdate('error', {
|
||||
message: message
|
||||
});
|
||||
} else {
|
||||
sendStateUpdate('installing');
|
||||
}
|
||||
}), { throttle: 250 }).on('progress', function(state) {
|
||||
if (!aborted) {
|
||||
// Update progress popup
|
||||
sendStateUpdate('downloading', state);
|
||||
}
|
||||
}).on('end', function(){
|
||||
sendStateUpdate('installing');
|
||||
});
|
||||
var unzipper = unzip.Extract({
|
||||
path: acResourceDirectory,
|
||||
verbose: true
|
||||
});
|
||||
unzipper.on('close', function() {
|
||||
console.log("Done", arguments);
|
||||
sendStateUpdate('complete');
|
||||
});
|
||||
unzipper.on('error', function (err) {
|
||||
console.log("aborting");
|
||||
|
||||
function extractError(err) {
|
||||
console.log("Aborting request because gunzip/untar failed");
|
||||
aborted = true;
|
||||
req.abort();
|
||||
console.log("ERROR");
|
||||
console.log("ERROR" + err);
|
||||
|
||||
sendStateUpdate('error', {
|
||||
message: "Error installing resources."
|
||||
});
|
||||
}
|
||||
|
||||
var gunzip = zlib.createGunzip();
|
||||
gunzip.on('error', extractError);
|
||||
|
||||
req.pipe(gunzip).pipe(tar.extract(getRootHifiDataDirectory())).on('error', extractError).on('finish', function(){
|
||||
// response and decompression complete, return
|
||||
console.log("Finished unarchiving home content set");
|
||||
sendStateUpdate('complete');
|
||||
});
|
||||
req.pipe(unzipper);
|
||||
|
||||
window.on('closed', function() {
|
||||
if (currentState == 'downloading') {
|
||||
|
|
Loading…
Reference in a new issue