refactor kiro auth flow and share account password service
This commit is contained in:
+24
-11
@@ -7,7 +7,7 @@
|
||||
const DEFAULT_KIRO_SOURCE_ID = 'kiro-rs';
|
||||
const DEFAULT_KIRO_RS_URL = 'https://kiro.leftcode.xyz/admin';
|
||||
const OPENAI_SOURCE_IDS = Object.freeze(['cpa', 'sub2api', 'codex2api']);
|
||||
const SHARED_SERVICE_IDS = Object.freeze(['email', 'proxy']);
|
||||
const SHARED_SERVICE_IDS = Object.freeze(['account', 'email', 'proxy']);
|
||||
|
||||
const DEFAULT_FLOW_CAPABILITIES = Object.freeze({
|
||||
supportsEmailSignup: true,
|
||||
@@ -37,7 +37,7 @@
|
||||
openai: {
|
||||
id: 'openai',
|
||||
label: 'Codex / OpenAI',
|
||||
services: ['email', 'proxy'],
|
||||
services: ['account', 'email', 'proxy'],
|
||||
capabilities: {
|
||||
...DEFAULT_FLOW_CAPABILITIES,
|
||||
supportsPhoneSignup: true,
|
||||
@@ -50,7 +50,6 @@
|
||||
stepDefinitionMode: 'openai-dynamic',
|
||||
},
|
||||
baseGroups: [
|
||||
'openai-account',
|
||||
'openai-plus',
|
||||
'openai-phone',
|
||||
'openai-oauth',
|
||||
@@ -203,7 +202,7 @@
|
||||
kiro: {
|
||||
id: 'kiro',
|
||||
label: 'Kiro',
|
||||
services: ['email', 'proxy'],
|
||||
services: ['account', 'email', 'proxy'],
|
||||
capabilities: {
|
||||
...DEFAULT_FLOW_CAPABILITIES,
|
||||
stepDefinitionMode: 'kiro-device-auth',
|
||||
@@ -225,7 +224,7 @@
|
||||
label: 'Kiro 授权页',
|
||||
readyPolicy: 'top-frame-only',
|
||||
family: 'kiro-device-auth-family',
|
||||
driverId: null,
|
||||
driverId: 'content/kiro-device-auth-page',
|
||||
cleanupScopes: [],
|
||||
},
|
||||
'kiro-rs-admin': {
|
||||
@@ -239,11 +238,25 @@
|
||||
},
|
||||
},
|
||||
driverDefinitions: {
|
||||
'content/kiro-device-auth-page': {
|
||||
sourceId: 'kiro-device-auth',
|
||||
commands: [
|
||||
'kiro-submit-email',
|
||||
'kiro-submit-name',
|
||||
'kiro-submit-verification-code',
|
||||
'kiro-fill-password',
|
||||
'kiro-confirm-access',
|
||||
],
|
||||
},
|
||||
'background/kiro-device-auth': {
|
||||
sourceId: 'kiro-device-auth',
|
||||
commands: [
|
||||
'kiro-start-device-login',
|
||||
'kiro-await-device-login',
|
||||
'kiro-submit-email',
|
||||
'kiro-submit-name',
|
||||
'kiro-submit-verification-code',
|
||||
'kiro-fill-password',
|
||||
'kiro-confirm-access',
|
||||
'kiro-upload-credential',
|
||||
],
|
||||
},
|
||||
@@ -252,6 +265,11 @@
|
||||
});
|
||||
|
||||
const SETTINGS_GROUP_DEFINITIONS = freezeDeep({
|
||||
'service-account': {
|
||||
id: 'service-account',
|
||||
label: '账户',
|
||||
rowIds: ['row-custom-password'],
|
||||
},
|
||||
'service-email': {
|
||||
id: 'service-email',
|
||||
label: '邮箱服务',
|
||||
@@ -283,11 +301,6 @@
|
||||
label: 'Codex2API 来源',
|
||||
rowIds: ['row-codex2api-url', 'row-codex2api-admin-key'],
|
||||
},
|
||||
'openai-account': {
|
||||
id: 'openai-account',
|
||||
label: '账户',
|
||||
rowIds: ['row-custom-password'],
|
||||
},
|
||||
'openai-plus': {
|
||||
id: 'openai-plus',
|
||||
label: 'Plus',
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
schemaVersion: 3,
|
||||
activeFlowId: defaultFlowId,
|
||||
services: {
|
||||
account: {
|
||||
customPassword: '',
|
||||
},
|
||||
email: {
|
||||
provider: '163',
|
||||
},
|
||||
@@ -91,9 +94,6 @@
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {
|
||||
customPassword: '',
|
||||
},
|
||||
signup: {
|
||||
signupMethod: 'email',
|
||||
phoneVerificationEnabled: false,
|
||||
@@ -131,7 +131,7 @@
|
||||
stepExecutionRange: {
|
||||
enabled: false,
|
||||
fromStep: 1,
|
||||
toStep: 3,
|
||||
toStep: 7,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -202,6 +202,14 @@
|
||||
?? defaults.services.proxy.mode
|
||||
).trim() || defaults.services.proxy.mode,
|
||||
},
|
||||
account: {
|
||||
customPassword: String(
|
||||
input?.customPassword
|
||||
?? nested?.services?.account?.customPassword
|
||||
?? nested?.flows?.openai?.account?.customPassword
|
||||
?? defaults.services.account.customPassword
|
||||
).trim(),
|
||||
},
|
||||
},
|
||||
flows: {
|
||||
openai: {
|
||||
@@ -242,9 +250,6 @@
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {
|
||||
customPassword: String(input?.customPassword ?? nested?.flows?.openai?.account?.customPassword ?? '').trim(),
|
||||
},
|
||||
signup: {
|
||||
signupMethod: String(input?.signupMethod ?? nested?.flows?.openai?.signup?.signupMethod ?? defaults.flows.openai.signup.signupMethod).trim().toLowerCase() === 'phone' ? 'phone' : 'email',
|
||||
phoneVerificationEnabled: Boolean(input?.phoneVerificationEnabled ?? nested?.flows?.openai?.signup?.phoneVerificationEnabled ?? defaults.flows.openai.signup.phoneVerificationEnabled),
|
||||
@@ -370,7 +375,7 @@
|
||||
next.sub2apiDefaultProxyName = openaiState.source.entries.sub2api.sub2apiDefaultProxyName;
|
||||
next.codex2apiUrl = openaiState.source.entries.codex2api.codex2apiUrl;
|
||||
next.codex2apiAdminKey = openaiState.source.entries.codex2api.codex2apiAdminKey;
|
||||
next.customPassword = openaiState.account.customPassword;
|
||||
next.customPassword = normalizedState.services.account.customPassword;
|
||||
next.signupMethod = openaiState.signup.signupMethod;
|
||||
next.phoneVerificationEnabled = openaiState.signup.phoneVerificationEnabled;
|
||||
next.phoneSignupReloginAfterBindEmailEnabled = openaiState.signup.phoneSignupReloginAfterBindEmailEnabled;
|
||||
|
||||
Reference in New Issue
Block a user