Option to hide paste creator for funneled pastes
All checks were successful
Nix build / build-docker-arm (pull_request) Successful in 9m12s
Nix build / build-docker (pull_request) Successful in 11m36s

This commit is contained in:
Gabriel Simmer 2024-03-31 17:16:30 +01:00
parent 1f6017e287
commit af145e1f6f
Signed by: arch
SSH key fingerprint: SHA256:m3OEcdtrnBpMX+2BDGh/byv3hrCekCLzDYMdvGEKPPQ
2 changed files with 6 additions and 1 deletions

View file

@ -39,6 +39,7 @@ var (
dataDir = flag.String("data-location", dataLocation(), "where data is stored, defaults to DATA_DIR or ~/.config/tailscale/paste") 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") 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") 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 //go:embed schema.sql
sqlSchema string sqlSchema string
@ -605,12 +606,14 @@ WHERE p.id = ?1`
CreatedAt string CreatedAt string
PasterDisplayName string PasterDisplayName string
PasterProfilePicURL string PasterProfilePicURL string
DisplayUser bool
RawHTML *template.HTML RawHTML *template.HTML
}{ }{
Title: title, Title: title,
CreatedAt: createdAt, CreatedAt: createdAt,
PasterDisplayName: userDisplayName, PasterDisplayName: userDisplayName,
PasterProfilePicURL: userProfilePicURL, PasterProfilePicURL: userProfilePicURL,
DisplayUser: !*hidePasteUserInfo,
RawHTML: rawHTML, RawHTML: rawHTML,
}) })
if err != nil { if err != nil {
@ -636,6 +639,7 @@ WHERE p.id = ?1`
PasterDisplayName string PasterDisplayName string
PasterProfilePicURL string PasterProfilePicURL string
PasterUserID int64 PasterUserID int64
DisplayUser bool
UserID int64 UserID int64
ID string ID string
Data string Data string
@ -647,6 +651,7 @@ WHERE p.id = ?1`
CreatedAt: createdAt, CreatedAt: createdAt,
PasterDisplayName: userDisplayName, PasterDisplayName: userDisplayName,
PasterProfilePicURL: userProfilePicURL, PasterProfilePicURL: userProfilePicURL,
DisplayUser: !*hidePasteUserInfo,
PasterUserID: userID, PasterUserID: userID,
UserID: int64(remoteUserID), UserID: int64(remoteUserID),
ID: id, ID: id,

View file

@ -6,7 +6,7 @@
{{if ne .PasterUserID .UserID}} {{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> <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}} {{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> <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}} {{end}}