Skip to content

Instantly share code, notes, and snippets.

View darksunlight's full-sized avatar

darksunlight

View GitHub Profile
@darksunlight
darksunlight / impulse-api-updates.md
Last active August 28, 2022 04:52
Impulse API Updates (Jul 2022)

Impulse Backend Changes (Jul 2022)

This backend update introduces significant changes to the gateway. There are no changes to the HTTP API.

The official web client has been updated to accomodate these changes.

Gateway

Breaking changes

  • Gateway events have been reorganised
  • _SUCCESS and _ERROR events have been removed in favour of GatewayMessages' success property
  • Gateway error messages are no longer human readable; this should be handled client-side
@darksunlight
darksunlight / mcLan.js
Last active June 9, 2022 05:25
Minecraft LAN World receiver (nodejs)
const dgram = require('dgram');
const socket = dgram.createSocket('udp4');
socket.bind(4445, '0.0.0.0');
socket.on("message", (data, rinfo) => {
const [, desc, port] = data.toString().match(/^\[MOTD\](.*)\[\/MOTD\]\[AD\](\d+)\[\/AD]$/);
console.log(`someone opened a lan world at ${rinfo.address}:${port} (${desc})`);
});
@darksunlight
darksunlight / discord-tokens.md
Last active June 26, 2023 09:58
Understanding Discord Tokens

Understanding Discord Tokens

There are two types of Discord tokens: normal tokens and MFA tokens.

Normal Tokens

Normal tokens can be split into 3 parts, each separated by a period/dot. The first part is the user ID string/snowflake in base64. The third part is the HMAC digest.

The second part is slightly more interesting. It is the timestamp at which the token was generated at, but depending on when the token was generated, you may have to add in an additional 1.1e9 to 1.3e9 to the retrieved timestamp to get the true timestamp.

Basic validations

If you want to verify if a token is real, but don't want to test token against Discord's servers, you can use the rules above (for the first and second parts) to filter out obvious fake tokens.

@darksunlight
darksunlight / plugify-api-updates.md
Last active February 6, 2022 08:31
Plugify API Updates (Feb 2022)

Backend Changes (Feb 2022)

Gateway

Breaking changes

  • The field for group ID is now groupID instead of groupId for channels.

New events

Event codes 24 through 29 and 32 through 34 are reserved.

Server to client

  • CHANNEL_CREATE (30) - New channel created or a previously unavailable channel became available
  • CHANNEL_DISCONNECT (31) - Currently joined channel becomes unavailable
@darksunlight
darksunlight / plugify-api-updates.md
Last active November 10, 2021 00:01
Plugify API Updates (2021-11-09)

Backend Changes (2021-11-09)

Gateway

New events: GROUP_REMOVE (22) and CHANNEL_REMOVE (23). 22 is broadcast when a user is banned from a group or when a group becomes deleted or otherwise unavailable. 23 is broadcast when a channel becomes deleted or otherwise unavailable.

HTTP

New API Error codes: NO_SUCH_CHANNEL (20), NO_SUCH_MEMBER (21), USER_BANNED (22) and USER_NOT_BANNED (23).

Channel

  • Get channel info - GET /channels/:groupID/:channelID
  • Create channel - POST /channels/create -> POST /channels/:groupID