xlight-vnc 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/LICENSE.txt +62 -0
- package/README-XLIGHT.md +46 -0
- package/README.md +265 -2
- package/app/audio-mse.js +176 -0
- package/app/audio.js +937 -0
- package/app/error-handler.js +87 -0
- package/app/images/alt.svg +92 -0
- package/app/images/audio-muted.svg +5 -0
- package/app/images/audio.svg +5 -0
- package/app/images/clipboard.svg +106 -0
- package/app/images/connect.svg +96 -0
- package/app/images/ctrl.svg +96 -0
- package/app/images/ctrlaltdel.svg +100 -0
- package/app/images/disconnect.svg +94 -0
- package/app/images/drag.svg +76 -0
- package/app/images/error.svg +81 -0
- package/app/images/esc.svg +92 -0
- package/app/images/expander.svg +69 -0
- package/app/images/fullscreen.svg +93 -0
- package/app/images/handle.svg +82 -0
- package/app/images/handle_bg.svg +172 -0
- package/app/images/icons/Makefile +42 -0
- package/app/images/icons/xlight-ios-120.png +0 -0
- package/app/images/icons/xlight-ios-152.png +0 -0
- package/app/images/icons/xlight-ios-167.png +0 -0
- package/app/images/icons/xlight-ios-180.png +0 -0
- package/app/images/icons/xlight-ios-40.png +0 -0
- package/app/images/icons/xlight-ios-58.png +0 -0
- package/app/images/icons/xlight-ios-60.png +0 -0
- package/app/images/icons/xlight-ios-80.png +0 -0
- package/app/images/icons/xlight-ios-87.png +0 -0
- package/app/images/icons/xlight-logo-192.png +0 -0
- package/app/images/icons/xlight-logo-32.png +0 -0
- package/app/images/icons/xlight-logo-512.png +0 -0
- package/app/images/icons/xlight-logo.svg +60 -0
- package/app/images/icons/xlight.ico +0 -0
- package/app/images/info.svg +81 -0
- package/app/images/keyboard.svg +88 -0
- package/app/images/power.svg +87 -0
- package/app/images/settings.svg +76 -0
- package/app/images/tab.svg +86 -0
- package/app/images/toggleextrakeys.svg +90 -0
- package/app/images/warning.svg +81 -0
- package/app/images/windows.svg +65 -0
- package/app/images/xlight-collapse.svg +12 -0
- package/app/locale/README +1 -0
- package/app/locale/cs.json +71 -0
- package/app/locale/de.json +74 -0
- package/app/locale/el.json +100 -0
- package/app/locale/es.json +68 -0
- package/app/locale/fr.json +82 -0
- package/app/locale/hu.json +80 -0
- package/app/locale/it.json +68 -0
- package/app/locale/ja.json +81 -0
- package/app/locale/ko.json +70 -0
- package/app/locale/nl.json +95 -0
- package/app/locale/pl.json +80 -0
- package/app/locale/pt_BR.json +72 -0
- package/app/locale/ru.json +72 -0
- package/app/locale/sv.json +83 -0
- package/app/locale/tr.json +69 -0
- package/app/locale/uk.json +81 -0
- package/app/locale/zh_CN.json +93 -0
- package/app/locale/zh_TW.json +69 -0
- package/app/localization.js +206 -0
- package/app/sounds/CREDITS +4 -0
- package/app/sounds/bell.mp3 +0 -0
- package/app/sounds/bell.oga +0 -0
- package/app/styles/Orbitron700.ttf +0 -0
- package/app/styles/Orbitron700.woff +0 -0
- package/app/styles/audio.css +28 -0
- package/app/styles/base.css +1106 -0
- package/app/styles/constants.css +30 -0
- package/app/styles/input.css +628 -0
- package/app/styles/xlight-glass.css +690 -0
- package/app/ui.js +2091 -0
- package/app/wakelock.js +199 -0
- package/app/webutil.js +250 -0
- package/app/xlight-features.js +343 -0
- package/app/xlight-tunl.js +315 -0
- package/cli/xlight.mjs +1477 -0
- package/codespace-setup.sh +196 -0
- package/core/base64.js +104 -0
- package/core/clipboard.js +72 -0
- package/core/crypto/aes.js +178 -0
- package/core/crypto/bigint.js +34 -0
- package/core/crypto/crypto.js +90 -0
- package/core/crypto/des.js +330 -0
- package/core/crypto/dh.js +55 -0
- package/core/crypto/md5.js +82 -0
- package/core/crypto/rsa.js +132 -0
- package/core/decoders/copyrect.js +27 -0
- package/core/decoders/h264.js +321 -0
- package/core/decoders/hextile.js +181 -0
- package/core/decoders/jpeg.js +161 -0
- package/core/decoders/raw.js +59 -0
- package/core/decoders/rre.js +44 -0
- package/core/decoders/tight.js +393 -0
- package/core/decoders/tightpng.js +27 -0
- package/core/decoders/zlib.js +51 -0
- package/core/decoders/zrle.js +185 -0
- package/core/deflator.js +84 -0
- package/core/display.js +605 -0
- package/core/encodings.js +54 -0
- package/core/inflator.js +65 -0
- package/core/input/domkeytable.js +311 -0
- package/core/input/fixedkeys.js +129 -0
- package/core/input/gesturehandler.js +567 -0
- package/core/input/keyboard.js +386 -0
- package/core/input/keysym.js +616 -0
- package/core/input/keysymdef.js +688 -0
- package/core/input/util.js +191 -0
- package/core/input/vkeys.js +116 -0
- package/core/input/xtscancodes.js +173 -0
- package/core/ra2.js +312 -0
- package/core/rfb.js +3566 -0
- package/core/util/browser.js +272 -0
- package/core/util/cursor.js +249 -0
- package/core/util/element.js +32 -0
- package/core/util/events.js +138 -0
- package/core/util/eventtarget.js +35 -0
- package/core/util/int.js +15 -0
- package/core/util/logging.js +56 -0
- package/core/util/strings.js +28 -0
- package/core/websock.js +369 -0
- package/defaults.json +1 -0
- package/docs/API-internal.md +105 -0
- package/docs/API.md +541 -0
- package/docs/EMBEDDING.md +130 -0
- package/docs/LIBRARY.md +31 -0
- package/docs/LICENSE.BSD-2-Clause +22 -0
- package/docs/LICENSE.BSD-3-Clause +24 -0
- package/docs/LICENSE.MPL-2.0 +373 -0
- package/docs/LICENSE.OFL-1.1 +91 -0
- package/docs/flash_policy.txt +4 -0
- package/docs/links +76 -0
- package/docs/notes +5 -0
- package/docs/novnc_proxy.1 +37 -0
- package/docs/rfb_notes +147 -0
- package/docs/rfbproto-3.3.pdf +0 -0
- package/docs/rfbproto-3.7.pdf +0 -0
- package/docs/rfbproto-3.8.pdf +0 -0
- package/host/README.md +166 -0
- package/host/audio-proxy.sh +144 -0
- package/host/audio-server.py +426 -0
- package/host/package-lock.json +67 -0
- package/host/package.json +1 -0
- package/host/pulse-setup.sh +75 -0
- package/host/tunl-server.mjs +320 -0
- package/host/xlight-audio.service +33 -0
- package/index.html +12 -0
- package/mandatory.json +1 -0
- package/package.json +80 -4
- package/po/Makefile +36 -0
- package/po/cs.po +294 -0
- package/po/de.po +303 -0
- package/po/el.po +399 -0
- package/po/es.po +284 -0
- package/po/fr.po +345 -0
- package/po/hr.po +338 -0
- package/po/hu.po +332 -0
- package/po/it.po +300 -0
- package/po/ja.po +342 -0
- package/po/ko.po +290 -0
- package/po/nl.po +400 -0
- package/po/pl.po +325 -0
- package/po/po2js +42 -0
- package/po/pt_BR.po +299 -0
- package/po/ru.po +302 -0
- package/po/sv.po +352 -0
- package/po/tr.po +288 -0
- package/po/uk.po +341 -0
- package/po/xgettext-html +119 -0
- package/po/xlight-vnc.pot +337 -0
- package/po/zh_CN.po +373 -0
- package/po/zh_TW.po +285 -0
- package/utils/README.md +14 -0
- package/utils/b64-to-binary.pl +17 -0
- package/utils/genkeysymdef.js +127 -0
- package/utils/novnc_proxy +232 -0
- package/utils/u2x11 +28 -0
- package/utils/validate +84 -0
- package/vendor/pako/LICENSE +21 -0
- package/vendor/pako/README.md +6 -0
- package/vendor/pako/lib/utils/common.js +45 -0
- package/vendor/pako/lib/zlib/adler32.js +27 -0
- package/vendor/pako/lib/zlib/constants.js +47 -0
- package/vendor/pako/lib/zlib/crc32.js +36 -0
- package/vendor/pako/lib/zlib/deflate.js +1846 -0
- package/vendor/pako/lib/zlib/gzheader.js +35 -0
- package/vendor/pako/lib/zlib/inffast.js +324 -0
- package/vendor/pako/lib/zlib/inflate.js +1527 -0
- package/vendor/pako/lib/zlib/inftrees.js +322 -0
- package/vendor/pako/lib/zlib/messages.js +11 -0
- package/vendor/pako/lib/zlib/trees.js +1195 -0
- package/vendor/pako/lib/zlib/zstream.js +24 -0
- package/xlight.html +826 -0
- package/xlight_lite.html +200 -0
package/AUTHORS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Gaurav Kumar Yadav (https://github.com/xgauravyaduvanshii)
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
noVNC is Copyright (C) 2022 The noVNC authors
|
|
2
|
+
(./AUTHORS)
|
|
3
|
+
|
|
4
|
+
The noVNC core library files are licensed under the MPL 2.0 (Mozilla
|
|
5
|
+
Public License 2.0). The noVNC core library is composed of the
|
|
6
|
+
Javascript code necessary for full noVNC operation. This includes (but
|
|
7
|
+
is not limited to):
|
|
8
|
+
|
|
9
|
+
core/**/*.js
|
|
10
|
+
app/*.js
|
|
11
|
+
test/playback.js
|
|
12
|
+
|
|
13
|
+
The HTML, CSS, font and images files that included with the noVNC
|
|
14
|
+
source distibution (or repository) are not considered part of the
|
|
15
|
+
noVNC core library and are licensed under more permissive licenses.
|
|
16
|
+
The intent is to allow easy integration of noVNC into existing web
|
|
17
|
+
sites and web applications.
|
|
18
|
+
|
|
19
|
+
The HTML, CSS, font and image files are licensed as follows:
|
|
20
|
+
|
|
21
|
+
*.html : 2-Clause BSD license
|
|
22
|
+
|
|
23
|
+
app/styles/*.css : 2-Clause BSD license
|
|
24
|
+
|
|
25
|
+
app/styles/Orbitron* : SIL Open Font License 1.1
|
|
26
|
+
(Copyright 2009 Matt McInerney)
|
|
27
|
+
|
|
28
|
+
app/images/ : Creative Commons Attribution-ShareAlike
|
|
29
|
+
http://creativecommons.org/licenses/by-sa/3.0/
|
|
30
|
+
|
|
31
|
+
Some portions of noVNC are copyright to their individual authors.
|
|
32
|
+
Please refer to the individual source files and/or to the noVNC commit
|
|
33
|
+
history: https://github.com/novnc/noVNC/commits/master
|
|
34
|
+
|
|
35
|
+
The are several files and projects that have been incorporated into
|
|
36
|
+
the noVNC core library. Here is a list of those files and the original
|
|
37
|
+
licenses (all MPL 2.0 compatible):
|
|
38
|
+
|
|
39
|
+
core/base64.js : MPL 2.0
|
|
40
|
+
|
|
41
|
+
core/des.js : Various BSD style licenses
|
|
42
|
+
|
|
43
|
+
vendor/pako/ : MIT
|
|
44
|
+
|
|
45
|
+
Any other files not mentioned above are typically marked with
|
|
46
|
+
a copyright/license header at the top of the file. The default noVNC
|
|
47
|
+
license is MPL-2.0.
|
|
48
|
+
|
|
49
|
+
The following license texts are included:
|
|
50
|
+
|
|
51
|
+
docs/LICENSE.MPL-2.0
|
|
52
|
+
docs/LICENSE.OFL-1.1
|
|
53
|
+
docs/LICENSE.BSD-3-Clause (New BSD)
|
|
54
|
+
docs/LICENSE.BSD-2-Clause (Simplified BSD / FreeBSD)
|
|
55
|
+
vendor/pako/LICENSE (MIT)
|
|
56
|
+
|
|
57
|
+
Or alternatively the license texts may be found here:
|
|
58
|
+
|
|
59
|
+
http://www.mozilla.org/MPL/2.0/
|
|
60
|
+
http://scripts.sil.org/OFL
|
|
61
|
+
http://en.wikipedia.org/wiki/BSD_licenses
|
|
62
|
+
https://opensource.org/licenses/MIT
|
package/README-XLIGHT.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# xLight VNC — Codespace test
|
|
2
|
+
|
|
3
|
+
xLight VNC is a rebranded, extended fork (MPL-2.0 — see the fork note in
|
|
4
|
+
README.md) with
|
|
5
|
+
KasmVNC-inspired settings, a compact glassy dark UI, and system-audio
|
|
6
|
+
streaming (WebRTC Opus primary, WebSocket + WebM/Opus fallback).
|
|
7
|
+
|
|
8
|
+
## Test it in this Codespace
|
|
9
|
+
|
|
10
|
+
The stack starts automatically at Codespace creation (see
|
|
11
|
+
`.devcontainer/devcontainer.json`). If it is not running, run:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bash codespace-setup.sh
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then open the forwarded port **6080** (it prints the URL at the end of the
|
|
18
|
+
setup log, e.g. `https://<codespace>-6080.app.github.dev/xlight.html`),
|
|
19
|
+
click **Connect**, and enter the VNC password:
|
|
20
|
+
|
|
21
|
+
**`xlight12`** — throwaway test credential, VNC truncates to 8 chars.
|
|
22
|
+
|
|
23
|
+
The remote XFCE desktop plays music (Kevin MacLeod — "Carefree", CC-BY 3.0)
|
|
24
|
+
into a PulseAudio null sink; enable **Audio** in the sidebar / Settings to
|
|
25
|
+
hear it in the browser. Some controls (WebRTC UDP Transit, WebP, the
|
|
26
|
+
dynamic video-mode sliders) are disabled with a "Requires KasmVNC server"
|
|
27
|
+
note — they need the KasmVNC server and do not work against a stock VNC
|
|
28
|
+
server, so they are shown disabled rather than as dead sliders.
|
|
29
|
+
|
|
30
|
+
## Layout
|
|
31
|
+
|
|
32
|
+
- `xlight.html`, `app/`, `core/`, `vendor/`, `po/`, `docs/` — the xLight fork
|
|
33
|
+
- `host/` — audio server (`audio-server.py`, port 5712), audio proxy
|
|
34
|
+
(`audio-proxy.sh`, port 5711), PulseAudio setup, systemd unit
|
|
35
|
+
- `codespace-setup.sh` — installs + starts the whole test stack
|
|
36
|
+
- `run/` — logs, pidfiles, token routes (created by the setup script)
|
|
37
|
+
- `music/` — test track (downloaded by the setup script)
|
|
38
|
+
|
|
39
|
+
## Notes
|
|
40
|
+
|
|
41
|
+
- No tunl is used here: tunl's HTTP tunnel returns 502 on the websocket
|
|
42
|
+
upgrade, so the Codespace's own forwarded port (which supports
|
|
43
|
+
websockets) is the test route.
|
|
44
|
+
- Nothing in this repo touches the author's VPS.
|
|
45
|
+
- Music: Kevin MacLeod — "Carefree", CC-BY 3.0 Unported, via Wikimedia
|
|
46
|
+
Commons. Attribution required if published.
|
package/README.md
CHANGED
|
@@ -1,3 +1,266 @@
|
|
|
1
|
-
|
|
1
|
+
## xLight VNC — see and control a computer from your browser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/xgauravyaduvanshii/xlight-vnc/actions?query=workflow%3ATest)
|
|
4
|
+
[](https://github.com/xgauravyaduvanshii/xlight-vnc/actions?query=workflow%3ALint)
|
|
5
|
+
|
|
6
|
+
**xLight VNC is a free app that lets you see another computer's screen
|
|
7
|
+
inside your web browser — and control it with your mouse and keyboard,
|
|
8
|
+
with sound.** You do not need to install any viewer app: just open a
|
|
9
|
+
link in Chrome, Firefox, or Safari (on a computer or a phone) and press
|
|
10
|
+
Connect.
|
|
11
|
+
|
|
12
|
+
xLight VNC is a fork of noVNC 1.7.0 (MPL-2.0) — see the [upstream project](https://github.com/novnc/noVNC).
|
|
13
|
+
|
|
14
|
+
### What you can do with it
|
|
15
|
+
|
|
16
|
+
- See a remote computer's screen live in your browser and control it.
|
|
17
|
+
- Hear the remote computer's sound (music, videos, alerts).
|
|
18
|
+
- Copy and paste text between your computer and the remote one.
|
|
19
|
+
- Share your screen with anyone over the internet with a public link
|
|
20
|
+
(see [Share your screen with tunl](#share-your-screen-with-tunl)
|
|
21
|
+
below) — they only need the link and the screen password.
|
|
22
|
+
- Change quality, scaling, and frame rate from the Settings panel.
|
|
23
|
+
|
|
24
|
+
### Easiest way — install on Linux (snap)
|
|
25
|
+
|
|
26
|
+
If you use Ubuntu or another Linux with snap support, this is the
|
|
27
|
+
whole install:
|
|
28
|
+
|
|
29
|
+
1. Open a terminal.
|
|
30
|
+
2. Run:
|
|
31
|
+
`sudo snap install xlight-vnc`
|
|
32
|
+
3. Start it with your VNC server's address, for example:
|
|
33
|
+
`xlight-vnc --vnc localhost:5901`
|
|
34
|
+
4. Open the link it prints (usually `http://localhost:6080`), press
|
|
35
|
+
**Connect**, and enter the VNC password if asked.
|
|
36
|
+
|
|
37
|
+
You can also run it as a background service — see
|
|
38
|
+
[Installation from snap package](#installation-from-snap-package)
|
|
39
|
+
below.
|
|
40
|
+
|
|
41
|
+
### Run it with one command — the `xlight` CLI
|
|
42
|
+
|
|
43
|
+
If you have Node.js 20 or newer, this is the easiest way on any
|
|
44
|
+
computer (Linux, Windows, or Mac). Install it once:
|
|
45
|
+
|
|
46
|
+
`npm i -g xlight-vnc`
|
|
47
|
+
|
|
48
|
+
Then just run:
|
|
49
|
+
|
|
50
|
+
`xlight`
|
|
51
|
+
|
|
52
|
+
It asks what to do, with numbers:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
1. Start xLight VNC
|
|
56
|
+
2. Start xLight VNC with password
|
|
57
|
+
3. Start xLight VNC without password
|
|
58
|
+
4. Start xLight VNC with password + tunl
|
|
59
|
+
5. Start xLight VNC without password + tunl
|
|
60
|
+
6. Login tunl
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Type the number and press Enter. It starts in the background and
|
|
64
|
+
prints the link (usually `http://localhost:6080`) — the terminal is
|
|
65
|
+
free again right away. Use it like this:
|
|
66
|
+
|
|
67
|
+
- **Option 1** — just start, and enter the VNC password in the
|
|
68
|
+
browser when asked.
|
|
69
|
+
- **Options 2 and 4** — it asks for a VNC password first (typed
|
|
70
|
+
hidden, nobody can see it) and saves it on this computer, so it
|
|
71
|
+
only asks once. The password belongs to the VNC server, not to
|
|
72
|
+
xLight VNC — on Linux it is set with `vncpasswd`; on Windows set
|
|
73
|
+
the same password in your VNC server (for example TightVNC).
|
|
74
|
+
- **Options 3 and 5** — no password at all. Only for your own
|
|
75
|
+
computer: anyone who can open the page can control the screen,
|
|
76
|
+
so the page listens on 127.0.0.1 only. If the VNC server still
|
|
77
|
+
asks for a password, `xlight` says so plainly and does not start.
|
|
78
|
+
- **Options 4 and 5** — also share the screen over the internet
|
|
79
|
+
with a public link like `https://something.tunl.cloud`. If this
|
|
80
|
+
computer is already logged in to tunl, it shows your name and
|
|
81
|
+
email and goes straight ahead. If not, it offers two ways:
|
|
82
|
+
(a) device login — it shows a big code and a link, you approve
|
|
83
|
+
the code in the browser; (b) paste a token — make one at
|
|
84
|
+
<https://urmate.tech/dashboard/tunnel/settings/api-tokens>
|
|
85
|
+
after logging in, and paste it when asked. Either way the login
|
|
86
|
+
is saved, so next time there is no login step.
|
|
87
|
+
- **Option 6** — only log in to tunl, without starting anything.
|
|
88
|
+
If you are already logged in it just shows your name and email.
|
|
89
|
+
|
|
90
|
+
Other commands you will use:
|
|
91
|
+
|
|
92
|
+
- `xlight stop` — stop the running xLight VNC.
|
|
93
|
+
- `xlight status` — is it running, and what are the links?
|
|
94
|
+
- `xlight --url` (or `xlight url`) — show the public tunl link again,
|
|
95
|
+
for when you forgot it. If no tunnel is running it says so plainly.
|
|
96
|
+
- `xlight autostart on` / `xlight autostart off` / `xlight autostart status`
|
|
97
|
+
— start it again on its own when the computer restarts (on Linux
|
|
98
|
+
this is a systemd user service; `xlight stop` leaves autostart
|
|
99
|
+
on, only `autostart off` turns it off).
|
|
100
|
+
- `xlight start --password --tunl` — the same choices without the
|
|
101
|
+
menu (`xlight start`, `xlight start --password`,
|
|
102
|
+
`xlight start --no-password`, `xlight start --password --tunl`,
|
|
103
|
+
`xlight start --no-password --tunl`, `xlight login-tunl`).
|
|
104
|
+
Add `--foreground` to keep it in the terminal for debugging.
|
|
105
|
+
|
|
106
|
+
### Windows — step by step
|
|
107
|
+
|
|
108
|
+
xLight VNC itself is just a web page, so on Windows you need two
|
|
109
|
+
small things first: a program that shares your Windows screen (a
|
|
110
|
+
"VNC server"), and Python to run the little web server that shows
|
|
111
|
+
the page.
|
|
112
|
+
|
|
113
|
+
1. **Install Python** from [python.org](https://www.python.org/downloads/)
|
|
114
|
+
(tick "Add python to PATH" during install), then restart your
|
|
115
|
+
terminal.
|
|
116
|
+
2. **Install a VNC server** to share your screen — for example
|
|
117
|
+
[TightVNC](https://www.tightvnc.com/download.php). During its
|
|
118
|
+
setup, choose a VNC password and remember it: that is the password
|
|
119
|
+
people type to see your screen.
|
|
120
|
+
3. **Download xLight VNC.** Open a terminal and run:
|
|
121
|
+
`git clone https://github.com/xgauravyaduvanshii/xlight-vnc.git`
|
|
122
|
+
(if you do not have git, install it from
|
|
123
|
+
[git-scm.com](https://git-scm.com/download/win) first), then:
|
|
124
|
+
`cd xlight-vnc`
|
|
125
|
+
4. **Install the web helper** (it connects the browser to the VNC
|
|
126
|
+
server):
|
|
127
|
+
`pip install websockify`
|
|
128
|
+
5. **Start xLight VNC:**
|
|
129
|
+
`python utils/novnc_proxy --vnc localhost:5901`
|
|
130
|
+
(5901 is the usual port of a VNC server on the same computer. If
|
|
131
|
+
yours uses a different port, change the number.)
|
|
132
|
+
6. **Open your browser** and go to `http://localhost:6080`. Press
|
|
133
|
+
**Connect** and enter your VNC password when asked. If you used
|
|
134
|
+
the ready-made test setup, the password is `xlight12`.
|
|
135
|
+
|
|
136
|
+
To stop it, press Ctrl+C in the terminal.
|
|
137
|
+
|
|
138
|
+
### No install at all — try it in a GitHub Codespace
|
|
139
|
+
|
|
140
|
+
1. Go to <https://github.com/xgauravyaduvanshii/xlight-vnc> and
|
|
141
|
+
press the green **Code** button, then **Codespaces** →
|
|
142
|
+
**Create codespace on main**.
|
|
143
|
+
2. Wait a minute while the test computer (Linux desktop) starts.
|
|
144
|
+
3. Open the link shown at the end of the setup
|
|
145
|
+
(`https://<your-codespace>-6080.app.github.dev/xlight.html`).
|
|
146
|
+
4. Press **Connect**. The test password is `xlight12`.
|
|
147
|
+
|
|
148
|
+
### Share your screen with tunl
|
|
149
|
+
|
|
150
|
+
Want someone far away to see your screen without them installing
|
|
151
|
+
anything? xLight VNC can give your screen a public internet link
|
|
152
|
+
like `https://something.tunl.cloud`:
|
|
153
|
+
|
|
154
|
+
1. On the computer sharing its screen, open a terminal in the
|
|
155
|
+
xLight VNC folder and install the small helper once:
|
|
156
|
+
`cd host` then `npm i`
|
|
157
|
+
2. Start it:
|
|
158
|
+
`node host/tunl-server.mjs`
|
|
159
|
+
(it listens on port 6081; the VNC page stays on port 6080).
|
|
160
|
+
3. Open xLight VNC in your browser, open the left sidebar, and
|
|
161
|
+
press the **Share** button.
|
|
162
|
+
4. **First time only:** press **Log in with tunl**. The panel shows
|
|
163
|
+
a big 8-digit code and a link — open the link, enter the code,
|
|
164
|
+
and approve it. Your login is saved on that computer.
|
|
165
|
+
**If this computer is already logged in to tunl, there is no
|
|
166
|
+
login step at all** — the panel shows your name and email
|
|
167
|
+
directly ("Logged in as …").
|
|
168
|
+
5. Press **Start sharing** and press **Copy link**. Send that link
|
|
169
|
+
to whoever needs to see your screen. They still need the VNC
|
|
170
|
+
password.
|
|
171
|
+
6. Press **Stop sharing** when you are done — the link stops
|
|
172
|
+
working immediately.
|
|
173
|
+
|
|
174
|
+
If the panel says the tunl service is not reachable, the helper from
|
|
175
|
+
step 2 is not running on that computer yet. If you opened the page
|
|
176
|
+
through a tunl link itself, open it from its local address
|
|
177
|
+
(`http://localhost:6080`) to share it.
|
|
178
|
+
|
|
179
|
+
### Installation from snap package
|
|
180
|
+
|
|
181
|
+
Running the command below installs the latest release of xLight VNC
|
|
182
|
+
from snap:
|
|
183
|
+
|
|
184
|
+
`sudo snap install xlight-vnc`
|
|
185
|
+
|
|
186
|
+
#### Running xLight VNC from snap directly
|
|
187
|
+
|
|
188
|
+
You can run the snap package installed xlight-vnc directly with, for example:
|
|
189
|
+
|
|
190
|
+
`xlight-vnc --listen 6081 --vnc localhost:5901 # /snap/bin/xlight-vnc if /snap/bin is not in your PATH`
|
|
191
|
+
|
|
192
|
+
If you want to use certificate files, due to standard snap confinement restrictions you need to have them in the /home/\<user\>/snap/xlight-vnc/current/ directory. If your username is jsmith an example command would be:
|
|
193
|
+
|
|
194
|
+
`xlight-vnc --listen 8443 --cert ~jsmith/snap/xlight-vnc/current/self.crt --key ~jsmith/snap/xlight-vnc/current/self.key --vnc ubuntu.example.com:5901`
|
|
195
|
+
|
|
196
|
+
#### Running xLight VNC from snap as a service (daemon)
|
|
197
|
+
|
|
198
|
+
The snap package also has the capability to run a 'xlight-vnc' service which can be
|
|
199
|
+
configured to listen on multiple ports connecting to multiple VNC servers
|
|
200
|
+
(effectively a service running multiple instances of xlight-vnc).
|
|
201
|
+
Instructions (with example values):
|
|
202
|
+
|
|
203
|
+
List current services (out-of-box this will be blank):
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
sudo snap get xlight-vnc services
|
|
207
|
+
Key Value
|
|
208
|
+
services.n6080 {...}
|
|
209
|
+
services.n6081 {...}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Create a new service that listens on port 6082 and connects to the VNC server
|
|
213
|
+
running on port 5902 on localhost:
|
|
214
|
+
|
|
215
|
+
`sudo snap set xlight-vnc services.n6082.listen=6082 services.n6082.vnc=localhost:5902`
|
|
216
|
+
|
|
217
|
+
(Any services you define with 'snap set' will be automatically started)
|
|
218
|
+
Note that the name of the service, 'n6082' in this example, can be anything
|
|
219
|
+
as long as it doesn't start with a number or contain spaces/special characters.
|
|
220
|
+
|
|
221
|
+
View the configuration of the service just created:
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
sudo snap get xlight-vnc services.n6082
|
|
225
|
+
Key Value
|
|
226
|
+
services.n6082.listen 6082
|
|
227
|
+
services.n6082.vnc localhost:5902
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Disable a service (note that because of a limitation in snap it's currently not
|
|
231
|
+
possible to unset config variables, setting them to blank values is the way
|
|
232
|
+
to disable a service):
|
|
233
|
+
|
|
234
|
+
`sudo snap set xlight-vnc services.n6082.listen='' services.n6082.vnc=''`
|
|
235
|
+
|
|
236
|
+
(Any services you set to blank with 'snap set' like this will be automatically stopped)
|
|
237
|
+
|
|
238
|
+
Verify that the service is disabled (blank values):
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
sudo snap get xlight-vnc services.n6082
|
|
242
|
+
Key Value
|
|
243
|
+
services.n6082.listen
|
|
244
|
+
services.n6082.vnc
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Browsers that work
|
|
248
|
+
|
|
249
|
+
Any modern browser: Chrome 89+, Firefox 89+, Safari 15+, Opera 75+,
|
|
250
|
+
Edge 89+, including on phones (iOS and Android).
|
|
251
|
+
|
|
252
|
+
### For developers
|
|
253
|
+
|
|
254
|
+
- Embedding the client in your own page: [docs/EMBEDDING.md](docs/EMBEDDING.md)
|
|
255
|
+
- Using it as a JavaScript library: [docs/LIBRARY.md](docs/LIBRARY.md)
|
|
256
|
+
- Host-side audio + tunl services: [host/README.md](host/README.md)
|
|
257
|
+
- Report a problem or ask for a feature:
|
|
258
|
+
[github issues](https://github.com/xgauravyaduvanshii/xlight-vnc/issues)
|
|
259
|
+
|
|
260
|
+
### Authors/Contributors
|
|
261
|
+
|
|
262
|
+
See [AUTHORS](AUTHORS) for a (full-ish) list of authors. xLight VNC is
|
|
263
|
+
maintained by [Gaurav Kumar Yadav](https://github.com/xgauravyaduvanshii).
|
|
264
|
+
|
|
265
|
+
Licensed mainly under the [MPL 2.0](http://www.mozilla.org/MPL/2.0/), see
|
|
266
|
+
[the license document](LICENSE.txt) for details.
|
package/app/audio-mse.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* xLight VNC — WebSocket / MSE fallback audio player (own code).
|
|
3
|
+
* Follows the MediaSource pattern (mode 'sequence', drift check, quota
|
|
4
|
+
* handling) described in audio-plan.md §1.2/§6.1. No plugin code copied.
|
|
5
|
+
*
|
|
6
|
+
* Feed it WebM/Opus chunks from the audio proxy (host/audio-proxy.sh).
|
|
7
|
+
* MIME: audio/webm; codecs="opus".
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as Log from "../core/util/logging.js";
|
|
11
|
+
|
|
12
|
+
const MIME_TYPE = 'audio/webm; codecs="opus"';
|
|
13
|
+
|
|
14
|
+
// Seconds of buffered audio we keep when the quota is exceeded.
|
|
15
|
+
const BUFFER_MIN_REMAIN = 30;
|
|
16
|
+
// Drift (seconds behind the live edge) that triggers a resync.
|
|
17
|
+
const DRIFT_LIMIT = 1.0;
|
|
18
|
+
// How often the drift check runs (ms).
|
|
19
|
+
const DRIFT_CHECK_MS = 5000;
|
|
20
|
+
|
|
21
|
+
export function isMSESupported() {
|
|
22
|
+
return typeof window !== "undefined" &&
|
|
23
|
+
typeof window.MediaSource !== "undefined" &&
|
|
24
|
+
window.MediaSource.isTypeSupported(MIME_TYPE);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class MediaSourcePlayer {
|
|
28
|
+
constructor(audioEl) {
|
|
29
|
+
this.audioEl = audioEl;
|
|
30
|
+
this.mediaSource = null;
|
|
31
|
+
this.sourceBuffer = null;
|
|
32
|
+
this.queue = [];
|
|
33
|
+
this.appending = false;
|
|
34
|
+
this.driftTimer = null;
|
|
35
|
+
this.started = false;
|
|
36
|
+
this.closed = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
attach() {
|
|
40
|
+
if (this.mediaSource) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.closed = false;
|
|
44
|
+
this.mediaSource = new MediaSource();
|
|
45
|
+
this.audioEl.src = URL.createObjectURL(this.mediaSource);
|
|
46
|
+
this.mediaSource.addEventListener("sourceopen", () => {
|
|
47
|
+
this._onSourceOpen();
|
|
48
|
+
}, { once: true });
|
|
49
|
+
this.driftTimer = window.setInterval(() => this._checkDrift(), DRIFT_CHECK_MS);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_onSourceOpen() {
|
|
53
|
+
if (this.closed || !this.mediaSource) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
this.sourceBuffer = this.mediaSource.addSourceBuffer(MIME_TYPE);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
// Unsupported MIME on this browser; caller surfaces the error.
|
|
60
|
+
this._fail(err);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.sourceBuffer.mode = "sequence";
|
|
64
|
+
this.sourceBuffer.addEventListener("updateend", () => {
|
|
65
|
+
this.appending = false;
|
|
66
|
+
this._drainQueue();
|
|
67
|
+
});
|
|
68
|
+
this._drainQueue();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Queue a WebM chunk (ArrayBuffer / Uint8Array) for appending.
|
|
72
|
+
feed(data) {
|
|
73
|
+
if (this.closed) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.queue.push(data);
|
|
77
|
+
this._drainQueue();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_drainQueue() {
|
|
81
|
+
if (!this.sourceBuffer || this.appending || this.queue.length === 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (this.mediaSource.readyState !== "open") {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.appending = true;
|
|
88
|
+
const chunk = this.queue.shift();
|
|
89
|
+
try {
|
|
90
|
+
this.sourceBuffer.appendBuffer(chunk);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
this.appending = false;
|
|
93
|
+
if (err && err.name === "QuotaExceededError") {
|
|
94
|
+
this._dropOldBuffer();
|
|
95
|
+
// Re-queue the chunk so it is retried after the trim.
|
|
96
|
+
this.queue.unshift(chunk);
|
|
97
|
+
this._drainQueue();
|
|
98
|
+
} else {
|
|
99
|
+
this._fail(err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_dropOldBuffer() {
|
|
105
|
+
if (!this.sourceBuffer || this.sourceBuffer.buffered.length === 0) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const end = this.sourceBuffer.buffered.end(0);
|
|
110
|
+
const removeEnd = end - BUFFER_MIN_REMAIN;
|
|
111
|
+
if (removeEnd > 0) {
|
|
112
|
+
this.sourceBuffer.remove(0, removeEnd);
|
|
113
|
+
}
|
|
114
|
+
} catch (err) {
|
|
115
|
+
// Trimming is best-effort; a failed trim just leaves more buffered.
|
|
116
|
+
Log.Warn("xLight audio: buffer trim failed", err);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
_checkDrift() {
|
|
121
|
+
if (this.closed || !this.sourceBuffer ||
|
|
122
|
+
this.sourceBuffer.buffered.length === 0) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
const liveEdge = this.sourceBuffer.buffered.end(0);
|
|
127
|
+
const drift = liveEdge - this.audioEl.currentTime;
|
|
128
|
+
if (drift > DRIFT_LIMIT) {
|
|
129
|
+
// Live edge: jump to the newest buffered audio, discard the lag.
|
|
130
|
+
this.audioEl.currentTime = liveEdge;
|
|
131
|
+
}
|
|
132
|
+
} catch (err) {
|
|
133
|
+
// currentTime seeks on a live stream can throw; ignore and retry.
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Start playback. Must be called from (or after) a user gesture.
|
|
138
|
+
async play() {
|
|
139
|
+
if (!this.started) {
|
|
140
|
+
this.started = true;
|
|
141
|
+
}
|
|
142
|
+
return this.audioEl.play();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
_fail(err) {
|
|
146
|
+
if (this.onError) {
|
|
147
|
+
this.onError(err);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
close() {
|
|
152
|
+
this.closed = true;
|
|
153
|
+
if (this.driftTimer !== null) {
|
|
154
|
+
window.clearInterval(this.driftTimer);
|
|
155
|
+
this.driftTimer = null;
|
|
156
|
+
}
|
|
157
|
+
this.queue = [];
|
|
158
|
+
if (this.sourceBuffer && this.mediaSource &&
|
|
159
|
+
this.mediaSource.readyState === "open") {
|
|
160
|
+
try {
|
|
161
|
+
this.mediaSource.endOfStream();
|
|
162
|
+
} catch (err) {
|
|
163
|
+
// Already closed; ignore.
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
this.sourceBuffer = null;
|
|
167
|
+
if (this.audioEl.src) {
|
|
168
|
+
URL.revokeObjectURL(this.audioEl.src);
|
|
169
|
+
this.audioEl.removeAttribute("src");
|
|
170
|
+
}
|
|
171
|
+
this.mediaSource = null;
|
|
172
|
+
this.started = false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default MediaSourcePlayer;
|