Caching fonts proxy for Googel Fonts
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Solves #1

+10
+10
src/fonts.gleam
··· 2 2 import gleam/bit_array 3 3 import gleam/bool 4 4 import gleam/erlang/application 5 + import gleam/erlang/atom 5 6 import gleam/erlang/process 6 7 import gleam/http 7 8 import gleam/http/request ··· 152 153 }, 153 154 ) 154 155 156 + let sha256 = list_to_atom([115, 104, 97, 50, 53, 54]) 157 + 155 158 // The path with queries is now officially a gfonts item_url. 156 159 let item_url = path_with_query |> string.remove_prefix("/") 157 160 // A url (and file path) safe version of the request. 158 161 let item_id = 159 162 bit_array.from_string(item_url) 163 + |> crypto_hash(sha256, _) 160 164 |> bit_array.base64_url_encode(False) 161 165 use <- woof.with_context([ 162 166 woof.str("item-url", item_url), ··· 368 372 } 369 373 } 370 374 } 375 + 376 + @external(erlang, "crypto", "hash") 377 + fn crypto_hash(algo: atom.Atom, data: BitArray) -> BitArray 378 + 379 + @external(erlang, "erlang", "list_to_atom") 380 + fn list_to_atom(list: List(Int)) -> atom.Atom