Coder Social home page Coder Social logo

vincent-peugnet / antilope Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 1.53 MB

Antilope private tracker for IRL sharing, allowing members to share anything inside communities.

Home Page: https://antilope-alpha.club1.fr/

License: GNU Affero General Public License v3.0

Shell 0.20% PHP 80.13% Twig 19.65% CSS 0.01%
symfony5 private-tracker social-network bootstrap4 share php mysql

antilope's Introduction

Antilope

build style phpstan

Antilope is the name of this Sharable Network Tracker.

Alternatives names could be Argali or Urial as it refers to Gazelle, the main inspiration dor this project.

This isn't an app, but a tool allowing people to create their own networks and setting them up for each use case. Checkout the requirements to set up your own instance on a server.

It's built using PHP 7 and MySQL with Symfony 5 framework and Bootstrap 4 toolkit.


  1. Concept what is this strange network ?
  2. Setup how to install
  3. Development usefull tools for develpment thanks to n-peugnet

Concept

The whole idea behind Antilope, is to transpose the private tracker system to anything else but torrents. Sharables are the key concept of Antilope : they are a the unit of what you can share.

The classic question is : What can be shared through this system ?

And the classic answer is : what would you share ?

In fact, there are no categories defining what should or should not be a sharable. The only limitation of what can be shared or not is your imagination! Sharables are only defined by a set of parameters (place, date, consumability...) that are all optionals. Sharables are "managed" by at least one user. Those managers can precisely define how they relate to the sharable and how they want to manage it.

Antilope is designed to encourage the creation of small scale networks instead of massive ones. The main goals are :

  • to increase trust between users instead of violents rating system.
  • have the possibility to gamify life interactions.
  • have an half self-managed, half moderated user management.

References

How it works

Create a sharable

When you create a sharable you can setup a lot of meta infos :

  • name
  • description
  • details (markdown)
  • begin date (optional)
  • end date (optional)
  • place* (optional)
  • consumability* (if the sharable is something that can only be shared a certain amount of times)
  • visibility (optional : above which user class does users can access the sharable)
  • contact method (see Managing and contact method)

*: todo

Managing and contact method

There can be any number of users managing the same sharable, that way they will all receive the same amount of share points during validation process.

A contact method must be chosen for every sharable between this four strategies :

  1. no contact : no contact infos are given with the sharable.
  2. automatic : when an user is interested by a sharable, contact infos are exchanged.
  3. manual : when an user is interested by a sharable, contact infos are exchanged after interested users have been manually reviewed by a manager.
  4. never : Only interested user contact infos are send to managers.

The methods go from less protection to maximum managers protection. As you are sharing, you are always able to be more protected.

Search and Discover

Depending on how user classes have been set up, users can search through the database of sharable using differents views :

  • list search
  • map*
  • calendar*

*: todo

Interest

First step to benefit from a sharable is to indicate that you're interested. After that depending on the sharable contact method, contact infos are exchanged.

Validation

The validation system is there to avoid violent rating system. As you can only validate a sharable and add a message like in a guestbook, you can only express criticism using words. You can't just put a 1/5 stars without explaining why.

Validation can only occur after the being interested in a sharable and that contact infos have been exchanged.

But if there is a real problem with a sharable, user could report it. Depending on the report subject, this will be handled by the managers or moderators.*

*: todo

User Class system

One of the most efficient way to increase gamification in a network is to implement an user class system. They allow or disallow users to share or access sharables, invite users... And the user classes can be triggered by many parameters such as the share score, account age, number of validations the user gave...

Share Score

The share score is the system that try to give an indication of how much an user has participate in the network. Unlike private trackers, that can precisely mesure torrents ratio, it's impossible and absurd to have a correct quantification of how much have been shared between users. But still, share score is there as the only indicator possible, and can be used for user class promotions, this is how it works :

Every time an user validate a Sharable, every user managing it win an amount of points, based on :

  • validating user class (higher user rank give more points)
  • the amount of validation already given for this sharable (first validations give more points)
  • divided by the number of managers

Interface

interface

Setup

Requirements

For now, the only way to install Antilope is using git and composer.

  • Apache
  • PHP 7.4
  • MySQL
    • MariaDB 10.2+
    • MySQL 8.0.1+
    • PostgreSQL 8.4+
    • SQLite 3.8.3+

Install

Install via git clone.

git clone https://github.com/vincent-peugnet/antilope <APP_DIRECTORY>

Go into your app_directory folder.

Setup database connexion using .env files. see symfony documentation.

