Giter VIP home page Giter VIP logo

infinity-next's Introduction

Infinity Next was never completed and is currently in an unusable state. I am currently working on refactoring it to Laravel 6 and modernizing some backend work, but it is just something I am doing for myself. For some reason, I just can't stand to see it unfinished.

Use at your own risk: I can't help you.


Infinity Next is an imageboard using the Laravel Framework. It was conceived as a way to replace existing free imageboard software that have aged poorly. Infinity Next is completely free to use, but modifications to the source code must be made open source as well.

Submitting Issues

If you are submitting an issue to developers, please supply the following:

  • A concise description of your problem.
  • An exact case of the error. If the problem is code related, reference the file and line number.
  • Additional details of articles if applicable.

Please don't assume we'll understand exactly what you're talking about. If I can read an error, copy+paste something, or upload a file and reproduce an error in 30 seconds after opening your message, I can fix it without having to ask you for more information. If you do not provide an error case or details on how to recreate what you're experiencing, the first response to your issue will be "please provide an example".

Requirements

Larachan runs on Laravel 5 and has the same requirements.

  • PHP 7.2 or greater.
    • php-bcmath for dealing with IP addresses.
    • php-mcrypt for bcrypt functions.
    • php-gd for captcha codes and other image manipulation.

You may also need the following because not all PHP packages include them:

  • mbstring for Lavarel.
  • fileinfo for Composer requirement.

When installing from source,

  • composer

You can also pass --prefer-source to composer to forego the Github OAuth requirement.

Installation

Infinity Next is currently below its first release version. When it is finished, a compiled archive will be available with an installation process. Right now, however, you must build it yourself and have access to a command line interface.

  • These instructions are based on a clean Debian 10 installation.
    • If you don't know how to deal with sudo: command not found, you probably shouldn't be doing this.

