Prettified

This commit is contained in:
mbhandary
2020-04-03 18:35:34 -04:00
parent 0f7bab354f
commit bca8cb9d4b

View File

@@ -24,7 +24,7 @@ function makeLogEntry(text, raw) {
.text(text + " ") .text(text + " ")
.appendTo("#log"); .appendTo("#log");
} }
log.resolve = function(text) { log.resolve = function (text) {
return $("<span></span>") return $("<span></span>")
.html(text) .html(text)
.appendTo(log); .appendTo(log);
@@ -100,8 +100,8 @@ async function parse_xrpl_toml(data, public_key_hex, public_key, message) {
function display_manifest(man) { function display_manifest(man) {
for (x in man){ for (x in man) {
log = makeLogEntry(x + ": " +man[x]); log = makeLogEntry(x + ": " + man[x]);
} }
} }
@@ -122,11 +122,7 @@ function parse_manifest() {
return; return;
} }
let seq = man["Sequence"];
let seq = man ["Sequence"];
let public_key_hex = man["PublicKey"]; let public_key_hex = man["PublicKey"];
let buff_pub = new Buffer(public_key_hex, "hex").toJSON().data; let buff_pub = new Buffer(public_key_hex, "hex").toJSON().data;
@@ -136,25 +132,26 @@ function parse_manifest() {
let buff_eph_pub = new Buffer(ephemeral_public_key_hex, "hex").toJSON().data; let buff_eph_pub = new Buffer(ephemeral_public_key_hex, "hex").toJSON().data;
let ephemeral_public_key = addressCodec.encodeNodePublic(buff_eph_pub); let ephemeral_public_key = addressCodec.encodeNodePublic(buff_eph_pub);
try { try {
var domain = hex_to_ascii(man["Domain"]); var domain = hex_to_ascii(man["Domain"]);
} catch { } catch {
makeLogEntry("Domain not found in manifest").addClass(CLASS_BAD); makeLogEntry("Domain not found in manifest").addClass(CLASS_BAD);
display_manifest({"Sequence":seq, display_manifest({
"Sequence": seq,
"Master Public Key": public_key, "Master Public Key": public_key,
"Ephemeral Public Key":ephemeral_public_key}); "Ephemeral Public Key": ephemeral_public_key
});
return; return;
} }
display_manifest({"Sequence":seq, display_manifest({
"Domain":domain, "Sequence": seq,
"Domain": domain,
"Master Public Key": public_key, "Master Public Key": public_key,
"Ephemeral Public Key":ephemeral_public_key}) "Ephemeral Public Key": ephemeral_public_key
})
@@ -167,11 +164,11 @@ function parse_manifest() {
$.ajax({ $.ajax({
url: url, url: url,
dataType: "text", dataType: "text",
success: function(data) { success: function (data) {
log.resolve("FOUND").addClass(CLASS_GOOD); log.resolve("FOUND").addClass(CLASS_GOOD);
parse_xrpl_toml(data, public_key_hex, public_key, message); parse_xrpl_toml(data, public_key_hex, public_key, message);
}, },
error: function(jqxhr, status, error) { error: function (jqxhr, status, error) {
switch (status) { switch (status) {
case "timeout": case "timeout":
err = "TIMEOUT"; err = "TIMEOUT";
@@ -229,4 +226,3 @@ function handle_submit(event) {
$(document).ready(() => { $(document).ready(() => {
$("#manifest-entry").submit(handle_submit); $("#manifest-entry").submit(handle_submit);
}); });