Difference between revisions of "Jschan"

From Hidden Wiki
Jump to navigation Jump to search
Line 121: Line 121:
===Requirements===
===Requirements===


* Linux - Debian used in this example
* [[Linux]] - Debian used in this example
* Node.js - the application runtime
* [[Node.js]] - the application runtime
* MongoDB >= 4.4 - the database
* [[MongoDB]] >= 4.4 - the database
* Redis - session store, task queue, locks, caching, websocket message arbiter
* [[Redis]] - session store, task queue, locks, caching, websocket message arbiter
* Nginx - webserver/proxy, serve static files, handle https, GeoIP lookup
* [[Nginx]] - webserver/proxy, serve static files, handle https, GeoIP lookup
* Certbot/letsencrypt - to get a free https certificate
* [[Certbot]]/[[letsencrypt]] - to get a free https certificate
* Graphicsmagick+Imagemagick - identify and thumbnail images, generate captchas
* [[Graphicsmagick]]+[[Imagemagick]] - identify and thumbnail images, generate captchas
* Ffmpeg - identify and thumbnail audio, video and gifs
* [[Ffmpeg]] - identify and thumbnail audio, video and gifs


=== Setup server with some basics ===
=== Setup server with some basics ===
Line 291: Line 291:


== See also ==
== See also ==
* [[TinyIB]]
* [[Darknet]]
* [[Darknet web development]]
:* [[PlayPen]] ([[Playpen]])
:* [[Childs Play]] ([[Child's Play]])
:* [[MediaWiki]]
:* [[phpBB]]
:* [[WordPress]]
:* [[OpenCart]]
:* [[TinyIB]]
* [[Security]]
* [[Security]]
:* [[Vulnerability]]
:* [[Vulnerability]]
Line 303: Line 311:
* [[Script]]
* [[Script]]
* [[Template:Computer engineering]]
* [[Template:Computer engineering]]
* [[Darknet]]
* [[Darknet web development]]
:* [[PlayPen]] ([[Playpen]])
:* [[Childs Play]] ([[Child's Play]])
:* [[MediaWiki]]
:* [[phpBB]]
:* [[WordPress]]
:* [[OpenCart]]
* [[Virtual private network]] ([[VPN]])
* [[Virtual private network]] ([[VPN]])
* [[Web hosting service]] ([[Web hosting]])
* [[Web hosting service]] ([[Web hosting]])

Revision as of 20:56, 14 June 2021

Unix Assembly language Mathematics Web development I2P
GhostBSD Assembly Programming Tutorial Statistics Django for Beginners MuWire
GUI Artificial intelligence Artificial neural network Machine learning Messenger
Tkinter Artificial intelligence Artificial neural network Machine Learning Mastery with Python Session

jschan

Oldschool anonymous imageboard with some modern touches. Multiple file uploads, user board creation and read-only API. Supports users without JavaScript.


https://gitgud.io/fatchan/jschan/


jschan

Anonymous imageboard software.

Demo/test instance: Clearnet, Tor hidden service, Lokinet SNApp


See Darknet web development to know how to install it on VPS.

Post styling

http://dvpcj3n5enx5ernlrdgs7pkp5ooue45mcm67znw3w64sok3ecwbhiyqd.onion/faq.html#post-styling


Input Output

>greentext >greentext

<pinktext <pinktext

==title== title

''bold'' bold

__underline__ underline

~~strikethrough~~ strikethrough

||spoiler text|| spoiler text

**italic** italic

(((detected))) (((detected)))


##2d9+3

(##2d9+3) Rolled 2 dice with 9 sides and modifier +3 = 10


https://example.com https://example.com

[custom label](https://example.com) custom label

>>123 >>123

>>>/b/ >>>/b/

>>>/b/123 >>>/b/123

`inline monospace` inline monospace


[code]language

int main() {...}

[/code]


int main() {...}


[code]aa

∧_∧

( ・ω・) Let's try that again.

[/code]


∧_∧

( ・ω・) Let's try that again.


The "language" of code blocks is optional. Without it, automatic language detection is used. If the language is "plain", highlighting is disabled for the code block. If "aa" is used, the font will be adjusted for Japanese Shift JIS art. Not all programming languages are supported, a subset of popular languages is used. If the language is not in the supported list, the code block will be rendered like "plain" with no highlighting. Languages supported: javascript, typescript, perl, js, c++, c, java, kotlin, php, h, csharp, bash, sh, zsh, python, ruby, css, html, json, golang, rust, aa

Goals

   Oldschool look, newschool features
   Work with javascript disabled
   Support using anonymizers such as Tor, Lokinet or I2P
   Be usable on mobile
   Simple static file serving

Features

   User created boards ala infinity
   Multiple files per post
   Basic antispam & multiple captcha options
   Read-only JSON api
   Multi-select moderation actions
   Websocket update threads w/o polling
   Webring w/proxy support (compatible with lynxchan & infinity versions)
   Manage everything from the web panel
   Works properly with anonymizer networks

Wants

   docker-compose file, use docker volumes and networks for super easy installation, backup and migration
   Mobile app integration (somebody pls)

Installation

These instructions are not for the uninitiated and assume you have a brain. Follow them carefully and you will have a nice working imageboard by the end.

Requirements

  • Linux - Debian used in this example
  • Node.js - the application runtime
  • MongoDB >= 4.4 - the database
  • Redis - session store, task queue, locks, caching, websocket message arbiter
  • Nginx - webserver/proxy, serve static files, handle https, GeoIP lookup
  • Certbot/letsencrypt - to get a free https certificate
  • Graphicsmagick+Imagemagick - identify and thumbnail images, generate captchas
  • Ffmpeg - identify and thumbnail audio, video and gifs

Setup server with some basics

  • Separate, non-root user to run the application
  • Basic security like ssh root login disabled, key login only, firewall (ufw works) deny all incoming on ports besides http/s and ssh.
  • Set the timezone to UTC


Steps to create a user account on Ubuntu Linux

1. Open the terminal application

2. Log in to VPS by running the

ssh root@your-ubuntu-VPS-ip

3. To add a new user in Ubuntu run

adduser userNameHere

4. Enter password and other needed info to create a user account on Ubuntu server

5. New username would be added to "/etc/passwd" file, and encrypted password stored in the "/etc/shadow" file.

Permissions problems with /var/www/html

  • Permissions problems with /var/www/html and my own home directory for a website document root

2016-05-04

https://askubuntu.com/questions/767504/permissions-problems-with-var-www-html-and-my-own-home-directory-for-a-website


  • Transfer files using scp: permission denied

2012-09-12

https://unix.stackexchange.com/questions/47909/transfer-files-using-scp-permission-denied

2. Install dependencies.

NOTE: You may need to add sources depending on your distro. If you want animated gif thumbnails, ffmpeg ?=4.3.x is recommended. For debian, it can be found in the testing repos or compiled from source.

$ sudo apt-get update $ sudo apt-get install nginx ffmpeg imagemagick graphicsmagick

3. Install MongoDB

MongoDB Installation & enable authentication

4. Install Redis

Redis Installation

5. Install Node.js

For easy installation, use node version manager "nvm". Install nvm then run the following commands to get the LTS version of nodejs.

$ nvm install --lts $ nvm use --lts

You can repeat this process in future to update node versions.

You may install Node.js yourself without nvm if you prefer.

6. Configure nginx

   Copy the nginx.example config to the sites-eavailable folder, and create a symlink from sites-available -> sites-enabled

$ sudo cp configs/nginx/nginx.example /etc/nginx/sites-available/DOMAIN.COM $ sudo ln -s /etc/nginx/sites-available/DOMAIN.COM /etc/nginx/sites-enabled/DOMAIN.COM

Edit/replace the following in your nginx config:

   "domain.com" with your domain name
   "/path/to/jschan" with the path of your jschan root folder
   If using .onion, uncomment the .onion block, and replace the example address with your .onion

$ sudo editor /etc/nginx/sites-available/DOMAIN.COM

sed can be used to automate this process:

$ sudo sed -i 's|/path/to/jschan|/path/to/your/install|g' /etc/nginx/sites-available/DOMAIN.COM $ sudo sed -i 's/domain.com/your.domain.com/g' /etc/nginx/sites-available/DOMAIN.COM

   Make sure the sites enabled folder is included by /etc/nginx/nginx.conf (it is in debian nginx package)
   Use certbot to get a free https certificate.
   For post flags to work, follow this guide to setup the legacy GeoIP database and add these directives to the http block in /etc/nginx/nginx.conf:

geoip_country /usr/share/GeoIP/GeoIP.dat;

If your nginx doesn't have the necessary module by default, or is using v2 instead, find your own guide.

If you use cloudflare, please read these articles to setup proper IP forwarding and geolocation headers. Similar steps would apply to other CDNs/reverse proxies.

Also included is an "nginx_advanced" config, and a snippets folder for advanced users who want to better organise and more easily customise the nginx configuration. It functions the same as the normal nginx.example, but you need to create the snippets folder in /etc/nginx/snippets, and copy the example snippets.

   Use https://realfavicongenerator.net/ to generate favicons how you want them to look and replace the files in gulp/res/icons/ with the icons from that package.

7. Clone this repo

7. Clone this repo, browse to the folder and set some things up

  1. copy example secrets file and edit it to fill out the details

$ cp configs/secrets.js.example configs/secrets.js && editor configs/secrets.js

  1. copy example custompages for rules and faq and edit

$ cp views/custompages/faq.pug.example views/custompages/faq.pug $ cp views/custompages/rules.pug.example views/custompages/rules.pug

  1. install dependencies and run build tasks

$ npm install $ npm run-script setup

  1. setup the database and folder structure, and creates the admin account. **The (random) password will be printed in the command line.**

$ gulp reset

  1. NOTE: dont run gulp reset again unless you want to completely irreversibly wipe everything
  1. make pm2 (process manager) start on server restart

$ pm2 startup #and follow any prompts

  1. save the process list so jschan is started with pm2

$ pm2 save

  1. start all the backend processes

$ npm run-script start $ gulp

  1. some commands you may need to use in future/find helpful
  2. pm2 is a process manager for nodejs

$ pm2 list #list running pm2 processes $ pm2 logs #see logs $ pm2 reload all #reload all backend processes

  1. gulp is used for various jobs like minifying and compiling scripts
  2. the build-worker process may also run some of these for certain operations e.g. editing global settings in the web panel

$ gulp --tasks #list available gulp tasks $ gulp migrate #check for and run db migrations $ gulp password #reset the admin account password if you forgot it $ gulp #run default gulp task

8. Optionally, if you plan to use the webring

8. Optionally, if you plan to use the webring and want to make requests with a proxy to mask your origin server IP:

EITHER:

   Install docker and run torproxy in a container: https://github.com/dperson/torproxy (of course, audit the docker image yourself).
   Use the socks proxy provided by a non-docker tor daemon, which is probably already setup on port 9050 if you have a tor installed for hidden service.
   Use your own socks proxy

Then update the proxy address in global settings. The first 2 will allow you to follow .onions in your webring follow list.

Updating

#stop the jschan backend
$ pm2 stop ecosystem.config.js
#pull the latest changes
$ git pull
#install dependencies again in case any have updated or changed
$ npm install
#run the gulp migrate task. this will update things such as your database schema.
$ gulp migrate
#run the default gulp task to update, scripts, css, icons, images and delete old html
$ gulp
#start the backend again
$ pm2 restart ecosystem.config.js --env production
#if something breaks, check and read the logs, they will help figure out what went wrong
$ pm2 logs

See also