Compare commits

...

41 Commits

Author SHA1 Message Date
Simple_Not
315e6f8142 threads almost normal
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-02 18:59:34 +10:00
Simple_Not
17fc89ebbd threads gogogo
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-02 01:51:03 +10:00
Simple_Not
fbb586b56c threads rising
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-01 03:26:12 +10:00
Simple_Not
f9bbd5e6af pics tryout
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-31 23:58:05 +10:00
Simple_Not
412b26244a pics tryout
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-31 23:56:43 +10:00
Simple_Not
32f1d87831 pics tryout
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-31 23:53:00 +10:00
Simple_Not
216d60c84d ip-getter
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 13:51:23 +10:00
Simple_Not
ad6feb7afb ip-getter
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 13:50:38 +10:00
Simple_Not
a95d556e8c re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 01:54:07 +10:00
Simple_Not
956b59c2fa re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 01:52:45 +10:00
Simple_Not
a325ea91fe re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 01:51:31 +10:00
Simple_Not
a84da0a6f9 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 01:49:36 +10:00
Simple_Not
9838f7f024 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:35:54 +10:00
Simple_Not
d21e5e0bf6 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:33:14 +10:00
Simple_Not
38842ec947 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:27:50 +10:00
Simple_Not
5ad7f7514d re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:26:45 +10:00
Simple_Not
365c4909fe re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:25:24 +10:00
Simple_Not
71f72c66f3 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:24:54 +10:00
Simple_Not
d4e585fb13 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:22:50 +10:00
Simple_Not
92bb87c816 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:19:43 +10:00
Simple_Not
9e90bd2458 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:18:17 +10:00
Simple_Not
2b5fd02929 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:16:33 +10:00
Simple_Not
d4131c26c8 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:15:08 +10:00
Simple_Not
edd102e5e3 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:14:31 +10:00
Simple_Not
2a5a3fd8e4 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:13:23 +10:00
Simple_Not
a7e17694c2 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:11:23 +10:00
Simple_Not
d0163a8963 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:09:03 +10:00
Simple_Not
e83dfebee5 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:08:46 +10:00
Simple_Not
c8241f2613 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:04:10 +10:00
Simple_Not
25e5430b4c re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-30 00:02:38 +10:00
Simple_Not
e34be51a16 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 23:59:38 +10:00
Simple_Not
e30077bf4d re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 23:53:41 +10:00
Simple_Not
3320baf0f2 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 23:53:26 +10:00
Simple_Not
68e455fe7b re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 23:51:59 +10:00
Simple_Not
134297911b re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:49:42 +10:00
Simple_Not
d89ba3f582 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:47:56 +10:00
Simple_Not
14057ead4d re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:44:05 +10:00
Simple_Not
1b2bfb601b re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:34:24 +10:00
Simple_Not
b3d20faec3 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:31:01 +10:00
Simple_Not
2a68a6d8c2 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:30:50 +10:00
Simple_Not
c36968ec16 re ans-post
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-29 02:28:38 +10:00
8 changed files with 360 additions and 78 deletions

173
app.py
View File

