Use random name for nickname if none set yet

This commit is contained in:
littlealex003 2021-04-29 07:30:00 +02:00 committed by Franck Royer
parent fbfad9390c
commit 55ca6a4e6f
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 14 additions and 1 deletions

View File

@ -11,6 +11,7 @@
"peer-id": "^0.14.8",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"server-name-generator": "^1.0.5",
"waku": "file:../build/main/lib",
"waku-chat": "file:../build/main/chat",
"web-vitals": "^1.1.1"
@ -20600,6 +20601,11 @@
"node": ">= 0.8.0"
}
},
"node_modules/server-name-generator": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/server-name-generator/-/server-name-generator-1.0.5.tgz",
"integrity": "sha512-LBo265lZl4rL/XETBhxPPssAzLNEl9fKNobJmFJxKcQQ43oONuHBQXR8evMnh9z2krWFVWmRPH7bWuvQvNQ4yw=="
},
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
@ -41529,6 +41535,11 @@
"send": "0.17.1"
}
},
"server-name-generator": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/server-name-generator/-/server-name-generator-1.0.5.tgz",
"integrity": "sha512-LBo265lZl4rL/XETBhxPPssAzLNEl9fKNobJmFJxKcQQ43oONuHBQXR8evMnh9z2krWFVWmRPH7bWuvQvNQ4yw=="
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",

View File

@ -8,6 +8,7 @@
"peer-id": "^0.14.8",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"server-name-generator": "^1.0.5",
"waku": "file:../build/main/lib",
"waku-chat": "file:../build/main/chat",
"web-vitals": "^1.1.1"

View File

@ -9,13 +9,14 @@ import handleCommand from './command';
import Room from './Room';
import Waku from 'waku/waku';
import { WakuContext } from './WakuContext';
import { generate } from 'server-name-generator';
export const ChatContentTopic = 'dingpu';
export default function App() {
let [stateMessages, setMessages] = useState<ChatMessage[]>([]);
let [stateWaku, setWaku] = useState<Waku | undefined>(undefined);
let [nick, setNick] = useState<string>('web-chat');
let [nick, setNick] = useState<string>(generate());
useEffect(() => {
const handleNewMessages = (event: { data: Uint8Array }) => {