mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-02 16:16:39 +08:00
优化认证
This commit is contained in:
parent
070f143541
commit
f5874a4d3d
@ -1,4 +1,3 @@
|
|||||||
// "use client";
|
|
||||||
import { Button, Input, Space } from "antd";
|
import { Button, Input, Space } from "antd";
|
||||||
import {
|
import {
|
||||||
Dispatch,
|
Dispatch,
|
||||||
@ -41,7 +40,11 @@ export default function VoiceInput({
|
|||||||
setAccessToken(result.result);
|
setAccessToken(result.result);
|
||||||
};
|
};
|
||||||
if (accessToken === "") {
|
if (accessToken === "") {
|
||||||
get_access_token();
|
try {
|
||||||
|
get_access_token();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[get_access_token]", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [accessToken]);
|
}, [accessToken]);
|
||||||
|
|
||||||
@ -61,15 +64,6 @@ export default function VoiceInput({
|
|||||||
if (intentJson) {
|
if (intentJson) {
|
||||||
setVoiceInputText(voiceInputText + `${intentJson}`);
|
setVoiceInputText(voiceInputText + `${intentJson}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setTempUserInput("");
|
|
||||||
// if (result?.translations) {
|
|
||||||
// let resultJson = JSON.parse(result.json);
|
|
||||||
// resultJson['privTranslationPhrase']['Translation']['Translations'].forEach(
|
|
||||||
// function (translation: { Language: any; Text: any; }) {
|
|
||||||
// setVoiceInputText(voiceInputText + ` [${translation.Language}] ${translation.Text}\r\n`);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
function onCanceled(
|
function onCanceled(
|
||||||
sender: Recognizer,
|
sender: Recognizer,
|
||||||
@ -177,11 +171,3 @@ export default function VoiceInput({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// export const getServerSideProps: GetServerSideProps = async context => {
|
|
||||||
// const serverConfig = getServerSideConfig();
|
|
||||||
// console.log('66666', serverConfig, )
|
|
||||||
// return {
|
|
||||||
// props: {}
|
|
||||||
// };
|
|
||||||
// };
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import * as pinyin from "tiny-pinyin";
|
||||||
|
|
||||||
export const DENY_LIST: string[] = [
|
export const DENY_LIST: string[] = [
|
||||||
"suibian", "某某", "张三", "李四", "啊实打实", "官方回复电话", "笑死", "观化听风", "null", "undefined",
|
"suibian", "某某", "张三", "李四", "啊实打实", "官方回复电话", "笑死", "观化听风", "null", "undefined",
|
||||||
|
"zhangsan",
|
||||||
]
|
]
|
||||||
export const ADMIN_LIST: string[] = [
|
export const ADMIN_LIST: string[] = [
|
||||||
"司金辉", "sijinhui", "sijinhui@qq.com",
|
"司金辉", "sijinhui", "sijinhui@qq.com",
|
||||||
@ -91,8 +93,12 @@ export function isName(input: string): boolean {
|
|||||||
if (!input || input === "") {
|
if (!input || input === "") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DENY_LIST.includes(input)) {
|
try {
|
||||||
return false;
|
if (DENY_LIST.includes(input.toLowerCase()) || pinyin.convertToPinyin(input).toLowerCase()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('[isName]', e)
|
||||||
}
|
}
|
||||||
return isEmail(input) || (input.length >= 2 && isHanZi(input)) || (isPinYin(input) >= 2);
|
return isEmail(input) || (input.length >= 2 && isHanZi(input)) || (isPinYin(input) >= 2);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
"spark-md5": "^3.0.2",
|
"spark-md5": "^3.0.2",
|
||||||
"tailwind-merge": "^2.2.1",
|
"tailwind-merge": "^2.2.1",
|
||||||
"tiktoken": "^1.0.13",
|
"tiktoken": "^1.0.13",
|
||||||
|
"tiny-pinyin": "^1.3.2",
|
||||||
"use-debounce": "^10.0.0",
|
"use-debounce": "^10.0.0",
|
||||||
"zustand": "^4.5.0"
|
"zustand": "^4.5.0"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user