fix: Home redirects local accounts to /local-workspace + sidebar Workspace section
- Dashboard '/' checks user_oauth_tokens for Gitea connection - Local accounts (no Gitea token) redirect to /local-workspace - Sidebar: Workspace section above Meetings with 'My Workspace' link - Local users no longer see Gitea projects on Home page
This commit is contained in:
@@ -304,6 +304,20 @@ async def dashboard(
|
|||||||
auth = _get_user_or_redirect(request)
|
auth = _get_user_or_redirect(request)
|
||||||
if isinstance(auth, RedirectResponse):
|
if isinstance(auth, RedirectResponse):
|
||||||
return auth
|
return auth
|
||||||
|
# Check if user has Gitea connected — if not, show local workspace
|
||||||
|
user_id = auth.get("id") if isinstance(auth, dict) else 1
|
||||||
|
has_gitea = False
|
||||||
|
try:
|
||||||
|
with get_conn() as conn:
|
||||||
|
tok = conn.execute(
|
||||||
|
"SELECT access_token FROM user_oauth_tokens WHERE user_id=? AND provider='gitea'",
|
||||||
|
(user_id,),
|
||||||
|
).fetchone()
|
||||||
|
has_gitea = bool(tok)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if not has_gitea:
|
||||||
|
return RedirectResponse("/local-workspace", status_code=302)
|
||||||
try:
|
try:
|
||||||
repos = await gitea.get_user_repos(page=1, limit=50)
|
repos = await gitea.get_user_repos(page=1, limit=50)
|
||||||
if search:
|
if search:
|
||||||
|
|||||||
@@ -80,6 +80,26 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Workspace -->
|
||||||
|
<div class="sidebar-section">
|
||||||
|
<div class="sidebar-section-header" @click="toggleSection('workspace')">
|
||||||
|
<div class="sidebar-section-title">
|
||||||
|
<span class="chevron" :class="{ open: sectionsOpen.workspace }" x-text="sectionsOpen.workspace ? '▼' : '▶'"></span>
|
||||||
|
<span>📁 Workspace</span>
|
||||||
|
</div>
|
||||||
|
<div class="sidebar-section-actions">
|
||||||
|
<button class="section-action-btn" title="New File" @click.stop="newPage('Private')">+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sidebar-section-items" x-show="sectionsOpen.workspace" x-transition>
|
||||||
|
<ul class="sidebar-items" data-section="workspace">
|
||||||
|
<li class="sidebar-item" onclick="window.location='/local-workspace'">
|
||||||
|
<span class="page-icon">📁</span><span class="page-name">My Workspace</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Meetings -->
|
<!-- Meetings -->
|
||||||
<div class="sidebar-section">
|
<div class="sidebar-section">
|
||||||
<div class="sidebar-section-header" @click="toggleSection('meetings')">
|
<div class="sidebar-section-header" @click="toggleSection('meetings')">
|
||||||
|
|||||||
Reference in New Issue
Block a user