Compare commits
26 Commits
a7964cd74c
...
97f74ce831
Author | SHA1 | Date | |
---|---|---|---|
|
97f74ce831 | ||
|
d53dde8325 | ||
|
da998af863 | ||
|
e7a2a6cac3 | ||
|
ef4f71b317 | ||
|
fa0decbb9c | ||
|
0545ddf4d9 | ||
|
d7d5c620a1 | ||
|
3fc9deb5b9 | ||
|
caefb042cd | ||
|
5ca30b21ef | ||
|
b15191dfed | ||
|
a9cabbe7d8 | ||
|
78bfc22811 | ||
|
cb4f26bec7 | ||
|
294f96c86e | ||
|
589acaeab4 | ||
|
0c24f0064c | ||
|
1cc624c4c8 | ||
|
10ebc6d628 | ||
|
a7fa809ae4 | ||
|
bd9a18eec6 | ||
|
8d5cf827a0 | ||
|
d4be063d00 | ||
|
7a08de831a | ||
|
2a7fcaf579 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__
|
41
app.py
41
app.py
@ -1,25 +1,57 @@
|
||||
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
|
||||
|
||||
import socket
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
assets = Environment(app)
|
||||
#css = Bundle("src/main.css", output="dist/main.css")
|
||||
css = Bundle("src/*.css", output="dist/main.css")
|
||||
|
||||
# https://unpkg.com/htmx.org
|
||||
js = Bundle("src/*.js", output="dist/main.js")
|
||||
|
||||
#assets.register("css", css)
|
||||
assets.register("css", css)
|
||||
assets.register("js", js)
|
||||
#css.build()
|
||||
css.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("/")
|
||||
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")
|
||||
|
||||
|
||||
@ -36,6 +68,7 @@ def search_todo():
|
||||
res_todos.append(todo)
|
||||
|
||||
return render_template("todo.html", todos=res_todos)
|
||||
### /stolen
|
||||
|
||||
|
||||
|
||||
|
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
0
static/src/vdk2ch.css
Normal file
0
static/src/vdk2ch.css
Normal file
@ -4,17 +4,18 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<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' %}
|
||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||
{% 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">
|
||||
{% endassets %}
|
||||
|
||||
{% assets 'js' %}
|
||||
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
|
||||
{% endassets %}
|
||||
|
||||
<title>Flask + htmx</title>
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.png') }}">
|
||||
<title>Board++</title>
|
||||
</head>
|
||||
<body class="bg-blue-100">
|
||||
{% block content %}
|
||||
|
50
templates/board.html
Normal file
50
templates/board.html
Normal file
@ -0,0 +1,50 @@
|
||||
{% 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 %}
|
28
templates/main-page.html
Normal file
28
templates/main-page.html
Normal file
@ -0,0 +1,28 @@
|
||||
{% 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 %}
|
@ -1,7 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% 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
|
||||
type="text"
|
||||
name="search"
|
||||
@ -13,20 +16,21 @@
|
||||
class="bg-white h-10 px-5 pr-10 rounded-full text-2xl focus:outline-none"
|
||||
>
|
||||
<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>
|
||||
+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 %}
|
11
threads.py
Normal file
11
threads.py
Normal file
@ -0,0 +1,11 @@
|
||||
threads_lists = {
|
||||
'b': {
|
||||
'123','124'
|
||||
},
|
||||
'a': {
|
||||
'1'
|
||||
},
|
||||
'd': {
|
||||
'44','99','1230'
|
||||
}
|
||||
}
|
45
threads_with_posts.py
Normal file
45
threads_with_posts.py
Normal file
@ -0,0 +1,45 @@
|
||||
# <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'
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user