Skip to content
Open
Changes from all commits
Commits
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
10 changes: 2 additions & 8 deletions subservers/taproot-assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,8 @@ func (t *taprootAssetsSubServer) WhiteListedURLs() map[string]struct{} {
// If it is running in remote mode however, we just allow the request
// through since the remote daemon will handle blocking the call if it
// is not whitelisted there.
publicUniRead := strings.Contains(
t.cfg.Universe.PublicAccess,
string(tap.UniversePublicAccessStatusRead),
)
publicUniWrite := strings.Contains(
t.cfg.Universe.PublicAccess,
string(tap.UniversePublicAccessStatusWrite),
)
publicUniRead := strings.Contains(t.cfg.Universe.PublicAccess, "r")
publicUniWrite := strings.Contains(t.cfg.Universe.PublicAccess, "w")
Comment on lines +180 to +181

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability and maintainability, it's better to avoid magic strings. Please define "r" and "w" as constants. You could add them at the top of the file, for example:

const (
	universePublicAccessRead = "r"
	universePublicAccessWrite = "w"
)
Suggested change
publicUniRead := strings.Contains(t.cfg.Universe.PublicAccess, "r")
publicUniWrite := strings.Contains(t.cfg.Universe.PublicAccess, "w")
publicUniRead := strings.Contains(t.cfg.Universe.PublicAccess, universePublicAccessRead)
publicUniWrite := strings.Contains(t.cfg.Universe.PublicAccess, universePublicAccessWrite)


return taprpc.MacaroonWhitelist(
publicUniRead || t.remote, publicUniWrite || t.remote,
Expand Down
Loading