This repo is no longer maintained this also means that this is an earlier version of the currently published version of is-my.life domain connection. There will be no more package or vulnerability fixes, if you want to use it I recommend checking for vulnerabilities first and fixing them.
Integrates with your Cloudflare account so you can share your funny domain with your friends. This is related to the new Discord feature called Domain Connections.
- It uses Discord OAuth to limit who can log in and use this web-app.
- The web-app communicated through socket.io and can receive real-time data.
- The only reason this web-app uses socket.io instead of rest API is that I stole a part of the code from one of my other project.
- It uses the Cloudflare API to update/create TXT records on your domain.
- That's all, it's a really simple explanation but if you can code you'll understand the code anyways.
EXPRESS_SECRET="your secret"
CLIENT_ID="" # Discord Client ID
CLIENT_SECRET="" # Discord Client Secret
CLOUDFLARE_API_KEY="" # Cloudflare API Key
- Go to the Developer Portal create a new Application and go to OAuth2, copy and paste the Client ID and Secret to your .env file.
- Add your redirect URI, if you're running this locally add
http://localhost:8000/auth
, if not then you know where you're gonna deploy this web-app. (Make sure the redirect URI ends with/auth
).
- Go to your profile > API tokens and click create a token.
- Use the edit zone DNS template, you can add filtering so only your IP address is allowed but that's not necessarry.
- Copy and paste the generated token to your .env file.
Just set any secret you want, the easiest one which I recommend is generating a random string or password and setting that. This secret is just for the sessions and it's not required to access the site, but don't share the secret you set with anyone.
{
"allowed_users": ["your discord id", "another discord id"],
"socket_port": 4000,
"http_port": 8000,
"cors": ["http://localhost:8000", "http://localhost:4000"],
"discord_auth_url": "",
"discord_redirect_uri": "http://localhost:8000/auth",
"domain": "your domain"
}
You can add allowed users who can access the web-app. Copy the ID of the user and add it to the allowed users array.
The http_port
is the web-app's port which is how you access the website and socket_port
is the socket.io port for communication. Make sure to update the CORS URLs as well!
Warning Currently the web-app connects to the same hostname and protocol for socket.io if you're exposing the socket.io connection on a different hostname or protocol you need to modify the code at public/script.js:11.
- Go back to the Developer Portal and select the application you created earlier.
- Go to OAuth2 > URL Generator.
- Select the
identify
scope and the redirect URI you added earlier. - Copy the generated URL and set it as
discord_auth_url
. - Set the
discord_redirect_uri
as the same redirect URI you added earlier in the Developer Portal.
Set the domain to a domain that you already own and already added to your Cloudflare account.