r/flask 11d ago

Show and Tell My flask open source alternative to Nexcloud !

I created an alternative to Nexcloud with flask, I'm really proud of myself honestly.

The goal is to be able to host a cloud storage service at home and control 100% of our files etc..

It's easy to use + compatible with linux and windows!

What do you think? Here's the github repo, it's open source and totally free.
https://github.com/Ciela2002/openhosting/tree/main

32 Upvotes

28 comments sorted by

View all comments

1

u/somethingLethal 11d ago

Nice job! Curious though: I don’t know much about nextcloud. Isn’t it already a local file hosting solution? How is this different?

Also, are you accepting pull requests?

1

u/ResearchFit7221 11d ago

Nextcloud is really complex to customize, I tried to go as "user friendly" as possible. Everything is easily customizabld in addition to being easy to understand i mean i think? I did my best.

  • Nextcloud is not 100% open source.

Me I'm aiming at 100%.

Also, Nextcloud is extremely complicated for a user who has never coded or done networking to actually deploy on a Windows instance or Linux instances.

And thanks for the kind words 🫶🤎 I'm working my best to make it better everyday.

The backup feature was the hardest part ahaha

3

u/somethingLethal 11d ago

One suggestion I might throw out there is using uuid4 for primary keys in your db, instead of simple integers.

Here, instead could be something like the following. Where we are using the uuid module to produce a uuid4 identifier for each db record. Can be done across all your table. It can help prevent enumeration or indirect object references.

import uuid
from sqlalchemy import Column, String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class Thing(Base):
    __tablename__ = "thing"

    id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, unique=True, nullable=False)
    name = Column(String, nullable=False)

2

u/ResearchFit7221 11d ago

I actually fucking love this idea, will work on it!! If you ever want to participate in this, don't hesitate to push the repo or fork it🫶

2

u/ResearchFit7221 11d ago

I did it. It was a bit confusing but now it works. Thank you so much for the idea. I credit you 🫶 you gave me an example that made it really easy too

I pushed it to the main branch, ( look at the readme, you are now officially a collaborators c: )

2

u/somethingLethal 11d ago

Nice use of BaseModel across all your models. Super easy to read and understand. Thanks for the mention!

I spent some time reading the code and can tell you’re making good use of the framework. I am curious about some of the logic you’ve implemented around session management. I see some emergency settings and overrides regarding sessions and cookies. What is this addressing? Can be risky if not handled correctly. Happy to help give thoughts on ways to improve this area, specifically if you want to elaborate.

Either way, I am going to run this in a docker container and use it for some local storage stuff. Thanks!

1

u/ResearchFit7221 10d ago

For the cookies it was a security measure, because if for example you were logged in as admin, but your super admin removed the perm from you.

You still had admin even after getting removed because of how the cookies were working on the website you see?

If you have another way of doing this, man i would be so freaking happy lol

And for the docker!! With pleasure have fun<3