feat(v4.0): Settings/Integrations — Gitea + GitHub connect/disconnect matrix
- GitHub integration row ajoutée (🦎 Gitea + 🐙 GitHub) - Badge 'Primary' sur le provider principal (auth_method) - Disconnect masqué pour le provider principal - authMethod, githubLinked, giteaLinked dans Alpine data - loadGithubStatus() + disconnectGithub() methods - Matrice respectée: local→déco OK, gitea→déco github OK, github→déco gitea OK
This commit is contained in:
@@ -319,9 +319,10 @@
|
||||
<p class="section-desc">Integrations and feature toggles.</p>
|
||||
<div class="setting-group">
|
||||
<h3>Integrations</h3>
|
||||
<!-- Gitea -->
|
||||
<div class="setting-row">
|
||||
<div>
|
||||
<div class="setting-label">Gitea</div>
|
||||
<div class="setting-label">🦎 Gitea <span x-show="authMethod==='gitea'" style="font-size:10px;background:var(--accent);color:#fff;padding:1px 6px;border-radius:3px;margin-left:6px;">Primary</span></div>
|
||||
<div class="setting-desc">
|
||||
<span x-show="giteaLinked">Connected to git.dracodev.net</span>
|
||||
<span x-show="!giteaLinked">Connect your Gitea account to access projects</span>
|
||||
@@ -329,16 +330,24 @@
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<span x-show="giteaLinked" style="font-size:12px;color:#0F7B6C;">✅ Active</span>
|
||||
<button x-show="giteaLinked" class="btn-sm" style="color:var(--danger);" @click="disconnectGitea()">Disconnect</button>
|
||||
<button x-show="giteaLinked && authMethod!=='gitea'" class="btn-sm" style="color:var(--danger);" @click="disconnectGitea()">Disconnect</button>
|
||||
<a x-show="!giteaLinked" class="btn-sm" href="/auth/login?provider=gitea&mode=link" style="text-decoration:none;color:var(--accent);">🔗 Connect</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- GitHub -->
|
||||
<div class="setting-row">
|
||||
<div>
|
||||
<div class="setting-label">GitHub</div>
|
||||
<div class="setting-desc">Connect your GitHub account</div>
|
||||
<div class="setting-label">🐙 GitHub <span x-show="authMethod==='github'" style="font-size:10px;background:var(--accent);color:#fff;padding:1px 6px;border-radius:3px;margin-left:6px;">Primary</span></div>
|
||||
<div class="setting-desc">
|
||||
<span x-show="githubLinked">Connected to github.com</span>
|
||||
<span x-show="!githubLinked">Connect your GitHub account to access repositories</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<span x-show="githubLinked" style="font-size:12px;color:#0F7B6C;">✅ Active</span>
|
||||
<button x-show="githubLinked && authMethod!=='github'" class="btn-sm" style="color:var(--danger);" @click="disconnectGithub()">Disconnect</button>
|
||||
<a x-show="!githubLinked" class="btn-sm" href="/auth/login?provider=github&mode=link" style="text-decoration:none;color:var(--accent);">🔗 Connect</a>
|
||||
</div>
|
||||
<div class="setting-control"><span style="font-size:12px;color:var(--text-dim);">Coming soon</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -513,8 +522,10 @@ document.addEventListener('alpine:init', function() {
|
||||
defaultView: localStorage.getItem('fd_default_view') || 'tree',
|
||||
userInfo: {full_name: '{{ user.full_name or "" }}', login: '{{ user.login or "" }}', email: '{{ user.email or "" }}'},
|
||||
userIsAdmin: {{ 'true' if user.get('is_admin') else 'false' }},
|
||||
// Gitea
|
||||
// Auth & Integrations
|
||||
authMethod: '{{ auth_method }}',
|
||||
giteaLinked: false,
|
||||
githubLinked: false,
|
||||
// Theme
|
||||
theme: localStorage.getItem('fd_theme') || 'dark',
|
||||
// Account form
|
||||
@@ -534,6 +545,7 @@ document.addEventListener('alpine:init', function() {
|
||||
async init() {
|
||||
await this.loadTags();
|
||||
await this.loadGiteaStatus();
|
||||
await this.loadGithubStatus();
|
||||
},
|
||||
|
||||
async loadTags() {
|
||||
@@ -772,6 +784,20 @@ document.addEventListener('alpine:init', function() {
|
||||
if (r.ok) { this.giteaLinked = false; }
|
||||
} catch(e) {}
|
||||
},
|
||||
async loadGithubStatus() {
|
||||
try {
|
||||
var r = await fetch('/api/github/status');
|
||||
var d = await r.json();
|
||||
this.githubLinked = d.linked || false;
|
||||
} catch(e) { this.githubLinked = false; }
|
||||
},
|
||||
async disconnectGithub() {
|
||||
if (!confirm('Disconnect GitHub? You can reconnect anytime.')) return;
|
||||
try {
|
||||
var r = await fetch('/api/github/disconnect', { method: 'DELETE', headers: {'X-CSRF-Token': this.getCsrfToken()} });
|
||||
if (r.ok) { this.githubLinked = false; }
|
||||
} catch(e) {}
|
||||
},
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user