Wolfballs Development
Hello; This is how I run the wolfballs backend codebase. To make UI changes more work is needed. If someone wants I can make a tutorial on that next. Copying the contents of the readme below. # Alternate Lemmy docker and vscode instructions I like to be able to run a rust app with cargo run and not rebuild images. Even if it's quick. This alternate docker method mounts the lemmy code into a container that installs all your dependencies. To get started you need a couple things installed on your machine; 1. [Docker](https://www.docker.com) For the ui features; 2. [VSCode](https://code.visualstudio.com/) 3. [Remote Container Plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) ## Instructions Clone lemmy down, `git clone https://github.com/LemmyNet/lemmy.git lemmy` `cd lemmy; # go into lemmy the directory` clone down this repo into the docker directory `git clone https://git.freefedifolk.com/chuzuchi/lemmy-remote-development.git docker/debug` Build the image; builds a arch linux container with a suder user name developer `docker-compose -f docker/debug/docker-compose.yml build` Do house keeping stuff the same as other methods. `mkdir -p docker/debug/volumes/pictrs` `sudo chown -R 991:991 docker/debug/volumes/pictrs` You can go ahead and test this with the terminal if you don't want to use vscode. To do that, `docker-compose -f docker/debug/docker-compose.yml up -d` `docker-compose -f docker/debug/docker-compose.yml exec lemmy /bin/bash` Might need to update rust; `rustup update` Ok now you can just run `cargo run` And you can visit the ui at, `` You can stop the container with; `docker-compose -f docker/debug/docker-compose.yml down` ## Run in VSCode If you would like a whole development environment based on vscode with all plugins auto installed continue to the next section. Bring down the containers `docker-compose -f docker/debug/docker-compose.yml down` From the root directory of the lemmy code base, copy the devcontainer and vscode directories from the debug section to the root. `cp -a docker/debug/devcontainer/ ./.devcontainer` `cp -a docker/debug/vscode/ ./.vscode` Now you can open up the project from vscode. VSCode will actually be running inside a arch container. Type `F1` and select `Reopen in container` ![](https://gitlab.com/wolfballs/lemmy-remote-development/-/raw/master/assets/picture1.jpg) Now you can click run in the debugger on the left. Break points aren't yet working due to async await in the main function. I'm not yet sure how to fix that. If someonw knows of how to get that working please open a issue and let me know. However server starts and the terminal in vscode is inside of the container. You can make code changes and click the restart button and it will restart very quickly. ![](https://gitlab.com/wolfballs/lemmy-remote-development/-/raw/master/assets/picture2.jpg) Thats is! You've got rust extensions auto installed in vscode for you.

Began moving wolfballs 2 to golang
In a effort to increase development velocity I have begun moving the code over to golang. As much as I love rust it's just not a great web dev language yet. Certain things are incredibly easy to do in golang. The http libraries are all written and tested by google. The error system is more standard so it's really easy to propagate errors. Rust doesn't have a standard web framework. It's all third party hobby written. While it's written good that also makes choosing the stack difficult. With golang I can just stick to libs google wrote. Will be supported atleast 10 years. This requires a little rework of the templates because golang doesn't use jinja style templating. I can reuse all the sqlite code and I'll begun writting a layer for postgres at the same time. I got distracted on some interviews and other projects so I took a few weeks off. I'm trying to keep my focus on this one thing. Lemmy has several bugs that really stress me out. And it's mostly to do with it's ui. Like you'll be half way down the page and suddendly it brings you to the top. The websockets cause people to hit their request limit to quick. While I could only rewrite the ui I feel like having complete control over the backend will allow me to add new features a little faster than trying to work them into lemmy, get them approved, all that jaz. Main things are better mastodon integration and a ui with less javascript. It will be cool when it's up and running i'm sure. And it will be good I think for lemmy to have a competitor like Mastodon so that people have something to compare and debate what features are needed and why. Always good to have competition in any space. Helps everyone do better.

I think I read in the past that the developer of Wolfballs would like to also buit it around Mastodon(?). I came across a fork of Misskey , Calckey which I think is way better than Mastodon and fits more to the Lemmy Wolfballs vision. Might wanna check it out..

