Skip to content

heyrict/cindy-next

Repository files navigation

Cindy-Next

This project is the frontend part of Cindy, a lateral thinking game forum. You can find backend here written in Rust.

This is a project started in homage to latethin created by kamisugi(上杉).

There is an unofficial wiki maintained by volunteers with most undocumented features here (Japanese only).

The name of Cindy stands for Cindy Is Not Dead Yet, which comes from the popular original character of Cindy.

Requisitories

Cindy-Next is designed to be run in parallel with Cindy-Next-Rust. Make sure you have set it up following the instructions there

  • Postgresql ≥ 12

    # Debian-based systems
    apt-get install postgresql
  • node > v12.13.0, nodejs manager (latest npm or yarn). yarn is tested and preferrable, but npm may also work.

    # Use yarn
    yarn --production
    # Use npm
    npm install
  • Python 3.x >= 3.6 (optional, required if you need scheduled update or twitter feature)

    You also need to install the required packages with pip install -r ./python/requirements.txt.

  • NotoSansCJK Font (optional, required if you need scheduled update or twitter feature)

Also, there are some sample configs for systemd and nginx, which are used in production in Cindy. You can find then in ./config folder. Useful scripts for automatic updates written in python are stored in ./config/cron.

Dev-Requisitories

In addition to the requirements above, some extra tools are needed for development.

  • dev packages

    yarn
  • global binaries

    yarn global add graphqurl apollo

For convenience, configs for some other tools are available in this repository.

  • Graphql Playground

Environment Variables

For next server

env description default
PORT port to use 3000

For twitter client

env description default
WS_ENDPOINT graphql endpoint ws://127.0.0.1:8000/graphql
TOKEN twitter token
TOKEN_SECRET twitter token secret
CONSUMER_KEY twitter consumer key
CONSUMER_SECRET twitter consumer secret
TWEET_WITH_PICTURE whether to render picture in twitter False

Hard-coded configurations

Global settings

All variables describe here should be exported directly or indirectly from ./settings.ts

variable description
GRAPHQL_SERVER / GRAPHQL_CLIENT Object of { ENDPOINT: string, LIVEQUERY: string, SUBSCRIPTION: string }
DEFAULT_LOCALE Locale fallback if requested locale is not provided in APPLOCALES. Default value is ja.
APPLOCALES Array<string> of Supported locales. Currently supported translations are en and ja.
DOMAIN_REGEXP Regular expression matching in-site urls. In-site urls are handled differently from cross-site urls.
SCRIPTS scripts prepending to HTML head tag. Basically used for tracking or ad services

Hard-coded award settings

Awards are hard-coded in script files as custom logic of checking awards are hard to implement with database only. This config must be adjusted to satisfy your awards in the database!

These variables are defined in components/AwardChecker/constants.ts

variable type
PuzzleCountAwards { [id: number]: /* count */ number }
QuestionCountAwards { [id: number]: /* count */ number }
TrueAnswerCountAwards { [id: number]: /* count */ number }
GoodQuestionCountAwards { [id: number]: /* count */ number }
StarSumAwards { [id: number]: /* count */ number }
StarByPuzzleAwards { [id: number]: { starCount: number, puzzleCount: number }}
PuzzleByGenreAwards { [id: number]: { genre: number, count: number }}
PuzzleByYamiAwards { [id: number]: /* count */ number }
PuzzleByYamiQuestionsAwards { [id: number]: /* count */ number }
MixedAwards { [id: number]: { questionCount: number, puzzleCount: number }}
SpecialAwards Array</* id */ number>

Patrons