Skip to content

Commit

Permalink
fix: clear session token after sign out (#2888)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban authored Feb 25, 2025
1 parent 4d0a112 commit 2c632c3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions apps/main/src/constants/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export const GITHUB_REPO = process.env.GITHUB_REPO || "follow"

// https://github.com/electron/electron/issues/25081
export const START_IN_TRAY_ARGS = "--start-in-tray"

export const BETTER_AUTH_COOKIE_NAME_SESSION_TOKEN = "__Secure-better-auth.session_token"
8 changes: 8 additions & 0 deletions apps/main/src/tipc/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { fileURLToPath } from "node:url"

import { getRendererHandlers } from "@egoist/tipc/main"
import { callWindowExpose } from "@follow/shared/bridge"
import { env } from "@follow/shared/env"
import { app, BrowserWindow, clipboard, dialog, shell } from "electron"

import { BETTER_AUTH_COOKIE_NAME_SESSION_TOKEN } from "~/constants/app"
import { registerMenuAndContextMenu } from "~/init"
import { clearAllData, getCacheSize } from "~/lib/cleaner"
import { store, StoreKey } from "~/lib/store"
Expand Down Expand Up @@ -151,6 +153,12 @@ export const appRoute = {
cleanBetterAuthSessionCookie: t.procedure.action(async () => {
cleanBetterAuthSessionCookie()
cleanUser()

const mainWindow = getMainWindow()
await mainWindow?.webContents.session.cookies.remove(
env.VITE_API_URL,
BETTER_AUTH_COOKIE_NAME_SESSION_TOKEN,
)
}),
/// clipboard

Expand Down
6 changes: 1 addition & 5 deletions apps/mobile/src/modules/subscription/SubscriptionLists.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import type { FeedViewType } from "@follow/constants"
import type { FlashList } from "@shopify/flash-list"
import { router } from "expo-router"
import type { RefObject } from "react"
import { useContext, useEffect, useMemo, useRef, useState } from "react"
import type { ScrollView } from "react-native"
import { useMemo, useState } from "react"
import { Text } from "react-native"
import { useEventCallback } from "usehooks-ts"

import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable"
import { SetAttachNavigationScrollViewContext } from "@/src/components/ui/tabbar/contexts/AttachNavigationScrollViewContext"
import { useRegisterNavigationScrollView } from "@/src/components/ui/tabbar/hooks"
import { StarCuteFiIcon } from "@/src/icons/star_cute_fi"
import { closeDrawer, selectFeed } from "@/src/modules/screen/atoms"
Expand Down
5 changes: 2 additions & 3 deletions apps/mobile/src/screens/(stack)/(tabs)/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getDefaultHeaderHeight } from "@react-navigation/elements"
import { useIsFocused } from "@react-navigation/native"
import { createNativeStackNavigator } from "@react-navigation/native-stack"
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react"
import type { NativeScrollEvent, NativeSyntheticEvent, ScrollView } from "react-native"
import { createContext, useCallback, useContext, useEffect, useState } from "react"
import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native"
import { findNodeHandle, Text, UIManager } from "react-native"
import type { SharedValue } from "react-native-reanimated"
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated"
Expand All @@ -11,7 +11,6 @@ import { useEventCallback } from "usehooks-ts"

import { ReAnimatedScrollView } from "@/src/components/common/AnimatedComponents"
import { BlurEffect } from "@/src/components/common/BlurEffect"
import { SetAttachNavigationScrollViewContext } from "@/src/components/ui/tabbar/contexts/AttachNavigationScrollViewContext"
import { BottomTabBarBackgroundContext } from "@/src/components/ui/tabbar/contexts/BottomTabBarBackgroundContext"
import { SetBottomTabBarVisibleContext } from "@/src/components/ui/tabbar/contexts/BottomTabBarVisibleContext"
import {
Expand Down
1 change: 1 addition & 0 deletions changelog/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
## Bug Fixes

- The app is stuck after closing the dialog
- Can not sign in with email in the desktop app

0 comments on commit 2c632c3

Please sign in to comment.