Skip to main content

packs all fridrich functions in one package

Project description

Fridrich

Fridrich is a project by 3 stupid guys who were bored, so they created a program on which they can vote who of them is the gayest. It mainly consists of three parts:

  • Fridrich Server
  • Fridrich Backend
  • Fridrich Dashboard


Fridrich Server

Installation

Step 1: Clone this repository

Clone this Repo to your target directory. ( how to clone a github repository )
Then head to your directory:

cd /your/directory/Fridrich/

Step 2: Install python 3.10 on your system

This step is going to be different for every OS. Here is an example for rasbian:
python3.10 installation for raspberry-pi

Step 3: Installing the python libraries (pip)

you can easily install the fridrich module and dependencies with pip:

pip install fridrich

if you install the package this way, you can delete the fridrich folder in your directory

Setp 3: Installing the python libraries (manual)

If you plan on using FridrichDiscordBot, edit requirements.txt and uncomment everything after # only for FridrichDiscordBot:

cryptography==3.3.2
numpy

# only for GayHistoryAnalyser
# matplotlib
# seaborn
# pandas

# only for FridrichDiscordBot
discord.py

The same thing applies for GayHistoryAnalyser.

In your Fridrich directory, run:

For Linux:

python3.10 -m pip install -r requirements.txt

For Windows:

pip3.10 -m pip install -r requirements.txt

Step 4: create the required files

Copy the data directory from this repository into your directory.

Step 5: Adjust settings.json

The file settings.json can be found under Fridrich/fridrich/server/ and contains all the settings for the server. In this file there are other settings as well, but the ones we need are those with filepaths in them.
Then for every directory replace /home/pi/Server/ with your directory.

Ex.:

"lastFile": "/home/pi/Server/data/yes.json"

to

"lastFile": "/your/server/directory/Fridrich/data/yes.json"

Step 6 (optional): Autostart

If you want your server to run every time on startup, you can put FridrichServer (and FridrichDiscordBot) into autostart. Again, this step is going to be different for every system, but here is an example for rasbian:

Open the file with nano:

sudo nano /etc/rc.local

Add the following line to the end of the file (before exit 0):

python3 /path/do/your/server/FridrichServer.py &

And optionally:

python3 /path/do/your/server/FridrichDiscordBot.py &

Description

The Server is run on a Raspberry-Pi model 3b+ connected to the local network. It saves all the data in files and accepts requests, handles events like the 0 o'clock vote and some other "cool" stuff.


The Calendar.json file saves the configurations of the calendar in a dict:

{'10.10.2005' : ['stuff happened', 'some other things happened as well'], '11.10.2005' : []}

dVotes.json stores all the data about how many double votes each user has left in this week:

{"User1": 1, "User2": 0}

The KeyFile.enc is the default key if the client hasn't yet authenticated or sends errors. It is encrypted with the cryption_tools.low class. logs/* are the files where all the voting results are stored (basically a log):

{
    "00.00.0000": "jesus",
    "30.05.2021": "John",
    "31.05.2021": "Will|John|Jack",
    "01.06.2021": "Jack"
}

The file now.json is used to save all current Votes (in case of a server restart/power off) and in newer versions generally used as the Votes Variable. It stores information like this:

{
    "GayKing":
    {
        "Will": "Trains",
        "John": "Will"
    },
    "BestBusDriver":
    {
        "Will": "Tobi",
        "Margaret": "Simon"
    }
}

In users.enc is a fridrich.cryption_tools.low encrypted dictionary with all users and passwords (low encryption because of speed)

The Version file stores information about the current version: Version:0.3.7,MaxLen:20 (Managed by the GUI developer). yes.json is basically the same file as now.json but from yesterday.

All the files in the fridrich folder are just modules for the Server to run.

FridrichDiscordBot

To run the discord bot you must replace the TOKEN with your discord bot's Token and the CHANNEL_ID with your discord servers channel id
How?
Follow the steps in this tutorial

Fridrich Backend

The Backend File is meant to be imported by another program (Fridrich Dashboard). It is generally used to communicate with the server, get information and send votes. The File Layout is straightforward:

|  
|---♦ data  
|   |---♦ KeyFile.enc
|  
|---♦ fridrich
|   |---♦ backend
|   |   |---♦ __init_.py
|   |   |---♦ debugging.py
|   |
|   |---♦ __init__.py
|   |---♦ classes.py
|   |---♦ errors.py
|   |---♦ cryption_tools.py
|  
|---♦ YourProgram.py  

Optionally there also is the file FridrichBackendOffline.py which is for testing if you can't connect to a Fridrich Server.

Fridrich Dashboard

As you may have noticed, this program is not actually included in this repository. The Programmer of it doesn't want his code to be open-source, so unfortunately you have to make your own program. As an example of how to use the fridrich module, you can use VersionChanger.py, AppStore.py and adminTool.py.

Installation with Docker

There are three docker-images available for Fridrich:

  • Server: nilusink/fridrich_server
  • BackendAccessPanel: nilusink/fridrich_backend_access

To run any of the above listed containers, you first need to install Docker for your system.

Then you need to pull the container you want to run.
Open a terminal and type:

docker pull |name of container|:|container version|

Instead of container version, you can also use latest to ensure you have the latest updates of the container.

example:

docker pull nilusink/fridrich_server:latest

To then run the container, type:

docker run --rm -it |name of container|:|container version|

For the server add

-p 12345:12345

Before the docker name (so you can access the port the server uses)
To look up the newest version for each container, follow this link and click on the desired repository.

example:

docker run --rm -it -p 12345:12345 nilusink/fridrich_server:latest

Attention!

This project uses Python-3.10 Syntax (Server and backend), so it won't run on anything else than Python-3.10 or Higher!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fridrich-1.0.1.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fridrich-1.0.1-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file fridrich-1.0.1.tar.gz.

File metadata

  • Download URL: fridrich-1.0.1.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for fridrich-1.0.1.tar.gz
Algorithm Hash digest
SHA256 76d623c0fed129589dbf213c5f0c4985dc7c1e180a516d7b453259046c75d533
MD5 ed100a55cc2b880f400429e624e64be9
BLAKE2b-256 2799e8bc2a75458717c03b23dbc630ee13aaa527fd573486ea09261034b47db3

See more details on using hashes here.

File details

Details for the file fridrich-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: fridrich-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for fridrich-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f17f222ede3ad8eba26c49e4252a31a2c73c9a1907823a5f37b1c6ac9d6aa1a9
MD5 4f0d5339a57245c54f7a26e6de1855ca
BLAKE2b-256 d97b2c0f04d61b0c78dff0f01796aff2be5bb7770bd5a3ec0c9fa674d9a2c9f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page