Skip to content

Commit fcefb34

Browse files
committed
domain data added
1 parent 099b8a0 commit fcefb34

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
./node_modules/*
2+
package-lock.json
3+
node_modules

index.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"use strict";
2+
3+
var metafetch = require('metafetch');
4+
var request = require('request');
5+
6+
var DomainVerifaction = (function() {
7+
8+
9+
var htmlVerification = function(domain_url,domain_value,domain_html_name,hash_value,callback) {
10+
if(arguments.length == 5)
11+
{
12+
var url = domain_url+'/'+domain_html_name+'-'+domain_value+'.html';
13+
var options = {
14+
method: 'GET',
15+
url: url
16+
}
17+
request(options,function(error,response,body){
18+
if(error)
19+
{
20+
callback(null,false);
21+
} else { console.log('hash_value',hash_value);
22+
console.log('body',body);
23+
if(parseInt(hash_value) == parseInt(body))
24+
{
25+
callback(null,true);
26+
} else {
27+
callback(null,false);
28+
}
29+
}
30+
})
31+
} else {
32+
callback('Mismatch arguments',null);
33+
}
34+
}
35+
36+
var txtVerification = function() {
37+
console.log('This is a method I want to expose!');
38+
}
39+
40+
var metaTagVerification = function(domain_url,domain_key,domain_value,callback) {
41+
if(arguments.length == 4)
42+
{
43+
metafetch.fetch(domain_url,function(err,result){
44+
if(err)
45+
{
46+
callback(false,null);
47+
} else {
48+
var checkKey = result.meta[domain_key];
49+
if( checkKey != undefined)
50+
{
51+
if(checkKey === domain_value)
52+
{
53+
callback(null,true);
54+
} else {
55+
callback(null,false);
56+
}
57+
} else {
58+
callback(null,false);
59+
}
60+
61+
62+
}
63+
})
64+
} else {
65+
callback('Mismatch arguments',null);
66+
}
67+
}
68+
69+
return {
70+
html: htmlVerification,
71+
txt: txtVerification,
72+
metatag: metaTagVerification
73+
};
74+
75+
})();
76+
77+
module.exports = DomainVerifaction;

package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "domain-verification",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/SpringRole/domain-verification.git"
12+
},
13+
"dependencies": {
14+
"metafetch": "^1.8.1",
15+
"request": "^2.87.0"
16+
},
17+
"author": "Rupam Biswal <[email protected]>",
18+
"license": "MIT",
19+
"keywords": [
20+
"metadata",
21+
"meta",
22+
"tags",
23+
"html",
24+
"parser",
25+
"txt",
26+
"open graph"
27+
],
28+
"bugs": {
29+
"url": "https://github.com/SpringRole/domain-verification/issues"
30+
},
31+
"homepage": "https://github.com/SpringRole/domain-verification#readme"
32+
}

0 commit comments

Comments
 (0)