Quick update on wolfballs 2
I'm committed to finishing the project. Holidays have me a little busy. I also need more practice in golang and not Rust. There just isn't many Rust jobs. I interviewed for one and my multi threading skills wasn't good enough to get me through the interview. I don't even know many ways to practice building multithreaded code. Usually a good single threaded algorithm does the trick better. I think I may take the templates and SQL I wrote and move them over to golang. Generally I can write golang faster than Rust, the performance is fine given that there is always time for the garbage collector when doing web request. I love Rust's enums, module structures but I'm not a huge fan of the error system in actix. It makes creating multiple database types a little difficult. I really want to support both SQLite and Postgres. I think both are important. .this is pretty normal for golang projects. Gitea does it. I can't find it any examples of a project actually doing that with Rust. People tend to pick one or the other. I'll probably finish a small reddit clone in rust and release the code as MIT to support the ecosystem and do federation in golang. The back end language isn't that important it's really mostly html and SQL with a connector layer.

Lemmy's community page is objectively terrible. It's just unfinished. In reatrospect that's pretty awful given the entire software is centered around communities. It's one area that will be easy to improve in wolfballs 2.

Basic community creation done
Had a little time today and have basic community creation is done in wolfballs2. A user can login, create a community and it sets the creator as a moderator by default. I need to add some better form validation and then I will work on the community view. Which should have proper sorting done first. And it will have community sorting, filtering before posting in a community is even a thing. That will get me close to being able to make actual post on the new site. I've got some pretty good css libraries i'm looking at so building the comment tree should be pretty easy and look very good with very little effort. Thats without pictures and stuff at first. I'm only going to show 3 levels deep. The user will have to click further to read down further. I'm doing 3 levels because the css library I am using supports 3 levels only. I don't want to write a custom css library. I want very little css in this project. Once we have community creation, community post and a few moderator tools I think the site will be ready for a alpha,alpha preview. Users will be able to create an account, play around with the expectation that your new account could get nuked as I don't want to promise the current database structure will stay the same. There will be very little features so i'm a little nervous to release anything so as to not let people think that the current state is all there will be. It's still very early on in the development but it would be useful for load testing to see some users play with it early on in the development. Also early feedback is useful in general so nothing gets to far along that is garbage.

Is There An Extension That Can Limit Wolfballs Tabs To 10?
I think in one post it was identified that over 10 tabs can cause problems with the ngix server or something? I accidentally did this today and then closed the tabs and was fine again I was wondering if there is some browser extension that could autodetect this and alert me to not open any more tabs on the other hand I was also asking if browser extensions like this are bad and harm your browsing security Ultimately I'll manually remember to not open so many tabs so I don't really need the extension it was just an idea I wanted to get input on

I'm calling communities Tribes in the rewrite. Tribe's have rules and community norms. You can be adopted into a tribe and expelled from a tribe. I think mods might be called elders or something cool like that.

Better Error Pages?
So let's say I try a community that doesn't exist, like https://wolfballs.com/c/ahhhhh, it gives me an error page "404: couldnt_find_community" do you think maybe we could have a better error page? Like maybe show mostly the main page but with that error message at the top? or also I think before I once suggested a "did you mean..." and list of alternative possible communities that sound like the community you tried?

Brief demo of wolfballs2's registration system
https://files.catbox.moe/p3667t.mp4 Hands down a backend rendered templated approach is going to offer a better experience than the current UI in lemmy. Developers who want to contribute will only need to know one programming language and that is rust to contribute. You will not need to spin up multiple containers to get started contributing. There will be no orm. Table joins will be as easy as can be. Colors and themeing and everything to be improved. I'm just trying to get it into a state where I can start adding the community features.

I have a working registration system
Complete with session cookies that expire after one month. I'm now building out the main dashboard templates. I love the css in gitea so much. I want all the colors to be like darkmode in gitea. Including a default icon. Once I clean up the code I will start building out community creation section. I will either immediately begin working on federation or start thinking about a timeline view. All this is in sqlite but the more I think about it the more I think I also want to support postgres in case sqlite bottlenecks. But supporting sqlite is really important for it to be easy to set up and hack on.

