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.2.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.2-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fridrich-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 16480b7616e75923c763a23739f6559a659c36a46f74c07736b35eea174bbd62
MD5 45b4633483db12e940173fc8e62b1e91
BLAKE2b-256 0995dd5306f473f43b7b41c821bf26576090aaa8ed202edf68fad8b675e4a1f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fridrich-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e83d0ef3a0542e6fff38a6abfef0e4fe53cab1d066e38e926d633216cd1c892
MD5 ba5daa94a77ac48ecc71948a941445b8
BLAKE2b-256 29b3b4e06836d9938f6458b03c4d6b7f92c2ecb938599136c78810d6aabef99d

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