Compare commits

5 Commits

Author SHA1 Message Date
root
6414aa4410 Merge branch 'master-of-slaves' of https://git.guaranteedstruggle.host/vdk2ch/flask-htmx-board1 into master-of-slaves
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-18 20:01:59 +10:00
Simple_Not
411a973102 remake many certs
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-17 13:00:37 +10:00
Simple_Not
ec8a36b7ed Merge branch 'dev' of https://git.vdk2ch.ru/vdk2ch/flask-htmx-board1 into master-of-slaves 2023-07-17 12:58:23 +10:00
Simple_Not
8b54e30493 remake many certs
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-17 12:58:15 +10:00
Simple_Not
353551b219 remake many certs
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-17 12:56:15 +10:00
16 changed files with 239 additions and 103 deletions

View File

@@ -15,93 +15,54 @@ steps:
- name: pull into the folduh - name: pull into the folduh
commands: commands:
- cd /usr/share/repos/$DRONE_REPO_NAME - cd /usr/share/repos/$DRONE_REPO_NAME
- git checkout $DRONE_COMMIT_BRANCH
- git pull origin $DRONE_COMMIT_BRANCH - git pull origin $DRONE_COMMIT_BRANCH
# - name: build - name: build
# environment: environment:
# DOCKER_TLS_VERIFY: 1 DOCKER_TLS_VERIFY: 1
# DOCKER_HOST: "tcp://192.168.49.2:2376" DOCKER_HOST: "tcp://192.168.49.2:2376"
# DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs" DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
# MINIKUBE_ACTIVE_DOCKERD: "minikube" MINIKUBE_ACTIVE_DOCKERD: "minikube"
# commands:
# - cd /usr/share/repos/$DRONE_REPO_NAME
# - git checkout $DRONE_COMMIT_BRANCH
# - docker build . -t ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)"
# - docker tag ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" ${DRONE_REPO_NAME}:latest
# - docker tag ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}
- name: build to harbor
commands: commands:
- cd /usr/share/repos/$DRONE_REPO_NAME - cd /usr/share/repos/$DRONE_REPO_NAME
- git checkout $DRONE_COMMIT_BRANCH - git checkout $DRONE_COMMIT_BRANCH
#- docker build . -t ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" - docker build . -t ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)"
#- docker tag ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" harbor.guaranteedstruggle.host/library/${DRONE_REPO_NAME}:latest - docker tag ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" ${DRONE_REPO_NAME}:latest
#- docker tag ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" harbor.guaranteedstruggle.host/library/${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH} - docker tag ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}-"$(git rev-parse --short HEAD)" ${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}
- docker build . -t harbor.guaranteedstruggle.host/library/${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}
- docker login harbor.guaranteedstruggle.host -u 'robot$drono' -p valgBwMgcB86azvmuezTOC3omjXZ1NZe
- docker push harbor.guaranteedstruggle.host/library/${DRONE_REPO_NAME}:${DRONE_COMMIT_BRANCH}
- name: restart deployment master - name: restart deployment master
environment: environment:
KUBECONFIG: /etc/kubernetes/admin.conf DOCKER_TLS_VERIFY: 1
DOCKER_HOST: "tcp://192.168.49.2:2376"
DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
MINIKUBE_ACTIVE_DOCKERD: "minikube"
commands: commands:
- kubectl rollout restart -n vdk2ch deployment flask-htmx-master - su - hogweed1 -c "minikube kubectl -- rollout restart -n vdk2ch deployment flask-htmx-master"
when: when:
branch: branch:
- master-of-slaves - master-of-slaves
- name: restart deployment dev - name: restart deployment dev
environment: environment:
KUBECONFIG: /etc/kubernetes/admin.conf DOCKER_TLS_VERIFY: 1
DOCKER_HOST: "tcp://192.168.49.2:2376"
DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
MINIKUBE_ACTIVE_DOCKERD: "minikube"
commands: commands:
- kubectl rollout restart -n vdk2ch deployment flask-htmx-dev - su - hogweed1 -c "minikube kubectl -- rollout restart -n vdk2ch deployment flask-htmx-dev"
when: when:
branch: branch:
- dev - dev
- name: restart deployment our-style - name: restart deployment our-style
environment: environment:
KUBECONFIG: /etc/kubernetes/admin.conf DOCKER_TLS_VERIFY: 1
DOCKER_HOST: "tcp://192.168.49.2:2376"
DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
MINIKUBE_ACTIVE_DOCKERD: "minikube"
commands: commands:
- kubectl rollout restart -n vdk2ch deployment flask-htmx-our-style - su - hogweed1 -c "minikube kubectl -- rollout restart -n vdk2ch deployment flask-htmx-our-style"
when: when:
branch: branch:
- our-style - our-style
# - name: restart deployment master
# environment:
# DOCKER_TLS_VERIFY: 1
# DOCKER_HOST: "tcp://192.168.49.2:2376"
# DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
# MINIKUBE_ACTIVE_DOCKERD: "minikube"
# commands:
# - su - hogweed1 -c "minikube kubectl -- rollout restart -n vdk2ch deployment flask-htmx-master"
# when:
# branch:
# - master-of-slaves
# - name: restart deployment dev
# environment:
# DOCKER_TLS_VERIFY: 1
# DOCKER_HOST: "tcp://192.168.49.2:2376"
# DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
# MINIKUBE_ACTIVE_DOCKERD: "minikube"
# commands:
# - su - hogweed1 -c "minikube kubectl -- rollout restart -n vdk2ch deployment flask-htmx-dev"
# when:
# branch:
# - dev
# - name: restart deployment our-style
# environment:
# DOCKER_TLS_VERIFY: 1
# DOCKER_HOST: "tcp://192.168.49.2:2376"
# DOCKER_CERT_PATH: "/home/hogweed1/.minikube/certs"
# MINIKUBE_ACTIVE_DOCKERD: "minikube"
# commands:
# - su - hogweed1 -c "minikube kubectl -- rollout restart -n vdk2ch deployment flask-htmx-our-style"
# when:
# branch:
# - our-style

