Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: update user session table

Stevenc18d6927ba96
diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go
index 742c2caf8..be34a2699 100644
--- a/server/router/api/v1/auth_service.go
+++ b/server/router/api/v1/auth_service.go
@@ -229,16 +229,6 @@ func (s *APIV1Service) DeleteSession(ctx context.Context, _ *v1pb.DeleteSessionR
}
}
- // Check if we have an access token (from header-based auth)
- if accessToken, ok := ctx.Value(accessTokenContextKey).(string); ok && accessToken != "" {
- // Delete the access token from the store
- if _, err := s.DeleteUserAccessToken(ctx, &v1pb.DeleteUserAccessTokenRequest{
- Name: fmt.Sprintf("%s%d/accessTokens/%s", UserNamePrefix, user.ID, accessToken),
- }); err != nil {
- slog.Error("failed to delete access token", "error", err)
- }
- }
-
if err := s.clearAuthCookies(ctx); err != nil {
return nil, status.Errorf(codes.Internal, "failed to clear auth cookies, error: %v", err)
}
diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx
index 5e72b6b83..5977ffe8d 100644
--- a/web/src/components/Navigation.tsx
+++ b/web/src/components/Navigation.tsx
@@ -71,7 +71,7 @@ const Navigation = observer((props: Props) => {
)}
>
<div className="w-full px-1 py-1 flex flex-col justify-start items-start space-y-2 overflow-auto overflow-x-hidden hide-scrollbar shrink">
- <NavLink className="mb-2 cursor-default" to={currentUser ? Routes.ROOT : Routes.EXPLORE}>
+ <NavLink className="mb-3 cursor-default" to={currentUser ? Routes.ROOT : Routes.EXPLORE}>
<BrandBanner collapsed={collapsed} />
</NavLink>
{navLinks.map((navLink) => (
diff --git a/web/src/components/Settings/UserSessionsSection.tsx b/web/src/components/Settings/UserSessionsSection.tsx
index 135d07f0d..74e8c800a 100644
--- a/web/src/components/Settings/UserSessionsSection.tsx
+++ b/web/src/components/Settings/UserSessionsSection.tsx
@@ -60,18 +60,6 @@ const UserSessionsSection = () => {
return parts.length > 0 ? parts.join(" • ") : "Unknown Device";
};
- const getSessionExpirationDate = (session: UserSession) => {
- if (!session.lastAccessedTime) return null;
- // Calculate expiration as last_accessed_time + 2 weeks (14 days)
- const expirationDate = new Date(session.lastAccessedTime.getTime() + 14 * 24 * 60 * 60 * 1000);
- return expirationDate;
- };
-
- const isSessionExpired = (session: UserSession) => {
- const expirationDate = getSessionExpirationDate(session);
- return expirationDate ? expirationDate < new Date() : false;
- };
-
const isCurrentSession = (session: UserSession) => {
// A simple heuristic: the most recently accessed session is likely the current one
if (userSessions.length === 0) return false;
@@ -103,9 +91,6 @@ const UserSessionsSection = () => {
<th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
{t("setting.user-sessions-section.last-active")}
</th>
- <th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
- {t("setting.user-sessions-section.expires")}
- </th>
<th scope="col" className="relative py-3.5 pl-3 pr-4">
<span className="sr-only">{t("common.delete")}</span>
</th>
@@ -137,15 +122,6 @@ const UserSessionsSection = () => {
<span>{userSession.lastAccessedTime?.toLocaleString()}</span>
</div>
</td>
- <td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">
- <div className="flex items-center space-x-1">
- <ClockIcon className="w-4 h-4" />
- <span>
- {getSessionExpirationDate(userSession)?.toLocaleString() ?? t("setting.user-sessions-section.never")}
- {isSessionExpired(userSession) && <span className="ml-2 text-red-600 text-xs">(Expired)</span>}
- </span>
- </div>
- </td>
<td className="relative whitespace-nowrap py-2 pl-3 pr-4 text-right text-sm">
<Button
variant="plain"