only allow clients to run this function
All checks were successful
Publish JS SDK / docker (push) Successful in 18s
All checks were successful
Publish JS SDK / docker (push) Successful in 18s
This commit is contained in:
parent
2b5e14b734
commit
3021920142
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "usetether",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
||||
"description": "An API designed to provide real-time access to a user's Discord data.",
|
||||
"keywords": [
|
||||
|
@ -1,7 +1,7 @@
|
||||
import TetherConfig from "@/types/config";
|
||||
import DiscordUser from "@/types/user";
|
||||
import { useEffect, useState } from "react";
|
||||
import Snowflake from "@/types/snowflake";
|
||||
import { Snowflake } from "@/types/snowflake";
|
||||
import { TetherConfig } from "@/types/config";
|
||||
import { DiscordUser } from "@/types/user";
|
||||
|
||||
export const useTetherWS = (
|
||||
snowflake: Snowflake,
|
||||
@ -14,6 +14,10 @@ export const useTetherWS = (
|
||||
|
||||
const url: string = `ws${secure && "s"}://${endpoint}/gateway`;
|
||||
useEffect(() => {
|
||||
// Prevent from running on the server
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
let socket: WebSocket; // The current WebSocket connection
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
type TetherConfig = {
|
||||
export type TetherConfig = {
|
||||
/**
|
||||
* The API endpoint to connect to.
|
||||
*/
|
||||
@ -9,4 +9,3 @@ type TetherConfig = {
|
||||
*/
|
||||
secure?: boolean;
|
||||
};
|
||||
export default TetherConfig;
|
||||
|
@ -1,2 +1 @@
|
||||
type Snowflake = `${bigint}`;
|
||||
export default Snowflake;
|
||||
export type Snowflake = `${bigint}`;
|
||||
|
@ -1,7 +1,6 @@
|
||||
type SocketPacket = {
|
||||
export type SocketPacket = {
|
||||
/**
|
||||
* The OP code for this packet.
|
||||
*/
|
||||
op: number;
|
||||
};
|
||||
export default SocketPacket;
|
||||
|
@ -1,4 +1,4 @@
|
||||
type DiscordUser = {
|
||||
export type DiscordUser = {
|
||||
/**
|
||||
* The unique snowflake of this user.
|
||||
*/
|
||||
@ -69,7 +69,7 @@ type DiscordUser = {
|
||||
/**
|
||||
* A user's flags.
|
||||
*/
|
||||
type UserFlags = {
|
||||
export type UserFlags = {
|
||||
/**
|
||||
* The list of flags the user has.
|
||||
*/
|
||||
@ -101,7 +101,7 @@ type UserFlags = {
|
||||
/**
|
||||
* A user's avatar.
|
||||
*/
|
||||
type Avatar = {
|
||||
export type Avatar = {
|
||||
/**
|
||||
* The id of the user's avatar.
|
||||
*/
|
||||
@ -116,7 +116,7 @@ type Avatar = {
|
||||
/**
|
||||
* A user's banner.
|
||||
*/
|
||||
type Banner = {
|
||||
export type Banner = {
|
||||
/**
|
||||
* The id of the user's avatar.
|
||||
*/
|
||||
@ -131,7 +131,7 @@ type Banner = {
|
||||
/**
|
||||
* A user's Spotify activity data.
|
||||
*/
|
||||
type SpotifyActivity = {
|
||||
export type SpotifyActivity = {
|
||||
/**
|
||||
* The currently playing song.
|
||||
*/
|
||||
@ -167,5 +167,3 @@ type SpotifyActivity = {
|
||||
*/
|
||||
ends: number;
|
||||
};
|
||||
|
||||
export default DiscordUser;
|
||||
|
Loading…
x
Reference in New Issue
Block a user