3
.gitignore vendored
View File

@@ -1,2 +1 @@
__pycache__ __pycache__
static/.webassets_cache

View File

@@ -212,6 +212,4 @@ stateDiagram-v2
Grafana --> dash_join Grafana --> dash_join
dash_join --> User : дашборды dash_join --> User : дашборды
``` ```

31
app.py
View File

@@ -23,7 +23,6 @@ js.build()
docker_short_id = socket.gethostname() docker_short_id = socket.gethostname()
arango_client = ArangoClient(hosts='https://arango.guaranteedstruggle.host') arango_client = ArangoClient(hosts='https://arango.guaranteedstruggle.host')
@@ -48,7 +47,15 @@ def healthz():
@app.route("/") @app.route("/")
def homepage(): def homepage():
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)
@app.route("/boards/<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]]
return render_template("board.html", host_id=docker_short_id, board_id=board_id, boards=board_list, board_threads=b_threads)
@app.route("/db_posts") @app.route("/db_posts")
def page_posts_from_db(): def page_posts_from_db():
@@ -102,7 +109,29 @@ def post_a_post(post_key):
# def post_a_file(): # def post_a_file():
# pass # pass
### stolen
@app.route("/todo")
def page_todo():
return render_template("page1.html")
@app.route("/search", methods=["POST"])
def search_todo():
search_term = request.form.get("search")
if not len(search_term):
return render_template("todo.html", host_id=docker_short_id, todos=[])
res_todos = []
for todo in todos:
if search_term in todo["title"]:
res_todos.append(todo)
return render_template("todo.html", host_id=docker_short_id, todos=res_todos)
### /stolen
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0') app.run(debug=True, host='0.0.0.0')

View File

@@ -1,11 +1,11 @@
/* украдено здесь https://css-tricks.com/hexagons-and-beyond-flexible-responsive-grid-patterns-sans-media-queries/ */ /* украдено здесь https://css-tricks.com/hexagons-and-beyond-flexible-responsive-grid-patterns-sans-media-queries/ */
.hex-main { .hex-main {
display:flex; display:flex;
--s: 100px; /* size */ --s: 100px; /* size */
--m: 4px; /* margin */ --m: 4px; /* margin */
--f: calc(1.732 * var(--s) + 4 * var(--m) - 1px); --f: calc(1.732 * var(--s) + 4 * var(--m) - 1px);
max-width: 330px; max-width: 440px;
margin: 15px; margin: 15px;
} }

View File

@@ -16,7 +16,7 @@
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}"> <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">
<title>Board++</title> <title>Board++</title>
</head> </head>
<body class=" "> <body class="bg-blue-100">
<div id="multi-bg"> <div id="multi-bg">
{% block content %} {% block content %}

