67 lines
2.9 KiB
Org Mode
67 lines
2.9 KiB
Org Mode
:PROPERTIES:
|
|
:ID: bea03f11-ea0e-495e-98e9-3f5fba9e056e
|
|
:END:
|
|
#+title: 2022-02-04
|
|
|
|
* Experimenting with Splash rendering
|
|
|
|
Looking into how to render landing page drafts for content moderation.
|
|
|
|
#+name: hello-html
|
|
#+begin_src html
|
|
<!doctype html>
|
|
<html class="no-js" lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<title>Untitled</title>
|
|
<meta name="description" content="">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
<!-- Place favicon.ico in the root directory -->
|
|
|
|
</head>
|
|
<body bgcolor="red">
|
|
<!--[if lt IE 8]>
|
|
<p class="browserupgrade">
|
|
You are using an <strong>outdated</strong> browser. Please
|
|
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
|
|
your experience.
|
|
</p>
|
|
<![endif]-->
|
|
<center><b>Hello!</b></center>
|
|
|
|
</body>
|
|
</html>
|
|
#+end_src
|
|
|
|
#+name: hello-data-url
|
|
#+begin_src emacs-lisp
|
|
(concat
|
|
"data:text/html;base64,"
|
|
(base64-encode-string
|
|
(cadr (org-babel-lob--src-info "hello-html")) t))
|
|
#+end_src
|
|
|
|
#+RESULTS: hello-data-url
|
|
: data:text/html;base64,PCFkb2N0eXBlIGh0bWw+CjxodG1sIGNsYXNzPSJuby1qcyIgbGFuZz0iIj4KICAgIDxoZWFkPgogICAgICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4KICAgICAgICA8bWV0YSBodHRwLWVxdWl2PSJ4LXVhLWNvbXBhdGlibGUiIGNvbnRlbnQ9ImllPWVkZ2UiPgogICAgICAgIDx0aXRsZT5VbnRpdGxlZDwvdGl0bGU+CiAgICAgICAgPG1ldGEgbmFtZT0iZGVzY3JpcHRpb24iIGNvbnRlbnQ9IiI+CiAgICAgICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xIj4KCiAgICAgICAgPGxpbmsgcmVsPSJhcHBsZS10b3VjaC1pY29uIiBocmVmPSIvYXBwbGUtdG91Y2gtaWNvbi5wbmciPgogICAgICAgIDwhLS0gUGxhY2UgZmF2aWNvbi5pY28gaW4gdGhlIHJvb3QgZGlyZWN0b3J5IC0tPgoKICAgIDwvaGVhZD4KICAgIDxib2R5IGJnY29sb3I9InJlZCI+CiAgICAgICAgPCEtLVtpZiBsdCBJRSA4XT4KICAgICAgICAgICAgPHAgY2xhc3M9ImJyb3dzZXJ1cGdyYWRlIj4KICAgICAgICAgICAgWW91IGFyZSB1c2luZyBhbiA8c3Ryb25nPm91dGRhdGVkPC9zdHJvbmc+IGJyb3dzZXIuIFBsZWFzZQogICAgICAgICAgICA8YSBocmVmPSJodHRwOi8vYnJvd3NlaGFwcHkuY29tLyI+dXBncmFkZSB5b3VyIGJyb3dzZXI8L2E+IHRvIGltcHJvdmUKICAgICAgICAgICAgeW91ciBleHBlcmllbmNlLgogICAgICAgICAgICA8L3A+CiAgICAgICAgPCFbZW5kaWZdLS0+CiAgICAgICAgPGNlbnRlcj48Yj5IZWxsbyE8L2I+PC9jZW50ZXI+CgogICAgPC9ib2R5Pgo8L2h0bWw+
|
|
|
|
#+begin_src http :var url=hello-data-url
|
|
GET http://splash.service.testing.consul/render.html?url=${url}
|
|
#+end_src
|
|
|
|
#+RESULTS:
|
|
: HTTP/1.1 200 OK
|
|
: Date: Fri, 04 Feb 2022 16:38:45 GMT
|
|
: Content-Type: text/html; charset=utf-8
|
|
: Transfer-Encoding: chunked
|
|
: Connection: keep-alive
|
|
: Server: TwistedWeb/19.7.0
|
|
:
|
|
: <html><head></head><body></body></html>
|
|
|
|
Well, crap. It doesn't like data urls.
|
|
|
|
It is self-hosted, though, so it should be able to reach any internal hosted
|
|
versions of pages if/when they become available.
|