Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions config/config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,39 @@

// set server to maintenance mode
//$_config['maintenance']=1;

$_config['homepage_apps'] = [
"explorer" => [
"title" => "Explorer",
"url" => "/apps/explorer",
"icon" => "fas fa-binoculars",
"condition" => true
],
"miner" => [
"title" => "Miner",
"url" => "/apps/miner",
"icon" => "fas fa-hammer",
"condition" => "miner_enabled"
],
"dapps" => [
"title" => "Dapps",
"url" => "/dapps.php?url={dapps_id}",
"icon" => "fas fa-cubes",
"condition" => "dapps_enabled",
"tooltip" => "Decentralized apps"
],
"exchange" => [
"title" => "Exchange",
"url" => "https://klingex.io/trade/PHP-USDT?ref=3436CA42",
"icon" => "https://klingex.io/symbol.svg",
"target" => "_blank",
"condition" => true,
"tooltip" => "Exchange"
],
"docs" => [
"title" => "Docs",
"url" => "/apps/docs",
"icon" => "fas fa-file-alt",
"condition" => true
]
];
74 changes: 41 additions & 33 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,45 +114,53 @@
</a>
</div>
<div class="row justify-content-center">
<div class="col-sm-6 col-md-4 col-lg-3 col-12 col-xl-2 my-3">
<div class="d-grid gap-2">
<a class="btn btn-lg btn-primary btn-block text-white-50 waves-effect waves-light" href="/apps/explorer">
<h5 class="mb-3 text-white">Explorer</h5>
<i class="fas fa-binoculars fa-2x"></i>
</a>
</div>
</div>
<?php if (Nodeutil::miningEnabled()) { ?>
<div class="col-sm-6 col-md-4 col-lg-3 col-12 col-xl-2 my-3">
<div class="d-grid gap-2">
<a class="btn btn-lg btn-primary btn-block text-white-50 waves-effect waves-light" href="/apps/miner">
<h5 class="mb-3 text-white">Miner</h5>
<i class="fas fa-hammer fa-2x"></i>
</a>
</div>
</div>
<?php } ?>
<?php if(Dapps::isEnabled() && !empty($_config['dapps_public_key'])) {
$dapps_id = Account::getAddress($_config['dapps_public_key']);
<?php
if (!isset($_config['homepage_apps'])) {
$_config['homepage_apps'] = [
"explorer" => [
"title" => "Explorer",
"url" => "/apps/explorer",
"icon" => "fas fa-binoculars",
"condition" => true
]
];
}
foreach ($_config['homepage_apps'] as $app) {
$condition = $app['condition'];
if ($condition !== true) {
$show = false;
if ($condition == "miner_enabled") {
$show = Nodeutil::miningEnabled();
} else if ($condition == "dapps_enabled") {
$show = Dapps::isEnabled() && !empty($_config['dapps_public_key']);
}
if(!$show) {
continue;
}
}
$url = $app['url'];
if (strpos($url, '{dapps_id}') !== false) {
$dapps_id = Account::getAddress($_config['dapps_public_key']);
$url = str_replace('{dapps_id}', $dapps_id, $url);
}
$target = isset($app['target']) ? 'target="'.$app['target'].'"' : '';
$tooltip = isset($app['tooltip']) ? 'data-bs-toggle="tooltip" title="'.$app['tooltip'].'"' : '';
$icon = $app['icon'];
if (strpos($icon, 'http') === 0) {
$iconHtml = '<img src="'.$icon.'" style="width:38px;height:38px" class="p-1 bg-white rounded-2"/>';
} else {
$iconHtml = '<i class="'.$icon.' fa-2x"></i>';
}
?>
<div class="col-sm-6 col-md-4 col-lg-3 col-12 col-xl-2 my-3">
<div class="d-grid gap-2" data-bs-toggle="tooltip" title="Decentralized apps">
<a class="btn btn-lg btn-primary btn-block text-white-50 waves-effect waves-light" href="/dapps.php?url=<?php echo $dapps_id ?>">
<h5 class="mb-3 text-white">Dapps</h5>
<i class="fas fa-cubes fa-2x"></i>
<div class="d-grid gap-2" <?php echo $tooltip ?>>
<a class="btn btn-lg btn-primary btn-block text-white-50 waves-effect waves-light" href="<?php echo $url ?>" <?php echo $target ?>>
<h5 class="mb-3 text-white"><?php echo $app['title'] ?></h5>
<?php echo $iconHtml ?>
</a>
</div>
</div>
<?php } ?>
<div class="col-sm-6 col-md-4 col-lg-3 col-12 col-xl-2 my-3">
<div class="d-grid gap-2" data-bs-toggle="tooltip" title="Exchange">
<a class="btn btn-lg btn-primary btn-block text-white-50 waves-effect waves-light"
href="https://klingex.io/trade/PHP-USDT?ref=3436CA42" target="_blank">
<h5 class="mb-3 text-white">Exchange</h5>
<img src="https://klingex.io/symbol.svg" style="width:38px;height:38px" class="p-1 bg-white rounded-2"/>
</a>
</div>
</div>
</div>
</div>

Expand Down