From d30769d51bf37be418c1ff4ced463a8c8e946096 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Tue, 9 Apr 2019 17:50:55 +0100 Subject: [PATCH] Restyle print key page as device key --- sirius/web/static/device-key-favicon.png | Bin 0 -> 1218 bytes sirius/web/static/device-key-large.svg | 47 +++ sirius/web/static/device-key-mini.svg | 23 ++ sirius/web/templates/print_key.html | 433 +++++++++++++++++------ 4 files changed, 391 insertions(+), 112 deletions(-) create mode 100644 sirius/web/static/device-key-favicon.png create mode 100644 sirius/web/static/device-key-large.svg create mode 100644 sirius/web/static/device-key-mini.svg diff --git a/sirius/web/static/device-key-favicon.png b/sirius/web/static/device-key-favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..e9b2f95ac40710f129596cc925eb5100faeb217c GIT binary patch literal 1218 zcmV;z1U>tSP)BL-Q7cH=-gf+*uXFC5ethly zZd)fgch2*FX3jjmxsm)&ZJD@v{US$!uNx~xByux1mT@xr2gS`L`4{6QS9~YZTQQkL zX|Xlp9=I*?Ikv~VJ{Xt!3al1)UmwYt(UTr{faJ|R5*=3gRdKn6 z;@*dLA;#rbJuO_C5ly+jnjGM77l?D71{R5HG8~`$18*CqZ!=%~UYXPq05tngkx!ZV zTAy$bz?N$gwb=mLMKs4fUZ(2utmkzP+%UfEp3%=@0AJf|=m)99<}{%7;wrFxhtH7t zBY(+VF*D7-q;840djV=UFnUeiY=IApn}K|YL2gwY_7*4~_&&(g%ghdRLf#YL8R11<(&u+LuxtQAY7sY$;EMsk zYej1|P6t7}-U)*N&S^bGB@wE`HChmr_*ub91|=M**we(`F&z5uYxpcD+)~9H$EwjR z?6`gH66v`vs}Z*ns`NpZxZXB(O7vG2kQ{*x=Exa6Y@|5wuzg$9&&1~d#f!|L7Uy{`U6y9unx}Fas_+GxwtPi5=rhm5@3hl-->mA19 zcg*-q{c>@OgEOqRVEnGj6pR!88`vBA)Y6YsA9U9Trz93Zdp&@HT&Whfq+}2doQ$Om z{%R1rH%r`IKKf4vpkD%@-%3>idjtMm7DN2`i9E4bvXKVB8rJd~B>QqXzy2TcqCCYG zzsW(L&vASLpKbVVp||)x?(c@H66t+VRx^M&h*{MF+y*VriUL3<)WqB1Le`kjFFxa@ z0OUL~sYj{rIPRcvn?Awc;C)v=(d3Fgssdp;uHb5pjsO4v literal 0 HcmV?d00001 diff --git a/sirius/web/static/device-key-large.svg b/sirius/web/static/device-key-large.svg new file mode 100644 index 0000000..87e414a --- /dev/null +++ b/sirius/web/static/device-key-large.svg @@ -0,0 +1,47 @@ + + + + Group 2 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sirius/web/static/device-key-mini.svg b/sirius/web/static/device-key-mini.svg new file mode 100644 index 0000000..53bd81b --- /dev/null +++ b/sirius/web/static/device-key-mini.svg @@ -0,0 +1,23 @@ + + + + Group 10 + Created with Sketch. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sirius/web/templates/print_key.html b/sirius/web/templates/print_key.html index 48f6435..45787eb 100644 --- a/sirius/web/templates/print_key.html +++ b/sirius/web/templates/print_key.html @@ -1,137 +1,346 @@ -{% extends "base.html" %} - -{% block title %}Print key | {{ printer.name }} | Little Printer{% endblock %} - -{% block page_content %} - -
-
-

🔑 You got a Print Key!

- -

- You can use this Print Key to print to {{ printer.owner.username }}'s Little Printer. -

- - - - - - - - - - - - - - - - - - - - -
Printer{{ printer.name }}
Owned by{{ printer.owner.username }}
Status - {% if printer.is_online %} - Online - {% else %} - Offline - {% endif %} -
Print key{{print_key.secret}}
-
-
- - - -

How do I actually use this?!

- -

The easy way

- -

- Download our iOS app and paste the code ({{print_key.secret}}) in there. -

- -

The nerdy way

- -

- This URL also works as an API. You can POST data to it and it'll send it to the printer. -

-

- You could do this from IFTTT, a Glitch app, your web app, or the command line. For example: -

-
curl '{{request.url}}?from=example' \
+
+
+    
+        
+        
+        
+
+        Device Key – {{printer.owner.username}}'s Little Printer
+
+        
+
+    
+    
+        
+ +
Device Keys
+
+ +
+ +
+ +
+ + +
Device Key:
+ {{request.url}} + +

+ A Device Key is a secret URL for a device, containing both + address and authentication. It can be + shared like any other URL, and used by apps, + services, or your own programs as an API endpoint. +

+ +
+
Type:
Berg Little Printer
+
Class:
Thermal Printer
+
Name:
{{ printer.name }}
+
Owner:
{{ printer.owner.username }}
+
Status:
+
+ {% if printer.is_online %} + Online + {% else %} + Offline + {% endif %} +
+
Apps:
Little Printers
+
API:
Documentation
+
+
+ + +
+ Close +

API Documentation

+

Class: Thermal Printer

+

+ This URL also works as an API. You can POST data to it and it'll send it to the printer. +

+

+ You could do this from IFTTT, a Glitch app, your web app, or the command line. For example: +

+
curl '{{request.url}}?from=example' \
     -H 'content-type: text/plain' \
     -d 'boop beep boop'
- -

- Take care to set the Content-Type of the request. Supported types below: -

+ +

+ Take care to set the Content-Type of the request. Supported types below: +

-

HTML

-

- Content-Type: text/html -

-

Renders and prints HTML. Surprisingly powerful! Supports HTML elements, CSS styling, and embedded images.

-
curl '{{request.url}}?from=htmlexample' \
+                

HTML

+

+ Content-Type: text/html +

+

Renders and prints HTML. Surprisingly powerful! Supports HTML elements, CSS styling, and embedded images.

+
curl '{{request.url}}?from=htmlexample' \
     -H 'content-type: text/html' \
     -d "<h1>Yep, you can do this</h1><small>or this</small>"
-

Images

-

- Content-Type: image/png, - Content-Type: image/gif, - Content-Type: image/jpeg -

-

Prints out the image data from the request body, in a lovely dithered style.

-
cat mindblown.gif | curl '{{request.url}}?from=image-example' \
+                

Images

+

+ Content-Type: image/png, + Content-Type: image/gif, + Content-Type: image/jpeg +

+

Prints out the image data from the request body, in a lovely dithered style.

+
cat mindblown.gif | curl '{{request.url}}?from=image-example' \
     -X POST \
     -H 'content-type: image/gif' \
     --data-binary @-
-

JSON

-

- Content-Type: application/json -

-

- Print Keys accept JSON encoded text or HTML. This is great for working with IFTTT! -

-

- Send HTML using the html key or plain text using the text key. -

-
curl '{{request.url}}?from=jsonexample' \
+                

JSON

+

+ Content-Type: application/json +

+

+ Print Keys accept JSON encoded text or HTML. This is great for working with IFTTT! +

+

+ Send HTML using the html key or plain text using the text key. +

+
curl '{{request.url}}?from=jsonexample' \
     -H 'content-type: application/json' \
     -d '{"html":"<h1>header!</h1>"}'
-

Text

-

- Content-Type: text/plain -

-

Prints out plain text.

-
curl '{{request.url}}?from=text-example' \
+                

Text

+

+ Content-Type: text/plain +

+

Prints out plain text.

+
curl '{{request.url}}?from=text-example' \
     -H 'content-type: text/plain' \
     -d "I'm a little teapot"
- - -

Status API

- -

This URL is also a status API e.g.

+ -
curl '{{request.url}}'
+

Status API

-

This returns the status of the printer in JSON format.

+

This URL is also a status API e.g.

-

e.g.

+
curl '{{request.url}}'
-
{{printer_info_json}}
+

This returns the status of the printer in JSON format.

-{% endblock %} +

e.g.

-{% block scripts %} -{{ super() }} +
{{printer_info_json}}
- -{% endblock scripts %} +
+
+ + -- 2.47.3