landscape: add woff2 support, serve Inter & Source Code Pro

Fixes urbit/landscape#92
This commit is contained in:
Tyler Brown Cifu Shuster 2020-12-10 12:37:25 -08:00
parent 8c313eba67
commit 308da85851
17 changed files with 37 additions and 21 deletions

View File

@ -143,6 +143,7 @@
%js (js-response:gen u.file)
%css (css-response:gen u.file)
%png (png-response:gen u.file)
%woff2 (woff2-response:gen u.file)
==
:: get data matching the json and convert it
::
@ -400,7 +401,7 @@
++ get-file-at
|= [base=path file=path ext=@ta]
^- (unit octs)
?. ?=(?(%html %css %js %png) ext)
?. ?=(?(%html %css %js %png %woff2) ext)
~
=/ =path
:* (scot %p our.bowl)

View File

@ -213,6 +213,9 @@
(lowercase (weld path.content.u.content suffix.u.content))
==
?. .^(? %cu scry-path) [not-found:gen %.n]
?: ?=([~ %woff2] ext.req-line)
:_ public.u.content
[[200 [['content-type' '/font/woff2'] ~]] `.^(octs %cx scry-path)]
=/ file (as-octs:mimes:html .^(@ %cx scry-path))
:_ public.u.content
?+ ext.req-line not-found:gen

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -77,7 +77,7 @@
=? hav ?=(^ fil.lon)
:: XX this whitelist needs to be reviewed
::
?. ?= ?(%css %hoon %html %js %json %md %png %txt %udon %umd)
?. ?= ?(%css %hoon %html %js %json %md %png %txt %udon %umd %woff2)
-.tyl
::
:: install only files with whitelisted marks

12
pkg/arvo/mar/woff2.hoon Normal file
View File

@ -0,0 +1,12 @@
|_ dat=octs
++ grow
|%
++ mime [/font/woff2 dat]
--
++ grab
|%
++ mime |=([=mite =octs] octs)
++ noun octs
--
++ grad %mime
--

View File

@ -1693,9 +1693,9 @@
"integrity": "sha512-3OPSdf9cejP/TSzWXuBaYbzLtAfBzQnc75SlPLkoPfwpxnv1Bvy9hiWngLY0WnKRR6lMOldnkYQCCuNWeDibYQ=="
},
"@tlon/indigo-react": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/@tlon/indigo-react/-/indigo-react-1.2.5.tgz",
"integrity": "sha512-NOQTwH74l/XXMIfQ4ZzymvZuk1WK1nmO552TmXrQxBUSb7HmdlA8anG5oRrvnLJTkajLCY59McLkDca+lCcvwg==",
"version": "1.2.15",
"resolved": "https://registry.npmjs.org/@tlon/indigo-react/-/indigo-react-1.2.15.tgz",
"integrity": "sha512-h9umWEzYZwyb53ujWoCQCJQwY9RUuoDaf6189+0LH3C7y9fybJe6vzbW6g2cUVH8dXA2EZkedS5nriYR0IpQbw==",
"requires": {
"@reach/menu-button": "^0.10.5",
"react": "^16.13.1",

View File

@ -2,76 +2,76 @@
font-family: 'Inter';
font-style: normal;
font-weight: 400;
src: url("https://media.urbit.org/fonts/Inter-Regular.woff2") format("woff2");
src: url("/~landscape/fonts/inter-regular.woff2") format("woff2");
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 500;
src: url("https://media.urbit.org/fonts/Inter-Medium.woff2") format("woff2");
src: url("/~landscape/fonts/inter-medium.woff2") format("woff2");
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 600;
src: url("https://media.urbit.org/fonts/Inter-SemiBold.woff2") format("woff2");
src: url("/~landscape/fonts/inter-semibold.woff2") format("woff2");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 400;
src: url("https://media.urbit.org/fonts/Inter-Italic.woff2") format("woff2");
src: url("/~landscape/fonts/inter-italic.woff2") format("woff2");
}
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 700;
src: url("https://media.urbit.org/fonts/Inter-Bold.woff2") format("woff2");
src: url("/~landscape/fonts/inter-bold.woff2") format("woff2");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 700;
src: url("https://media.urbit.org/fonts/Inter-BoldItalic.woff2") format("woff2");
src: url("/~landscape/fonts/inter-bolditalic.woff2") format("woff2");
}
@font-face {
font-family: "Source Code Pro";
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-extralight.woff");
src: url("/~landscape/fonts/sourcecodepro-extralight.woff2");
font-weight: 200;
}
@font-face {
font-family: "Source Code Pro";
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-light.woff");
src: url("/~landscape/fonts/sourcecodepro-light.woff2");
font-weight: 300;
}
@font-face {
font-family: "Source Code Pro";
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-regular.woff");
src: url("/~landscape/fonts/sourcecodepro-regular.woff2");
font-weight: 400;
}
@font-face {
font-family: "Source Code Pro";
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-medium.woff");
src: url("(/~landscape/fonts/sourcecodepro-medium.woff2");
font-weight: 500;
}
@font-face {
font-family: "Source Code Pro";
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-semibold.woff");
src: url("/~landscape/fonts/sourcecodepro-semibold.woff2");
font-weight: 600;
}
@font-face {
font-family: "Source Code Pro";
src: url("https://storage.googleapis.com/media.urbit.org/fonts/scp-bold.woff");
src: url("/~landscape/fonts/sourcecodepro-bold.woff2");
font-weight: 700;
}