From d84e33bb57f3e2a44e4d56b6fef383bf9e454abe Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sat, 16 Mar 2024 18:40:25 +0100 Subject: [PATCH] Update dependencies, add another package for plugins, add id to contentwarning HTML element --- docs/plugins.md | 1 + go.mod | 13 +++-- go.sum | 26 +++++----- .../github_com-araddon-dateparse.go | 48 +++++++++++++++++++ pkgs/yaegiwrappers/wrappers.go | 1 + uiComponents.go | 2 +- ui_test.go | 2 +- 7 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 pkgs/yaegiwrappers/github_com-araddon-dateparse.go diff --git a/docs/plugins.md b/docs/plugins.md index 2655dfc..569c766 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -81,6 +81,7 @@ Third-party modules - `github.com/PuerkitoBio/goquery` (Can be used to *manipulate* HTML in a jquery-like way) - `github.com/carlmjohnson/requests` (Can be used to do HTTP requests more easily) +- `github.com/araddon/dateparse` (Can be used to parse dates more easily) ## Plugins diff --git a/go.mod b/go.mod index 4bda143..fc1e269 100644 --- a/go.mod +++ b/go.mod @@ -20,8 +20,8 @@ require ( github.com/dmulholl/mp3lib v1.0.0 github.com/elnormous/contenttype v1.0.4 github.com/emersion/go-smtp v0.20.2 - github.com/go-ap/activitypub v0.0.0-20240311125533-442f6c0264c8 - github.com/go-ap/client v0.0.0-20240311125901-a74d64acf456 + github.com/go-ap/activitypub v0.0.0-20240316125321-b61fd6a83225 + github.com/go-ap/client v0.0.0-20240316125535-27e8db2c2547 github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 github.com/go-chi/chi/v5 v5.0.12 github.com/go-fed/httpsig v1.1.0 @@ -65,14 +65,14 @@ require ( golang.org/x/sync v0.6.0 golang.org/x/text v0.14.0 gopkg.in/yaml.v3 v3.0.1 - maunium.net/go/mautrix v0.17.0 + maunium.net/go/mautrix v0.18.0 nhooyr.io/websocket v1.8.10 willnorris.com/go/microformats v1.2.0 ) require ( git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 // indirect - git.sr.ht/~mariusor/lw v0.0.0-20240310135138-67bdb0a4f8db // indirect + git.sr.ht/~mariusor/lw v0.0.0-20240313142800-531789c76b6d // indirect github.com/andybalholm/cascadia v1.3.2 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/boombuler/barcode v1.0.1 // indirect @@ -119,15 +119,14 @@ require ( github.com/tidwall/sjson v1.2.5 // indirect github.com/toorop/go-dkim v0.0.0-20240103092955-90b7d1423f92 // indirect github.com/valyala/fastjson v1.6.4 // indirect - go.mau.fi/util v0.4.0 // indirect + go.mau.fi/util v0.4.1 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect + golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/image v0.15.0 // indirect golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sys v0.18.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - maunium.net/go/maulogger/v2 v2.4.1 // indirect willnorris.com/go/webmention v0.0.0-20220108183051-4a23794272f0 // indirect ) diff --git a/go.sum b/go.sum index 1080b27..1c5eba0 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ git.jlel.se/jlelse/template-strings v0.0.0-20220211095702-c012e3b5045b h1:zrGLEe git.jlel.se/jlelse/template-strings v0.0.0-20220211095702-c012e3b5045b/go.mod h1:UNLE8cup2GTHbsE89xezRwq3GhKspPI9NyckPbgJEmw= git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg= git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs= -git.sr.ht/~mariusor/lw v0.0.0-20240310135138-67bdb0a4f8db h1:g3ZOs0tX3PKZshK5LOIr/DTUT6421CswoiGevfMPL8s= -git.sr.ht/~mariusor/lw v0.0.0-20240310135138-67bdb0a4f8db/go.mod h1:kXJ4JsgGBu7IVBKlrVvGjSLJmpsAGqZwq/JU/kTUaLw= +git.sr.ht/~mariusor/lw v0.0.0-20240313142800-531789c76b6d h1:6bS3+FTFCD80nquIArt+jXc5yDpMqqao3IQW3ODQMEw= +git.sr.ht/~mariusor/lw v0.0.0-20240313142800-531789c76b6d/go.mod h1:kXJ4JsgGBu7IVBKlrVvGjSLJmpsAGqZwq/JU/kTUaLw= github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI= github.com/PuerkitoBio/goquery v1.9.1/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY= github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= @@ -71,10 +71,10 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-ap/activitypub v0.0.0-20240311125533-442f6c0264c8 h1:Tts4VOqc3vkM74xz+6sOi9S2t0Lt9uXwdOnYpi0RuDs= -github.com/go-ap/activitypub v0.0.0-20240311125533-442f6c0264c8/go.mod h1:yRUfFCoZY6C1CWalauqEQ5xYgSckzEBEO/2MBC6BOME= -github.com/go-ap/client v0.0.0-20240311125901-a74d64acf456 h1:FjC/c1l0xk+ObGzV/2Rb1ZNLOZ700R+yn2rvQld/gBc= -github.com/go-ap/client v0.0.0-20240311125901-a74d64acf456/go.mod h1:fUy2zwDM4g5oERfJSJ1q8ShuP7VlIMVmjlEDprOp71s= +github.com/go-ap/activitypub v0.0.0-20240316125321-b61fd6a83225 h1:OoM81OclgRX7CUch4M7MmsH0NcmLWpFiSn7rhs6Y5ZU= +github.com/go-ap/activitypub v0.0.0-20240316125321-b61fd6a83225/go.mod h1:yRUfFCoZY6C1CWalauqEQ5xYgSckzEBEO/2MBC6BOME= +github.com/go-ap/client v0.0.0-20240316125535-27e8db2c2547 h1:3rTVjVuysXdoWTb8JaX39/ov46h38ki91SAJYy/xXeA= +github.com/go-ap/client v0.0.0-20240316125535-27e8db2c2547/go.mod h1:YxuArEgQJgfr6T4Tx25+UkALaPYOC/MbnrwcsyTSusY= github.com/go-ap/errors v0.0.0-20240304112515-6077fa9c17b0 h1:H9MGShwybHLSln6K8RxHPMHiLcD86Lru+5TVW2TcXHY= github.com/go-ap/errors v0.0.0-20240304112515-6077fa9c17b0/go.mod h1:5x8a6P/dhmMGFxWLcyYlyOuJ2lRNaHGhRv+yu8BaTSI= github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 h1:GMKIYXyXPGIp+hYiWOhfqK4A023HdgisDT4YGgf99mw= @@ -302,8 +302,8 @@ github.com/yuin/goldmark-emoji v1.0.2 h1:c/RgTShNgHTtc6xdz2KKI74jJr6rWi7FPgnP9GA github.com/yuin/goldmark-emoji v1.0.2/go.mod h1:RhP/RWpexdp+KHs7ghKnifRoIs/Bq4nDS7tRbCkOwKY= go.hacdias.com/indielib v0.2.3 h1:9bKEuR//QiyjN4EQPk1Fc4RmuOCBZviZyKgYsZd4coI= go.hacdias.com/indielib v0.2.3/go.mod h1:zR/7VfuqHQSOmWB3S5fO5p7YQPaThnR5vYt33yMP05c= -go.mau.fi/util v0.4.0 h1:S2X3qU4pUcb/vxBRfAuZjbrR9xVMAXSjQojNBLPBbhs= -go.mau.fi/util v0.4.0/go.mod h1:leeiHtgVBuN+W9aDii3deAXnfC563iN3WK6BF8/AjNw= +go.mau.fi/util v0.4.1 h1:3EC9KxIXo5+h869zDGf5OOZklRd/FjeVnimTwtm3owg= +go.mau.fi/util v0.4.1/go.mod h1:GjkTEBsehYZbSh2LlE6cWEn+6ZIZTGrTMM/5DMNlmFY= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -312,8 +312,8 @@ golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw= +golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= @@ -395,10 +395,8 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.6/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -maunium.net/go/maulogger/v2 v2.4.1 h1:N7zSdd0mZkB2m2JtFUsiGTQQAdP0YeFWT7YMc80yAL8= -maunium.net/go/maulogger/v2 v2.4.1/go.mod h1:omPuYwYBILeVQobz8uO3XC8DIRuEb5rXYlQSuqrbCho= -maunium.net/go/mautrix v0.17.0 h1:scc1qlUbzPn+wc+3eAPquyD+3gZwwy/hBANBm+iGKK8= -maunium.net/go/mautrix v0.17.0/go.mod h1:j+puTEQCEydlVxhJ/dQP5chfa26TdvBO7X6F3Ataav8= +maunium.net/go/mautrix v0.18.0 h1:sNsApeSWB8x0hLjGcdmi5JqO6Tvp2PVkiSStz+Yas6k= +maunium.net/go/mautrix v0.18.0/go.mod h1:STwJZ+6CAeiEQs7fYCkd5aC12XR5DXANE6Swy/PBKGo= nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= willnorris.com/go/microformats v1.2.0 h1:73pzJCLJM69kYE5qsLI9OOC/7sImNVOzya9EQ0+1wmM= diff --git a/pkgs/yaegiwrappers/github_com-araddon-dateparse.go b/pkgs/yaegiwrappers/github_com-araddon-dateparse.go new file mode 100644 index 0000000..69bc4d0 --- /dev/null +++ b/pkgs/yaegiwrappers/github_com-araddon-dateparse.go @@ -0,0 +1,48 @@ +// Code generated by 'yaegi extract github.com/araddon/dateparse'. DO NOT EDIT. + +// MIT License +// +// Copyright (c) 2020 - 2024 Jan-Lukas Else +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package yaegiwrappers + +import ( + "github.com/araddon/dateparse" + "reflect" +) + +func init() { + Symbols["github.com/araddon/dateparse/dateparse"] = map[string]reflect.Value{ + // function, constant and variable definitions + "ErrAmbiguousMMDD": reflect.ValueOf(&dateparse.ErrAmbiguousMMDD).Elem(), + "MustParse": reflect.ValueOf(dateparse.MustParse), + "ParseAny": reflect.ValueOf(dateparse.ParseAny), + "ParseFormat": reflect.ValueOf(dateparse.ParseFormat), + "ParseIn": reflect.ValueOf(dateparse.ParseIn), + "ParseLocal": reflect.ValueOf(dateparse.ParseLocal), + "ParseStrict": reflect.ValueOf(dateparse.ParseStrict), + "PreferMonthFirst": reflect.ValueOf(dateparse.PreferMonthFirst), + "RetryAmbiguousDateWithSwap": reflect.ValueOf(dateparse.RetryAmbiguousDateWithSwap), + + // type definitions + "ParserOption": reflect.ValueOf((*dateparse.ParserOption)(nil)), + } +} diff --git a/pkgs/yaegiwrappers/wrappers.go b/pkgs/yaegiwrappers/wrappers.go index 6dd68f2..4135a68 100644 --- a/pkgs/yaegiwrappers/wrappers.go +++ b/pkgs/yaegiwrappers/wrappers.go @@ -16,3 +16,4 @@ var ( // Dependencies //go:generate yaegi extract -license ../../LICENSE -name yaegiwrappers github.com/PuerkitoBio/goquery //go:generate yaegi extract -license ../../LICENSE -name yaegiwrappers github.com/carlmjohnson/requests +//go:generate yaegi extract -license ../../LICENSE -name yaegiwrappers github.com/araddon/dateparse diff --git a/uiComponents.go b/uiComponents.go index 9ad31c5..f86c126 100644 --- a/uiComponents.go +++ b/uiComponents.go @@ -282,7 +282,7 @@ func (a *goBlog) renderOldContentWarning(hb *htmlbuilder.HtmlBuilder, p *post, b if b == nil || b.hideOldContentWarning || p == nil || !p.Old() { return } - hb.WriteElementOpen("strong", "class", "p border-top border-bottom") + hb.WriteElementOpen("strong", "class", "p border-top border-bottom", "id", "oldcontentwarning") hb.WriteEscaped(a.ts.GetTemplateStringVariant(b.Lang, "oldcontent")) hb.WriteElementClose("strong") } diff --git a/ui_test.go b/ui_test.go index 4411228..02e0bb1 100644 --- a/ui_test.go +++ b/ui_test.go @@ -61,7 +61,7 @@ func Test_renderOldContentWarning(t *testing.T) { _, err := goquery.NewDocumentFromReader(strings.NewReader(res)) require.NoError(t, err) - assert.Equal(t, "⚠️ This entry is already over one year old. It may no longer be up to date. Opinions may have changed.", res) + assert.Equal(t, "⚠️ This entry is already over one year old. It may no longer be up to date. Opinions may have changed.", res) } func Test_renderInteractions(t *testing.T) {