From 593e78ec208751b413b48661926fb4b1f91ad145 Mon Sep 17 00:00:00 2001 From: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> Date: Sun, 12 Apr 2020 16:19:10 +1000 Subject: [PATCH] TypeScript rewrite --- index.ts | 172 +++++ package.json | 5 + s/webrtc-capturestill/capture.ts | 97 +++ s/webrtc-capturestill/tsconfig.json | 9 + s/webrtc-from-chat/chatclient.ts | 667 +++++++++++++++++++ s/webrtc-from-chat/chatserver.definitions.ts | 24 + s/webrtc-from-chat/chatserver.ts | 353 ++++++++++ s/webrtc-from-chat/package-lock.json | 84 ++- s/webrtc-from-chat/package.json | 3 + s/webrtc-from-chat/tsconfig.json | 9 + s/webrtc-simple-datachannel/index.html | 2 +- s/webrtc-simple-datachannel/main.ts | 208 ++++++ s/webrtc-simple-datachannel/tsconfig.json | 9 + s/websocket-chat/chatclient.ts | 99 +++ s/websocket-chat/chatserver.ts | 221 ++++++ s/websocket-chat/index.html | 2 +- s/websocket-chat/tsconfig.json | 9 + tools/extract-function/extract-function.ts | 11 + tools/extract-function/package.json | 4 + tools/extract-function/test.ts | 22 + tools/extract-function/tsconfig.json | 9 + tsconfig.json | 9 + 22 files changed, 2019 insertions(+), 9 deletions(-) create mode 100644 index.ts create mode 100644 s/webrtc-capturestill/capture.ts create mode 100644 s/webrtc-capturestill/tsconfig.json create mode 100644 s/webrtc-from-chat/chatclient.ts create mode 100644 s/webrtc-from-chat/chatserver.definitions.ts create mode 100644 s/webrtc-from-chat/chatserver.ts create mode 100644 s/webrtc-from-chat/tsconfig.json create mode 100644 s/webrtc-simple-datachannel/main.ts create mode 100644 s/webrtc-simple-datachannel/tsconfig.json create mode 100644 s/websocket-chat/chatclient.ts create mode 100644 s/websocket-chat/chatserver.ts create mode 100644 s/websocket-chat/tsconfig.json create mode 100644 tools/extract-function/extract-function.ts create mode 100755 tools/extract-function/test.ts create mode 100644 tools/extract-function/tsconfig.json create mode 100644 tsconfig.json diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..8ff4b74 --- /dev/null +++ b/index.ts @@ -0,0 +1,172 @@ +import * as http from "http"; +import * as https from "https"; +import * as fs from "fs"; +import * as path from "path"; + +import express from "express"; +import * as escapeHTML from "escape-html"; +import { ServerOptions } from "https"; + +const app = express(); + +let httpPort = 80; + +const htmlTop = ` + +
+ + ++ This site hosts code samples + for MDN Web Docs that require server assistance to operate, such as examples for WebSocket, + WebRTC, and other APIs. +
+