From a2f9b4f978c1b8a6dd870b545430f624462fbeb2 Mon Sep 17 00:00:00 2001 From: Michael Rodin Date: Mon, 16 Oct 2023 21:58:50 +0200 Subject: [PATCH] The beginning Added the base structure and a minimal web frontend. Much work needed. --- .gitignore | 8 +++ Dockerfile | 13 +++++ ER-rar-index.graphml | 111 ++++++++++++++++++++++++++++++++++---- README.md | 26 +++++++++ flask/app.py | 21 ++++++++ flask/static/base.css | 50 +++++++++++++++++ flask/templates/base.html | 21 ++++++++ flask/templates/home.html | 5 ++ requirements.txt | 1 + 9 files changed, 247 insertions(+), 9 deletions(-) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 flask/app.py create mode 100644 flask/static/base.css create mode 100644 flask/templates/base.html create mode 100644 flask/templates/home.html create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6f3a60 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/** + +!/Dockerfile +!/ER-rar-index.graphml +!/flask** +!/.gitignore +!/README.md +!/requirements.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e2c5992 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +#Download Python from DockerHub and use it +FROM python:3.11.3 + +#Set the working directory in the Docker container +WORKDIR /app + +#Copy the dependencies file to the working directory +COPY ./requirements.txt . + +#Install the dependencies +RUN pip install -r requirements.txt + +COPY ./flask/ . \ No newline at end of file diff --git a/ER-rar-index.graphml b/ER-rar-index.graphml index 4c709f3..ba15361 100644 --- a/ER-rar-index.graphml +++ b/ER-rar-index.graphml @@ -35,10 +35,11 @@ - - - - + + + + + @@ -101,6 +102,7 @@ ID NAME PARENT + DESC @@ -140,6 +142,11 @@ + + + + + 4 @@ -155,7 +162,7 @@ ID ARCH - CAT + LAB @@ -197,25 +204,111 @@ + + + + + + + + 7 + + + + + + + + Sessions + + + ID + SESSKEY + CREATED + LIMIT + + + + + + + + + + + + + + 8 + + + + + + + + LabType + + + ID + NAME + DESC + + + + + + + + + + + + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index e69de29..5203310 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,26 @@ +# RAR-Index +It's some project for my school which is supposed to index _rar_-archives and make them searchable over a very ugly web frontend. + +## Downloading +```bash +git clone https://git.marcelsite.com/marcel/rar-index +cd rar-index +``` + +## Usage +### Baremetal +Install the dependencies: +```bash +pip install -r requirements.txt +``` +Start the server: +```bash +cd flask +python app.py +``` + +### Docker +TBA + +## Contributing +I don't recommend wasting your time on this project. It is only created to get a (hopefully) good grade in school. \ No newline at end of file diff --git a/flask/app.py b/flask/app.py new file mode 100644 index 0000000..8b89898 --- /dev/null +++ b/flask/app.py @@ -0,0 +1,21 @@ + +# Importing flask module in the project is mandatory +# An object of Flask class is our WSGI application. +from flask import Flask,redirect,url_for,request,render_template + +# Flask constructor takes the name of +# current module (__name__) as argument. +app = Flask(__name__) + + +## WEB FRONTEND +@app.route('/') +def homepage(): + return render_template("home.html", title="Homepage") + +## API CALLS + +# main driver function +if __name__ == '__main__': + # run app if executed directly + app.run() \ No newline at end of file diff --git a/flask/static/base.css b/flask/static/base.css new file mode 100644 index 0000000..cce6ae8 --- /dev/null +++ b/flask/static/base.css @@ -0,0 +1,50 @@ +body { + background: teal; +} + +header { + background: lightskyblue; + border-radius: 0.5em; + border: greenyellow dotted 0.2em; + box-sizing: border-box; + position: relative; + top: 0; + margin: 0; + padding: 0.1em; + width: 100%; + display: flex; +} + +header > div#container { + flex-grow: 1; + display: flex; + align-items: center; + justify-content: end; +} + +.big-button { + width: 2em; + height: 2em; + margin: auto 0.1em; + border: none; + background: linear-gradient(135deg, white, yellow); +} + +.big-button:hover { + background: linear-gradient(135deg, yellow, orange); +} + +span#title { + display: inline-block; + font-size: 2em; + font-weight: 600; +} + +div#content { + margin: 2em 1em; + padding: 0.5em; + background: white; + height: 100%; + border-radius: 1em; + border: dimgrey 0.2em solid; +} \ No newline at end of file diff --git a/flask/templates/base.html b/flask/templates/base.html new file mode 100644 index 0000000..d479676 --- /dev/null +++ b/flask/templates/base.html @@ -0,0 +1,21 @@ + + + + + RAR-Index – {{title}} + + + +
+ {{title}} +
+
+ +
+
+ {% block content %} + {% endblock %} +
+ + + \ No newline at end of file diff --git a/flask/templates/home.html b/flask/templates/home.html new file mode 100644 index 0000000..f683c4d --- /dev/null +++ b/flask/templates/home.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block content %} +

Test

+{% endblock %} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8ab6294 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask \ No newline at end of file