Skip to content

Commit

Permalink
support package base64 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lyokha committed Jan 19, 2024
1 parent a7034ad commit 75e8705
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
experimental: false
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install GHC and Cabal
uses: haskell-actions/setup@v2
with:
Expand Down
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.2.7

- Support package *base64* *1.0*.

### 1.2.6

- Refactored to avoid using *head* and *tail* as it triggers *x-partial*
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The following license covers this documentation, and the source code, except
where otherwise indicated.

Copyright 2019-2023, Alexey Radkov. All rights reserved.
Copyright 2019-2024, Alexey Radkov. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
12 changes: 10 additions & 2 deletions NgxExport/Tools/EDE.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : NgxExport.Tools.EDE
-- Copyright : (c) Alexey Radkov 2020-2023
-- Copyright : (c) Alexey Radkov 2020-2024
-- License : BSD-style
--
-- Maintainer : alexey.radkov@gmail.com
Expand Down Expand Up @@ -47,6 +47,9 @@ import qualified Data.ByteString.Char8 as C8
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Lazy.Char8 as C8L
import Data.ByteString.Base64.URL
#if MIN_VERSION_base64(1,0,0)
import Data.Base64.Types
#endif
import Data.IORef
import Data.Text (Text)
import qualified Data.Text.Encoding as T
Expand Down Expand Up @@ -242,12 +245,17 @@ ngxExportSimpleServiceTyped 'compileEDETemplates ''InputTemplates
-- * __/uenc/__ encodes a 'Value' using /URL encoding/ rules.
extraEDEFilters :: HashMap Id Term
extraEDEFilters = HM.fromList
["b64" @: applyToValue encodeBase64
["b64" @: applyToValue eb64
,"uenc" @: applyToValue (T.decodeUtf8 . urlEncode False)
]
where applyToValue :: (ByteString -> Text) -> Value -> Text
applyToValue f (String t) = f $ T.encodeUtf8 t
applyToValue f v = f $ L.toStrict $ encode v
#if MIN_VERSION_base64(1,0,0)
eb64 = extractBase64 . encodeBase64
#else
eb64 = encodeBase64
#endif

-- | Renders an EDE template from a JSON object.
--
Expand Down
8 changes: 4 additions & 4 deletions ngx-export-tools-extra.cabal
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: ngx-export-tools-extra
version: 1.2.6
synopsis: More extra tools for Nginx haskell module
version: 1.2.7
synopsis: More extra tools for Nginx Haskell module
description: More extra tools for
<https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.
<https://github.com/lyokha/nginx-haskell-module Nginx Haskell module>.
homepage: https://github.com/lyokha/ngx-export-tools-extra
license: BSD3
license-file: LICENSE
extra-doc-files: Changelog.md
author: Alexey Radkov <alexey.radkov@gmail.com>
maintainer: Alexey Radkov <alexey.radkov@gmail.com>
stability: stable
copyright: 2019-2023 Alexey Radkov
copyright: 2019-2024 Alexey Radkov
category: Network
build-type: Simple
cabal-version: 1.20
Expand Down

0 comments on commit 75e8705

Please sign in to comment.