Address Brother QL printer by URL path instead of session cookie
deploy / deploy (push) Successful in 9s
deploy / deploy (push) Successful in 9s
Drops /brother/select and the session-based "active printer" state: the printer key now lives in the path (/brother/<printer>/*), so the proxy is stateless and any path under it -- including brother_ql_web's API, not just its UI -- is reachable without a prior "activation" step.
This commit is contained in:
1 parent
776f7fdd5a
commit
5c06f725f0
4 files changed
+13
-34
No files matched your search
+1
-4
@@ -16,10 +16,7 @@
|
||||
<span class="navbar-text me-2">Brother:</span>
|
||||
<div class="d-flex gap-1">
|
||||
<% BROTHER_PRINTERS.each do |key, info| %>
|
||||
<form action="/brother/select" method="POST" class="m-0">
|
||||
<input type="hidden" name="printer" value="<%= key %>">
|
||||
<button type="submit" class="btn btn-sm <%= session[:brother_printer] == key ? 'btn-primary' : 'btn-outline-secondary' %>"><%= info[:label].sub('Brother ', '') %></button>
|
||||
</form>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -3,16 +3,6 @@
|
||||
|
||||
<div class="list-group" style="max-width: 400px;">
|
||||
<% @printers.each do |key, info| %>
|
||||
<form action="/brother/select" method="POST" class="mb-2">
|
||||
<input type="hidden" name="printer" value="<%= key %>">
|
||||
<button type="submit" class="btn <%= @selected == key ? 'btn-primary' : 'btn-outline-primary' %> w-100 text-start">
|
||||
<%= info[:label] %>
|
||||
<% if @selected == key %> (active) <% end %>
|
||||
</button>
|
||||
</form>
|
||||
<a href="/brother/<%= key %>/" class="btn btn-outline-primary w-100 text-start mb-2"><%= info[:label] %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @selected %>
|
||||
<p class="mt-3"><a href="/brother/">Open <%= @printers[@selected][:label] %> »</a></p>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user