mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 04:05:49 +00:00
Remove unused ripple-txt-validator files
This commit is contained in:
@@ -1,17 +0,0 @@
|
|||||||
input#domain {
|
|
||||||
padding: 10px 20px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-title {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.red {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.green {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
function VerificationError(message, tips) {
|
|
||||||
this.name = "VerificationError";
|
|
||||||
this.message = message || "";
|
|
||||||
this.tips = tips || "";
|
|
||||||
}
|
|
||||||
VerificationError.prototype = Error.prototype;
|
|
||||||
|
|
||||||
function makeLogEntry(text) {
|
|
||||||
var log = $('<li></li>').text(text).appendTo('#log');
|
|
||||||
log.resolve = function(text) {
|
|
||||||
return $('<span></span>').html(text).appendTo(log);
|
|
||||||
};
|
|
||||||
return log;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#domain-entry').submit(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var domain = $('#domain').val(),
|
|
||||||
txtdata;
|
|
||||||
|
|
||||||
$('.result-title').show();
|
|
||||||
$('#result').show();
|
|
||||||
$('#log').empty();
|
|
||||||
|
|
||||||
async.waterfall([
|
|
||||||
function(callback) {
|
|
||||||
var urls = [
|
|
||||||
//'http://www.'+domain+'/ripple.txt',
|
|
||||||
'https://www.' + domain + '/ripple.txt',
|
|
||||||
//'http://'+domain+'/ripple.txt',
|
|
||||||
'https://' + domain + '/ripple.txt',
|
|
||||||
'https://ripple.' + domain + '/ripple.txt'
|
|
||||||
].reverse();
|
|
||||||
|
|
||||||
function next(xhr, status) {
|
|
||||||
if (this instanceof $) {
|
|
||||||
var err;
|
|
||||||
switch (status) {
|
|
||||||
case 'timeout':
|
|
||||||
err = 'TIMEOUT';
|
|
||||||
break;
|
|
||||||
case 'abort':
|
|
||||||
err = 'ABORTED';
|
|
||||||
break;
|
|
||||||
case 'error':
|
|
||||||
err = 'ERROR';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
err = 'UNKNOWN';
|
|
||||||
}
|
|
||||||
$('<span></span>').text(err).addClass('red').appendTo(this);
|
|
||||||
}
|
|
||||||
if (!urls.length) {
|
|
||||||
var tips = 'Check if the file is actually hosted at one of the URLs above and make sure your server provides the required <a href="https://ripple.com/wiki/Ripple.txt#Publishing_ripple.txt">CORS header.</a>';
|
|
||||||
callback(new VerificationError('No ripple.txt found!', tips));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var url = urls.pop();
|
|
||||||
var log = makeLogEntry('Checking ' + url + '...');
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
dataType: 'text',
|
|
||||||
success: function(data) {
|
|
||||||
$('<span></span>').text('FOUND').addClass('green').appendTo(log);
|
|
||||||
txtdata = data;
|
|
||||||
callback();
|
|
||||||
},
|
|
||||||
error: $.proxy(next, log)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
},
|
|
||||||
function() {
|
|
||||||
txtdata = txtdata.replace('\r\n', '\n');
|
|
||||||
txtdata = txtdata.replace('\r', '\n');
|
|
||||||
txtdata = txtdata.split('\n');
|
|
||||||
|
|
||||||
var currentSection = "",
|
|
||||||
sections = {};
|
|
||||||
for (var i = 0, l = txtdata.length; i < l; i++) {
|
|
||||||
var line = txtdata[i].replace(/^\s+|\s+$/g, '');
|
|
||||||
if (!line.length || line[0] === '#') {
|
|
||||||
continue;
|
|
||||||
} else if (line[0] === '[' && line[line.length - 1] === ']') {
|
|
||||||
currentSection = line.slice(1, line.length - 1);
|
|
||||||
sections[currentSection] = [];
|
|
||||||
} else {
|
|
||||||
line = line.replace(/^\s+|\s+$/g, '');
|
|
||||||
if (sections[currentSection]) {
|
|
||||||
sections[currentSection].push(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var log;
|
|
||||||
|
|
||||||
log = makeLogEntry('Domain should match [domain]...');
|
|
||||||
if (sections.domain && sections.domain.length && sections.domain[0] === domain) {
|
|
||||||
log.resolve('VALID').addClass('green');
|
|
||||||
} else if (sections.domain && sections.domain.length) {
|
|
||||||
log.resolve('MISMATCH').addClass('red');
|
|
||||||
} else {
|
|
||||||
log.resolve('MISSING').addClass('red');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
], function(err, result) {
|
|
||||||
if (err instanceof VerificationError) {
|
|
||||||
var log = makeLogEntry("");
|
|
||||||
log.resolve(err.message).addClass('red');
|
|
||||||
$('<br>').appendTo(log);
|
|
||||||
$('<p></p>').html(err.tips).appendTo(log);
|
|
||||||
} else if (err) {
|
|
||||||
makeLogEntry(err).addClass('red');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{% extends "template-base.html" %}
|
|
||||||
|
|
||||||
{% block main %}
|
|
||||||
<section class="container-fluid pt-3 p-md-3">
|
|
||||||
<h1>ripple.txt Validator</h1>
|
|
||||||
|
|
||||||
<p>If you run a business that connects to the XRP Ledger, serving a <code>ripple.txt</code> file from your domain can help clarify which XRP Ledger addresses you own and use, and which validating server(s) you run.</p>
|
|
||||||
|
|
||||||
<p>This tool allows you to verify that your ripple.txt is syntactically
|
|
||||||
correct and deployed properly.</p><br/>
|
|
||||||
<form id="domain-entry">
|
|
||||||
<fieldset>
|
|
||||||
<input id="domain" type="text" required
|
|
||||||
placeholder="example.com (Domain name to check)"
|
|
||||||
pattern="^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$"><br>
|
|
||||||
<button class="btn btn-primary">Verify ripple.txt</button>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
<div id="result">
|
|
||||||
<h5 class='result-title'>Result</h5>
|
|
||||||
<ul id="log">
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block endbody %}
|
|
||||||
<link rel='stylesheet' type='text/css' href='assets/css/ripple-txt-validator.css' />
|
|
||||||
<script type='text/javascript' src='assets/vendor/async.min.js'></script>
|
|
||||||
<script type='text/javascript' src='assets/js/ripple-txt-validator.js'></script>
|
|
||||||
{% endblock %}
|
|
||||||
Reference in New Issue
Block a user