mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 10:22:39 +01:00
This is for later
This commit is contained in:
parent
688c17b8f5
commit
1435f58d84
30
assets/popout.html
Normal file
30
assets/popout.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=3.0" name="viewport" />
|
||||
|
||||
<title>Discord Popout</title>
|
||||
<link rel="icon" href="/assets/ec2c34cadd4b5f4594415127380a85e6.ico" />
|
||||
<script nonce="MTI1LDcwLDIzNSw4MiwxODcsMjM4LDExNCw5">
|
||||
(window.onload = function () {
|
||||
null != window.opener &&
|
||||
window.opener.postMessage({ discordPopoutEvent: { type: "loaded", key: window.windowKey } }, window.origin);
|
||||
}),
|
||||
(window.onunload = function () {
|
||||
null != window.opener &&
|
||||
window.opener.postMessage({ discordPopoutEvent: { type: "unloaded", key: window.windowKey } }, window.origin);
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
body,
|
||||
html {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app-mount"></div>
|
||||
</body>
|
||||
</html>
|
2883
assets/schemas.json
2883
assets/schemas.json
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,8 @@
|
||||
"settings": {
|
||||
"files.exclude": {
|
||||
"*.ansi": true,
|
||||
"**/cache": true,
|
||||
"**/cache_src": true
|
||||
}
|
||||
},
|
||||
"launch": {
|
||||
@ -28,10 +30,16 @@
|
||||
"type": "node-terminal"
|
||||
},
|
||||
{
|
||||
"command": "kitty npm run start:bundle:vscode-dbg",
|
||||
"command": "[ \"$(basename $PWD)\" != \"fosscord-server\" ] && cd ..; node scripts/build_new.js && kitty node --enable-source-maps --inspect dist/start.js",
|
||||
"name": "Run Fosscord with debugger (kitty)",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
},
|
||||
{
|
||||
"command": "[ \"$(basename $PWD)\" != \"fosscord-server\" ] && cd ..; $(ps -o comm= $PPID) assets/cache",
|
||||
"name": "Open testclient patch workspace",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -82,6 +82,15 @@ export default function TestClient(app: Application) {
|
||||
|
||||
res.send(fs.readFileSync(path.join(__dirname, "..", "..", "..", "assets", "developers.html"), { encoding: "utf8" }));
|
||||
});
|
||||
app.get("/popout", (_req: Request, res: Response) => {
|
||||
const { useTestClient } = Config.get().client;
|
||||
res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
|
||||
res.set("content-type", "text/html");
|
||||
|
||||
if (!useTestClient) return res.send("Test client is disabled on this instance. Use a stand-alone client to connect this instance.");
|
||||
|
||||
res.send(fs.readFileSync(path.join(__dirname, "..", "..", "..", "assets", "popout.html"), { encoding: "utf8" }));
|
||||
});
|
||||
app.get("*", (req: Request, res: Response) => {
|
||||
const { useTestClient } = Config.get().client;
|
||||
res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
|
||||
|
@ -43,6 +43,7 @@ export async function Message(this: WebSocket, buffer: Buffer) {
|
||||
const OPCodeHandler = OPCodeHandlers[data.op];
|
||||
if (!OPCodeHandler) {
|
||||
console.error("[Gateway] Unkown opcode " + data.op);
|
||||
if(process.env.WS_VERBOSE_UNKNOWN) console.log(data);
|
||||
// TODO: if all opcodes are implemented comment this out:
|
||||
// this.close(CloseCodes.Unknown_opcode);
|
||||
return;
|
||||
|
9
src/gateway/opcodes/VoiceServerPing.ts
Normal file
9
src/gateway/opcodes/VoiceServerPing.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { Payload, WebSocket } from "@fosscord/gateway";
|
||||
import { Send } from "../util/Send";
|
||||
|
||||
export async function onVoiceServerPing(this: WebSocket, data: Payload) {
|
||||
console.log("Got voice server ping: ", data, "Doing a noop!");
|
||||
|
||||
|
||||
// return this.close(CloseCodes.Invalid_session);
|
||||
}
|
@ -6,6 +6,7 @@ import { onPresenceUpdate } from "./PresenceUpdate";
|
||||
import { onRequestGuildMembers } from "./RequestGuildMembers";
|
||||
import { onResume } from "./Resume";
|
||||
import { onVoiceStateUpdate } from "./VoiceStateUpdate";
|
||||
import { onVoiceServerPing } from "./VoiceServerPing";
|
||||
|
||||
export type OPCodeHandler = (this: WebSocket, data: Payload) => any;
|
||||
|
||||
@ -14,12 +15,14 @@ export default {
|
||||
2: onIdentify,
|
||||
3: onPresenceUpdate,
|
||||
4: onVoiceStateUpdate,
|
||||
// 5: Voice Server Ping
|
||||
5: onVoiceServerPing, //Voice Server Ping
|
||||
6: onResume,
|
||||
// 7: Reconnect: You should attempt to reconnect and resume immediately.
|
||||
8: onRequestGuildMembers,
|
||||
// 9: Invalid Session
|
||||
// 10: Hello
|
||||
// 11: Heartbeat ACK
|
||||
|
||||
// 13: Dm_update
|
||||
14: onLazyRequest
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user