Insert variable externally

Question:
I have a project named ChatCord and for the actual chatting system (it’s a whole new repl), lets call that repl “Chat System.” So, username needs to be defined in Chat System but I already have Authentication in ChatCord (with a custom login screen). I don’t want a sign-in on ChatCord and chat system, so what I thought was: why don’t I define username directly from ChatCord? So the user signs in on ChatCord, user.name is stored somehow, and then when Chat System wakes up, a script defining username with the variable username containing the username from user.name is inserted into an iframe. Then, Chat System goes in it’s normal way.

Is that even possible? How would I do that?

Why would you create separate Repls?

One uses Node.js, so that takes some time to wake up. ChatCord uses HTML/CSS/JS; loads up almost instantly for me.

That seems like a lot of extra work to get a variable from two separate Repls (which I don’t think is possible) than to just make one Node.js Repl IMO.

I don’t know how to put both repls’ HTML+CSS together, so rn it’s not an option for me.

I could help you with that, invite me to the Repl or just send a link so I can fork it and give you the fork if you don’t want me to be able to edit the Repl.

Templates or ejs or whatever Node uses. Having two repls is not only a hassle, but also a security risk, as you would have to disable CORS on the backend.

2 Likes

I’ve invited you to the repl. Hopefully you can help:

The chat part comes from this repl which is what I was trying to iframe:

https://replit.com/@Whacko/Socketio-Chat

Socket.io requires Node.js!