Compare commits

...

12 Commits

8 changed files with 55 additions and 9 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ __pycache__/
config.py
*.pyc
.idea/
*.env

14
Dockerfile.dev Normal file
View File

@ -0,0 +1,14 @@
FROM alpine:3.8
ADD ["./requirements.txt", "/requirements.txt"]
RUN apk add --update --no-cache python3 postgresql-dev py3-psycopg2 && \
pip3 install -r /requirements.txt && \
rm /requirements.txt && \
adduser -D app
WORKDIR /app
CMD ["python3", "-u", "/app/main.py"]
EXPOSE 5000
USER app

View File

@ -1,3 +1,5 @@
# MOVED PERMANENTLY TO GITHUB
https://github.com/michigg/codimd_note_overview
# CodiMD note overview

View File

@ -1,16 +1,15 @@
version: "3"
networks:
db_net:
external: true
services:
codimd_note_overview:
build: .
build:
context: .
dockerfile: Dockerfile.dev
image: docker.wiai.de/fswiai/codimd_notes_overview:0.1
ports:
- 8080:5000
networks:
- db_net
env_file:
- /home/michigg/Nextcloud/Documents/OFU_Fachschaft/Server/hackmd_overview_addon/hackmd/docker.env
- ./docker.env
volumes:
- ./src:/app

7
docker_example.env Normal file
View File

@ -0,0 +1,7 @@
DB_HOST=<hostname>
POSTGRES_DB=<db name>
POSTGRES_USER=<user name>
POSTGRES_PASSWORD=<user password>
# Padlist
TESTING=<True|False>

View File

@ -0,0 +1,19 @@
import os
import psycopg2
DB_HOST = os.environ.get('DB_HOST')
DB_NAME = os.environ.get('POSTGRES_DB')
DB_USER = os.environ.get('POSTGRES_USER')
DB_PASSWORD = os.environ.get('POSTGRES_PASSWORD')
deletion_statement = 'DELETE FROM "Notes" WHERE "content" = \'\';'
try:
conn = psycopg2.connect(host=DB_HOST, database=DB_NAME, user=DB_USER, password=DB_PASSWORD)
cur = conn.cursor()
cur.execute(deletion_statement)
conn.commit()
cur.close()
conn.close()
except Exception as e:
print(e)

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -20,6 +20,10 @@
<a class="navbar-brand" href="#">
<h1>CodiMD notes</h1>
</a>
<div navbar-nav flex-row ml-md-auto d-none d-md-flex>
<a class="nav-item nav-link" href="https://git.wiai.de/mgoetz/codimd_note_overview" target="_blank">Fork me <img
src="{{ url_for('static', filename='images/gitea-192.png') }}" width="35px" heigt="35px"></a>
</div>
</nav>
<div class="container">
@ -41,7 +45,7 @@
<td scope="row"><a href="{{host}}/{{note['shortid']}}" target="_blank">{{note['shortid']}}</a></td>
<td>{{note['title']}}</td>
<td>{{note['alias']}}</td>
<td><span class="note-date">{% if note['lastchangeAt'] %}{{note['lastchangeAt'].strftime('%d.%m.%Y %H:%M')}}{% endif %}</span>
<td><span class="note-date">{% if note['lastchangeAt'] %}{{note['lastchangeAt'].strftime('%Y-%m-%d %H:%M')}}{% endif %}</span>
</td>
<td>{{note['permission']}}</td>
<td>{%if note['content']%}💬{%else%}❌{%endif%}</td>