rawrtc / rawrtc-terminal-demo

A browser terminal that punches through NATs using the force of RAWRTC
BSD 2-Clause "Simplified" License
28 stars 9 forks source link

Maybe indexOf better than startsWith #13

Open lxlenovostar opened 6 years ago

lxlenovostar commented 6 years ago
        parseWSURIOrParameters(text) {
            // Stop catching paste events
            paste.setAttribute('contenteditable', 'false');
            this.previousPasteEventHandler = paste.onpaste;
            paste.onpaste = (event) => {
                event.preventDefault();
            };

            // Remove current selections (or we'll get an error when selecting)
            window.getSelection().removeAllRanges();

            // Parse
            //if (text.startsWith('ws://')) {
            if (text.indexOf('ws://')) {
                // WebSocket URI
                paste.innerText = 'Connecting to WebSocket URI: ' + text;
                paste.classList.add('done');
                paste.classList.add('orange');
                this.startWS(text);

in app.js

Because maybe text(websocket URL) start is a space.

lgrahl commented 6 years ago

Sure. Just make a pull request. :)