some tweeks

This commit is contained in:
Craig 2020-01-13 11:28:14 +00:00
parent 0c8af21fab
commit c85abb3b63
14 changed files with 105 additions and 31 deletions

4
.docker/build.sh Normal file → Executable file
View File

@ -7,4 +7,6 @@ cd ../client
npm install && npm run build
cd ../
docker build -f Dockerfile -t neko .
sudo docker build -f Dockerfile -t neko .
# sudo docker run -p 8080:8080 --shm-size=2gb neko:latest

View File

@ -1,4 +1,7 @@
unload-module module-suspend-on-idle
#!/usr/bin/pulseaudio -nF
# Allow pulse audio to be accessed via TCP (from localhost only), to allow other users to access the virtual devices
load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket auth-anonymous=1
load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket auth-anonymous=1
### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

5
.docker/entrypoint.sh Normal file → Executable file
View File

@ -1,7 +1,6 @@
#!/bin/bash
echo "Starting dbus"
/etc/init.d/dbus start
sudo /etc/init.d/dbus start
echo "Starting supervisord"
su -p -l $NEKO_USER -c '/usr/bin/supervisord -c /etc/neko/supervisord.conf' -s /bin/bash
/usr/bin/supervisord -c /etc/neko/supervisord.conf

View File

@ -3,10 +3,40 @@
"DisableAppUpdate": true,
"DisableTelemetry": true,
"DontCheckDefaultBrowser": true,
"DisableFirefoxAccounts": true,
"DisablePrivateBrowsing": true,
"DisableProfileImport": true,
"BlockAboutConfig": true,
"BlockAboutProfiles": true,
"BlockAboutSupport": true,
"OverrideFirstRunPage": "",
"OfferToSaveLogins": false,
"PromptForDownloadLocation":false,
"DisableSetDesktopBackground":false,
"DisableDeveloperTools":false,
"DisableFeedbackCommands":false,
"DisableFirefoxScreenshots":false,
"DisableProfileRefresh":false,
"OfferToSaveLoginsDefault":false,
"PasswordManagerEnabled":false,
"SanitizeOnShutdown": {
"Cache": true,
"Cookies": true,
"Downloads": true,
"FormData": true,
"History": true,
"Sessions": true,
"SiteSettings": true,
"OfflineApps": true
},
"FirefoxHome": {
"Search": true,
"TopSites": true,
"Highlights": false,
"Pocket": false,
"Snippets": false,
"Locked": false
},
"ExtensionSettings": {
"uBlock0@raymondhill.net": {
"installation_mode": "force_installed",
@ -20,6 +50,14 @@
"Homepage": {
"Additional": [],
"StartPage": "none"
}
},
"Bookmarks": [
{
"Title": "9 Anime",
"URL": "https://9anime.xyz/",
"Favicon": "https://9anime.xyz/favicon.png",
"Placement": "toolbar"
}
]
}
}

View File

@ -1,18 +1,17 @@
[supervisord]
environment=PULSE_SERVER="unix:/tmp/pulseaudio.socket",DISPLAY=":%(ENV_NEKO_DISPLAY)s"
nodaemon=true
pidfile=/var/run/supervisord.pid
logfile=/dev/null
logfile_maxbytes=0
loglevel=debug
[program:xvfb]
command=/usr/bin/Xvfb :%(ENV_NEKO_DISPLAY)s -screen 0 %(ENV_NEKO_WIDTH)sx%(ENV_NEKO_HEIGHT)sx24+32
redirect_stderr=true
autorestart=true
priority=300
[program:pulseaudio]
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1 --file=/etc/neko/pulseaudio.pa
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1
autorestart=true
priority=300
@ -27,6 +26,6 @@ autorestart=true
priority=400
[program:neko]
command=/usr/bin/neko serve -d --static "/var/www"
command=/usr/bin/neko serve --static "/var/www"
autorestart=true
priority=500
priority=800

View File

@ -1,7 +1,6 @@
[supervisord]
environment=PULSE_SERVER="unix:/tmp/pulseaudio.socket",DISPLAY=":%(ENV_NEKO_DISPLAY)s"
nodaemon=true
pidfile=/var/run/supervisord.pid
#logfile=/dev/null
#logfile_maxbytes=0
loglevel=debug
@ -13,7 +12,7 @@ autorestart=true
priority=300
[program:pulseaudio]
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1 --file=/etc/neko/pulseaudio.pa
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1
autorestart=true
priority=300

View File

@ -6,8 +6,9 @@ sudo mkdir -p /var/run/dbus /etc/neko
sudo /etc/init.d/dbus start
sudo cp supervisord.conf /etc/neko/supervisord.conf
sudo cp pulseaudio.pa /etc/neko/pulseaudio.pa
sudo cp openbox.xml /etc/neko/openbox.xml
sudo cp default.pa /etc/pulse/default.pa
sudo cp policies.json /usr/lib/firefox-esr/distribution/policies.json
if [ ! -f /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi ]; then

0
.github/.gitkeep vendored
View File

