Merge branch 'maddy/refactor' into maddy/bodyParserPatch
This commit is contained in:
commit
13453129e7
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -17,9 +17,9 @@ jobs:
|
|||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
@ -12,7 +12,7 @@ import { Config } from "@fosscord/util";
|
|||||||
var erlpack: any;
|
var erlpack: any;
|
||||||
try {
|
try {
|
||||||
erlpack = require("@yukikaze-bot/erlpack");
|
erlpack = require("@yukikaze-bot/erlpack");
|
||||||
} catch (error) {}
|
} catch (error) { }
|
||||||
|
|
||||||
// TODO: check rate limit
|
// TODO: check rate limit
|
||||||
// TODO: specify rate limit in config
|
// TODO: specify rate limit in config
|
||||||
@ -39,6 +39,20 @@ export async function Connection(
|
|||||||
// `[Gateway] New connection from ${socket.ipAddress}, total ${this.clients.size}`,
|
// `[Gateway] New connection from ${socket.ipAddress}, total ${this.clients.size}`,
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
if (process.env.WS_LOGEVENTS)
|
||||||
|
[
|
||||||
|
"close",
|
||||||
|
"error",
|
||||||
|
"upgrade",
|
||||||
|
//"message",
|
||||||
|
"open",
|
||||||
|
"ping",
|
||||||
|
"pong",
|
||||||
|
"unexpected-response"
|
||||||
|
].forEach((x) => {
|
||||||
|
socket.on(x, (y) => console.log(x, y));
|
||||||
|
});
|
||||||
|
|
||||||
const { searchParams } = new URL(`http://localhost${request.url}`);
|
const { searchParams } = new URL(`http://localhost${request.url}`);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
socket.encoding = searchParams.get("encoding") || "json";
|
socket.encoding = searchParams.get("encoding") || "json";
|
||||||
|
@ -33,6 +33,8 @@ export async function Message(this: WebSocket, buffer: WS.Data) {
|
|||||||
}
|
}
|
||||||
else return this.close(CLOSECODES.Decode_error);
|
else return this.close(CLOSECODES.Decode_error);
|
||||||
|
|
||||||
|
if (process.env.WS_VERBOSE) console.log(`[Websocket] Incomming message: ${JSON.stringify(data)}`);
|
||||||
|
|
||||||
check.call(this, PayloadSchema, data);
|
check.call(this, PayloadSchema, data);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -7,6 +7,7 @@ export const JWTOptions: VerifyOptions = { algorithms: ["HS256"] };
|
|||||||
export function checkToken(token: string, jwtSecret: string): Promise<any> {
|
export function checkToken(token: string, jwtSecret: string): Promise<any> {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
token = token.replace("Bot ", "");
|
token = token.replace("Bot ", "");
|
||||||
|
token = token.replace("Bearer ", "");
|
||||||
/**
|
/**
|
||||||
in fosscord, even with instances that have bot distinction; we won't enforce "Bot" prefix,
|
in fosscord, even with instances that have bot distinction; we won't enforce "Bot" prefix,
|
||||||
as we don't really have separate pathways for bots
|
as we don't really have separate pathways for bots
|
||||||
|
Loading…
x
Reference in New Issue
Block a user