Author SHA1 Message Date
randy 99b900b127 Update dependency puma to v8.1.2 2026-11-23 05:01:37 +00:00
randy 320679cedd Labelburg instead of Labelhaus: the project was renamed again
deploy / deploy (push) Successful in 7s
The proxy and links are below /labelburg, /labelhaus and /brother are
redirected there.
2026-11-09 20:24:11 +01:00
randy b1cfe03fa1 Labelhaus instead of Brother: brother_ql_web was renamed
deploy / deploy (push) Successful in 6s
The proxy and links are below /labelhaus, the old /brother addresses are
redirected there. The home page names all printers it prints on.
2026-11-09 20:14:28 +01:00
randy 06bfa6f537 Brand of the bar above brother_ql_web clashed with the designer's .brand
deploy / deploy (push) Successful in 6s
2026-11-04 12:34:28 +01:00
randy d5db7ded9e Own bar above the new brother_ql_web label designer, which has no Bootstrap
deploy / deploy (push) Successful in 5s
The Bootstrap navbar was injected without Bootstrap and took the first row of
the designer's page grid, its top bar was stretched to the height of the page.
2026-11-04 12:32:37 +01:00
randy a76c35304c Renovate: run in the official image instead of npm install
deploy / deploy (push) Successful in 8s
npm picks a Renovate whose engines.node matches the runtime, so with
setup-node on a non-matching major it silently installed an old,
unsupported Renovate (37.x on Node 26). The image ships its own Node,
skips the per-run install and its warnings, and installs tools like
bundler on demand.
2026-11-03 18:22:05 +01:00
randy 357b178547 Update dependency node to v26
deploy / deploy (push) Successful in 22s
2026-11-02 05:05:11 +00:00
randy 4d366e8470 Fit PDF pages wider than the label onto it
deploy / deploy (push) Successful in 9s
A label in landscape or a letter page was cut off: the PDF was rendered
1:1 at 203 dpi and the Datamax printed only what fits its width. Pages
wider than the A6 label (105 x 148 mm, as set up in the printer) are now
rendered again fitted onto the label, which Ghostscript turns to portrait
when that fits better. Pages that fit, like the shipping labels, still
print 1:1.
2026-11-01 19:00:25 +01:00
randy 0f7c18141b Serve Bootstrap, MDI and Dropzone locally, self-contained 502 page
deploy / deploy (push) Successful in 9s
The print server has to work without internet. The stylesheets, scripts
and icon fonts came from jsdelivr and unpkg, offline the pages had no
styles, icons or drag and drop. They are now in public/vendor, the same
versions. The 502 page of nginx has its styles and the icon inline, as
the app's files are not there while it is down. The proxied brother_ql_web
pages get the MDI stylesheet for the navbar's printer icon, which was
missing there.
2026-11-01 18:11:59 +01:00
randy 563772197d Brother: proxy one brother_ql_web for all QL printers, drop printer switcher
deploy / deploy (push) Successful in 10s
2026-10-30 23:52:36 +01:00
randy 66300c5278 Navbar: mb-0 on proxied brother pages (brother_ql_web's CSS adds margin to every .navbar)
deploy / deploy (push) Successful in 10s
2026-10-30 14:01:44 +01:00
randy 874159199a Navbar: no bottom margin above proxied brother_ql_web navbar
deploy / deploy (push) Successful in 10s
2026-10-30 13:59:51 +01:00
randy 7dabfb6223 Brother proxy: rewind request body before forwarding (Rack 3 leaves it consumed)
deploy / deploy (push) Successful in 12s
2026-10-30 13:56:55 +01:00
randy fc59cf595e Add a friendly 502/503/504 page (nginx serves it directly, no backend needed)
deploy / deploy (push) Successful in 9s
2026-09-15 22:31:08 +02:00
randy 7ea03e5bc5 Rename /labels route to /repository
deploy / deploy (push) Successful in 9s
2026-09-15 22:29:10 +02:00
randy 61d190ed91 Move behind nginx reverse proxy: app binds 127.0.0.1:4567, nginx owns :80
deploy / deploy (push) Successful in 11s
Avoids the cap_net_bind_service dance breaking on every RVM ruby patch
upgrade (it happened today after today's ruby-4.0.7 install).
2026-09-15 22:24:40 +02:00
randy 46fd345b7f Match klikatko/mc-panel look: dark navbar, Bootstrap 5.3.8, MDI icons
deploy / deploy (push) Successful in 12s
2026-09-15 22:17:49 +02:00
randy 4308850a2e Test page: replace inverted section banners with plain '=' rules, frame page with '-'
deploy / deploy (push) Successful in 10s
Matches the style settled on for the print-issues receipt -- '=' for
labeled section breaks, '-' for the plain top/bottom frame, no more
fully blacked-out rows.
2026-09-13 12:40:00 +02:00
randy a58d4b66ea Update README: Epson routes, API usage example with the home-gitops print-issues workflow
deploy / deploy (push) Successful in 9s
2026-09-13 12:35:24 +02:00
randy ec9278c0dd Remove doubled-up padding on the divider links, add explicit flex align to the brand row
deploy / deploy (push) Successful in 9s
ps-3 stacked on top of nav-link's own padding made the gap after the
border look uneven -- nav-link's built-in padding is enough on its own.
2026-09-13 12:20:45 +02:00
randy f351212395 Fix navbar dividers: border-start on the link itself instead of a standalone vr div
deploy / deploy (push) Successful in 10s
The vr utility needs stretch alignment from its flex parent to size
correctly -- inside a plain nav-item li it collapsed/misaligned instead
of showing as a clean vertical rule.
2026-09-13 12:18:00 +02:00
randy eafea9f728 Add visual separators: inverted banner sections on receipts, dividers in navbar
deploy / deploy (push) Successful in 9s
ReceiptBuilder#invert (GS B) + #section_separator give the test page (and
future receipts) a full-width white-on-black banner between sections --
the closest a direct-thermal printer gets to a second color. Navbar gets
a vr divider between Home | Brother/Shipping labels/Receipts | Labels to
group the three logical clusters.
2026-09-13 12:16:09 +02:00
randy f8857384fd Shorten default barcode height -- printer default (~162 dots) prints noticeably tall
deploy / deploy (push) Successful in 10s
2026-09-13 12:12:28 +02:00
randy d2900361b3 Add Epson test page: text sizes, EAN-13, QR, and a raster image
deploy / deploy (push) Successful in 9s
ReceiptBuilder#image implements GS v 0 raster printing (no image library
needed for the demo -- a procedural 8px checkerboard proves it end to
end). Skipped attempting the printer's real-time clock: unsure the
TM-T20II actually has a battery-backed RTC (that's usually an option on
higher-end models), not worth guessing at an undocumented command.
2026-09-13 12:09:52 +02:00
randy 790d716d57 Fix ESC/POS notation parser: '#' only starts a comment as its own token
deploy / deploy (push) Successful in 9s
Stripping from the first '#' anywhere in the line ate content like '#5
Fix thing' (an issue reference) entirely, since it starts with '#' with
no preceding whitespace. Comments now only trigger on a standalone '#'
token (i.e. whitespace on both sides), matching the documented examples.
2026-09-13 11:51:36 +02:00
24 changed files with 356 additions and 99 deletions

