1 Commits

Author SHA1 Message Date
n07070
0601fe8190 Add information on contributions 2026-01-04 12:07:10 +01:00
5 changed files with 10 additions and 10 deletions

View File

@@ -57,10 +57,16 @@ $ export FLASK_APP=src/main.py
$ flask run
```
This command should start a web server with which you can test your configuration. If you plan on exposing your printer to the Internet, and give it an IP / URL, _please, please, please_, don't run it this way. Look at Flask's documentation and read about running a production server. It's a little more work, but it will prevent your computer/server being hacked in too easily.
This command should start a web server with which you can test your configuration. If you plan on exposing your printer to the Internet, and give it an IP / URL, _please, please, please_, don't run it this way. Look at Flask's documentation and read about running a production server. It's a little more work, but it will prevent your computer/server being hacked in too easily.
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,7 +19,6 @@ import os # For VARS from the shell.
# Variables
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
# Load the configuration file
try:
@@ -45,12 +44,13 @@ try:
os.mkdir(UPLOAD_FOLDER)
app.logger.debug(f"Directory '{UPLOAD_FOLDER}' created successfully.")
except FileExistsError:
app.logger.debug(f"Directory '{UPLOAD_FOLDER}' already exists.")
app.logger.error(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,7 +125,6 @@ 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()))
@@ -162,7 +161,6 @@ 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()

View File

@@ -1,4 +0,0 @@
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", " Accès Libre ~ 1 An ~ Fête de la Musique Libre @ " + time)
formData.set("signature", "Printed via the webcam @ " + time)
fetch(url, {
method: 'POST', // or 'PUT'