mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix(github): label Copilot profiles by account identity (#2498)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
e79f9eddb4
commit
3a7a878f91
@@ -56,6 +56,17 @@ function upsert(db, c) {
|
||||
);
|
||||
}
|
||||
|
||||
function deriveConnectionName(data, fallbackName) {
|
||||
if (data.provider === "github") {
|
||||
return data.providerSpecificData?.githubLogin
|
||||
|| data.providerSpecificData?.githubEmail
|
||||
|| data.email
|
||||
|| data.providerSpecificData?.githubName
|
||||
|| fallbackName;
|
||||
}
|
||||
return fallbackName;
|
||||
}
|
||||
|
||||
export async function getProviderConnections(filter = {}) {
|
||||
const db = await getAdapter();
|
||||
const where = [];
|
||||
@@ -133,7 +144,7 @@ export async function createProviderConnection(data) {
|
||||
|
||||
let connectionName = data.name || null;
|
||||
if (!connectionName && (data.authType === "oauth" || data.authType === "access_token")) {
|
||||
connectionName = data.email || `Account ${all.length + 1}`;
|
||||
connectionName = deriveConnectionName(data, data.email || `Account ${all.length + 1}`);
|
||||
}
|
||||
let connectionPriority = data.priority;
|
||||
if (!connectionPriority) {
|
||||
|
||||
@@ -777,6 +777,9 @@ const PROVIDERS = {
|
||||
accessToken: tokens.access_token,
|
||||
refreshToken: tokens.refresh_token,
|
||||
expiresIn: tokens.expires_in,
|
||||
name: extra?.userInfo?.login || extra?.userInfo?.name,
|
||||
displayName: extra?.userInfo?.name || extra?.userInfo?.login,
|
||||
email: extra?.userInfo?.email || null,
|
||||
providerSpecificData: {
|
||||
copilotToken: extra?.copilotToken?.token,
|
||||
copilotTokenExpiresAt: extra?.copilotToken?.expires_at,
|
||||
|
||||
Reference in New Issue
Block a user