Archived
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
204ebea1b0 | ||
|
|
320679cedd | ||
|
|
b1cfe03fa1 | ||
|
|
06bfa6f537 | ||
|
|
d5db7ded9e | ||
|
|
a76c35304c | ||
|
|
357b178547 | ||
|
|
4d366e8470 | ||
|
|
0f7c18141b | ||
|
|
563772197d | ||
|
|
66300c5278 | ||
|
|
874159199a | ||
|
|
7dabfb6223 | ||
|
|
fc59cf595e | ||
|
|
7ea03e5bc5 | ||
|
|
61d190ed91 | ||
|
|
46fd345b7f | ||
|
|
4308850a2e | ||
|
|
a58d4b66ea | ||
|
|
ec9278c0dd | ||
|
|
f351212395 | ||
|
|
eafea9f728 | ||
|
|
f8857384fd | ||
|
|
d2900361b3 | ||
|
|
790d716d57 | ||
|
|
f09c92f201 | ||
|
|
368bf670b9 |
No files matched your search
@@ -8,15 +8,15 @@ on:
|
||||
jobs:
|
||||
renovate:
|
||||
runs-on: ubuntu-latest
|
||||
# Official image instead of `npm install -g renovate`: no per-run
|
||||
# install, and Node is whatever this Renovate release ships with (npm
|
||||
# silently picks an older Renovate when the runtime Node doesn't match
|
||||
# its engines.node). Tools like Ruby/bundler for lockfile updates get
|
||||
# installed on demand by the image's containerbase. Renovate bumps
|
||||
# this tag itself.
|
||||
container:
|
||||
image: ghcr.io/renovatebot/renovate:44
|
||||
steps:
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Install Renovate
|
||||
run: npm install -g renovate
|
||||
|
||||
- name: Run Renovate
|
||||
run: renovate
|
||||
env:
|
||||
@@ -25,4 +25,6 @@ jobs:
|
||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||
RENOVATE_REPOSITORIES: "${{ gitea.repository }}"
|
||||
RENOVATE_ONBOARDING: "false"
|
||||
RENOVATE_BINARY_SOURCE: install
|
||||
# Secret named GH_COM_TOKEN: Gitea reserves the GITHUB_ prefix.
|
||||
GITHUB_COM_TOKEN: ${{ secrets.GH_COM_TOKEN }}
|
||||
@@ -1,5 +1,4 @@
|
||||
.session_secret
|
||||
.gitea_token
|
||||
public/files/*
|
||||
!public/files/.gitkeep
|
||||
data/labels/*
|
||||
|
||||
+9
-8
@@ -4,14 +4,14 @@ GEM
|
||||
base64 (0.3.0)
|
||||
chunky_png (1.4.0)
|
||||
logger (1.7.0)
|
||||
multi_json (1.21.1)
|
||||
multi_json (1.21.2)
|
||||
mustermann (3.1.1)
|
||||
nio4r (2.7.5)
|
||||
ostruct (0.6.3)
|
||||
puma (8.0.2)
|
||||
nio4r (~> 2.0)
|
||||
rack (3.2.6)
|
||||
rack-protection (4.2.1)
|
||||
rack (3.2.9)
|
||||
rack-protection (4.2.2)
|
||||
base64 (>= 0.1.0)
|
||||
logger (>= 1.6.0)
|
||||
rack (>= 3.0.0, < 4)
|
||||
@@ -24,24 +24,25 @@ GEM
|
||||
chunky_png (~> 1.0)
|
||||
rqrcode_core (~> 2.0)
|
||||
rqrcode_core (2.1.0)
|
||||
sinatra (4.2.1)
|
||||
sinatra (4.2.2)
|
||||
logger (>= 1.6.0)
|
||||
mustermann (~> 3.0)
|
||||
rack (>= 3.0.0, < 4)
|
||||
rack-protection (= 4.2.1)
|
||||
rack-protection (= 4.2.2)
|
||||
rack-session (>= 2.0.0, < 3)
|
||||
tilt (~> 2.0)
|
||||
sinatra-contrib (4.2.1)
|
||||
sinatra-contrib (4.2.2)
|
||||
multi_json (>= 0.0.2)
|
||||
mustermann (~> 3.0)
|
||||
rack-protection (= 4.2.1)
|
||||
sinatra (= 4.2.1)
|
||||
rack-protection (= 4.2.2)
|
||||
sinatra (= 4.2.2)
|
||||
tilt (~> 2.0)
|
||||
tilt (2.7.0)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux
|
||||
armv7l-linux-eabihf
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
logger
|
||||
|
||||
+35
-9
@@ -1,17 +1,41 @@
|
||||
= labelprint
|
||||
|
||||
Unified UI for printing labels/stickers:
|
||||
Unified UI for printing labels/receipts:
|
||||
|
||||
* Native ZPL printing to a Datamax-ONeil thermal barcode printer
|
||||
* A proxy/switcher in front of three https://github.com/DL6ER/brother_ql_web[brother_ql_web] instances, one per Brother QL printer
|
||||
* A proxy in front of https://github.com/DL6ER/brother_ql_web[brother_ql_web] (port 8013), which drives all Brother QL printers
|
||||
* ESC/POS receipt printing to an Epson TM-T20II
|
||||
|
||||
== Routes
|
||||
|
||||
* `/` -- upload a PDF and print it (ZPL)
|
||||
* `/upload` -- upload form
|
||||
* `/test-print` -- print the bundled test label
|
||||
* `/brother` -- list of Brother QL printers
|
||||
* `/brother/<printer>/*` -- proxied to that printer's brother_ql_web instance (UI and API alike)
|
||||
* `/` -- home page, links to everything below
|
||||
* `/upload`, `POST /upload` -- upload a PDF/ZPL file and print it (Datamax). PDF pages wider than the A6 label (e.g. letter pages or labels in landscape) are turned and fitted onto it, others print 1:1.
|
||||
* `POST /shipping/zpl` -- print raw ZPL text (see "API usage" below)
|
||||
* `/test-print` -- print the bundled Datamax test label
|
||||
* `/epson` -- receipt printing UI (title/body/QR template, or raw ESC/POS mnemonic notation)
|
||||
* `POST /epson/print` -- print a title/body/QR receipt
|
||||
* `POST /epson/raw` -- print already-formatted ESC/POS mnemonic notation (see "API usage" below)
|
||||
* `POST /epson/test-print` -- print an Epson capability test page (text sizes, barcode, QR, raster image)
|
||||
* `/labels` -- shared repository of saved ZPL labels / ESC-POS receipts (list, edit, preview, print, delete)
|
||||
* `/brother/*` -- proxied to brother_ql_web (UI and API alike), the printer is chosen in its label designer
|
||||
|
||||
== API usage (e.g. from Gitea Actions)
|
||||
|
||||
`POST /shipping/zpl` and `POST /epson/raw` are plain, unauthenticated form-POST endpoints -- no session/login needed, and printing without a `save_as`/`commit` param just prints (nothing gets kept in the label repository). That makes labelprint usable as a "dumb" print API for other automation: it doesn't need to know anything about the caller, and the caller doesn't need any labelprint-specific client, just an HTTP form POST.
|
||||
|
||||
Example: `randy/home-gitops` has a workflow (`.gitea/workflows/print-issues.yaml` + `scripts/print_issues.rb`) that fetches its own open issues via the Gitea API and prints a summary on the Epson receipt printer -- the Gitea-specific logic (fetching, formatting) lives entirely in that script, not here:
|
||||
|
||||
[source,ruby]
|
||||
----
|
||||
require 'net/http'
|
||||
|
||||
res = Net::HTTP.post_form(
|
||||
URI('http://rpi-printserver.hv.priesol.net/epson/raw'),
|
||||
'content' => "ESC E 0x01\nHello from CI\nESC E 0x00\nLF"
|
||||
)
|
||||
----
|
||||
|
||||
`content` uses labelprint's mnemonic ESC/POS notation: `ESC`/`GS`/`FS`/`LF`/`CR`/`HT`/`NUL` as command names, `0xNN` as a raw byte, anything else as literal text (CP852-encoded) -- see the `/epson` page for the full reference and worked examples (alignment, bold, barcodes). `POST /shipping/zpl` works the same way but with a `zpl` form field taking plain ZPL instead.
|
||||
|
||||
== Running
|
||||
|
||||
@@ -25,10 +49,12 @@ Requires `config.json` (see printer definitions inside) and a `.session_secret`
|
||||
|
||||
== Deployment
|
||||
|
||||
Runs as `sinatra.service` (systemd) on `rpi-printserver.local`, under RVM (`rvm default do bundle exec ruby app.rb` -- always uses whatever ruby is currently the RVM default, no manual bumping needed).
|
||||
Runs as `sinatra.service` (systemd) on `rpi-printserver.hv.priesol.net`, under RVM (`rvm default do bundle exec ruby app.rb` -- always uses whatever ruby is currently the RVM default, no manual bumping needed).
|
||||
|
||||
`.gitea/workflows/deploy.yaml` deploys on every push to `main`: SSH into `rpi-printserver.local`, `git pull`, `bundle install`, restart the service.
|
||||
`.gitea/workflows/deploy.yaml` deploys on every push to `main`: SSH into `rpi-printserver.hv.priesol.net`, `git pull`, `bundle install`, restart the service.
|
||||
|
||||
== Dependency updates
|
||||
|
||||
`.gitea/workflows/renovate.yaml` runs Renovate on a schedule (Monday 06:00 Europe/Bratislava, or manually) to open PRs for outdated gems and GitHub Actions. See the "Dependency Dashboard" issue for current status.
|
||||
|
||||
The print server works without internet: Bootstrap, Material Design Icons and Dropzone are in `public/vendor/<name>-<version>/` (unchanged release files from jsdelivr/unpkg, without source maps; MDI only with the WOFF2 and WOFF fonts). Renovate does not update them, a new version is a new folder plus the paths in `views/layout.erb` (and `app.rb` for the MDI stylesheet of the proxied brother_ql_web pages). `nginx-502.html` is self-contained, nginx serves it from `/etc/nginx/error_pages/502.html` while the app is down. Only the ZPL preview in `/labels` needs internet (Labelary API).
|
||||
@@ -3,14 +3,15 @@ require 'sinatra'
|
||||
require "sinatra/reloader"
|
||||
require 'tmpdir'
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
require_relative 'lib/receipt_builder'
|
||||
require_relative 'lib/label_repository'
|
||||
|
||||
set :protection, :except => :frame_options
|
||||
set :environment, :production
|
||||
set :bind, "::"
|
||||
set :port, 80
|
||||
# nginx reverse-proxies :80 -> here. Loopback-only and an unprivileged port
|
||||
# means no more cap_net_bind_service dance on every RVM ruby upgrade.
|
||||
set :bind, "127.0.0.1"
|
||||
set :port, 4567
|
||||
|
||||
if !File.exist?('config.json') || !File.readable?('config.json')
|
||||
raise RuntimeException, 'Could not read config.json'
|
||||
@@ -21,6 +22,7 @@ end
|
||||
# controller -- back to the kernel driver via a stable udev symlink instead.
|
||||
PRINTER_DEVICE = '/dev/usb/lp_datamax' # see /etc/udev/rules.d/99-datamax.rules
|
||||
PRINTER_DPI = 203 # DatamaxONeil E4204B Mark III native head resolution
|
||||
LABEL_DOTS = [840, 1183] # 105 x 148 mm (A6) labels, as set up in the printer
|
||||
PRINTER_DARKNESS = 8 # lower than factory default to stop thermal dot-gain from fusing barcode bars
|
||||
TEST_LABEL_PDF = File.join(File.dirname(__FILE__), 'test-label.pdf')
|
||||
|
||||
@@ -28,11 +30,7 @@ PRINTER_DEVICE_EPSON = '/dev/usb/lp_epson' # see /etc/udev/rules.d/99-epson.rule
|
||||
|
||||
LABEL_REPO = LabelRepository.new(File.join(File.dirname(__FILE__), 'data', 'labels'))
|
||||
|
||||
BROTHER_PRINTERS = {
|
||||
'ql560' => { port: 8560, label: 'Brother QL-560' },
|
||||
'ql700' => { port: 8700, label: 'Brother QL-700' },
|
||||
'ql1100' => { port: 9100, label: 'Brother QL-1100' }
|
||||
}.freeze
|
||||
BROTHER_PORT = 8013 # one brother_ql_web for all QL printers (its PRINTERS env)
|
||||
|
||||
configure do
|
||||
enable :static
|
||||
@@ -64,17 +62,35 @@ helpers do
|
||||
# Renders a PDF to ZPL ^GFA graphic labels at the printer's native DPI,
|
||||
# bypassing CUPS/Gutenprint's raster pipeline which blurs text and 1px-shifts
|
||||
# output compared to native ZPL rendering.
|
||||
# Pages wider than the label (e.g. a letter page, or a label in
|
||||
# landscape) are fitted onto the label instead, which Ghostscript turns
|
||||
# to portrait when that fits better. Pages that fit print 1:1.
|
||||
def pdf_to_zpl(pdf_path, dpi: PRINTER_DPI)
|
||||
Dir.mktmpdir do |dir|
|
||||
pattern = File.join(dir, 'page-%03d.pbm')
|
||||
pages = render_pbm(pdf_path, dir, dpi)
|
||||
if pages.any? { |f| pbm_size(f)[0] > LABEL_DOTS[0] }
|
||||
pages.each { |f| File.delete(f) }
|
||||
pages = render_pbm(pdf_path, dir, dpi, "-g#{LABEL_DOTS.join('x')}", '-dFIXEDMEDIA', '-dPDFFitPage')
|
||||
end
|
||||
pages.map { |f| pbm_to_zpl_label(f) }.join
|
||||
end
|
||||
end
|
||||
|
||||
def render_pbm(pdf_path, dir, dpi, *options)
|
||||
ok = system('gs', '-q', '-dNOPAUSE', '-dBATCH', '-dSAFER',
|
||||
'-sDEVICE=pbmraw', "-r#{dpi}",
|
||||
'-sDEVICE=pbmraw', "-r#{dpi}", *options,
|
||||
'-dTextAlphaBits=4', '-dGraphicsAlphaBits=4',
|
||||
"-sOutputFile=#{pattern}", pdf_path)
|
||||
"-sOutputFile=#{File.join(dir, 'page-%03d.pbm')}", pdf_path)
|
||||
raise 'ghostscript rendering failed' unless ok
|
||||
|
||||
Dir.glob(File.join(dir, 'page-*.pbm')).sort.map { |f| pbm_to_zpl_label(f) }.join
|
||||
Dir.glob(File.join(dir, 'page-*.pbm')).sort
|
||||
end
|
||||
|
||||
def pbm_size(pbm_path)
|
||||
header = /\AP4\s+(?:#[^\n]*\n\s*)*(\d+)\s+(\d+)\s/.match(File.binread(pbm_path, 512))
|
||||
raise "unreadable PBM header in #{pbm_path}" unless header
|
||||
|
||||
[header[1].to_i, header[2].to_i]
|
||||
end
|
||||
|
||||
def pbm_to_zpl_label(pbm_path)
|
||||
@@ -108,6 +124,56 @@ helpers do
|
||||
receipt.print!(PRINTER_DEVICE_EPSON)
|
||||
end
|
||||
|
||||
# Procedural 64x64 checkerboard (8px squares) -- no image library needed,
|
||||
# just to prove GS v 0 raster printing works end to end.
|
||||
def checkerboard_bitmap(size_px = 64, block_px = 8)
|
||||
width_bytes = size_px / 8
|
||||
bytes = "".b
|
||||
size_px.times do |y|
|
||||
row_block = y / block_px
|
||||
width_bytes.times do |xb|
|
||||
byte = 0
|
||||
8.times do |bit|
|
||||
x = xb * 8 + bit
|
||||
col_block = x / block_px
|
||||
byte |= (1 << (7 - bit)) if (row_block + col_block).even?
|
||||
end
|
||||
bytes << byte.chr
|
||||
end
|
||||
end
|
||||
bytes
|
||||
end
|
||||
|
||||
# Demonstrates most of what the printer can do: text sizes/styles, EAN-13,
|
||||
# QR code, and a raster image -- mirrors /test-print's role for the Datamax.
|
||||
def print_epson_test_page
|
||||
receipt = ReceiptBuilder.new
|
||||
receipt.align(:center).bold.size(:big).text("TM-T20II TEST\n").size(:normal).bold(false)
|
||||
receipt.align(:left).text(('-' * 48) + "\n")
|
||||
|
||||
receipt.section_separator('TEXT STYLES')
|
||||
receipt.text("Normal text\n")
|
||||
receipt.bold.text("Bold text\n").bold(false)
|
||||
receipt.underline.text("Underlined text\n").underline(false)
|
||||
receipt.size(:wide).text("Double width\n").size(:normal)
|
||||
receipt.size(:high).text("Double height\n").size(:normal)
|
||||
receipt.size(:big).text("Double both\n").size(:normal)
|
||||
|
||||
receipt.section_separator('BARCODE')
|
||||
receipt.align(:center).ean13('2012345678902')
|
||||
|
||||
receipt.section_separator('QR CODE')
|
||||
receipt.align(:center).qr('https://git.priesol.net/randy/home-gitops')
|
||||
|
||||
receipt.section_separator('IMAGE')
|
||||
receipt.align(:center).image(64, 64, checkerboard_bitmap)
|
||||
|
||||
receipt.align(:left).text(('-' * 48) + "\n")
|
||||
receipt.text("Printed: #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
||||
receipt.feed(3).cut
|
||||
receipt.print!(PRINTER_DEVICE_EPSON)
|
||||
end
|
||||
|
||||
ESCPOS_MNEMONICS = {
|
||||
'ESC' => "\x1B", 'GS' => "\x1D", 'FS' => "\x1C", 'DLE' => "\x10",
|
||||
'LF' => "\x0A", 'CR' => "\x0D", 'HT' => "\x09", 'NUL' => "\x00"
|
||||
@@ -118,17 +184,23 @@ helpers do
|
||||
# Hello # literal text
|
||||
# LF
|
||||
# GS k 0x03 12345678 0x00
|
||||
# Each `#...` trailing comment is stripped, then each line's
|
||||
# whitespace-separated tokens become either a known control mnemonic, a
|
||||
# raw `0xNN` byte, or literal text (CP852-encoded) -- consecutive literal
|
||||
# tokens are rejoined with a single space so plain prose still reads
|
||||
# correctly, while whitespace around control/byte tokens is dropped since
|
||||
# those are just for human readability, not printer output.
|
||||
# A trailing comment is only a comment when "#" is its own
|
||||
# whitespace-separated token -- not just stripped from the first "#"
|
||||
# anywhere in the line, which would mangle literal text like "#5 Fix
|
||||
# thing" (an issue reference, not a comment). Each remaining token
|
||||
# becomes a known control mnemonic, a raw `0xNN` byte, or literal text
|
||||
# (CP852-encoded) -- consecutive literal tokens are rejoined with a
|
||||
# single space so plain prose still reads correctly, while whitespace
|
||||
# around control/byte tokens is dropped since those are just for human
|
||||
# readability, not printer output.
|
||||
def parse_escpos_notation(text)
|
||||
bytes = "".b
|
||||
text.each_line do |line|
|
||||
prev_was_text = false
|
||||
line.sub(/#.*/, '').split.each do |token|
|
||||
tokens = line.split
|
||||
comment_at = tokens.index('#')
|
||||
tokens = tokens[0...comment_at] if comment_at
|
||||
tokens.each do |token|
|
||||
if ESCPOS_MNEMONICS.key?(token)
|
||||
bytes << ESCPOS_MNEMONICS[token]
|
||||
prev_was_text = false
|
||||
@@ -155,45 +227,6 @@ helpers do
|
||||
receipt.print!(PRINTER_DEVICE_EPSON)
|
||||
end
|
||||
|
||||
GITEA_TOKEN_FILE = File.join(File.dirname(__FILE__), '.gitea_token')
|
||||
|
||||
def fetch_open_issues(repo)
|
||||
token = File.read(GITEA_TOKEN_FILE).strip
|
||||
uri = URI("https://git.priesol.net/api/v1/repos/randy/#{repo}/issues?state=open&type=issues&limit=50")
|
||||
req = Net::HTTP::Get.new(uri)
|
||||
req['Authorization'] = "token #{token}"
|
||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
|
||||
raise "Gitea API returned #{res.code}" unless res.is_a?(Net::HTTPSuccess)
|
||||
|
||||
JSON.parse(res.body)
|
||||
end
|
||||
|
||||
# Prints a receipt-style summary of a repo's open issues -- number, title,
|
||||
# labels, one separator per issue, total at the end.
|
||||
def print_issues(repo)
|
||||
issues = fetch_open_issues(repo).sort_by { |i| i['number'] }
|
||||
|
||||
receipt = ReceiptBuilder.new
|
||||
receipt.align(:center).bold.text("Open issues: #{repo}\n").bold(false)
|
||||
receipt.text("#{Time.now.strftime('%Y-%m-%d %H:%M')}\n")
|
||||
receipt.align(:left).text(('-' * 32) + "\n")
|
||||
|
||||
if issues.empty?
|
||||
receipt.text("(no open issues)\n")
|
||||
else
|
||||
issues.each do |issue|
|
||||
receipt.bold.text("##{issue['number']} #{issue['title']}\n").bold(false)
|
||||
labels = issue['labels'].map { |l| l['name'] }.join(', ')
|
||||
receipt.text("#{labels}\n") unless labels.empty?
|
||||
receipt.text(('-' * 32) + "\n")
|
||||
end
|
||||
end
|
||||
|
||||
receipt.text("Total: #{issues.size}\n")
|
||||
receipt.feed(3).cut
|
||||
receipt.print!(PRINTER_DEVICE_EPSON)
|
||||
end
|
||||
|
||||
# Renders ZPL to a PNG via Labelary's public API for an inline preview.
|
||||
# Fixed at the Datamax label size (4x6in @ 8dpmm ~= 203dpi) -- good enough
|
||||
# for a thumbnail, not meant to be exact for other sizes.
|
||||
@@ -205,12 +238,10 @@ helpers do
|
||||
res.body
|
||||
end
|
||||
|
||||
# Transparently reverse-proxies the current request to one of the
|
||||
# brother_ql_web instances, so all three printers (web UI and API alike)
|
||||
# are reachable through this single sinatra port instead of their own
|
||||
# dedicated ports.
|
||||
def proxy_to_brother(port, prefix, path)
|
||||
uri = URI("http://127.0.0.1:#{port}#{path}")
|
||||
# Transparently reverse-proxies the current request to brother_ql_web, so
|
||||
# its web UI and API are reachable through this single sinatra port.
|
||||
def proxy_to_brother(prefix, path)
|
||||
uri = URI("http://127.0.0.1:#{BROTHER_PORT}#{path}")
|
||||
uri.query = request.query_string unless request.query_string.empty?
|
||||
|
||||
proxied = Net::HTTP.const_get(request.request_method.capitalize).new(uri)
|
||||
@@ -223,13 +254,20 @@ helpers do
|
||||
proxied['Content-Type'] = request.content_type if request.content_type
|
||||
proxied['X-Forwarded-Prefix'] = prefix
|
||||
proxied['X-Forwarded-Host'] = request.host
|
||||
proxied.body = request.body.read unless request.request_method == 'GET'
|
||||
# Sinatra already consumed the body when parsing params (Rack 3 no longer
|
||||
# rewinds it), so rewind first or form POSTs reach brother_ql_web empty.
|
||||
unless request.request_method == 'GET'
|
||||
request.body.rewind
|
||||
proxied.body = request.body.read
|
||||
end
|
||||
|
||||
res = Net::HTTP.start(uri.host, uri.port) { |http| http.request(proxied) }
|
||||
|
||||
body = res.body || ''
|
||||
if res['Content-Type']&.include?('text/html')
|
||||
body = body.sub(/(<body[^>]*>)/i) { "#{Regexp.last_match(1)}\n#{erb(:_navbar, layout: false)}" }
|
||||
body = body.sub(/(<body[^>]*>)/i) { "#{Regexp.last_match(1)}\n#{erb(:_brother_bar, layout: false)}" }
|
||||
# The navbar's icons, brother_ql_web has no MDI font of its own
|
||||
body = body.sub(%r{</head>}i) { %(<link href="/vendor/mdi-7.4.47/css/materialdesignicons.min.css" rel="stylesheet">\n</head>) }
|
||||
end
|
||||
|
||||
headers = {}
|
||||
@@ -253,16 +291,6 @@ get '/' do
|
||||
erb :index
|
||||
end
|
||||
|
||||
post '/issues/print' do
|
||||
begin
|
||||
print_issues('home-gitops')
|
||||
flash 'Open issues sent to printer', 'success'
|
||||
rescue => e
|
||||
flash "Failed to print issues (#{e.message})", 'danger'
|
||||
end
|
||||
redirect '/'
|
||||
end
|
||||
|
||||
get '/upload' do
|
||||
erb :upload
|
||||
end
|
||||
@@ -270,9 +298,15 @@ end
|
||||
post '/shipping/zpl' do
|
||||
zpl = params[:zpl].to_s
|
||||
name = params[:save_as].to_s
|
||||
|
||||
if zpl.strip.empty?
|
||||
flash 'ZPL text is empty', 'warning'
|
||||
elsif name.empty?
|
||||
redirect '/upload'
|
||||
end
|
||||
|
||||
case params[:commit]
|
||||
when 'save', 'save_and_print'
|
||||
if name.empty?
|
||||
flash 'Name is required to save', 'warning'
|
||||
else
|
||||
LABEL_REPO.save(name: name, type: 'zpl', content: zpl)
|
||||
@@ -287,6 +321,16 @@ post '/shipping/zpl' do
|
||||
flash "Saved '#{name}'", 'success'
|
||||
end
|
||||
end
|
||||
else
|
||||
# No explicit save/save_and_print action -- e.g. a plain API/CI call.
|
||||
# labelprint stays a "dumb" print API here: just print, nothing saved.
|
||||
begin
|
||||
print_to_datamax(zpl)
|
||||
flash 'ZPL sent to printer', 'success'
|
||||
rescue => e
|
||||
flash "ZPL print failed (#{e.message})", 'danger'
|
||||
end
|
||||
end
|
||||
redirect '/upload'
|
||||
end
|
||||
|
||||
@@ -341,6 +385,16 @@ get '/epson' do
|
||||
erb :epson
|
||||
end
|
||||
|
||||
post '/epson/test-print' do
|
||||
begin
|
||||
print_epson_test_page
|
||||
flash 'Test page sent to Epson printer', 'success'
|
||||
rescue => e
|
||||
flash "Epson test print failed (#{e.message})", 'danger'
|
||||
end
|
||||
redirect '/epson'
|
||||
end
|
||||
|
||||
post '/epson/print' do
|
||||
begin
|
||||
print_receipt(title: params[:title].to_s, body: params[:body].to_s, qr: params[:qr].to_s)
|
||||
@@ -354,9 +408,15 @@ end
|
||||
post '/epson/raw' do
|
||||
content = params[:content].to_s
|
||||
name = params[:save_as].to_s
|
||||
|
||||
if content.strip.empty?
|
||||
flash 'Receipt text is empty', 'warning'
|
||||
elsif name.empty?
|
||||
redirect '/epson'
|
||||
end
|
||||
|
||||
case params[:commit]
|
||||
when 'save', 'save_and_print'
|
||||
if name.empty?
|
||||
flash 'Name is required to save', 'warning'
|
||||
else
|
||||
LABEL_REPO.save(name: name, type: 'escpos', content: content)
|
||||
@@ -371,30 +431,40 @@ post '/epson/raw' do
|
||||
flash "Saved '#{name}'", 'success'
|
||||
end
|
||||
end
|
||||
else
|
||||
# No explicit save/save_and_print action -- e.g. a plain API/CI call.
|
||||
# labelprint stays a "dumb" print API here: just print, nothing saved.
|
||||
begin
|
||||
print_raw_escpos(content)
|
||||
flash 'Sent to Epson printer', 'success'
|
||||
rescue => e
|
||||
flash "Epson print failed (#{e.message})", 'danger'
|
||||
end
|
||||
end
|
||||
redirect '/epson'
|
||||
end
|
||||
|
||||
get '/labels' do
|
||||
get '/repository' do
|
||||
@labels = LABEL_REPO.all
|
||||
erb :labels
|
||||
erb :repository
|
||||
end
|
||||
|
||||
get '/labels/:id/edit' do
|
||||
get '/repository/:id/edit' do
|
||||
@label = LABEL_REPO.find(params[:id])
|
||||
halt 404, 'unknown label' unless @label
|
||||
|
||||
erb :label_edit
|
||||
end
|
||||
|
||||
post '/labels/:id' do
|
||||
post '/repository/:id' do
|
||||
label = LABEL_REPO.update(params[:id], name: params[:name].to_s, content: params[:content].to_s)
|
||||
halt 404, 'unknown label' unless label
|
||||
|
||||
flash "Saved '#{label['name']}'", 'success'
|
||||
redirect '/labels'
|
||||
redirect '/repository'
|
||||
end
|
||||
|
||||
get '/labels/:id/preview.png' do
|
||||
get '/repository/:id/preview.png' do
|
||||
label = LABEL_REPO.find(params[:id])
|
||||
halt 404 unless label && label['type'] == 'zpl'
|
||||
|
||||
@@ -405,7 +475,7 @@ get '/labels/:id/preview.png' do
|
||||
png
|
||||
end
|
||||
|
||||
post '/labels/:id/print' do
|
||||
post '/repository/:id/print' do
|
||||
label = LABEL_REPO.find(params[:id])
|
||||
halt 404, 'unknown label' unless label
|
||||
|
||||
@@ -420,25 +490,29 @@ post '/labels/:id/print' do
|
||||
rescue => e
|
||||
flash "Print failed (#{e.message})", 'danger'
|
||||
end
|
||||
redirect '/labels'
|
||||
redirect '/repository'
|
||||
end
|
||||
|
||||
post '/labels/:id/delete' do
|
||||
post '/repository/:id/delete' do
|
||||
LABEL_REPO.delete(params[:id])
|
||||
flash 'Label deleted', 'success'
|
||||
redirect '/labels'
|
||||
redirect '/repository'
|
||||
end
|
||||
|
||||
get '/brother' do
|
||||
@printers = BROTHER_PRINTERS
|
||||
erb :brother_picker
|
||||
get '/labelburg' do
|
||||
redirect '/labelburg/'
|
||||
end
|
||||
|
||||
%w[get post put delete].each do |verb|
|
||||
send(verb, '/brother/:printer/*') do
|
||||
printer = BROTHER_PRINTERS[params[:printer]]
|
||||
halt 404, 'unknown printer' unless printer
|
||||
send(verb, '/labelburg/*') do
|
||||
proxy_to_brother('/labelburg', '/' + params[:splat].first)
|
||||
end
|
||||
end
|
||||
|
||||
proxy_to_brother(printer[:port], "/brother/#{params[:printer]}", '/' + params[:splat].first)
|
||||
# Its old addresses, e.g. in bookmarks
|
||||
%w[get post put delete].each do |verb|
|
||||
send(verb, %r{/(?:brother|labelhaus)(/.*)?}) do
|
||||
path = '/labelburg' + (params[:captures].first || '/')
|
||||
redirect(request.query_string.empty? ? path : "#{path}?#{request.query_string}", 308)
|
||||
end
|
||||
end
|
||||
+36
-2
@@ -65,6 +65,28 @@ class ReceiptBuilder
|
||||
self
|
||||
end
|
||||
|
||||
# White-on-black reverse video (GS B n) -- available if a receipt ever
|
||||
# wants a real highlight, but plain "=" rules read better for routine
|
||||
# section breaks than a fully blacked-out line.
|
||||
def invert(enable = true)
|
||||
@buffer << (enable ? "\x1D\x42\x01" : "\x1D\x42\x00")
|
||||
self
|
||||
end
|
||||
|
||||
# A single "=" rule with an optional label centered in it, e.g.
|
||||
# section_separator("SECTION") -> "========= SECTION =========".
|
||||
def section_separator(label = '', width: 48)
|
||||
line = if label.empty?
|
||||
'=' * width
|
||||
else
|
||||
mid = " #{label} "
|
||||
pad = [width - mid.length, 0].max
|
||||
left = pad / 2
|
||||
('=' * left) + mid + ('=' * (pad - left))
|
||||
end
|
||||
feed(1).text("#{line}\n").feed(1)
|
||||
end
|
||||
|
||||
def size(mode)
|
||||
@buffer << case mode
|
||||
when :big then TXT_BIG
|
||||
@@ -87,12 +109,24 @@ class ReceiptBuilder
|
||||
self
|
||||
end
|
||||
|
||||
# Native ESC/POS EAN-13
|
||||
def ean13(code)
|
||||
# Native ESC/POS EAN-13. height is in dots (GS h) -- the printer's default
|
||||
# (~162 dots) prints noticeably tall; 50 is a shorter, still-scannable size.
|
||||
def ean13(code, height: 50)
|
||||
@buffer << "\x1D\x68" << height.chr # GS h n -- set barcode height
|
||||
@buffer << "\x1D\x6B\x02" << code.b << "\x00"
|
||||
self
|
||||
end
|
||||
|
||||
# Raster bit image (GS v 0) -- bytes must already be packed 1bpp,
|
||||
# row-major, (width_px/8 rounded up) bytes per row, MSB-first, 1=black.
|
||||
def image(width_px, height_px, bytes)
|
||||
width_bytes = (width_px + 7) / 8
|
||||
@buffer << "\x1D\x76\x30\x00"
|
||||
@buffer << [width_bytes % 256, width_bytes / 256, height_px % 256, height_px / 256].pack('C4')
|
||||
@buffer << bytes
|
||||
self
|
||||
end
|
||||
|
||||
def feed(lines = 3)
|
||||
@buffer << ("\n" * lines)
|
||||
self
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<!doctype html>
|
||||
<html lang="sk">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="refresh" content="5">
|
||||
<title>Print server</title>
|
||||
<!-- Self-contained: nginx serves it while the app (and its /vendor files) is down -->
|
||||
<style>
|
||||
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center;
|
||||
background: #212529; color: #adb5bd; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-align: center; }
|
||||
svg { width: 4rem; height: 4rem; fill: #6c757d; }
|
||||
h1 { margin: 1rem 0 .5rem; font-weight: 500; color: #dee2e6; }
|
||||
p { color: #6c757d; }
|
||||
.spinner { width: 2rem; height: 2rem; margin: .5rem auto 0; border: .25em solid #6c757d; border-right-color: transparent;
|
||||
border-radius: 50%; animation: spin .75s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<!-- mdi-printer-off from Material Design Icons 7.4.47 -->
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6,3V4.18L8.82,7H18V3H6M2.28,3L1,4.27L4.75,8C3.19,8.15 2,9.44 2,11V17H6V21H17.73L19.73,23L21,21.72L2.28,3M9.82,8L18.82,17H22V11A3,3 0 0,0 19,8H9.82M19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10M8,14H10.73L15.73,19H8V14Z"/></svg>
|
||||
<h1>Tlačiareň spí</h1>
|
||||
<p>Print server práve nabieha alebo sa reštartuje.<br>Stránka sa sama skúsi znova o chvíľu...</p>
|
||||
<div class="spinner" role="status"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,26 @@
|
||||
# Installed at /etc/nginx/sites-available/labelprint on rpi-printserver
|
||||
# (symlinked into sites-enabled), not auto-deployed -- kept here just so a
|
||||
# reflash/rebuild isn't a guessing game. nginx owns :80 so the app itself
|
||||
# never needs cap_net_bind_service (which a plain RVM ruby patch upgrade
|
||||
# silently drops, since it's tied to the old binary's path).
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name rpi-printserver.hv.priesol.net;
|
||||
|
||||
client_max_body_size 20m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:4567;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
error_page 502 503 504 /502.html;
|
||||
location = /502.html {
|
||||
root /etc/nginx/error_pages;
|
||||
internal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Bootstrap v5.3.8 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,function(){"use strict";const t=new Map,e={set(e,i,n){t.has(e)||t.set(e,new Map);const s=t.get(e);s.has(i)||0===s.size?s.set(i,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(e,i)=>t.has(e)&&t.get(e).get(i)||null,remove(e,i){if(!t.has(e))return;const n=t.get(e);n.delete(i),0===n.size&&t.delete(e)}},i="transitionend",n=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,(t,e)=>`#${CSS.escape(e)}`)),t),s=t=>null==t?`${t}`:Object.prototype.toString.call(t).match(/\s([a-z]+)/i)[1].toLowerCase(),o=t=>{t.dispatchEvent(new Event(i))},r=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),a=t=>r(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(n(t)):null,l=t=>{if(!r(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},c=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),h=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?h(t.parentNode):null},d=()=>{},u=t=>{t.offsetHeight},f=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,p=[],m=()=>"rtl"===document.documentElement.dir,g=t=>{var e;e=()=>{const e=f();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(p.length||document.addEventListener("DOMContentLoaded",()=>{for(const t of p)t()}),p.push(e)):e()},_=(t,e=[],i=t)=>"function"==typeof t?t.call(...e):i,b=(t,e,n=!0)=>{if(!n)return void _(t);const s=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(e)+5;let r=!1;const a=({target:n})=>{n===e&&(r=!0,e.removeEventListener(i,a),_(t))};e.addEventListener(i,a),setTimeout(()=>{r||o(e)},s)},v=(t,e,i,n)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!i&&n?t[s-1]:t[0]:(o+=i?1:-1,n&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},y=/[^.]*(?=\..*)\.|.*/,w=/\..*/,A=/::\d+$/,E={};let T=1;const C={mouseenter:"mouseover",mouseleave:"mouseout"},O=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function x(t,e){return e&&`${e}::${T++}`||t.uidEvent||T++}function k(t){const e=x(t);return t.uidEvent=e,E[e]=E[e]||{},E[e]}function L(t,e,i=null){return Object.values(t).find(t=>t.callable===e&&t.delegationSelector===i)}function S(t,e,i){const n="string"==typeof e,s=n?i:e||i;let o=N(t);return O.has(o)||(o=t),[n,s,o]}function D(t,e,i,n,s){if("string"!=typeof e||!t)return;let[o,r,a]=S(e,i,n);if(e in C){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=k(t),c=l[a]||(l[a]={}),h=L(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=x(r,e.replace(y,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return j(s,{delegateTarget:r}),n.oneOff&&P.off(t,s.type,e,i),i.apply(r,[s])}}(t,i,r):function(t,e){return function i(n){return j(n,{delegateTarget:t}),i.oneOff&&P.off(t,n.type,e),e.apply(t,[n])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function $(t,e,i,n,s){const o=L(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function I(t,e,i,n){const s=e[i]||{};for(const[o,r]of Object.entries(s))o.includes(n)&&$(t,e,i,r.callable,r.delegationSelector)}function N(t){return t=t.replace(w,""),C[t]||t}const P={on(t,e,i,n){D(t,e,i,n,!1)},one(t,e,i,n){D(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=S(e,i,n),a=r!==e,l=k(t),c=l[rLine truncated
|
||||
//# sourceMappingURL=bootstrap.bundle.min.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
@charset "UTF-8";/*!
|
||||
* Bootstrap v5.3.8 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2025 The Bootstrap Authors
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/:root,[data-bs-theme=light]{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-black:#000;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13,110,253;--bs-secondary-rgb:108,117,125;--bs-success-rgb:25,135,84;--bs-info-rgb:13,202,240;--bs-warning-rgb:255,193,7;--bs-danger-rgb:220,53,69;--bs-light-rgb:248,249,250;--bs-dark-rgb:33,37,41;--bs-primary-text-emphasis:#052c65;--bs-secondary-text-emphasis:#2b2f32;--bs-success-text-emphasis:#0a3622;--bs-info-text-emphasis:#055160;--bs-warning-text-emphasis:#664d03;--bs-danger-text-emphasis:#58151c;--bs-light-text-emphasis:#495057;--bs-dark-text-emphasis:#495057;--bs-primary-bg-subtle:#cfe2ff;--bs-secondary-bg-subtle:#e2e3e5;--bs-success-bg-subtle:#d1e7dd;--bs-info-bg-subtle:#cff4fc;--bs-warning-bg-subtle:#fff3cd;--bs-danger-bg-subtle:#f8d7da;--bs-light-bg-subtle:#fcfcfd;--bs-dark-bg-subtle:#ced4da;--bs-primary-border-subtle:#9ec5fe;--bs-secondary-border-subtle:#c4c8cb;--bs-success-border-subtle:#a3cfbb;--bs-info-border-subtle:#9eeaf9;--bs-warning-border-subtle:#ffe69c;--bs-danger-border-subtle:#f1aeb5;--bs-light-border-subtle:#e9ecef;--bs-dark-border-subtle:#adb5bd;--bs-white-rgb:255,255,255;--bs-black-rgb:0,0,0;--bs-font-sans-serif:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--bs-font-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-color-rgb:33,37,41;--bs-body-bg:#fff;--bs-body-bg-rgb:255,255,255;--bs-emphasis-color:#000;--bs-emphasis-color-rgb:0,0,0;--bs-secondary-color:rgba(33, 37, 41, 0.75);--bs-secondary-color-rgb:33,37,41;--bs-secondary-bg:#e9ecef;--bs-secondary-bg-rgb:233,236,239;--bs-tertiary-color:rgba(33, 37, 41, 0.5);--bs-tertiary-color-rgb:33,37,41;--bs-tertiary-bg:#f8f9fa;--bs-tertiary-bg-rgb:248,249,250;--bs-heading-color:inherit;--bs-link-color:#0d6efd;--bs-link-color-rgb:13,110,253;--bs-link-decoration:underline;--bs-link-hover-color:#0a58ca;--bs-link-hover-color-rgb:10,88,202;--bs-code-color:#d63384;--bs-highlight-color:#212529;--bs-highlight-bg:#fff3cd;--bs-border-width:1px;--bs-border-style:solid;--bs-border-color:#dee2e6;--bs-border-color-translucent:rgba(0, 0, 0, 0.175);--bs-border-radius:0.375rem;--bs-border-radius-sm:0.25rem;--bs-border-radius-lg:0.5rem;--bs-border-radius-xl:1rem;--bs-border-radius-xxl:2rem;--bs-border-radius-2xl:var(--bs-border-radius-xxl);--bs-border-radius-pill:50rem;--bs-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-box-shadow-sm:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-box-shadow-lg:0 1rem 3rem rgba(0, 0, 0, 0.175);--bs-box-shadow-inset:inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-focus-ring-width:0.25rem;--bs-focus-ring-opacity:0.25;--bs-focus-ring-color:rgba(13, 110, 253, 0.25);--bs-form-valid-color:#198754;--bs-form-valid-border-color:#198754;--bs-form-invalid-color:#dc3545;--bs-form-invalid-border-color:#dc3545}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color:#dee2e6;--bs-body-color-rgb:222,226,230;--bs-body-bg:#212529;--bs-body-bg-rgb:33,37,41;--bs-emphasis-color:#fff;--bs-emphasis-color-rgb:255,255,255;--bs-secondary-color:rgba(222, 226, 230, 0.75);--bs-secondary-color-rgb:222,226,230;--bs-secondary-bg:#343a40;--bs-secondary-bg-rgb:52,58,64;--bs-tertiary-color:rgba(222, 226, 230, 0.5);--bs-tertiary-color-rgb:222,226,230;--bs-tertiary-bg:#2b3035;--bs-tertiary-bg-rgb:43,48,53;--bs-primary-text-emphasis:#6ea8fe;--bs-secondary-text-emphasis:#a7acb1;--bs-success-text-emphasis:#75b798;--bs-info-text-emphasis:#6edff6;--bs-warning-text-emphasis:#ffda6a;--bs-danger-text-emphasis:#ea868f;--bs-light-text-emphasis:#f8f9fa;--bs-dark-text-emphasis:#dee2e6;--bs-primary-bg-subtle:#031633;--bs-secondary-bg-subtle:#161719;--bs-success-bg-subtle:#051b11;--bs-info-bg-subtle:#032830;--bs-warning-bg-subtle:#332701;--bs-danger-bg-subtle:#2c0b0e;--bs-light-bg-subtle:#343a40;--bs-dark-bg-subtle:#1a1d20;--bs-primary-border-subtle:#084298;--bs-secondary-border-subtle:#41464b;--bs-success-border-subtle:#0f5132;--bs-info-border-subtle:#087990;--bs-warning-border-subtle:#997404;--bs-danger-border-subtle:#842029;--bs-light-border-subtle:#495057;--bs-dark-border-subtle:#343a40;--bs-heading-color:inherLine truncated
|
||||
/*# sourceMappingURL=bootstrap.min.css.map */
|
||||
@@ -0,0 +1,2 @@
|
||||
!function(){function e(e){return e&&e.__esModule?e.default:e}function t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}function s(e,i){return!i||"object"!=((n=i)&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof i?t(e):i;var n}var u;function c(e){return Array.isArray(e)||"[object Object]"=={}.toString.call(e)}function d(e){return!e||"object"!=typeof e&&"function"!=typeof e}u=function e(){var t=[].slice.call(arguments),i=!1;"boolean"==typeof t[0]&&(i=t.shift());var n=t[0];if(d(n))throw new Error("extendee must be an object");for(var r=t.slice(1),a=r.length,o=0;o<a;o++){var l=r[o];for(var s in l)if(Object.prototype.hasOwnProperty.call(l,s)){var u=l[s];if(i&&c(u)){var h=Array.isArray(u)?[]:{};n[s]=e(!0,Object.prototype.hasOwnProperty.call(n,s)&&!d(n[s])?n[s]:h,u)}else n[s]=u}}return n};var h=function(){"use strict";function e(){i(this,e)}return r(e,[{key:"on",value:function(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}},{key:"emit",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];this._callbacks=this._callbacks||{};var r=this._callbacks[e],a=!0,o=!1,l=void 0;if(r)try{for(var s,u=r[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var c=s.value;c.apply(this,i)}}catch(e){o=!0,l=e}finally{try{a||null==u.return||u.return()}finally{if(o)throw l}}return this.element&&this.element.dispatchEvent(this.makeEvent("dropzone:"+e,{args:i})),this}},{key:"makeEvent",value:function(e,t){var i={bubbles:!0,cancelable:!0,detail:t};if("function"==typeof window.CustomEvent)return new CustomEvent(e,i);var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,i.bubbles,i.cancelable,i.detail),n}},{key:"off",value:function(e,t){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;var i=this._callbacks[e];if(!i)return this;if(1===arguments.length)return delete this._callbacks[e],this;for(var n=0;n<i.length;n++){var r=i[n];if(r===t){i.splice(n,1);break}}return this}}]),e}();var p={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2e6,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(e,t,i){if(i)return{dzuuid:i.file.upload.uuid,dzchunkindex:i.index,dztotalfilesize:i.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:i.file.upload.totalChunkCount,dzchunkbyteoffset:i.index*this.options.chunkSize}},accept:function(e,t){return t()},chunksUploaded:function(e,t){t()},fallback:function(){var e;this.element.className="".concat(this.element.className," dz-browser-not-supported");var t=!0,i=!1,n=void 0;try{for(var r,a=this.element.getElementsByTagName("div")[Symbol.iterator]();!(t=(r=a.next()).done);t=!0){var o=r.value;if(/(^| )dz-message($| )/.test(o.clLine truncated
|
||||
//# sourceMappingURL=dropzone-min.js.map
|
||||
@@ -0,0 +1 @@
|
||||
@keyframes passing-through{0%{opacity:0;transform:translateY(40px)}30%,70%{opacity:1;transform:translateY(0px)}100%{opacity:0;transform:translateY(-40px)}}@keyframes slide-in{0%{opacity:0;transform:translateY(40px)}30%{opacity:1;transform:translateY(0px)}}@keyframes pulse{0%{transform:scale(1)}10%{transform:scale(1.1)}20%{transform:scale(1)}}.dropzone,.dropzone *{box-sizing:border-box}.dropzone{min-height:150px;border:1px solid rgba(0,0,0,.8);border-radius:5px;padding:20px 20px}.dropzone.dz-clickable{cursor:pointer}.dropzone.dz-clickable *{cursor:default}.dropzone.dz-clickable .dz-message,.dropzone.dz-clickable .dz-message *{cursor:pointer}.dropzone.dz-started .dz-message{display:none}.dropzone.dz-drag-hover{border-style:solid}.dropzone.dz-drag-hover .dz-message{opacity:.5}.dropzone .dz-message{text-align:center;margin:2em 0}.dropzone .dz-message .dz-button{background:none;color:inherit;border:none;padding:0;font:inherit;cursor:pointer;outline:inherit}.dropzone .dz-preview{position:relative;display:inline-block;vertical-align:top;margin:16px;min-height:100px}.dropzone .dz-preview:hover{z-index:1000}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview.dz-file-preview .dz-image{border-radius:20px;background:#999;background:linear-gradient(to bottom, #eee, #ddd)}.dropzone .dz-preview.dz-file-preview .dz-details{opacity:1}.dropzone .dz-preview.dz-image-preview{background:#fff}.dropzone .dz-preview.dz-image-preview .dz-details{transition:opacity .2s linear}.dropzone .dz-preview .dz-remove{font-size:14px;text-align:center;display:block;cursor:pointer;border:none}.dropzone .dz-preview .dz-remove:hover{text-decoration:underline}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview .dz-details{z-index:20;position:absolute;top:0;left:0;opacity:0;font-size:13px;min-width:100%;max-width:100%;padding:2em 1em;text-align:center;color:rgba(0,0,0,.9);line-height:150%}.dropzone .dz-preview .dz-details .dz-size{margin-bottom:1em;font-size:16px}.dropzone .dz-preview .dz-details .dz-filename{white-space:nowrap}.dropzone .dz-preview .dz-details .dz-filename:hover span{border:1px solid rgba(200,200,200,.8);background-color:rgba(255,255,255,.8)}.dropzone .dz-preview .dz-details .dz-filename:not(:hover){overflow:hidden;text-overflow:ellipsis}.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span{border:1px solid transparent}.dropzone .dz-preview .dz-details .dz-filename span,.dropzone .dz-preview .dz-details .dz-size span{background-color:rgba(255,255,255,.4);padding:0 .4em;border-radius:3px}.dropzone .dz-preview:hover .dz-image img{transform:scale(1.05, 1.05);filter:blur(8px)}.dropzone .dz-preview .dz-image{border-radius:20px;overflow:hidden;width:120px;height:120px;position:relative;display:block;z-index:10}.dropzone .dz-preview .dz-image img{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview.dz-error .dz-error-mark{opacity:1;animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview .dz-success-mark,.dropzone .dz-preview .dz-error-mark{pointer-events:none;opacity:0;z-index:500;position:absolute;display:block;top:50%;left:50%;margin-left:-27px;margin-top:-27px;background:rgba(0,0,0,.8);border-radius:50%}.dropzone .dz-preview .dz-success-mark svg,.dropzone .dz-preview .dz-error-mark svg{display:block;width:54px;height:54px;fill:#fff}.dropzone .dz-preview.dz-processing .dz-progress{opacity:1;transition:all .2s linear}.dropzone .dz-preview.dz-complete .dz-progress{opacity:0;transition:opacity .4s ease-in}.dropzone .dz-preview:not(.dz-processing) .dz-progress{animation:pulse 6s ease infinite}.dropzone .dz-preview .dz-progress{opacity:1;z-index:1000;pointer-events:none;position:absolute;height:20px;top:50%;margin-top:-10px;left:15%;right:15%;border:3px solid rgba(0,0,0,.8);background:rgba(0,0,0,.8);border-radius:10px;overflow:hidden}.dropzone .dz-preview .dz-progress .dz-upload{background:#fff;display:block;position:relative;height:100%;width:0;transition:width 300ms ease-in-out;border-radius:17px}.dropzone .dz-preview.dz-error .dz-error-message{display:block}.dropzone .dz-preview.dz-error:hover .dz-error-message{opacity:1;pointer-events:auto}.dropzone .dz-preview .dz-error-message{pointer-events:none;z-index:1000;position:absolute;display:block;display:none;opacity:0;transition:opacity .3s ease;border-radius:8px;font-size:13px;top:130px;left:-10px;width:140px;background:#b10606;padding:.5em 1em;color:#fff}.dropzone .dz-preview .dz-error-message:after{content:"";position:absolute;top:-6px;left:64px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #b10606}/*# sourceMappingURL=dropzone.css.map */
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
Pictogrammers Free License
|
||||
--------------------------
|
||||
|
||||
This icon collection is released as free, open source, and GPL friendly by
|
||||
the [Pictogrammers](http://pictogrammers.com/) icon group. You may use it
|
||||
for commercial projects, open source projects, or anything really.
|
||||
|
||||
# Icons: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
|
||||
Some of the icons are redistributed under the Apache 2.0 license. All other
|
||||
icons are either redistributed under their respective licenses or are
|
||||
distributed under the Apache 2.0 license.
|
||||
|
||||
# Fonts: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
|
||||
All web and desktop fonts are distributed under the Apache 2.0 license. Web
|
||||
and desktop fonts contain some icons that are redistributed under the Apache
|
||||
2.0 license. All other icons are either redistributed under their respective
|
||||
licenses or are distributed under the Apache 2.0 license.
|
||||
|
||||
# Code: MIT (https://opensource.org/licenses/MIT)
|
||||
The MIT license applies to all non-font and non-icon files.
|
||||
@@ -0,0 +1,3 @@
|
||||
@font-face{font-family:"Material Design Icons";src:url("../fonts/materialdesignicons-webfont.eot?v=7.4.47");src:url("../fonts/materialdesignicons-webfont.eot?#iefix&v=7.4.47") format("embedded-opentype"),url("../fonts/materialdesignicons-webfont.woff2?v=7.4.47") format("woff2"),url("../fonts/materialdesignicons-webfont.woff?v=7.4.47") format("woff"),url("../fonts/materialdesignicons-webfont.ttf?v=7.4.47") format("truetype");font-weight:normal;font-style:normal}.mdi:before,.mdi-set{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.mdi-ab-testing::before{content:"\F01C9"}.mdi-abacus::before{content:"\F16E0"}.mdi-abjad-arabic::before{content:"\F1328"}.mdi-abjad-hebrew::before{content:"\F1329"}.mdi-abugida-devanagari::before{content:"\F132A"}.mdi-abugida-thai::before{content:"\F132B"}.mdi-access-point::before{content:"\F0003"}.mdi-access-point-check::before{content:"\F1538"}.mdi-access-point-minus::before{content:"\F1539"}.mdi-access-point-network::before{content:"\F0002"}.mdi-access-point-network-off::before{content:"\F0BE1"}.mdi-access-point-off::before{content:"\F1511"}.mdi-access-point-plus::before{content:"\F153A"}.mdi-access-point-remove::before{content:"\F153B"}.mdi-account::before{content:"\F0004"}.mdi-account-alert::before{content:"\F0005"}.mdi-account-alert-outline::before{content:"\F0B50"}.mdi-account-arrow-down::before{content:"\F1868"}.mdi-account-arrow-down-outline::before{content:"\F1869"}.mdi-account-arrow-left::before{content:"\F0B51"}.mdi-account-arrow-left-outline::before{content:"\F0B52"}.mdi-account-arrow-right::before{content:"\F0B53"}.mdi-account-arrow-right-outline::before{content:"\F0B54"}.mdi-account-arrow-up::before{content:"\F1867"}.mdi-account-arrow-up-outline::before{content:"\F186A"}.mdi-account-badge::before{content:"\F1B0A"}.mdi-account-badge-outline::before{content:"\F1B0B"}.mdi-account-box::before{content:"\F0006"}.mdi-account-box-edit-outline::before{content:"\F1CC8"}.mdi-account-box-minus-outline::before{content:"\F1CC9"}.mdi-account-box-multiple::before{content:"\F0934"}.mdi-account-box-multiple-outline::before{content:"\F100A"}.mdi-account-box-outline::before{content:"\F0007"}.mdi-account-box-plus-outline::before{content:"\F1CCA"}.mdi-account-cancel::before{content:"\F12DF"}.mdi-account-cancel-outline::before{content:"\F12E0"}.mdi-account-card::before{content:"\F1BA4"}.mdi-account-card-outline::before{content:"\F1BA5"}.mdi-account-cash::before{content:"\F1097"}.mdi-account-cash-outline::before{content:"\F1098"}.mdi-account-check::before{content:"\F0008"}.mdi-account-check-outline::before{content:"\F0BE2"}.mdi-account-child::before{content:"\F0A89"}.mdi-account-child-circle::before{content:"\F0A8A"}.mdi-account-child-outline::before{content:"\F10C8"}.mdi-account-circle::before{content:"\F0009"}.mdi-account-circle-outline::before{content:"\F0B55"}.mdi-account-clock::before{content:"\F0B56"}.mdi-account-clock-outline::before{content:"\F0B57"}.mdi-account-cog::before{content:"\F1370"}.mdi-account-cog-outline::before{content:"\F1371"}.mdi-account-convert::before{content:"\F000A"}.mdi-account-convert-outline::before{content:"\F1301"}.mdi-account-cowboy-hat::before{content:"\F0E9B"}.mdi-account-cowboy-hat-outline::before{content:"\F17F3"}.mdi-account-credit-card::before{content:"\F1BA6"}.mdi-account-credit-card-outline::before{content:"\F1BA7"}.mdi-account-details::before{content:"\F0631"}.mdi-account-details-outline::before{content:"\F1372"}.mdi-account-edit::before{content:"\F06BC"}.mdi-account-edit-outline::before{content:"\F0FFB"}.mdi-account-eye::before{content:"\F0420"}.mdi-account-eye-outline::before{content:"\F127B"}.mdi-account-file::before{content:"\F1CA7"}.mdi-account-file-outline::before{content:"\F1CA8"}.mdi-account-file-text::before{content:"\F1CA9"}.mdi-account-file-text-outline::before{content:"\F1CAA"}.mdi-account-filter::before{content:"\F0936"}.mdi-account-filter-outline::before{content:"\F0F9D"}.mdi-account-group::before{content:"\F0849"}.mdi-account-group-outline::before{content:"\F0B58"}.mdi-account-hard-hat::before{content:"\F05B5"}.mdi-account-hard-hat-outline::before{content:"\F1A1F"}.mdi-account-heart::before{content:"\F0899"}.mdi-account-heart-outline::before{content:"\F0BE3"}.mdi-account-injury::before{content:"\F1815"}.mdi-account-injury-outline::before{content:"\F1816"}.mdi-account-key::before{content:"\F000B"}.mdi-account-key-outline::before{content:"\F0BE4"}.mdi-account-lock::before{content:"\F115E"}.mdi-account-lock-open::before{content:"\F1960"}.mdi-account-lock-open-outline::before{content:"\F1961"}.mdi-account-lock-outline::before{content:"\F115F"}.mdi-account-minus::before{content:"\F000D"}.mdi-account-minus-outline::before{content:"\F0AEC"}.mdi-account-multiple::before{content:"\F000E"}.mdi-account-multiple-check::before{content:"\F08C5"}.mdi-account-multiple-check-outline::before{contentLine truncated
|
||||
|
||||
/*# sourceMappingURL=materialdesignicons.css.map */
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
<%# Above brother_ql_web's label designer, which has no Bootstrap: styled here,
|
||||
and a row of the designer's page grid (its top bar and view follow) %>
|
||||
<style>
|
||||
body { grid-template-rows: auto 58px 1fr !important; }
|
||||
.lp-bar { display: flex; align-items: center; gap: .2rem; padding: 0 .8rem; height: 36px; background: #212529; font: 14px/1 system-ui, sans-serif; overflow-x: auto; }
|
||||
.lp-bar a { color: rgba(255, 255, 255, .65); text-decoration: none; padding: .45rem .6rem; white-space: nowrap; }
|
||||
.lp-bar a:hover, .lp-bar a.active { color: #fff; }
|
||||
.lp-bar .lp-brand { color: #fff; font-size: 16px; margin-right: .6rem; display: inline-flex; align-items: center; gap: .3rem; }
|
||||
.lp-bar i { display: inline-block; line-height: 1; }
|
||||
.lp-bar .sep { border-left: 1px solid rgba(255, 255, 255, .25); }
|
||||
</style>
|
||||
<nav class="lp-bar">
|
||||
<a class="lp-brand" href="/"><i class="mdi mdi-printer"></i> Print server</a>
|
||||
<a href="/">Home</a>
|
||||
<a class="sep active" href="/labelburg">Labelburg</a>
|
||||
<a href="/upload">Shipping labels</a>
|
||||
<a href="/epson">Receipts</a>
|
||||
<a class="sep" href="/repository">Labels</a>
|
||||
</nav>
|
||||
+5
-13
@@ -1,6 +1,6 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Print server</a>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-4">
|
||||
<div class="container-fluid d-flex align-items-center">
|
||||
<a class="navbar-brand" href="/"><i class="mdi mdi-printer"></i> Print server</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
@@ -10,7 +10,7 @@
|
||||
<a class="nav-link <%= 'active' if request.path == '/' %>" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= 'active' if request.path.start_with?('/brother') %>" href="/brother">Brother</a>
|
||||
<a class="nav-link border-start <%= 'active' if request.path.start_with?('/labelburg') %>" href="/labelburg">Labelburg</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= 'active' if request.path == '/upload' %>" href="/upload">Shipping labels</a>
|
||||
@@ -19,17 +19,9 @@
|
||||
<a class="nav-link <%= 'active' if request.path == '/epson' %>" href="/epson">Receipts</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= 'active' if request.path.start_with?('/labels') %>" href="/labels">Labels</a>
|
||||
<a class="nav-link border-start <%= 'active' if request.path.start_with?('/repository') %>" href="/repository">Labels</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% if request.path.start_with?('/brother') %>
|
||||
<span class="navbar-text me-2">Printer:</span>
|
||||
<div class="d-flex gap-1">
|
||||
<% BROTHER_PRINTERS.each do |key, info| %>
|
||||
<a href="/brother/<%= key %>/" class="btn btn-sm <%= request.path.start_with?("/brother/#{key}/") ? 'btn-primary' : 'btn-outline-secondary' %>"><%= info[:label].sub('Brother ', '') %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -1,8 +0,0 @@
|
||||
<h1>Brother printers</h1>
|
||||
<p>Choose a printer to open its label designer through this server.</p>
|
||||
|
||||
<div class="list-group" style="max-width: 400px;">
|
||||
<% @printers.each do |key, info| %>
|
||||
<a href="/brother/<%= key %>/" class="btn btn-outline-primary w-100 text-start mb-2"><%= info[:label] %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
+5
-1
@@ -15,6 +15,10 @@
|
||||
<button class="btn btn-secondary" type="submit">Print</button>
|
||||
</form>
|
||||
|
||||
<form action="/epson/test-print" method="POST" class="mt-3">
|
||||
<button class="btn btn-outline-secondary" type="submit">Print test page (sizes, barcode, QR, image)</button>
|
||||
</form>
|
||||
|
||||
<hr class="mt-4">
|
||||
|
||||
<h5>Free text (ESC/POS mnemonic notation)</h5>
|
||||
@@ -47,4 +51,4 @@ GS V 0x00 # Full cut</code></pre>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="mt-4"><a href="/labels">See saved receipts →</a></p>
|
||||
<p class="mt-4"><a href="/repository">See saved receipts →</a></p>
|
||||
+1
-11
@@ -5,17 +5,7 @@
|
||||
<ul>
|
||||
<li>Datamax-ONeil E4204B Mark III (ZPL, 100x150) -- <a href="/upload">Shipping labels</a></li>
|
||||
<li>Epson TM-T20II (ESC/POS) -- <a href="/epson">Receipts</a></li>
|
||||
<li>Brother QL-560, QL-700, QL-1100 -- <a href="/brother">Brother</a></li>
|
||||
<li>Brother QL-560, QL-700, QL-1100, PT-E550W, PUQU Q00, Reekon P1L, Niimbot D110, Epson TM-T20II -- <a href="/labelburg">Labelburg</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">home-gitops open issues</h5>
|
||||
<p class="card-text">Print a receipt-style summary of currently open issues.</p>
|
||||
<form action="/issues/print" method="POST">
|
||||
<button class="btn btn-secondary" type="submit">Print open issues</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -6,7 +6,7 @@
|
||||
<span class="badge bg-info text-dark">ESC/POS · Epson</span>
|
||||
<% end %>
|
||||
|
||||
<form action="/labels/<%= @label['id'] %>" method="POST" class="mt-3">
|
||||
<form action="/repository/<%= @label['id'] %>" method="POST" class="mt-3">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<input name="name" class="form-control" type="text" id="name" value="<%= @label['name'] %>" />
|
||||
@@ -16,5 +16,5 @@
|
||||
<textarea name="content" class="form-control" id="content" rows="12" style="font-family: monospace;"><%= @label['content'] %></textarea>
|
||||
</div>
|
||||
<button class="btn btn-secondary" type="submit">Save</button>
|
||||
<a href="/labels" class="btn btn-outline-secondary">Cancel</a>
|
||||
<a href="/repository" class="btn btn-outline-secondary">Cancel</a>
|
||||
</form>
|
||||
+7
-6
@@ -5,12 +5,13 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAD9/f0AAAAAAOzs7ADl5eUA/Pz8ACsZBgD+/v4AAwMDAPv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEWZmZmZmIxERZmZmZmZmERFmZmZmZmYREWZmZoZmZhERZmYUVmZmERFmYREWZmYREWYRERFmZhERZhYREXZmERFmZmYRZmYREWZmZhFmZhERZmZmERFmERFmZmYHEWYREWZmZmZmZhERZmZmZmZmERFmZmZmZmYREWZmZmZmZhHAAwAAwAMAAMADAADAAwAAwAMAAMADAADAAwAAwAMAAMADAADAAwAAwAMAAMADAADAAwAAwAMAAMADAADAAwAA" rel="icon" type="image/x-icon" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<link href="https://unpkg.com/dropzone@6.0.0-beta.1/dist/dropzone.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/vendor/bootstrap-5.3.8/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="/vendor/mdi-7.4.47/css/materialdesignicons.min.css" rel="stylesheet">
|
||||
<link href="/vendor/dropzone-6.0.0-beta.1/dropzone.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<%= erb :_navbar, layout: false %>
|
||||
<main class="container-fluid px-4">
|
||||
<div class="row">
|
||||
<% if @alert_success then %>
|
||||
<div class="alert alert-success"><%=@alert_success%></div>
|
||||
@@ -23,9 +24,9 @@
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
||||
<script src="https://unpkg.com/dropzone@6.0.0-beta.1/dist/dropzone-min.js"></script>
|
||||
</main>
|
||||
<script src="/vendor/bootstrap-5.3.8/bootstrap.bundle.min.js"></script>
|
||||
<script src="/vendor/dropzone-6.0.0-beta.1/dropzone-min.js"></script>
|
||||
<script>
|
||||
Dropzone.options.UploadForm = {
|
||||
paramFile: "file",
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
<strong class="ms-2"><%= label['name'] %></strong>
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<form action="/labels/<%= label['id'] %>/print" method="POST">
|
||||
<form action="/repository/<%= label['id'] %>/print" method="POST">
|
||||
<button class="btn btn-sm btn-secondary" type="submit">Print</button>
|
||||
</form>
|
||||
<a href="/labels/<%= label['id'] %>/edit" class="btn btn-sm btn-outline-secondary">Edit</a>
|
||||
<form action="/labels/<%= label['id'] %>/delete" method="POST">
|
||||
<a href="/repository/<%= label['id'] %>/edit" class="btn btn-sm btn-outline-secondary">Edit</a>
|
||||
<form action="/repository/<%= label['id'] %>/delete" method="POST">
|
||||
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<div class="mt-2">
|
||||
<% if label['type'] == 'zpl' %>
|
||||
<img src="/labels/<%= label['id'] %>/preview.png" alt="preview" style="max-height: 150px;" onerror="this.remove()" />
|
||||
<img src="/repository/<%= label['id'] %>/preview.png" alt="preview" style="max-height: 150px;" onerror="this.remove()" />
|
||||
<% else %>
|
||||
<pre class="bg-light p-2 mb-0" style="max-height: 150px; overflow: auto;"><%= label['content'] %></pre>
|
||||
<% end %>
|
||||
+1
-1
@@ -33,4 +33,4 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="mt-4"><a href="/labels">See saved labels →</a></p>
|
||||
<p class="mt-4"><a href="/repository">See saved labels →</a></p>
|
||||
Reference in new issue
Block a user