Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge upstream 2024041023 #3

Open
wants to merge 102 commits into
base: feat/add-connect
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
8fe6874
chore: add description field to user
boojack Mar 13, 2024
e795149
chore: tweak memo view display
boojack Mar 13, 2024
ded4da0
feat: use @github/relative-time-element to display time
boojack Mar 13, 2024
2516431
chore: tweak memo content styles
boojack Mar 13, 2024
9ce381a
chore: tweak user profile
boojack Mar 13, 2024
15be18f
chore: update compace mode handler
boojack Mar 14, 2024
115b555
chore: tweak default avatar
boojack Mar 14, 2024
21af2a0
chore: translated using Weblate (French) (#3099)
michaelien Mar 14, 2024
ab136e3
chore: tweak styles
boojack Mar 14, 2024
606a306
fix: check username in signup
boojack Mar 15, 2024
0f48cfb
chore: tweak padding styles
boojack Mar 15, 2024
1447934
chore: remove demo checks
boojack Mar 15, 2024
9c1e2f8
feat: implemented link previews (frontend files) (#3074)
MehadND Mar 16, 2024
335a031
chore: tweak link styles
boojack Mar 16, 2024
ea104a5
chore: fix typo (#3106)
sunxunle Mar 17, 2024
5dd1251
chore: update i18n with Weblate (#3109)
michaelien Mar 17, 2024
cf207df
chore: tweak link styles
boojack Mar 17, 2024
1e43c8d
chore: disallow update workspace setting in demo mode
boojack Mar 17, 2024
f3fb5e0
chore: tweak route enum
boojack Mar 18, 2024
86db6d0
chore: tweak user api definition
boojack Mar 18, 2024
2dc8ed7
chore: tweak linter
boojack Mar 18, 2024
5f2d6b2
chore: tweak memo structure
boojack Mar 18, 2024
efb15a0
chore: tweak naming
boojack Mar 18, 2024
722e356
chore: update memo store
boojack Mar 19, 2024
ed89cb8
chore: update memo relation definition
boojack Mar 19, 2024
96a7d0e
chore: tweak line height
boojack Mar 19, 2024
0a0ccbf
chore: update acl list
boojack Mar 20, 2024
6db427e
chore: update acl list
boojack Mar 20, 2024
76c9363
chore: fix resource link
boojack Mar 20, 2024
a3a4e37
chore: update memo content styles
boojack Mar 20, 2024
7cc8b95
refactor: update resource id naming
boojack Mar 20, 2024
7c5261b
chore: tweak resource definition
boojack Mar 20, 2024
26e5b70
chore: upgrade frontend dependencies
boojack Mar 20, 2024
861a1e4
chore: update i18n with Weblate (#3115)
michaelien Mar 20, 2024
1d83c68
chore: update type definitions
boojack Mar 21, 2024
18d16ab
chore: update workspace service
boojack Mar 21, 2024
8f37d74
chore: fix linter
boojack Mar 21, 2024
c5fa4fe
chore: tweak imports order
boojack Mar 21, 2024
8fd1dff
chore: update migration scripts
boojack Mar 21, 2024
005305c
chore: update relative time display
boojack Mar 22, 2024
d1e8af4
chore: tweak memo view styles
boojack Mar 22, 2024
be525fa
chore: fix migration script
boojack Mar 22, 2024
e703b4f
fix: resource v1 definition
boojack Mar 24, 2024
d460e6b
fix: link node
boojack Mar 25, 2024
2e87da4
chore: update frontend dependencies
boojack Mar 26, 2024
a078059
chore: fix action run
boojack Mar 26, 2024
f637dea
chore: tweak tag list
boojack Mar 26, 2024
16cfef3
chore: tweak statistics translation
boojack Mar 26, 2024
2ebea4d
chore: fix workspace profile api
boojack Mar 27, 2024
a0846c2
feat: add shortcut to edit the previous memo (#3122)
Dubzer Mar 27, 2024
3605efc
chore: removed sanitization logic (#3147)
YohannKovacs Mar 28, 2024
aed4c13
chore: update i18n with Weblate (#3151)
michaelien Mar 28, 2024
7d94256
chore: update i18n with Weblate (#3152)
michaelien Mar 28, 2024
192ee7a
chore: fix memo link
boojack Mar 28, 2024
90679cc
chore: add explore sidebar
boojack Mar 28, 2024
f7a445a
chore: update Vietnamese translation (#3155)
ntheanh201 Mar 29, 2024
7331c59
fix: edit account dialog fields
boojack Mar 29, 2024
bfaf065
chore: translated using Weblate (Portuguese (Brazil)) (#3157)
michaelien Mar 29, 2024
526f468
chore: tweak user list display
boojack Mar 29, 2024
ea66280
chore: update sidebar components
boojack Mar 29, 2024
200a0d3
fix: memo relations
boojack Mar 29, 2024
9f803aa
chore: translated using Weblate (Russian) (#3161)
michaelien Mar 29, 2024
239348c
chore: update i18n with Weblate (#3162)
michaelien Mar 29, 2024
c7aaf79
chore: tweak props naming
boojack Mar 29, 2024
4f7a6cd
chore: fix default logo url
boojack Mar 29, 2024
5ab845d
chore: fix linter
boojack Mar 29, 2024
d84a88e
chore: fix linter
boojack Mar 29, 2024
54a3c25
chore: update memo resource name definition
boojack Mar 30, 2024
9a88e00
fix: link embedded content to uid instead of name (#3164)
ntheanh201 Mar 30, 2024
c8baeb8
chore: fix memo links
boojack Mar 30, 2024
2fe6d60
feat: handle restore memo when is in archived memo detail page (#3165)
ntheanh201 Mar 30, 2024
03c9378
chore: implement list random users
boojack Mar 30, 2024
bb10bb2
chore: implement search random memos
boojack Mar 30, 2024
4d62ed4
chore: tweak words
boojack Mar 30, 2024
cbebbca
chore: add idp definition
boojack Mar 30, 2024
edc7645
chore: fix linter
boojack Mar 30, 2024
98c9ab7
chore: update translation files (#3166)
michaelien Mar 30, 2024
ec35a42
chore: update i18n with Weblate (#3168)
michaelien Mar 31, 2024
b79f626
chore: fix memo comment inbox
boojack Mar 31, 2024
33e9b13
chore: tweak linter
boojack Mar 31, 2024
b1297f5
chore: tweak linter
boojack Mar 31, 2024
5aa6339
chore: use the built-in slices library (#3172)
stayweek Apr 1, 2024
15ef575
chore: go mod tidy
boojack Apr 1, 2024
ba7dbc1
chore: fix task node click handler
boojack Apr 1, 2024
09ffa7b
chore: fix memo link (#3173)
ntheanh201 Apr 1, 2024
bedf3b3
chore: tweak embedded memo styles
boojack Apr 2, 2024
b5893aa
chore: update i18n with Weblate (#3183)
michaelien Apr 7, 2024
8101a5e
chore: add origin flag to config cors
boojack Apr 7, 2024
ff81ea6
chore: tweak error message
boojack Apr 7, 2024
a6b09aa
chore: add confirm dialog for disable password login setting
boojack Apr 7, 2024
756ab71
chore: tweak truncate styles
boojack Apr 7, 2024
90ed908
fix: set navigation icons to not shrink (#3186)
imikod Apr 8, 2024
436a6cb
chore: fix text truncate
boojack Apr 8, 2024
6d10251
feat: impl list syntax auto complete to editor
boojack Apr 8, 2024
b1e196b
fix: delete memo reaction
boojack Apr 8, 2024
fc95876
chore: update memo creator display
boojack Apr 9, 2024
8356ebc
chore: improve localization (#3190)
imikod Apr 9, 2024
bbdd40b
chore: add placeholder to comment editor
boojack Apr 9, 2024
000b3a7
chore: update i18n with weblate (#3195)
michaelien Apr 9, 2024
6028838
chore: update component name
boojack Apr 9, 2024
58ae321
chore: update auth callback messages
boojack Apr 9, 2024
b6796c1
chore: merge upstream 2024041023
whatwewant Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "web/**"

jobs:
eslint-checks:
static-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -28,6 +28,9 @@ jobs:
- name: Run eslint check
run: pnpm lint
working-directory: web
- name: Run type checks
run: pnpm type-check
working-directory: web

frontend-build:
runs-on: ubuntu-latest
Expand Down
43 changes: 25 additions & 18 deletions bin/memos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/usememos/memos/internal/jobs"
"github.com/usememos/memos/server"
_profile "github.com/usememos/memos/server/profile"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
)
Expand All @@ -31,21 +31,22 @@ const (
)

var (
profile *_profile.Profile
mode string
addr string
port int
data string
driver string
dsn string
serveFrontend bool
mode string
addr string
port int
data string
driver string
dsn string
serveFrontend bool
allowedOrigins []string
instanceProfile *profile.Profile

rootCmd = &cobra.Command{
Use: "memos",
Short: `An open-source, self-hosted memo hub with knowledge management and social networking.`,
Short: `An open source, lightweight note-taking service. Easily capture and share your great thoughts.`,
Run: func(_cmd *cobra.Command, _args []string) {
ctx, cancel := context.WithCancel(context.Background())
dbDriver, err := db.NewDBDriver(profile)
dbDriver, err := db.NewDBDriver(instanceProfile)
if err != nil {
cancel()
slog.Error("failed to create db driver", err)
Expand All @@ -57,14 +58,14 @@ var (
return
}

storeInstance := store.New(dbDriver, profile)
storeInstance := store.New(dbDriver, instanceProfile)
if err := storeInstance.MigrateManually(ctx); err != nil {
cancel()
slog.Error("failed to migrate manually", err)
return
}

s, err := server.NewServer(ctx, profile, storeInstance)
s, err := server.NewServer(ctx, instanceProfile, storeInstance)
if err != nil {
cancel()
slog.Error("failed to create server", err)
Expand Down Expand Up @@ -114,6 +115,7 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&driver, "driver", "", "", "database driver")
rootCmd.PersistentFlags().StringVarP(&dsn, "dsn", "", "", "database source name(aka. DSN)")
rootCmd.PersistentFlags().BoolVarP(&serveFrontend, "frontend", "", true, "serve frontend files")
rootCmd.PersistentFlags().StringArrayVarP(&allowedOrigins, "origins", "", []string{}, "CORS allowed domain origins")

err := viper.BindPFlag("mode", rootCmd.PersistentFlags().Lookup("mode"))
if err != nil {
Expand Down Expand Up @@ -143,19 +145,24 @@ func init() {
if err != nil {
panic(err)
}
err = viper.BindPFlag("origins", rootCmd.PersistentFlags().Lookup("origins"))
if err != nil {
panic(err)
}

viper.SetDefault("mode", "demo")
viper.SetDefault("driver", "sqlite")
viper.SetDefault("addr", "")
viper.SetDefault("port", 8081)
viper.SetDefault("frontend", true)
viper.SetDefault("origins", []string{})
viper.SetEnvPrefix("memos")
}

func initConfig() {
viper.AutomaticEnv()
var err error
profile, err = _profile.GetProfile()
instanceProfile, err = profile.GetProfile()
if err != nil {
fmt.Printf("failed to get profile, error: %+v\n", err)
return
Expand All @@ -172,15 +179,15 @@ mode: %s
driver: %s
frontend: %t
---
`, profile.Version, profile.Data, profile.DSN, profile.Addr, profile.Port, profile.Mode, profile.Driver, profile.Frontend)
`, instanceProfile.Version, instanceProfile.Data, instanceProfile.DSN, instanceProfile.Addr, instanceProfile.Port, instanceProfile.Mode, instanceProfile.Driver, instanceProfile.Frontend)
}

func printGreetings() {
print(greetingBanner)
if len(profile.Addr) == 0 {
fmt.Printf("Version %s has been started on port %d\n", profile.Version, profile.Port)
if len(instanceProfile.Addr) == 0 {
fmt.Printf("Version %s has been started on port %d\n", instanceProfile.Version, instanceProfile.Port)
} else {
fmt.Printf("Version %s has been started on address '%s' and port %d\n", profile.Version, profile.Addr, profile.Port)
fmt.Printf("Version %s has been started on address '%s' and port %d\n", instanceProfile.Version, instanceProfile.Addr, instanceProfile.Port)
}
fmt.Printf(`---
See more in:
Expand Down
13 changes: 5 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ require (
github.com/labstack/echo/v4 v4.11.4
github.com/lib/pq v1.10.9
github.com/lithammer/shortuuid/v4 v4.0.0
github.com/microcosm-cc/bluemonday v1.0.26
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/swaggo/swag v1.16.3
github.com/yourselfhosted/gomark v0.0.0-20240228170507-6a73bfad2eb6
golang.org/x/crypto v0.19.0
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
golang.org/x/mod v0.15.0
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.17.0
Expand All @@ -42,21 +40,19 @@ require (
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/spec v0.20.9 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/spec v0.20.14 // indirect
github.com/go-openapi/swag v0.22.9 // indirect
github.com/go-zoox/chalk v1.0.2 // indirect
github.com/go-zoox/connect v1.12.0 // indirect
github.com/go-zoox/core-utils v1.4.5 // indirect
github.com/go-zoox/crypto v1.1.8 // indirect
github.com/go-zoox/datetime v1.3.1 // indirect
github.com/go-zoox/jwt v1.3.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
Expand All @@ -67,6 +63,7 @@ require (
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
Expand Down
42 changes: 10 additions & 32 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.27.0 h1:cjTRjh700H36MQ8M0LnDn33W3Jmw
github.com/aws/aws-sdk-go-v2/service/sts v1.27.0/go.mod h1:nXfOBMWPokIbOY+Gi7a1psWMSvskUCemZzI+SMB7Akc=
github.com/aws/smithy-go v1.20.0 h1:6+kZsCXZwKxZS9RfISnPc4EXlHoyAkm2hPuM8X2BrrQ=
github.com/aws/smithy-go v1.20.0/go.mod h1:uo5RKksAl4PzhqaAbjd4rLgFoq5koTsQKYuGe7dklGc=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand All @@ -88,7 +86,6 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand Down Expand Up @@ -128,21 +125,14 @@ github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgO
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/spec v0.20.9 h1:xnlYNQAwKd2VQRRfwTEI0DcK+2cbuvI/0c7jx3gA8/8=
github.com/go-openapi/spec v0.20.9/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q=
github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs=
github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU=
github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4=
github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do=
github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw=
github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE=
github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
Expand Down Expand Up @@ -228,8 +218,6 @@ github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/feeds v1.1.1 h1:HwKXxqzcRNg9to+BbvJog4+f3s/xzvtZXICcQGutYfY=
github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
Expand Down Expand Up @@ -301,7 +289,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -322,9 +309,6 @@ github.com/lithammer/shortuuid/v4 v4.0.0/go.mod h1:Zs8puNcrvf2rV9rTH51ZLLcj7ZXqQ
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
Expand All @@ -340,8 +324,6 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
Expand Down Expand Up @@ -369,7 +351,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
Expand Down Expand Up @@ -429,8 +410,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
Expand Down Expand Up @@ -478,7 +459,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
Expand Down Expand Up @@ -708,7 +688,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
Expand All @@ -730,7 +709,6 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
2 changes: 1 addition & 1 deletion internal/util/resource_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package util
import "regexp"

var (
ResourceNameMatcher = regexp.MustCompile("^[a-zA-Z0-9]([a-zA-Z0-9-]{1,30}[a-zA-Z0-9])$")
UIDMatcher = regexp.MustCompile("^[a-zA-Z0-9]([a-zA-Z0-9-]{1,30}[a-zA-Z0-9])$")
)
14 changes: 0 additions & 14 deletions plugin/http-getter/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"net/http"
"net/url"
"strings"

"github.com/microcosm-cc/bluemonday"
)

type Image struct {
Expand Down Expand Up @@ -39,21 +37,9 @@ func GetImage(urlStr string) (*Image, error) {
return nil, err
}

bodyBytes, err = SanitizeContent(bodyBytes)
if err != nil {
return nil, err
}

image := &Image{
Blob: bodyBytes,
Mediatype: mediatype,
}
return image, nil
}

func SanitizeContent(content []byte) ([]byte, error) {
bodyString := string(content)

bm := bluemonday.UGCPolicy()
return []byte(bm.Sanitize(bodyString)), nil
}
3 changes: 2 additions & 1 deletion plugin/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ type Memo struct {
}

type Resource struct {
ID int32 `json:"id"`
ID int32 `json:"id"`
UID string `json:"uid"`

// Standard fields
CreatorID int32 `json:"creatorId"`
Expand Down
Loading
Loading