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

js-based view-source #106

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

js-based view-source #106

wants to merge 5 commits into from

Conversation

lrvick
Copy link
Member

@lrvick lrvick commented Oct 11, 2016

Do not merge, still some CSS issues to work out (can't scroll).

Overall implementation tested/works.

server.py Outdated
response.headers['X-Content-Type-Options'] = 'nosniff'
response.headers['X-Frame-Options'] = 'DENY'
response.headers['X-XSS-Protection'] = '1; mode=block'
response.headers['Access-Control-Allow-Origin'] = 'https://hashbang.sh/'
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

src/scripts.js Outdated
var link = document.createElement("link");
link.type = "image/png";
link.rel = "icon";
link.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAAA3iMLMAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAd2KE6QAAAAYSURBVAjXY2CAAck+EKp/B0II9gMoGwYA4+MJkeae/NUAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTQtMDUtMTdUMTM6MzI6MTMtMDQ6MDB7pieOAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE0LTA1LTE3VDEzOjMxOjQ4LTA0OjAwqyt+rwAAAABJRU5ErkJggg==";
Copy link
Member

Choose a reason for hiding this comment

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

If we are moving this around, can't we put it directly in the HTML?

src/scripts.js Outdated
sourceEl.removeAttribute("href");
sourceEl.onclick = function(){
var client = new XMLHttpRequest();
client.open('GET', 'http://localhost:8080/');
Copy link
Member

@KellerFuchs KellerFuchs Oct 11, 2016

Choose a reason for hiding this comment

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

NOPE, wrong URL.
(Also, would be forbidden by CSP)

Copy link
Member

@KellerFuchs KellerFuchs left a comment

Choose a reason for hiding this comment

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

@lrvick I implemented the changes I requested.
Please answer the question regarding the CORS header.

@RyanSquared Please review, since there are now commits I wrote in here.

@KellerFuchs KellerFuchs dismissed their stale review February 26, 2017 00:42

Changes implemented. One question left.

@KellerFuchs
Copy link
Member

Rebased atop the current master because of merge conflicts.

var client = new XMLHttpRequest();
client.open('GET', 'https://hashbang.sh/');
client.onreadystatechange = function() {
console.log(client.responseText)
Copy link
Member

Choose a reason for hiding this comment

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

debug log left over?

var sourceText = document.createTextNode(client.responseText)
div.appendChild(sourceText)
div.id = "source"
document.getElementsByTagName("html")[0].appendChild(div);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of document.getElementsByTagName("html")[0] why not use document.firstElementChild?
But also, shouldn't you be appending to document.body anyway?

@KellerFuchs KellerFuchs marked this pull request as draft May 8, 2023 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants