Chromium Code Reviews| Index: appengine/isolate/templates/browse.html |
| diff --git a/appengine/isolate/templates/browse.html b/appengine/isolate/templates/browse.html |
| index b79202d9f283c646d6032d1a8b337f48372a1dc3..3de55e45c1f80a034fdeff2067ae5f192ecbe1eb 100644 |
| --- a/appengine/isolate/templates/browse.html |
| +++ b/appengine/isolate/templates/browse.html |
| @@ -5,7 +5,7 @@ |
| {% block headers %} |
| <style> |
| html, body { |
| - height: 100%; |
| + height: 95%; |
| margin: 0; |
| width: 100%; |
| } |
| @@ -24,104 +24,12 @@ |
| overflow-y: hidden; |
| padding: 0; |
| width: 100%; |
| + min-height: 80%; |
| } |
| </style> |
| - |
| -{# |
| -TODO(maruel): Reenable once Web UI authentication is switched to OAuth2. |
| -<script type="text/javascript" src="third_party/pako/pako-0.2.3.min.js"> |
| -</script> |
| -<script> |
| - if (typeof String.prototype.endsWith !== 'function') { |
| - String.prototype.endsWith = function(suffix) { |
| - return this.indexOf(suffix, this.length - suffix.length) !== -1; |
| - }; |
| - } |
| - |
| - // Fetch the content, uncompress it if necessary, then write it to the iframe. |
| - function update() { |
| - var digest = encodeURIComponent(document.getElementById('digest').value); |
| - var namespace = encodeURIComponent( |
| - document.getElementById('namespace').value); |
| - var url = '/_ah/api/isolateservice/v1/retrieve'; |
| - fetch(url, namespace, digest); |
| - // TODO(maruel): Add back once endpoint API is rewritten. |
| - //document.getElementById('generated_link').innerHTML = ( |
| - // '<a href="' + url + '">Link to ' + digest + '</a>'); |
| - } |
| - |
| - function ab2str(buf) { |
| - return String.fromCharCode.apply(null, new Uint8Array(buf)); |
| - } |
| - |
| - function fetch(url, namespace, digest) { |
| - var xhr = new XMLHttpRequest(); |
| - // TODO(maruel): Change back to a HTTP GET once endpoint API is rewritten. |
| - xhr.open('POST', url, true); |
| - xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); |
| - var oauthToken = gapi.auth.getToken(); |
| - xhr.setRequestHeader('Authorization', 'Bearer ' + oauthToken.access_token); |
| - xhr.responseType = 'arraybuffer'; |
| - xhr.onload = function(e) { |
| - if (this.status == 200) { |
| - post_process_async( |
| - namespace, new Uint8Array(this.response), write_to_iframe); |
| - } else { |
| - alert(ab2str(this.response)); |
| - } |
| - }; |
| - xhr.send(JSON.stringify({namespace: {namespace:namespace}, digest: digest})); |
| - } |
| - |
| - function decompress_to_string_async(data, callback) { |
| - var bytes = pako.inflate(new Uint8Array(data)); |
| - var bb = new Blob([bytes]); |
| - var f = new FileReader(); |
| - f.onload = function(e) { |
| - callback(e.target.result); |
| - }; |
| - f.readAsText(bb); |
| - } |
| - |
| - function post_process_async(namespace, data, callback) { |
| - // Note that -gzip is a misnomer, it's actually -deflate. |
| - if (namespace.endsWith('-gzip') || namespace.endsWith('-deflate')) { |
| - decompress_to_string_async(data, function(x) { |
| - // Now act as if the namespace was the default uncompressed one so |
| - // further processing can be done. |
| - post_process_async('default', x, callback); |
| - }); |
| - return; |
| - } |
| - if (data[0] == 'P' && data[1] == 'K') { |
| - // TODO(maruel): Implement PKzip decoding to be able to list files? |
| - callback("Found a .zip file (" + data.length + " bytes)"); |
| - return; |
| - } |
| - if (data[0] == '{') { |
| - // Assume a json file, pretty-print it. |
| - // TODO(maruel): Convert .isolated files to browsable file. |
| - // TODO(maruel): Catch exception and print data as-is in that case. |
| - var pretty = JSON.stringify(JSON.parse(data), null, 2); |
| - callback(pretty); |
| - return; |
| - } |
| - // Fallback. |
| - callback(data); |
| - } |
| - |
| - function write_to_iframe(data) { |
| - var ifrm = document.getElementById('content').contentDocument; |
| - ifrm.open(); |
| - ifrm.write('<html><body><pre>' + data + '</pre></body></html>'); |
| - ifrm.close(); |
| - } |
| -</script> |
| -#} |
| {% endblock %} |
| - |
| {% block body %} |
| <h1>File browser</h1> |
| @@ -133,10 +41,9 @@ Enter the namespace and digest of an object:<br> |
| <br> |
| <input type=submit value="Load item"/><br> |
| </form> |
| -<p> |
| -<div id="generated_link"> </div> |
| -<p> |
| <hr> |
| -<div class="use_all_space monospace">{{content}}{# <iframe id="content" class="use_all_space" sandbox="allow-same-origin"></iframe>#}</div> |
| +<div id="iframe-entry"></div> |
| +<iframe id="content" class="use_all_space" sandbox="allow-same-origin allow-popups" src="content?namespace={{namespace}}&digest={{digest}}"> |
|
M-A Ruel
2016/04/14 14:05:06
src="/content?... ?
kjlubick
2016/04/14 14:57:37
Done.
|
| +</iframe> |
| {% endblock %} |