• Stars
    star
    123
  • Rank 290,145 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web-based danmaku server

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

More Repositories

1

thuthesis

LaTeX Thesis Template for Tsinghua University
TeX
4,532
star
2

tunasync

Mirror job management tool.
Go
1,406
star
3

blogroll

世界一流兼容并包TUNA协会收集的周围同学们的Blog
Python
827
star
4

mirror-web

Source code of the web interface of https://mirrors.tuna.tsinghua.edu.cn/
HTML
690
star
5

oh-my-tuna

Keep calm and use TUNA mirrors.
Python
480
star
6

ipv6.tsinghua.edu.cn

CSS
399
star
7

tunasync-scripts

Custom scripts for mirror jobs
Python
390
star
8

issues

Code Unrelated Issues
336
star
9

THU-Beamer-Theme

A LaTeX beamer theme template for Tsinghua students.
TeX
305
star
10

fishroom

Message forwarding for multiple IM protocols
Python
283
star
11

collection

idea collections from TUNA
254
star
12

danmaQ

danmaku implemented in Qt5
JavaScript
185
star
13

freedns-go

Optimized DNS Server for Chinese users.
Go
180
star
14

opentuna

TUNA on AWS
TypeScript
142
star
15

tuna.moe

HTML
75
star
16

gdanmaku

play danmaku on any screen
Python
36
star
17

artwork

tuna artwork
26
star
18

QSerial

An advanced cross-platform serial port utility
C++
23
star
19

podcast

Voice from TUNA
CSS
19
star
20

scripts

Python
15
star
21

pub-mirror

Dart application to fully mirror the content on https://pub.dartlang.org/
Dart
15
star
22

mirrorhub

Redirects the user to a nearby mirror site.
Go
11
star
23

Books

Tracking Books of TUNA Library
9
star
24

registr

JavaScript
6
star
25

dataset-issues

Issues about academic dataset mirrors
5
star
26

tunaccount

Go
5
star
27

topdf

Automactically convert Office files to PDF via a web interface
PHP
4
star
28

live

CSS
3
star
29

pdns-ldap

Python
3
star
30

fakeTunet

a fake net.tsinghua.edu.cn
JavaScript
2
star
31

feed_tuna

Telegram shop/payment bot 金枪鱼喂食计划
Python
2
star
32

tunasay

tunasay is a configurable talking tuna
JavaScript
2
star
33

playbooks

Python
1
star
34

Cash

1
star
35

loglyzer

log analyzer for tuna mirrors
Python
1
star
36

docker-images

Repo for various docker images
Dockerfile
1
star
37

tunasync-monitor

Rust
1
star