Merged upstream master

This commit is contained in:
n1474335 2017-03-27 18:41:23 +01:00
commit 559e32a16a
10 changed files with 70 additions and 169 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -131,6 +131,10 @@ const FlowControl = {
jumpNum = ings[0],
maxJumps = ings[1];
if (jumpNum < 0) {
jumpNum--;
}
if (state.numJumps >= maxJumps) {
return state;
}
@ -158,6 +162,10 @@ const FlowControl = {
jumpNum = ings[1],
maxJumps = ings[2];
if (jumpNum < 0) {
jumpNum--;
}
if (state.numJumps >= maxJumps) {
return state;
}

View file

@ -1029,20 +1029,37 @@ const Utils = {
};
var formatFile = function(file, i) {
var blob = new Blob(
[new Uint8Array(file.bytes)],
{type: "octet/stream"}
);
var blobUrl = URL.createObjectURL(blob);
var downloadAnchorElem = "<a href='" + blobUrl + "' " +
"title='Download " + Utils.escapeHtml(file.fileName) + "' " +
"download='" + Utils.escapeHtml(file.fileName) + "'>\u21B4</a>";
var expandFileContentsElem = "<a href='#collapse" + i + "' " +
"class='collapsed' " +
"data-toggle='collapse' " +
"aria-expanded='true' " +
"aria-controls='collapse" + i + "' " +
"title=\"Show/hide contents of '" + Utils.escapeHtml(file.fileName) + "'\">&#x1F50D</a>";
var html = "<div class='panel panel-default'>" +
"<div class='panel-heading' role='tab' id='heading" + i + "'>" +
"<h4 class='panel-title'>" +
"<a class='collapsed' role='button' data-toggle='collapse' " +
"href='#collapse" + i + "' " +
"aria-expanded='true' aria-controls='collapse" + i +"'>" +
file.fileName +
"<div>" +
Utils.escapeHtml(file.fileName) +
" " + expandFileContentsElem +
" " + downloadAnchorElem +
"<span class='pull-right'>" +
// These are for formatting when stripping HTML
"<span style='display: none'>\n</span>" +
file.size.toLocaleString() + " bytes" +
"<span style='display: none'>\n</span>" +
"</span>" +
"</a>" +
"</div>" +
"</h4>" +
"</div>" +
"<div id='collapse" + i + "' class='panel-collapse collapse' " +

View file

@ -34,6 +34,7 @@ const Base64 = {
{name: "Xxencoding: +-0-9A-Za-z", value: "+\\-0-9A-Za-z"},
{name: "BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r", value: "!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},
{name: "ROT13: N-ZA-Mn-za-m0-9+/=", value: "N-ZA-Mn-za-m0-9+/="},
{name: "UNIX crypt: ./0-9A-Za-z", value: "./0-9A-Za-z"},
],
/**
@ -105,7 +106,7 @@ const Base64 = {
enc3 = (chr2 >> 1) & 31;
enc4 = ((chr2 & 1) << 4) | (chr3 >> 4);
enc5 = ((chr3 & 15) << 1) | (chr4 >> 7);
enc6 = (chr4 >> 2) & 63;
enc6 = (chr4 >> 2) & 31;
enc7 = ((chr4 & 3) << 3) | (chr5 >> 5);
enc8 = chr5 & 31;

View file

@ -327,9 +327,8 @@ const Compress = {
files = [];
filenames.forEach(function(fileName) {
var contents = unzip.decompress(fileName);
contents = Utils.byteArrayToUtf8(contents);
var bytes = unzip.decompress(fileName);
var contents = Utils.byteArrayToUtf8(bytes);
var file = {
fileName: fileName,
@ -338,6 +337,7 @@ const Compress = {
var isDir = contents.length === 0 && fileName.endsWith("/");
if (!isDir) {
file.bytes = bytes;
file.contents = contents;
}
@ -495,6 +495,13 @@ const Compress = {
this.position = 0;
};
Stream.prototype.getBytes = function(bytesToGet) {
var newPosition = this.position + bytesToGet;
var bytes = this.bytes.slice(this.position, newPosition);
this.position = newPosition;
return bytes;
};
Stream.prototype.readString = function(numBytes) {
var result = "";
for (var i = this.position; i < this.position + numBytes; i++) {
@ -553,11 +560,9 @@ const Compress = {
endPosition += 512 - (file.size % 512);
}
file.contents = "";
while (stream.position < endPosition) {
file.contents += stream.readString(512);
}
file.bytes = stream.getBytes(file.size);
file.contents = Utils.byteArrayToUtf8(file.bytes);
stream.position = endPosition;
} else if (file.type === "5") {
// Directory
files.push(file);

View file

@ -20,8 +20,8 @@ const HTTP = {
* @returns {string}
*/
runStripHeaders: function(input, args) {
var headerEnd = input.indexOf("\r\n\r\n") +
(headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
var headerEnd = input.indexOf("\r\n\r\n");
headerEnd = (headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
return (headerEnd < 2) ? input : input.slice(headerEnd, input.length);
},

View file

@ -212,6 +212,22 @@ const IP = {
output += "\nThis is a reserved multicast address.";
output += "\nMulticast addresses range: ff00::/8";
}
// Detect possible EUI-64 addresses
if ((ipv6[5] & 0xff === 0xff) && (ipv6[6] >>> 8 === 0xfe)) {
output += "\n\nThis IPv6 address contains a modified EUI-64 address, identified by the presence of FF:FE in the 12th and 13th octets.";
var intIdent = Utils.hex(ipv6[4] >>> 8) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[5] & 0xff) + ":" +
Utils.hex(ipv6[6] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff),
mac = Utils.hex((ipv6[4] >>> 8) ^ 2) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff);
output += "\nInterface identifier: " + intIdent +
"\nMAC address: " + mac;
}
} else {
return "Invalid IPv6 address";
}

View file

@ -1,9 +1,9 @@
129 source files
49149 lines
128 source files
49196 lines
1.9M size
63 JavaScript source files
20966 lines
21013 lines
788K size
uncompressed JavaScript size