26
templates/board.html Normal file
View File

@@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block content %}
<div class="content">
<p>Вы тут: /{{board_id}}</p>
</div>
<nav>
<a href="/">glavnaya</a>
<br>
Доски:
<div class="boards">
<ul>
{% for board in boards %}
<li><a href="/boards/{{board}}">/{{board}}</a></li>
{% endfor %}
</ul>
</div>
</nav>
{% include 'posts.html' %}
{% endblock content %}

View File

@@ -1,39 +1,38 @@
{% if postos | length > 0 %} {% if postos | length > 0 %}
{% for posto in postos %} {% for posto in postos %}
<div class=" "> <div class="row">
{% if posto.root_post %} {% if posto.root_post %}
<div class=" "> <div class="card s4 deep-orange accent-4 darken-1">
{% else %} {% else %}
<div class=" "> <div class="card s4 blue-grey darken-1">
{% endif %} {% endif %}
<div class=" " id="post-{{ posto._key }}"> <div class="row" id="post-{{ posto._key }}">
<div class=" "> <div class="col s4">
<div class=""> <div class="card-image">
<div class="hex-main"> <div class="hex-main">
<div class="hex-container"> <div class="hex-container">
<a href="https://loremflickr.com/g/320/240/paris" target="_blank" "> <a href="https://loremflickr.com/g/320/240/paris" target="_blank" ">
<img src="https://loremflickr.com/g/320/240/paris"> <img src="https://loremflickr.com/g/320/240/paris">
</a> </a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class=" "> <div class="col s8">
<div class=" "> <div class="card-content white-text">
<span class=" e">#{{ posto._key }} <span class="card-title">#{{ posto._key }}
<span class=" " data-badge-caption="">Ответов: {{ posto.answers_num }}</span> <span class="new badge blue" data-badge-caption="">Ответов: {{ posto.answers_num }}</span>
<span class=" " data-badge-caption="">Длина треда: {{ posto.children_num }}</span> <span class="new badge red" data-badge-caption="">Длина треда: {{ posto.children_num }}</span>
</span> </span>
{% if posto.parent_post %} {% if posto.parent_post %}
<a class=" " href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a> <a class="card-action" href="#post-{{ posto.parent_post }}"> >>{{ posto.parent_post }} </a>
{% endif %} {% endif %}
<p>{{ posto.texto }}</p> <p>{{ posto.texto }}</p>
</div> </div>
</div> </div>
<div class=" "> <div class="col s12">
<div class=" "> <div class="card-action right">
<a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a> <a href="#" hx-post="/post_my_post/{{ posto._key }}" hx-target="#neu-posts" >Answer me!</a>
</div> </div>
</div> </div>

View File

@@ -6,8 +6,8 @@
{% include 'navbar.html' %} {% include 'navbar.html' %}
<div class=" " > <div class="row" >
<div class=" " id="neu-posts"> <div class="col s5" id="neu-posts">
{% include 'i-posts.html' %} {% include 'i-posts.html' %}
</div> </div>
</div> </div>