BIN
.github/logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -1,4 +1,4 @@
FROM buildpack-deps:stretch
FROM debian:stretch-slim
ARG USERNAME=neko
ARG USER_UID=1000
@ -7,9 +7,9 @@ ARG USER_GID=$USER_UID
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
# Install dependencies ttf-freefont
RUN apt-get update \
&& apt-get -y install curl supervisor openbox dbus-x11 ttf-freefont xvfb pulseaudio consolekit firefox-esr \
&& apt-get -y install curl supervisor openbox dbus-x11 xvfb pulseaudio firefox-esr \
&& apt-get -y install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio libxcb-xkb-dev libxkbcommon-x11-dev \
#
# Create a non-root user
@ -19,18 +19,23 @@ RUN apt-get update \
&& adduser $USERNAME video \
&& adduser $USERNAME pulse \
#
# Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
#
# Install uBlock
&& mkdir -p /usr/lib/firefox-esr/distribution/extensions \
&& curl -o /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi \
#
# Make directories for neko
&& mkdir -p /etc/neko /var/www \
#
# Setup Pulse Audio
mkdir -p /home/$USERNAME/.config/pulse/ \
&& echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME \
#
# Make directories for neko
&& mkdir -p /etc/neko /var/www \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
@ -38,9 +43,9 @@ RUN apt-get update \
#
# Copy configuation files
COPY .docker/pulseaudio.pa /etc/neko/pulseaudio.pa
COPY .docker/openbox.xml /etc/neko/openbox.xml
COPY .docker/supervisord.conf /etc/neko/supervisord.conf
COPY .docker/default.pa /etc/pulse/default.pa
COPY .docker/policies.json /usr/lib/firefox-esr/distribution/policies.json
#
@ -48,18 +53,22 @@ COPY .docker/policies.json /usr/lib/firefox-esr/distribution/policies.json
COPY client/dist/ /var/www
COPY server/bin/neko /usr/bin/neko
USER $USERNAME
#
# Neko Env
ENV NEKO_USER=$USERNAME
ENV NEKO_DISPLAY=0
ENV NEKO_WIDTH=1280
ENV NEKO_HEIGHT=720
ENV NEKO_URL=https://www.youtube.com/embed/QH2-TGUlwu4
ENV NEKO_PASSWORD=neko
ENV NEKO_BIND=0.0.0.0:80
ENV NEKO_BIND=0.0.0.0:8080
ENV NEKO_KEY=
ENV NEKO_CERT=
# Nayn
ENV NEKO_URL=https://www.youtube.com/embed/QH2-TGUlwu4
#
# Copy entrypoint
COPY .docker/entrypoint.sh /entrypoint.sh

View File

@ -1,3 +1,7 @@
<div align="center">
<img src="https://github.com/nurdism/neko/raw/master/.github/logo.png" width="650" height="auto"/>
</div>
# n.eko
This is a proof of concept project I threw together over the last few days, its ugly its not perfect but it looks nice. This uses web rtc to stream a desktop inside of a docker container, I made this because [rabb.it](https://en.wikipedia.org/wiki/Rabb.it) went under and my internet can't handle streaming and discord keeps crashing. I just want to watch anime with my friends ლ(ಠ益ಠლ) so I started digging throughout the net and found a few *kinda* clones, but non of them had the virtual browser, then I found [Turtus](https://github.com/Khauri/Turtus) and I was able to figure out the rest.
@ -7,10 +11,28 @@ This is by no means a fully featured clone of rabbit. It has no concept of other
I like cats, I'm a weeb and a nerd, I own the domain [n.eko.moe](https://n.eko.moe/) and I love that logo I came across, had to use it for something /shrug
### I need help setting this up!
Its a docker container, you need to have docker installed and then run
Its a docker container, you need to have docker installed, you then need to build the image
```
TODO:
cd .docker && ./build.sh
```
Then run the container:
```
sudo docker run -p 8080:8080 --shm-size=2gb neko:latest
```
*Note:* `--shm-size=2gb` is required, firefox-esr tabs will crash (not sure if 2gb is *really* needed)
### Config
```
NEKO_USER=$USERNAME // User
NEKO_DISPLAY=0 // Display number
NEKO_WIDTH=1280 // Display width
NEKO_HEIGHT=720 // Display width
NEKO_PASSWORD=neko // Password
NEKO_BIND=0.0.0.0:8080 // Bind
NEKO_KEY= // Key (SSL)
NEKO_CERT= // Cert (SSL)
```
### Development

View File

@ -0,0 +1 @@
# n.eko Client

View File

@ -0,0 +1 @@
# n.eko Server

View File

@ -152,16 +152,16 @@ func (manager *WebRTCManager) onData(session *session, msg webrtc.DataChannelMes
if key, ok := keys.Mouse[int(payload.Key)]; ok {
switch int(payload.Key) {
case keys.MOUSE_WHEEL_DOWN:
robotgo.Scroll(0, -10)
robotgo.Scroll(0, -1)
break
case keys.MOUSE_WHEEL_UP:
robotgo.Scroll(0, 10)
robotgo.Scroll(0, 1)
break
case keys.MOUSE_WHEEL_LEFT:
robotgo.Scroll(-10, 0)
robotgo.Scroll(-1, 0)
break
case keys.MOUSE_WHEEL_RIGH:
robotgo.Scroll(10, 0)
robotgo.Scroll(1, 0)
break
default:
robotgo.Click(key, false)