Code Monkey home page Code Monkey logo

lobsters's Introduction

Gambe.ro

gambe.ro is a community of italian programmers built using lobste.rs software.

This code is forked from journalduhacker.net (code available here). Journalduhacker, in turn, is a fork of lobste.rs (code available here).

License

Licensed under the AGPLv3 license. See LICENSE for the full license.

Contributing

Please see the CONTRIBUTING file.

Setup

  • Install Docker.

  • Clone the repository:

    $ git clone https://github.com/gambe-ro/lobsters.git
    $ cd lobsters
  • Define the following environment variables in the file .env:

    • RAILS_ENV: the environment in which Ruby on Rails will run. It must be one of the following: development, test, production.
    • SECRET_KEY_BASE: a secret string used to verify the validity of cookies.
    • MYSQL_USER: the MariaDB username (for the user that gambe.ro will use).
    • MYSQL_PASSWORD: the MariaDB password.
    • MYSQL_ROOT_PASSWORD: the root password for MariaDB (used only for table initialization).
    • MYSQL_DATABASE: the MariaDB database name.
    • SMTP_USERNAME: the username for the SMTP server (whose address is hardcoded in config/initializers/email.rb).
    • SMTP_PASSWORD: the password for the SMTP server.
  • Apply some manual security tweaks:

    • If you are deploying gambe.ro, edit your .bashrc (or the equivalent for your shell) and add the following:
    export DOCKER_CONTENT_TRUST=1

    then run the next steps in a new shell.

    • If you are developing gambe.ro, remove read_only: true from the app container in docker-compose.yml.
  • Run deployment/docker-run.sh:

    $ deployment/docker-run.sh

    This command will provision two containers: one for the Ruby on Rails server and one for the MariaDB database.

  • You should now be able to view the website at 172.20.0.2:8080 (you can change this address from the docker-compose.yml file). Moreover, you should be able to login with the test account (password is test).

When in production, don't forget to copy maintenance/ somewhere and make Nginx point to it (see nginx.conf).

Additional setup steps

  • Define your site's name and default domain, which are used in various places, in a config/initializers/production.rb or similar file:

    class << Rails.application
      def domain
        "example.com"
      end
    
      def name
        "Example News"
      end
    end
    
    Rails.application.routes.default_url_options[:host] = Rails.application.domain
  • Put your site's custom CSS in app/assets/stylesheets/local.

  • In production, set up crontab or another scheduler to run regular jobs:

    */20 * * * * cd /path/to/gambero && env RAILS_ENV=production bundle exec rake ts:index > /dev/null

Moderation

On-site tasks are carried out directly on the website. Console tasks are carried out through the Ruby on Rails console in production. To start the Rails console: rails c. To start the Rails console and rollback on exit: rails c --sandbox.

On-site tasks

Edit/Delete a story

By clicking the 'edit' button under the story title you can:

  • Delete the story
  • Edit the URL
  • Edit the title
  • Add or remove tags
  • Edit the body text
  • Merge the story into another

Delete a comment

Click the 'delete' button next to it.

Attach a moderation note to a user

Inside a user profile page, you can write moderation notes for that particular user. Only moderators can see them.

Disable invites for a user

Inside a user profile page, click the 'Disable Invites' button at the bottom. You will be able to re-enable invites by clicking on 'Enable Invites'.

Ban a user

Inside a user profile page, click the 'Ban' button at the bottom. You must provide a reason. You will be able to unban the user by clicking on 'Unban'.

Read the latest 10 moderation notes and moderations applied to a user

You can see them inside a user profile page. To see more than 10, you need to use the console.

Manage hats requests

Go to /hats/requests.

Console tasks

A typical command to add a resource is:

name_of_resource.create(attribute1: value1, attribute2: value2, ...)

To edit a resource first assign it to a variable, edit it and then save:

story = Story.find_by(short_id: story_short_id)
story.attribute = new_attribute_value
story.save()

To delete a resource (please see difference between delete and destroy):

story = Story.find_by(short_id: story_short_id)
story.delete() # or story.destroy()

Note: all resources can be added, edited and deleted through the console. However, it will be usually used in the following cases:

Add/Edit/Disable tag

Available attributes:

  • tag: name of the tag
  • description: description of the tag
  • privileged: if set to true, only moderators can post stories with this tag
  • is_media: (?)
  • inactive: if set to true, users cannot post stories with this tag anymore
  • hotness_mod: (?)

lobsters's People

Contributors

a-chernykh avatar abutler3 avatar akkartik avatar alanpca avatar amalrik avatar capacitorset avatar chobeat avatar derekprior avatar jcs avatar jdan avatar karjudev avatar kratacoa avatar mbologna avatar mxswd avatar nyanpasu avatar oa414 avatar padi avatar pizzo00 avatar prayagverma avatar pushcx avatar rhysforyou avatar riggraz avatar rjsamson avatar rvoicilas avatar samhasler avatar sidevesh avatar srgpqt avatar srobuttiteraki avatar walle avatar zubkonst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lobsters's Issues

Night mode reflow

I just found that there is a dark mode in gambe.ro 🎉

But, actually a very minor issue is an initial reflow of the page, causing a flash, from light to dark. You can reproduce it by setting the dark-mode and then click on the logo in the home page

cuoricini profusi

Riordinare i tag per utilizzo

In seguito alla discussione sui tag mi è venuto in mente che avendo una lista così lunga di tag potrebbe essere interessante riordinarli in base a quanto sono utilizzati.

Visto che tende a esserci una "long tail" di tag poco utilizzati, che risulterebbe scomodo avere ordinati per utilizzo, un'idea che proporrei è di ordinare per utilizzo solo il primo 20%, e il resto alfabeticamente. Per intenderci, con i tag attuali verrebbe fuori una lista del tipo:

  • politica
  • privacy
  • società
  • sicurezza
  • ...
  • accessibilità
  • AMA
  • android
  • api

Mi vengono in mente due possibili aspetti negativi. Il primo è che andrebbe implementato con del caching, in modo da non dover scorrere la lista di articoli ogni volta che un utente vuole mandare un post, e il secondo è che questa cosa potrebbe prediligere l'uso di tag più popolari ma più generici rispetto a tag più appropriati ma anche più rari (es. nella situazione attuale si tenderebbe a mettere un articolo sulle malattie collegate al lavoro in società, che è una delle prime scelte, anziché in salute).

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.