View File

@@ -3,17 +3,15 @@
{% block content %} {% block content %}
{% include 'navbar.html' %} {% include 'navbar.html' %}
<div class=" "> <div class="container">
<div class=" "> <div class="row">
<div class=" "> <div class="col s4 center">
<div class=" "> <div class="card">
<div class=" "> <div class="card-image">
<img class=" " src="https://static.guaranteedstruggle.host/test-public/sin.jpg" height="400px" width="320px"> <img class="img-responsive" src="https://static.guaranteedstruggle.host/test-public/sin.jpg" height="400px" width="320px">
</div> </div>
<div class=" "> <div class="card-content">
<p> <p> Dobro pozhalovat. AGAIN. </p>
Dobro pozhalovat. AGAIN.
</p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,11 +1,11 @@
<nav> <nav>
<div class=" "> <div class="nav-wrapper purple darken-3">
<ul id="nav-mobile" class="left "> <ul id="nav-mobile" class="left ">
<li> <a href="/">glavnaya</a> </li> <li> <a href="/">glavnaya</a> </li>
<li><a href="/db_posts"><span class=" " data-badge-caption="">here we go</span></a> </li> <li><a href="/db_posts"><span class="new badge red" data-badge-caption="">here we go</span></a> </li>
<li> <li>
<a href="#">Вас закинуло сюда: <span class=" " data-badge-caption="">{{host_id}}</span></a> <a href="#">Вас закинуло сюда: <span class="new badge blue" data-badge-caption="">{{host_id}}</span></a>
</li> </li>
</ul> </ul>
</div> </div>

36
templates/page1.html Normal file
View File

@@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block content %}
<div class="panel-block">
<div class="w-small w-2/3 mx-auto py-10 text-gray-600">
<input
type="text"
name="search"
hx-post="/search"
hx-trigger="keyup changed delay:250ms"
hx-indicator=".htmx-indicator"
hx-target="#todo-results"
placeholder="Search"
class="bg-white h-10 px-5 pr-10 rounded-full text-2xl focus:outline-none"
>
<span class="htmx-indicator">Searching...</span>
</div>
+dev 3
<table class="border-collapse w-small w-2/3 mx-auto">
<thead>
<tr>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">#</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">Title</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">Completed</th>
</tr>
</thead>
<tbody id="todo-results">
{% include 'todo.html' %}
</tbody>
</table>
</div>
{% endblock content %}

75
templates/posts.html Normal file
View File