By default SQLite 3 will be used in DEV environment but incremental migration mode won't work.

Then run composer

composer install

Some questions will be asked to set your app parameters. You can press enter many times to set those as default and change them later in the paramaters.yaml file.

Create the database

bin/console doctrine:database:create

Migrate the migrations

bin/console doctrine:migration:migrate

Create the first user Class

bin/console app:userclass

Then you will have to create your first user. Verify that app.openegistration is set to true, and access sign up at /signup to register.

To toogle admin privilege on a user, you'll need it's user ID. Navigate to an user profile page and get the number like this /user/<USER_ID>/show. Then, use the following command:

bin/console app:admin

Email

Edit your .env file as defined in symfony's DSN protocol.

Then you can use the following command to send a test mail, just to be sure you've set everything up alright.

bin/console app:mail <your-email-adress>

Global parameters

Default global parameters are generated interactively during composer install command.

  • app.open_registration (bool) Allow free sign up, disable the invite code system
  • app.user_limit (int) Max user limit. If this number is reached, registrations are closed
  • app.invitation_duration (int) Duration of invite code before it expired (in hours)
  • app.last_activity_delay (int) Time of user lastActivity refresh (in minutes)
  • app.contact_forget_delay (int) Time before a contact is not visible anymore (in hours)
  • app.contact_edit_delay (int) Time before a contact is not editable anymore (in minutes)
  • app.min_tag (int) Minimum number of tag per sharable (0 is none)
  • app.max_tag (int) Maximum number of tag per sharable (0 is none)
  • app.bootswatch_theme (string) Name of the Bootswatch theme to load (in lowercase)

Administration

Inactivity pruning

Users are automatically disabled if they login after too much time according to their user class, but you can also manually trigger a full check using this command:

bin/console app:inactivity [--dry]

Pass the --dry option to launch a dry run, this will tell you how many users need to be disabled because of inactivity.

Deployment

It is possible to automatically deploy the application on a remote server using the command bin/console deploy. For this to work correctly you will have to set the following environment variables correctly on your local machine:

[email protected]
DEPLOY_DIR=/absolute/path/to/antilope
[email protected]:vincent-peugnet/antilope.git
DEPLOY_REPOSITORY_BRANCH=main   # optional
DEPLOY_WEBSERVER=apache         # optional
DEPLOY_COMPOSER_PATH            # optional

The directory DEPLOY_DIR will have to be created on the remote and a .env.local file must be created inside with the correct variables.

In order to fix a symlink bug with Liip Imagine Bundle, you need to specify:

LIIP_PUBLIC_PATH="../../shared/public"

Development

Run checks

composer check

Fix basic check errors

composer fix

Run the dev server

bin/console server:start

Generate migrations for sqlite

bin/console doctrine:migrations:diff --db-configuration sqlite

Translation

Translation checking tools CLI.

bin/console translation:missing       # check missing strings for fallback locale (en)
bin/console translation:missing --all # check missing strings for all locales
bin/console translation:extract       # extract missing string for fallback locale (en)
bin/console translation:extract --all # extract missing string for all locales

antilope's People

Contributors

mement0o avatar n-peugnet avatar vincent-peugnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

antilope's Issues

reports

Report are made to avoid abuse and try to keep a minimum security layer using user self moderation and dedicated moderators.

