Compare commits

..

No commits in common. "97f74ce8318d30620c4707c43691f25dbd73a123" and "a7964cd74ce8fa3cb776c3af252bf456d04a1814" have entirely different histories.

11 changed files with 27 additions and 203 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
__pycache__

41
app.py
View File

@ -1,57 +1,25 @@
from flask import Flask, render_template, request from flask import Flask, render_template, request
from flask_assets import Bundle, Environment from flask_assets import Bundle, Environment
from todo import todos from todo import todos
from boards import board_list
from threads import threads_lists
from threads_with_posts import open_threads
import socket
app = Flask(__name__) app = Flask(__name__)
assets = Environment(app) assets = Environment(app)
css = Bundle("src/*.css", output="dist/main.css") #css = Bundle("src/main.css", output="dist/main.css")
# https://unpkg.com/htmx.org # https://unpkg.com/htmx.org
js = Bundle("src/*.js", output="dist/main.js") js = Bundle("src/*.js", output="dist/main.js")
assets.register("css", css) #assets.register("css", css)
assets.register("js", js) assets.register("js", js)
css.build() #css.build()
js.build() js.build()
@app.route('/liveness')
def healthx():
return "<h1><center>Liveness check completed</center><h1>"
@app.route('/readiness')
def healthz():
return "<h1><center>Readiness check completed</center><h1>"
@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)
### stolen
@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", board_id=board_id, boards=board_list, board_threads=b_threads)
### stolen
@app.route("/todo")
def page_todo():
return render_template("page1.html") return render_template("page1.html")
@ -68,7 +36,6 @@ def search_todo():
res_todos.append(todo) res_todos.append(todo)
return render_template("todo.html", todos=res_todos) return render_template("todo.html", todos=res_todos)
### /stolen

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

View File

View File

@ -4,18 +4,17 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css" integrity="sha384-X38yfunGUhNzHpBaEBsWLO+A0HDYOQi8ufWDkZ0k9e0eXz/tH3II7uKZ9msv++Ls" crossorigin="anonymous">
{% assets 'css' %} {% assets 'css' %}
<link rel="stylesheet" href="{{ ASSET_URL }}"> <link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %} {% endassets %} -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css" integrity="sha384-X38yfunGUhNzHpBaEBsWLO+A0HDYOQi8ufWDkZ0k9e0eXz/tH3II7uKZ9msv++Ls" crossorigin="anonymous">
{% assets 'js' %} {% assets 'js' %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script> <script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %} {% endassets %}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}"> <title>Flask + htmx</title>
<title>Board++</title>
</head> </head>
<body class="bg-blue-100"> <body class="bg-blue-100">
{% block content %} {% block content %}

View File

@ -1,50 +0,0 @@
{% 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>
<table class="pure-table-odd">
<thead>
<tr>
<th class="">номер треда</th>
<th class="">номер поста</th>
<th class="">автор(ка)</th>
<th class="">пикча эта ваша</th>
<th class="">текст</th>
</tr>
</thead>
<tbody id="thread-results">
{% for thread in board_threads %}
<tr class="">
<td class="">{{thread.thread_num}}</td>
<td class="">{{thread.post_num}}</td>
<td class="">{{thread.name}}</td>
<td class="">
<img src="https://static.vdk2ch.ru/thread-pics/{{thread.pic_link}}" alt="" width="200" height="200">
</td>
<td class="">{{thread.txt}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}

View File

@ -1,28 +0,0 @@
{% extends "base.html" %}
{% block content %}
<div class="host-id">Вас закинуло сюда: {{host_id}}</div>
<div class="content">
Dobro pozhalovat. AGAIN.
</div>
<nav>
<a routerLink = "/">Напоминание </a>
<br>
<a routerLink = "/about">О нас </a>
<br>
Доски:
<div class="boards">
<ul>
{% for board in boards %}
<li><a href="/boards/{{board}}">/{{board}}</a></li>
{% endfor %}
</ul>
</div>
</nav>
<img src="https://static.vdk2ch.ru/test-public/sin.jpg">
{% endblock content %}

View File

@ -1,10 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<div class="w-small w-2/3 mx-auto py-10 text-gray-600">
<div class="panel-block">
<div class="w-small w-2/3 mx-auto py-10 text-gray-600">
<input <input
type="text" type="text"
name="search" name="search"
@ -16,21 +13,20 @@
class="bg-white h-10 px-5 pr-10 rounded-full text-2xl focus:outline-none" class="bg-white h-10 px-5 pr-10 rounded-full text-2xl focus:outline-none"
> >
<span class="htmx-indicator">Searching...</span> <span class="htmx-indicator">Searching...</span>
</div>
+dev 2
<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> </div>
+7 asdf
<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>
{% endblock content %} {% endblock content %}

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_link>, <texto>, <name>}
open_threads = {
'123': {
'thread_num': '123',
'post_num': '9999',
'pic_link': '16216445863900.jpg',
'txt': 'фыва',
'name': 'anonius'
},
'124': {
'thread_num': '124',
'post_num': '456',
'pic_link': '16672846165910.png',
'txt': 'Test',
'name': 'anonius'
},
'1': {
'thread_num': '123',
'post_num': '1',
'pic_link': '16211265989190.jpg',
'txt': 'фыва',
'name': 'anonius'
},
'44': {
'thread_num': '44',
'post_num': '12',
'pic_link': '15937598937440.png',
'txt': 'I hate my brother-nation..',
'name': 'Владимир Владимирович'
},
'99': {
'thread_num': '99',
'post_num': '55',
'pic_link': 'Экран-смерти.jpg',
'txt': 'фыва',
'name': 'anonius'
},
'1230': {
'thread_num': '1230',
'post_num': '1234',
'pic_link': '15906018690140.png',
'txt': '33333!',
'name': 'SIRNA'
}
}