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

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. KingLog.json is the file where all the GayKings are saved (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"
    }
}

tempData.json is used to transfer temperature data between the main program and the CPUHeatHandler:

{"temp": 29.0, "cptemp": 38.628, "hum": 39.0}

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
|   |---♦ server
|   |   |---♦__init_.py
|   |
|   |---♦ __init__.py
|   |---♦ app_store.py
|   |---♦ backend.py
|   |---♦ classes.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.0.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.0-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fridrich-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 4b386f75a17384904d116516f92ed9902b0b3a8119db81bd422a0f2cbc335f43
MD5 1220ea1e9d1d14ea1d9354763b9e3af7
BLAKE2b-256 e2a903362dc0feb9e1d35791cf79536c3d57655863ae514cace02a55e7ef8293

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fridrich-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b04e700c376ce84f2acc91d8a316a3a636af2f08941e36ba60703ba8f8478baa
MD5 1c5c83587a7526bbfc0ac7ff38e66b3f
BLAKE2b-256 bd5222d6f89864a80539bc084e8ec8571705733c09bbd612e829a47a9c9eb512

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