Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)A
Posts
90
Comments
101
Joined
10 mo. ago

  • i think we are safe till atleast early 2030's

  • sir please forgive us

  • what about established accounts?

  • is it wrong?

  • yes i meant separate instance also we just have to put this, dark souls wiki also uses it

    You don’t need to rewrite the whole page—just inject the pieces for Socket .io and your chat UI where indicated. Here’s exactly what to add or change in existing HTML (THIS PAGE):


    1. Include Socket.IO on the client

    Find the closing </head> tag and just before it insert:

     html
        
      <!-- Socket.IO client library (served automatically by your server) -->
      <script src="/socket.io/socket.io.js"></script>
      <!-- Optional: simple styles for the chat box -->
      <style>
        #chat-container {
          position: fixed;
          bottom: 0;
          right: 0;
          width: 300px;
          max-height: 400px;
          background: white;
          border: 1px solid #ccc;
          display: flex;
          flex-direction: column;
          font-family: sans-serif;
          z-index: 1000;
        }
        #chat-messages {
          flex: 1;
          overflow-y: auto;
          padding: 8px;
        }
        #chat-form {
          display: flex;
          border-top: 1px solid #eee;
        }
        #chat-input {
          flex: 1;
          border: none;
          padding: 8px;
        }
        #chat-send {
          border: none;
          padding: 8px 12px;
          cursor: pointer;
        }
      </style>
    </head>
    
      


    2. Add the chat HTML

    Find the closing </body> tag and just before it paste:

     html
        
      <!-- Chat widget -->
      <div id="chat-container">
        <div id="chat-messages"></div>
        <form id="chat-form">
          <input id="chat-input" autocomplete="off" placeholder="Type a message…" />
          <button type="submit" id="chat-send">Send</button>
        </form>
      </div>
    
      


    3. Wire up the client-side JavaScript

    Right below that (still before </body>), add:

     html
        
      <script>
        // connect using the global io() function
        const socket = io();
    
        const form = document.getElementById('chat-form');
        const input = document.getElementById('chat-input');
        const messages = document.getElementById('chat-messages');
    
        // render incoming messages
        socket.on('message', ({ from, text }) => {
          const div = document.createElement('div');
          div.textContent = from + ': ' + text;
          messages.appendChild(div);
          messages.scrollTop = messages.scrollHeight;
        });
    
        // on submit send to server
        form.addEventListener('submit', e => {
          e.preventDefault();
          const msg = input.value.trim();
          if (!msg) return;
          socket.emit('message', msg);
          input.value = '';
        });
      </script>
    </body>
    </html>
    
      


    4. Ensure your server is serving this page and Socket.IO

    On your Node/Express server (the same one you use to serve the Lemmy/lemm.ee front-end), you need to:

    1. Install Socket.IO:

       bash
          
      npm install socket.io
      
        
    2. Hook it up to your HTTP server (roughly as in the example I shared before), making sure you share sessions so only logged-in users connect.

      The minimal changes in your server.js (or equivalent) are:

       js
          
      const http = require('http');
      const socketIO = require('socket.io');
      // … your existing Express `app`
      
      const server = http.createServer(app);
      const io = socketIO(server);
      
      // (if you have session middleware already:)
      io.use((socket, next) => {
        // reuse your Express session middleware here…
        sessionMiddleware(socket.request, socket.request.res || {}, next);
      });
      
      io.on('connection', socket => {
        const user = socket.request.session.user; 
        if (!user) return socket.disconnect(true);
      
        socket.broadcast.emit('message', {
          from: 'SYSTEM',
          text: `${user.name} joined.`
        });
      
        socket.on('message', msg => {
          io.emit('message', { from: user.name, text: msg });
        });
      
        socket.on('disconnect', () => {
          io.emit('message', {
            from: 'SYSTEM',
            text: `${user.name} left.`
          });
        });
      });
      
      server.listen(3000);
      
        


    Summary of “what changed” in your HTML

    1. Head: added <script src="/socket.io/socket.io.js"> + minimal CSS
    2. Body: injected a <div id="chat-container">…</div> chat widget
    3. Footer: added a <script>…</script> block to wire up io()

    With those three small patches, your existing site will host a floating chat box that’s only usable by authenticated users. Let me know if you need help wiring up the session middleware or adjusting the styles!

  • yea but do you think it will be a good idea?

  • Annexing is a formal legal process, it's not just creating settlements and occupying. Almost none of the West Bank has been annexed by Israel ...........................

    YET

  • good point

  • know when to be evil? i am assuming you meant to say when do we have the right to defend ourselves?

  • Source: The Hindu, published August 21, 2024, citing Association for Democratic Reforms (ADR) report. Total Cases: 151 sitting MPs and MLAs in India have declared cases related to crimes against women. Rape Charges: 16 MPs/MLAs are charged with rape under IPC Section 376. Party Breakdown: Bharatiya Janata Party (BJP): 54 MPs/MLAs with cases of crimes against women. Indian National Congress: 23 MPs/MLAs with cases of crimes against women, including 5 charged with rape. Telugu Desam Party: 17 MPs/MLAs with cases of crimes against women. Data Source: Analysis of 4,809 out of 4,863 election affidavits of sitting MPs and MLAs as of August 2024.

  • oh shoot why didn't i think of this, this is a really good point

  • do you think my list is enough?

  • not fully compatible with Godot in the same way that GDScript, C#, or C++ are, but it can be used with Godot

  • what's wrong with it? it just shows the most popular type

  • Technology @lemmy.world

    Apple Plans Split iPhone Launch Strategy: Pro and Foldable in Fall 2026, Standard in Spring 2027

    www.macrumors.com /2025/05/03/apple-split-iphone-launch-strategy/
  • politics @lemmy.world

    Can Trump serve a third term as US president?

    www.bbc.com /news/articles/cx20lwedn23o
  • No Stupid Questions @lemmy.world

    Does humanism lead to tolerance paradox?

  • Asklemmy @lemmy.ml

    Does humanism lead to tolerance paradox?

  • News @lemmy.world

    Pakistan rushes air defence, electronic assets forward; steps up readiness drills

    economictimes.indiatimes.com /news/defence/pakistan-rushes-air-defence-electronic-assets-forward-steps-up-readiness-drills/articleshow/120741202.cms
  • News @lemmy.world

    Audacious terror strike at Pahalgam, 27 tourists dead. Among the dead two foreign nationals from Israel and Italy. Ten others are injured.

    www.thehindubusinessline.com /news/audacious-terror-strike-at-pahalgam-27-tourist-dead/article69479598.ece
  • politics @lemmy.world

    Pro-Palestinian groups have more demands for Democrats

    www.politico.com /news/2025/03/12/pro-palestinian-groups-dnc-00225896
  • News @lemmy.world

    Muslim advocacy group to preference Greens above Labor in some seats despite disagreement on religious freedom

    www.theguardian.com /australia-news/2025/apr/16/muslim-advocacy-group-to-preference-greens-above-labor-in-some-seats-despite-disagreement-on-religious-freedom
  • News @lemmy.world

    Muslim Group Accuses Greg Abbott of 'Abusing Power' Over New Texas City

    www.newsweek.com /muslim-group-accuses-greg-abbott-abusing-power-over-new-texas-city-2057879
  • Meta (lemm.ee) @lemm.ee

    I can't see images from lemmy.world instance because my country has banned lemmy.world, is there any effort going on to solve this issue?