добавлено много файлов, и отсутствие файлов
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-09-28 14:56:29 +10:00
parent 85dce5ce2e
commit d2907b9362
9 changed files with 59 additions and 602 deletions

98
app.py
View File

@ -1,15 +1,13 @@
from flask import Flask, render_template, request
from flask_assets import Bundle, Environment
from todo import todos
#from boards import board_list
from threads import threads_lists
from threads_with_posts import open_threads
from arango import ArangoClient
from minio import Minio
import socket, os
app = Flask(__name__)
assets = Environment(app)
@ -30,8 +28,10 @@ docker_short_id = socket.gethostname()
arango_client = ArangoClient(hosts='https://arango.guaranteedstruggle.host')
db = arango_client.db('board1', username='root', password='stolendick527')
# предполагается что меняться список будет весьма редко, поэтому подхватываем при лишь при перезапуске
boards0 = db.collection('boards')
print(boards0)
board_list = [ k['_key'] for k in boards0]
@ -41,6 +41,8 @@ def healthx():
@app.route('/readiness')
def healthz():
#### TODU return arango check
return "<h1><center>Readiness check completed</center><h1>"
@ -80,70 +82,23 @@ def answer_post(target_post_id):
@app.route('/post_my_post/<post_key>', methods=['POST'])
def post_a_post(post_key):
postos = db.collection('posts')
#### TODO проверить как-то по-умному что мы таки его добавили
metadata = postos.insert({
'texto': 'next post is this',
'parent_post': f'{post_key}'
}, overwrite_mode='update')
metadata = db.collection('post_parents').insert({
# '_key': post_key,
'_from': f'posts/{post_key}',
'_to': f'posts/{metadata["_key"]}'
}, overwrite_mode='update')
cursor = db.aql.execute(
"""FOR ppp IN posts
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
UPDATE ppp WITH { children_num : COUNT_DISTINCT( children[*]._key ) } IN posts"""
)
cursor = db.aql.execute(
"""FOR ppp IN posts
LET children = (FOR v IN 1 OUTBOUND ppp post_parents RETURN v)
UPDATE ppp WITH { answers_num : COUNT_DISTINCT( children[*]._key ) } IN posts"""
)
cursor = db.aql.execute(
"""FOR ppp IN posts
LET children0 = (FOR v IN 1 OUTBOUND ppp post_parents RETURN v)
LET children = (FOR c IN children0
SORT c._key DESC
RETURN c)
UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num, children[*].children_num ] } IN posts"""
)
postos = db.collection('posts')
postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False)
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
@app.route('/post_to_another_post/<post_key>', methods=['POST'])
def post_to_post(post_key):
uploaded_file = request.files["file"]
#### TODO allow only imgs, videos, and gifs
if 'file' in request.files:
if uploaded_file:
minioClient = Minio( "static.guaranteedstruggle.host" )
bucket_name = "thread-pics"
size = os.fstat(uploaded_file.fileno()).st_size
minioClient.put_object(
bucket_name, uploaded_file.filename, uploaded_file, size
)
files = request.files.getlist("file")
for file in files:
size = os.fstat(file.fileno()).st_size
minioClient.put_object(
bucket_name, file.filename, file, size
)
postos = db.collection('posts')
@ -186,29 +141,6 @@ def post_to_post(post_key):
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
# @app.route('/post_my_file', method=['POST'])
# def post_a_file():
# pass
@app.route("/send_dudes", methods=["POST"])
def upload_file():
#### TODO вынести в обычный метод отправки
if request.method == "POST":
uploaded_file = request.files["file"]
if uploaded_file:
minioClient = Minio( "static.guaranteedstruggle.host" )
bucket_name = "thread-pics"
size = os.fstat(uploaded_file.fileno()).st_size
minioClient.put_object(
bucket_name, uploaded_file.filename, uploaded_file, size
)
return "OK"
return " NE OK "

View File

@ -1,3 +0,0 @@
board_list = [
'b','a','d'
]

41
static/dist/main.css vendored Normal file
View File

