Code Monkey home page Code Monkey logo

site's Introduction

Python Discord: Site

Discord Lint & Test Coverage Status License

This is all of the code that is responsible for maintaining our website and all of its subdomains.

The website is built on Django and should be simple to set up and get started with. If you happen to run into issues with setup, please don't hesitate to open an issue!

If you're looking to contribute or play around with the code, take a look at the wiki. If you're looking for things to do, check out our issues.

site's People

Contributors

akarys42 avatar aramperes avatar bluenix2 avatar camcaswell avatar chrislovering avatar d0rs4n avatar delterr avatar dependabot[bot] avatar diabolical5777 avatar gdude2002 avatar hassanabouelela avatar hedyhli avatar inveracity avatar janine9vn avatar jb3 avatar jchristgit avatar kosayoda avatar ks129 avatar lemonsaurus avatar markkoz avatar mbaruh avatar minalike avatar rohanjnr avatar sco1 avatar scragly avatar sebastiaanz avatar shtlrs avatar swfarnsworth avatar wookie184 avatar xithrius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

site's Issues

Datadog Link is Exposed

I remember a while back I talked to @JoeBanks13 about exposing the DataDog link, and he said no, because of security or something along those lines. When I was looking at the code, I saw there was a file, directly exposing it, and anyone can see it. Here is a pull request that adds it

I know its a minor issue, but still wanted to bring it up, I think there is a way of making it only view able by members, but I dont use DataDog anymore.

UserView bug

Originally posted by Kingsley McDonald:

I've noticed a bug in site/pysite/views/api/bot/user.py which causes quite a few problems, such as broken role persistence.

class UserView(APIView, DBMixin):
    path = "/bot/users"
    name = "bot.users"
    ...
    @api_key
    @api_params(schema=GET_SCHEMA, validation_type=ValidationTypes.params)
    def get(self, data):
        ...
        data = [x["user_id"] for x in data]

The data variable at the end here would, in fact, be an HTTP parameter (like {"user_id": 69} for example). This raises a TypeError exception when the bot interacts with it with the following code in bot/cogs/events.py:

    async def get_user(self, user_id):
        response = await self.bot.http_session.get(
            url=URLs.site_user_api,
            params={"user_id": user_id},  # <-- oof
            headers={"X-API-Key": Keys.site_api}
        )

        resp = await response.json()
        return resp["data"]

I was thinking that the IDs should be sent as a JSON list instead.

Staff page for editing tags that the bot can post

Originally posted by Gareth Coles:

Originally submitted by gdude2002 to ClickUp and assigned to Aperture:

Ideally this should have a wysiwyg editor which translates into discord-compatible formatting before saving. accessible only to staff via staff.pythondiscord.com/tags


gdude2002 commented:

While a WYSIWYG editor is often nice to have, I do tend to prefer that you write the markdown yourself and have some kind of live preview.

Lemon commented:

yeah - I mean, I think write markdown and see preview is WYSIWYG enough.

Lemon commented:

