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:
Shxiao authored and GitHub committed 2026-09-08 18:18:46 +08:00
1 parent eecb02140f
commit 96de2314b0
6 files changed
+20 -16

No files matched your search

+2 -2
View File
@@ -860,7 +860,7 @@ export class OneBotMsgApi {
// 获取签名服务地址
let signUrl = this.obContext.configLoader.configData.musicSignUrl;
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('[音乐卡片签名] 首选地址失败,尝试备选地址...');
musicJson = await RequestUtil.HttpGetJson<string>(
'https://ss.xingzhige.com/music_card/card', //思思的音卡签名
'https://ss.xingzhige.com/music_card/card', // 思思的音卡签名
'POST',
postData
);
@@ -249,7 +249,7 @@ export class PluginLoader {
if (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字节
* @returns Base32编码的密钥
*/
static generateSecret(length: number = 16): string {
static generateSecret (length: number = 16): string {
const buffer = crypto.randomBytes(length);
return this.toBase32(buffer);
}
@@ -23,7 +23,7 @@ export class TotpHelper {
* @param window 允许的时间窗口(前后各多少个时间步长),默认1
* @returns 是否验证通过
*/
static verifyTotp(
static verifyTotp (
secret: string,
code: string,
timeStep: number = 30,
@@ -47,7 +47,7 @@ export class TotpHelper {
* @param counter 计数器
* @returns 6位数字验证码
*/
private static generateHotp(secret: string, counter: number): string {
private static generateHotp (secret: string, counter: number): string {
// 将 Base32 密钥转换为字节
const key = this.base32ToBytes(secret);
@@ -93,7 +93,7 @@ export class TotpHelper {
* @param issuer 发行方名称
* @returns otpauth:// URL
*/
static generateQrCodeUrl(
static generateQrCodeUrl (
secret: string,
account: string,
issuer: string
@@ -108,7 +108,7 @@ export class TotpHelper {
* @param buffer 字节数组
* @returns Base32编码字符串
*/
private static toBase32(buffer: Buffer): string {
private static toBase32 (buffer: Buffer): string {
const base32Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
let output = '';
@@ -138,7 +138,7 @@ export class TotpHelper {
* @param base32 Base32编码字符串
* @returns 字节数组
*/
private static base32ToBytes(base32: string): Buffer {
private static base32ToBytes (base32: string): Buffer {
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
const base32Clean = base32.toUpperCase().replace(/=+$/, '');
@@ -6,8 +6,8 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
import key from '@/const/key';
//把修改密码移动到WebUI栏目中
//import ChangePasswordCard from './change_password';
// 把修改密码移动到WebUI栏目中
// import ChangePasswordCard from './change_password';
import LoginConfigCard from './login';
import OneBotConfigCard from './onebot';
import ServerConfigCard from './server';
@@ -102,7 +102,7 @@ export default function ConfigPage () {
<LoginConfigCard />
</ConfigPageItem>
</Tab>
//把修改密码移动到WebUI栏目中
{/* 把修改密码移动到WebUI栏目中 */}
{
/*
<Tab title='修改密码' key='token'>
@@ -457,7 +457,8 @@ const WebUIConfigCard = () => {
</span>
</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='mb-3'>
@@ -484,7 +485,8 @@ const WebUIConfigCard = () => {
禁用双因素认证
</Button>
</div>
) : (
)
: (
<>
<div className='text-sm text-default-400 mb-2'>
启用双因素认证后,登录时需要额外输入Authenticator应用生成的验证码
@@ -238,7 +238,8 @@ export default function WebLoginPage () {
)}
{/* 2FA验证步骤 */}
{require2FA ? (
{require2FA
? (
<>
<Button
isIconOnly
@@ -307,7 +308,8 @@ export default function WebLoginPage () {
验证
</Button>
</>
) : (
)
: (
<>
<form
onSubmit={(e) => {