IdiotNet is a really stupid social media, made by W1THRD. It has very little security features, and at this stage is only a prototype, not a finished product intended for the public internet.
Each database table has a corresponding class to represent a record from said table. There are two constructors for each:
- default constructor:
User(),Post(), andToken()create a new object that hasn't been committed to the database yet - read constructor:
.read()will take a pre-existing record from the database and turn it into an object
If you need to commit an object to the database, use User.create, Post.publish, or Token.create
Please, I beg you, don't yell at me for storing the passwords in plaintext. I've known for years that this is not a good way to store passwords. I will add it sometime in the future. Here's a rundown of the tables used:
This table stores all the user-generated content. Each record contains:
id: A unique numeric idtitle: user-created title for the postscontent: user-created body for the postauthor: username of the user who created the postdate_posted: the date of the post's creation, in Unix timelikes: a count of how many users have liked the posts
When the backend reads a record from the posts database, it will create an instance
of the Post class, containing the same data values.
This table stores data about user accounts, including:
username: a string used to identify a user, by both the backend and in the UXdate_created: the date of the user's registration, in Unix timepassword: the password, stored in plaintext. (Don't be mad- I will start using password hashing and salting in a future update)followers: a JSON list of the usernames of the user's followersposts: a JSON list of the ID's of posts the user has writtenfollowing: a JSON list of the users that this user followsliked_posts: a JSON list of the ID's of posts the user has liked
Like with records in the posts database, all records in the User database can be stored in User object.
This table stores authentication tokens, used to keep track of who is logged in. The data stored includes:
id: a unique UUID string to identify a tokenusername: the username of the user associated with the tokenvalid_until: expiration date of the token, will eventually be implemented