@@ -0,0 +1,75 @@
{% if board_threads|length>0 %}
{% for thread in board_threads %}
<div class="post post_type_reply post_withimg" id="post-15135655" data-num="15135655">
<div class="post__details" id="post-details-15135655">
<input type="checkbox" name="delete" class="turnmeoff" value="15135655">
<span class="post__detailpart">
<span class="post__anon">{{thread.name}}</span>
</span>
<span class="post__detailpart">
<span class="post__time">05/07/23 Срд 14:53:58</span>
</span>
<span class="post__detailpart">
<a href="/news/res/15135633.html#15135655" id="15135655" class="post__reflink"></a>
<a href="/news/res/15135633.html#15135655" class="js-post-reply-btn post__reflink" data-num="15135655">{{thread.post_num}}</a>
<span class="post__number">2</span></span>
<span class="post__detailpart">
<svg xmlns="http://www.w3.org/2000/svg" class="post__btn post__btn_type_menu icon desktop" data-num="15135655"><use xlink:href="#icon__addmenu"></use></svg>
<span data-num="15135655" onclick="addAdminMenu(this); return false;" onmouseout="removeAdminMenu(event); return false;" style="display: flex;">
<svg xmlns="http://www.w3.org/2000/svg" class="post__btn post__btn_type_adm icon"><use xlink:href="#icon__report"></use></svg>
</span>
</span>
</div>
<div class="post__images post__images_type_multi">
<!-- <div class="post__images">
<svg class="post__file-preview " data-width="954" data-height="960" data-type="2" data-md5="15135655-d39bd5b1ed6c40e9a1d1eb2971a57584" data-title="image.png" viewBox="0 0 100 100" data-src="https://static.vdk2ch.ru/thread-pics/{{pic}}" width="168" height="170" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="img-{{thread.post_num}}" patternUnits="userSpaceOnUse" width="100" height="100">
<image xlink:href="https://static.vdk2ch.ru/thread-pics/{{pic}}" x="-25" width="150" height="100" />
</pattern>
</defs>
<use>
<polygon points="50 1 95 25 95 75 50 99 5 75 5 25" fill="url(#img-{{thread.post_num}})"/>
</use>
</svg>
</div> -->
<!-- <figure class="post__image">
<figcaption class="post__file-attr">
<a class="desktop" target="_blank" href="https://static.vdk2ch.ru/thread-pics/{{pic}}" title="image.png">{{pic}}</a>
</figcaption> -->
<!-- <svg visibility="visible" class="post__file-preview " data-width="954" data-height="960" data-type="2" data-md5="15135655-d39bd5b1ed6c40e9a1d1eb2971a57584" data-title="image.png" viewBox="0 0 100 100" data-src="https://static.vdk2ch.ru/thread-pics/{{pic}}" width="168" height="170" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="img-{{thread.post_num}}" patternUnits="userSpaceOnUse" width="100" height="100">
<image xlink:href="https://static.vdk2ch.ru/thread-pics/{{pic}}" x="-25" width="150" height="100" />
</pattern>
</defs>
<use>
<polygon points="50 1 95 25 95 75 50 99 5 75 5 25" fill="url(#img-{{thread.post_num}})"/>
</use>
</svg> -->
<!-- <img src="https://static.vdk2ch.ru/thread-pics/{{pic}}" alt="954x960" id="img-15135655-d39bd5b1ed6c40e9a1d1eb2971a57584" class="post__file-preview " data-type="2" data-title="image.png" data-width="954" data-height="960" data-md5="15135655-d39bd5b1ed6c40e9a1d1eb2971a57584" data-src="https://static.vdk2ch.ru/thread-pics/{{pic}}" width="168" height="170"> -->
<!-- </figure> -->
<div class="hex-main">
<div class="hex-container">
{% for pic in thread.pic_links %}
<a href="https://static.vdk2ch.ru/thread-pics/{{pic}}" target="_blank" ">
<img src="https://static.vdk2ch.ru/thread-pics/{{pic}}" >
</a>
{% endfor %}
</div>
</div>
</div>
<article id="m15135655" class="post__message ">
<a href="/news/res/15135633.html#15135633" class="post-reply-link" data-thread="15135633" data-num="15135633">&gt;&gt;15135633 (OP)</a><br>
{{thread.txt}}
</article>
<div id="refmap-15135655" class="post__refmap" style="display: none;"></div>
</div>
{% endfor %}
{% endif %}

15
templates/todo.html Normal file
View File

@@ -0,0 +1,15 @@
{% if todos|length>0 %}
{% for todo in todos %}
<tr class="bg-white lg:hover:bg-gray-100 flex lg:table-row flex-row lg:flex-row flex-wrap lg:flex-no-wrap mb-10 lg:mb-0">
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{todo.id}}</td>
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">{{todo.title}}</td>
<td class="w-full lg:w-auto p-3 text-gray-800 text-center border border-b block lg:table-cell relative lg:static">
{% if todo.completed %}
<span class="rounded bg-green-400 py-1 px-3 text-xs font-bold">Yes</span>
{% else %}
<span class="rounded bg-red-400 py-1 px-3 text-xs font-bold">No</span>
{% endif %}
</td>
</tr>
{% endfor %}
{% endif %}