(and that's probably what I would have done)

Code Jam Frontend/Backend

Originally posted by Gareth Coles:

This is a ticket to keep track of the remaining tasks for the code jam site implementation. Here's what's on our plate:

  • Backend
    • Retrieval of user avatars
  • Staff-side
    • Jammer profile listing [N/A, team profile listings seems like enough]
    • Per-jam response listing and approvals
    • Role assignment
    • Team listing and assignment - !6
    • Winner declaration - !14
  • User-side - !9
    • Participant and team listing
    • Team profiles
      • GitLab activity feed
  • Documentation
    • New Git basics tutorial
    • How to use GitLab
    • Code Jam FAQ
    • Rules on wiki
    • How judging works

It's quite a list. If I could get some help from you @ALL, I'd appreciate that. Documentation is going to be the longest part of this, so that would be one of the most useful ways you could contribute.

Wiki page for env vars

Originally posted by Gareth Coles:

Originally submitted by Automation to ClickUp and assigned to Lemon:

Make a wiki page that documents all the env vars in use on both site and bot.

Landing page view

Originally posted by Gareth Coles:

Originally submitted by gdude2002 to ClickUp and assigned to gdude2002:

Make a landing page view (home) where we'll add some text explaining who we are and push announcements from the #announcements channel. later we can set up automation for this by having the bot push all new announcements to rethinkdb and having the page display whatever is in that collection, but for now static content is fine. add a home item to the navbar with an appropriate icon.


gdude2002 commented:

Blocked by Announcements Cog (https://gitlab.com/discord-python/projects/bot/issues/4)

Django: Logging when running tests

Some tests emit logging output that messes up the test results and look out of place in general. For example:

Creating test database for alias 'default'...
System check identified no issues (0 silenced).
Bad Request: /bot/documentation-links
.Bad Request: /bot/documentation-links
..Not Found: /bot/documentation-links/whatever
.....Not Found: /bot/documentation-links/whatever
.Not Found: /bot/documentation-links/whatever
.Not Found: /bot/documentation-links/whatever
..Unauthorized: /bot/documentation-links
.Unauthorized: /bot/documentation-links/whatever
.Unauthorized: /bot/documentation-links/whatever
.Unauthorized: /bot/documentation-links
...Bad Request: /bot/members
.Bad Request: /bot/members
..Unauthorized: /bot/members
.Unauthorized: /bot/members/whatever
.Unauthorized: /bot/members/whatever
.Unauthorized: /bot/members
..Bad Request: /bot/off-topic-channel-names
Bad Request: /bot/off-topic-channel-names
Bad Request: /bot/off-topic-channel-names
.Bad Request: /bot/off-topic-channel-names
..Not Found: /bot/off-topic-channel-names/unknown-name
..Bad Request: /bot/off-topic-channel-names
.Bad Request: /bot/off-topic-channel-names
.....Unauthorized: /bot/off-topic-channel-names
.Unauthorized: /bot/off-topic-channel-names
.....Unauthorized: /bot/snake-names
.Unauthorized: /bot/snake-names
.............................
----------------------------------------------------------------------
Ran 73 tests in 0.347s

OK
Destroying test database for alias 'default'...

When we're running tests, we should ensure that output like this is not being logged.

Django - descriptive README

Originally posted by Johannes Christ:

Make the readme more descriptive. It should ideally link to the documentation directory and elaborate on what the project is built on.

Replace RMQ with Tasks

Originally posted by Leon Sandøy:

Instead of the RMQ system we're using today to communicate between the site and the bot, me and gdude would like to see a simplified system where the site generate Task objects and the bot polls an endpoint every 15 seconds.

Tasks should be generic, and should be stored in the database, and there should be a single endpoint that can be polled by the bot every 15 seconds to retrieve all Tasks. A Task should contain all the information the bot might need to perform said task. Tasks might be stuff like posting an announcement, granting a user a Jammer role, or even performing a moderator action.

Django: Model documentation

Originally posted by Johannes Christ:

Add model documentation that is displayed on the admin page and aids in working with our models.

  • Model help texts
  • __repr__s for models so they are more readable in the admin interface

Django - `.dockerapp` file for development setup

Originally posted by Johannes Christ:

The setup documentation of the Django branch currently mentions setup via docker-compose but we currently don't have any docker-compose.yml in order to set the site up locally. There is a pysite.dockerapp file in the docker/ subdirectory, but it's not really built around best practices.

Ideally, we'd add a script which basically does "migrate and boot" in the container in order to skip the questionable migration step. Some more setup instructions on this would also be great.

When we have the .dockerapp file, we can use it to render a docker-compose.yml that users can use for development setup.

Escaping a single backslash with a backslash in an inline codeblock renders both slashes

Originally posted by Mark:

This happens when editing the wiki. It only affects inline code blocks that have a single backslash; if there is any character following the backslash, no escape is needed and it appears just fine. Tried adding a space after the backslash, but the space ends up being part of the code block, which is undesirable.

This is what can reproduce the issue:

:code:`\\`

Afterwards, if you look at the saved page, you'll see both backslashes are in the code block.

Move wiki to GitHub Wikis

Originally posted by Leon Sandøy:

We're scrapping the wiki we wrote for our website 1.0 and moving the content to GitHub Wikis.

Our current wiki is built to work with UIKit, Flask, RethinkDB and RabbitMQ, but we're gonna get rid of all of those. After they're all gone, we might write a new wiki. By popular demand, that wiki must support markdown.

Create a system to handle applications on the site and post them to a Discord channel

Originally posted by Gareth Coles:

Originally submitted by Joseph to ClickUp:

We should have an application system on our website where users can log in and fill out forms to apply for the following:

  • Application to post a job advert into a new channel #jobs
  • Application to become a Helper (only available to non-Helpers)
  • Moderator applications (only available to Helpers)
  • Code Jam applications (only available at certain times)
    These would in turn be sent to a staff-only Discord channel called #applications via a simple webhook.

Staff would then discuss these, and then reject or accept them. Staff could apply a checkmark or X to mark the application as either rejected or approved.


Andrew S. commented:

Do you imagine these as separate pages for the four postings? Let me know - I could throw together a mockup

Lemon commented:

Probably as seperate pages, but only available after the user has logged in, and sensitive to context.

A new section should appear in the dropdown containing only the applicable applications.

  • Posting job adverts should always be there,
  • Helper applications should be there if you're not already a helper,
  • Moderator applications should only be there if you are a helper but not a moderator
  • Code Jam applications should only be available when a code jam is currently in the sign-up phase.

Lemon commented:

All of these applications should of course also be saved in our database, so that we may create website interfaces in the future for viewing them. It would be useful if staff could look at the code jam applicants on a staff page that automatically sorted them by age, skill and timezone, for example.

Django - Admin subdomain

Originally posted by Johannes Christ:

We want to serve the admin page of the website at admin.pythondiscord.com or admin.pythondiscord.local for local setups. The current setup doesn't quite work, because the admin namespace isn't registered properly.
The task would be making the admin page work on the subdomain.

Staff landing page

Originally posted by Gareth Coles:

Originally submitted by gdude2002 to ClickUp and assigned to gdude2002:

Maybe this can contain server stats and other data that's relevant for us.

Add Appeal Form to the Site

Originally posted by Daniel Brown:

As we all know, the Python Discord is growing at a steady rate. We have more and more people that we have to watch, and that means more and more punishments we regretfully have to hand out. We currently have no appeals system (other than messaging us directly via DM).

My proposition is this: I would like to see us have a form on the site where users would (after using OAuth to log into their Discord account) plead their case. It would direct the message to a log as well as to an Appeals channel on the server. This would at least give us a way to review, discuss, and possibly vote on the appeal.

Again, this is just a proposed idea, but I think it would at least help us deal with the increase of users.

Django - deployment documentation

Originally posted by Johannes Christ:

We will need some documentation detailing how to set up the webserver and database.

I have an Ansible role flying around which works for me, we should document the setup process in human language regardless, though.

Finding Stuff To Do page - Guide and Other

Originally posted by Daniel Brown:

Currently our "Finding Stuff To Do" page is empty. After spit balling a few ideas in the dev chat, the idea was raised of possibly having a widget that will show available issues on that page or on the sidebar, given the user has the proper permissions of course. Before that, possibly something as simple as a link to the page. Beyond that, not sure what else we could really do with the page.

Wiki

Originally posted by Gareth Coles:

Originally submitted by gdude2002 to ClickUp:

We've done a lot of research into this at this point, and it really seems like there are no wiki softwares out there that meet our needs. That means we need to write our own.

  • Unit testing

Django - prettier embed widget in the Admin

Originally posted by Johannes Christ:

The current way of editing tag embeds in the Django admin is very unwieldy. We should improve the overall editing experience by using a custom widget to do so.

Django: Announcements view

Originally posted by Leon Sandøy:

A view where staff can write announcements, view a preview, and then post it to multiple platforms, including the site itself, twitter and discord. This should either make use of Tasks, as described in https://gitlab.com/python-discord/projects/site/issues/45, or use webhooks in order to get the announcement posted on the server.

The view should also allow edits to the announcements, which should propagate through to both the site and discord (although not twitter and other uneditable platforms). The twitter view will probably have to be a link to the site and perhaps a short summary.

Add a Page for Our Linting Guidelines

Originally posted by Daniel Brown:

As it stands, we currently only have a mention regarding us using Flake8 in our Contributor agreement and maybe a couple mentions here and there, but nothing more specific than that. I think it would benefit those who are currently working on projects and those who become contributors in the future so that we're all on the same page.

If those of you who know exactly what our procedures tend to be can give me some guidance I can start to write up a guide for us.

Django - container healthchecks

Originally posted by Johannes Christ:

In case something breaks that's causing the server to become irresponsive, we likely won't notice because uWSGI will keep running.

However, we could use Docker healthchecks to issue requests to the server on various endpoints (e.g. regular HTML endpoints, endpoints interacting with the database and so forth). This should ideally be written in Python (since that comes preinstalled in the container) and be dependency-free, since it runs in the production container.

This is a good first issue - if you have any questions or want more information, don't be afraid to ask!

Gitlab Cog

Originally posted by Wim De Clercq:

None

Error page improvements

  • Close window by hitting "x"
  • Make error header darker
  • Link issue tracker instead of displaying link

Django - Better model validation

Originally posted by Johannes Christ:

We still have some places where adding more model validation may be a good idea, such as snake names not containing any numbers or documentation link packages being valid python names.

Make a view for challenges

Originally posted by Gareth Coles:

Originally submitted by gdude2002 to ClickUp:

Add it to the navbar with an appropriate fontawesome icon. Add some challenges from the #challenges channel for now, we will replace with the challenges webapp later.

Announcement management API

Originally posted by Gareth Coles:

Originally submitted by gdude2002 to ClickUp


gdude2002 commented:

Blocked by Middleware/Decorator for API key validation

gdude2002 commented:

This is no longer on hold.

Django - API: Infractions

Originally posted by Johannes Christ:

Add the infractions API. The current implementation along with routes can be found here.

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.