From: Joe Rickerby Date: Tue, 9 Apr 2019 16:50:55 +0000 (+0100) Subject: Restyle print key page as device key X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=d30769d51bf37be418c1ff4ced463a8c8e946096;p=sirius.git Restyle print key page as device key --- diff --git a/sirius/web/static/device-key-favicon.png b/sirius/web/static/device-key-favicon.png new file mode 100644 index 0000000..e9b2f95 Binary files /dev/null and b/sirius/web/static/device-key-favicon.png differ 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 %} +
+
+ +