Решены конфликты при слиянии main
This commit is contained in:
commit
2c2e2a2f5b
7 changed files with 76 additions and 1 deletions
36
main.py
36
main.py
|
|
@ -5,7 +5,10 @@ import aiosqlite
|
|||
from quart import Quart, render_template, request, send_from_directory, Response
|
||||
from datetime import datetime
|
||||
from babel.dates import format_datetime
|
||||
<<<<<<< HEAD
|
||||
from urllib.parse import quote
|
||||
=======
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
|
||||
|
||||
|
||||
|
|
@ -49,10 +52,15 @@ async def get_maps(page=1, per_page=30):
|
|||
return maps
|
||||
|
||||
def get_image_path(filepath):
|
||||
<<<<<<< HEAD
|
||||
print(f"Получение пути изображения для файла: {filepath}")
|
||||
image_path = os.path.join(DATA, filepath)
|
||||
if not os.path.exists(image_path):
|
||||
print("Изображение не найдено, возвращаем дефолтное.")
|
||||
=======
|
||||
image_path = os.path.join(DATA, filepath)
|
||||
if not os.path.exists(image_path):
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
return "/images/image.jpg"
|
||||
return f"/images/{filepath.split('/')[0]}/{filepath.split('/')[1]}/{filepath.split('/')[1]}.jpg"
|
||||
|
||||
|
|
@ -64,26 +72,41 @@ def get_star_image(stars):
|
|||
|
||||
@app.route('/images/<path:filename>')
|
||||
async def serve_image(filename):
|
||||
<<<<<<< HEAD
|
||||
print(f"Запрос изображения с именем: {filename}")
|
||||
image_path = os.path.join(DATA, filename)
|
||||
if os.path.exists(image_path):
|
||||
print(f"Изображение {filename} найдено и отправляется.")
|
||||
=======
|
||||
image_path = os.path.join(DATA, filename)
|
||||
if os.path.exists(image_path):
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
return await send_from_directory(DATA, filename)
|
||||
else:
|
||||
default_image_path = os.path.join(DATA, 'image.jpg')
|
||||
if os.path.exists(default_image_path):
|
||||
<<<<<<< HEAD
|
||||
print("Изображение не найдено, отправляем дефолтное.")
|
||||
return await send_from_directory(DATA, 'image.jpg')
|
||||
print("Не найдено ни одного изображения.")
|
||||
=======
|
||||
return await send_from_directory(DATA, 'image.jpg')
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
return "Default image not found", 404
|
||||
|
||||
@app.route('/stars/<filename>')
|
||||
async def serve_star_image(filename):
|
||||
<<<<<<< HEAD
|
||||
print(f"Запрос изображения звезды: {filename}")
|
||||
stars = os.path.join(DATA, 'stars')
|
||||
star_path = os.path.join(stars, filename)
|
||||
if os.path.exists(star_path):
|
||||
print(f"Звезда {filename} найдена и отправляется.")
|
||||
=======
|
||||
stars = os.path.join(DATA, 'stars')
|
||||
star_path = os.path.join(stars, filename)
|
||||
if os.path.exists(star_path):
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
return await send_from_directory(stars, filename)
|
||||
else:
|
||||
print("Изображение звезды не найдено.")
|
||||
|
|
@ -123,7 +146,10 @@ async def download_bsp():
|
|||
return "No .bsp file found in the same directory", 404
|
||||
|
||||
file_path = os.path.join(DATA, image_folder, bsp_filename)
|
||||
<<<<<<< HEAD
|
||||
print(f"Найден файл для скачивания: {file_path}")
|
||||
=======
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
|
||||
SPEED_LIMIT = 60 * 1024 * 1024 // 8
|
||||
|
||||
|
|
@ -366,10 +392,18 @@ async def robots_txt():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
<<<<<<< HEAD
|
||||
print("Запуск приложения...")
|
||||
import hypercorn.asyncio
|
||||
from hypercorn.config import Config
|
||||
|
||||
config = Config()
|
||||
config.bind = ["0.0.0.0:5000"]
|
||||
hypercorn.asyncio.run(app, config)
|
||||
hypercorn.asyncio.run(app, config)
|
||||
=======
|
||||
import hypercorn.asyncio
|
||||
from hypercorn.config import Config
|
||||
config = Config()
|
||||
config.bind = ["0.0.0.0:5000"]
|
||||
hypercorn.asyncio.run(app, config)
|
||||
>>>>>>> 9cc0929a09596abeb93ee7f2711527fb5da25f7a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue