style: 修复主分支现存的 ESLint 错误 (#2046)
- 修复 7 个文件中全部 21 个 ESLint 错误(缩进、注释空格、引号、函数括号空格、三元表达式换行、JSX 缩进) - dashboard/config/index.tsx 中写在 JSX children 里的 // 注释会被当作文本节点渲染到 WebUI 配置页,改为 JSX 注释 - 验证:npx eslint . 退出码 0;pnpm run typecheck 全部包通过
This commit is contained in:
1 parent
eecb02140f
commit
96de2314b0
7 files changed
+254
-250
No files matched your search
@@ -490,10 +490,10 @@ export class NTQQWebApi {
|
|||||||
const client_key = Date.now() * 1000;
|
const client_key = Date.now() * 1000;
|
||||||
return await this.context.session.getAlbumService().doQunComment(
|
return await this.context.session.getAlbumService().doQunComment(
|
||||||
random_seq, {
|
random_seq, {
|
||||||
map_info: [],
|
map_info: [],
|
||||||
map_bytes_info: [],
|
map_bytes_info: [],
|
||||||
map_user_account: [],
|
map_user_account: [],
|
||||||
},
|
},
|
||||||
qunId,
|
qunId,
|
||||||
2,
|
2,
|
||||||
createAlbumMediaFeed(uin, albumId, lloc),
|
createAlbumMediaFeed(uin, albumId, lloc),
|
||||||
|
|||||||
@@ -860,7 +860,7 @@ export class OneBotMsgApi {
|
|||||||
// 获取签名服务地址
|
// 获取签名服务地址
|
||||||
let signUrl = this.obContext.configLoader.configData.musicSignUrl;
|
let signUrl = this.obContext.configLoader.configData.musicSignUrl;
|
||||||
if (!signUrl) {
|
if (!signUrl) {
|
||||||
signUrl = 'http://106.55.0.102:10087/'; //首选,yibai音卡签名,已更换稳定签名服务器
|
signUrl = 'http://106.55.0.102:10087/'; // 首选,yibai音卡签名,已更换稳定签名服务器
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求签名服务
|
// 请求签名服务
|
||||||
@@ -872,7 +872,7 @@ export class OneBotMsgApi {
|
|||||||
// 首选失败,降级到备选
|
// 首选失败,降级到备选
|
||||||
this.core.context.logger.logError('[音乐卡片签名] 首选地址失败,尝试备选地址...');
|
this.core.context.logger.logError('[音乐卡片签名] 首选地址失败,尝试备选地址...');
|
||||||
musicJson = await RequestUtil.HttpGetJson<string>(
|
musicJson = await RequestUtil.HttpGetJson<string>(
|
||||||
'https://ss.xingzhige.com/music_card/card', //思思的音卡签名
|
'https://ss.xingzhige.com/music_card/card', // 思思的音卡签名
|
||||||
'POST',
|
'POST',
|
||||||
postData
|
postData
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ export class PluginLoader {
|
|||||||
if (hit) {
|
if (hit) {
|
||||||
return `sensitive keyword "${hit}"`;
|
return `sensitive keyword "${hit}"`;
|
||||||
}
|
}
|
||||||
return "not in official plugin whitelist";
|
return 'not in official plugin whitelist';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class TotpHelper {
|
|||||||
* @param length 密钥长度(字节),默认16字节
|
* @param length 密钥长度(字节),默认16字节
|
||||||
* @returns Base32编码的密钥
|
* @returns Base32编码的密钥
|
||||||
*/
|
*/
|
||||||
static generateSecret(length: number = 16): string {
|
static generateSecret (length: number = 16): string {
|
||||||
const buffer = crypto.randomBytes(length);
|
const buffer = crypto.randomBytes(length);
|
||||||
return this.toBase32(buffer);
|
return this.toBase32(buffer);
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ export class TotpHelper {
|
|||||||
* @param window 允许的时间窗口(前后各多少个时间步长),默认1
|
* @param window 允许的时间窗口(前后各多少个时间步长),默认1
|
||||||
* @returns 是否验证通过
|
* @returns 是否验证通过
|
||||||
*/
|
*/
|
||||||
static verifyTotp(
|
static verifyTotp (
|
||||||
secret: string,
|
secret: string,
|
||||||
code: string,
|
code: string,
|
||||||
timeStep: number = 30,
|
timeStep: number = 30,
|
||||||
@@ -47,7 +47,7 @@ export class TotpHelper {
|
|||||||
* @param counter 计数器
|
* @param counter 计数器
|
||||||
* @returns 6位数字验证码
|
* @returns 6位数字验证码
|
||||||
*/
|
*/
|
||||||
private static generateHotp(secret: string, counter: number): string {
|
private static generateHotp (secret: string, counter: number): string {
|
||||||
// 将 Base32 密钥转换为字节
|
// 将 Base32 密钥转换为字节
|
||||||
const key = this.base32ToBytes(secret);
|
const key = this.base32ToBytes(secret);
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ export class TotpHelper {
|
|||||||
* @param issuer 发行方名称
|
* @param issuer 发行方名称
|
||||||
* @returns otpauth:// URL
|
* @returns otpauth:// URL
|
||||||
*/
|
*/
|
||||||
static generateQrCodeUrl(
|
static generateQrCodeUrl (
|
||||||
secret: string,
|
secret: string,
|
||||||
account: string,
|
account: string,
|
||||||
issuer: string
|
issuer: string
|
||||||
@@ -108,7 +108,7 @@ export class TotpHelper {
|
|||||||
* @param buffer 字节数组
|
* @param buffer 字节数组
|
||||||
* @returns Base32编码字符串
|
* @returns Base32编码字符串
|
||||||
*/
|
*/
|
||||||
private static toBase32(buffer: Buffer): string {
|
private static toBase32 (buffer: Buffer): string {
|
||||||
const base32Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
const base32Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ export class TotpHelper {
|
|||||||
* @param base32 Base32编码字符串
|
* @param base32 Base32编码字符串
|
||||||
* @returns 字节数组
|
* @returns 字节数组
|
||||||
*/
|
*/
|
||||||
private static base32ToBytes(base32: string): Buffer {
|
private static base32ToBytes (base32: string): Buffer {
|
||||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||||
const base32Clean = base32.toUpperCase().replace(/=+$/, '');
|
const base32Clean = base32.toUpperCase().replace(/=+$/, '');
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
|
|||||||
|
|
||||||
import key from '@/const/key';
|
import key from '@/const/key';
|
||||||
|
|
||||||
//把修改密码移动到WebUI栏目中
|
// 把修改密码移动到WebUI栏目中
|
||||||
//import ChangePasswordCard from './change_password';
|
// import ChangePasswordCard from './change_password';
|
||||||
import LoginConfigCard from './login';
|
import LoginConfigCard from './login';
|
||||||
import OneBotConfigCard from './onebot';
|
import OneBotConfigCard from './onebot';
|
||||||
import ServerConfigCard from './server';
|
import ServerConfigCard from './server';
|
||||||
@@ -102,7 +102,7 @@ export default function ConfigPage () {
|
|||||||
<LoginConfigCard />
|
<LoginConfigCard />
|
||||||
</ConfigPageItem>
|
</ConfigPageItem>
|
||||||
</Tab>
|
</Tab>
|
||||||
//把修改密码移动到WebUI栏目中
|
{/* 把修改密码移动到WebUI栏目中 */}
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
<Tab title='修改密码' key='token'>
|
<Tab title='修改密码' key='token'>
|
||||||
|
|||||||
@@ -457,99 +457,101 @@ const WebUIConfigCard = () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{twoFAStatus.enable2FA ? (
|
{twoFAStatus.enable2FA
|
||||||
<div className='bg-green-50 border border-green-200 rounded-lg p-4'>
|
? (
|
||||||
<div className='text-sm text-green-700 mb-3'>✅ 双因素认证已启用</div>
|
<div className='bg-green-50 border border-green-200 rounded-lg p-4'>
|
||||||
<div className='mb-3'>
|
<div className='text-sm text-green-700 mb-3'>✅ 双因素认证已启用</div>
|
||||||
<div className='text-sm text-default-600 mb-2'>输入验证码以禁用</div>
|
<div className='mb-3'>
|
||||||
<input
|
<div className='text-sm text-default-600 mb-2'>输入验证码以禁用</div>
|
||||||
type='text'
|
<input
|
||||||
inputMode='numeric'
|
type='text'
|
||||||
pattern='[0-9]*'
|
inputMode='numeric'
|
||||||
maxLength={6}
|
pattern='[0-9]*'
|
||||||
value={disableTotpCode}
|
maxLength={6}
|
||||||
onChange={(e) => setDisableTotpCode(e.target.value.replace(/\D/g, ''))}
|
value={disableTotpCode}
|
||||||
placeholder='000000'
|
onChange={(e) => setDisableTotpCode(e.target.value.replace(/\D/g, ''))}
|
||||||
className='w-32 px-3 py-2 border border-default-300 rounded-lg text-center text-lg tracking-widest'
|
placeholder='000000'
|
||||||
/>
|
className='w-32 px-3 py-2 border border-default-300 rounded-lg text-center text-lg tracking-widest'
|
||||||
</div>
|
/>
|
||||||
<Button
|
</div>
|
||||||
color='danger'
|
|
||||||
variant='flat'
|
|
||||||
onPress={disableTwoFA}
|
|
||||||
isLoading={isDisabling2FA}
|
|
||||||
disabled={!disableTotpCode || disableTotpCode.length !== 6}
|
|
||||||
className='w-fit'
|
|
||||||
>
|
|
||||||
禁用双因素认证
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<div className='text-sm text-default-400 mb-2'>
|
|
||||||
启用双因素认证后,登录时需要额外输入Authenticator应用生成的验证码
|
|
||||||
</div>
|
|
||||||
<div className='bg-default-50 border border-default-200 rounded-lg p-4'>
|
|
||||||
<Button
|
<Button
|
||||||
color='secondary'
|
color='danger'
|
||||||
variant='flat'
|
variant='flat'
|
||||||
onPress={generateTwoFASecret}
|
onPress={disableTwoFA}
|
||||||
isLoading={isGeneratingSecret}
|
isLoading={isDisabling2FA}
|
||||||
className='w-fit mb-4'
|
disabled={!disableTotpCode || disableTotpCode.length !== 6}
|
||||||
|
className='w-fit'
|
||||||
>
|
>
|
||||||
<IoQrCode className='mr-2' />
|
禁用双因素认证
|
||||||
生成密钥
|
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<>
|
||||||
|
<div className='text-sm text-default-400 mb-2'>
|
||||||
|
启用双因素认证后,登录时需要额外输入Authenticator应用生成的验证码
|
||||||
|
</div>
|
||||||
|
<div className='bg-default-50 border border-default-200 rounded-lg p-4'>
|
||||||
|
<Button
|
||||||
|
color='secondary'
|
||||||
|
variant='flat'
|
||||||
|
onPress={generateTwoFASecret}
|
||||||
|
isLoading={isGeneratingSecret}
|
||||||
|
className='w-fit mb-4'
|
||||||
|
>
|
||||||
|
<IoQrCode className='mr-2' />
|
||||||
|
生成密钥
|
||||||
|
</Button>
|
||||||
|
|
||||||
{twoFASecret && (
|
{twoFASecret && (
|
||||||
<>
|
<>
|
||||||
<div className='mb-4'>
|
<div className='mb-4'>
|
||||||
<div className='text-sm text-default-600 mb-2'>请使用 Authenticator 应用扫描下方二维码</div>
|
<div className='text-sm text-default-600 mb-2'>请使用 Authenticator 应用扫描下方二维码</div>
|
||||||
<div className='flex items-center gap-4'>
|
<div className='flex items-center gap-4'>
|
||||||
<div className='bg-white border border-default-300 rounded-lg p-3'>
|
<div className='bg-white border border-default-300 rounded-lg p-3'>
|
||||||
<QRCodeSVG
|
<QRCodeSVG
|
||||||
value={twoFAQrCodeUrl}
|
value={twoFAQrCodeUrl}
|
||||||
size={128}
|
size={128}
|
||||||
level='M'
|
level='M'
|
||||||
includeMargin={false}
|
includeMargin={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className='text-xs text-default-500 mb-1'>密钥(手动输入用)</div>
|
<div className='text-xs text-default-500 mb-1'>密钥(手动输入用)</div>
|
||||||
<div className='font-mono text-sm bg-default-100 px-3 py-2 rounded break-all max-w-[200px]'>
|
<div className='font-mono text-sm bg-default-100 px-3 py-2 rounded break-all max-w-[200px]'>
|
||||||
{twoFASecret}
|
{twoFASecret}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className='mb-4'>
|
||||||
<div className='mb-4'>
|
<div className='text-sm text-default-600 mb-2'>输入Authenticator验证码</div>
|
||||||
<div className='text-sm text-default-600 mb-2'>输入Authenticator验证码</div>
|
<input
|
||||||
<input
|
type='text'
|
||||||
type='text'
|
inputMode='numeric'
|
||||||
inputMode='numeric'
|
pattern='[0-9]*'
|
||||||
pattern='[0-9]*'
|
maxLength={6}
|
||||||
maxLength={6}
|
value={twoFATotpCode}
|
||||||
value={twoFATotpCode}
|
onChange={(e) => setTwoFATotpCode(e.target.value.replace(/\D/g, ''))}
|
||||||
onChange={(e) => setTwoFATotpCode(e.target.value.replace(/\D/g, ''))}
|
placeholder='000000'
|
||||||
placeholder='000000'
|
className='w-32 px-3 py-2 border border-default-300 rounded-lg text-center text-lg tracking-widest'
|
||||||
className='w-32 px-3 py-2 border border-default-300 rounded-lg text-center text-lg tracking-widest'
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
<Button
|
||||||
<Button
|
color='primary'
|
||||||
color='primary'
|
variant='flat'
|
||||||
variant='flat'
|
onPress={enableTwoFA}
|
||||||
onPress={enableTwoFA}
|
isLoading={isEnabling2FA}
|
||||||
isLoading={isEnabling2FA}
|
disabled={!twoFATotpCode || twoFATotpCode.length !== 6}
|
||||||
disabled={!twoFATotpCode || twoFATotpCode.length !== 6}
|
className='w-fit'
|
||||||
className='w-fit'
|
>
|
||||||
>
|
启用双因素认证
|
||||||
启用双因素认证
|
</Button>
|
||||||
</Button>
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
</div>
|
||||||
</div>
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SaveButtons
|
<SaveButtons
|
||||||
|
|||||||
@@ -238,159 +238,161 @@ export default function WebLoginPage () {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 2FA验证步骤 */}
|
{/* 2FA验证步骤 */}
|
||||||
{require2FA ? (
|
{require2FA
|
||||||
<>
|
? (
|
||||||
<Button
|
<>
|
||||||
isIconOnly
|
<Button
|
||||||
variant='light'
|
isIconOnly
|
||||||
className='self-start -ml-2'
|
variant='light'
|
||||||
onPress={goBackToToken}
|
className='self-start -ml-2'
|
||||||
>
|
onPress={goBackToToken}
|
||||||
<IoArrowBack size={20} />
|
>
|
||||||
</Button>
|
<IoArrowBack size={20} />
|
||||||
<div className='text-center text-default-600 dark:text-default-400'>
|
</Button>
|
||||||
请输入Authenticator中的验证码
|
<div className='text-center text-default-600 dark:text-default-400'>
|
||||||
</div>
|
请输入Authenticator中的验证码
|
||||||
<form
|
</div>
|
||||||
onSubmit={(e) => {
|
<form
|
||||||
e.preventDefault();
|
onSubmit={(e) => {
|
||||||
onSubmit2FA();
|
e.preventDefault();
|
||||||
}}
|
onSubmit2FA();
|
||||||
>
|
|
||||||
<Input
|
|
||||||
type='text'
|
|
||||||
inputMode='numeric'
|
|
||||||
pattern='[0-9]*'
|
|
||||||
maxLength={6}
|
|
||||||
classNames={{
|
|
||||||
label: 'text-black/50 dark:text-white/90',
|
|
||||||
input: [
|
|
||||||
'bg-transparent',
|
|
||||||
'text-black/90 dark:text-white/90',
|
|
||||||
'placeholder:text-default-700/50 dark:placeholder:text-white/60',
|
|
||||||
],
|
|
||||||
innerWrapper: 'bg-transparent',
|
|
||||||
inputWrapper: [
|
|
||||||
'shadow-xl',
|
|
||||||
'bg-default-100/70',
|
|
||||||
'dark:bg-default/60',
|
|
||||||
'backdrop-blur-xl',
|
|
||||||
'backdrop-saturate-200',
|
|
||||||
'hover:bg-default-0/70',
|
|
||||||
'dark:hover:bg-default/70',
|
|
||||||
'group-data-[focus=true]:bg-default-100/50',
|
|
||||||
'dark:group-data-[focus=true]:bg-default/60',
|
|
||||||
'!cursor-text',
|
|
||||||
],
|
|
||||||
}}
|
}}
|
||||||
isDisabled={isLoading}
|
>
|
||||||
label='验证码'
|
<Input
|
||||||
placeholder='请输入6位验证码'
|
type='text'
|
||||||
radius='lg'
|
inputMode='numeric'
|
||||||
size='lg'
|
pattern='[0-9]*'
|
||||||
startContent={
|
maxLength={6}
|
||||||
<IoKeyOutline className='text-black/50 mb-0.5 dark:text-white/90 text-slate-400 pointer-events-none flex-shrink-0' />
|
|
||||||
}
|
|
||||||
value={totpCode}
|
|
||||||
onChange={(e) => setTotpCode(e.target.value.replace(/\D/g, ''))}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
<Button
|
|
||||||
className='mx-10 mt-10 text-lg py-7'
|
|
||||||
color='primary'
|
|
||||||
isLoading={isLoading}
|
|
||||||
radius='full'
|
|
||||||
size='lg'
|
|
||||||
variant='shadow'
|
|
||||||
onPress={onSubmit2FA}
|
|
||||||
>
|
|
||||||
验证
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<form
|
|
||||||
onSubmit={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
onSubmitToken();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* 隐藏的用户名字段,帮助浏览器识别登录表单 */}
|
|
||||||
<input
|
|
||||||
type='text'
|
|
||||||
name='username'
|
|
||||||
value='napcat-webui'
|
|
||||||
autoComplete='username'
|
|
||||||
className='absolute -left-[9999px] opacity-0 pointer-events-none'
|
|
||||||
readOnly
|
|
||||||
tabIndex={-1}
|
|
||||||
aria-label='Username'
|
|
||||||
/>
|
|
||||||
<Input
|
|
||||||
isClearable
|
|
||||||
type='password'
|
|
||||||
name='password'
|
|
||||||
autoComplete='current-password'
|
|
||||||
classNames={{
|
|
||||||
label: 'text-black/50 dark:text-white/90',
|
|
||||||
input: [
|
|
||||||
'bg-transparent',
|
|
||||||
'text-black/90 dark:text-white/90',
|
|
||||||
'placeholder:text-default-700/50 dark:placeholder:text-white/60',
|
|
||||||
],
|
|
||||||
innerWrapper: 'bg-transparent',
|
|
||||||
inputWrapper: [
|
|
||||||
'shadow-xl',
|
|
||||||
'bg-default-100/70',
|
|
||||||
'dark:bg-default/60',
|
|
||||||
'backdrop-blur-xl',
|
|
||||||
'backdrop-saturate-200',
|
|
||||||
'hover:bg-default-0/70',
|
|
||||||
'dark:hover:bg-default/70',
|
|
||||||
'group-data-[focus=true]:bg-default-100/50',
|
|
||||||
'dark:group-data-[focus=true]:bg-default/60',
|
|
||||||
'!cursor-text',
|
|
||||||
],
|
|
||||||
}}
|
|
||||||
isDisabled={isLoading || isPasskeyLoading}
|
|
||||||
label='Token'
|
|
||||||
placeholder='请输入token'
|
|
||||||
radius='lg'
|
|
||||||
size='lg'
|
|
||||||
startContent={
|
|
||||||
<IoKeyOutline className='text-black/50 mb-0.5 dark:text-white/90 text-slate-400 pointer-events-none flex-shrink-0' />
|
|
||||||
}
|
|
||||||
value={tokenValue}
|
|
||||||
onChange={(e) => setTokenValue(e.target.value)}
|
|
||||||
onClear={() => setTokenValue('')}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
<div className='text-center text-small text-default-600 dark:text-default-400 px-2'>
|
|
||||||
💡 提示:请从 NapCat 启动日志中查看登录密钥
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
className='mx-10 mt-10 text-lg py-7'
|
|
||||||
color='primary'
|
|
||||||
isLoading={isLoading}
|
|
||||||
radius='full'
|
|
||||||
size='lg'
|
|
||||||
variant='shadow'
|
|
||||||
onPress={onSubmitToken}
|
|
||||||
>
|
|
||||||
{!isLoading && (
|
|
||||||
<Image
|
|
||||||
alt='logo'
|
|
||||||
classNames={{
|
classNames={{
|
||||||
wrapper: '-ml-8',
|
label: 'text-black/50 dark:text-white/90',
|
||||||
|
input: [
|
||||||
|
'bg-transparent',
|
||||||
|
'text-black/90 dark:text-white/90',
|
||||||
|
'placeholder:text-default-700/50 dark:placeholder:text-white/60',
|
||||||
|
],
|
||||||
|
innerWrapper: 'bg-transparent',
|
||||||
|
inputWrapper: [
|
||||||
|
'shadow-xl',
|
||||||
|
'bg-default-100/70',
|
||||||
|
'dark:bg-default/60',
|
||||||
|
'backdrop-blur-xl',
|
||||||
|
'backdrop-saturate-200',
|
||||||
|
'hover:bg-default-0/70',
|
||||||
|
'dark:hover:bg-default/70',
|
||||||
|
'group-data-[focus=true]:bg-default-100/50',
|
||||||
|
'dark:group-data-[focus=true]:bg-default/60',
|
||||||
|
'!cursor-text',
|
||||||
|
],
|
||||||
}}
|
}}
|
||||||
height='2em'
|
isDisabled={isLoading}
|
||||||
src={logo}
|
label='验证码'
|
||||||
|
placeholder='请输入6位验证码'
|
||||||
|
radius='lg'
|
||||||
|
size='lg'
|
||||||
|
startContent={
|
||||||
|
<IoKeyOutline className='text-black/50 mb-0.5 dark:text-white/90 text-slate-400 pointer-events-none flex-shrink-0' />
|
||||||
|
}
|
||||||
|
value={totpCode}
|
||||||
|
onChange={(e) => setTotpCode(e.target.value.replace(/\D/g, ''))}
|
||||||
/>
|
/>
|
||||||
)}
|
</form>
|
||||||
登录
|
<Button
|
||||||
</Button>
|
className='mx-10 mt-10 text-lg py-7'
|
||||||
</>
|
color='primary'
|
||||||
)}
|
isLoading={isLoading}
|
||||||
|
radius='full'
|
||||||
|
size='lg'
|
||||||
|
variant='shadow'
|
||||||
|
onPress={onSubmit2FA}
|
||||||
|
>
|
||||||
|
验证
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<>
|
||||||
|
<form
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
onSubmitToken();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* 隐藏的用户名字段,帮助浏览器识别登录表单 */}
|
||||||
|
<input
|
||||||
|
type='text'
|
||||||
|
name='username'
|
||||||
|
value='napcat-webui'
|
||||||
|
autoComplete='username'
|
||||||
|
className='absolute -left-[9999px] opacity-0 pointer-events-none'
|
||||||
|
readOnly
|
||||||
|
tabIndex={-1}
|
||||||
|
aria-label='Username'
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
isClearable
|
||||||
|
type='password'
|
||||||
|
name='password'
|
||||||
|
autoComplete='current-password'
|
||||||
|
classNames={{
|
||||||
|
label: 'text-black/50 dark:text-white/90',
|
||||||
|
input: [
|
||||||
|
'bg-transparent',
|
||||||
|
'text-black/90 dark:text-white/90',
|
||||||
|
'placeholder:text-default-700/50 dark:placeholder:text-white/60',
|
||||||
|
],
|
||||||
|
innerWrapper: 'bg-transparent',
|
||||||
|
inputWrapper: [
|
||||||
|
'shadow-xl',
|
||||||
|
'bg-default-100/70',
|
||||||
|
'dark:bg-default/60',
|
||||||
|
'backdrop-blur-xl',
|
||||||
|
'backdrop-saturate-200',
|
||||||
|
'hover:bg-default-0/70',
|
||||||
|
'dark:hover:bg-default/70',
|
||||||
|
'group-data-[focus=true]:bg-default-100/50',
|
||||||
|
'dark:group-data-[focus=true]:bg-default/60',
|
||||||
|
'!cursor-text',
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
isDisabled={isLoading || isPasskeyLoading}
|
||||||
|
label='Token'
|
||||||
|
placeholder='请输入token'
|
||||||
|
radius='lg'
|
||||||
|
size='lg'
|
||||||
|
startContent={
|
||||||
|
<IoKeyOutline className='text-black/50 mb-0.5 dark:text-white/90 text-slate-400 pointer-events-none flex-shrink-0' />
|
||||||
|
}
|
||||||
|
value={tokenValue}
|
||||||
|
onChange={(e) => setTokenValue(e.target.value)}
|
||||||
|
onClear={() => setTokenValue('')}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
<div className='text-center text-small text-default-600 dark:text-default-400 px-2'>
|
||||||
|
💡 提示:请从 NapCat 启动日志中查看登录密钥
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
className='mx-10 mt-10 text-lg py-7'
|
||||||
|
color='primary'
|
||||||
|
isLoading={isLoading}
|
||||||
|
radius='full'
|
||||||
|
size='lg'
|
||||||
|
variant='shadow'
|
||||||
|
onPress={onSubmitToken}
|
||||||
|
>
|
||||||
|
{!isLoading && (
|
||||||
|
<Image
|
||||||
|
alt='logo'
|
||||||
|
classNames={{
|
||||||
|
wrapper: '-ml-8',
|
||||||
|
}}
|
||||||
|
height='2em'
|
||||||
|
src={logo}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
登录
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</CardBody>
|
</CardBody>
|
||||||
</HoverEffectCard>
|
</HoverEffectCard>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|||||||
Reference in new issue
Block a user