211 lines
8.1 KiB
PHP
211 lines
8.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
style('qortal_integration', 'personal');
|
|
script('qortal_integration', 'personal');
|
|
?>
|
|
|
|
<div
|
|
id="qortal-personal-root"
|
|
class="section"
|
|
data-user-mappings-url="<?php p($_['userMappingsUrl']); ?>"
|
|
data-user-create-wallet-url="<?php p($_['userCreateWalletUrl']); ?>"
|
|
data-user-backup-wallet-url="<?php p($_['userBackupWalletUrl']); ?>"
|
|
data-user-import-seed-link-url="<?php p($_['userImportSeedLinkUrl']); ?>"
|
|
data-user-import-backup-link-url="<?php p($_['userImportBackupLinkUrl']); ?>"
|
|
data-user-unlink-mapping-url="<?php p($_['userUnlinkMappingUrl']); ?>"
|
|
data-user-qapps-prefs-url="<?php p($_['userQappsPrefsUrl']); ?>"
|
|
data-user-qapps-rules-url="<?php p($_['userQappsRulesUrl']); ?>"
|
|
data-user-qapps-rule-revoke-url="<?php p($_['userQappsRuleRevokeUrl']); ?>"
|
|
data-user-qapps-approval-mode="<?php p((string)($_['userQappsApprovalMode'] ?? 'once')); ?>"
|
|
data-user-qapps-approval-temp-minutes="<?php p((string)($_['userQappsApprovalTempMinutes'] ?? 10)); ?>"
|
|
data-user-qapps-approval-unlock-10-min="<?php p(!empty($_['userQappsApprovalUnlock10Min']) ? '1' : '0'); ?>"
|
|
data-user-qapps-unlock-session-20-min="<?php p(!empty($_['userQappsUnlockSession20Min']) ? '1' : '0'); ?>"
|
|
>
|
|
<h2><?php p($_['title']); ?></h2>
|
|
<p class="qortal-help">
|
|
Import an existing Qortal wallet by seed phrase or backup JSON to link it with your Nextcloud account.
|
|
</p>
|
|
<?php if (!empty($_['currentUserId'])): ?>
|
|
<p class="qortal-note">
|
|
Current Nextcloud user:
|
|
<code><?php p($_['currentUserId']); ?></code>
|
|
</p>
|
|
<?php endif; ?>
|
|
|
|
<div class="qortal-card" id="qortal-user-approval-defaults">
|
|
<h3>Q-Apps Approval Defaults</h3>
|
|
<p class="qortal-note">
|
|
These defaults control only Qortal transaction/request approvals. External Auth session connectivity is handled automatically while your Nextcloud session is active.
|
|
</p>
|
|
<div class="qortal-grid">
|
|
<label for="qortal-default-approval-mode">Default Approval Policy</label>
|
|
<select id="qortal-default-approval-mode">
|
|
<option value="once">Allow only this request</option>
|
|
<option value="type_minutes">Allow this request type for X minutes</option>
|
|
<option value="type_always">Always allow this request type</option>
|
|
<option value="app_always">Always allow all request types for this Q-App</option>
|
|
</select>
|
|
|
|
<label for="qortal-default-approval-temp-minutes">Default X Minutes</label>
|
|
<input id="qortal-default-approval-temp-minutes" type="number" min="1" max="1440" step="1" placeholder="10">
|
|
</div>
|
|
<div class="qortal-toggles">
|
|
<label>
|
|
<input id="qortal-default-approval-unlock-10-min" type="checkbox">
|
|
Default to "Also unlock wallet for 10 min"
|
|
</label>
|
|
<label>
|
|
<input id="qortal-default-unlock-session-20-min" type="checkbox">
|
|
Default to "Keep wallet unlocked for 20 minutes" on unlock popup
|
|
</label>
|
|
</div>
|
|
<div class="qortal-actions">
|
|
<button id="qortal-save-approval-defaults" class="button button-primary">Save Approval Defaults</button>
|
|
<button id="qortal-reset-approval-defaults" class="button">Reset to Safe Defaults</button>
|
|
</div>
|
|
<div id="qortal-approval-defaults-result" class="qortal-status qortal-compact-status"></div>
|
|
</div>
|
|
|
|
<div class="qortal-card" id="qortal-user-approval-rules">
|
|
<h3>Active Q-Apps Approval Rules</h3>
|
|
<p class="qortal-note">
|
|
Rules set from Q-Apps approval prompts are persisted here. Removing a rule sets that scope back to ask every time.
|
|
</p>
|
|
<div class="qortal-actions">
|
|
<button id="qortal-refresh-approval-rules" class="button">Refresh Rules</button>
|
|
</div>
|
|
<div class="qortal-table-wrap">
|
|
<table class="qortal-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Mode</th>
|
|
<th>App</th>
|
|
<th>Scope</th>
|
|
<th>Request Type</th>
|
|
<th>Updated</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="qortal-user-approval-rules-body"></tbody>
|
|
</table>
|
|
</div>
|
|
<div id="qortal-approval-rules-result" class="qortal-status qortal-compact-status"></div>
|
|
</div>
|
|
|
|
<div class="qortal-card" id="qortal-create-wallet">
|
|
<h3>Create New Qortal Wallet</h3>
|
|
<p class="qortal-note">
|
|
Create a new Qortal wallet locally and link it to your Nextcloud account.
|
|
After creation you can generate and save a backup JSON.
|
|
</p>
|
|
<div class="qortal-grid">
|
|
<label for="qortal-create-password">Wallet Password</label>
|
|
<input id="qortal-create-password" type="password" placeholder="Required for wallet creation">
|
|
|
|
<label for="qortal-create-kdf">KDF Threads (optional)</label>
|
|
<input id="qortal-create-kdf" type="number" min="1" placeholder="Optional">
|
|
</div>
|
|
<div class="qortal-actions">
|
|
<button id="qortal-create-wallet-button" class="button button-primary">Create Wallet</button>
|
|
</div>
|
|
<div id="qortal-create-wallet-result" class="qortal-status qortal-compact-status"></div>
|
|
</div>
|
|
|
|
<div class="qortal-card" id="qortal-backup-wallet">
|
|
<h3>Backup Wallet</h3>
|
|
<p class="qortal-note">
|
|
Generate an encrypted backup JSON for your wallet. Store it safely.
|
|
</p>
|
|
<div class="qortal-grid">
|
|
<label for="qortal-backup-wallet-id">Wallet ID</label>
|
|
<input id="qortal-backup-wallet-id" type="text" placeholder="Wallet ID from creation or linked accounts">
|
|
|
|
<label for="qortal-backup-wallet-password">Backup Password</label>
|
|
<input id="qortal-backup-wallet-password" type="password" placeholder="Password used to encrypt the backup">
|
|
</div>
|
|
<div class="qortal-toggles">
|
|
<label>
|
|
<input id="qortal-backup-download" type="checkbox" checked>
|
|
Download backup JSON
|
|
</label>
|
|
<label>
|
|
<input id="qortal-backup-save" type="checkbox">
|
|
Save backup to Nextcloud Files
|
|
</label>
|
|
</div>
|
|
<div class="qortal-actions">
|
|
<button id="qortal-backup-wallet-button" class="button">Create Backup</button>
|
|
</div>
|
|
<div id="qortal-backup-result" class="qortal-status qortal-compact-status"></div>
|
|
</div>
|
|
|
|
<div class="qortal-card">
|
|
<h3>Import Existing Wallet</h3>
|
|
<p class="qortal-note">
|
|
This imports your wallet into the broker's External Auth context and links it to your current Nextcloud user.
|
|
</p>
|
|
<div class="qortal-grid">
|
|
<label for="qortal-seed-phrase">Seed Phrase</label>
|
|
<textarea id="qortal-seed-phrase" rows="3" spellcheck="false" placeholder="word1 word2 ..."></textarea>
|
|
|
|
<label for="qortal-wallet-password">Wallet Password</label>
|
|
<input id="qortal-wallet-password" type="password" placeholder="Password to encrypt imported wallet">
|
|
</div>
|
|
<div class="qortal-actions">
|
|
<button id="qortal-import-link" class="button button-primary">Import And Link</button>
|
|
<button id="qortal-refresh-user-mappings" class="button">Refresh My Linked Accounts</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="qortal-card">
|
|
<h3>Import Backup JSON</h3>
|
|
<p class="qortal-note">
|
|
Upload your encrypted Qortal wallet backup JSON and provide its password.
|
|
</p>
|
|
<div class="qortal-grid">
|
|
<label for="qortal-backup-file">Backup JSON File</label>
|
|
<input id="qortal-backup-file" type="file" accept=".json,application/json">
|
|
|
|
<label for="qortal-backup-password">Backup Password</label>
|
|
<input id="qortal-backup-password" type="password" placeholder="Password used when creating backup">
|
|
</div>
|
|
<div class="qortal-actions">
|
|
<button id="qortal-import-backup-link" class="button button-primary">Import Backup And Link</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="qortal-personal-feedback" class="qortal-feedback" role="status"></div>
|
|
<div id="qortal-personal-success" class="qortal-note"></div>
|
|
<pre id="qortal-personal-result" class="qortal-status"></pre>
|
|
|
|
<div class="qortal-card">
|
|
<h3>My Linked Qortal Accounts</h3>
|
|
<div class="qortal-table-wrap">
|
|
<table class="qortal-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Qortal Address</th>
|
|
<th>Wallet ID</th>
|
|
<th>Status</th>
|
|
<th>Updated</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="qortal-user-mappings-body"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($_['qappsEnabled']) || !empty($_['qappsFullBrowserEnabled'])): ?>
|
|
<div class="qortal-card">
|
|
<h3>Q-Apps Access</h3>
|
|
<p class="qortal-note">
|
|
Launch approved Q-Apps from the Q-Apps hub.
|
|
</p>
|
|
<a class="button button-primary" href="<?php p($_['qappsUrl']); ?>">Open Q-Apps Hub</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|