Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// If we don't have a session for the image hostname, create one.
var cached_uri = URI(api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()))
console.log("Attempting to load image from server-side cache...");
console.log("Loading image " + image.uri + " from server...");
var xhr = new XMLHttpRequest();
var api = "/file";
if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
api = "/file";
}
xhr.image = image;
xhr.open("GET", api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()), true);
xhr.responseType = "arraybuffer";
xhr.onload = function(e){
//If the image isn't in cache, open an agent session:
if (this.status == 404) {
if(!self.login_open)
{
self.login_open = true;
self.remotes.get_remote({
hostname: uri.hostname(),
title: "Login to " + uri.hostname(),
message: "Loading " + uri.pathname(),
cancel: function() {
var jFrame = $(".scaffolding." + image.image_class + "[data-uri=\"" + image.uri + "\"]");
var frame = d3.select(jFrame[0]);
var related_frames = jFrame.closest('.media-layer').children('.scaffolding').filter(function(_,x){ return URI($(x).attr("data-uri")).hostname() == uri.hostname(); });
}
// If we don't have a session for the image hostname, create one.
var cached_uri = URI(api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()))
console.log("Attempting to load image from server-side cache...");
console.log("Loading image " + image.uri + " from server...");
var xhr = new XMLHttpRequest();
var api = "/file";
if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
api = "/file";
}
xhr.image = image;
xhr.open("GET", api_root + "projects/" + self.options.model.project + "/cache/" + URI.encode(uri.host() + uri.path()), true);
xhr.responseType = "arraybuffer";
xhr.onload = function(e){
//If the image isn't in cache, open an agent session:
if (this.status == 404) {
if(!self.login_open)
{
self.login_open = true;
self.remotes.get_remote({
hostname: uri.hostname(),
title: "Login to " + uri.hostname(),
message: "Loading " + uri.pathname(),
cancel: function() {
var jFrame = $(".scaffolding." + image.image_class + "[data-uri=\"" + image.uri + "\"]");
var frame = d3.select(jFrame[0]);
var related_frames = jFrame.closest('.media-layer').children('.scaffolding').filter(function(_,x){ return URI($(x).attr("data-uri")).hostname() == uri.hostname(); });
var exportURL = function(e)
{
// Update song ranges
updateSongRanges();
var json = songToJSON(mSong, false);
var url = "" + new URI().fragment(URI.encode(LZString.compressToBase64(json)));
showUrlDialog(url);
return false;
};
success: function(hostname) {
var xhr = new XMLHttpRequest();
var api = "/file";
if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
api = "/file";
}
xhr.image = image;
//Double encode to avoid cherrypy's auto unencode in the controller
xhr.open("GET", api_root + "remotes/" + hostname + api + uri.pathname() + "?cache=project&project=" + self.options.model.project + "&key=" + URI.encode(URI.encode(uri.host() + uri.path())), true);
xhr.responseType = "arraybuffer";
xhr.onload = function(e) {
// If we get 404, the remote session no longer exists because it timed-out.
// If we get 500, there was an internal error communicating to the remote host.
// Either way, delete the cached session and create a new one.
if(this.status == 404 || this.status == 500) {
self.remotes.delete_remote(uri.hostname());
self._open_images(images);
return;
}
// If we get 400, it means that the session is good and we're
// communicating with the remote host, but something else went wrong
// (probably file permissions issues).
if(this.status == 400) {
var message = this.getResponseHeader("slycat-message");
var hint = this.getResponseHeader("slycat-hint");
success: function(hostname) {
var xhr = new XMLHttpRequest();
var api = "/file";
if(self.options.video_file_extensions.indexOf(uri.suffix()) > -1) {
api = "/file";
}
xhr.image = image;
//Double encode to avoid cherrypy's auto unencode in the controller
xhr.open("GET", api_root + "remotes/" + hostname + api + uri.pathname() + "?cache=project&project=" + self.options.model.project + "&key=" + URI.encode(URI.encode(uri.host() + uri.path())), true);
xhr.responseType = "arraybuffer";
xhr.onload = function(e) {
// If we get 404, the remote session no longer exists because it timed-out.
// If we get 500, there was an internal error communicating to the remote host.
// Either way, delete the cached session and create a new one.
if(this.status == 404 || this.status == 500) {
self.remotes.delete_remote(uri.hostname());
self._open_images(images);
return;
}
// If we get 400, it means that the session is good and we're
// communicating with the remote host, but something else went wrong
// (probably file permissions issues).
if(this.status == 400) {
var message = this.getResponseHeader("slycat-message");
var hint = this.getResponseHeader("slycat-hint");
render() {
const item = this.props.item;
return (
member.nameInCatalog)
.join(" → ")}
btnState={this.getState()}
onBtnClick={this.onBtnClicked}
// All things are "removable" - meaning add and remove from workbench,
// but only user data is "trashable"
trashable={this.props.removable}
onTrashClick={
this.props.removable
? () => {
this.onTrashClicked();
}
: undefined
}
<li>
<button title="Zoom to data" type="button">
Zoom To
</button>
</li>
<span>
<li>
About This Data
</li>
<span>
</span>
<li>
</li></span>