mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 15:29:42 +02:00
Merge branch '404DomainRedirect' of https://github.com/wayne-chen/hifi into interstitalMerged
This commit is contained in:
commit
7721cba483
8 changed files with 43 additions and 2 deletions
BIN
interface/resources/meshes/redirect/oopsDialog_auth.fbx
Normal file
BIN
interface/resources/meshes/redirect/oopsDialog_auth.fbx
Normal file
Binary file not shown.
BIN
interface/resources/meshes/redirect/oopsDialog_auth.png
Normal file
BIN
interface/resources/meshes/redirect/oopsDialog_auth.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
BIN
interface/resources/meshes/redirect/oopsDialog_protocol.fbx
Normal file
BIN
interface/resources/meshes/redirect/oopsDialog_protocol.fbx
Normal file
Binary file not shown.
BIN
interface/resources/meshes/redirect/oopsDialog_protocol.png
Normal file
BIN
interface/resources/meshes/redirect/oopsDialog_protocol.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
interface/resources/meshes/redirect/oopsDialog_vague.fbx
Normal file
BIN
interface/resources/meshes/redirect/oopsDialog_vague.fbx
Normal file
Binary file not shown.
BIN
interface/resources/meshes/redirect/oopsDialog_vague.png
Normal file
BIN
interface/resources/meshes/redirect/oopsDialog_vague.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5 KiB |
|
@ -625,7 +625,7 @@
|
||||||
"lastEdited": 1536108160862286,
|
"lastEdited": 1536108160862286,
|
||||||
"lastEditedBy": "{4656d4a8-5e61-4230-ab34-2888d7945bd6}",
|
"lastEditedBy": "{4656d4a8-5e61-4230-ab34-2888d7945bd6}",
|
||||||
"locked": true,
|
"locked": true,
|
||||||
"modelURL": "http://hifi-content.s3.amazonaws.com/wayne/models/oopsDialog_protocol.fbx",
|
"modelURL": Script.resourcesPath() + "meshes/redirect/oopsDialog_protocol.fbx",
|
||||||
"name": "Oops Dialog",
|
"name": "Oops Dialog",
|
||||||
"owningAvatarID": "{00000000-0000-0000-0000-000000000000}",
|
"owningAvatarID": "{00000000-0000-0000-0000-000000000000}",
|
||||||
"position": {
|
"position": {
|
||||||
|
@ -648,7 +648,7 @@
|
||||||
"y": 0.4957197904586792,
|
"y": 0.4957197904586792,
|
||||||
"z": -7.62939453125e-05
|
"z": -7.62939453125e-05
|
||||||
},
|
},
|
||||||
"script": "https://hifi-content.s3.amazonaws.com/wayne/404redirectionScripts/oopsEntityScript.js",
|
"script": "https://raw.githubusercontent.com/wayne-chen/hifi/404DomainRedirect/scripts/system/oopsEntityScript.js",
|
||||||
"scriptTimestamp": 1536102551825,
|
"scriptTimestamp": 1536102551825,
|
||||||
"type": "Model",
|
"type": "Model",
|
||||||
"userData": "{\"grabbableKey\":{\"grabbable\":false}}"
|
"userData": "{\"grabbableKey\":{\"grabbable\":false}}"
|
||||||
|
|
41
scripts/system/oopsEntityScript.js
Normal file
41
scripts/system/oopsEntityScript.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
(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