Merge branch 'develop' of https://github.com/getmaxun/maxun into develop

This commit is contained in:
amhsirak
2025-01-25 16:29:48 +05:30
2 changed files with 75 additions and 63 deletions

View File

@@ -76,7 +76,14 @@ interface RecordingsTableProps {
handleDuplicateRobot: (id: string, name: string, params: string[]) => void;
}
export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handleScheduleRecording, handleIntegrateRecording, handleSettingsRecording, handleEditRobot, handleDuplicateRobot }: RecordingsTableProps) => {
export const RecordingsTable = ({
handleEditRecording,
handleRunRecording,
handleScheduleRecording,
handleIntegrateRecording,
handleSettingsRecording,
handleEditRobot,
handleDuplicateRobot }: RecordingsTableProps) => {
const { t } = useTranslation();
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
@@ -109,7 +116,20 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handl
},
];
const { notify, setRecordings, browserId, setBrowserId, setInitialUrl, recordingUrl, setRecordingUrl, isLogin, setIsLogin, recordingName, setRecordingName, recordingId, setRecordingId } = useGlobalInfoStore();
const {
notify,
setRecordings,
browserId,
setBrowserId,
setInitialUrl,
recordingUrl,
setRecordingUrl,
isLogin,
setIsLogin,
recordingName,
setRecordingName,
recordingId,
setRecordingId } = useGlobalInfoStore();
const navigate = useNavigate();
const handleChangePage = (event: unknown, newPage: number) => {

View File

@@ -8,7 +8,6 @@ import { useGlobalInfoStore } from '../../context/globalInfo';
import { getStoredRecording, updateRecording } from '../../api/storage';
import { WhereWhatPair } from 'maxun-core';
// Base interfaces for robot data structure
interface RobotMeta {
name: string;
id: string;
@@ -55,7 +54,6 @@ interface RobotSettingsProps {
initialSettings?: RobotSettings | null;
}
// Enhanced interfaces for credential handling
interface CredentialInfo {
value: string;
type: string;
@@ -95,27 +93,20 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
const isUsernameSelector = (selector: string): boolean => {
return selector.toLowerCase().includes('username') ||
selector.toLowerCase().includes('user') ||
selector.toLowerCase().includes('email');
selector.toLowerCase().includes('user') ||
selector.toLowerCase().includes('email');
};
const determineCredentialType = (selector: string, info: CredentialInfo): 'password' | 'email' | 'username' | 'other' => {
// Check for password type first
if (info.type === 'password') {
if (info.type === 'password' || selector.toLowerCase().includes('password')) {
return 'password';
}
// Check for email patterns in the value or selector
if (isEmailPattern(info.value) || selector.toLowerCase().includes('email')) {
return 'email';
}
// Check for username patterns in the selector
if (isUsernameSelector(selector)) {
return 'username';
}
// If no specific pattern is matched, classify as other
return 'other';
};
@@ -161,6 +152,11 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
const character: string = action.args[1];
const inputType: string = action.args[2] || '';
// Detect `input[type="password"]`
if (!currentType && inputType.toLowerCase() === 'password') {
currentType = 'password';
}
// If we're dealing with a new selector, store the previous one
if (currentSelector && selector !== currentSelector) {
if (!credentials[currentSelector]) {
@@ -281,32 +277,28 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
const renderAllCredentialFields = () => {
return (
<>
{/* Render username credentials */}
{renderCredentialFields(
credentialGroups.usernames,
t('Username Credentials'),
'text' // Always show usernames as text
t('Username'),
'text'
)}
{/* Render email credentials */}
{renderCredentialFields(
credentialGroups.emails,
t('Email Credentials'),
'text' // Always show emails as text
t('Email'),
'text'
)}
{/* Render password credentials */}
{renderCredentialFields(
credentialGroups.passwords,
t('Password Credentials'),
'password' // Use password masking
t('Password'),
'password'
)}
{/* Render other credentials */}
{renderCredentialFields(
credentialGroups.others,
t('Other Credentials'),
'text' // Show other credentials as text
t('Other'),
'text'
)}
</>
);
@@ -317,30 +309,27 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
return (
<>
<Typography variant="h6" style={{ marginBottom: '20px'}}>
{/* <Typography variant="h6" style={{ marginBottom: '20px' }}>
{headerText}
</Typography>
{selectors.map((selector) => {
</Typography> */}
{selectors.map((selector, index) => {
const isVisible = showPasswords[selector];
return (
<TextField
key={selector}
// The type changes based on visibility state
type={isVisible ? 'text' : 'password'}
label={`Credential for ${selector}`}
label={headerText === 'Other' ? `${`Input`} ${index + 1}` : headerText}
value={credentials[selector]?.value || ''}
onChange={(e) => handleCredentialChange(selector, e.target.value)}
style={{ marginBottom: '20px' }}
InputProps={{
// Now showing visibility toggle for all fields
endAdornment: (
<InputAdornment position="end">
<IconButton
aria-label="toggle credential visibility"
aria-label="Show input"
onClick={() => handleClickShowPassword(selector)}
edge="end"
// Optional: disable if field is empty
disabled={!credentials[selector]?.value}
>
{isVisible ? <Visibility /> : <VisibilityOff />}
@@ -434,6 +423,9 @@ export const RobotEditModal = ({ isOpen, handleStart, handleClose, initialSettin
{(robot.isLogin || Object.keys(credentials).length > 0) && (
<>
<Typography variant="body1" style={{ marginBottom: '20px' }}>
{t('Input Texts')}
</Typography>
{renderAllCredentialFields()}
</>
)}