add the ability to report sharables and interested users to users. (interested users are users that have clicked on interested button on a sharable

This could be an UserClass propriety defining who can or not report. But keep in mind that it's a security tool, so this should not be reserved to only high user classes.

There should be different types of reports adressing to differents users types :

  • report

    • the sharable is not available anymore (maybe this could be only when manager don't take responsibility for it) This is send to managers or public in case of no-responsibility for example
    • there's been a problem with the sharable
      • send it directly with managers
      • or send it to moderators, the reports will be analysed and used to block dangerous users or sharables
  • user can create reports on

    • sharable
    • interest
    • validation
    • contact ???
  • report right is set in their user class

Make UserClass editable by admin

Re-use the userclass/id by adding a userclass/id/edit and a userclass/id/delete.

access would be controller by userClassVoter checking if user is admin.

edit

Should be the same form as add but with a few differences:

  • The rank could only be set between next and previous userClass ranks.
  • the submit button will be called "edit"

Delete

On delete, all the user will migrate to the next lower user class or then upper.
It will be impossible to delete the last userClass standing.

user search/sort bar

  • Do the same work that for sharable but for users.
    • add a select user class
    • add a search bar
    • ggg

Userclass/id should be redirected to user search using a get parameter indicating witch user_class to filter

SAML 2.0 IdP

In order to add a forum module to Antilope, the best solution seems to use SAML protocol.

It allow user to be automatically authenticated on a forum or any other SAML 2 compatible Service provider (SP).

The best way to do it seems to use the LightSAML-IDP library. This not well documented, happily for me, there is this perfect tutorial doing just what I'd like to do !

An example of SAML SP plugin for Flarum seems to be in active dev right now : https://github.com/askvortsov1/flarum-saml

If SAML is working smoothly, this will be a major improvement in terms of modularity !

help

to help new user, there could be a lot of little texts infos div in each page explaning how it works.

Users can then just uncheck it in there account setting to hide those.

This seems to me the easiest way to add some help in the application. It take advantage of the precise page sub-division.

define disabled user

For many reasons, an user could become disabled.
It could happen:

  • after a certain amount of warnings
  • because of inactivity pruning #32
  • because an user want to left the network ?? (is it the same thing)

But what does it mean to be disabled ?

  • can't access sharable
  • can't create sharable
  • can't be contacted
  • can't invite

So the user can still connect read the rules, and maybe later, contact staff.

What to do with already existing sharable ?

There are two cases:

  1. When the disabled user is the only manager
    • this should be considerate as un-contactable, so impossible to be interested in.
      • this mean sharable using contact method 1 are still working
  2. When there are onther non-disabled users
    • the sharable should remain as contactable if at least one contact exist.

Is disabled the same thing as deleting an account ?

Account should never be totally deleted. As there is often this logic of one account / user / lifetime. But it is not for every purpose. Maybe this could be a global parameter. accountRealDelete (bool). Or, allow or not user to leave with no traces.

This is related to the question: can user delete sharables ? This is interesting for archive purpose.

After all, I think the solution may be to ask the leaving user if he or she'd like to delete all it's history or not. This could be a parameter allowUserDeleteHistory (bool). The most problematic deletion seems to be validations.

Sharable consumption

add a consumption propriety in sharable entity

This could be for now just a boolean.

In a more advanced version this could be a int, that could indicate a quantity, but it's quite strange.

Could this propriety interact with validation ? as a consumable sharable should be deleted after a fixed amount of validation. But as validation are not so sure, it sounds a bit dangerous...

add some new notifications

  • userclass update, depends on #53
  • invitation has been used
  • account has been disabled
  • validation received
  • rules update
  • invited to manage a sharable

warnings

Warning could be send to users that received a certain amount of report.

This could be automatic: for example if first warning is set after 3 reports, the user will directly have a warning message.
But what will contain this message ?

  • It should not give information about who send them
  • it should explain in a way what for the user is warned. But how to do this ?
    • The only way I see to synthesize a problem, is through an human. This could be a moderator job to write the warning message or to select it in a list of categories, or both... Even better if it's referring to a specific part of the rules.
      • But moderators should not be able to see there own reports !
      • Maybe categories to choose when sending a warning could be directly in the rule list, according that rules are stored in a database table (#45).

What to do with the warning after it's been send ? Maybe let's just wait ! A warning could have a perish date set in global parameters. For example every warning last 3 months.

There could also be a number of simultaneous warning after which an user is disabled (meaning he or she can't /search/interest/validate any sharable.

inactivity pruning

account deactivation based on inactivity.

This sounds like a parameter in userClass:

  • inactive (int)

quantity of days before inactivity pruning ( 0 for immunity )

And of course, store in the User class the lastConnect (datetime) and active (bool) datas.

But how to implement this ? should it be :

  1. a cron job ?
  2. or when an user connect ?
  3. Or a scan triggered by admins or moderators ?

I know that I can easily implement a mix of 2 and 3, but maybe you have a better idea @n-peugnet ?

Contact entity

Store contacts in a new table.

  • createdAt
  • user
  • sharable
  • type (email, phone, matrix, adresse, coordinate...)

Question, does the sharables and users contact need to share the same table or is it better to split ?

Rules : add a rules section and a way to edit them

The simplest way could be a markdown file stored in the app files.
But only one admin could edit it.
It could be interesting to add the ability to allow moderators edit the rules.

AND

The most complex but interesting strategy could be to use a git-like rule system, but using a vote system to validate rules or not.
Voters could be mods of course, but also some users as defined by user-classes.

This could as well be done by some external dedicated tools, with a SAML connection #40 πŸ₯Ί But I doubt on this solution.

Actually vote system for rules are very related to important aspects of this project. This would be a great implementation but maybe not too soon as it need a lot of work to do it well.

anonymous management

Allow manager to manage sharables anonymously.

That could be a boolean in Manage object indicating it.

bookmarks

allow users to bookmark sharables

Sharable should be deactivated by default and later activated by the user

Deactivation of a sharable should not be a little checkbox in the edit page.

In fact activation or not is a different kind of info. That is why it should need a different place.

I could as well imagine storing in the database a "last toggle" date to indicate since when a sharable has been deactivated or since when it has be (re)activated. This will start with the first "activate" clic by the manager.

Funny idea : instead of storing a classic bool (0 or 1), I could store a int using a method isActivated() sending true if the number can't be divided by two and false if it can. That way, I just have an info of how much times it has been activated. LOL
It's really if you don't want to create an activate table with manyToOne relationship πŸ˜„ @n-peugnet

tag system

checkboxes to select tags in sharable/edit

Problem, when there is a lot of tags, thing will get pretty messy...

Two possibilities I see :

  • in global parameters : allow or not users to create tags
  • user can create tags only at a certain point.

Share Score / Validation algorythm

The main moment to add some share point to an user is for now during the validation process.

At this time, the idea is to calculate it based on 3 datas ;

  • the rank of the validating user
  • how much the sharable as already been validated
  • then divided by the number of managers

dedicated rich text description editing tool

instead of editing sharable description as a part of /edit, add a specific interface with a generous editor.

Choosing a rich markdown editor

What I need:

  1. display markdown synthax
  2. have toolbar for text style
  3. have image import tool !?
  4. have an easy url tool

In fact, Github editor is almost perfect, I love the image drag n drop function, but it lack of url help wich is cool for beginners I think.

Selection

For example Toast UI editor is based on Jquery, and I use jquery query for bootstrap menu and others. Is it a good strategy to use only one main library like this more than many differents @n-peugnet ?

PHPStan ? PHPCS ? GH Actions ?

So, would you be interested for a setup of ye olde php toolchain:

  • PHPStan for static analysis (+ symfony plugin) (#19)
  • PHPCS for style checkink (PSR12) (#23)
  • GitHub Action to run these checks on pull requests and master (#35)

In addition I could add a command in Symfony console that run the checks to easily check before committing.

Problem with this migration

$this->addSql('ALTER TABLE user CHANGE last_activiy last_activity DATETIME NOT NULL');

I don't remember what I've done here when correcting a spelling error, but I've broke the migration system. I think I've deleted the original creation of last_activivy.

I think I should transform it to ADD last_activity instead of CHANGE because there are no reference of last_activy before.

What do you think @n-peugnet

admin panel

add an admin panel and an admin role using symfony role system

interested / contact button

When an user click on the "ask for contact" button, this should send some more preçise info related to the sharable.

should it be :

  • some added contact info (email, phone, matrix, adresse, coordinate...)
  • a new text bock containing text to help the user access the sharable
  • both ?

Some sharable does not seems to need this contact logic. For example, thoses where managers are not responsible for it, this seems less acurate.

So, there should be a choice indicating how it need or not to be contacted :

  1. don't need contact before accessing
  2. auto contact, info are send automaticaly
  3. manual contact, managers have to check manualy user profiles asking for it, and send them contact individualy
  4. never send contact, only user needing access send contact by clicking the button, managers only can join the user using their contact infos.

There's an ideological problem with stratey number 3 and 4, as it add some judgment by the manager upon the user.
Maybe this should as well be a global parameter...

geo datas for sharables

each sharable should have the ability to store geo datas.

There should be two ways of doing so ;

  • by setting up a longitude and a latitude
  • by setting up a address, postal code, country

When a one is set but not the other, the app will check on online API to get the other.

Roadmap

  • store coordinates with sharables
    • add a long and lat property to Sharable entity as float ?
    • update the form
    • add a radius property for public location anonymisation
  • map view
    • implement leaflet
    • add deflate library
  • add the (reverse)geo-coding function in forms
  • radar view on phones

calendar view

add a view to easily check for event.

an easy way seems to be a week using 7 columns that are only displayed horizontally on large computer screens.

But, the simplest is just like the task list : display a list of all next days where something append (start, end) and what continue today.

user class level up

check for level up should be triggered by multiple events:

  • when an user get share points
  • when an user login
  • when an user create a sharable

MMhhh, maybe a better system would be to trigger thoose checks depending on the upper userclass access parameters.

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.