@ -0,0 +1,41 @@
/* украдено здесь https://css-tricks.com/hexagons-and-beyond-flexible-responsive-grid-patterns-sans-media-queries/ */
.hex-main {
display:flex;
--s: 100px; /* size */
--m: 4px; /* margin */
--f: calc(1.732 * var(--s) + 4 * var(--m) - 1px);
max-width: 440px;
margin: 15px;
}
.hex-container {
font-size: 0; /*disable white space between inline block element */
}
.hex-container img {
width: var(--s);
margin: var(--m);
height: calc(var(--s)*1.1547);
display: inline-block;
font-size:initial;
clip-path: polygon(0% 25%, 0% 75%, 50% 100%, 100% 75%, 100% 25%, 50% 0%);
background: transparent;
margin-bottom: calc(var(--m) - var(--s)*0.2885);
}
.hex-container img:nth-child(odd) {
background: transparent;
}
.hex-container::before {
content: "";
width: calc(var(--s)/2 + var(--m));
float: left;
height: 120%;
shape-outside: repeating-linear-gradient(
#0000 0 calc(var(--f) - 3px),
#000 0 var(--f));
}

View File

@ -9,7 +9,7 @@
<label for="send_this_text">Печатать сюда</label>
</div>
<div class="input-field col s6">
<input id="file" name="file" type="file" >
<input id="file" name="file" type="file" multiple>
<label for="file">Upload</label>
<progress id='progress' value='0' max='100'></progress>
</div>

View File

@ -1,11 +0,0 @@
threads_lists = {
'b': {
'123','124'
},
'a': {
'1'
},
'd': {
'44','99','1230'
}
}

View File

@ -1,45 +0,0 @@
# <id>: {<post_num>, <pic_links>, <texto>, <name>}
open_threads = {
'123': {
'thread_num': '123',
'post_num': '9999',
'pic_links': ['16216445863900.jpg'],
'txt': 'фыва',
'name': 'anonius'
},
'124': {
'thread_num': '124',
'post_num': '456',
'pic_linkss': ['16672846165910.png'],
'txt': 'Test',
'name': 'anonius'
},
'1': {
'thread_num': '123',
'post_num': '1',
'pic_links': ['16211265989190.jpg'],
'txt': 'фыва',
'name': 'anonius'
},
'44': {
'thread_num': '44',
'post_num': '12',
'pic_links': ['15937598937440.png'],
'txt': 'I hate my brother-nation..',
'name': 'Владимир Владимирович'
},
'99': {
'thread_num': '99',
'post_num': '55',
'pic_links': ['Экран-смерти.jpg','Экран-смерти.jpg','Экран-смерти.jpg','Экран-смерти.jpg','15937598937440.png','Экран-смерти.jpg','Экран-смерти.jpg'],
'txt': 'фыва',
'name': 'anonius'
},
'1230': {
'thread_num': '1230',
'post_num': '1234',
'pic_links': ['15906018690140.png'],
'txt': '33333!',
'name': 'SIRNA'
}
}

457
todo.py
View File

@ -1,457 +0,0 @@
todos = [
{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": False},
{
"userId": 1,
"id": 2,
"title": "quis ut nam facilis et officia qui",
"completed": False,
},
{"userId": 1, "id": 3, "title": "fugiat veniam minus", "completed": False},
{"userId": 1, "id": 4, "title": "et porro tempora", "completed": True},
{
"userId": 1,
"id": 5,
"title": "laboriosam mollitia et enim quasi adipisci quia provident illum",
"completed": False,
},
{
"userId": 1,
"id": 6,
"title": "qui ullam ratione quibusdam voluptatem quia omnis",
"completed": False,
},
{
"userId": 1,
"id": 7,
"title": "illo expedita consequatur quia in",
"completed": False,
},
{"userId": 1, "id": 8, "title": "quo adipisci enim quam ut ab", "completed": True},
{"userId": 1, "id": 9, "title": "molestiae perspiciatis ipsa", "completed": False},
{
"userId": 1,
"id": 10,
"title": "illo est ratione doloremque quia maiores aut",
"completed": True,
},
{"userId": 1, "id": 11, "title": "vero rerum temporibus dolor", "completed": True},
{"userId": 1, "id": 12, "title": "ipsa repellendus fugit nisi", "completed": True},
{"userId": 1, "id": 13, "title": "et doloremque nulla", "completed": False},
{
"userId": 1,
"id": 14,
"title": "repellendus sunt dolores architecto voluptatum",
"completed": True,
},
{"userId": 1, "id": 15, "title": "ab voluptatum amet voluptas", "completed": True},
{
"userId": 1,
"id": 16,
"title": "accusamus eos facilis sint et aut voluptatem",
"completed": True,
},
{
"userId": 1,
"id": 17,
"title": "quo laboriosam deleniti aut qui",
"completed": True,
},
{
"userId": 1,
"id": 18,
"title": "dolorum est consequatur ea mollitia in culpa",
"completed": False,
},
{
"userId": 1,
"id": 19,
"title": "molestiae ipsa aut voluptatibus pariatur dolor nihil",
"completed": True,
},
{
"userId": 1,
"id": 20,
"title": "ullam nobis libero sapiente ad optio sint",
"completed": True,
},
{
"userId": 2,
"id": 21,
"title": "suscipit repellat esse quibusdam voluptatem incidunt",
"completed": False,
},
{
"userId": 2,
"id": 22,
"title": "distinctio vitae autem nihil ut molestias quo",
"completed": True,
},
{
"userId": 2,
"id": 23,
"title": "et itaque necessitatibus maxime molestiae qui quas velit",
"completed": False,
},
{
"userId": 2,
"id": 24,
"title": "adipisci non ad dicta qui amet quaerat doloribus ea",
"completed": False,
},
{
"userId": 2,
"id": 25,
"title": "voluptas quo tenetur perspiciatis explicabo natus",
"completed": True,
},
{"userId": 2, "id": 26, "title": "aliquam aut quasi", "completed": True},
{"userId": 2, "id": 27, "title": "veritatis pariatur delectus", "completed": True},
{
"userId": 2,
"id": 28,
"title": "nesciunt totam sit blanditiis sit",
"completed": False,
},
{"userId": 2, "id": 29, "title": "laborum aut in quam", "completed": False},
{
"userId": 2,
"id": 30,
"title": "nemo perspiciatis repellat ut dolor libero commodi blanditiis omnis",
"completed": True,
},
{
"userId": 2,
"id": 31,
"title": "repudiandae totam in est sint facere fuga",
"completed": False,
},
{
"userId": 2,
"id": 32,
"title": "earum doloribus ea doloremque quis",
"completed": False,
},
{"userId": 2, "id": 33, "title": "sint sit aut vero", "completed": False},
{
"userId": 2,
"id": 34,
"title": "porro aut necessitatibus eaque distinctio",
"completed": False,
},
{
"userId": 2,
"id": 35,
"title": "repellendus veritatis molestias dicta incidunt",
"completed": True,
},
{
"userId": 2,
"id": 36,
"title": "excepturi deleniti adipisci voluptatem et neque optio illum ad",
"completed": True,
},
{"userId": 2, "id": 37, "title": "sunt cum tempora", "completed": False},
{"userId": 2, "id": 38, "title": "totam quia non", "completed": False},
{
"userId": 2,
"id": 39,
"title": "doloremque quibusdam asperiores libero corrupti illum qui omnis",
"completed": False,
},
{"userId": 2, "id": 40, "title": "totam atque quo nesciunt", "completed": True},
{
"userId": 3,
"id": 41,
"title": "aliquid amet impedit consequatur aspernatur placeat eaque fugiat suscipit",
"completed": False,
},
{
"userId": 3,
"id": 42,
"title": "rerum perferendis error quia ut eveniet",
"completed": False,
},
{
"userId": 3,
"id": 43,
"title": "tempore ut sint quis recusandae",
"completed": True,
},
{
"userId": 3,
"id": 44,
"title": "cum debitis quis accusamus doloremque ipsa natus sapiente omnis",
"completed": True,
},
{
"userId": 3,
"id": 45,
"title": "velit soluta adipisci molestias reiciendis harum",
"completed": False,
},
{
"userId": 3,
"id": 46,
"title": "vel voluptatem repellat nihil placeat corporis",
"completed": False,
},
{
"userId": 3,
"id": 47,
"title": "nam qui rerum fugiat accusamus",
"completed": False,
},
{
"userId": 3,
"id": 48,
"title": "sit reprehenderit omnis quia",
"completed": False,
},
{
"userId": 3,
"id": 49,
"title": "ut necessitatibus aut maiores debitis officia blanditiis velit et",
"completed": False,
},
{
"userId": 3,
"id": 50,
"title": "cupiditate necessitatibus ullam aut quis dolor voluptate",
"completed": True,
},
{
"userId": 3,
"id": 51,
"title": "distinctio exercitationem ab doloribus",
"completed": False,
},
{
"userId": 3,
"id": 52,
"title": "nesciunt dolorum quis recusandae ad pariatur ratione",
"completed": False,
},
{
"userId": 3,
"id": 53,
"title": "qui labore est occaecati recusandae aliquid quam",
"completed": False,
},
{
"userId": 3,
"id": 54,
"title": "quis et est ut voluptate quam dolor",
"completed": True,
},
{
"userId": 3,
"id": 55,
"title": "voluptatum omnis minima qui occaecati provident nulla voluptatem ratione",
"completed": True,
},
{"userId": 3, "id": 56, "title": "deleniti ea temporibus enim", "completed": True},
{
"userId": 3,
"id": 57,
"title": "pariatur et magnam ea doloribus similique voluptatem rerum quia",
"completed": False,
},
{
"userId": 3,
"id": 58,
"title": "est dicta totam qui explicabo doloribus qui dignissimos",
"completed": False,
},
{
"userId": 3,
"id": 59,
"title": "perspiciatis velit id laborum placeat iusto et aliquam odio",
"completed": False,
},
{
"userId": 3,
"id": 60,
"title": "et sequi qui architecto ut adipisci",
"completed": True,
},
{"userId": 4, "id": 61, "title": "odit optio omnis qui sunt", "completed": True},
{
"userId": 4,
"id": 62,
"title": "et placeat et tempore aspernatur sint numquam",
"completed": False,
},
{
"userId": 4,
"id": 63,
"title": "doloremque aut dolores quidem fuga qui nulla",
"completed": True,
},
{
"userId": 4,
"id": 64,
"title": "voluptas consequatur qui ut quia magnam nemo esse",
"completed": False,
},
{
"userId": 4,
"id": 65,
"title": "fugiat pariatur ratione ut asperiores necessitatibus magni",
"completed": False,
},
{
"userId": 4,
"id": 66,
"title": "rerum eum molestias autem voluptatum sit optio",
"completed": False,
},
{
"userId": 4,
"id": 67,
"title": "quia voluptatibus voluptatem quos similique maiores repellat",
"completed": False,
},
{
"userId": 4,
"id": 68,
"title": "aut id perspiciatis voluptatem iusto",
"completed": False,
},
{
"userId": 4,
"id": 69,
"title": "doloribus sint dolorum ab adipisci itaque dignissimos aliquam suscipit",
"completed": False,
},
{
"userId": 4,
"id": 70,
"title": "ut sequi accusantium et mollitia delectus sunt",
"completed": False,
},
{"userId": 4, "id": 71, "title": "aut velit saepe ullam", "completed": False},
{
"userId": 4,
"id": 72,
"title": "praesentium facilis facere quis harum voluptatibus voluptatem eum",
"completed": False,
},
{
"userId": 4,
"id": 73,
"title": "sint amet quia totam corporis qui exercitationem commodi",
"completed": True,
},
{
"userId": 4,
"id": 74,
"title": "expedita tempore nobis eveniet laborum maiores",
"completed": False,
},
{
"userId": 4,
"id": 75,
"title": "occaecati adipisci est possimus totam",
"completed": False,
},
{"userId": 4, "id": 76, "title": "sequi dolorem sed", "completed": True},
{
"userId": 4,
"id": 77,
"title": "maiores aut nesciunt delectus exercitationem vel assumenda eligendi at",
"completed": False,
},
{
"userId": 4,
"id": 78,
"title": "reiciendis est magnam amet nemo iste recusandae impedit quaerat",
"completed": False,
},
{"userId": 4, "id": 79, "title": "eum ipsa maxime ut", "completed": True},
{
"userId": 4,
"id": 80,
"title": "tempore molestias dolores rerum sequi voluptates ipsum consequatur",
"completed": True,
},
{"userId": 5, "id": 81, "title": "suscipit qui totam", "completed": True},
{
"userId": 5,
"id": 82,
"title": "voluptates eum voluptas et dicta",
"completed": False,
},
{
"userId": 5,
"id": 83,
"title": "quidem at rerum quis ex aut sit quam",
"completed": True,
},
{"userId": 5, "id": 84, "title": "sunt veritatis ut voluptate", "completed": False},
{"userId": 5, "id": 85, "title": "et quia ad iste a", "completed": True},
{"userId": 5, "id": 86, "title": "incidunt ut saepe autem", "completed": True},
{
"userId": 5,
"id": 87,
"title": "laudantium quae eligendi consequatur quia et vero autem",
"completed": True,
},
{
"userId": 5,
"id": 88,
"title": "vitae aut excepturi laboriosam sint aliquam et et accusantium",
"completed": False,
},
{"userId": 5, "id": 89, "title": "sequi ut omnis et", "completed": True},
{
"userId": 5,
"id": 90,
"title": "molestiae nisi accusantium tenetur dolorem et",
"completed": True,
},
{
"userId": 5,
"id": 91,
"title": "nulla quis consequatur saepe qui id expedita",
"completed": True,
},
{"userId": 5, "id": 92, "title": "in omnis laboriosam", "completed": True},
{
"userId": 5,
"id": 93,
"title": "odio iure consequatur molestiae quibusdam necessitatibus quia sint",
"completed": True,
},
{"userId": 5, "id": 94, "title": "facilis modi saepe mollitia", "completed": False},
{
"userId": 5,
"id": 95,
"title": "vel nihil et molestiae iusto assumenda nemo quo ut",
"completed": True,
},
{
"userId": 5,
"id": 96,
"title": "nobis suscipit ducimus enim asperiores voluptas",
"completed": False,
},
{
"userId": 5,
"id": 97,
"title": "dolorum laboriosam eos qui iure aliquam",
"completed": False,
},
{
"userId": 5,
"id": 98,
"title": "debitis accusantium ut quo facilis nihil quis sapiente necessitatibus",
"completed": True,
},
{"userId": 5, "id": 99, "title": "neque voluptates ratione", "completed": False},
{
"userId": 5,
"id": 100,
"title": "excepturi a et neque qui expedita vel voluptate",
"completed": False,
},
]