Skip to content

Commit

Permalink
refactor!: rename API to API_ENABLED
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschubek committed Nov 28, 2024
1 parent 3e8773a commit d5deb03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion dbmeta-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ hash:
required: false
algo: sha256

api: true
api:
enabled: true # renamed from API

layout: basic # Options: basic, popup, full

Expand Down
8 changes: 4 additions & 4 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function downloadBatch(array $urls) {
$sorted = array_merge($sorted_folders, $sorted_files);

// if list request return json
$[if `process.env.API === "true"`]$
$[if `process.env.API_ENABLED === "true"`]$
if(isset($_REQUEST["ls"])) {
$info = [];
foreach ($sorted as $file) {
Expand Down Expand Up @@ -445,7 +445,7 @@ function downloadBatch(array $urls) {
$redis->connect('127.0.0.1', 6379);
$[end]$

$[if `process.env.API === "true"`]$
$[if `process.env.API_ENABLED === "true"`]$
if(isset($_REQUEST["info"])) {
$info = [
"url" => $relative_path, // FIXME: use host domain! abc.de/foobar
Expand Down Expand Up @@ -841,7 +841,7 @@ function toggletheme() {
<ul class="dropdown-menu">
<!-- <li><a class="dropdown-item stopprop" onclick="actionDownload()">Download</a></li> -->
<!-- <li><span class="dropdown-item stopprop">Download</span></li> -->
$[if `process.env.API === "true"`]$
$[if `process.env.API_ENABLED === "true"`]$
<li><span class="dropdown-item stopprop" onclick="window.open('${{`process.env.BASE_PATH ?? ''`}}$<?= $file->url ?>?<?= $file->is_dir ? "ls" : "info"?>')"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-external-link"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6" /><path d="M11 13l9 -9" /><path d="M15 4h5v5" /></svg>API</span></li>
<hr style="margin:0;margin-top: 2px;margin-bottom: 2px;"/>
$[end]$
Expand Down Expand Up @@ -889,7 +889,7 @@ function toggletheme() {
<div class="mt-auto">
<div class="container py-2 text-center" id="footer">
<?= $total_items ?> Items | <?= human_filesize($total_size) ?> $[if `process.env.TIMING === "true"`]$| <?= (hrtime(true) - $time_start)/1000000 ?> ms $[end]$$[if `process.env.API === "true"`]$| <a href="<?= '/' . implode(separator: '/', array: $url_parts) . '?ls' ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-api"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 13h5" /><path d="M12 16v-8h3a2 2 0 0 1 2 2v1a2 2 0 0 1 -2 2h-3" /><path d="M20 8v8" /><path d="M9 16v-5.5a2.5 2.5 0 0 0 -5 0v5.5" /></svg></a>$[end]$<br>
<?= $total_items ?> Items | <?= human_filesize($total_size) ?> $[if `process.env.TIMING === "true"`]$| <?= (hrtime(true) - $time_start)/1000000 ?> ms $[end]$$[if `process.env.API_ENABLED === "true"`]$| <a href="<?= '/' . implode(separator: '/', array: $url_parts) . '?ls' ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-api"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 13h5" /><path d="M12 16v-8h3a2 2 0 0 1 2 2v1a2 2 0 0 1 -2 2h-3" /><path d="M20 8v8" /><path d="M9 16v-5.5a2.5 2.5 0 0 0 -5 0v5.5" /></svg></a>$[end]$<br>
<span style="opacity:0.8"><span style="opacity: 0.8;">Powered by</span> <a href="https://dir.adriansoftware.de" class="text-decoration-none text-primary" target="_blank">dir-browser</a> v<?= VERSION ?></span>
</div>
</div>
Expand Down

0 comments on commit d5deb03

Please sign in to comment.