check posts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simple_Not 2023-07-14 01:52:00 +10:00
parent bda72fc32d
commit 39aa0a9687
5 changed files with 22 additions and 23 deletions

12
app.py
View File

@ -23,6 +23,7 @@ js.build()
docker_short_id = socket.gethostname()
arango_client = ArangoClient(hosts='https://arango.vdk2ch.ru') arango_client = ArangoClient(hosts='https://arango.vdk2ch.ru')
db = arango_client.db('board1', username='root', password='stolendick527') db = arango_client.db('board1', username='root', password='stolendick527')
@ -45,7 +46,6 @@ def healthz():
@app.route("/") @app.route("/")
def homepage(): def homepage():
docker_short_id = socket.gethostname()
return render_template("main-page.html", host_id=docker_short_id, boards=board_list) return render_template("main-page.html", host_id=docker_short_id, boards=board_list)
@ -53,7 +53,7 @@ def homepage():
def page_board(board_id): def page_board(board_id):
b_threads = [ open_threads[thread_id] for thread_id in open_threads if thread_id in threads_lists[board_id]] b_threads = [ open_threads[thread_id] for thread_id in open_threads if thread_id in threads_lists[board_id]]
return render_template("board.html", board_id=board_id, boards=board_list, board_threads=b_threads) return render_template("board.html", host_id=docker_short_id, board_id=board_id, boards=board_list, board_threads=b_threads)
@ -64,7 +64,7 @@ def page_posts_from_db():
postos = [ p for p in postos] postos = [ p for p in postos]
postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False)
return render_template("interactive-posts.html", postos=postos) return render_template("interactive-posts.html", host_id=docker_short_id, postos=postos)
@app.route('/post_my_post/<post_key>', methods=['POST']) @app.route('/post_my_post/<post_key>', methods=['POST'])
@ -101,7 +101,7 @@ def post_a_post(post_key):
postos = db.collection('posts') postos = db.collection('posts')
postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False)
return render_template("i-posts.html", postos=postos) return render_template("i-posts.html", host_id=docker_short_id, postos=postos)
# @app.route('/post_my_file', method=['POST']) # @app.route('/post_my_file', method=['POST'])
@ -120,14 +120,14 @@ def search_todo():
search_term = request.form.get("search") search_term = request.form.get("search")
if not len(search_term): if not len(search_term):
return render_template("todo.html", todos=[]) return render_template("todo.html", host_id=docker_short_id, todos=[])
res_todos = [] res_todos = []
for todo in todos: for todo in todos:
if search_term in todo["title"]: if search_term in todo["title"]:
res_todos.append(todo) res_todos.append(todo)
return render_template("todo.html", todos=res_todos) return render_template("todo.html", host_id=docker_short_id, todos=res_todos)
### /stolen ### /stolen

View File

@ -19,8 +19,7 @@
</ul> </ul>
</div> </div>
</nav> </nav>
<li>
{% include 'posts.html' %} {% include 'posts.html' %}

View File

@ -3,10 +3,7 @@
{% block content %} {% block content %}
<nav> {% include 'navbar.html' %}
<a href="/">glavnaya</a>
<br>
</nav>
<div class="row" > <div class="row" >

View File

@ -2,17 +2,7 @@
{% block content %} {% block content %}
<nav> {% include 'navbar.html' %}
<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" data-badge-caption="">here we go</span></a> </li>
<li>
<a href="#">Вас закинуло сюда: {{host_id}}</a>
</li>
</ul>
</div>
</nav>
<div id="multi-bg"> <div id="multi-bg">

13
templates/navbar.html Normal file
View File

@ -0,0 +1,13 @@
<nav>
<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="">here we go</span></a> </li>
<li>
<a href="#">><span class="new badge blue" data-badge-caption="">Вас закинуло сюда: {{host_id}}</span></a>
</li>
</ul>
</div>
</nav>