Skip to content

imissxxx page retrieving livestream status from twitch instead of youtube

License

Notifications You must be signed in to change notification settings

brainless-afk/imissjuni.com

 
 

Repository files navigation

Config

The site is configured using environment variables. Set the following in your .env file, or the actual environment of your server process:

  • WATCH_TWITCH_CHANNEL_HANDLE=@xxxx sets the twitch channel to check for livestream status.
    Also sets the channel link at the bottom of the page.
  • WATCH_YT_CHANNEL_ID=XXXX sets the youtube channel to check for livestream status. Copy only the part after /channel/ in the URL (i.e. the UC... part)
  • USE_DUMMY_DATA=true returns fake stream status instead of scraping YT. See getServerSideProps in pages/index.js.
  • PUBLIC_HOST=XXXX sets the external hostname of the site (e.g. "https://imissfauna.com"). This is used to make absolute URLs for the embed. Do not leave a trailing slash.
  • YOUTUBE_API_KEY=XXXX for refreshing members/premiere info. Can be created for free at https://console.cloud.google.com/apis/api/youtube.googleapis.com/credentials (Google account required)
  • WATCH_YT_CHANNEL_HANDLE=@xxxx sets the channel link at the bottom of the page. If unset, uses the old /channel/... URL format.

One of the following variable sets are needed to configure the database:

If using SQLite:

  • DATABASE_TYPE=sqlite
  • SQLITE_DB_PATH=./data.db

If using Postgres:

  • DATABASE_TYPE=postgres
  • PGUSER=xxx
  • PGPASSWORD=xxx
  • PGPORT=xxx
  • PGHOST=xxx
  • PGDATABASE=imfdev
  • POSTGRES_URL= postgres connectiontring overwrites ssl object in pg client and prevent ssl required error that appears with default login method

(Any PG environment variables supported by libpq can also be set. See https://www.postgresql.org/docs/9.3/libpq-envars.html)

You will probably want a connection pooler like pgbouncer if you're deploying on a serverless platform like vercel.

Initializing the database

Run either init_postgres.sql or init_sqlite3.sql on your database to create the necessary tables.

How to add images

  1. Put a .png or .jpg file in public/imagesets/[name]

How to add languages

  1. Open next.config.js and add your language's locale code to the locales array (e.g. locales: ["en"], -> locales: ["en", "fr"],). Locale codes can be either just the language (en) or include a region (en-US).
  2. Open lang/strings.js and copy/paste the entire English strings block. Replace the locale code in AllStrings["en"] with the code you added in step 1.
  3. Translate all the newly copypasted strings.
  4. Make a pull request.

About

imissxxx page retrieving livestream status from twitch instead of youtube

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.8%
  • CSS 4.0%
  • PLpgSQL 1.2%