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

Option to hide paste creator for funneled pastes #51

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
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
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
Loading