Use object instad of map Fix styles

This commit is contained in:
odoacre 2022-11-04 15:33:56 +01:00
parent a4265a6a49
commit b63ec11122
2 changed files with 12 additions and 8 deletions

View file

@ -8,7 +8,7 @@ const io = new Server(server);
const { Readable } = require('stream');
const { parse } = require('node-html-parser');
const names = new Map();
const names = {};
const getName = async (category = "Informatica") => {
const altre = ['Anarchici+italiani', 'Informatica', 'Distretti+dell%27Irlanda+del+Nord+soppressi']
@ -57,14 +57,14 @@ app.get('/', (req, res) => {
app.get('/waiting', (req, res) => {
res.sendStatus(418);
});
app.get('/image', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'title.png'));
app.get('/users', (req, res) => {
res.send(JSON.stringify(Object.values(names)));
});
io.on('connection', async (socket) => {
const { name: nameForUser, link } = await getName();
names.set(socket.id, nameForUser);
names[socket.id] = nameForUser;
// Emit username and chat message
socket.emit('username', `${nameForUser}@@@${link}`);
socket.emit('chat message', `Ciao ${nameForUser}!`);
@ -80,6 +80,7 @@ io.on('connection', async (socket) => {
socket.on('disconnect', () => {
console.info(`${nameForUser} disconnected`);
delete names[socket.id];
});
});

View file

@ -21,14 +21,15 @@
}
#form {
background: rgba(0, 0, 0, 0.15);
border-top: 1px solid black;
background: #eee;
padding: 0.25rem;
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: flex;
height: 8vh;
height: 3em;
box-sizing: border-box;
justify-content: center;
}
@ -103,7 +104,9 @@
<body>
<h1>Hack or Di(Y|E) 8</h1>
<div id="username">
<p>Tu sei: <a href="" id="value"></a></p>
<a href="/users">Lista utenti connessi</a> -
Tu sei: <a href="" id="value"></a>
</div>
<!--<iframe allowfullscreen="true" src="https://file-examples.com/storage/fe8c7eef0c6364f6c9504cc/2017/04/file_example_MP4_480_1_5MG.mp4" frameborder="0"></iframe>-->
<iframe allowfullscreen="true" src="https://hod8.vado.li/" frameborder="0"></iframe>