GitXplorerGitXplorer
t

gdanmaku-server

public
124 stars
40 forks
7 issues

Commits

List of commits on branch master.
Verified
ec4e46c0b17247c295e80ce242abd3e76a5777f4

Merge pull request #34 from tuna/dependabot/pip/werkzeug-0.15.5

zz4yx committed 2 years ago
Verified
a827f284119493fd49a844063381f002842bb9bf

Bump werkzeug from 0.15.4 to 0.15.5

ddependabot[bot] committed 2 years ago
Unverified
881ca9ab8f1141686605b9251f8700379bded7d5

[POTENTIAL BREAKING] bump dependency versions

jjiegec committed 6 years ago
Verified
d47d8db7647613081b2090d9b69722abe4111cc2

Merge pull request #30 from berryboy2012/master

HHarry-Chen committed 6 years ago
Unverified
dbe9ca4d1680872925eeccc779e33cc335cce0cd

Rewrite README.md in accordance to recent changes

bberryboy2012 committed 6 years ago
Unverified
63d34e458ccd62807a25a2c4904d900598a3f2e9

Reorganized files

bberryboy2012 committed 6 years ago

README

The README file for this repository.

gdanmaku-server

Web-based danmaku server

Installation

The easy way

  1. Get yourself a VPS

  2. Clone this project

    git clone https://github.com/tuna/gdanmaku-server
    cd gdanmaku-server

    Pay attention to where you see this guide and what repository you are cloning from. Actual repository address may differ.

  3. Install openssl curl python3 nano if there isn't

  4. Install docker and docker-compose if there isn't

    sudo snap install docker
    sudo curl -L --fail https://github.com/docker/compose/releases/download/1.22.0/run.sh -o /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose

    We recommend you use docker pre-installed images from your VPS provider since there are many caveats when installing them yourself.

  5. Edit configs to your preference

    python3 -c "import random,hashlib;print(hashlib.sha1(str(random.random()).encode()).hexdigest())"

    Copy the output, we will call it <SECRET> in the following easy steps.

    curl -4 icanhazip.com

    This should be your public ip, we will use it in the following steps.

    If you want to use Wechat, log into your Wechat Subscription Account, get your Token.

    If you want to use telegram, get your telegram token. Now we can start editing configs

    cd docker_conf
    nano settings_local.py

    Copy the following contents into it.

    DEBUG = False
    
    SECRET_KEY = "<SECRET>"
    
    # WECHAT
    WECHAT_TOKEN = "<WECHAT_TOKEN>"
    
    # TELEGRAM
    TELEGRAM_TOKEN = "<TELEGRAM_TOKEN>"

    Change <SECRET>, <WECHAT_TOKEN>, <TELEGRAM_TOKEN> according to your situation.

    After that you can press Ctrl + O to save and Ctrl + X to exit.

  6. Run the script and open corresponding ports

    chmod +x ./easy_setup.sh
    sudo ./easy_setup.sh

    Wait until everything finished.

    If you have trouble building docker image in executing the script above, you can try uncommenting the lines commented in PROJECT_ROOT_DIR/Dockerfile

    Then open port 80, 443 in your VPS according to your OS and VPS provider.

    If you do not use telegram support, then it is okay to keep port 443 closed.

  7. Edit Wechat Subscription Account if necessary

    Change URL in your account settings to

    http://<PUBLIC_IP>/api/wechat
    
  8. Finished

    Now you are all set, go to https://www.github.com/tuna/danmaQ and get a display client.

The other way

Install dependencies:

  • python modules: flask, gevent, pyredis
  • service: redis

Run webserver.py and open http://localhost:5000/ in your browser.

Use this method only if you want to see what's under the hood. To actually host this server, please use docker instead.

Docker the hard way

You should have a vps first, then you need to install the docker if you do not have one.

You can find help in Prepare your Docker Environment or your VPS provider's knowledge base.

Clone this project

Pay attention to where you see this guide and what repository you are cloning from. Actual repository address may differ.

git clone https://github.com/tuna/gdanmaku-server
cd gdanmaku-server

Get a redis docker and run

docker pull redis:alpine
docker run --name redis -v /var/lib/redis:/data -d redis:alpine

Modify settings.py in dir gdanmaku, remember REDIS_HOSTin your settings i.e. myredis.

If you want to use it in Wechat, please modify the WECHAT_TOKEN in setting.py. Change TELEGRAM_TOKEN as well if you want to utilize telegram bot.

Modify Dockerfile, you may want to change the sources.list part. Next we build the docker image of danmaku:

docker build --tag danmaku:dev .

We need to link redis to it. Try:

docker run -it --rm --link redis:myredis -p IP:Port:5000 danmaku:dev python3 gdanmaku/webserver.py

Open your browser and visit http://IP:port/, you should see the danmaku web page.

If you wanna run danmaku service as a daemon, use

docker run -d --name danmaku --link redis:myredis -v /path/to/gdanmaku-server:/data/gdanmaku -p IP:Port:5000 danmaku:dev python3 gdanmaku/webserver.py

If you want to use it in Wechat alone, please set port to 80, and open the firewall.

If you want to use it in Telegram, however, you need to setup reverse proxy and a certificate besides set port to 5000.

Here are the links for Telegram Webhook Setup Tutorial in your convenience. You may find docker_conf/easy_setup.sh and docker_conf/nginx.conf helpful.

Good luck, and have fun!

Client

The official desktop client is available at https://github.com/tuna/danmaQ