Skip to content

Commit

Permalink
Merge pull request #51 from gmemstr/hidden-funnel-names
Browse files Browse the repository at this point in the history
Option to hide paste creator for funneled pastes
  • Loading branch information
Erisa committed Jul 15, 2024
2 parents ca16251 + c9e969c commit f7b7121
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/tclipd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
dataDir = flag.String("data-location", dataLocation(), "where data is stored, defaults to DATA_DIR or ~/.config/tailscale/paste")
tsnetLogVerbose = flag.Bool("tsnet-verbose", hasEnv("TSNET_VERBOSE"), "if set, have tsnet log verbosely to standard error")
useFunnel = flag.Bool("use-funnel", hasEnv("USE_FUNNEL"), "if set, expose individual pastes to the public internet with Funnel, USE_FUNNEL in the environment")
hidePasteUserInfo = flag.Bool("hide-funnel-users", hasEnv("HIDE_FUNNEL_USERS"), "if set, display the username and profile picture of the user who created the paste in funneled pastes")

//go:embed schema.sql
sqlSchema string
Expand Down Expand Up @@ -605,12 +606,14 @@ WHERE p.id = ?1`
CreatedAt string
PasterDisplayName string
PasterProfilePicURL string
DisplayUser bool
RawHTML *template.HTML
}{
Title: title,
CreatedAt: createdAt,
PasterDisplayName: userDisplayName,
PasterProfilePicURL: userProfilePicURL,
DisplayUser: !*hidePasteUserInfo,
RawHTML: rawHTML,
})
if err != nil {
Expand All @@ -636,6 +639,7 @@ WHERE p.id = ?1`
PasterDisplayName string
PasterProfilePicURL string
PasterUserID int64
DisplayUser bool
UserID int64
ID string
Data string
Expand All @@ -647,6 +651,7 @@ WHERE p.id = ?1`
CreatedAt: createdAt,
PasterDisplayName: userDisplayName,
PasterProfilePicURL: userProfilePicURL,
DisplayUser: !*hidePasteUserInfo,
PasterUserID: userID,
UserID: int64(remoteUserID),
ID: id,
Expand Down
2 changes: 1 addition & 1 deletion cmd/tclipd/tmpl/showpaste.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{if ne .PasterUserID .UserID}}
<div class="float-right font-medium flex flex-row items-center">{{.PasterDisplayName}} {{if ne .PasterProfilePicURL ""}}<img class="ml-3 w-8 rounded-xl" src="{{.PasterProfilePicURL}}" />{{end}}</div>
{{end}}
{{else}}
{{else if .DisplayUser}}
<div class="float-right font-medium flex flex-row items-center"><span>{{.PasterDisplayName}}</span> {{if ne .PasterProfilePicURL ""}}<img class="ml-3 w-8 rounded-xl" src="{{.PasterProfilePicURL}}" />{{end}}</div>
{{end}}

Expand Down

0 comments on commit f7b7121

Please sign in to comment.