Compare commits

..

5 Commits

Author SHA1 Message Date
Shiro-Nek0
bc02d4c3a8 docker + go 2026-02-25 23:54:30 -03:00
66ec27672f modified: requirements.txt 2026-02-25 23:52:29 -03:00
96a10c6448 new file: requirements.txt 2026-02-25 23:50:45 -03:00
96f4856555 Merge branch 'main' of https://gitea.sekidesu.xyz/SekiDesu01/SekiPOS 2026-02-25 23:47:33 -03:00
f6b4bc016b modified: pos_database.db
deleted:    static/cache/7801620009441.jpg
2026-02-25 23:47:00 -03:00
6 changed files with 99 additions and 0 deletions

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "app.py"]

7
ScannerGO/go.mod Normal file
View File

@@ -0,0 +1,7 @@
module ScannerGO
go 1.25.7
require github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
require golang.org/x/sys v0.41.0 // indirect

4
ScannerGO/go.sum Normal file
View File

@@ -0,0 +1,4 @@
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=

72
ScannerGO/main.go Normal file
View File

@@ -0,0 +1,72 @@
package main
import (
"flag"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
"time"
"github.com/tarm/serial"
)
func main() {
portName := flag.String("port", "/dev/ttyACM0", "Serial port name")
endpoint := flag.String("url", "https://scanner.sekidesu.xyz/scan", "Target URL endpoint")
baudRate := flag.Int("baud", 115200, "Baud rate")
flag.Parse()
config := &serial.Config{
Name: *portName,
Baud: *baudRate,
ReadTimeout: time.Second * 2,
}
port, err := serial.OpenPort(config)
if err != nil {
fmt.Printf("Error opening port %s: %v\n", *portName, err)
os.Exit(1)
}
defer port.Close()
fmt.Printf("Listening on %s (Baud: %d)...\n", *portName, *baudRate)
fmt.Printf("Sending data to: %s\n", *endpoint)
buf := make([]byte, 128)
for {
n, err := port.Read(buf)
if err != nil {
if err != io.EOF {
fmt.Printf("Read error: %v\n", err)
}
continue
}
if n > 0 {
content := strings.TrimSpace(string(buf[:n]))
if content != "" {
sendToEndpoint(*endpoint, content)
}
}
}
}
func sendToEndpoint(baseURL, content string) {
client := &http.Client{
Timeout: 5 * time.Second,
}
fullURL := fmt.Sprintf("%s?content=%s", baseURL, url.QueryEscape(content))
resp, err := client.Get(fullURL)
if err != nil {
fmt.Printf("Network Error: %v\n", err)
return
}
defer resp.Body.Close()
fmt.Printf("Data: [%s] | Status: %s\n", content, resp.Status)
}

BIN
pos_database.db Normal file

Binary file not shown.

5
requirements.txt Normal file
View File

@@ -0,0 +1,5 @@
Flask==3.1.3
Flask-Login==0.6.3
Flask-SocketIO==5.6.1
requests==2.32.5
eventlet==0.36.1