@ -1,4 +1,5 @@
from flask import Flask, render_template, request
from flask import Flask, render_template, request, jsonify, make_response
from flask_assets import Bundle, Environment
from arango import ArangoClient
from minio import Minio
@ -30,9 +31,16 @@ db = arango_client.db('board1', username='root', password='stolendick527')
# предполагается что меняться список будет весьма редко, поэтому подхватываем при лишь при перезапуске
boards0 = db.collection('boards')
print(boards0)
board_list = [ k['_key'] for k in boards0]
# # boards0 = db.collection('boards')
# # print(boards0)
# # board_list = [ k['_key'] for k in boards0]
@app.route("/get_my_ip")
def get_my_ip():
return jsonify({'ip': request.remote_addr,
'real-ip': request.environ.get('HTTP_X_REAL_IP', request.remote_addr)}), 200
@app.route('/liveness')
@ -49,45 +57,133 @@ def healthz():
@app.route("/")
def homepage():
def homepage():
boards0 = db.collection('boards')
board_list = [ k['_key'] for k in boards0]
return render_template("main-page.html", host_id=docker_short_id, boards=board_list)
@app.route('/db_posts')
@app.route("/db_posts/<target_post_id>")
def page_posts_from_db(target_post_id=None):
#### TODO если борды нет, то возвращать 404 мемную
#### TODO если треда нет, то возвращать 404 мемную
#### DONE route :: /{board}/
@app.route('/<board>')
def board_posts(board=None):
postos = db.collection('posts')
postos = [ p for p in postos]
postos = [ p for p in postos if p.get('root_post') == True and p.get('board') == board ]
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
boards0 = db.collection('boards')
board_list = [ k['_key'] for k in boards0]
return render_template("board-posts.html", host_id=docker_short_id, postos=postos, board=board, target_post_id=None, boards=board_list)
#### TODO route :: /{board}/{thread}/
#### TODO убрать отсюда чужие рут-потсы
@app.route("/<board>/<int:target_post_id>")
def thread_posts(board=None, target_post_id=None):
## взять рут-пост
## взять всех его детей
# postos = db.collection('posts')
# postos = [ p for p in postos]
# postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
cursor = db.aql.execute(
f"""FOR ppp IN posts
FILTER ppp.root_post == True and ppp._key == "{target_post_id}"
FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v"""
)
postos = [ ]
while not cursor.empty(): # Pop until nothing is left on the cursor.
postos.append(cursor.pop())
cursor = db.aql.execute(
f'RETURN DOCUMENT("posts/{target_post_id}")'
)
while not cursor.empty(): # Pop until nothing is left on the cursor.
postos.append(cursor.pop())
postos = [ p for p in postos ]
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
if not target_post_id:
target_post_id = postos[0]['_key']
return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos, target_post_id=target_post_id)
boards0 = db.collection('boards')
board_list = [ k['_key'] for k in boards0]
return render_template("interactive-posts.html", board=board, host_id=docker_short_id, postos=postos, target_post_id=target_post_id, boards=board_list)
#### TODO route :: /{board}/create_thread/{target_post_id}
@app.route("/<board>/create-thread/<target_post_id>", methods=['POST'])
def create_thread(board=None, target_post_id=None):
postos = db.collection('posts')
data = request.form['send_this_text']
metadata = postos.insert({
'texto': data,
"root_post": True,
'board': board,
'images': [],
"children_num": 0,
"answers_num": 0,
"answers_list": [ [], [], [] ]
}, overwrite_mode='update')
response = make_response()
response.headers["HX-Redirect"] = f"/{board}/{metadata['_key']}"
response.status_code = 200
return response
#### TODO route :: /{board}/{thread}/answer_post/
#### TODO route :: /{board}/{thread}/post_to_another_post/
# @app.route('/db_posts')
# @app.route("/db_posts/<target_post_id>")
# def page_posts_from_db(target_post_id=None):
# postos = db.collection('posts')
# postos = [ p for p in postos]
# postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
# for p in postos:
# #if p['root_post']:
# print(p)
# if not target_post_id:
# target_post_id = postos[0]['_key']
# return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos, target_post_id=target_post_id)
@app.route("/answer_post/<target_post_id>", methods=['POST'])
def answer_post(target_post_id):
@app.route("/<board>/answer_post/<target_post_id>", methods=['POST'])
def answer_post(board, target_post_id):
postos = db.collection('posts')
postos = [ p for p in postos]
postos = [ p for p in postos ]
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
## ?? wut
if not target_post_id:
target_post_id = postos[0]['_key']
return render_template("answer-post.html", target_post_id=target_post_id)
return render_template("answer-post.html", board=board, target_post_id=target_post_id)
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'mp4', 'webm', 'webp'}
def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
@app.route('/post_to_another_post/<post_key>', methods=['POST'])
def post_to_post(post_key):
@app.route('/<board>/post_to_another_post/<post_key>', methods=['POST'])
def post_to_post(board, post_key):
#### TODO resize pics https://stackoverflow.com/questions/53337318/how-can-i-resize-image-with-pil-on-upload-and-serve-them-with-flask-cloudy
@ -110,13 +206,28 @@ def post_to_post(post_key):
print(f'somebody tried to put this inside minio: {file.filename} size: {size}')
postos = db.collection('posts')
postos = db.collection('posts')
data = request.form['send_this_text']
cursor = db.aql.execute(
f'RETURN DOCUMENT("posts/{post_key}")'
)
p = cursor.pop()
if p.get('root_post') == True:
thread = p.get('_key')
elif not p.get('root_post'):
thread = p.get('thread')
else:
thread = 'ERROR'
print(p)
metadata = postos.insert({
'texto': data,
'parent_post': f'{post_key}'
'texto': data,
'parent_post': f'{post_key}',
'images': [],
"thread": thread
}, overwrite_mode='update')
metadata = db.collection('post_parents').insert({
@ -125,6 +236,7 @@ def post_to_post(post_key):
}, overwrite_mode='update')
#### TODO оптимайз для только тредовых штук
cursor = db.aql.execute(
"""FOR ppp IN posts
LET children = (FOR v IN 1..9999 OUTBOUND ppp post_parents RETURN v)
@ -145,15 +257,22 @@ def post_to_post(post_key):
)
postos = db.collection('posts')
postos = [ p for p in postos if (not p.get('root_post')) and p.get('thread') == thread ]
cursor = db.aql.execute(
f'RETURN DOCUMENT("posts/{thread}")'
)
postos.append(cursor.pop())
postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False)
return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
return render_template("i-posts.html", board=board, host_id=docker_short_id, postos=postos)
#### TODO websockets
#### TODO sse
#### TODO kafka
#### TODO shards
#### TODO shards
#### TODO grpc

View File

@ -1,35 +1,54 @@
<div class="card">
<form
hx-encoding='multipart/form-data'
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
hx-on::after-request="this.reset()"
>
<div class="card-content">
<div class="row">
<span class="card-title">Ты отвечаешь: <a href="#post-{{ target_post_id }}">>>{{ target_post_id }}</a></span>
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>></i></a>
<form hx-encoding='multipart/form-data' _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
<div class="input-field col s6">
<input id="send_this_text" name="send_this_text" type="text" >
<label for="send_this_text">Печатать сюда</label>
</div>
<div class="input-field col s6">
<input id="file" name="file" type="file" multiple>
<label for="file">Upload</label>
<progress id='progress' value='0' max='100'></progress>
</div>
</form>
</div>
</div>
<div class="row">
<a class="btn-floating halfway-fab waves-effect waves-light red" href="#post-{{ target_post_id }}"><i class="material-icons">>>{{ target_post_id }}</i></a>
</div>
<div class="row">
<div class="input-field col s6">
<input id="send_this_text" name="send_this_text" type="text" >
<label for="send_this_text">Печатать сюда</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<div class="file-field input-field">
<div class="btn">
<span>File</span>
<input id="file" name="file" type="file" multiple>
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="Upload one or more files">
<progress id='progress' value='0' max='100'></progress>
</div>
<!-- <div class="file-progress">
</div> -->
</div>
</div>
</div>
</div>
<div class="card-action">
<a href="#answer-post">
<button class="btn waves-effect waves-light"
type="submit" name="action" hx-encoding='multipart/form-data'
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
hx-post="/post_to_another_post/{{ target_post_id }}"
hx-post="/{{board}}/post_to_another_post/{{ target_post_id }}"
hx-target="#neu-posts"
hx-include="[name='send_this_text'], [name='file']"
hx-include="[name='send_this_text'], [name='file']"
>
Отправить!!
<i class="material-icons right">send</i>
</button>
</a>
</div>
</form>
<!-- <div class="row">
<form hx-encoding='multipart/form-data' hx-post='/send_dudes'
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>

View File

@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block content %}
{% include 'navbar.html' %}
<div class="row" >
{% include 'create-thread.html' %}
</div>
<div class="row" >
<div class="col s6 m5" id="op-posts">
{% include 'op-posts.html' %}
</div>
<!-- <div class="col s6 m5" id="thread-viz">
<iframe src="https://thread-visualizah-dev.board.vdk2ch.ru/" scrolling="no" frameborder="0" style="position: relative; height: 600px; width: 100%; margin:10px;"></iframe>
</div> -->
</div>
{% endblock content %}

View File

@ -0,0 +1,48 @@
<div class="card">
<form
hx-encoding='multipart/form-data'
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
hx-on::after-request="this.reset()"
>
<div class="card-content">
<div class="row">
<span class="card-title">Создавай тред уже!</span>
</div>
<div class="row">
<div class="input-field col s6">
<input id="send_this_text" name="send_this_text" type="text" >
<label for="send_this_text">Печатать сюда</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<div class="file-field input-field">
<div class="btn">
<span>File</span>
<input id="file" name="file" type="file" multiple>
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="Upload one or more files">
<progress id='progress' value='0' max='100'></progress>
</div>
<!-- <div class="file-progress">
</div> -->
</div>
</div>
</div>
</div>
<div class="card-action">
<a href="/{{board}}/create-thread/{{ target_post_id }}">
<button class="btn waves-effect waves-light"
type="submit" name="action" hx-encoding='multipart/form-data'
_='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
hx-post="/{{board}}/create-thread/{{ target_post_id }}"
hx-include="[name='send_this_text'], [name='file']"
>
Отправить!!
<i class="material-icons right">send</i>
</button>
</a>
</div>
</form>
</div>

View File

@ -6,19 +6,45 @@
{% else %}
<div class="card s5 blue-grey darken-1">
{% endif %}
<div class="card-content white-text">
<span class="new badge yellow" data-badge-caption="">
<a class="purple-text" href="#post-{{ posto._key }}"> #{{ posto._key }} </a>
</span>
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
<span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
</div>
<div class="row" id="post-{{ posto._key }}">
<div class="col s4">
<div class="card-image">
<div class="hex-main">
{% if posto.images | length > 0 %}
<div class="col s12">
<!-- <div class="hex-main">
<div class="hex-container">
<a href="https://loremflickr.com/g/320/240/paris" target="_blank" ">
<img src="https://loremflickr.com/g/320/240/paris">
</a>
</div>
</div>
</div>
</div> -->
<div class="nav-wrapper">
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>
<a href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank" ">
<img src="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" width="300px">
</a>
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank"> photo_2023-05-16_00-49-34.jpg </a> </span>
</li>
<li>
<a href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank" ">
<img src="https://static.guaranteedstruggle.host/thread-pics/109.png" width="300px">
</a>
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank"> 109.png </a> </span>
</li>
</ul>
</div>
</div>
<div class="col s8">
{% endif %}
<!-- <div class="col s8">
<div class="card-content white-text">
<span class="card-title">#{{ posto._key }}
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
@ -26,50 +52,38 @@
</span>
{% if posto.parent_post %}
<a class="card-action" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
<a class="link orange-text purple" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
{% endif %}
<p>{{ posto.texto }}</p>
<!-- {% if posto.answers_list[0] | length > 0 %}
<br>
<p>Ответы:</p>
<div class="collection">
{% for ans in posto.answers_list[0] %}
{% if (posto.answers_list[1])[loop.index-1] > 0 %}
{% if (posto.answers_list[2])[loop.index-1] > 0 %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
{% endif %}
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
{% endif %}
{% endfor %}
</div>
{% endif %} -->
<p>{{ posto.texto }}</p>
</div>
</div> -->
<div class="col s12 card-content white-text">
{% if posto.parent_post %}
<a class="link orange-text purple" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
{% endif %}
<p>{{ posto.texto }}</p>
</div>
<div class="col s12">
<div class="card-action right">
<div class="col s12 card-action white-text">
<div class="right">
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
<a href="#answer-post" hx-post="/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
<a href="#answer-post" hx-post="/{{board}}/answer_post/{{ posto._key }}" hx-target="#answer-post" >Ответить этому.</a>
</div>
</div>
<div class="col s12">
<div class="col s12 card-content white-text">
<!-- TODO !подгрузка следующего поста в конец треда без перезагрузки всего треда! -->
<div class="card-action left">
<div class="left">
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
{% if posto.answers_list[0] | length > 0 %}
<p>Ответы:</p>
{% for ans in posto.answers_list[0] %}
{% if (posto.answers_list[1])[loop.index-1] > 0 %}
{% if (posto.answers_list[2])[loop.index-1] > 0 %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="lime-text red collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }}, длина {{ (posto.answers_list[2])[loop.index-1] }})</a>
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="lime-text red collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }} (ответов {{ (posto.answers_list[1])[loop.index-1] }})</a>
{% endif %}
{% else %}
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
<a href="#post-{{ (posto.answers_list[0])[loop.index-1] }}" class="lime-text red collection-item" style="padding: 2px 2px;">>>{{ (posto.answers_list[0])[loop.index-1] }}</a>
{% endif %}
{% endfor %}
{% endif %}

View File

@ -16,7 +16,8 @@
<div class="row">
<div class="col s7 m6" id="answer-post">
<div class="col s3 m3 " id="aa"></div>
<div class="col s7 m6 " id="answer-post">
{% include 'answer-post.html' %}
</div>
</div>

View File

@ -3,7 +3,12 @@
<div class="nav-wrapper purple darken-3">
<ul id="nav-mobile" class="left ">
<li> <a href="/">glavnaya</a> </li>
<li><a href="/db_posts"><span class="new badge red" data-badge-caption="">and here we go again..</span></a> </li>
{% if boards | length > 0 %}
{% for board in boards %}
<li><a href="/{{board}}"><span class="new badge red" data-badge-caption="">{{board}}</span></a> </li>
{% endfor %}
{% endif %}
<li>
<a href="#">Вас закинуло сюда: <span class="new badge blue" data-badge-caption="">{{host_id}}</span></a>
</li>

53
templates/op-posts.html Normal file
View File

@ -0,0 +1,53 @@
{% if postos | length > 0 %}
{% for posto in postos %}
<div class="row">
{% if posto.root_post %}
<div class="card s5 deep-orange accent-4 darken-1">
{% else %}
<div class="card s5 blue-grey darken-1">
{% endif %}
<div class="card-content white-text">
<span class="new badge yellow" data-badge-caption="">
<a class="purple-text" href="/{{board}}/{{ posto._key }}"> #{{ posto._key }} </a>
</span>
<span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
<span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
</div>
<div class="row" id="post-{{ posto._key }}">
{% if posto.images | length > 0 %}
<div class="col s12">
<!-- <div class="nav-wrapper">
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>
<a href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank" ">
<img src="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" width="300px">
</a>
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/photo_2023-05-16_00-49-34.jpg" target="_blank"> photo_2023-05-16_00-49-34.jpg </a> </span>
</li>
<li>
<a href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank" ">
<img src="https://static.guaranteedstruggle.host/thread-pics/109.png" width="300px">
</a>
<span class=" "><a class="" href="https://static.guaranteedstruggle.host/thread-pics/109.png" target="_blank"> 109.png </a> </span>
</li>
</ul>
</div> -->
</div>
{% endif %}
<div class="col s12 card-content white-text">
<p>{{ posto.texto }}</p>
</div>
<div class="col s12 card-action white-text">
<div class="right">
<!-- <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> -->
<a href="/{{board}}/{{ posto._key }}" >В тред!</a>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}