Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: oott123/docker-novnc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: ned-kelly/viber-franz
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 28 files changed
  • 1 contributor

Commits on Aug 15, 2018

  1. update for viber support

    ned-kelly committed Aug 15, 2018
    Copy the full SHA
    f081211 View commit details
  2. include screenshot

    ned-kelly committed Aug 15, 2018
    Copy the full SHA
    a4760b6 View commit details
  3. Copy the full SHA
    0d22604 View commit details
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
viber-docker/viberdata
.DS_Store
30 changes: 0 additions & 30 deletions .gitlab-ci.yml

This file was deleted.

51 changes: 0 additions & 51 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 三三
Copyright (c) 2017

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
59 changes: 33 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
# docker-novnc
# Franz Viber Plugin

[![Docker Pulls](https://img.shields.io/docker/pulls/oott123/novnc.svg)](https://hub.docker.com/r/oott123/novnc/) [![Docker Automated build](https://img.shields.io/docker/automated/oott123/novnc.svg)](https://hub.docker.com/r/oott123/novnc/)
This is a plugin for the [Franz Messaging App](https://meetfranz.com/) that wraps Viber inside a docker container, published via novnc.

tigervnc, websokify, novnc and Nginx with s6-overlay in a docker image.
_(In simple terms think of this as a "web based" Viber wrapper...)_

## Environment variables
-------------------

* **`VNC_GEOMETRY`** - VNC geometry; default: `800x600`
* **`VNC_PASSWD`** - VNC password, no more than 8 chars; default: `MAX8char`
* **`USER_PASSWD`** - user `user` password. If you specify it, it will change the password for user `user` and add it to sudoers. NOTE: This password can get by programs so it's not safe. default: _(blank)_
![Screenshot](franz-plugin/screenshot.jpg)

## Ports
### Steps to get started:

* **5911** - tigervnc
* **9000** - Nginx
* **9001** - websockify
To get up and running you will need to:

## Add your foreground process
1. Install [Docker](https://www.docker.com/) (on your machine, or a server somewhere that will "publish" your Viber application)...
2. Install [Docker Compose](https://docs.docker.com/compose/install/) - Pretty straightforward, follow the instructions...
3. Configure & start the Viber container...
4. Install the Viber plugin to Franz.

`vncmain.sh` is a file which is a placeholder for foreground process running in VNC.
### Configuring & Starting Viber Container

You can write a Dockerfile like this:
This is fairly straightforward, just run the following commands from the `viber-docker` directory:

```Dockerfile
FROM oott123/novnc:latest
COPY vncmain.sh /app/vncmain.sh
```
docker-compose up --build -d
```

And add foreground commands in your `vncmain.sh`:
By default the container will auto-start when Docker starts (so if you restart your computer, it will come back automatically).

```bash
#!/bin/bash
# Set them to empty is NOT SECURE but avoid them display in random logs.
export VNC_PASSWD=''
export USER_PASSWD=''
### Install plugin to Franz

xterm
```
Please see the [franz-plugin/readme](franz-plugin/readme.md) file for instructions on installing and enabling the Viber Plugin within Franz.

### Moving Files/Directories?

If you move this project's files around after you have stood up the docker container, you will need to: `docker-compose down && docker-compose up -d` the _viber-docker_ directory again.

### Publishing the Viber Server on the web (web based Viber)

If you want to run just the docker container on the web (to publish Viber as if it was a Web Based Chat app) I suggest you put a service such as [Caddy](https://caddyserver.com/) in-front of the service to provide a free SSL certificate (via Lets Encrypt) - You will also want to change the default VNC password in `viber-docker/docker-root/etc/cont-init.d/10-setup-vnc` to something unique and secure.

You may then access the service via your favourite browser like so:
`https://<your-viber-server>/?autoconnect=true&reconnect=true&resize=remote&reconnect_delay=1000`

### Future Improvements
- There's currently no notifications hooked into Franz - We might be able to do this by monitor any signal sent via libpulse and assume it's a Notification?

Then build and run your docker image. That's it!
- Map audio through to Host Client from Libpulse (See: https://github.com/novnc/noVNC/issues/302)
3 changes: 0 additions & 3 deletions docker-root/app/vncmain.sh

This file was deleted.

2 changes: 2 additions & 0 deletions franz-plugin/dev/viber/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Viber (via docker) for Franz
This is a quick franz hack to get you running with viber (within franz) via docker...
24 changes: 24 additions & 0 deletions franz-plugin/dev/viber/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions franz-plugin/dev/viber/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions franz-plugin/dev/viber/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "viber",
"name": "Viber",
"version": "1.0.0",
"description": "Viber",
"main": "index.js",
"author": "David N <david@nedved.com.au>",
"license": "MIT",
"config": {
"serviceURL": "http://localhost:9981/?password=viber-franz&autoconnect=true&reconnect=true&resize=remote&reconnect_delay=1000",
"hasNotificationSound": true
}
}
8 changes: 8 additions & 0 deletions franz-plugin/dev/viber/service.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#noVNC_control_bar_anchor {
display: none;
}
.app-wrapper-web .app {
width: 100% !important;
height: 100% !important;
top: 0 !important;
}
26 changes: 26 additions & 0 deletions franz-plugin/dev/viber/webview.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions franz-plugin/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Installing to Franz...

This addition to Franz has not been published to their community repo, so you will need to manually install.

### To install to Franz:

- Quit any running instances of Franz
- Open the Franz Plugins folder on your machine:

*This can be done by going to one of the following folders:*

```
Mac: ~/Library/Application Support/Franz/recipes/
Windows: %appdata%/Franz/recipes/
Linux: ~/.config/Franz/recipes/
```

- copy the `dev` directory into the Franz plugin folder on your machine.

### Restart Franz and use the plug-in!

- You're good to go (you will need to also stand up the Docker container which Runs the actual Viber Desktop app and publishes it)...

**NOTE:**

If you're like me and running Viber on another instance you will need to edit the `package.json` file and update the `serviceURL` to point to your correctly configured "web based Viber" endpoint.
Binary file added franz-plugin/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions viber-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Viber for Franz plugin - Based on docker ubuntu 16.04 LTS
FROM ubuntu:bionic
MAINTAINER DN "david@nedved.com.au"

# Configure Environment Variables
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_ARG0=/sbin/entrypoint.sh \
VNC_GEOMETRY=800x600 \
VNC_PASSWD='pass' \
USER_PASSWD='' \
DEBIAN_FRONTEND=noninteractive

RUN groupadd user && useradd -m -g user user

# Pull in S6 Overlay & Tiger VNC
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.18.1.5/s6-overlay-amd64.tar.gz /tmp/s6-overlay-amd64.tar.gz

# Setup VNC Server
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y \
python git \
ca-certificates wget curl locales \
sudo nginx \
xorg openbox && \
tar -xvf /tmp/s6-overlay-amd64.tar.gz && \
# workaround for https://github.com/just-containers/s6-overlay/issues/158
ln -s /init /init.entrypoint && \
locale-gen en_US.UTF-8 && \
# novnc
mkdir -p /app/src && \
git clone --depth=1 https://github.com/novnc/noVNC.git /app/src/novnc && \
git clone --depth=1 https://github.com/novnc/websockify.git /app/src/websockify && \
apt-get autoremove -y && \
apt-get clean

# Install Viber DPKG Dependences
## We need several additional libraries for viber to work..
RUN apt-get install -y libpulse-dev libqt5gui5

# Repackage viber with libcurl4 support...
RUN curl -fL# http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb -o /usr/src/viber.deb && \
cd /usr/src && dpkg-deb -x /usr/src/viber.deb viber && \
dpkg-deb --control /usr/src/viber.deb viber/DEBIAN && \
sed -i 's/libcurl3/libcurl4/g' viber/DEBIAN/control && \
dpkg -b viber vibernew.deb

# Install Viber (new dpkg'd version)
RUN dpkg -i /usr/src/vibernew.deb > /dev/null 2>&1; if [ $? -gt 0 ]; then apt-get -f --force-yes --yes install>/dev/null 2>&1; fi && \
dpkg -i /usr/src/vibernew.deb

RUN apt install -f && \
dpkg -i /usr/src/vibernew.deb

# Auto-set timezone based on location...
RUN apt install -y python-pip && \
pip install -U tzupdate

RUN apt-get install -y tigervnc-common tigervnc-standalone-server && \
apt-get install -y xdg-utils wmctrl --fix-missing

# copy files
COPY ./docker-root /

EXPOSE 9000

ENTRYPOINT ["/init.entrypoint"]
CMD ["start"]
13 changes: 13 additions & 0 deletions viber-docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2'

services:
viber:

build: .
container_name: viber
privileged: true
restart: always
volumes:
- ./viberdata:/home/user
ports:
- 9981:9000
11 changes: 11 additions & 0 deletions viber-docker/docker-root/app/viber.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Viber needs a soundcard for audio output...
export HOME="/home/user"
export PULSE_LATENCY_MSEC=60
export PULSE_SERVER="tcp:localhost:64713"
export TZ=`tzupdate -p` # Set timezone based on location...

bash -c 'while : ; do sleep 1 && wmctrl -r Viber -b add,fullscreen ; done' &
/opt/viber/Viber

# http://localhost:9981/?password=viber-franz&autoconnect=true&reconnect=true&resize=remote&reconnect_delay=1000
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@ set -eo pipefail

[[ $DEBUG == true ]] && set -x

echo -e "$VNC_PASSWD\n$VNC_PASSWD\n\n" | sudo -Hu user vncpasswd
export VNC_PASSWD="viber-franz"
echo -e "$VNC_PASSWD\n$VNC_PASSWD\n\n" | sudo -Hu user vncpasswd || true
if [ ! -d /etc/vnc ]; then
mkdir /etc/vnc
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ case ${1} in
sleep 2
/bin/s6-svc -wu -T 5000 -u /var/run/s6/services/nginx
sleep 2
sudo --preserve-env -Hu user /app/vncmain.sh "$@"
sudo --preserve-env -Hu user /app/viber.sh "$@"
;;
*)
exec "$@"