No files matched your search

+10 -8
View File
@@ -8,15 +8,15 @@ on:
jobs: jobs:
renovate: renovate:
runs-on: ubuntu-latest 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: steps:
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: "24"
- name: Install Renovate
run: npm install -g renovate
- name: Run Renovate - name: Run Renovate
run: renovate run: renovate
env: env:
@@ -25,4 +25,6 @@ jobs:
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }} RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
RENOVATE_REPOSITORIES: "${{ gitea.repository }}" RENOVATE_REPOSITORIES: "${{ gitea.repository }}"
RENOVATE_ONBOARDING: "false" RENOVATE_ONBOARDING: "false"
RENOVATE_BINARY_SOURCE: install
# Secret named GH_COM_TOKEN: Gitea reserves the GITHUB_ prefix.
GITHUB_COM_TOKEN: ${{ secrets.GH_COM_TOKEN }} GITHUB_COM_TOKEN: ${{ secrets.GH_COM_TOKEN }}
+2 -1
View File
@@ -8,7 +8,7 @@ GEM
mustermann (3.1.1) mustermann (3.1.1)
nio4r (2.7.5) nio4r (2.7.5)
ostruct (0.6.3) ostruct (0.6.3)
puma (8.0.2) puma (8.1.2)
nio4r (~> 2.0) nio4r (~> 2.0)
rack (3.2.6) rack (3.2.6)
rack-protection (4.2.1) rack-protection (4.2.1)
@@ -42,6 +42,7 @@ GEM
PLATFORMS PLATFORMS
aarch64-linux aarch64-linux
armv7l-linux-eabihf armv7l-linux-eabihf
x86_64-linux
DEPENDENCIES DEPENDENCIES
logger logger
+35 -9
View File
@@ -1,17 +1,41 @@
= labelprint = labelprint
Unified UI for printing labels/stickers: Unified UI for printing labels/receipts:
* Native ZPL printing to a Datamax-ONeil thermal barcode printer * 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 == Routes
* `/` -- upload a PDF and print it (ZPL) * `/` -- home page, links to everything below
* `/upload` -- upload form * `/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.
* `/test-print` -- print the bundled test label * `POST /shipping/zpl` -- print raw ZPL text (see "API usage" below)
* `/brother` -- list of Brother QL printers * `/test-print` -- print the bundled Datamax test label
* `/brother/<printer>/*` -- proxied to that printer's brother_ql_web instance (UI and API alike) * `/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 == Running
@@ -25,10 +49,12 @@ Requires `config.json` (see printer definitions inside) and a `.session_secret`
== Deployment == 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 == 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. `.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).
+135 -43
View File
@@ -8,8 +8,10 @@ require_relative 'lib/label_repository'
set :protection, :except => :frame_options set :protection, :except => :frame_options
set :environment, :production set :environment, :production
set :bind, "::" # nginx reverse-proxies :80 -> here. Loopback-only and an unprivileged port
set :port, 80 # 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') if !File.exist?('config.json') || !File.readable?('config.json')
raise RuntimeException, 'Could not read config.json' raise RuntimeException, 'Could not read config.json'
@@ -20,6 +22,7 @@ end
# controller -- back to the kernel driver via a stable udev symlink instead. # 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_DEVICE = '/dev/usb/lp_datamax' # see /etc/udev/rules.d/99-datamax.rules
PRINTER_DPI = 203 # DatamaxONeil E4204B Mark III native head resolution 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 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') TEST_LABEL_PDF = File.join(File.dirname(__FILE__), 'test-label.pdf')
@@ -27,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')) LABEL_REPO = LabelRepository.new(File.join(File.dirname(__FILE__), 'data', 'labels'))
BROTHER_PRINTERS = { BROTHER_PORT = 8013 # one brother_ql_web for all QL printers (its PRINTERS env)
'ql560' => { port: 8560, label: 'Brother QL-560' },
'ql700' => { port: 8700, label: 'Brother QL-700' },
'ql1100' => { port: 9100, label: 'Brother QL-1100' }
}.freeze
configure do configure do
enable :static enable :static
@@ -63,17 +62,35 @@ helpers do
# Renders a PDF to ZPL ^GFA graphic labels at the printer's native DPI, # 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 # bypassing CUPS/Gutenprint's raster pipeline which blurs text and 1px-shifts
# output compared to native ZPL rendering. # 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) def pdf_to_zpl(pdf_path, dpi: PRINTER_DPI)
Dir.mktmpdir do |dir| 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', ok = system('gs', '-q', '-dNOPAUSE', '-dBATCH', '-dSAFER',
'-sDEVICE=pbmraw', "-r#{dpi}", '-sDEVICE=pbmraw', "-r#{dpi}", *options,
'-dTextAlphaBits=4', '-dGraphicsAlphaBits=4', '-dTextAlphaBits=4', '-dGraphicsAlphaBits=4',
"-sOutputFile=#{pattern}", pdf_path) "-sOutputFile=#{File.join(dir, 'page-%03d.pbm')}", pdf_path)
raise 'ghostscript rendering failed' unless ok 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 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 end
def pbm_to_zpl_label(pbm_path) def pbm_to_zpl_label(pbm_path)
@@ -107,6 +124,56 @@ helpers do
receipt.print!(PRINTER_DEVICE_EPSON) receipt.print!(PRINTER_DEVICE_EPSON)
end 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 = { ESCPOS_MNEMONICS = {
'ESC' => "\x1B", 'GS' => "\x1D", 'FS' => "\x1C", 'DLE' => "\x10", 'ESC' => "\x1B", 'GS' => "\x1D", 'FS' => "\x1C", 'DLE' => "\x10",
'LF' => "\x0A", 'CR' => "\x0D", 'HT' => "\x09", 'NUL' => "\x00" 'LF' => "\x0A", 'CR' => "\x0D", 'HT' => "\x09", 'NUL' => "\x00"
@@ -117,17 +184,23 @@ helpers do
# Hello # literal text # Hello # literal text
# LF # LF
# GS k 0x03 12345678 0x00 # GS k 0x03 12345678 0x00
# Each `#...` trailing comment is stripped, then each line's # A trailing comment is only a comment when "#" is its own
# whitespace-separated tokens become either a known control mnemonic, a # whitespace-separated token -- not just stripped from the first "#"
# raw `0xNN` byte, or literal text (CP852-encoded) -- consecutive literal # anywhere in the line, which would mangle literal text like "#5 Fix
# tokens are rejoined with a single space so plain prose still reads # thing" (an issue reference, not a comment). Each remaining token
# correctly, while whitespace around control/byte tokens is dropped since # becomes a known control mnemonic, a raw `0xNN` byte, or literal text
# those are just for human readability, not printer output. # (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) def parse_escpos_notation(text)
bytes = "".b bytes = "".b
text.each_line do |line| text.each_line do |line|
prev_was_text = false 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) if ESCPOS_MNEMONICS.key?(token)
bytes << ESCPOS_MNEMONICS[token] bytes << ESCPOS_MNEMONICS[token]
prev_was_text = false prev_was_text = false
@@ -165,12 +238,10 @@ helpers do
res.body res.body
end end
# Transparently reverse-proxies the current request to one of the # Transparently reverse-proxies the current request to brother_ql_web, so
# brother_ql_web instances, so all three printers (web UI and API alike) # its web UI and API are reachable through this single sinatra port.
# are reachable through this single sinatra port instead of their own def proxy_to_brother(prefix, path)
# dedicated ports. uri = URI("http://127.0.0.1:#{BROTHER_PORT}#{path}")
def proxy_to_brother(port, prefix, path)
uri = URI("http://127.0.0.1:#{port}#{path}")
uri.query = request.query_string unless request.query_string.empty? uri.query = request.query_string unless request.query_string.empty?
proxied = Net::HTTP.const_get(request.request_method.capitalize).new(uri) proxied = Net::HTTP.const_get(request.request_method.capitalize).new(uri)
@@ -183,13 +254,20 @@ helpers do
proxied['Content-Type'] = request.content_type if request.content_type proxied['Content-Type'] = request.content_type if request.content_type
proxied['X-Forwarded-Prefix'] = prefix proxied['X-Forwarded-Prefix'] = prefix
proxied['X-Forwarded-Host'] = request.host 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) } res = Net::HTTP.start(uri.host, uri.port) { |http| http.request(proxied) }
body = res.body || '' body = res.body || ''
if res['Content-Type']&.include?('text/html') 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 end
headers = {} headers = {}
@@ -307,6 +385,16 @@ get '/epson' do
erb :epson erb :epson
end 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 post '/epson/print' do
begin begin
print_receipt(title: params[:title].to_s, body: params[:body].to_s, qr: params[:qr].to_s) print_receipt(title: params[:title].to_s, body: params[:body].to_s, qr: params[:qr].to_s)
@@ -356,27 +444,27 @@ post '/epson/raw' do
redirect '/epson' redirect '/epson'
end end
get '/labels' do get '/repository' do
@labels = LABEL_REPO.all @labels = LABEL_REPO.all
erb :labels erb :repository
end end
get '/labels/:id/edit' do get '/repository/:id/edit' do
@label = LABEL_REPO.find(params[:id]) @label = LABEL_REPO.find(params[:id])
halt 404, 'unknown label' unless @label halt 404, 'unknown label' unless @label
erb :label_edit erb :label_edit
end 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) label = LABEL_REPO.update(params[:id], name: params[:name].to_s, content: params[:content].to_s)
halt 404, 'unknown label' unless label halt 404, 'unknown label' unless label
flash "Saved '#{label['name']}'", 'success' flash "Saved '#{label['name']}'", 'success'
redirect '/labels' redirect '/repository'
end end
get '/labels/:id/preview.png' do get '/repository/:id/preview.png' do
label = LABEL_REPO.find(params[:id]) label = LABEL_REPO.find(params[:id])
halt 404 unless label && label['type'] == 'zpl' halt 404 unless label && label['type'] == 'zpl'
@@ -387,7 +475,7 @@ get '/labels/:id/preview.png' do
png png
end end
post '/labels/:id/print' do post '/repository/:id/print' do
label = LABEL_REPO.find(params[:id]) label = LABEL_REPO.find(params[:id])
halt 404, 'unknown label' unless label halt 404, 'unknown label' unless label
@@ -402,25 +490,29 @@ post '/labels/:id/print' do
rescue => e rescue => e
flash "Print failed (#{e.message})", 'danger' flash "Print failed (#{e.message})", 'danger'
end end
redirect '/labels' redirect '/repository'
end end
post '/labels/:id/delete' do post '/repository/:id/delete' do
LABEL_REPO.delete(params[:id]) LABEL_REPO.delete(params[:id])
flash 'Label deleted', 'success' flash 'Label deleted', 'success'
redirect '/labels' redirect '/repository'
end end
get '/brother' do get '/labelburg' do
@printers = BROTHER_PRINTERS redirect '/labelburg/'
erb :brother_picker
end end
%w[get post put delete].each do |verb| %w[get post put delete].each do |verb|
send(verb, '/brother/:printer/*') do send(verb, '/labelburg/*') do
printer = BROTHER_PRINTERS[params[:printer]] proxy_to_brother('/labelburg', '/' + params[:splat].first)
halt 404, 'unknown printer' unless printer 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
end end
+36 -2
View File
@@ -65,6 +65,28 @@ class ReceiptBuilder
self self
end 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) def size(mode)
@buffer << case mode @buffer << case mode
when :big then TXT_BIG when :big then TXT_BIG
@@ -87,12 +109,24 @@ class ReceiptBuilder
self self
end end
# Native ESC/POS EAN-13 # Native ESC/POS EAN-13. height is in dots (GS h) -- the printer's default
def ean13(code) # (~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" @buffer << "\x1D\x6B\x02" << code.b << "\x00"
self self
end 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) def feed(lines = 3)
@buffer << ("\n" * lines) @buffer << ("\n" * lines)
self self
+29
View File
@@ -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>
+26
View File
@@ -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;
}
}
+7
View File
@@ -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
+6
View File
@@ -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 */
+2
View File
@@ -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
+1
View File
@@ -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 */
+20
View File
@@ -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.
+19
View File
@@ -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
View File
@@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-4">
<div class="container-fluid"> <div class="container-fluid d-flex align-items-center">
<a class="navbar-brand" href="/">Print server</a> <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"> <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> <span class="navbar-toggler-icon"></span>
</button> </button>
@@ -10,7 +10,7 @@
<a class="nav-link <%= 'active' if request.path == '/' %>" href="/">Home</a> <a class="nav-link <%= 'active' if request.path == '/' %>" href="/">Home</a>
</li> </li>
<li class="nav-item"> <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>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <%= 'active' if request.path == '/upload' %>" href="/upload">Shipping labels</a> <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> <a class="nav-link <%= 'active' if request.path == '/epson' %>" href="/epson">Receipts</a>
</li> </li>
<li class="nav-item"> <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> </li>
</ul> </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>
</div> </div>
</nav> </nav>
-8
View File
@@ -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
View File
@@ -15,6 +15,10 @@
<button class="btn btn-secondary" type="submit">Print</button> <button class="btn btn-secondary" type="submit">Print</button>
</form> </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"> <hr class="mt-4">
<h5>Free text (ESC/POS mnemonic notation)</h5> <h5>Free text (ESC/POS mnemonic notation)</h5>
@@ -47,4 +51,4 @@ GS V 0x00 # Full cut</code></pre>
</div> </div>
</form> </form>
<p class="mt-4"><a href="/labels">See saved receipts &rarr;</a></p> <p class="mt-4"><a href="/repository">See saved receipts &rarr;</a></p>
+1 -1
View File
@@ -5,7 +5,7 @@
<ul> <ul>
<li>Datamax-ONeil E4204B Mark III (ZPL, 100x150) -- <a href="/upload">Shipping labels</a></li> <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>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> </ul>
</div> </div>
</div> </div>
+2 -2
View File
@@ -6,7 +6,7 @@
<span class="badge bg-info text-dark">ESC/POS &middot; Epson</span> <span class="badge bg-info text-dark">ESC/POS &middot; Epson</span>
<% end %> <% 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"> <div class="mb-3">
<label for="name" class="form-label">Name</label> <label for="name" class="form-label">Name</label>
<input name="name" class="form-control" type="text" id="name" value="<%= @label['name'] %>" /> <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> <textarea name="content" class="form-control" id="content" rows="12" style="font-family: monospace;"><%= @label['content'] %></textarea>
</div> </div>
<button class="btn btn-secondary" type="submit">Save</button> <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> </form>
+7 -6
View File
@@ -5,12 +5,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <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="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="/vendor/bootstrap-5.3.8/bootstrap.min.css" rel="stylesheet">
<link href="https://unpkg.com/dropzone@6.0.0-beta.1/dist/dropzone.css" rel="stylesheet" type="text/css" /> <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> </head>
<body> <body>
<div class="container">
<%= erb :_navbar, layout: false %> <%= erb :_navbar, layout: false %>
<main class="container-fluid px-4">
<div class="row"> <div class="row">
<% if @alert_success then %> <% if @alert_success then %>
<div class="alert alert-success"><%=@alert_success%></div> <div class="alert alert-success"><%=@alert_success%></div>
@@ -23,9 +24,9 @@
<% end %> <% end %>
<%= yield %> <%= yield %>
</div> </div>
</div> </main>
<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="/vendor/bootstrap-5.3.8/bootstrap.bundle.min.js"></script>
<script src="https://unpkg.com/dropzone@6.0.0-beta.1/dist/dropzone-min.js"></script> <script src="/vendor/dropzone-6.0.0-beta.1/dropzone-min.js"></script>
<script> <script>
Dropzone.options.UploadForm = { Dropzone.options.UploadForm = {
paramFile: "file", paramFile: "file",
+4 -4
View File
@@ -16,11 +16,11 @@
<strong class="ms-2"><%= label['name'] %></strong> <strong class="ms-2"><%= label['name'] %></strong>
</div> </div>
<div class="d-flex gap-2"> <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> <button class="btn btn-sm btn-secondary" type="submit">Print</button>
</form> </form>
<a href="/labels/<%= label['id'] %>/edit" class="btn btn-sm btn-outline-secondary">Edit</a> <a href="/repository/<%= label['id'] %>/edit" class="btn btn-sm btn-outline-secondary">Edit</a>
<form action="/labels/<%= label['id'] %>/delete" method="POST"> <form action="/repository/<%= label['id'] %>/delete" method="POST">
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button> <button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
</form> </form>
</div> </div>
@@ -28,7 +28,7 @@
<div class="mt-2"> <div class="mt-2">
<% if label['type'] == 'zpl' %> <% 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 %> <% else %>
<pre class="bg-light p-2 mb-0" style="max-height: 150px; overflow: auto;"><%= label['content'] %></pre> <pre class="bg-light p-2 mb-0" style="max-height: 150px; overflow: auto;"><%= label['content'] %></pre>
<% end %> <% end %>
+1 -1
View File
@@ -33,4 +33,4 @@
</div> </div>
</form> </form>
<p class="mt-4"><a href="/labels">See saved labels &rarr;</a></p> <p class="mt-4"><a href="/repository">See saved labels &rarr;</a></p>