Currently doing interviews
So progress on wolfballs rewrite will be slow for the next week while my free time is spent studying leet code type questions and what ever programming language i'm interviewing for. I've got some web 3 and fang interviews lined up the next week. But I will get back to finishing the authentication system after that and then begin work on communities.

Post Numbering System From Decimal to Base 36?
So I think the post URLs have been numbers in order in the decimal system I've seen other sites make use of all the letters as well, which I think is the base 36 system: https://infogalactic.com/info/Base36 While the amount of posts is small now, I guess this is a kind of "future proofing" idea to keep post URLs small if you have a lot more letters to choose from to represent numbers. Thoughts on this or does it already make use of this system kind of?

I think they call it flair
This would be a great tool for mods. Is there a way we could place a simple tag besides a post for descriptive purposes.

Writing the new wolfballs blog
I think I'll start posting how things are coming along here. Atleast until i'm ready to share some source code. After struggling with Diesel i've decided to go a level lower with regular sql. I'm starting out with sqlite and I'm going to try to program to a contract so I can have both a sqlite option and a postgres option but I think sqlite fits better with my plan atm of making a hackable easy to deploy fediverse app. I really like using straight up prepared statements. Its easy to write, easy to read, and very intuitive. Disel has very poor documentation, examples and when they decide to release a breaking upgrade you have to suffer through a long upgrade process. At the end of the day you are writting sql so it's better for me to write sql. Now we can still use disel for the migrations and database creations. Which I might do or I might write my own for practice. I wrote one for work in golang just fine. Here is an example of a basic users table, ``` CREATE TABLE users ( id INTEGER PRIMARY KEY NOT NULL, username VARCHAR ( 255 ) UNIQUE NOT NULL, password VARCHAR ( 255 ) NOT NULL, email VARCHAR ( 255 ) UNIQUE NOT NULL, created_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ); ``` I've also decide to make a user sessions table. I beleive if someone gets a hold of one of your lemmy tokens you are basically fucked and have to make a new user because they never expire. (I could be wrong so feel free to correct me). ``` CREATE TABLE user_sessions ( id INTEGER PRIMARY KEY NOT NULL, user_id integer NOT NULL, uuid VARCHAR ( 255 ) UNIQUE NOT NULL, created_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, expires_on TIMESTAMP DEFAULT (datetime('now', '+1 months')) NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id) ); ``` Here I set a user session to last one month. I have not finished the session code yet. Today I wrote some basic create user code. ``` pub async fn new_user(pool: &Pool,user: crate::crud::models::UserInsertable) -> Result<i32, Error> { let pool = pool.clone(); let conn = web::block(move || pool.get()) .await? .map_err(error::ErrorInternalServerError)?; let parent_result = web::block(move || { let result = conn.execute( "insert into users (username,password,email) values (?1,?2,?3)", &[&user.username, &user.password,&user.email], ); return result; }) .await; let mut ret_val:i32 = 0; match parent_result { Ok(value) => { match value { Ok(ok) => { return Ok(ok as i32); }, Err(e) => { ret_val = -1; println!("error creating user:{}",e); }, } }, Err(e) => { println!("error:{}",e); }, } return Ok(ret_val) } ``` Pretty easy to read. Verbose because it's rust. The password is hashed ofcourse. To get a user, ``` fn get_user_Agg(conn: PooledConnection<SqliteConnectionManager>,username: String) -> Result<Vec<models::User>, rusqlite::Error> { let mut stmt = conn.prepare("select id,username,password,email,created_on from users where username = ?1;")?; let ret_val = stmt.query_map([&username], |row|{ Ok( models::User { id:row.get(0)?, username:row.get(1)?, password:row.get(2)?, email:row.get(3)?, created_on:row.get(4)?, }) }).and_then(Iterator::collect); return ret_val; } pub async fn get_user_by_username(pool: &Pool, username:String) -> Result<models::User, Error> { let pool = pool.clone(); let conn = web::block(move || pool.get()) .await? .map_err(error::ErrorInternalServerError)?; let parent_result = web::block(move || { let result = get_user_Agg(conn,username); let mut user = models::User{id:-1,..Default::default()}; match result { Ok(values) => { for u in values { user = u; } }, Err(e) => { println!("error getting user:{}",e) }, } return user; }) .await?; return Ok(parent_result); } ``` Pretty basic stuff. I have a little form with validation all done with templates rather than a separate front and back end. ![](https://wolfballs.com/pictrs/image/c81f0da4-0443-4bd0-8c48-40ca30289439.png) All basic stuff but sense i'm not using a big frame work like Django I need to write this basic stuff first. After I get a few crud operations out of the way things should start progressing pretty fast. I'll make a concept of a timeline, communities before I go into federation code which will be pretty hard i'm sure but there are plenty of examples on the internet now. The goal will be a super lightweight hackable community focused fediverse app written purely in rust. Javascript to be optional but will be used to make filling out forms quicker.

I don't want to use orm's on the rewrite
I've been playing with diesel 2.0 and it's just been a super big pain in the ass trying to get anything done. The documentation is horrid. I really like [ using direct sql statments](https://github.com/actix/examples/blob/master/databases/sqlite/src/db.rs) So i'm going to rewrite the login code I have in this. It's easier to unit test. And I can create multiple implementations one for sqlite and one for postgres. I think i'll start doing everything in sqlite for easy hackability and then work on a performance version with postgres if time allows.

So I have begun working on a wolfballs rewrite
It's slow going and will take a long time but I think it's needed. Lemmy is great general purpose software but I think I can do better for freedom fighters. I'm not going to fork it because I want to know the code from the ground up and I would rather not have to rip out everything I don't need just to add some stuff I do. In order for it to be successful it's going to need the following features, 1. More lightweight. Most instances are pretty small. This software was built with industry standards. nginx, postgres, react server rendered, middle teir written in rust. That is to much for most instances. It's way to bloated. Those things could help it scale into the hundreds of thousands by having clearly separated responsibilities but for smaller instances it's just bloat. The server rendered react layer is the dumbest imo. It's such a stupid fad of the industry these days. Lets create a spa, oh but those come with lots of problems so lets server render it. When you could have just server rendered in your main backend language to begin with. They could have used yew too if they HAD to go that route. I think we can do with sqlite instead of postgres, no nginx, no javascript front end. Javascript will be optional for the main UI and probably just used for form validation when enabled. sqlite should be fine for up to a couple thousand users if done right. Any more than that should just go to another instance. 2. person following. I want two views. Community view and timeline view. I want to make it a real social network alternative. But I want mastodon integration to be meaningful. Right now our post are funny to users who regularly browse the fediverse as a twitter view. I want wolfballs to be able to view mastodon post. 3. Good UI. If it's ugly no one will use it. Good use of CSS. I'm gonna go with Bulma I think because it doesn't require bootstrap and is pretty simple. I think it would make sense to create the social network with no federation first, proving the views work and look good and then start work on federating. If all goes well we can migrate all these accounts over to it or just run a second instance. I would also like to have crypto functionality built in. I want to be able to make crypt transactions in app so that all instances have a source of funding built into the application. That's my plan, i'm sticking to it.

Wolfballs One Year Anniversary
Should be about there or getting close, any idea how to celebrate? Thoughts on the site existing for a year? Where to go in future, how things have been?

Do Banwaves Happen On Reddit Anymore, Where Do They Go If So?
Seems like now banned communities just regroup under some other unbanned topic, have times changed? Because I remember we wanted to catch the fallout of some of these banwaves to grow the forum here

Communities: What New Ones Should We Make, Which Existing Ones Should We Check Out?
We're getting closer to a 1 year of Wolfballs being up I think too

Wolfballs Development

    Wolfballs Development

    Feature suggestions.

    Bug reports.

    Lemmy build guides.

    • 0 users online
    • 2 users / day
    • 1 user / week
    • 8 users / month
    • 19 users / 6 months
    • 43 subscribers
    • 81 Posts
    • Modlog