diff --git a/bitcore-node/index.js b/bitcore-node/index.js
new file mode 100644
index 0000000..2d6db13
--- /dev/null
+++ b/bitcore-node/index.js
@@ -0,0 +1,42 @@
+'use strict';
+
+var BaseService = require('./service');
+var inherits = require('util').inherits;
+var fs = require('fs');
+
+var InsightUI = function(options) {
+ BaseService.call(this, options);
+};
+
+InsightUI.dependencies = ['insight-api'];
+
+inherits(InsightUI, BaseService);
+
+InsightUI.prototype.start = function(callback) {
+ this.indexFile = this.filterIndexHTML(fs.readFileSync(__dirname + '/../public/index.html', {encoding: 'utf8'}));
+ setImmediate(callback);
+};
+
+InsightUI.prototype.setupRoutes = function(app, express) {
+ var self = this;
+
+ app.use('/', function(req, res, next){
+ if (req.headers.accept && req.headers.accept.indexOf('text/html') !== -1 &&
+ req.headers["X-Requested-With"] !== 'XMLHttpRequest'
+ ) {
+ res.setHeader('Content-Type', 'text/html');
+ res.send(self.indexFile);
+ } else {
+ express.static(__dirname + '/../public')(req, res, next);
+ }
+ });
+};
+
+InsightUI.prototype.filterIndexHTML = function(data) {
+ var transformed = data
+ .replace(/=0.2.14"
},
diff --git a/public/index.html b/public/index.html
index 337731e..59059f5 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,6 +1,7 @@
+
@@ -8,9 +9,9 @@
Insight
-
+
-
+
@@ -39,7 +40,7 @@
insight API v{{version}}
+
-
-
-
+
+
+
diff --git a/public/src/js/config.js b/public/src/js/config.js
index 4ba2fc0..bb1801d 100644
--- a/public/src/js/config.js
+++ b/public/src/js/config.js
@@ -4,47 +4,47 @@
angular.module('insight').config(function($routeProvider) {
$routeProvider.
when('/block/:blockHash', {
- templateUrl: '/views/block.html',
+ templateUrl: 'views/block.html',
title: 'Bitcoin Block '
}).
when('/block-index/:blockHeight', {
controller: 'BlocksController',
- templateUrl: '/views/redirect.html'
+ templateUrl: 'views/redirect.html'
}).
when('/tx/send', {
- templateUrl: '/views/transaction_sendraw.html',
+ templateUrl: 'views/transaction_sendraw.html',
title: 'Broadcast Raw Transaction'
}).
when('/tx/:txId/:v_type?/:v_index?', {
- templateUrl: '/views/transaction.html',
+ templateUrl: 'views/transaction.html',
title: 'Bitcoin Transaction '
}).
when('/', {
- templateUrl: '/views/index.html',
+ templateUrl: 'views/index.html',
title: 'Home'
}).
when('/blocks', {
- templateUrl: '/views/block_list.html',
+ templateUrl: 'views/block_list.html',
title: 'Bitcoin Blocks solved Today'
}).
when('/blocks-date/:blockDate/:startTimestamp?', {
- templateUrl: '/views/block_list.html',
+ templateUrl: 'views/block_list.html',
title: 'Bitcoin Blocks solved '
}).
when('/address/:addrStr', {
- templateUrl: '/views/address.html',
+ templateUrl: 'views/address.html',
title: 'Bitcoin Address '
}).
when('/status', {
- templateUrl: '/views/status.html',
+ templateUrl: 'views/status.html',
title: 'Status'
}).
when('/messages/verify', {
- templateUrl: '/views/messages_verify.html',
+ templateUrl: 'views/messages_verify.html',
title: 'Verify Message'
})
.otherwise({
- templateUrl: '/views/404.html',
+ templateUrl: 'views/404.html',
title: 'Error'
});
});
diff --git a/public/src/js/controllers/transactions.js b/public/src/js/controllers/transactions.js
index 2493082..504c1b2 100644
--- a/public/src/js/controllers/transactions.js
+++ b/public/src/js/controllers/transactions.js
@@ -189,7 +189,7 @@ angular.module('insight.transactions').controller('SendRawTransactionController'
rawtx: $scope.transaction
};
$scope.status = 'loading';
- $http.post('/api/tx/send', postData)
+ $http.post(window.apiPrefix + '/tx/send', postData)
.success(function(data, status, headers, config) {
if(typeof(data.txid) != 'string') {
// API returned 200 but the format is not known
diff --git a/public/src/js/services/address.js b/public/src/js/services/address.js
index bdacb9c..556063a 100644
--- a/public/src/js/services/address.js
+++ b/public/src/js/services/address.js
@@ -2,7 +2,7 @@
angular.module('insight.address').factory('Address',
function($resource) {
- return $resource('/api/addr/:addrStr/?noTxList=1', {
+ return $resource(window.apiPrefix + '/addr/:addrStr/?noTxList=1', {
addrStr: '@addStr'
}, {
get: {
@@ -21,3 +21,4 @@ angular.module('insight.address').factory('Address',
});
});
+
\ No newline at end of file
diff --git a/public/src/js/services/blocks.js b/public/src/js/services/blocks.js
index aa89df5..fb8f5d6 100644
--- a/public/src/js/services/blocks.js
+++ b/public/src/js/services/blocks.js
@@ -3,7 +3,7 @@
angular.module('insight.blocks')
.factory('Block',
function($resource) {
- return $resource('/api/block/:blockHash', {
+ return $resource(window.apiPrefix + '/block/:blockHash', {
blockHash: '@blockHash'
}, {
get: {
@@ -23,9 +23,9 @@ angular.module('insight.blocks')
})
.factory('Blocks',
function($resource) {
- return $resource('/api/blocks');
+ return $resource(window.apiPrefix + '/blocks');
})
.factory('BlockByHeight',
function($resource) {
- return $resource('/api/block-index/:blockHeight');
+ return $resource(window.apiPrefix + '/block-index/:blockHeight');
});
diff --git a/public/src/js/services/currency.js b/public/src/js/services/currency.js
index 1a9cc0e..9f7eea2 100644
--- a/public/src/js/services/currency.js
+++ b/public/src/js/services/currency.js
@@ -2,5 +2,5 @@
angular.module('insight.currency').factory('Currency',
function($resource) {
- return $resource('/api/currency');
+ return $resource(window.apiPrefix + '/currency');
});
diff --git a/public/src/js/services/global.js b/public/src/js/services/global.js
index 4bbd022..07bd5ec 100644
--- a/public/src/js/services/global.js
+++ b/public/src/js/services/global.js
@@ -8,5 +8,5 @@ angular.module('insight.system')
])
.factory('Version',
function($resource) {
- return $resource('/api/version');
+ return $resource(window.apiPrefix + '/version');
});
diff --git a/public/src/js/services/status.js b/public/src/js/services/status.js
index 62fb84e..6f60559 100644
--- a/public/src/js/services/status.js
+++ b/public/src/js/services/status.js
@@ -3,15 +3,15 @@
angular.module('insight.status')
.factory('Status',
function($resource) {
- return $resource('/api/status', {
+ return $resource(window.apiPrefix + '/status', {
q: '@q'
});
})
.factory('Sync',
function($resource) {
- return $resource('/api/sync');
+ return $resource(window.apiPrefix + '/sync');
})
.factory('PeerSync',
function($resource) {
- return $resource('/api/peer');
+ return $resource(window.apiPrefix + '/peer');
});
diff --git a/public/src/js/services/transactions.js b/public/src/js/services/transactions.js
index d1243ea..e84bed7 100644
--- a/public/src/js/services/transactions.js
+++ b/public/src/js/services/transactions.js
@@ -3,7 +3,7 @@
angular.module('insight.transactions')
.factory('Transaction',
function($resource) {
- return $resource('/api/tx/:txId', {
+ return $resource(window.apiPrefix + '/tx/:txId', {
txId: '@txId'
}, {
get: {
@@ -23,17 +23,17 @@ angular.module('insight.transactions')
})
.factory('TransactionsByBlock',
function($resource) {
- return $resource('/api/txs', {
+ return $resource(window.apiPrefix + '/txs', {
block: '@block'
});
})
.factory('TransactionsByAddress',
function($resource) {
- return $resource('/api/txs', {
+ return $resource(window.apiPrefix + '/txs', {
address: '@address'
});
})
.factory('Transactions',
function($resource) {
- return $resource('/api/txs');
+ return $resource(window.apiPrefix + '/txs');
});
diff --git a/public/views/404.html b/public/views/404.html
index 9b2c262..08c5238 100644
--- a/public/views/404.html
+++ b/public/views/404.html
@@ -1,4 +1,4 @@
-
+
Ooops!
404 Page not found :(
diff --git a/public/views/address.html b/public/views/address.html
index f16ec87..edca68c 100644
--- a/public/views/address.html
+++ b/public/views/address.html
@@ -1,4 +1,4 @@
-
+
@@ -74,7 +74,7 @@
diff --git a/public/views/block.html b/public/views/block.html
index 35c1faa..4a56365 100644
--- a/public/views/block.html
+++ b/public/views/block.html
@@ -1,10 +1,10 @@
-
+
diff --git a/public/views/block_list.html b/public/views/block_list.html
index 4a9212c..9de2872 100644
--- a/public/views/block_list.html
+++ b/public/views/block_list.html
@@ -1,4 +1,4 @@
-
+
@@ -22,8 +22,8 @@
{{humanSince(pagination.currentTs)}}
@@ -49,7 +49,7 @@
Waiting for blocks... |
- {{b.height}} |
+ {{b.height}} |
{{b.time * 1000 | date:'medium'}} |
{{b.txlength}} |
{{b.poolInfo.poolName}} |
@@ -58,8 +58,8 @@
diff --git a/public/views/includes/header.html b/public/views/includes/header.html
index 67efecd..8b20d8f 100644
--- a/public/views/includes/header.html
+++ b/public/views/includes/header.html
@@ -7,15 +7,15 @@
- insight
+ insight
-
+
-
@@ -41,7 +41,7 @@
Scan
-
+
diff --git a/public/views/index.html b/public/views/index.html
index 4610ea4..c5a1262 100644
--- a/public/views/index.html
+++ b/public/views/index.html
@@ -1,13 +1,13 @@
{{$root.flashMessage}}
-
+
-
+
Latest Blocks
@@ -24,7 +24,7 @@
Waiting for blocks... |
- {{b.height}}
+ {{b.height}}
|
{{humanSince(b.time)}} |
{{b.txlength}} |
@@ -34,7 +34,7 @@
Latest Transactions
@@ -50,7 +50,7 @@
Waiting for transactions... |
- {{tx.txid}}
+ {{tx.txid}}
|
{{$root.currency.getConvertion(tx.valueOut) || tx.valueOut + ' BTC'}} |
diff --git a/public/views/status.html b/public/views/status.html
index 280afad..ceffff6 100644
--- a/public/views/status.html
+++ b/public/views/status.html
@@ -1,4 +1,4 @@
-
+