Ajout de quelques changements pour acces libre

This commit is contained in:
nono 2025-06-18 11:57:34 +02:00
parent 3dc6a41724
commit 2cc0b40b90
4 changed files with 9 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import os # For VARS from the shell.
# Variables
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
# Load the configuration file
try:
@ -44,13 +45,12 @@ try:
os.mkdir(UPLOAD_FOLDER)
app.logger.debug(f"Directory '{UPLOAD_FOLDER}' created successfully.")
except FileExistsError:
app.logger.error(f"Directory '{UPLOAD_FOLDER}' already exists.")
app.logger.debug(f"Directory '{UPLOAD_FOLDER}' already exists.")
except PermissionError:
app.logger.error(f"Permission denied: Unable to create '{UPLOAD_FOLDER}'.")
except Exception as e:
app.logger.error(f"An error occurred: {e}")
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
# Output the config file
if os.getenv('LIPY_DEBUG') == True:

View File

@ -125,6 +125,7 @@ class Printer(object):
try:
self.printer.open(self.usb_args);
self.printer.set(align='left', font='a', bold=False, underline=0, width=1, height=1, density=8, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False)
self.printer.textln("> Printed by LittlePrinter | https://n07070.xyz/articles/littleprynter")
self.printer.textln(clean_msg)
self.printer.set(align='left', font='b', bold=False, underline=1, width=1, height=1, density=9, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False)
self.printer.textln("> " + clean_signature + " @ " + strftime("%Y-%m-%d %H:%M:%S", gmtime()))
@ -161,6 +162,7 @@ class Printer(object):
try:
self.printer.open(self.usb_args)
self.printer.textln("> Printed by LittlePrinter | https://n07070.xyz/articles/littleprynter")
self.printer.textln("> " + clean_signature + " @ " + strftime("%Y-%m-%d %H:%M:%S", gmtime()))
self.printer.image(path)
self.printer.cut()

4
src/raspberry.py Normal file
View File

@ -0,0 +1,4 @@
from printer import Printer
class Raspberry(object):
pass

View File

@ -124,7 +124,7 @@ function print_picture(data){
let time = currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds();
formData.set("img", picture, "picture.png");
formData.set("signature", "Printed via the webcam @ " + time)
formData.set("signature", " Accès Libre ~ 1 An ~ Fête de la Musique Libre @ " + time)
fetch(url, {
method: 'POST', // or 'PUT'