mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 09:54:14 +02:00
Merge branch '404DomainRedirect' of https://github.com/wayne-chen/hifi into interstitalMerged
This commit is contained in:
commit
ebedbabace
2 changed files with 2 additions and 43 deletions
|
@ -625,7 +625,7 @@
|
|||
"lastEdited": 1536108160862286,
|
||||
"lastEditedBy": "{4656d4a8-5e61-4230-ab34-2888d7945bd6}",
|
||||
"locked": true,
|
||||
"modelURL": "https://raw.githubusercontent.com/wayne-chen/hifi/interstitalMerged/interface/resources/meshes/redirect/oopsDialog_protocol.fbx",
|
||||
"modelURL": "",
|
||||
"name": "Oops Dialog",
|
||||
"owningAvatarID": "{00000000-0000-0000-0000-000000000000}",
|
||||
"position": {
|
||||
|
@ -648,7 +648,7 @@
|
|||
"y": 0.4957197904586792,
|
||||
"z": -7.62939453125e-05
|
||||
},
|
||||
"script": "https://raw.githubusercontent.com/wayne-chen/hifi/interstitalMerged/scripts/system/oopsEntityScript.js",
|
||||
"script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/oopsEntityScript.js",
|
||||
"scriptTimestamp": 1536102551825,
|
||||
"type": "Model",
|
||||
"userData": "{\"grabbableKey\":{\"grabbable\":false}}"
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
(function() {
|
||||
var PROTOCOL_MISMATCH = 1;
|
||||
var NOT_AUTHORIZED = 3;
|
||||
|
||||
this.entityID = Uuid.NULL;
|
||||
this.preload = function(entityID) {
|
||||
this.entityID = entityID;
|
||||
};
|
||||
function pingError() {
|
||||
if(this.entityID === undefined) {
|
||||
var entities = Entities.findEntitiesByName("Oops Dialog", MyAvatar.position, 10);
|
||||
if(entities.length > 0) {
|
||||
this.entityID = entities[0];
|
||||
}
|
||||
}
|
||||
var error = location.lastDomainConnectionError;
|
||||
var newModel = "";
|
||||
var hostedSite = Script.resourcesPath() + "meshes/redirect";
|
||||
if (error === PROTOCOL_MISMATCH) {
|
||||
newModel = "oopsDialog_protocol";
|
||||
} else if (error === NOT_AUTHORIZED) {
|
||||
newModel = "oopsDialog_auth";
|
||||
} else {
|
||||
newModel = "oopsDialog_vague";
|
||||
}
|
||||
var props = Entities.getEntityProperties(this.entityID, ["modelURL"]);
|
||||
var newModelURL = hostedSite + newModel + ".fbx";
|
||||
if(props.modelURL !== newModelURL) {
|
||||
var newFileURL = newModelURL + "/" + newModel + ".png";
|
||||
var newTextures = {"file16": newFileURL, "file17": newFileURL};
|
||||
Entities.editEntity(this.entityID, {modelURL: newModelURL, originalTextures: JSON.stringify(newTextures)});
|
||||
}
|
||||
};
|
||||
var ping = Script.setInterval(pingError, 5000);
|
||||
|
||||
function cleanup() {
|
||||
Script.clearInterval(ping);
|
||||
};
|
||||
|
||||
Script.scriptEnding.connect(cleanup);
|
||||
});
|
Loading…
Reference in a new issue