Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created Site Admin page, looking for requests #156

Open
therealjr opened this issue Aug 21, 2020 · 12 comments
Open

Created Site Admin page, looking for requests #156

therealjr opened this issue Aug 21, 2020 · 12 comments

Comments

@therealjr
Copy link

therealjr commented Aug 21, 2020

As the title says I've written a site-wide administration page. Currently it allows you to make slips into admin/mod accounts, delete slips, create boards, and delete boards (which also deletes all of the threads/posts in the board). I plan to add a section to edit the themes of the website and possibly add in new ones. I want to also be able to edit things such as the FAQ from the admin panel. I guess what I need to know is how I could save the modified page. Lastly I was wondering how I might be able to add this to the toolbar at the top of the site when someone has logged into a slip.

Can anyone think of any other features that would be useful here?

How should I go about uploading this? The problem is that other parts of my copy of the software are also modified for my chans specific purpose and I don't want to upload the entire thing because it's outside of the scope of developing this software.

I plan on adding more features to the slip account for what I am doing with this software but for now I would like to focus on the mod/admin accounts.

@therealjr
Copy link
Author

therealjr commented Aug 21, 2020

Additionally I think there are some basic tweaks that need to be made to the software. Specifically regarding the mod slips. I think it would be best to have the option to restrict mod accounts to only be able to moderate particular boards, rather than be a site-wide moderator. Because in my experience having everyone that is a moderator act as a site-wide moderator is a bad practice. Also I have noticed wonky behavior in the software when you try to make an admin account into a moderator account at the same time. It appears as though it automatically nullifies the admin status of the account. I will double check my code to make sure this isn't an issue I have created though.

@therealjr
Copy link
Author

Other features I plan on implementing:

I think it would be a good idea to implement pages for each board (so adding a thread limit per page rather than just a thread limit per board) and then also implement infinite scrolling. Could anyone point me in the general direction to accomplish this?

Offset the image hosting to imgur. I think that this would be very helpful for people hosting the software on cheaper vps solutions because it would mean that storage space wouldn't be eaten up.

@therealjr
Copy link
Author

therealjr commented Aug 21, 2020

I think another good feature that I'm going to try to implement is what was mentioned here with regards to adding banners at the top of the page.

Another common feature is to allow each board's html to be customized (somewhat). I would appreciate it if someone could point me to the easiest path of accomplishing this. From what I can tell each board is rendered from a template. So perhaps a template header page that could be modified for each board is the easiest path.

@therealjr
Copy link
Author

Here is what the admin panel currently looks like

@DangerOnTheRanger
Copy link
Owner

For integrating the site administration stuff (thanks for writing all that, by the way!), I think the easiest way might be to just make a pull request if the admin code is mostly separate from the other additions/modifications you've made. If the integration is too tight, you could try pulling from the main Maniwani branch and re-adding your admin stuff from that point before making a pull request.

For the FAQ, I think it was probably a misstep of mine to hard-code the route into Flask in the first place, though at the very least it's a separate editable template now (templates/faq.html) - I think that ideally, a better system would be to allow site owners to create arbitrary HTML pages and then have them linked to in the site navbar, though that's extra work, obviously. But I think that that route is probably the best one going forward.

Getting more directly to what you want to do with the FAQ though, it's stored in the file I just mentioned; so if you write to that file, the FAQ page will get overwritten. It's a little more complicated with a containerized setup though, since that folder is not usually persisted (so you'll need a Docker volume or something else to keep it saved).

I think the idea of having more granularity with moderation is good. I've never heard of the bug you mentioned, but if you're able to replicate it, feel free to submit a separate bug report and I can take a look at it.

Paginating boards would be a two-part process; one, the API call to retrieve the list of threads in a board will need to be modified to support pagination; this maybe be a step in the right direction towards that end, at least on the database side. Now, for the UI side of things, this is a bit harder. I'm currently in the process of migrating the entire UI over to React, which when finished will make infinite scrolling a lot easier - it's a rather volatile branch at the moment, but you can check it out if you'd like, and I hope to merge it soon anyway. As a sidenote, I'd like for the UI side of pagination to gracefully degrade if Javascript is disabled - what this would look like specifically is something that I'm down to discuss further, if you'd like.

I think I recall you mentioning an imgur backend before, and I think that would be fine; all you really have to do to add a new file attachment storage backend to Maniwani is create a new subclass of model.media.StorageBase and then implement _write_attachment and _write_thumbnail, and then add a new config option to set your new storage backend as the active one. I'd like to point out that imgur isn't capable of storing arbitrary files, so that should be documented somewhere, both so site owners set proper MIME type filtering on their boards, and so that people don't try to disable SERVE_STATIC (imgur wouldn't be capable of hosting Maniwani's CSS/JS, so that option would have to stay enabled).

Board banners shouldn't be too difficult to implement. Each board just needs to have an extra column with either the link to some image to display as the banner, or (preferably, in my opinion) a bit of Markdown/HTML that's displayed at the top of every page.

@therealjr
Copy link
Author

Thanks for your reply. Today I'm going to try to implement banners on the boards, modify mod accounts for more granularity, and try to implement tripcodes. I think the image hosting could be a combination of the two solutions.

@therealjr
Copy link
Author

therealjr commented Aug 22, 2020

@DangerOnTheRanger Could you explain to me how to go about adding a banner saving mechanism to blueprints/boards.py? I checked model/Media.py for reference but it seems a bit too different in that it's using classes and inheriting an object. I feel like I might have to do something similar just to implement banner uploading so that the code works when someone runs it in containers.

Additionally I'm new to using git but don't you mean I should try to push? Could you create a separate branch for me to push to? That way you can look at the additions I'm making and can integrate the additions yourself. It's not really that tightly integrated.

@DangerOnTheRanger
Copy link
Owner

I think first place to add banners would be model/Board.py, as a new column in the model. Next, make sure that new column gets rendered (either as raw HTML, or preferably to me, as rendered Markdown) inside blueprints/boards.py. To get banners to work inside containers, just make sure the banners themselves are stored in a directory that's usually mounted - deploy-configs, for instance.

For git: I think the simplest approach might be to fork the Maniwani repository, add your changes there in a new branch (you have full reign over any fork you make), then push to your fork. Github should then give you an option to create a pull request that I can then take a look at/comment on before merging your changes.

@therealjr
Copy link
Author

therealjr commented Aug 22, 2020

So what you're describing would be ideal for a single banner on a board. However what I'm trying to do is rotate banners on a board. Would it be best to introduce a group table which another table called, say "banner", would then point to? I think that way we can cleanly associate multiple banners with a single board while trying to stay consistent with your design.

Fork created btw. So you can now go through and look at the modifications. I went ahead and started fresh minus a small modification to the board table and a couple of files which reference reddit.

@DangerOnTheRanger
Copy link
Owner

Yeah, I think the solution that you describe would work very well. Just make sure that older databases are migrated correctly (should be taken care of automatically by Flask-SQLAlchemy and Flask-Migrate), and you're good to go.

Try to see if you can make a pull request, since that makes a couple steps easier; Github will automatically diff and display which files are different, and there's a hook to make sure that the fork still builds correctly, for instance. There should be a button on the main repository page (https://github.com/DangerOnTheRanger/maniwani/) to make a new one, but if not, you can go to the pull request tab and make a new one there.

@therealjr
Copy link
Author

Hey can you let me know when you're on IRC? I have a problem slightly outside of the scope of the project I need to resolve before I can continue with the banner implementation.

@DangerOnTheRanger
Copy link
Owner

Sure, I'll probably be on in a few hours and I can take a look at whatever you're having trouble with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants