The beginning

Added the base structure and a minimal web frontend. Much work needed.
This commit is contained in:
Michael Rodin 2023-10-16 21:58:50 +02:00
parent 25b5af94fd
commit a2f9b4f978
9 changed files with 247 additions and 9 deletions

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
/**
!/Dockerfile
!/ER-rar-index.graphml
!/flask**
!/.gitignore
!/README.md
!/requirements.txt

13
Dockerfile Normal file
View file

@ -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/ .

View file

@ -35,10 +35,11 @@
<y:SharedData>
<yjs:SolidColorFill x:Key="1" color="#FFE8EEF7"/>
<yjs:SolidColorFill x:Key="2" color="#FFB7C9E3"/>
<yjs:SolidColorFill x:Key="3" color="#FF663800"/>
<yjs:Stroke x:Key="4" fill="{y:GraphMLReference 3}"/>
<yjs:Arrow x:Key="5" type="TRIANGLE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 3}" cropLength="1"/>
<yjs:PolylineEdgeStyle x:Key="6" stroke="{y:GraphMLReference 4}" targetArrow="{y:GraphMLReference 5}"/>
<y:FreeNodePortLocationModelParameter x:Key="3" Ratio="0.007575757575757569,0.5"/>
<yjs:SolidColorFill x:Key="4" color="#FF663800"/>
<yjs:Stroke x:Key="5" fill="{y:GraphMLReference 4}"/>
<yjs:Arrow x:Key="6" type="TRIANGLE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 4}" cropLength="1"/>
<yjs:PolylineEdgeStyle x:Key="7" stroke="{y:GraphMLReference 5}" targetArrow="{y:GraphMLReference 6}"/>
</y:SharedData>
</data>
<graph id="G" edgedefault="directed">
@ -101,6 +102,7 @@
<sys:String>ID</sys:String>
<sys:String>NAME</sys:String>
<sys:String>PARENT</sys:String>
<sys:String>DESC</sys:String>
</x:Array>
</x0:EntityRelationshipModel.attributes>
</x0:EntityRelationshipModel>
@ -140,6 +142,11 @@
<y:FreeNodePortLocationModelParameter Ratio="0.007575757575757569,0.5"/>
</data>
</port>
<port name="p1">
<data key="d16">
<y:FreeNodePortLocationModelParameter Ratio="0.5,0.007575757575757569"/>
</data>
</port>
</node>
<node id="n3">
<data key="d0">4</data>
@ -155,7 +162,7 @@
<x:Array Type="sys:Object">
<sys:String>ID</sys:String>
<sys:String>ARCH</sys:String>
<sys:String>CAT</sys:String>
<sys:String>LAB</sys:String>
</x:Array>
</x0:EntityRelationshipModel.attributes>
</x0:EntityRelationshipModel>
@ -197,25 +204,111 @@
<y:FreeNodePortLocationModelParameter Ratio="0.5,0.9924242424242424"/>
</data>
</port>
<port name="p1">
<data key="d16">
<y:FreeNodePortLocationModelParameter Ratio="0.9924242424242424,0.5"/>
</data>
</port>
</node>
<node id="n5">
<data key="d0">7</data>
<data key="d5">
<y:RectD X="-27.5" Y="-453" Width="130" Height="130"/>
</data>
<data key="d7">
<x0:EntityNodeStyle fill="{y:GraphMLReference 1}" insetFill="{y:GraphMLReference 2}" stroke="BLACK">
<x0:EntityNodeStyle.model>
<x0:EntityRelationshipModel>
<x0:EntityRelationshipModel.title>Sessions</x0:EntityRelationshipModel.title>
<x0:EntityRelationshipModel.attributes>
<x:Array Type="sys:Object">
<sys:String>ID</sys:String>
<sys:String>SESSKEY</sys:String>
<sys:String>CREATED</sys:String>
<sys:String>LIMIT</sys:String>
</x:Array>
</x0:EntityRelationshipModel.attributes>
</x0:EntityRelationshipModel>
</x0:EntityNodeStyle.model>
</x0:EntityNodeStyle>
</data>
<port name="p0">
<data key="d16">
<y:GraphMLReference ResourceKey="3"/>
</data>
</port>
</node>
<node id="n6">
<data key="d0">8</data>
<data key="d5">
<y:RectD X="210.5" Y="-453" Width="130" Height="130"/>
</data>
<data key="d7">
<x0:EntityNodeStyle fill="{y:GraphMLReference 1}" insetFill="{y:GraphMLReference 2}" stroke="BLACK">
<x0:EntityNodeStyle.model>
<x0:EntityRelationshipModel>
<x0:EntityRelationshipModel.title>LabType</x0:EntityRelationshipModel.title>
<x0:EntityRelationshipModel.attributes>
<x:Array Type="sys:Object">
<sys:String>ID</sys:String>
<sys:String>NAME</sys:String>
<sys:String>DESC</sys:String>
</x:Array>
</x0:EntityRelationshipModel.attributes>
</x0:EntityRelationshipModel>
</x0:EntityNodeStyle.model>
</x0:EntityNodeStyle>
</data>
<port name="p0">
<data key="d16">
<y:GraphMLReference ResourceKey="3"/>
</data>
</port>
<port name="p1">
<data key="d16">
<y:FreeNodePortLocationModelParameter Ratio="0.5,0.9924242424242424"/>
</data>
</port>
</node>
<edge id="e0" source="n0" target="n2" sourceport="p0" targetport="p0">
<data key="d10"><![CDATA[]]></data>
<data key="d13">
<yjs:PolylineEdgeStyle stroke="{y:GraphMLReference 4}" targetArrow="{y:GraphMLReference 5}">
<yjs:PolylineEdgeStyle stroke="{y:GraphMLReference 5}" targetArrow="{y:GraphMLReference 6}">
<yjs:PolylineEdgeStyle.sourceArrow>
<yjs:Arrow type="TRIANGLE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 3}" cropLength="1"/>
<yjs:Arrow type="TRIANGLE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 4}" cropLength="1"/>
</yjs:PolylineEdgeStyle.sourceArrow>
</yjs:PolylineEdgeStyle>
</data>
</edge>
<edge id="e1" source="n0" target="n1" sourceport="p1" targetport="p0">
<data key="d13">
<y:GraphMLReference ResourceKey="6"/>
<y:GraphMLReference ResourceKey="7"/>
</data>
</edge>
<edge id="e2" source="n0" target="n4" sourceport="p2" targetport="p0">
<data key="d13">
<y:GraphMLReference ResourceKey="6"/>
<y:GraphMLReference ResourceKey="7"/>
</data>
</edge>
<edge id="e3" source="n4" target="n5" sourceport="p1" targetport="p0">
<data key="d13">
<yjs:PolylineEdgeStyle stroke="{y:GraphMLReference 5}">
<yjs:PolylineEdgeStyle.targetArrow>
<yjs:Arrow type="NONE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 4}"/>
</yjs:PolylineEdgeStyle.targetArrow>
<yjs:PolylineEdgeStyle.sourceArrow>
<yjs:Arrow type="NONE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 4}"/>
</yjs:PolylineEdgeStyle.sourceArrow>
</yjs:PolylineEdgeStyle>
</data>
</edge>
<edge id="e4" source="n6" target="n2" sourceport="p1" targetport="p1">
<data key="d13">
<yjs:PolylineEdgeStyle stroke="{y:GraphMLReference 5}">
<yjs:PolylineEdgeStyle.targetArrow>
<yjs:Arrow type="NONE" scale="0.75" stroke="#FF663800" fill="{y:GraphMLReference 4}"/>
</yjs:PolylineEdgeStyle.targetArrow>
</yjs:PolylineEdgeStyle>
</data>
</edge>
</graph>

View file

@ -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.

21
flask/app.py Normal file
View file

@ -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()

50
flask/static/base.css Normal file
View file

@ -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;
}

21
flask/templates/base.html Normal file
View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/base.css" />
<title>RAR-Index {{title}}</title>
</head>
<body>
<header>
<span id="title">{{title}}</span>
<div id="container">
<button class="big-button">&#x1F50E;</div>
</div>
</header>
<div id="content">
{% block content %}
{% endblock %}
</div>
</body>
</html>

View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<p>Test</p>
{% endblock %}

1
requirements.txt Normal file
View file

@ -0,0 +1 @@
flask