mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Compare commits
23 Commits
v2.8.2
...
url_params
Author | SHA1 | Date | |
---|---|---|---|
2f9964580f | |||
b8881b3a46 | |||
355c0eac0d | |||
4d023df692 | |||
792b1ac111 | |||
a03b29ba01 | |||
683b750189 | |||
3c4d7b9d60 | |||
7a9b33706a | |||
052a961fd9 | |||
8ef9c1aff5 | |||
6ed3493aa0 | |||
5959d056f3 | |||
92ad202bfe | |||
cd4acb5eec | |||
a32be0b44a | |||
b2080649ea | |||
851c38b8fd | |||
e2336be568 | |||
e417ec5dbe | |||
ad7e1f2b7b | |||
91e1a8b502 | |||
9bdf9c8851 |
@ -27,7 +27,7 @@ RUN set -eux; apt-get update; \
|
|||||||
#
|
#
|
||||||
# build server
|
# build server
|
||||||
COPY server/ .
|
COPY server/ .
|
||||||
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go
|
RUN ./build
|
||||||
|
|
||||||
#
|
#
|
||||||
# STAGE 2: CLIENT
|
# STAGE 2: CLIENT
|
||||||
@ -96,9 +96,12 @@ RUN set -eux; \
|
|||||||
chown $USERNAME /tmp/.X11-unix/; \
|
chown $USERNAME /tmp/.X11-unix/; \
|
||||||
#
|
#
|
||||||
# make directories for neko
|
# make directories for neko
|
||||||
mkdir -p /etc/neko /var/www /var/log/neko /home/$USERNAME/.config/pulse /home/$USERNAME/.local/share/xorg; \
|
mkdir -p /etc/neko /var/www /var/log/neko \
|
||||||
|
/tmp/runtime-$USERNAME \
|
||||||
|
/home/$USERNAME/.config/pulse \
|
||||||
|
/home/$USERNAME/.local/share/xorg; \
|
||||||
chmod 1777 /var/log/neko; \
|
chmod 1777 /var/log/neko; \
|
||||||
chown $USERNAME /var/log/neko/; \
|
chown $USERNAME /var/log/neko/ /tmp/runtime-$USERNAME; \
|
||||||
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
||||||
#
|
#
|
||||||
# clean up
|
# clean up
|
||||||
@ -117,6 +120,7 @@ COPY .docker/base/xorg.conf /etc/neko/xorg.conf
|
|||||||
ENV USER=$USERNAME
|
ENV USER=$USERNAME
|
||||||
ENV DISPLAY=:99.0
|
ENV DISPLAY=:99.0
|
||||||
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
||||||
|
ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME
|
||||||
ENV NEKO_PASSWORD=neko
|
ENV NEKO_PASSWORD=neko
|
||||||
ENV NEKO_PASSWORD_ADMIN=admin
|
ENV NEKO_PASSWORD_ADMIN=admin
|
||||||
ENV NEKO_BIND=:8080
|
ENV NEKO_BIND=:8080
|
||||||
|
@ -27,29 +27,32 @@ RUN set -eux; apt-get update; \
|
|||||||
#
|
#
|
||||||
# build server
|
# build server
|
||||||
COPY server/ .
|
COPY server/ .
|
||||||
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go
|
RUN ./build
|
||||||
|
|
||||||
#
|
#
|
||||||
# STAGE 2: CLIENT
|
# STAGE 2: CLIENT
|
||||||
#
|
#
|
||||||
FROM node:18-bullseye-slim as client
|
|
||||||
|
|
||||||
# install dependencies
|
|
||||||
RUN set -eux; apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends python2 build-essential
|
|
||||||
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# install dependencies
|
# Because client builds fail in Github Actions, therefor we build it outside of Docker.
|
||||||
COPY client/package*.json ./
|
#
|
||||||
RUN npm install
|
# FROM node:18-bullseye-slim as client
|
||||||
|
#
|
||||||
|
# # install dependencies
|
||||||
|
# RUN set -eux; apt-get update; \
|
||||||
|
# apt-get install -y --no-install-recommends python2 build-essential
|
||||||
|
#
|
||||||
|
# WORKDIR /src
|
||||||
|
#
|
||||||
|
# #
|
||||||
|
# # install dependencies
|
||||||
|
# COPY client/package*.json ./
|
||||||
|
# RUN npm install
|
||||||
|
#
|
||||||
|
# #
|
||||||
|
# # build client
|
||||||
|
# COPY client/ .
|
||||||
|
# RUN npm run build
|
||||||
#
|
#
|
||||||
# build client
|
|
||||||
COPY client/ .
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# STAGE 3: RUNTIME
|
# STAGE 3: RUNTIME
|
||||||
#
|
#
|
||||||
@ -102,9 +105,12 @@ RUN set -eux; \
|
|||||||
chown $USERNAME /tmp/.X11-unix/; \
|
chown $USERNAME /tmp/.X11-unix/; \
|
||||||
#
|
#
|
||||||
# make directories for neko
|
# make directories for neko
|
||||||
mkdir -p /etc/neko /var/www /var/log/neko /home/$USERNAME/.config/pulse /home/$USERNAME/.local/share/xorg; \
|
mkdir -p /etc/neko /var/www /var/log/neko \
|
||||||
|
/tmp/runtime-$USERNAME \
|
||||||
|
/home/$USERNAME/.config/pulse \
|
||||||
|
/home/$USERNAME/.local/share/xorg; \
|
||||||
chmod 1777 /var/log/neko; \
|
chmod 1777 /var/log/neko; \
|
||||||
chown $USERNAME /var/log/neko/; \
|
chown $USERNAME /var/log/neko/ /tmp/runtime-$USERNAME; \
|
||||||
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
||||||
#
|
#
|
||||||
# clean up
|
# clean up
|
||||||
@ -123,6 +129,7 @@ COPY .docker/base/xorg.conf /etc/neko/xorg.conf
|
|||||||
ENV USER=$USERNAME
|
ENV USER=$USERNAME
|
||||||
ENV DISPLAY=:99.0
|
ENV DISPLAY=:99.0
|
||||||
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
||||||
|
ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME
|
||||||
ENV NEKO_PASSWORD=neko
|
ENV NEKO_PASSWORD=neko
|
||||||
ENV NEKO_PASSWORD_ADMIN=admin
|
ENV NEKO_PASSWORD_ADMIN=admin
|
||||||
ENV NEKO_BIND=:8080
|
ENV NEKO_BIND=:8080
|
||||||
@ -130,7 +137,8 @@ ENV NEKO_BIND=:8080
|
|||||||
#
|
#
|
||||||
# copy static files from previous stages
|
# copy static files from previous stages
|
||||||
COPY --from=server /src/bin/neko /usr/bin/neko
|
COPY --from=server /src/bin/neko /usr/bin/neko
|
||||||
COPY --from=client /src/dist/ /var/www
|
# COPY --from=client /src/dist/ /var/www
|
||||||
|
COPY client/dist/ /var/www
|
||||||
|
|
||||||
HEALTHCHECK --interval=10s --timeout=5s --retries=8 \
|
HEALTHCHECK --interval=10s --timeout=5s --retries=8 \
|
||||||
CMD wget -O - http://localhost:${NEKO_BIND#*:}/health || exit 1
|
CMD wget -O - http://localhost:${NEKO_BIND#*:}/health || exit 1
|
||||||
|
@ -27,7 +27,7 @@ RUN set -eux; apt-get update; \
|
|||||||
#
|
#
|
||||||
# build server
|
# build server
|
||||||
COPY server/ .
|
COPY server/ .
|
||||||
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go
|
RUN ./build
|
||||||
|
|
||||||
#
|
#
|
||||||
# STAGE 2: CLIENT
|
# STAGE 2: CLIENT
|
||||||
@ -105,9 +105,12 @@ RUN set -eux; \
|
|||||||
chown $USERNAME /tmp/.X11-unix/; \
|
chown $USERNAME /tmp/.X11-unix/; \
|
||||||
#
|
#
|
||||||
# make directories for neko
|
# make directories for neko
|
||||||
mkdir -p /etc/neko /var/www /var/log/neko /home/$USERNAME/.config/pulse /home/$USERNAME/.local/share/xorg; \
|
mkdir -p /etc/neko /var/www /var/log/neko \
|
||||||
|
/tmp/runtime-$USERNAME \
|
||||||
|
/home/$USERNAME/.config/pulse \
|
||||||
|
/home/$USERNAME/.local/share/xorg; \
|
||||||
chmod 1777 /var/log/neko; \
|
chmod 1777 /var/log/neko; \
|
||||||
chown $USERNAME /var/log/neko/; \
|
chown $USERNAME /var/log/neko/ /tmp/runtime-$USERNAME; \
|
||||||
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
||||||
#
|
#
|
||||||
# clean up
|
# clean up
|
||||||
@ -127,6 +130,7 @@ COPY .docker/base/intel/add-render-group.sh /usr/bin/add-render-group.sh
|
|||||||
ENV USER=$USERNAME
|
ENV USER=$USERNAME
|
||||||
ENV DISPLAY=:99.0
|
ENV DISPLAY=:99.0
|
||||||
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
||||||
|
ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME
|
||||||
ENV NEKO_PASSWORD=neko
|
ENV NEKO_PASSWORD=neko
|
||||||
ENV NEKO_PASSWORD_ADMIN=admin
|
ENV NEKO_PASSWORD_ADMIN=admin
|
||||||
ENV NEKO_BIND=:8080
|
ENV NEKO_BIND=:8080
|
||||||
|
@ -82,7 +82,7 @@ RUN set -eux; apt-get update; \
|
|||||||
#
|
#
|
||||||
# build server
|
# build server
|
||||||
COPY server/ .
|
COPY server/ .
|
||||||
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go
|
RUN ./build
|
||||||
|
|
||||||
#
|
#
|
||||||
# STAGE 2: CLIENT
|
# STAGE 2: CLIENT
|
||||||
@ -201,9 +201,12 @@ RUN set -eux; \
|
|||||||
chown $USERNAME /tmp/.X11-unix/; \
|
chown $USERNAME /tmp/.X11-unix/; \
|
||||||
#
|
#
|
||||||
# make directories for neko
|
# make directories for neko
|
||||||
mkdir -p /etc/neko /var/www /var/log/neko /home/$USERNAME/.config/pulse /home/$USERNAME/.local/share/xorg; \
|
mkdir -p /etc/neko /var/www /var/log/neko \
|
||||||
|
/tmp/runtime-$USERNAME \
|
||||||
|
/home/$USERNAME/.config/pulse \
|
||||||
|
/home/$USERNAME/.local/share/xorg; \
|
||||||
chmod 1777 /var/log/neko; \
|
chmod 1777 /var/log/neko; \
|
||||||
chown $USERNAME /var/log/neko/; \
|
chown $USERNAME /var/log/neko/ /tmp/runtime-$USERNAME; \
|
||||||
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
|
||||||
#
|
#
|
||||||
# clean up
|
# clean up
|
||||||
@ -263,6 +266,7 @@ COPY .docker/base/nvidia/entrypoint.sh /bin/entrypoint.sh
|
|||||||
ENV USER=$USERNAME
|
ENV USER=$USERNAME
|
||||||
ENV DISPLAY=:99.0
|
ENV DISPLAY=:99.0
|
||||||
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
|
||||||
|
ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME
|
||||||
ENV NEKO_PASSWORD=neko
|
ENV NEKO_PASSWORD=neko
|
||||||
ENV NEKO_PASSWORD_ADMIN=admin
|
ENV NEKO_PASSWORD_ADMIN=admin
|
||||||
ENV NEKO_BIND=:8080
|
ENV NEKO_BIND=:8080
|
||||||
|
@ -54,3 +54,14 @@ stdout_logfile=/var/log/neko/neko.log
|
|||||||
stdout_logfile_maxbytes=100MB
|
stdout_logfile_maxbytes=100MB
|
||||||
stdout_logfile_backups=10
|
stdout_logfile_backups=10
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
||||||
|
[unix_http_server]
|
||||||
|
file=/var/run/supervisor.sock
|
||||||
|
chmod=0700
|
||||||
|
chown=root:root
|
||||||
|
|
||||||
|
[supervisorctl]
|
||||||
|
serverurl=unix:///var/run/supervisor.sock
|
||||||
|
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
@ -10,7 +10,7 @@ RUN set -eux; \
|
|||||||
#
|
#
|
||||||
# install widevine module
|
# install widevine module
|
||||||
CHROMIUM_DIR="/usr/lib/chromium"; \
|
CHROMIUM_DIR="/usr/lib/chromium"; \
|
||||||
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | tail -n 1); \
|
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | sort --version-sort | tail -n 1); \
|
||||||
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
|
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
|
||||||
mkdir -p "${CHROMIUM_DIR}/WidevineCdm/_platform_specific/linux_x64"; \
|
mkdir -p "${CHROMIUM_DIR}/WidevineCdm/_platform_specific/linux_x64"; \
|
||||||
unzip -p /tmp/widevine.zip LICENSE.txt > "${CHROMIUM_DIR}/WidevineCdm/LICENSE"; \
|
unzip -p /tmp/widevine.zip LICENSE.txt > "${CHROMIUM_DIR}/WidevineCdm/LICENSE"; \
|
||||||
|
@ -14,7 +14,7 @@ RUN set -eux; \
|
|||||||
#
|
#
|
||||||
# install widevine module
|
# install widevine module
|
||||||
CHROMIUM_DIR="/usr/lib/chromium"; \
|
CHROMIUM_DIR="/usr/lib/chromium"; \
|
||||||
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | tail -n 1); \
|
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | sort --version-sort | tail -n 1); \
|
||||||
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
|
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
|
||||||
mkdir -p "${CHROMIUM_DIR}/WidevineCdm/_platform_specific/linux_x64"; \
|
mkdir -p "${CHROMIUM_DIR}/WidevineCdm/_platform_specific/linux_x64"; \
|
||||||
unzip -p /tmp/widevine.zip LICENSE.txt > "${CHROMIUM_DIR}/WidevineCdm/LICENSE"; \
|
unzip -p /tmp/widevine.zip LICENSE.txt > "${CHROMIUM_DIR}/WidevineCdm/LICENSE"; \
|
||||||
|
35
.docker/firefox/Dockerfile.nvidia
Normal file
35
.docker/firefox/Dockerfile.nvidia
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
ARG BASE_IMAGE=m1k1o/neko:base
|
||||||
|
FROM $BASE_IMAGE
|
||||||
|
|
||||||
|
ARG SRC_URL="https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
|
||||||
|
|
||||||
|
#
|
||||||
|
# install firefox
|
||||||
|
RUN set -eux; apt-get update; \
|
||||||
|
apt-get install -y --no-install-recommends openbox \
|
||||||
|
xz-utils bzip2 libgtk-3-0 libdbus-glib-1-2; \
|
||||||
|
#
|
||||||
|
# fetch latest release
|
||||||
|
wget -O /tmp/firefox-setup.tar.bz2 "${SRC_URL}"; \
|
||||||
|
mkdir /usr/lib/firefox; \
|
||||||
|
tar -xjf /tmp/firefox-setup.tar.bz2 -C /usr/lib; \
|
||||||
|
rm -f /tmp/firefox-setup.tar.bz2; \
|
||||||
|
ln -s /usr/lib/firefox/firefox /usr/bin/firefox; \
|
||||||
|
#
|
||||||
|
# create a profile directory
|
||||||
|
mkdir -p /home/neko/.mozilla/firefox/profile.default/extensions; \
|
||||||
|
chown -R neko:neko /home/neko/.mozilla/firefox/profile.default; \
|
||||||
|
#
|
||||||
|
# clean up
|
||||||
|
apt-get --purge autoremove -y xz-utils bzip2; \
|
||||||
|
apt-get clean -y; \
|
||||||
|
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
|
||||||
|
|
||||||
|
#
|
||||||
|
# copy configuation files
|
||||||
|
COPY supervisord.nvidia.conf /etc/neko/supervisord/firefox.conf
|
||||||
|
COPY neko.js /usr/lib/firefox/mozilla.cfg
|
||||||
|
COPY autoconfig.js /usr/lib/firefox/defaults/pref/autoconfig.js
|
||||||
|
COPY policies.json /usr/lib/firefox/distribution/policies.json
|
||||||
|
COPY --chown=neko profiles.ini /home/neko/.mozilla/firefox/profiles.ini
|
||||||
|
COPY openbox.xml /etc/neko/openbox.xml
|
28
.docker/firefox/supervisord.nvidia.conf
Normal file
28
.docker/firefox/supervisord.nvidia.conf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[program:firefox]
|
||||||
|
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
||||||
|
command=/bin/entrypoint.sh /usr/bin/firefox
|
||||||
|
--no-remote
|
||||||
|
-P default
|
||||||
|
--display=%(ENV_DISPLAY)s
|
||||||
|
-setDefaultBrowser
|
||||||
|
-width 1280
|
||||||
|
-height 720
|
||||||
|
stopsignal=INT
|
||||||
|
autorestart=true
|
||||||
|
priority=800
|
||||||
|
user=%(ENV_USER)s
|
||||||
|
stdout_logfile=/var/log/neko/firefox.log
|
||||||
|
stdout_logfile_maxbytes=100MB
|
||||||
|
stdout_logfile_backups=10
|
||||||
|
redirect_stderr=true
|
||||||
|
|
||||||
|
[program:openbox]
|
||||||
|
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
|
||||||
|
command=/usr/bin/openbox --config-file /etc/neko/openbox.xml
|
||||||
|
autorestart=true
|
||||||
|
priority=300
|
||||||
|
user=%(ENV_USER)s
|
||||||
|
stdout_logfile=/var/log/neko/openbox.log
|
||||||
|
stdout_logfile_maxbytes=100MB
|
||||||
|
stdout_logfile_backups=10
|
||||||
|
redirect_stderr=true
|
@ -1,7 +1,9 @@
|
|||||||
ARG BASE_IMAGE=m1k1o/neko:nvidia-base
|
ARG BASE_IMAGE=m1k1o/neko:nvidia-base
|
||||||
FROM $BASE_IMAGE
|
FROM $BASE_IMAGE
|
||||||
|
|
||||||
ARG SRC_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
|
# latest working version with EGL: 111.0.5563.146, revert when resolved
|
||||||
|
# 112.0.5615.49 fails: https://github.com/VirtualGL/virtualgl/issues/229
|
||||||
|
ARG SRC_URL="https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_111.0.5563.146-1_amd64.deb"
|
||||||
|
|
||||||
#
|
#
|
||||||
# install google chrome
|
# install google chrome
|
||||||
|
@ -8,7 +8,7 @@ ARG API_URL="https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edg
|
|||||||
RUN set -eux; apt-get update; \
|
RUN set -eux; apt-get update; \
|
||||||
#
|
#
|
||||||
# fetch latest release
|
# fetch latest release
|
||||||
SRC_URL="${API_URL}$(wget -O - "${API_URL}" 2>/dev/null | sed -n 's/.*href="\([^"]*\).*/\1/p' | tail -1)"; \
|
SRC_URL="${API_URL}$(wget -O - "${API_URL}" 2>/dev/null | sed -n 's/.*href="\([^"]*\).*/\1/p' | sort --version-sort | tail -1)"; \
|
||||||
wget -O /tmp/microsoft-edge.deb "${SRC_URL}"; \
|
wget -O /tmp/microsoft-edge.deb "${SRC_URL}"; \
|
||||||
apt-get install -y --no-install-recommends openbox /tmp/microsoft-edge.deb; \
|
apt-get install -y --no-install-recommends openbox /tmp/microsoft-edge.deb; \
|
||||||
#
|
#
|
||||||
|
@ -8,7 +8,7 @@ ARG API_URL="https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edg
|
|||||||
RUN set -eux; apt-get update; \
|
RUN set -eux; apt-get update; \
|
||||||
#
|
#
|
||||||
# fetch latest release
|
# fetch latest release
|
||||||
SRC_URL="${API_URL}$(wget -O - "${API_URL}" 2>/dev/null | sed -n 's/.*href="\([^"]*\).*/\1/p' | tail -1)"; \
|
SRC_URL="${API_URL}$(wget -O - "${API_URL}" 2>/dev/null | sed -n 's/.*href="\([^"]*\).*/\1/p' | sort --version-sort | tail -1)"; \
|
||||||
wget -O /tmp/microsoft-edge.deb "${SRC_URL}"; \
|
wget -O /tmp/microsoft-edge.deb "${SRC_URL}"; \
|
||||||
apt-get install -y --no-install-recommends openbox /tmp/microsoft-edge.deb; \
|
apt-get install -y --no-install-recommends openbox /tmp/microsoft-edge.deb; \
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,7 @@ ARG LIBFFMPEG_API_URL="https://api.github.com/repos/nwjs-ffmpeg-prebuilt/nwjs-ff
|
|||||||
RUN set -eux; apt-get update; \
|
RUN set -eux; apt-get update; \
|
||||||
#
|
#
|
||||||
# fetch latest release
|
# fetch latest release
|
||||||
VERSION="$(wget -O - "${API_URL}" 2>/dev/null | sed -n 's/.*href="\([^"/]*\).*/\1/p' | tail -1)"; \
|
VERSION="$(wget -O - "${API_URL}" 2>/dev/null | sed -n 's/.*href="\([^"/]*\).*/\1/p' | sort --version-sort | tail -1)"; \
|
||||||
wget -O /tmp/opera.deb "${API_URL}${VERSION}/linux/opera-stable_${VERSION}_amd64.deb"; \
|
wget -O /tmp/opera.deb "${API_URL}${VERSION}/linux/opera-stable_${VERSION}_amd64.deb"; \
|
||||||
apt-get install -y --no-install-recommends openbox jq unzip /tmp/opera.deb; \
|
apt-get install -y --no-install-recommends openbox jq unzip /tmp/opera.deb; \
|
||||||
#
|
#
|
||||||
|
@ -21,7 +21,7 @@ RUN set -eux; apt-get update; \
|
|||||||
chmod 4755 /usr/lib/chromium/chrome-sandbox; \
|
chmod 4755 /usr/lib/chromium/chrome-sandbox; \
|
||||||
#
|
#
|
||||||
# install widevine module
|
# install widevine module
|
||||||
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | tail -n 1); \
|
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | sort --version-sort | tail -n 1); \
|
||||||
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
|
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
|
||||||
unzip -p /tmp/widevine.zip libwidevinecdm.so > /usr/lib/chromium/libwidevinecdm.so; \
|
unzip -p /tmp/widevine.zip libwidevinecdm.so > /usr/lib/chromium/libwidevinecdm.so; \
|
||||||
chmod 644 /usr/lib/chromium/libwidevinecdm.so; \
|
chmod 644 /usr/lib/chromium/libwidevinecdm.so; \
|
||||||
|
37
.github/workflows/ghcr-arm.yml
vendored
37
.github/workflows/ghcr-arm.yml
vendored
@ -13,7 +13,7 @@ env:
|
|||||||
PLATFORMS: linux/arm64,linux/arm/v7
|
PLATFORMS: linux/arm64,linux/arm/v7
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-base:
|
build-client:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
#
|
#
|
||||||
# do not run on forks
|
# do not run on forks
|
||||||
@ -23,6 +23,41 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Set up node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
-
|
||||||
|
name: Build client
|
||||||
|
run: |
|
||||||
|
cd client
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
-
|
||||||
|
name: Upload client dist
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: client-dist
|
||||||
|
path: client/dist
|
||||||
|
|
||||||
|
build-base:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#
|
||||||
|
# do not run on forks
|
||||||
|
#
|
||||||
|
if: github.repository_owner == 'm1k1o'
|
||||||
|
needs: [ build-client ]
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Download client dist
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: client-dist
|
||||||
|
path: client/dist
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
2
.github/workflows/ghcr-nvidia.yml
vendored
2
.github/workflows/ghcr-nvidia.yml
vendored
@ -69,6 +69,8 @@ jobs:
|
|||||||
# Will build all images even if some fail.
|
# Will build all images even if some fail.
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- tag: firefox
|
||||||
|
dockerfile: Dockerfile.nvidia
|
||||||
- tag: brave
|
- tag: brave
|
||||||
dockerfile: Dockerfile.nvidia
|
dockerfile: Dockerfile.nvidia
|
||||||
- tag: chromium
|
- tag: chromium
|
||||||
|
4
LICENSE
4
LICENSE
@ -186,7 +186,9 @@
|
|||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright 2020 Nurdism <nurdism.io@gmail.com>, 2020-2021 m1k1o
|
Copyright (C) 2020 Nurdism <nurdism.io@gmail.com>
|
||||||
|
Copyright (C) 2020-2023 m1k1o
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -76,5 +76,20 @@
|
|||||||
about() {
|
about() {
|
||||||
this.$accessor.client.toggleAbout()
|
this.$accessor.client.toggleAbout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
const default_lang = new URL(location.href).searchParams.get('lang')
|
||||||
|
if (default_lang && this.langs.includes(default_lang)) {
|
||||||
|
this.$i18n.locale = default_lang
|
||||||
|
}
|
||||||
|
const show_side = new URL(location.href).searchParams.get('show_side')
|
||||||
|
if (show_side !== null) {
|
||||||
|
this.$accessor.client.setSide(show_side === '1')
|
||||||
|
}
|
||||||
|
const mute_chat = new URL(location.href).searchParams.get('mute_chat')
|
||||||
|
if (mute_chat !== null) {
|
||||||
|
this.$accessor.settings.setSound(mute_chat !== '1')
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,5 +6,6 @@ Vue.use(VueI18n)
|
|||||||
|
|
||||||
export const i18n = new VueI18n({
|
export const i18n = new VueI18n({
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
|
fallbackLocale: 'en',
|
||||||
messages,
|
messages,
|
||||||
})
|
})
|
||||||
|
@ -27,6 +27,10 @@ export const mutations = mutationTree(state, {
|
|||||||
state.side = !state.side
|
state.side = !state.side
|
||||||
set('side', state.side)
|
set('side', state.side)
|
||||||
},
|
},
|
||||||
|
setSide(state, side: boolean) {
|
||||||
|
state.side = side
|
||||||
|
set('side', side)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export const actions = actionTree({ state, getters, mutations }, {})
|
export const actions = actionTree({ state, getters, mutations }, {})
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
## master branch
|
## master branch
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
- Added nvidia support for firefox.
|
||||||
|
- Added `?lang=<lang>` parameter to the URL, which will set the language of the interface (by @mbattista).
|
||||||
|
|
||||||
|
### Misc
|
||||||
|
- Git commit and tag are now included in the build when creating a docker image.
|
||||||
|
|
||||||
## [n.eko v2.8.0](https://github.com/m1k1o/neko/releases/tag/v2.8.0)
|
## [n.eko v2.8.0](https://github.com/m1k1o/neko/releases/tag/v2.8.0)
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
@ -50,7 +50,7 @@ All images are also available on [GitHub Container Registry](https://github.com/
|
|||||||
- `ghcr.io/m1k1o/neko/xfce:latest`
|
- `ghcr.io/m1k1o/neko/xfce:latest`
|
||||||
- `ghcr.io/m1k1o/neko/kde:latest`
|
- `ghcr.io/m1k1o/neko/kde:latest`
|
||||||
|
|
||||||
For ARM-based images (like Raspberry Pi - with GPU hardware acceleration, Oracle Cloud ARM tier). Currently, not all images are available for ARM, because not all applications are available for ARM.
|
For ARM-based images (like Raspberry Pi - with GPU hardware acceleration, Oracle Cloud ARM tier). Currently, not all images are available for ARM, because not all applications are available for ARM. Please note, that `m1k1o/neko:arm-*` images from dockerhub are currently not maintained and they can contain outdated software. Please use images below:
|
||||||
|
|
||||||
- `ghcr.io/m1k1o/neko/arm-firefox:latest`
|
- `ghcr.io/m1k1o/neko/arm-firefox:latest`
|
||||||
- `ghcr.io/m1k1o/neko/arm-chromium:latest`
|
- `ghcr.io/m1k1o/neko/arm-chromium:latest`
|
||||||
@ -74,8 +74,9 @@ For images with VAAPI GPU hardware acceleration using intel drivers use:
|
|||||||
- `ghcr.io/m1k1o/neko/intel-xfce:latest`
|
- `ghcr.io/m1k1o/neko/intel-xfce:latest`
|
||||||
- `ghcr.io/m1k1o/neko/intel-kde:latest`
|
- `ghcr.io/m1k1o/neko/intel-kde:latest`
|
||||||
|
|
||||||
For images with Nvidia GPU hardware acceleration using EGL use:
|
For images with Nvidia GPU hardware acceleration using EGL (see example below) use (please note, there is a known issue with EGL and Chromium-based browsers, see [here](https://github.com/m1k1o/neko/issues/279)):
|
||||||
|
|
||||||
|
- `ghcr.io/m1k1o/neko/nvidia-firefox:latest`
|
||||||
- `ghcr.io/m1k1o/neko/nvidia-chromium:latest`
|
- `ghcr.io/m1k1o/neko/nvidia-chromium:latest`
|
||||||
- `ghcr.io/m1k1o/neko/nvidia-google-chrome:latest`
|
- `ghcr.io/m1k1o/neko/nvidia-google-chrome:latest`
|
||||||
- `ghcr.io/m1k1o/neko/nvidia-microsoft-edge:latest`
|
- `ghcr.io/m1k1o/neko/nvidia-microsoft-edge:latest`
|
||||||
@ -131,6 +132,17 @@ services:
|
|||||||
- UDP is generally better for latency. But some networks block UDP so it is good to have TCP available as fallback.
|
- UDP is generally better for latency. But some networks block UDP so it is good to have TCP available as fallback.
|
||||||
- Still, using `NEKO_ICELITE=true` is recommended.
|
- Still, using `NEKO_ICELITE=true` is recommended.
|
||||||
|
|
||||||
|
### Using turn servers instead of port forwarding
|
||||||
|
|
||||||
|
- If you don't want to use port forwarding, you can use turn servers.
|
||||||
|
- But you need to have your own turn server (e.g. [cotrun](https://github.com/coturn/coturn)) or have access to one.
|
||||||
|
- They are generally not free, because they require a lot of bandwidth.
|
||||||
|
- Please make sure that you correctly escape your turn server credentials in the environment variable or use aphostrophes.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
NEKO_ICESERVERS: '[{"urls": ["turn:<MY-COTURN-SERVER>:443?transport=udp", "turn:<MY-COTURN-SERVER>:443?transport=tcp", "turns:<MY-COTURN-SERVER>:443?transport=udp", "turns:<MY-COTURN-SERVER>:443?transport=tcp"], "credential": "<MY-COTURN-CREDENTIAL"}, {"urls": ["stun:stun.nextcloud.com:443"]}]'
|
||||||
|
```
|
||||||
|
|
||||||
### Want to customize and install own add-ons, set custom bookmarks?
|
### Want to customize and install own add-ons, set custom bookmarks?
|
||||||
- You would need to modify the existing policy file and mount it to your container.
|
- You would need to modify the existing policy file and mount it to your container.
|
||||||
- For Firefox, copy [this](https://github.com/m1k1o/neko/blob/master/.docker/firefox/policies.json) file, modify and mount it as: ` -v '${PWD}/policies.json:/usr/lib/firefox/distribution/policies.json'`
|
- For Firefox, copy [this](https://github.com/m1k1o/neko/blob/master/.docker/firefox/policies.json) file, modify and mount it as: ` -v '${PWD}/policies.json:/usr/lib/firefox/distribution/policies.json'`
|
||||||
@ -219,6 +231,12 @@ services:
|
|||||||
- You can verify that GPU is used for encoding by searching for `nvh264enc` in `docker logs neko` output.
|
- You can verify that GPU is used for encoding by searching for `nvh264enc` in `docker logs neko` output.
|
||||||
- If you don'ŧ specify `NEKO_HWENC: nvenc` environment variable, CPU encoding will be used but GPU will still be available for browser rendering.
|
- If you don'ŧ specify `NEKO_HWENC: nvenc` environment variable, CPU encoding will be used but GPU will still be available for browser rendering.
|
||||||
|
|
||||||
|
Broadcast pipeline is not hardware accelerated by default. You can use this pipeline created by [@evilalmus](https://github.com/m1k1o/neko/issues/276#issuecomment-1498362533).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
NEKO_BROADCAST_PIPELINE: "flvmux name=mux ! rtmpsink location={url} pulsesrc device={device} ! audio/x-raw,channels=2 ! audioconvert ! voaacenc ! mux. ximagesrc display-name={display} show-pointer=false use-damage=false ! video/x-raw,framerate=30/1 ! videoconvert ! queue ! video/x-raw,format=NV12 ! nvh264enc name=encoder preset=low-latency-hq gop-size=25 spatial-aq=true temporal-aq=true bitrate=2800 vbv-buffer-size=2800 rc-mode=6 ! h264parse config-interval=-1 ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! mux."
|
||||||
|
```
|
||||||
|
|
||||||
### Want to use VPN for your n.eko browsing?
|
### Want to use VPN for your n.eko browsing?
|
||||||
- Check this out: https://github.com/m1k1o/neko-vpn
|
- Check this out: https://github.com/m1k1o/neko-vpn
|
||||||
|
|
||||||
@ -238,6 +256,9 @@ services:
|
|||||||
- Adding `?cast=1` will hide all control and show only video.
|
- Adding `?cast=1` will hide all control and show only video.
|
||||||
- Adding `?embed=1` will hide most additional components and show only video.
|
- Adding `?embed=1` will hide most additional components and show only video.
|
||||||
- Adding `?volume=<0-1>` will set volume to given value.
|
- Adding `?volume=<0-1>` will set volume to given value.
|
||||||
|
- Adding `?lang=<language>` will set language to given value.
|
||||||
|
- Adding `?show_side=1` will show the sidebar on startup.
|
||||||
|
- Adding `?mute_chat=1` will mute the chat on startup.
|
||||||
- e.g. `http(s)://<URL:Port>/?pwd=neko&usr=guest&cast=1`
|
- e.g. `http(s)://<URL:Port>/?pwd=neko&usr=guest&cast=1`
|
||||||
|
|
||||||
### Screen size
|
### Screen size
|
||||||
|
@ -72,7 +72,8 @@ services:
|
|||||||
version: "3.4"
|
version: "3.4"
|
||||||
services:
|
services:
|
||||||
neko:
|
neko:
|
||||||
image: "m1k1o/neko:arm-chromium"
|
# see docs for more variants
|
||||||
|
image: "ghcr.io/m1k1o/neko/arm-chromium:latest"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
# increase on rpi's with more then 1gb ram.
|
# increase on rpi's with more then 1gb ram.
|
||||||
shm_size: "520mb"
|
shm_size: "520mb"
|
||||||
|
@ -94,7 +94,7 @@ services:
|
|||||||
+ NEKO_IPFETCH: https://ifconfig.co/ip
|
+ NEKO_IPFETCH: https://ifconfig.co/ip
|
||||||
```
|
```
|
||||||
|
|
||||||
Or you can specify your IP address manually using `NEKO_NAT1TO1`:
|
Or you can specify your IP address manually using `NEKO_NAT1TO1`: (It's read as NAT 1 to 1, so it's capital letter 'O', not zero '0', in NAT1`TO`1)
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
version: "3.4"
|
version: "3.4"
|
||||||
@ -210,3 +210,17 @@ Most likely you forgot to add `-cap-add=SYS_ADMIN` when using chromium-based bro
|
|||||||
```
|
```
|
||||||
|
|
||||||
This error originates from browser, that it could not connect to dbus. This does not affect us and can be ignored.
|
This error originates from browser, that it could not connect to dbus. This does not affect us and can be ignored.
|
||||||
|
|
||||||
|
### Broadcast pipeline not working with some ingest servers
|
||||||
|
|
||||||
|
See [related issue](https://github.com/m1k1o/neko/issues/276).
|
||||||
|
|
||||||
|
```
|
||||||
|
Could not connect to RTMP stream "'rtmp://<ingest-url>/live/<stream-key-removed> live=1'" for writing
|
||||||
|
```
|
||||||
|
|
||||||
|
Some ingest servers require `live=1` parameter in the URL (e.g. nginx-rtmp-module). Some do not and do not accept aphostrophes (e.g. owncast). You can try to change the pipeline to:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
NEKO_BROADCAST_PIPELINE: "flvmux name=mux ! rtmpsink location={url} pulsesrc device={device} ! audio/x-raw,channels=2 ! audioconvert ! voaacenc ! mux. ximagesrc display-name={display} show-pointer=false use-damage=false ! video/x-raw,framerate=28/1 ! videoconvert ! queue ! x264enc bframes=0 key-int-max=0 byte-stream=true tune=zerolatency speed-preset=veryfast ! mux."
|
||||||
|
```
|
||||||
|
17
server/build
17
server/build
@ -1,24 +1,35 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -ex
|
#
|
||||||
|
# aborting if any command returns a non-zero value
|
||||||
|
set -e
|
||||||
|
|
||||||
BUILD_TIME=`date -u +'%Y-%m-%dT%H:%M:%SZ'`
|
BUILD_TIME=`date -u +'%Y-%m-%dT%H:%M:%SZ'`
|
||||||
|
|
||||||
#
|
#
|
||||||
# set git build variables if git exists
|
# set git build variables if git exists
|
||||||
if git status > /dev/null 2>&1 && [ -z $GIT_COMMIT ] && [ -z $GIT_BRANCH ] && [ -z $GIT_DIRTY ];
|
if git status > /dev/null 2>&1 && [ -z $GIT_COMMIT ] && [ -z $GIT_BRANCH ] && [ -z $GIT_TAG ];
|
||||||
then
|
then
|
||||||
GIT_COMMIT=`git rev-parse --short HEAD`
|
GIT_COMMIT=`git rev-parse --short HEAD`
|
||||||
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
|
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
|
||||||
|
GIT_TAG=`git tag --points-at $GIT_COMMIT | head -n 1`
|
||||||
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"`
|
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"`
|
||||||
|
GIT_COMMIT="${GIT_DIRTY}${GIT_COMMIT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# load dependencies
|
||||||
|
go get -v -t -d .
|
||||||
|
|
||||||
|
#
|
||||||
|
# build server
|
||||||
go build \
|
go build \
|
||||||
-o bin/neko \
|
-o bin/neko \
|
||||||
-ldflags "
|
-ldflags "
|
||||||
-s -w
|
-s -w
|
||||||
-X 'm1k1o/neko.buildDate=${BUILD_TIME}'
|
-X 'm1k1o/neko.buildDate=${BUILD_TIME}'
|
||||||
-X 'm1k1o/neko.gitCommit=${GIT_DIRTY}${GIT_COMMIT}'
|
-X 'm1k1o/neko.gitCommit=${GIT_COMMIT}'
|
||||||
-X 'm1k1o/neko.gitBranch=${GIT_BRANCH}'
|
-X 'm1k1o/neko.gitBranch=${GIT_BRANCH}'
|
||||||
|
-X 'm1k1o/neko.gitTag=${GIT_TAG}'
|
||||||
" \
|
" \
|
||||||
cmd/neko/main.go;
|
cmd/neko/main.go;
|
||||||
|
@ -4,7 +4,7 @@ go 1.20
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fsnotify/fsnotify v1.6.0
|
github.com/fsnotify/fsnotify v1.6.0
|
||||||
github.com/go-chi/chi v4.1.2+incompatible
|
github.com/go-chi/chi/v5 v5.0.10
|
||||||
github.com/go-chi/cors v1.2.1
|
github.com/go-chi/cors v1.2.1
|
||||||
github.com/gorilla/websocket v1.5.0
|
github.com/gorilla/websocket v1.5.0
|
||||||
github.com/pion/ice/v2 v2.3.0
|
github.com/pion/ice/v2 v2.3.0
|
||||||
|
@ -63,8 +63,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
|
|||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||||
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
|
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
|
||||||
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
|
||||||
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
|
@ -14,6 +14,7 @@ type Server struct {
|
|||||||
Cert string
|
Cert string
|
||||||
Key string
|
Key string
|
||||||
Bind string
|
Bind string
|
||||||
|
Proxy bool
|
||||||
Static string
|
Static string
|
||||||
PathPrefix string
|
PathPrefix string
|
||||||
CORS []string
|
CORS []string
|
||||||
@ -35,6 +36,11 @@ func (Server) Init(cmd *cobra.Command) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Bool("proxy", false, "enable reverse proxy mode")
|
||||||
|
if err := viper.BindPFlag("proxy", cmd.PersistentFlags().Lookup("proxy")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().String("static", "./www", "path to neko client files to serve")
|
cmd.PersistentFlags().String("static", "./www", "path to neko client files to serve")
|
||||||
if err := viper.BindPFlag("static", cmd.PersistentFlags().Lookup("static")); err != nil {
|
if err := viper.BindPFlag("static", cmd.PersistentFlags().Lookup("static")); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -57,6 +63,7 @@ func (s *Server) Set() {
|
|||||||
s.Cert = viper.GetString("cert")
|
s.Cert = viper.GetString("cert")
|
||||||
s.Key = viper.GetString("key")
|
s.Key = viper.GetString("key")
|
||||||
s.Bind = viper.GetString("bind")
|
s.Bind = viper.GetString("bind")
|
||||||
|
s.Proxy = viper.GetBool("proxy")
|
||||||
s.Static = viper.GetString("static")
|
s.Static = viper.GetString("static")
|
||||||
s.PathPrefix = path.Join("/", path.Clean(viper.GetString("path_prefix")))
|
s.PathPrefix = path.Join("/", path.Clean(viper.GetString("path_prefix")))
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
type WebSocket struct {
|
type WebSocket struct {
|
||||||
Password string
|
Password string
|
||||||
AdminPassword string
|
AdminPassword string
|
||||||
Proxy bool
|
|
||||||
Locks []string
|
Locks []string
|
||||||
|
|
||||||
ControlProtection bool
|
ControlProtection bool
|
||||||
@ -30,11 +29,6 @@ func (WebSocket) Init(cmd *cobra.Command) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().Bool("proxy", false, "enable reverse proxy mode")
|
|
||||||
if err := viper.BindPFlag("proxy", cmd.PersistentFlags().Lookup("proxy")); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.PersistentFlags().StringSlice("locks", []string{}, "resources, that will be locked when starting (control, login)")
|
cmd.PersistentFlags().StringSlice("locks", []string{}, "resources, that will be locked when starting (control, login)")
|
||||||
if err := viper.BindPFlag("locks", cmd.PersistentFlags().Lookup("locks")); err != nil {
|
if err := viper.BindPFlag("locks", cmd.PersistentFlags().Lookup("locks")); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -63,7 +57,6 @@ func (WebSocket) Init(cmd *cobra.Command) error {
|
|||||||
func (s *WebSocket) Set() {
|
func (s *WebSocket) Set() {
|
||||||
s.Password = viper.GetString("password")
|
s.Password = viper.GetString("password")
|
||||||
s.AdminPassword = viper.GetString("password_admin")
|
s.AdminPassword = viper.GetString("password_admin")
|
||||||
s.Proxy = viper.GetBool("proxy")
|
|
||||||
s.Locks = viper.GetStringSlice("locks")
|
s.Locks = viper.GetStringSlice("locks")
|
||||||
|
|
||||||
s.ControlProtection = viper.GetBool("control_protection")
|
s.ControlProtection = viper.GetBool("control_protection")
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
@ -35,6 +35,9 @@ func New(conf *config.Server, webSocketHandler types.WebSocketHandler, desktop t
|
|||||||
|
|
||||||
router := chi.NewRouter()
|
router := chi.NewRouter()
|
||||||
router.Use(middleware.RequestID) // Create a request ID for each request
|
router.Use(middleware.RequestID) // Create a request ID for each request
|
||||||
|
if conf.Proxy {
|
||||||
|
router.Use(middleware.RealIP)
|
||||||
|
}
|
||||||
router.Use(middleware.RequestLogger(&logformatter{logger}))
|
router.Use(middleware.RequestLogger(&logformatter{logger}))
|
||||||
router.Use(middleware.Recoverer) // Recover from panics without crashing server
|
router.Use(middleware.Recoverer) // Recover from panics without crashing server
|
||||||
router.Use(middleware.Compress(5, "application/octet-stream"))
|
router.Use(middleware.Compress(5, "application/octet-stream"))
|
||||||
@ -163,7 +166,13 @@ func New(conf *config.Server, webSocketHandler types.WebSocketHandler, desktop t
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
r.ParseMultipartForm(32 << 20)
|
err = r.ParseMultipartForm(32 << 20)
|
||||||
|
if err != nil || r.MultipartForm == nil {
|
||||||
|
logger.Warn().Err(err).Msg("failed to parse multipart form")
|
||||||
|
http.Error(w, "error parsing form", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for _, formheader := range r.MultipartForm.File["files"] {
|
for _, formheader := range r.MultipartForm.File["files"] {
|
||||||
filePath := webSocketHandler.FileTransferPath(formheader.Filename)
|
filePath := webSocketHandler.FileTransferPath(formheader.Filename)
|
||||||
|
|
||||||
@ -184,6 +193,11 @@ func New(conf *config.Server, webSocketHandler types.WebSocketHandler, desktop t
|
|||||||
|
|
||||||
io.Copy(f, formfile)
|
io.Copy(f, formfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = r.MultipartForm.RemoveAll()
|
||||||
|
if err != nil {
|
||||||
|
logger.Warn().Err(err).Msg("failed to remove multipart form")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
@ -31,21 +31,10 @@ func GetIP(serverUrl string) (string, error) {
|
|||||||
}
|
}
|
||||||
defer rsp.Body.Close()
|
defer rsp.Body.Close()
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(rsp.Body)
|
buf, err := io.ReadAll(rsp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(bytes.TrimSpace(buf)), nil
|
return string(bytes.TrimSpace(buf)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetHttpRequestIP(r *http.Request, proxy bool) string {
|
|
||||||
IPAddress := r.Header.Get("X-Real-Ip")
|
|
||||||
if IPAddress == "" {
|
|
||||||
IPAddress = r.Header.Get("X-Forwarded-For")
|
|
||||||
}
|
|
||||||
if IPAddress == "" || !proxy {
|
|
||||||
IPAddress = r.RemoteAddr
|
|
||||||
}
|
|
||||||
return IPAddress
|
|
||||||
}
|
|
||||||
|
@ -290,7 +290,7 @@ func (ws *WebSocketHandler) Upgrade(w http.ResponseWriter, r *http.Request) erro
|
|||||||
socket := &WebSocket{
|
socket := &WebSocket{
|
||||||
id: id,
|
id: id,
|
||||||
ws: ws,
|
ws: ws,
|
||||||
address: utils.GetHttpRequestIP(r, ws.conf.Proxy),
|
address: r.RemoteAddr,
|
||||||
connection: connection,
|
connection: connection,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"m1k1o/neko/internal/capture"
|
"m1k1o/neko/internal/capture"
|
||||||
"m1k1o/neko/internal/config"
|
"m1k1o/neko/internal/config"
|
||||||
@ -25,7 +26,7 @@ const Header = `&34
|
|||||||
/ |/ / _ \/ //_/ __ \ ) ( ')
|
/ |/ / _ \/ //_/ __ \ ) ( ')
|
||||||
/ /| / __/ ,< / /_/ / ( / )
|
/ /| / __/ ,< / /_/ / ( / )
|
||||||
/_/ |_/\___/_/|_|\____/ \(__)|
|
/_/ |_/\___/_/|_|\____/ \(__)|
|
||||||
&1&37 nurdism/m1k1o &33%s v%s&0
|
&1&37 nurdism/m1k1o &33%s %s&0
|
||||||
`
|
`
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -35,13 +36,8 @@ var (
|
|||||||
gitCommit = "dev"
|
gitCommit = "dev"
|
||||||
//
|
//
|
||||||
gitBranch = "dev"
|
gitBranch = "dev"
|
||||||
|
//
|
||||||
// Major version when you make incompatible API changes,
|
gitTag = "dev"
|
||||||
major = "2"
|
|
||||||
// Minor version when you add functionality in a backwards-compatible manner, and
|
|
||||||
minor = "8"
|
|
||||||
// Patch version when you make backwards-compatible bug fixes.
|
|
||||||
patch = "0"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Service *Neko
|
var Service *Neko
|
||||||
@ -49,11 +45,9 @@ var Service *Neko
|
|||||||
func init() {
|
func init() {
|
||||||
Service = &Neko{
|
Service = &Neko{
|
||||||
Version: &Version{
|
Version: &Version{
|
||||||
Major: major,
|
|
||||||
Minor: minor,
|
|
||||||
Patch: patch,
|
|
||||||
GitCommit: gitCommit,
|
GitCommit: gitCommit,
|
||||||
GitBranch: gitBranch,
|
GitBranch: gitBranch,
|
||||||
|
GitTag: gitTag,
|
||||||
BuildDate: buildDate,
|
BuildDate: buildDate,
|
||||||
GoVersion: runtime.Version(),
|
GoVersion: runtime.Version(),
|
||||||
Compiler: runtime.Compiler,
|
Compiler: runtime.Compiler,
|
||||||
@ -69,11 +63,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Version struct {
|
type Version struct {
|
||||||
Major string
|
|
||||||
Minor string
|
|
||||||
Patch string
|
|
||||||
GitCommit string
|
GitCommit string
|
||||||
GitBranch string
|
GitBranch string
|
||||||
|
GitTag string
|
||||||
BuildDate string
|
BuildDate string
|
||||||
GoVersion string
|
GoVersion string
|
||||||
Compiler string
|
Compiler string
|
||||||
@ -81,20 +73,25 @@ type Version struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *Version) String() string {
|
func (i *Version) String() string {
|
||||||
return fmt.Sprintf("%s.%s.%s %s", i.Major, i.Minor, i.Patch, i.GitCommit)
|
version := i.GitTag
|
||||||
|
if version == "" || version == "dev" {
|
||||||
|
version = i.GitBranch
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%s@%s", version, i.GitCommit)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Version) Details() string {
|
func (i *Version) Details() string {
|
||||||
return fmt.Sprintf(
|
return "\n" + strings.Join([]string{
|
||||||
"%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
|
fmt.Sprintf("Version %s", i.String()),
|
||||||
fmt.Sprintf("Version %s.%s.%s", i.Major, i.Minor, i.Patch),
|
|
||||||
fmt.Sprintf("GitCommit %s", i.GitCommit),
|
fmt.Sprintf("GitCommit %s", i.GitCommit),
|
||||||
fmt.Sprintf("GitBranch %s", i.GitBranch),
|
fmt.Sprintf("GitBranch %s", i.GitBranch),
|
||||||
|
fmt.Sprintf("GitTag %s", i.GitTag),
|
||||||
fmt.Sprintf("BuildDate %s", i.BuildDate),
|
fmt.Sprintf("BuildDate %s", i.BuildDate),
|
||||||
fmt.Sprintf("GoVersion %s", i.GoVersion),
|
fmt.Sprintf("GoVersion %s", i.GoVersion),
|
||||||
fmt.Sprintf("Compiler %s", i.Compiler),
|
fmt.Sprintf("Compiler %s", i.Compiler),
|
||||||
fmt.Sprintf("Platform %s", i.Platform),
|
fmt.Sprintf("Platform %s", i.Platform),
|
||||||
)
|
}, "\n") + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
type Neko struct {
|
type Neko struct {
|
||||||
|
Reference in New Issue
Block a user