├── .dockerignore ├── .gitignore ├── copyables ├── crd-session ├── update ├── etc │ └── supervisor │ │ └── conf.d │ │ ├── supervisord-crdonly.conf │ │ └── supervisord.conf ├── crdonly └── entrypoint.sh ├── .circleci └── config.yml ├── LICENSE ├── Dockerfile └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .circleci 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # git add -A;git commit -m 'yandex-init';git push https://github.com/QGB/yandex master 2 | .idea 3 | .DS_Store 4 | venv 5 | Thumbs.db 6 | __pycache__ 7 | *.pyc 8 | 9 | .9t- 10 | .9t. 11 | 12 | yandex.deb 13 | -------------------------------------------------------------------------------- /copyables/crd-session: -------------------------------------------------------------------------------- 1 | rm -rf /home/chrome/.config/chrome-remote-desktop/chrome-profile/Singleton* 2 | exec /opt/google/chrome/chrome --no-sandbox --start-maximized --force-device-scale-factor=1 --use-system-title-bar ${CHROME_OPTS} 3 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: /app 5 | docker: 6 | - image: docker:17.05.0-ce-git 7 | steps: 8 | - checkout 9 | - setup_remote_docker 10 | - run: 11 | name: Build Docker image 12 | command: | 13 | docker build -t chrome . 14 | -------------------------------------------------------------------------------- /copyables/update: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | apt-get update -qq \ 5 | -o Dir::Etc::sourcelist="sources.list.d/google-chrome.list" \ 6 | -o Dir::Etc::sourceparts="-" \ 7 | -o API::Get::List-Cleanup="0" 8 | 9 | for pkg in "google-chrome-stable"; do 10 | 11 | IFS=": " read -r p i iv c cv x <<< $(apt-cache policy $pkg) 12 | 13 | if [ "$iv" != "$cv" ]; then 14 | apt-get install --only-upgrade -y -qq $pkg 15 | echo $pkg upgraded to $cv 16 | fi 17 | 18 | done 19 | -------------------------------------------------------------------------------- /copyables/etc/supervisor/conf.d/supervisord-crdonly.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [program:crd] 5 | environment=HOME="/home/chrome",USER="chrome" 6 | command=/usr/bin/python /opt/google/chrome-remote-desktop/chrome-remote-desktop --start --foreground --config=/home/chrome/.config/chrome-remote-desktop/~host.json 7 | user=chrome 8 | autorestart=true 9 | priority=200 10 | 11 | [program:fluxbox] 12 | environment=DISPLAY=":20",HOME="/home/chrome",USER="chrome",XAUTHORITY="/home/chrome/.Xauthority" 13 | command=/usr/bin/fluxbox 14 | user=chrome 15 | autorestart=true 16 | startretries=60 17 | -------------------------------------------------------------------------------- /copyables/etc/supervisor/conf.d/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [program:xvfb] 5 | command=/usr/bin/Xvfb :1 -screen 0 %(ENV_VNC_SCREEN)s +extension RANDR 6 | autorestart=true 7 | priority=100 8 | 9 | [program:chrome] 10 | environment=HOME="/home/chrome",DISPLAY=":1",USER="chrome" 11 | command=/usr/bin/yandex-browser --window-size=%(ENV_CHROME_WINDOW_SIZE)s %(ENV_CHROME_OPTS)s 12 | user=chrome 13 | autorestart=true 14 | priority=200 15 | 16 | [program:x11vnc] 17 | command=/usr/bin/x11vnc -display :1 %(ENV_X11VNC_AUTH)s -wait 5 -forever -xrandr 18 | user=chrome 19 | autorestart=true 20 | priority=300 21 | -------------------------------------------------------------------------------- /copyables/crdonly: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # make sure to install a new version of ~/.chrome-remote-desktop-session 4 | # where ~ is a volume 5 | cp /crd-session /home/chrome/.chrome-remote-desktop-session 6 | 7 | # delete obsolete pulseaudio sockets if left from previous sessions 8 | rm -rf /home/chrome/.config/chrome-remote-desktop/pulseaudio* 9 | 10 | # delete .Xauthority files possibly owned by root 11 | rm -rf /home/chrome/.Xauthority* 12 | 13 | # only keep 1 host#*.json config file 14 | # (default is to use md5 of hostname, which changes on every docker run) 15 | if test -n "$(find /home/chrome/.config/chrome-remote-desktop -name 'host#*.json' -print -quit)" 16 | then 17 | mv `ls -t /home/chrome/.config/chrome-remote-desktop/host#*.json | head -n 1` /home/chrome/.config/chrome-remote-desktop/~host.json 18 | rm /home/chrome/.config/chrome-remote-desktop/host#*.json 19 | fi 20 | 21 | # start supervisor to watch `chrome-remote-desktop` only 22 | /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord-crdonly.conf 23 | -------------------------------------------------------------------------------- /copyables/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | set -e 4 | 5 | # VNC default no password 6 | export X11VNC_AUTH="-nopw" 7 | 8 | # look for VNC password file in order (first match is used) 9 | # passwd_files=( 10 | # /home/chrome/.vnc/passwd 11 | # /run/secrets/vncpasswd 12 | # ) 13 | 14 | # for passwd_file in ${passwd_files[@]}; do 15 | # if [[ -f ${passwd_file} ]]; then 16 | # export X11VNC_AUTH="-rfbauth ${passwd_file}" 17 | # break 18 | # fi 19 | # done 20 | 21 | # # override above if VNC_PASSWORD env var is set (insecure!) 22 | # if [[ "$VNC_PASSWORD" != "" ]]; then 23 | # export X11VNC_AUTH="-passwd $VNC_PASSWORD" 24 | # fi 25 | 26 | # set sizes for both VNC screen & Chrome window 27 | : ${VNC_SCREEN_SIZE:='1366x768'} 28 | IFS='x' read SCREEN_WIDTH SCREEN_HEIGHT <<< "${VNC_SCREEN_SIZE}" 29 | export VNC_SCREEN="${SCREEN_WIDTH}x${SCREEN_HEIGHT}x24" 30 | export CHROME_WINDOW_SIZE="${SCREEN_WIDTH},${SCREEN_HEIGHT}" 31 | 32 | export CHROME_OPTS="${CHROME_OPTS_OVERRIDE:- --user-data-dir --no-sandbox --window-position=0,0 --force-device-scale-factor=1 --disable-dev-shm-usage }" 33 | 34 | exec "$@" 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Tomohisa Kusano 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | LABEL maintainer="qgbcs" 4 | 5 | ENV VNC_SCREEN_SIZE 1366x768 6 | 7 | RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && apt-get update \ 8 | && apt-get install -y --no-install-recommends \ 9 | gdebi \ 10 | gnupg2 \ 11 | fonts-takao \ 12 | pulseaudio \ 13 | supervisor \ 14 | x11vnc \ 15 | fluxbox \ 16 | eterm \ 17 | fonts-arphic-ukai \ 18 | fonts-arphic-uming 19 | 20 | 21 | COPY Yandex.deb /tmp/Yandex.deb 22 | 23 | RUN gdebi --non-interactive /tmp/Yandex.deb 24 | 25 | RUN apt-get install -y xvfb tmux htop vim lsof 26 | 27 | COPY copyables / 28 | 29 | RUN apt-get clean \ 30 | && rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/* /tmp/* \ 31 | # && useradd -m -G chrome-remote-desktop,pulse-access chrome \ 32 | && useradd -m -G pulse-access chrome \ 33 | && usermod -s /bin/bash chrome \ 34 | && ln -s /crdonly /usr/local/sbin/crdonly \ 35 | && ln -s /update /usr/local/sbin/update \ 36 | && mkdir -p /home/chrome/.config \ 37 | && mkdir -p /home/chrome/.config/chrome-remote-desktop \ 38 | && mkdir -p /home/chrome/.fluxbox \ 39 | && echo ' \n\ 40 | session.screen0.toolbar.visible: true\n\ 41 | session.screen0.fullMaximization: false\n\ 42 | session.screen0.maxDisableResize: false\n\ 43 | session.screen0.maxDisableMove: false\n\ 44 | session.screen0.defaultDeco: NONE\n\ 45 | ' >> /home/chrome/.fluxbox/init \ 46 | && chown -R chrome:chrome /home/chrome/.config /home/chrome/.fluxbox 47 | 48 | VOLUME ["/home/chrome"] 49 | 50 | EXPOSE 5900 51 | 52 | ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] 53 | CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | - The testing branch for [RandR](https://en.wikipedia.org/wiki/RandR) (i.e. "Resize desktop to fit" in CRD client) is merged into master/latest. 2 | 3 | Yandex Browser via VNC 4 | == 5 | `docker run -p 127.0.0.1:5900:5900 qgbcs/yandex` 6 | if you want save user-data in docker: 7 | ` docker run -v ~/chrome:/home/chrome -p 127.0.0.1:5900:5900 -e VNC_SCREEN_SIZE=1366x768 yandex` 8 | 9 | - Yandex Browser, not Chromium, for the ease of Flash plugin management 10 | - on Xvfb, with FluxBox (no window decorations) 11 | - served by X11VNC (no password; assuming usage via SSH) 12 | 13 | Must agree to [Yandex Browser ToS][1] to use. 14 | 15 | Yandex Browser via Chrome Remote Desktop 16 | == 17 | ... so you can use the full Yandex Browser with Flash on iPad (with preliminary sound support)! 18 | Much faster than VNC thanks to VP8! 19 | 20 | Prerequisite: Create a Profile Volume 21 | -- 22 | You need a VNC client for the initial setup. 23 | 24 | 1. `docker run -d --name chrome-profile qgbcs/yandex` (NO password so DO NOT simply use -p 5900:5900 to expose it to the world!) 25 | 2. Connect to the container via VNC. Find the container's IP address by `docker inspect -f '{{ .NetworkSettings.IPAddress }}' chrome-profile` 26 | 3. Install the "Chrome Remote Desktop" Chrome extension via VNC and activate it, authorize it, and My Computers > Enable Remote Connections, then set a PIN. (Google Account required) 27 | 4. `docker stop chrome-profile` 28 | 29 | (Technically the only config file CRD uses is `/home/chrome/.config/chrome-remote-desktop/~host.json` which includes OAuth token and private key.) 30 | 31 | Usage 32 | -- 33 | `docker run -d --volumes-from chrome-profile qgbcs/yandex /crdonly` (no port needs to be exposed) 34 | `/crdonly` command will run chrome-remote-desktop in foreground. 35 | 36 | Docker ホスト(ヘッドレス可!)で走らせれば、「艦これ」等 Flash ブラウザゲームを iPad/iPhone/Android 等上の Chrome リモート デスクトップ アプリで一応プレイ可能になります。サウンド付き(遅延があります)。 37 | Yandex は英語版ですが、Web ページ用の日本語フォントは含まれています。[詳しくはこちら。][3] 38 | 39 | Yandex Updates 40 | -- 41 | It is recommended to `docker pull qgbcs/yandex` and restart the container once in a while to update Yandex & crd inside (they will not get automatically updated). Optionally you can run `docker exec update` to upgrade only Yandex-stable from outside the container (exit Yandex inside CRD after upgrading). 42 | 43 | Build 44 | == 45 | 1. `git clone https://github.com/QGB/yandex` 46 | 2. `cd yandex` 47 | 3. download `yandex.deb` from https://browser.yandex.com/ 48 | 3. `docker build --tag yandex:1.0 .` 49 | 4. `sudo docker run -p 127.0.0.1:5900:5900 --name yandex -d yandex:1.0` 50 | 51 | [1]: https://www.google.com/intl/en/chrome/browser/privacy/eula_text.html 52 | [2]: https://code.google.com/p/chromium/issues/detail?id=490964 53 | [3]: https://github.com/qgb/yandex/wiki/%E6%97%A5%E6%9C%AC%E8%AA%9E 54 | --------------------------------------------------------------------------------