完善虎牙自动注册改密
This commit is contained in:
@@ -179,18 +179,26 @@ export interface HuyaAutoRegisterRequest {
|
||||
concurrency?: number;
|
||||
wait_seconds?: number;
|
||||
poll_interval?: number;
|
||||
password_prefix?: string;
|
||||
fixed_password?: string;
|
||||
}
|
||||
|
||||
export interface HuyaAutoRegisterItem {
|
||||
line: number;
|
||||
phone: string;
|
||||
provider: string;
|
||||
sms_url: string;
|
||||
status: string;
|
||||
message: string;
|
||||
code: string;
|
||||
change_code: string;
|
||||
attempts: number;
|
||||
change_attempts: number;
|
||||
account_id: number | null;
|
||||
username: string;
|
||||
uid: string;
|
||||
password: string;
|
||||
password_changed: boolean;
|
||||
cookie: string;
|
||||
cookie_preview: string;
|
||||
started_at: string | null;
|
||||
@@ -206,6 +214,7 @@ export interface HuyaAutoRegisterBatch {
|
||||
concurrency: number;
|
||||
wait_seconds: number;
|
||||
poll_interval: number;
|
||||
password_prefix: string;
|
||||
total: number;
|
||||
success_count: number;
|
||||
failed_count: number;
|
||||
|
||||
@@ -22,6 +22,7 @@ const STATUS_LABELS: Record<string, string> = {
|
||||
updated: '已更新',
|
||||
password_imported: '待登录',
|
||||
login_success: '登录成功',
|
||||
password_changed: '已改密',
|
||||
login_failed: '登录失败',
|
||||
active: '正常',
|
||||
invalid: '失效',
|
||||
@@ -32,6 +33,7 @@ const STATUS_COLORS: Record<string, string> = {
|
||||
updated: 'cyan',
|
||||
password_imported: 'warning',
|
||||
login_success: 'success',
|
||||
password_changed: 'success',
|
||||
login_failed: 'error',
|
||||
active: 'success',
|
||||
invalid: 'error',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
Button, Card, Col, Input, InputNumber, message, Row, Space, Statistic, Table, Tag, Typography,
|
||||
Button, Card, Col, Input, InputNumber, message, Row, Segmented, Space, Statistic, Table, Tag, Typography,
|
||||
} from 'antd';
|
||||
import type { TableProps } from 'antd';
|
||||
import { DownloadOutlined, PlayCircleOutlined, ReloadOutlined, StopOutlined } from '@ant-design/icons';
|
||||
@@ -16,6 +16,7 @@ const STATUS_LABELS: Record<string, string> = {
|
||||
sending: '发码',
|
||||
waiting: '等待验证码',
|
||||
logging: '保存',
|
||||
changing: '改密',
|
||||
success: '成功',
|
||||
error: '失败',
|
||||
stopped: '已停止',
|
||||
@@ -26,6 +27,7 @@ const STATUS_COLORS: Record<string, string> = {
|
||||
sending: 'processing',
|
||||
waiting: 'processing',
|
||||
logging: 'processing',
|
||||
changing: 'processing',
|
||||
success: 'success',
|
||||
error: 'error',
|
||||
stopped: 'warning',
|
||||
@@ -39,6 +41,9 @@ export default function HuyaRegisterPage() {
|
||||
const [concurrency, setConcurrency] = useState(1);
|
||||
const [waitSeconds, setWaitSeconds] = useState(180);
|
||||
const [pollInterval, setPollInterval] = useState(5);
|
||||
const [passwordMode, setPasswordMode] = useState<'random' | 'fixed'>('random');
|
||||
const [passwordPrefix, setPasswordPrefix] = useState('hy');
|
||||
const [fixedPassword, setFixedPassword] = useState('');
|
||||
const [batch, setBatch] = useState<HuyaAutoRegisterBatch | null>(null);
|
||||
const [starting, setStarting] = useState(false);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
@@ -69,7 +74,7 @@ export default function HuyaRegisterPage() {
|
||||
}, [batchId, isRunning, refreshBatch]);
|
||||
|
||||
const successRows = useMemo(
|
||||
() => (batch?.items || []).filter((item) => item.status === 'success' && item.cookie),
|
||||
() => (batch?.items || []).filter((item) => item.status === 'success' && item.password && (item.username || item.uid)),
|
||||
[batch],
|
||||
);
|
||||
|
||||
@@ -78,6 +83,10 @@ export default function HuyaRegisterPage() {
|
||||
message.warning('请先粘贴手机号池');
|
||||
return;
|
||||
}
|
||||
if (passwordMode === 'fixed' && !fixedPassword.trim()) {
|
||||
message.warning('请先填写固定密码');
|
||||
return;
|
||||
}
|
||||
setStarting(true);
|
||||
try {
|
||||
const data = await huyaApi.startAutoRegister({
|
||||
@@ -86,6 +95,8 @@ export default function HuyaRegisterPage() {
|
||||
concurrency,
|
||||
wait_seconds: waitSeconds,
|
||||
poll_interval: pollInterval,
|
||||
password_prefix: passwordMode === 'random' ? (passwordPrefix.trim() || 'hy') : 'hy',
|
||||
fixed_password: passwordMode === 'fixed' ? fixedPassword.trim() : '',
|
||||
});
|
||||
setBatch(data);
|
||||
message.success('自动注册批次已启动');
|
||||
@@ -112,15 +123,17 @@ export default function HuyaRegisterPage() {
|
||||
|
||||
const handleExportSuccess = () => {
|
||||
if (successRows.length === 0) {
|
||||
message.warning('当前批次没有可导出的成功 CK');
|
||||
message.warning('当前批次没有可导出的成功账号');
|
||||
return;
|
||||
}
|
||||
const body = successRows.map((item) => `${item.phone}----${item.cookie}`).join('\n');
|
||||
const body = successRows
|
||||
.map((item) => `${item.username || item.uid}----${item.password}----${item.phone}----${item.sms_url}`)
|
||||
.join('\n');
|
||||
const blob = new Blob([body], { type: 'text/plain;charset=utf-8' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = `huya-register-${batchId || 'success'}.txt`;
|
||||
link.download = `huya-register-accounts-${batchId || 'success'}.txt`;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
@@ -128,6 +141,17 @@ export default function HuyaRegisterPage() {
|
||||
const columns: TableProps<HuyaAutoRegisterItem>['columns'] = [
|
||||
{ title: '行', dataIndex: 'line', width: 64 },
|
||||
{ title: '手机号', dataIndex: 'phone', width: 150 },
|
||||
{
|
||||
title: '虎牙号',
|
||||
width: 150,
|
||||
render: (_, item) => item.username || item.uid || '-',
|
||||
},
|
||||
{
|
||||
title: '密码',
|
||||
dataIndex: 'password',
|
||||
width: 130,
|
||||
render: (value: string) => value || '-',
|
||||
},
|
||||
{ title: '平台', dataIndex: 'provider', width: 90 },
|
||||
{
|
||||
title: '状态',
|
||||
@@ -139,20 +163,18 @@ export default function HuyaRegisterPage() {
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{ title: '验证码', dataIndex: 'code', width: 100 },
|
||||
{ title: '轮询', dataIndex: 'attempts', width: 80 },
|
||||
{ title: '注册码', dataIndex: 'code', width: 100 },
|
||||
{ title: '改密码', dataIndex: 'change_code', width: 100 },
|
||||
{
|
||||
title: '轮询',
|
||||
width: 90,
|
||||
render: (_, item) => `${item.attempts}/${item.change_attempts}`,
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
width: 160,
|
||||
render: (_, item) => item.uid || (item.account_id ? `#${item.account_id}` : '-'),
|
||||
},
|
||||
{
|
||||
title: 'Cookie',
|
||||
dataIndex: 'cookie_preview',
|
||||
width: 220,
|
||||
ellipsis: true,
|
||||
render: (value: string) => value || '-',
|
||||
},
|
||||
{
|
||||
title: '消息',
|
||||
dataIndex: 'message',
|
||||
@@ -223,6 +245,35 @@ export default function HuyaRegisterPage() {
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} md={8}>
|
||||
<Text type="secondary">密码设置</Text>
|
||||
<Space.Compact style={{ width: '100%' }}>
|
||||
<Segmented
|
||||
value={passwordMode}
|
||||
options={[
|
||||
{ label: '随机', value: 'random' },
|
||||
{ label: '固定', value: 'fixed' },
|
||||
]}
|
||||
onChange={(value) => setPasswordMode(value as 'random' | 'fixed')}
|
||||
disabled={isRunning}
|
||||
/>
|
||||
{passwordMode === 'random' ? (
|
||||
<Input
|
||||
value={passwordPrefix}
|
||||
maxLength={8}
|
||||
onChange={(event) => setPasswordPrefix(event.target.value)}
|
||||
disabled={isRunning}
|
||||
/>
|
||||
) : (
|
||||
<Input.Password
|
||||
value={fixedPassword}
|
||||
maxLength={64}
|
||||
onChange={(event) => setFixedPassword(event.target.value)}
|
||||
disabled={isRunning}
|
||||
/>
|
||||
)}
|
||||
</Space.Compact>
|
||||
</Col>
|
||||
<Col xs={24} md={4}>
|
||||
<Space style={{ width: '100%', paddingTop: 22 }}>
|
||||
<Button
|
||||
@@ -257,7 +308,7 @@ export default function HuyaRegisterPage() {
|
||||
刷新
|
||||
</Button>
|
||||
<Button icon={<DownloadOutlined />} disabled={successRows.length === 0} onClick={handleExportSuccess}>
|
||||
导出成功 CK
|
||||
导出账号
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
@@ -276,7 +327,7 @@ export default function HuyaRegisterPage() {
|
||||
dataSource={batch?.items || []}
|
||||
loading={refreshing && !isRunning}
|
||||
pagination={{ pageSize: 20, showSizeChanger: true }}
|
||||
scroll={{ x: 1280 }}
|
||||
scroll={{ x: 1320 }}
|
||||
/>
|
||||
</Card>
|
||||
</Space>
|
||||
|
||||
Reference in New Issue
Block a user