Replace password storage with token-based authentication for server switching

Co-authored-by: retardgerman <78982850+retardgerman@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-09-05 20:03:33 +00:00
parent 85929c2854
commit a377317710
3 changed files with 60 additions and 30 deletions

View File

@@ -11,10 +11,7 @@ interface Server {
serverName?: string;
serverId?: string;
lastUsername?: string;
savedCredentials?: {
username: string;
password: string;
};
savedToken?: string;
}
interface PreviousServersListProps {
@@ -58,7 +55,7 @@ export const PreviousServersList: React.FC<PreviousServersListProps> = ({
onPress={() => onServerSelect(s)}
title={getServerDisplayName(s)}
subtitle={getServerSubtitle(s)}
icon={s.savedCredentials ? "key" : "server"}
icon={s.savedToken ? "key" : "server"}
showArrow
/>
))}

View File

@@ -13,10 +13,7 @@ interface Server {
serverName?: string;
serverId?: string;
lastUsername?: string;
savedCredentials?: {
username: string;
password: string;
};
savedToken?: string;
}
interface Props extends ViewProps {}
@@ -54,8 +51,8 @@ export const ServerSwitcher: React.FC<Props> = ({ ...props }) => {
const getServerSubtitle = (server: Server) => {
if (server.lastUsername) {
const hasCredentials = !!server.savedCredentials;
return hasCredentials
const hasToken = !!server.savedToken;
return hasToken
? `${server.lastUsername} • Auto-login available`
: `Last user: ${server.lastUsername}`;
}
@@ -81,7 +78,7 @@ export const ServerSwitcher: React.FC<Props> = ({ ...props }) => {
onPress={() => handleServerSwitch(server)}
title={getServerDisplayName(server)}
subtitle={getServerSubtitle(server)}
icon={server.savedCredentials ? "key" : "server"}
icon={server.savedToken ? "key" : "server"}
showArrow
disabled={switchingServer === server.address}
/>