1 Commits

Author SHA1 Message Date
nono
2cc0b40b90 Ajout de quelques changements pour acces libre 2025-06-18 11:57:34 +02:00
5 changed files with 10 additions and 10 deletions

View File

@@ -61,12 +61,6 @@ This command should start a web server with which you can test your configuratio
Voilà !
## Contributions
Your contributions are very much welcome ! You can either request an account on git.n07070.xyz, or send me a patch by email ( see git-send-mail.io ). Please [squash](https://www.geeksforgeeks.org/git/use-of-git-squash-commits/) yours commits into one commit, and add as much information in the commit's description. The more you add comments and descriptions, the better it is.
Please also say if you had a printer to test your code, and which printer you've been using.
## Screenshots
![](src/static/images/homepage.png)

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'