Phase 1:

  1. Add oldstable main and buster-backports main to /etc/apt/sources.list
    1. apt update
  2. apt install php7.3 php7.3-common php-bcmath php-mcrypt php-gd php-mbstring php-xml php-curl php-redis php-pgsql php-zip php-gmp
  3. apt install postgresql
    1. sudo -u postgres psql or runuser -u postgres psql
    2. create user chan;
    3. create database chan owner chan;
    4. \c chan
    5. CREATE EXTENSION fuzzystrmatch;
    6. \password chan
    7. \q
  4. apt install redis git
  5. At your discretion:
    1. apt autoremove apache2
    2. apt install nginx-full
    3. apt install php-fpm
  6. Install Node.js (https://github.com/nodesource/distributions/blob/master/README.md#debinstall)
    1. curl -sL https://deb.nodesource.com/setup_14.x | bash -
    2. apt-get install -y nodejs
  7. adduser --system infinitynext --home /var/www/infinity-next
  8. git clone https://github.com/infinity-next/infinity-next.git /var/www/infinity-next
  9. chown -hR infinitynext /var/www/infinity-next

Phase 2:

  1. sudo -u infinitynext /bin/bash or runuser -u infinitynext /bin/bash
  2. cp .env.example .env
  3. Edit .env, set:
    1. A unqiue 32 character value for APP_KEY.
    2. DB_DATABASE,DB_USERNAME,DB_PASSWORD as configured.
  4. php composer.phar update and wait as 3rd party libraries are installed.
  5. php artisan migrate
  6. php artisan db:seed
    • Take note of the Admin account password that will be created for you.
  7. Add the Laravel crontab service provided in crontab.txt
    1. cat ./docs/crontab.txt
    2. crontab -e
    3. Do the needful.
  8. exit

Phase 3:

  1. Add the virtual host configuration for nginx.
    1. cp /var/www/infinity-next/docs/nginx.txt /etc/nginx/sites-available/infinity-next
    2. Adjust /etc/nginx/sites-available/infinity-next as required.
    3. ln -s /etc/nginx/sites-available/infinity-next /etc/nginx/sites-enabled/infinity-next
    4. nginx -t
      1. systemctl restart nginx
  2. Give www-data read/write access to application storage:
    1. chown -hR infinitynext:www-data /var/www/infinity-next/storage/
    2. chmod -R g+rw /var/www/infinity-next/storage/

Phase 4:

  1. sudo -u infinitynext /bin/bash or runuser -u infinitynext /bin/bash
  2. npm install
  3. npm run prod
    1. Check package.json for npm script definitions.
  4. CONGRATULATIONS!!! U HAVE SUCCESSED ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰
    1. You should now have a /test/ board.
    2. The admin account will be named Admin.

To accommodate upstream reverse proxies:

  1. sudo -u infinitynext /bin/bash or runuser -u infinitynext /bin/bash
  2. php artisan vendor:publish
  3. Edit config/trustedproxy.php as required.

Additional reminders:

  1. Set your SMTP server in .env - you need this for password resets.
  2. Adjust your maximum file upload size in nginx and php!
  3. Install ffmpeg for multimedia assets to work!

Adding WebSockets

WebSockets will play an increasingly important part of the software as they increase the responsiveness of the entire application. It is suggested to set it up, though it is somewhat complicated.

  1. Install Supervisor to run artisan queue:work redis. Example in docs/supervisor.txt.
  2. Install Laravel Echo Server by running npm install -g laravel-echo-server or yarn global add laravel-echo-server.
  3. Run laravel-echo-server config and generate a laravel-echo-server.json.
    • You must be using Redis and you must make sure the Redis configuration matches exactly.
    • Ensure the hostname matches exactly or events will not be sent to connected users.
    • I suggest using the docs/nginx.txt configuration with a /socket.io proxy pass to the server instead of exposing it directly.
  4. Run laravel-echo-server start. This does not launch as a daemon, so consider using a program like screen to keep it running without a terminal attached.

Further documentation about Laravel Queues and Laravel Broadcasting can be found in the official Laravel documentation.

License

Infinity Next is distributed under the AGPL 3.0.

In short:

  • You may use Infinity Next for any reason you please.
  • You may modify Infinity Next as you see fit.
  • You may profit with Infinity Next.

However, you also agree that:

  • Infinity Next & Contributors are not liable for this software and any damage it may do.
  • Infinity Next & Contributors are not liable if this software is used to break the law.
  • You will not sell copies or modifications of this source code (no sublicensing).
  • You must distribute the source code for any publicly hosted modifications of Infinity Next under the AGPL 3.0 license in a conventional format.

The AGPL3 license is designed to protect the end user by keeping modified copies of the source open and free.

While not binding, I do ask that users link back to this git repository on their website. Sharing is caring. โ™ฅ

Contributing

Everyone is welcome to contribute, but please follow repository etiquette.

  • Fork the repository.
  • Raise a separate issue for everything you intend to fix.
  • Plan your fix and allow for discussion.
  • Tie your commits to issues.
  • Keep pull requests concise, list issues addressed, and make it easy to pull them.

It would benefit you to make sure your solution has the OK before writing any code.

Coding Standards

In the name of preventing conflict and keeping the codebase clean, I am implementing the exact same standards of Laravel contributors.

Laravel follows the PSR-0 and PSR-1 coding standards. In addition to these standards, the following coding standards should be followed:

  • The class namespace declaration must be on the same line as <?php.
  • A class's opening { must be on the same line as the class name.
  • Functions and control structures must use Allman style braces. Indent with tabs, align with spaces.

"Allman style braces" refer to having a curly-brace on a new line at the same level of indentation as the conditional itself.

if (condition)
{
	// Code here.
}

infinity-next's People

Contributors

ccd0 avatar ctrlcctrlv avatar dependabot[bot] avatar garbagehamburger avatar graham--m avatar interjection avatar jaw-sh avatar lilyachan avatar lluixhi avatar majestrate avatar milezzz avatar nuew avatar odilitime avatar robsob91 avatar sleepingcrows avatar tmrwbo avatar zefredz avatar ziro- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infinity-next's Issues

Create an administrative options page and integrate options

  • Add a permission for admins to edit site-wite config
  • Add a page to the /cp/
  • Config options belong in their own table with a UID.
  • Config options should belong to groups which also have their own table.
  • Initial config options
    • Moderator options
      • Maximum ban length (default 30d)
    • Post options
      • Maximum file size (allow 0, which disables)
      • Thumbnail dimensions

Properly handle navigation

Right now, navigation is constructed by the View and directly translates the boards with what is to be shown. This is improper and too select..

  • Expand the navigation menus so that non-boards can be linked.
  • Improve the way views are constructed so that we do not need to call SQL in the View.
    • As a part of this, resolve the issue where the same query is ran twice.
  • Try to match this really great design.

8chan frontpage__redesign__edit5 1

Add Boards

Content on Larachan should be grouped into boards.

For this to happen, we need:

  • A MySQL table for boards.
  • An index page for boards that is accessed with an uri.
  • A list of threads created for that board (#4).

Add Posts

Content will be pushed to Larachan in individual posts written by the user.

  • MySQL table for posts.
  • Posts belong to a board. (#3)
  • Can be their own thread.
  • Can be a reply to a thread.

nntpchan integration

infinity-next should implement srnd integration so that it can act as a frontened for nntp-overchan.

right now i am working on stubs for this in srnd in the event that upstream cares to merge this functionality in.

User Board Creation

Allow for users to create their own boards.

  • Accounts
    • Registration must work.
    • Emails must send for password resets.
    • Reset links yield the correct form and reset the password.
    • Users can create accounts without emails that do not have automatic password resets.
  • Board Creation
    • Accounts can create multiple boards.
    • Site config for maximum number of boards.
    • Site config for wait time between board creation.

Implement IP bans and hotpocket tools

  • Deletions
    • Single Deletions
    • Board-wide Deletions
    • Site-wide Deletions
  • Bans
    • Ban table
    • Ban reason table
    • Ban creation page
    • Bans prohibit posting
    • Inline ban message
    • Ban+Delete
    • Ban+Delete+All
    • Ban+Delete+Global

CAPTCHA route interferes with board routing

The vendor we use for captcha work will sometimes be hijacked by the board router trying to find a board named /captcha/.

Because of general lack of customization in this plugin, @ctrlcctrlv and I believe it'd be better to take the code (licensed under MIT) and make it an official part of the codebase.

Allow post submission

A response needs to be set up to insert posts.

  • This form needs to appear on two pages.
    • Thread list.
    • Reply list.
  • The form needs to press posts into the database.
    • Replies should appear under their OP.
    • New threads should appear in the board list.

Improve .env handling and config options

The config is very presumptuous and caters only to my local environment. Flesh out environment options so that it's easier to make your own.

  • URL
  • Stripe Settings

Implement tripcodes

The current tripcode system, first written by 2ch in the 90's, is implemented like this:

https://github.com/ctrlcctrlv/infinity/blob/master/inc/functions.php#L2751-2785

In short, it works by using a publicly known salt and the thoroughly busted PHP crypt() function which implements the so called "Data Encryption Standard", first written by IBM in the 1970's.

DES is thoroughly broken.

A program exists that can crack entire tripcodes in 48 hours or less on modern GPUs.

Even less advanced users who only have CPU power at their disposal can crack the beginning 4-5 characters of a trip in hours, which is enough to fool most people as they don't have the whole trip memorized.

The nice thing about the 2ch system was that tripcodes on 2ch work everywhere: 2chan.net, 4chan, 8ch, 7chan...unfortunately, they're very broken already and it won't be long until completely inadept users can track any trip on an hour.

I will implement Overchan-style message singing in infinity-next using ED25519. Since this is a signing algorithm and not symmetric encryption like trips, it is even possible (but of course not default) to sign your message offline and not even trust the site with your key. This is suitable to even be used for admin messages.

In order to be easy for inexperienced users, [a pure PHP fallback will be used by default](https://github.com/trianglman/sqrl/blob/master/
src/Trianglman/Sqrl/Ed25519/Crypto.php). Users will be recommended to compile the PHP libsodium for best security though!

Drag and drop support.

I want to be able to add files by dragging and dropping. Navigating from file open dialog is tedious when I can use a superior file manager.

Add Laravel

The base of Larachan is Laravel. Install it to start off the repository.

Create ad space

Copypaste has 2 300x250 ads and 1 720x90 ad. Find some room in our default template for this.

Build and organize the sign-in control panel.

The /cp/ directory is being reserved for anything that requires authentication to do. It is the control panel for login, registration, password manipulation, board creation, board management, site management, etc. This is for three reasons:

  1. /cp/ can standard for Control Panel.
  2. /cp/ can be for user, moderator, or administrative controls.
  3. /cp/ is usually a blacklisted directory anyways. :^)

Right now most of the Laravel default controllers and views are tagged as Auth and listed under /Auth/ directories. This definition tends to be mostly about handling logins and registrations, so the organization needs to be handled to deal with a larger and more broad definition.

Create database seeds

copy was frustrated setting up the database because of a lack of seeding.

Seeds are easy to create, so lets create them.

Add Captcha

Bots are the natural enemy of imageboards. Add a captcha service.

  • Captcha added.
  • Request password form secured.
  • Post form secured.

We'll revisit this in another issue to determine when it is appropriate to have captcha. That is not this issue.

Create a moderator log

  • logs table
  • Actions commit to the logs table
  • Public table with all moderator actions
  • Logs clearly show who did what when.
  • Actions translate and access extra information when populating logs table.

Proper documentation

The repository Wiki needs to outline the following in detail.

  • Purpose
  • License
  • Contribution requirements.
    • Coding standards

Image attachments

  • Add table for storing files.
  • Add table for file to post association
  • Add form element for uploading images
  • Render image inline with post
  • Render compressed thumbnails

KX style second SQL-encapsulated increment column for board id

Much to @jaw-sh's disapopintment, it is a definite requirement to have a board_id that autoincrements along with a global ID that auto increments.

Kusaba X, one of the original chan engine and the one that Tinyboard rewrote provides us with this schema:

CREATE TABLE `PREFIX_posts` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `boardid` smallint(5) unsigned NOT NULL,
  -- snip
  PRIMARY KEY  (`boardid`,`id`),
  -- snip
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Psql supports it as well. SQLite does with a CREATE TRIGGER. Unfortuantely, in MySQL in only one engine InnoDB this is impossible.

Looping forever like (psuedocode):

while ($error && $error->isDuplicateIdError) try_again();

hits the database far too often and is assuredly bad practice. In very active threads this could potentially loop ten times with a busy DB. I've done tests before of this on live software for a project and it was a disaster, but it 'worked' and I got paid. Let's try to do better than just get paid and do a good job as well.

We cannot just use global IDs and we cannot just use IDs based on position in the thread (>>1, >>2 etc) due to familiarity reasons. We need to keep this hack from KX, without just devolving into a million post tables like Tinyboard/vichan/infinity stable. I will write a migration for it.

Add Font Awesome

Add font awesome because everyone loves font awesome

  • Font awesome

Utilize the translation feature better

Right now, I am building a lot of forms and pages with raw text. Laravel has a built-in translation system that I need to take full advantage of.

  • Understand the translation architecture more comprehensively.
  • Wrap all text in a translation function and properly use the architecture.
    • Board, thread, and post views.
    • /cp/

Board Management, Board Transparency, Board Moderation!

Separate from #47.

  • cp/boards/ area shows a list of boards where board.config privileges exist.
  • cp/board/{board} shows the config panel.
  • Config
    • Basic
      • Title
      • Description
      • Language
      • Indexed
      • Overboard
      • Worksafe
    • Transparency
      • Public logs
      • Public logs without usernames
      • Ban logs
      • Ban logs without usernames
    • Moderators
      • Allow for users to be added as moderators on a board.
      • Allow for users to be created for moderator positions on a board.
      • Allow for unique casts to be added for moderator roles.
      • Allow for users to be assigned castes with roles.
    • Style
      • Custom CSS

More to be added as featured are implemented.

Paint it blue.

I see a line of cars and they're all painted blue.
With flowers, and my love, both never to come back.
I see people turn their heads and quickly look away.
Like a new born baby, it just happens every day.

Segregate all Contribution pages, organize file structure

The contribution pages are now in the way. Normal users cannot adequately fork the Infinity Next codebase because they're in the way.

Move Contribution stuff to neatly organized areas so that they can be ignored and eventually removed.

Organize CSS and JS and add a way for run-time compression

Right now, CSS and JavaScript is all over the place.

CSS

  • Make sure all CSS is properly organized.
  • Add a way for CSS to be compiled into a single file for live applications.

JavaScript

  • Make sure all JS is properly organized.
  • Add a way for JS to be compiled into a single for live applications.
  • Build a window.ib object that handles every single script relating to larachan.

Avoid distributing static content via PHP

@majestrate takes issue with the way that files are distributed.

Right now, files are accessed via this route:
/board/file/md5/filename.ext

I think it would be possible to reserve this URL, or change it slightly, and continue to use PHP to distribute it -- but, also create Apache/nginx/Lighttpd masks that will serve the /storage/app/attachments/md5 file with the filename.ext name. If these masks are not present (i.e. because the environment is poorly configured), PHP will distribute as normal as a failsafe.

@majestrate claims that doing doing this may work but it may also break as content-type will not be set by the web servers unless the file itself has an extension, such as md5.ext. Needs some investigation.

PR #25 will do exactly what @majestrate has proposed, but I'm reluctant to pull it until my idea is tried out.

Issue pertinent to @ctrlcctrlv as this is mostly an issue for high bottlenecks on big sites.

Rebrand to Infinity Next

Any and all instances of Larachan are to be removed as official sponsorship is added from the Infinity Development Group.

Anonymous users should share functions with the User model.

Auth::user() currently returns a \App\User if the user is authenticated. I have organized the controller structure so that MainController inherits Controller and automatically binds authentication to every page on the application. All other controllers either directly inherit MainController, or (in the Auth controllers), inherits a controller which inherits MainController.

What would improve this system is an Anonymous user. If a user is not authenticated, there is no model which exists to pose challenges against. By splitting out permission challenges into a new trait and implementing it both on the \App\User and another, non-inherited class, we can easily share logic between the two and yield reliable information.

Implement user permissions for administration, moderation, and board management

A synopsis of this issue is: "Add a system to check if a person can do something."

This is my current proposed model.

This is a lot to digest so I'll explain how this process would hypothetically work.

The Seeder
When the database is originally seeded, you will end up with four Roles and a few permissions.

An example of permissions, for instance, would be board.post.delete.self and board.post.delete.other. One is the traditional permission to delete your own message, the other is a conventionally staff-only permission for deleting anyone's post.

With our seeded information, the Role table would look something like this:

Role Board
anonymous null
admin null
volunteer null
owner "test"

Our permission table would look like this.

Permission Base Value
board.post.delete.self 1
board.post.delete.other 0

And finally, the pivot table between roles and permissions would look like this.

Role Board Permission Value
admin null board.post.delete.self 1
admin null board.post.delete.other 1
volunteer null board.post.delete.self 1
volunteer null board.post.delete.other 1
owner "test" board.post.delete.self 1
owner "test" board.post.delete.other 1

What is a permission value?
The answer to a "can?" question in programming is boolean, but when composing a permission mask it's a bit more complicated.

By default, an anonymous, unaffiliated user can delete his own post. On a board like /cow/, you cannot delete your own post. The answer to "can anonymous delete a post on /cow/" is no, despite the answer to "can anonymous delete a post" being yes. To represent this in a model, it is assumed that:

  • If a value is 1, you can do something.
  • If a value is null, you cannot do something, unless given permission.
  • If a value is 0, you can never do something.

So, if a user was setting up their board and defined the role "anonymous","cow" with the permission "board.post.delete.self",0, it would override the base_value of that permission.and kill the anonymous user's ability to delete his own post.

Conversely, the value for board.post.delete.other is 0 by default, which means that you cannot delete another IP's post.

A null value comes from a lack of a pivot row between a role and a permission and it defaults to the base_value of the permission.

Inheritance
Much like how a Post can reply_to another Post, a Role can inherits another Role. The most succinct example of this I can give is in a case where we define a specific permission mask for the DNSBL. If a user is on Tor or a known proxy server, we can modify their permission masks to this affect in a case where board.post.delete.self.base_value is 1

Role Board Inherits Permission Value
anonymous null null board.post.delete.self null
dnsbl null anonymous board.post.delete.self 0

With this inheritance, the answer to "can dnsbl user delete posts from the same ip?" is "no". However, in all other regards, it is treated as an anonymous user and permissions applied to "anonymous" will also apply to "dnsbl".

Assignment
The user_roles table FKs the roles table using the joint PK role,board. Instances where board is set to null mean that it is a global mask. Where it is set, it affects only one board. Assignments work the same way.

User Role Board
copypaste admin null
copypaste owner "n"

Redirect Vichan-style Routes

The following route styles need to be handled.

  • /operate/catalog.html
  • /operate/res/20692.html
  • /operate/res/20692+50.html
  • /operate/index.html
  • /operate/2.html

Additionally, copypaste uses these for unique features.

  • /_g/
  • /_t/

/_g/ and /_t/ are text files. I'm not going to route those. He can upload them to public on his own and they should continue to exist. In the future, we can probably have a URI like /board/post/post_id for GPG signatures. /_t/ will remain as-is because it's not an imageboard feature.

Add Stripe cashier support

For the Kickstarter, we need Stripe.

  • Install Stripe with composer.
  • Add a page for donations.
  • Allow Anonymous or User-based donations.
  • Add a page to list donors.
  • Add a campaign page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.