229 lines
12 KiB
PHP
229 lines
12 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
style('qortal_integration', 'qapps');
|
||
script('qortal_integration', 'qapps');
|
||
|
||
$qapps = $_['qappsList'] ?? [];
|
||
$isPoweredMode = (string)($_['sovereignMode'] ?? 'powered') !== 'full_qortal';
|
||
?>
|
||
|
||
<div
|
||
id="qortal-qapps-root"
|
||
class="section"
|
||
data-qapps="<?php p(json_encode($qapps, JSON_UNESCAPED_SLASHES)); ?>"
|
||
data-qapps-enabled="<?php p(!empty($_['qappsEnabled']) ? '1' : '0'); ?>"
|
||
data-qapps-browser-enabled="<?php p(!empty($_['qappsFullBrowserEnabled']) ? '1' : '0'); ?>"
|
||
data-qapps-browser-address="<?php p((string)($_['qappsFullBrowserAddress'] ?? '')); ?>"
|
||
data-qapps-debug-enabled="<?php p(!empty($_['qappsDebugEnabled']) ? '1' : '0'); ?>"
|
||
data-qapps-advanced-unlock-settings-enabled="<?php p(!empty($_['qappsAdvancedUnlockSettingsEnabled']) ? '1' : '0'); ?>"
|
||
data-qortal-node-url="<?php p((string)($_['qortalNodeUrl'] ?? '')); ?>"
|
||
data-qortal-gateway-url="<?php p((string)($_['qortalGatewayUrl'] ?? '')); ?>"
|
||
data-gateway-proxy-url="<?php p((string)($_['gatewayProxyUrl'] ?? '')); ?>"
|
||
data-qapps-request-url="<?php p((string)($_['qappsRequestUrl'] ?? '')); ?>"
|
||
data-qapps-approve-url="<?php p((string)($_['qappsApproveUrl'] ?? '')); ?>"
|
||
data-qapps-permissions-url="<?php p((string)($_['qappsPermissionsUrl'] ?? '')); ?>"
|
||
data-qapps-unlock-url="<?php p((string)($_['qappsUnlockUrl'] ?? '')); ?>"
|
||
data-qapps-unlock-status-url="<?php p((string)($_['qappsUnlockStatusUrl'] ?? '')); ?>"
|
||
data-qapps-default-approval-mode="<?php p((string)($_['qappsDefaultApprovalMode'] ?? 'once')); ?>"
|
||
data-qapps-default-approval-temp-minutes="<?php p((string)($_['qappsDefaultApprovalTempMinutes'] ?? 120)); ?>"
|
||
data-qapps-default-approval-unlock-10-min="<?php p(!empty($_['qappsDefaultApprovalUnlock10Min']) ? '1' : '0'); ?>"
|
||
data-qapps-default-unlock-session-20-min="<?php p(!empty($_['qappsDefaultUnlockSession20Min']) ? '1' : '0'); ?>"
|
||
data-nextcloud-public-url="<?php p((string)($_['nextcloudPublicUrl'] ?? '')); ?>"
|
||
data-sovereign-mode="<?php p((string)($_['sovereignMode'] ?? 'powered')); ?>"
|
||
data-user-mappings-url="<?php p((string)($_['userMappingsUrl'] ?? '')); ?>"
|
||
data-settings-path="<?php p((string)($_['settingsPath'] ?? '')); ?>"
|
||
data-embed-mode="<?php p(!empty($_['embedMode']) ? '1' : '0'); ?>"
|
||
>
|
||
<div class="qortal-page-header">
|
||
<div>
|
||
<h2 id="qortal-qapps-title"><?php p((string)($_['title'] ?? 'NuQloud Apps')); ?></h2>
|
||
<p id="qortal-qapps-help" class="qortal-help">Launch approved NuQloud Apps from inside Nextcloud.</p>
|
||
</div>
|
||
<?php if ($isPoweredMode) { ?>
|
||
<div class="qortal-powered-brand">
|
||
<picture>
|
||
<source srcset="<?php p((string)($_['poweredByQortalLogoDarkUrl'] ?? '')); ?>" media="(prefers-color-scheme: dark)">
|
||
<img src="<?php p((string)($_['poweredByQortalLogoLightUrl'] ?? '')); ?>" alt="Powered by Qortal">
|
||
</picture>
|
||
</div>
|
||
<?php } ?>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-empty" class="qortal-card">
|
||
<p id="qortal-qapps-empty-note" class="qortal-note">App access is not enabled yet. Ask an admin to enable it.</p>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-browser" class="qortal-card">
|
||
<h3 id="qortal-qapps-browser-title">Full NuQloud Browser</h3>
|
||
<p id="qortal-qapps-browser-note" class="qortal-note">
|
||
Open the full NuQloud browser for unrestricted app access.
|
||
</p>
|
||
<p class="qortal-note">
|
||
Address: <code id="qortal-qapps-browser-address"></code>
|
||
</p>
|
||
<button id="qortal-qapps-open-browser" class="button button-primary">Open Full Browser</button>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-warning" class="qortal-card qortal-hidden">
|
||
<h3>View-only mode</h3>
|
||
<p id="qortal-qapps-warning-note" class="qortal-note">
|
||
No linked wallet is available for your account yet. You can browse apps, but authenticated actions
|
||
will not work until you create or attach a wallet.
|
||
</p>
|
||
<p class="qortal-note">
|
||
<a id="qortal-qapps-settings-link" class="button" href="#">Open Integration Settings</a>
|
||
</p>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-name-required" class="qortal-modal qortal-hidden">
|
||
<div class="qortal-modal__backdrop"></div>
|
||
<div class="qortal-modal__card qortal-modal__card--danger">
|
||
<h3 id="qortal-qapps-name-required-title">Registered Name Needed</h3>
|
||
<p id="qortal-qapps-name-required-note-1" class="qortal-note">
|
||
You do not have a registered name.
|
||
</p>
|
||
<ol id="qortal-qapps-name-required-steps" class="qortal-note">
|
||
<li id="qortal-qapps-name-required-step-1">Create or link your account from the dashboard.</li>
|
||
<li id="qortal-qapps-name-required-step-2">Obtain credits from admins/CHD or purchase them on the dashboard.</li>
|
||
<li id="qortal-qapps-name-required-step-3">Register your distributed identity name from the dashboard.</li>
|
||
</ol>
|
||
<p id="qortal-qapps-name-required-note-2" class="qortal-note">
|
||
Once these steps are complete, distributed authentication, communications, backups, and app data features will be available.
|
||
</p>
|
||
<div class="qortal-approval-actions qortal-name-required-actions">
|
||
<a id="qortal-qapps-name-required-dashboard" class="button button-primary" href="#">Open Dashboard</a>
|
||
<button id="qortal-qapps-name-required-continue" class="button" type="button">Continue in View-Only Mode</button>
|
||
<button id="qortal-qapps-name-required-cancel" class="button" type="button">Cancel</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-list" class="qortal-card">
|
||
<h3 id="qortal-qapps-list-title">Available NuQloud Apps</h3>
|
||
<p id="qortal-qapps-list-note" class="qortal-note">Launch approved NuQloud Apps from this list, or use Full Browser mode for unrestricted navigation.</p>
|
||
<div id="qortal-qapps-gallery" class="qortal-qapps-gallery"></div>
|
||
<div class="qortal-table-wrap">
|
||
<table class="qortal-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Name</th>
|
||
<th>Address</th>
|
||
<th>Description</th>
|
||
<th>Action</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody id="qortal-qapps-body">
|
||
<tr>
|
||
<td colspan="4">Loading…</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-switch-modal" class="qortal-modal qortal-hidden">
|
||
<div class="qortal-modal__backdrop"></div>
|
||
<div class="qortal-modal__card">
|
||
<h3>Switch App?</h3>
|
||
<p id="qortal-qapps-switch-modal-note" class="qortal-note">
|
||
Opening another app here will replace your current app in this tab.
|
||
</p>
|
||
<div class="qortal-approval-actions qortal-name-required-actions">
|
||
<button id="qortal-qapps-switch-open-here" class="button button-primary" type="button">Open anyway</button>
|
||
<button id="qortal-qapps-switch-open-new-tab" class="button" type="button">Open in new tab</button>
|
||
<button id="qortal-qapps-switch-cancel" class="button" type="button">Cancel</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-viewer" class="qortal-card qortal-hidden">
|
||
<div class="qortal-viewer-toolbar">
|
||
<div class="qortal-viewer-nav-actions">
|
||
<button id="qortal-qapps-back" class="button">Back</button>
|
||
<button id="qortal-qapps-reload" class="button">Reload</button>
|
||
</div>
|
||
<div class="qortal-viewer-address">
|
||
<code id="qortal-qapps-viewer-address" class="qortal-viewer-address-text"></code>
|
||
<div class="qortal-viewer-address-input">
|
||
<input id="qortal-qapps-viewer-address-input" class="qortal-input" type="text" placeholder="qortal://APP/Q-Tube">
|
||
<button id="qortal-qapps-viewer-address-go" class="button">Go</button>
|
||
</div>
|
||
<span id="qortal-qapps-loading-progress" class="qortal-qdn-progress qortal-hidden" aria-live="polite"></span>
|
||
</div>
|
||
<div id="qortal-qapps-viewer-node-stats" class="qortal-viewer-node-stats" aria-live="polite" title="Local node connectivity">
|
||
<span class="qortal-viewer-node-stat" id="qortal-qapps-viewer-peers-pill">
|
||
<span class="qortal-viewer-node-stat-label">Peers</span>
|
||
<span id="qortal-qapps-viewer-peers-value" class="qortal-viewer-node-stat-value">—</span>
|
||
</span>
|
||
<span class="qortal-viewer-node-stat" id="qortal-qapps-viewer-data-peers-pill">
|
||
<span class="qortal-viewer-node-stat-label">Data</span>
|
||
<span id="qortal-qapps-viewer-data-peers-value" class="qortal-viewer-node-stat-value">—</span>
|
||
</span>
|
||
</div>
|
||
<div class="qortal-viewer-actions">
|
||
<button id="qortal-qapps-menu" class="button qortal-mobile-only" type="button" aria-controls="qortal-qapps-root" aria-expanded="false">Menu</button>
|
||
<button id="qortal-qapps-mobile-refresh" class="button qortal-mobile-only qortal-mobile-icon-button" type="button" aria-label="Refresh Q-App" title="Refresh Q-App">↻</button>
|
||
<button id="qortal-qapps-open-external" class="button" type="button">Copy link</button>
|
||
<button id="qortal-qapps-close" class="button qortal-mobile-icon-button" type="button" aria-label="Close Q-App viewer">×</button>
|
||
</div>
|
||
</div>
|
||
<div id="qortal-qapps-frame-wrap" class="qortal-viewer-frame-wrap">
|
||
<div id="qortal-qapps-loading-overlay" class="qortal-loading-overlay qortal-hidden" aria-live="polite" aria-atomic="true">
|
||
<div class="qortal-loading-card">
|
||
<div class="qortal-loading-title">Loading from QDN</div>
|
||
<div id="qortal-qapps-loading-status" class="qortal-loading-status">Preparing resource...</div>
|
||
<div class="qortal-loading-progress-track">
|
||
<div id="qortal-qapps-loading-progress-bar" class="qortal-loading-progress-bar"></div>
|
||
</div>
|
||
<div id="qortal-qapps-loading-meta" class="qortal-loading-meta"></div>
|
||
</div>
|
||
</div>
|
||
<iframe
|
||
id="qortal-qapps-frame"
|
||
title="Q-App Viewer"
|
||
loading="lazy"
|
||
scrolling="yes"
|
||
allow="fullscreen; autoplay; encrypted-media; picture-in-picture"
|
||
allowfullscreen
|
||
></iframe>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-debug" class="qortal-card qortal-hidden">
|
||
<div id="qortal-qapps-debug-resize-handle" class="qortal-debug-resize-handle" aria-hidden="true"></div>
|
||
<div class="qortal-debug-header">
|
||
<h3>Debug Panel</h3>
|
||
<div class="qortal-debug-actions">
|
||
<button id="qortal-qapps-debug-minimize" class="button" type="button" aria-label="Minimize debug panel" title="Minimize debug panel">−</button>
|
||
<button id="qortal-qapps-debug-float" class="button" type="button" aria-label="Dock debug panel" title="Dock debug panel">⤓</button>
|
||
<button id="qortal-qapps-debug-copy" class="button" type="button" title="Copy debug logs" aria-label="Copy debug logs">⧉</button>
|
||
<button id="qortal-qapps-debug-clear" class="button" type="button" title="Clear debug logs" aria-label="Clear debug logs">⌫</button>
|
||
</div>
|
||
</div>
|
||
<pre id="qortal-qapps-debug-body" class="qortal-status qortal-compact-status">Debug mode enabled.</pre>
|
||
</div>
|
||
|
||
<div id="qortal-qapps-unlock" class="qortal-modal qortal-hidden">
|
||
<div class="qortal-modal__backdrop"></div>
|
||
<div class="qortal-modal__card">
|
||
<h3 id="qortal-qapps-unlock-title"><?php p(!empty($_['qappsAdvancedUnlockSettingsEnabled']) ? 'Unlock Qortal Wallet' : 'Unlock to Continue'); ?></h3>
|
||
<p id="qortal-qapps-unlock-note" class="qortal-note"><?php p(!empty($_['qappsAdvancedUnlockSettingsEnabled']) ? 'Your wallet is locked. Enter your wallet password to continue.' : 'Enter your password to continue in this app.'); ?></p>
|
||
<div class="qortal-approval-details">
|
||
<div><span class="qortal-label">App</span> <span id="qortal-unlock-app" class="qortal-value">—</span></div>
|
||
<div><span class="qortal-label">Action</span> <span id="qortal-unlock-action" class="qortal-value">—</span></div>
|
||
</div>
|
||
<div class="qortal-unlock-field">
|
||
<label class="qortal-label" for="qortal-unlock-password">Wallet password</label>
|
||
<input id="qortal-unlock-password" class="qortal-input" type="password" placeholder="Enter wallet password" autocomplete="current-password">
|
||
</div>
|
||
<div class="qortal-approval-actions">
|
||
<button id="qortal-unlock-confirm" class="button button-primary">Unlock</button>
|
||
<button id="qortal-unlock-cancel" class="button">Cancel</button>
|
||
</div>
|
||
<p id="qortal-unlock-error" class="qortal-note qortal-approval-error qortal-hidden"></p>
|
||
</div>
|
||
</div>
|
||
</div>
|