mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-05 16:58:01 +00:00
Begin work on offline vault client tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var request = require('superagent');
|
||||
var superagent = require('superagent');
|
||||
|
||||
function RippleTxt() {
|
||||
this.txts = { };
|
||||
@@ -13,6 +13,14 @@ RippleTxt.urlTemplates = [
|
||||
'http://{{domain}}/ripple.txt'
|
||||
];
|
||||
|
||||
RippleTxt.request = function() {
|
||||
return request;
|
||||
};
|
||||
|
||||
RippleTxt.prototype.request = function(url, callback) {
|
||||
return superagent.get(url, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the ripple.txt file for the given domain
|
||||
*
|
||||
@@ -36,7 +44,7 @@ RippleTxt.prototype.get = function(domain, fn) {
|
||||
|
||||
url = url.replace('{{domain}}', domain);
|
||||
|
||||
request.get(url, function(err, resp) {
|
||||
self.request(url, function(err, resp) {
|
||||
if (err || !resp.text) {
|
||||
return nextUrl(++i);
|
||||
}
|
||||
@@ -67,7 +75,7 @@ RippleTxt.prototype.parse = function(txt) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line[0] === '[' && line[line.length-1] === ']') {
|
||||
if (line[0] === '[' && line[line.length - 1] === ']') {
|
||||
currentSection = line.slice(1, line.length - 1);
|
||||
sections[currentSection] = [];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user