mirror of
https://github.com/MetaProvide/nextcloud-swarm-plugin.git
synced 2025-01-27 13:20:24 +00:00
f2501b13ea
* feat(cs): update cs config * feat(cs): update composer deps * feat(cs): gitignore * feat(cs): add pipeline * feat(cs): code style * perf(cs): update pipeline - refactor: changed name to Lint - add: auto commit action - add: fast fail - update: install only cs-fixer dep * Apply automatic changes * feat(cs): update auto commit - update: commit message * feat(cs): enable PSR12 and PhpCsFixer rules - add: extend NC rules - chore: lint new rules - fix: OC PSR4 detection - add: global imports - add: trailing comma in arrays and etc * refactor(file): find_exists return value * chore: fix code style * refactor(swarm): ref check and param arg type * refactor(swarm): param arg type * chore: fix code style --------- Co-authored-by: mahiarirani <mahiarirani@users.noreply.github.com> Co-authored-by: JoaoSRaposo <joaosraposo@gmail.com>
81 lines
3.6 KiB
PHP
81 lines
3.6 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2022, MetaProvide Holding EKF
|
|
* @author Ron Trevor <ecoron@proton.me>
|
|
* @license GNU AGPL version 3 or any later version
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
style('files_external_ethswarm', 'settings-admin');
|
|
script('files_external_ethswarm', 'settings');
|
|
?>
|
|
<div id="beeswarm" class="section">
|
|
<h2 class="inlineblock"><?php p($l->t('External Storage: Swarm')); ?></h2>
|
|
<a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation')); ?>" href="<?php p('https://github.com/MetaProvide/nextcloud-swarm-plugin/'); ?>"></a>
|
|
<p class="settings-hint"><?php p($l->t('View the current status of the Swarm node(s) configured in \'External Storage\' section of NextCloud.')); ?></p>
|
|
<?php
|
|
// Get configured storage mounts from parameters
|
|
$mounts = json_decode($_['mounts'], true);
|
|
$mountIds = array_column($mounts, 'mount_id');
|
|
// Make comma-seperated list of storageIds to use in hidden control in this form.
|
|
$controlmountIds = implode(',', $mountIds);
|
|
|
|
foreach ($mounts as $mount) {
|
|
$mountId = $mount['mount_id'];
|
|
$mountName = $mount['mount_name'];
|
|
$encrypted = $mount['encrypt'];
|
|
$batchId = isset($mount['batchid']) ? $mount['batchid'] : '';
|
|
$batchBalance = isset($mount['batchbalance']) ? $mount['batchbalance'] : '';
|
|
$chequeBalance = isset($mount['chequebalance']) ? $mount['chequebalance'] : '';
|
|
?>
|
|
<div>
|
|
<label>
|
|
<h3><b><span id="<?php p($mountId); ?>"><?php p($l->t('Swarm node')); ?></b>: <?php p($mountName); ?></span></h3>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
<span class="label"><?php p($l->t('Allow encryption')); ?></span>
|
|
<?php
|
|
if ($encrypted) {
|
|
$checked = 'checked';
|
|
}?>
|
|
<span><input id="beeswarm_encrypt_<?php p($mountId); ?>" type="checkbox" <?php p($checked); ?>/></span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
<span class="label"><?php p($l->t('Current Batch Id')); ?></span>
|
|
<span><input id="beeswarm_batchid_<?php p($mountId); ?>" type="text" maxlength="200" class="inputBatch" value="<?php p($batchId); ?>" /></span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
<span class="label"><?php p($l->t('Batch TTL')); ?></span>
|
|
<span><input id="beeswarm-bzz_<?php p($mountId); ?>" type="text" placeholder="<?php p($l->t('Batch TTL')); ?>" value="<?php p($batchBalance); ?>" maxlength="20" readonly/><span>
|
|
<span data-setting="bzz" data-toggle="tooltip" data-original-title="<?php p($l->t('Reset to default')); ?>" class="theme-undo icon icon-history"></span>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
<span class="label"><?php p($l->t('Chequebook Balance')); ?></span>
|
|
<input id="beeswarm-chequebalance_<?php p($mountId); ?>" type="text" maxlength="20" value="<?php p($chequeBalance); ?>" readonly/>
|
|
<div data-setting="chequebalance_" data-toggle="tooltip" data-original-title="<?php p($l->t('Reset to default')); ?>" class="theme-undo icon icon-history"></div>
|
|
</label>
|
|
</div>
|
|
<?php } ?>
|
|
<input id="mountsIds" type="hidden" value='<?php p($controlmountIds); ?>'>
|
|
|
|
<button id="beeswarm-save-settings"><?php p($l->t('Save')); ?></button>
|
|
</div>
|