Skip to content

Commit

Permalink
Converts bindata usage to embed usage, gzip all http responses. (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall authored Jul 29, 2024
2 parents ba3e1b5 + 181a38a commit 10af186
Show file tree
Hide file tree
Showing 136 changed files with 220 additions and 23,917 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
git fetch --force --tags;
source ./settings.sh;
[ -z SLIPPERS ] || eval "${SLIPPERS}";
gzip -9 pkg/bindata/files/{css,js}/*;
gzip -9r pkg/bindata/templates/*;
for item in DATE COMMIT VERSION ITERATION BRANCH LICENSE DESC VENDOR MAINT SOURCE_URL; do
eval echo "settings.sh build-arg: ${item}=\$${item}";
eval echo "${item}=\$${item}" >> $GITHUB_ENV;
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: |
brew install Bearer/tap/gon
[ -z SLIPPERS ] || eval "${SLIPPERS}"
gzip -9 pkg/bindata/files/{css,js}/*
gzip -9r pkg/bindata/templates/*
make signdmg
- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -80,6 +82,8 @@ jobs:
sudo gem install --no-document fpm
echo "${GPG_SIGNING_KEY}" | gpg --import -
[ -z SLIPPERS ] || eval "${SLIPPERS}"
gzip -9 pkg/bindata/files/{css,js}/*
gzip -9r pkg/bindata/templates/*
make release
- name: Upload Release Artifacts v${{steps.vars.outputs.version}}-${{steps.vars.outputs.revision}}
uses: actions/upload-artifact@v4
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ clean:
rm -f notifiarr notifiarr.*.{macos,freebsd,linux,exe}{,.gz,.zip} notifiarr.1{,.gz} notifiarr.rb
rm -f notifiarr{_,-}*.{deb,rpm,txz} v*.tar.gz.sha256 examples/MANUAL .metadata.make rsrc_*.syso
rm -f cmd/notifiarr/README{,.html} README{,.html} ./notifiarr_manual.html rsrc.syso Notifiarr.*.app.zip
rm -f notifiarr.service pkg/bindata/bindata.go pack.temp.dmg notifiarr.conf.example
rm -f notifiarr.service pack.temp.dmg notifiarr.conf.example
rm -rf package_build_* release Notifiarr.*.app Notifiarr.app
rm -f pkg/bindata/docs/api_docs.go

Expand Down Expand Up @@ -357,12 +357,10 @@ lint: generate
GOOS=freebsd golangci-lint --build-tags nodbus run
GOOS=windows golangci-lint run

generate: pkg/bindata/bindata.go pkg/bindata/docs/api_docs.go
generate: pkg/bindata/docs/api_docs.go
pkg/bindata/docs/api_docs.go:
go generate ./pkg/bindata/docs
pkg/bindata/bindata.go:
find pkg -name .DS\* -delete
go generate ./pkg/bindata/
go generate ./pkg/bindata/docs

##################
##### Docker #####
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go 1.22

require (
github.com/BurntSushi/toml v1.4.0
github.com/CAFxX/httpcompression v0.0.9
github.com/akavel/rsrc v0.10.2
github.com/dsnet/compress v0.0.1
github.com/energye/systray v1.0.2
Expand All @@ -24,7 +25,6 @@ require (
github.com/jackpal/gateway v1.0.15
github.com/jaypipes/ghw v0.12.0
github.com/jxeng/shortcut v1.0.2
github.com/kevinburke/go-bindata/v4 v4.0.2
github.com/lestrrat-go/apache-logformat/v2 v2.0.6
github.com/mitchellh/go-homedir v1.1.0
github.com/mrobinsn/go-rtorrent v1.8.0
Expand All @@ -33,6 +33,7 @@ require (
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
github.com/stretchr/testify v1.9.0
github.com/swaggo/swag v1.16.3
github.com/vearutop/statigz v1.4.0
golang.org/x/crypto v0.25.0
golang.org/x/mod v0.19.0
golang.org/x/sys v0.22.0
Expand Down
27 changes: 17 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CAFxX/httpcompression v0.0.9 h1:0ue2X8dOLEpxTm8tt+OdHcgA+gbDge0OqFQWGKSqgrg=
github.com/CAFxX/httpcompression v0.0.9/go.mod h1:XX8oPZA+4IDcfZ0A71Hz0mZsv/YJOgYygkFhizVPilM=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/bodgit/plumbing v1.3.0 h1:pf9Itz1JOQgn7vEOE7v7nlEfBykYqvUYioC61TwWCFU=
Expand All @@ -35,6 +38,8 @@ github.com/bodgit/sevenzip v1.5.1 h1:rVj0baZsooZFy64DJN0zQogPzhPrT8BQ8TTRd1H4WHw
github.com/bodgit/sevenzip v1.5.1/go.mod h1:Q3YMySuVWq6pyGEolyIE98828lOfEoeWg5zeH6x22rc=
github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4=
github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM=
github.com/bool64/dev v0.2.28 h1:6ayDfrB/jnNr2iQAZHI+uT3Qi6rErSbJYQs1y8rSrwM=
github.com/bool64/dev v0.2.28/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
Expand Down Expand Up @@ -102,6 +107,8 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/brotli/go/cbrotli v0.0.0-20230829110029-ed738e842d2f h1:jopqB+UTSdJGEJT8tEqYyE29zN91fi2827oLET8tl7k=
github.com/google/brotli/go/cbrotli v0.0.0-20230829110029-ed738e842d2f/go.mod h1:nOPhAkwVliJdNTkj3gXpljmWhjc4wCaVqbMJcPKWP4s=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -171,13 +178,13 @@ github.com/jxeng/shortcut v1.0.2 h1:nYVmn22NjzfJewPX9uC8zwHoc4gZotpfX+7HgLRDaKQ=
github.com/jxeng/shortcut v1.0.2/go.mod h1:3J/BiW+ER+vTzzg1anfOoYyMKXQH3R5xzlnjaaGH7qs=
github.com/kdomanski/iso9660 v0.4.0 h1:BPKKdcINz3m0MdjIMwS0wx1nofsOjxOq8TOr45WGHFg=
github.com/kdomanski/iso9660 v0.4.0/go.mod h1:OxUSupHsO9ceI8lBLPJKWBTphLemjrCQY8LPXM7qSzU=
github.com/kevinburke/go-bindata/v4 v4.0.2 h1:6qQI0nNTL27wM1En8zQHGBEPp3ETzgFU6hVdSjlkrfE=
github.com/kevinburke/go-bindata/v4 v4.0.2/go.mod h1:M/CkBqw2qCZ1Ztv5JyKgocGYWyUkYlDqkqXS1ktLe5c=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
Expand Down Expand Up @@ -210,6 +217,7 @@ github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9l
github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -262,9 +270,14 @@ github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYN
github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY=
github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE=
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/valyala/gozstd v1.20.1 h1:xPnnnvjmaDDitMFfDxmQ4vpx0+3CdTg2o3lALvXTU/g=
github.com/valyala/gozstd v1.20.1/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
github.com/vearutop/statigz v1.4.0 h1:RQL0KG3j/uyA/PFpHeZ/L6l2ta920/MxlOAIGEOuwmU=
github.com/vearutop/statigz v1.4.0/go.mod h1:LYTolBLiz9oJISwiVKnOQoIwhO1LWX1A7OECawGS8XE=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
Expand Down Expand Up @@ -438,8 +451,6 @@ golift.io/nzbget v0.1.5 h1:TE/TPldaLr/Qy5wy+7R4Lvur1SosOpjTLs6BLK3TMrU=
golift.io/nzbget v0.1.5/go.mod h1:YYGQsadsgvadzM6qlVBS21gz8DBhfbxexGMndsGelj8=
golift.io/qbit v0.0.0-20240715191156-11930ac2546e h1:JtgHLTF8YPH9fuyHxUYvteJMKyDtxCIbTA9KkbtwsgI=
golift.io/qbit v0.0.0-20240715191156-11930ac2546e/go.mod h1:rW0J8ruEeqTiICfWSk54gja8WLqUjNkbcsFN3wVdO94=
golift.io/rotatorr v0.0.0-20230911015553-cd2abbd726c7 h1:8reg8mRdLxCz168FaGPf/kVxmDRDc92/Dhub54trdOc=
golift.io/rotatorr v0.0.0-20230911015553-cd2abbd726c7/go.mod h1:59bC4ue06MetIY4iiHu3PCqVbzW0leGoCONZhH8dPZ8=
golift.io/rotatorr v0.0.0-20240723172740-cb73b9c4894c h1:/YAFK+YHhXfx/jdeQ8Hti7iFJKo0BXNwWLPhUj/4MAg=
golift.io/rotatorr v0.0.0-20240723172740-cb73b9c4894c/go.mod h1:OzsfIeAOPI4rjyv5GU8oOTdfJcq78urn2ncdfg9q/4Y=
golift.io/starr v1.0.1-0.20240717055349-aa3e015cc8a4 h1:8ijJymuEKA2xvSuRh3/k6G1esCGQxL6RiuFQ4jjN5Kk=
Expand Down Expand Up @@ -504,16 +515,14 @@ howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM=
howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ=
modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
modernc.org/ccgo/v4 v4.19.0 h1:f9K5VdC0nVhHKTFMvhjtZ8TbRgFQbASvE5yO1zs8eC0=
modernc.org/ccgo/v4 v4.19.0/go.mod h1:CfpAl+673iXNwMG/aqcQn+vDcu4Es/YLya7+9RHjTa4=
modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b h1:BnN1t+pb1cy61zbvSUV7SeI0PwosMhlAEi/vBY4qxp8=
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
modernc.org/libc v1.54.3 h1:pcPjjPJUHBRIJka4/R6AJ9FvxxuGRy0097QPjSMOdJs=
modernc.org/libc v1.54.3/go.mod h1:s3b2r/5Fre7gAEhWiMf+X1czfZ9KYx2rz4BBsnUf16E=
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
Expand All @@ -524,8 +533,6 @@ modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
modernc.org/sqlite v1.30.2 h1:IPVVkhLu5mMVnS1dQgh3h0SAACRWcVk7aoLP9Us3UCk=
modernc.org/sqlite v1.30.2/go.mod h1:DUmsiWQDaAvU4abhc/N+djlom/L2o8f7gZ95RCvyoLU=
modernc.org/sqlite v1.31.1 h1:XVU0VyzxrYHlBhIs1DiEgSl0ZtdnPtbLVy8hSkzxGrs=
modernc.org/sqlite v1.31.1/go.mod h1:UqoylwmTb9F+IqXERT8bW9zzOWN8qwAIcLdzeBZs4hA=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
Expand Down
6 changes: 2 additions & 4 deletions init/archlinux/PKGBUILD.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ install="${pkgname}.aur.install"

build() {
cd "$pkgname-$pkgver"
export EXTRA_LDFLAGS=-linkmode=external
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
make clean man VERSION="${pkgver}" ITERATION="${pkgrel}"
make clean man generate VERSION="${pkgver}" ITERATION="${pkgrel}"

if [ "$CARCH" == "x86_64" ]; then
make linux VERSION="${pkgver}" ITERATION="${pkgrel}"
Expand All @@ -43,7 +41,7 @@ package() {
# Binary.
install -Dm755 "${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
# Directories.
install -dm0755 "${pkgdir}/usr/share/doc/${pkgname}" \
install -dm0755 "${pkgdir}/usr/share/doc/${pkgname}" "${pkgdir}/usr/share/applications" \
"${pkgdir}/usr/share/licenses/${pkgname}" "${pkgdir}/etc/${pkgname}"
# Man file.
install -Dm644 "${pkgname}.1.gz" "${pkgdir}/usr/share/man/man1/${pkgname}.1.gz"
Expand Down
3 changes: 1 addition & 2 deletions init/docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ COPY main.go go.mod go.sum ./

# Cache all the needed tools.
RUN go mod download \
&& go run github.com/kevinburke/go-bindata/v4/go-bindata@latest -v \
&& go run github.com/swaggo/swag/cmd/swag@master -v
&& go run github.com/swaggo/swag/cmd/swag@latest -v

COPY pkg pkg
RUN go generate ./...
Expand Down
3 changes: 1 addition & 2 deletions init/docker/Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ COPY main.go go.mod go.sum ./

# Cache all the needed tools.
RUN go mod download \
&& go run github.com/kevinburke/go-bindata/v4/go-bindata@latest -v \
&& go run github.com/swaggo/swag/cmd/swag@master -v
&& go run github.com/swaggo/swag/cmd/swag@latest -v

COPY pkg pkg
RUN go generate ./...
Expand Down
3 changes: 1 addition & 2 deletions init/docker/Dockerfile.scratch
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ COPY main.go go.mod go.sum ./

# Cache all the needed tools.
RUN go mod download \
&& go run github.com/kevinburke/go-bindata/v4/go-bindata@latest -v \
&& go run github.com/swaggo/swag/cmd/swag@master -v
&& go run github.com/swaggo/swag/cmd/swag@latest -v

# Cache apt installs.
RUN apt update \
Expand Down
2 changes: 2 additions & 0 deletions init/docker/hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if ! (docker buildx inspect | grep -Eq 'docker-container'); then
fi

[ -z SLIPPERS ] || eval "${SLIPPERS}"
gzip -9 pkg/bindata/files/{css,js}/*
gzip -9r pkg/bindata/templates/*

read -r -d '' BUILD_ARGS << EOF
--build-arg "BUILD_DATE=${DATE}" \
Expand Down
6 changes: 3 additions & 3 deletions pkg/apps/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ func (a *Apps) HandleAPIpath(app starr.App, uri string, api APIHandler, method .

uri = path.Join(a.URLBase, "api", app.Lower(), id, uri)

return a.Router.Handle(uri, a.CheckAPIKey(a.handleAPI(app, api))).Methods(method...)
return a.Router.Handle(uri, a.CheckAPIKey(a.compress(a.handleAPI(app, api)))).Methods(method...)
}

// This grabs the app struct and saves it in a context before calling the handler.
// The purpose of this complicated monster is to keep API handler methods simple.
func (a *Apps) handleAPI(app starr.App, api APIHandler) http.HandlerFunc { //nolint:cyclop,funlen
return func(w http.ResponseWriter, r *http.Request) { //nolint:varnamelen
return func(resp http.ResponseWriter, r *http.Request) { //nolint:varnamelen
var (
msg interface{}
ctx = r.Context()
Expand Down Expand Up @@ -92,7 +92,7 @@ func (a *Apps) handleAPI(app starr.App, api APIHandler) http.HandlerFunc { //nol
code, msg = api(r.WithContext(context.WithValue(ctx, app, aID)))
}

wrote := a.Respond(w, code, msg)
wrote := a.Respond(resp, code, msg)

if str, _ := json.MarshalIndent(msg, "", " "); len(post) > 0 {
a.Debugf("Incoming API: %s %s (%s): %s\nStatus: %d, Reply (%s): %s",
Expand Down
Loading

0 comments on commit 10af186

Please sign in to comment.