lbry app and Coinomi transaction URL handling
This commit is contained in:
parent
f85b9982e2
commit
96fac56e70
3 changed files with 23 additions and 5 deletions
|
@ -53,6 +53,7 @@ Router::scope('/', function (RouteBuilder $routes) {
|
|||
$routes->connect('/stats', ['controller' => 'Main', 'action' => 'stats']);
|
||||
$routes->connect('/tx/*', ['controller' => 'Main', 'action' => 'tx']);
|
||||
$routes->connect('/qr/*', ['controller' => 'Main', 'action' => 'qr']);
|
||||
$routes->connect('/*', ['controller' => 'Main', 'action' => 'index']);
|
||||
|
||||
$routes->connect('/api/v1/address/:addr/tag', ['controller' => 'Main', 'action' => 'apiaddrtag'], ['addr' => '[A-Za-z0-9,]+', 'pass' => ['addr']]);
|
||||
$routes->connect('/api/v1/address/:addr/utxo', ['controller' => 'Main', 'action' => 'apiaddrutxo'], ['addr' => '[A-Za-z0-9,]+', 'pass' => ['addr']]);
|
||||
|
|
|
@ -448,10 +448,6 @@ class MainController extends AppController {
|
|||
$this->loadModel('Outputs');
|
||||
$sourceAddress = $this->request->query('address');
|
||||
|
||||
if (!$hash) {
|
||||
return $this->redirect('/');
|
||||
}
|
||||
|
||||
$tx = $this->Transactions->find()->select(
|
||||
['Id', 'BlockHash', 'InputCount', 'OutputCount', 'Hash', 'Value', 'TransactionTime', 'TransactionSize', 'Created', 'Version', 'LockTime', 'Raw'])->where(['Hash' => $hash])->first();
|
||||
if (!$tx) {
|
||||
|
|
|
@ -34,6 +34,28 @@
|
|||
<!-- End Analytics Code -->
|
||||
<?php endif; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
// handle coinomi and lbry app urls
|
||||
var hashpart = window.location.hash;
|
||||
if (hashpart.length > 3) {
|
||||
hashpart = hashpart.substring(3);
|
||||
var txhash = null;
|
||||
if (hashpart.indexOf('?id=') > -1) {
|
||||
txhash = hashpart.substring(hashpart.indexOf('?id=') + 4);
|
||||
alert(txhash);
|
||||
} else {
|
||||
var parts = hashpart.split('/');
|
||||
if (parts.length > 1) {
|
||||
txhash = parts[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (txhash && $.trim(txhash.trim).length > 0) {
|
||||
window.location.href = '/tx/' + txhash;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php echo $this->fetch('meta') ?>
|
||||
<?php echo $this->fetch('css') ?>
|
||||
<?php echo $this->fetch('script') ?>
|
||||
|
@ -49,4 +71,3 @@
|
|||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
Loading…
Reference in a new issue