Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[brainbrowser] Fully remove ajax directory #7824

Merged
merged 12 commits into from
Jan 20, 2022

Conversation

driusan
Copy link
Collaborator

@driusan driusan commented Nov 11, 2021

This updates brainbrowser in LORIS to get rid of the ajax directory.
In doing so, it also updates the architecture to be somewhat more
sane.

Previously, a request would be made from javascript to an ajax script
which takes a FileID and returns the raw file content with some metadata
in HTTP headers. This request would be made once per file to be displayed in BrainBrowser. The body of the request would then be discarded, and the
same endpoint would be passed to brainbrowser. Brainbrowser would download
the file content a second time, and after all files were re-downloaded
display the volume viewer.

In the new architecture, an imageinfo endpoint is added which returns
the metadata in JSON format. Included in the information in the response
is a URL which can be passed to brainbrowser to download the raw file
data. The LORIS API is used for imaging browser files, and a new endpoint
is added to the mri_violations module for files which can not be accessed
through the API.

The end result is that the ajax directory is no longer used by brainbrowser,
the API is used to download files, and more access checking is
done on accessing mri violations files.

Copy link
Collaborator

@cmadjar cmadjar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work for me. I get the following error with an infinite loop:
Screen Shot 2022-01-18 at 12 02 25 PM

This removes the getImageName script from the brainbrowser module.

The script's only purpose is to return a file's filename, given the
FileID after image.php retrieves the file. However, image.php
already looks up the filename. image.php passes the FileID in an X-FileID
header, so this extends that to add an X-Filename header to pass the
name as well as the ID. This is cached in an object and used to update
the file template after the volumes are downloaded.
This fixes an issue where image data is downloaded twice by
BrainBrowser. The brainbrowser.loris.js file makes a request to
image.php to get metadata for the file from http headers, and then passes
the URL to brainbrowser which makes a separate data.

Replace the GET request with a HEAD request from the LORIS side so
that only brainbrowser downloads the data.

Resolves aces#7805
This updates brainbrowser in LORIS to get rid of the ajax directory.
In doing so, it also updates the architecture to be somewhat more
sane.

Previously, a request would be made from javascript to an ajax script
which takes a FileID and returns the raw file content with some metadata
in HTTP headers. This request would be made once per file to be displayed in BrainBrowser. The body of the request would then be discarded, and the
same endpoint would be passed to brainbrowser. Brainbrowser would download
the file content a second time, and after all files were re-downloaded
display the volume viewer.

In the new architecture, an imageinfo endpoint is added which returns
the metadata in JSON format. Included in the information in the response
is a URL which can be passed to brainbrowser to download the raw file
data. The LORIS API is used for imaging browser files, and a new endpoint
is added to the mri_violations module for files which can not be accessed
through the API.

The end result is that the ajax directory is no longer used by brainbrowser,
the API is used to download files, and some more access checking is
done on accessing mri violations files.
@driusan
Copy link
Collaborator Author

driusan commented Jan 19, 2022

@cmadjar I think I managed to reproduce and fix this problem, can you try again?

@cmadjar cmadjar added the Passed Manual Tests PR has undergone proper testing by at least one peer label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Manual Tests PR has undergone proper testing by at least one peer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants