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.1.3.tar.gz (33.3 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.1.3-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fridrich-1.1.3.tar.gz
  • Upload date:
  • Size: 33.3 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.1.3.tar.gz
Algorithm Hash digest
SHA256 bbbbad4dc0800317e8a1b31141488379350c5d5a35ed247f90aedaaa7d0257f0
MD5 2092d2de870166637bd48f72c56adf4e
BLAKE2b-256 8807b2743ab1db5a0cd8ffc78caee89edb2f752cbf03b386ef27babd3fb54ad2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fridrich-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 34.9 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.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dfa3d5c4bc57f264c4f5c03b12b96ef3882889862b000a8922067159d915e095
MD5 5a842cc5ac922715341f77d90a518263
BLAKE2b-256 e43c3ac814c8fc53ce6078bb7b267e12cb0e5bda188cf82ed178f104bca62716

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