branding: make product identity runtime-configurable
Adopt upstream owpengram/owpengram-server's branding.Config/Configure/ Current in place of the old package-level constants. This is the piece the earlier merge attempt was blocked on (internal/branding failed to import during that merge). The default identity is unchanged -- every existing ProductName/ProductUsername/... default still reads "OwpenGram" -- so this is a pure capability add: nothing currently calls Configure, and every call site now reads the current snapshot via a function instead of a compile-time constant. Five string templates that concatenated branding.ProductName into a `const` had to become `var`, since a func call is no longer a valid const operand. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
7fef8438c5
commit
6649b70d5e
15 changed files with 224 additions and 51 deletions
|
|
@ -80,7 +80,7 @@ func (s *Service) DeleteAccount(ctx context.Context, userID int64, authKeyID [8]
|
|||
}
|
||||
executeAt := now.Add(accountDeletionDelay)
|
||||
message := fmt.Sprintf(
|
||||
"A request was made to delete your "+branding.ProductName+" account. If this wasn't you, cancel the request: tg://confirmphone?phone=%s&hash=%s",
|
||||
"A request was made to delete your "+branding.ProductName()+" account. If this wasn't you, cancel the request: tg://confirmphone?phone=%s&hash=%s",
|
||||
url.QueryEscape(snapshot.User.Phone), url.QueryEscape(rawToken),
|
||||
)
|
||||
pending, _, err := s.lifecycle.ScheduleAccountDeletion(ctx, domain.ScheduleAccountDeletion{
|
||||
|
|
|
|||
|
|
@ -1535,9 +1535,9 @@ func (s *Service) passwordNeeded(ctx context.Context, userID int64) (bool, error
|
|||
return found && settings.HasPassword, nil
|
||||
}
|
||||
|
||||
const loginMessageTpl = `Login code: %s. Do not give this code to anyone, even if they say they are from ` + branding.ProductName + `!
|
||||
var loginMessageTpl = `Login code: %s. Do not give this code to anyone, even if they say they are from ` + branding.ProductName() + `!
|
||||
|
||||
This code can be used to log in to your ` + branding.ProductName + ` account. We never ask it for anything else.
|
||||
This code can be used to log in to your ` + branding.ProductName() + ` account. We never ask it for anything else.
|
||||
|
||||
If you didn't request this code by trying to log in on another device, simply ignore this message.`
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const (
|
|||
maxTelegramLoginCommandsPerMessage = 32
|
||||
)
|
||||
|
||||
const botFatherHelpText = `I can help you create and manage ` + branding.ProductName + ` bots.
|
||||
var botFatherHelpText = `I can help you create and manage ` + branding.ProductName() + ` bots.
|
||||
|
||||
You can control me by sending these commands:
|
||||
|
||||
|
|
|
|||
|
|
@ -194,13 +194,13 @@ const (
|
|||
|
||||
// verifierBotWhatText is the part of /start that is true whether or not an
|
||||
// operator has activated this bot, so it is said first and unconditionally.
|
||||
const verifierBotWhatText = `I hand out THIRD-PARTY verification.
|
||||
var verifierBotWhatText = `I hand out THIRD-PARTY verification.
|
||||
|
||||
A third-party mark is a verifier's own icon, shown right before the name of a bot, a channel or an account, plus one line of description in its profile. It means "this verifier vouches for this peer" -- nothing more.
|
||||
|
||||
It is NOT the official ` + branding.ProductName + ` checkmark. The platform badge is granted by the platform itself (@verifybot collects those applications); a third-party mark is granted by the company running a verifier bot. The two are stored, shown and taken away separately, and neither one implies the other.`
|
||||
It is NOT the official ` + branding.ProductName() + ` checkmark. The platform badge is granted by the platform itself (@verifybot collects those applications); a third-party mark is granted by the company running a verifier bot. The two are stored, shown and taken away separately, and neither one implies the other.`
|
||||
|
||||
const verifierBotHelpText = `I am a verifier bot. I grant third-party marks: my icon before the name of your bot, channel or account, plus a description in its profile. This is not the official ` + branding.ProductName + ` checkmark.
|
||||
var verifierBotHelpText = `I am a verifier bot. I grant third-party marks: my icon before the name of your bot, channel or account, plus a description in its profile. This is not the official ` + branding.ProductName() + ` checkmark.
|
||||
|
||||
/start - what a third-party mark is and who grants it
|
||||
/verify - apply for the mark
|
||||
|
|
@ -1121,7 +1121,7 @@ func verifierSummaryText(state domain.BotChatState, settings domain.BotVerifierS
|
|||
b.WriteString("\n\nWhy:\n")
|
||||
b.WriteString(state.Draft[verifierDraftReason])
|
||||
b.WriteString("\n\nThis is a third-party mark, not the official ")
|
||||
b.WriteString(branding.ProductName)
|
||||
b.WriteString(branding.ProductName())
|
||||
b.WriteString(" checkmark, and I do not decide: an operator reads the application and either grants the mark or refuses it. I will message you here either way.")
|
||||
return b.String()
|
||||
}
|
||||
|
|
@ -1170,7 +1170,7 @@ func verifierDecisionText(req domain.CustomVerificationRequest) (string, bool) {
|
|||
switch req.Status {
|
||||
case domain.CustomVerificationApproved:
|
||||
return fmt.Sprintf("Application #%d is approved: %s now carries my mark -- my icon before the name and my description in the profile.\n\nThis is a third-party mark, not the official %s checkmark. Send /revoke if you ever want it removed.",
|
||||
req.ID, label, branding.ProductName), true
|
||||
req.ID, label, branding.ProductName()), true
|
||||
case domain.CustomVerificationRejected:
|
||||
text := fmt.Sprintf("Application #%d for %s was not approved, so no mark was granted.", req.ID, label)
|
||||
if reason := strings.TrimSpace(req.DecisionReason); reason != "" {
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ const (
|
|||
verifyChoiceBlockedPrefix = "no:"
|
||||
)
|
||||
|
||||
const verifyBotStartText = `I collect applications for official ` + branding.ProductName + ` verification: the badge shown next to the name of a channel, supergroup or bot whose identity has been confirmed.
|
||||
var verifyBotStartText = `I collect applications for official ` + branding.ProductName() + ` verification: the badge shown next to the name of a channel, supergroup or bot whose identity has been confirmed.
|
||||
|
||||
Before you apply, check that the subject of the application:
|
||||
- is a channel, supergroup or bot with a public @username;
|
||||
|
|
@ -126,7 +126,7 @@ This badge is never sold and never granted automatically. A person reads every a
|
|||
|
||||
Tap the button below, or send /new, to start. Send /help for the full list of commands.`
|
||||
|
||||
const verifyBotHelpText = `I collect official ` + branding.ProductName + ` verification applications.
|
||||
var verifyBotHelpText = `I collect official ` + branding.ProductName() + ` verification applications.
|
||||
|
||||
/new - file a verification application
|
||||
/status - list your applications and their status
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func (s *Service) SeedDefaultVerifier(ctx context.Context) (bool, error) {
|
|||
if _, err := s.GrantVerifier(ctx, domain.BotVerifierSettings{
|
||||
BotID: domain.VerifierBotUserID,
|
||||
IconDocumentID: icon.DocumentID,
|
||||
CompanyName: branding.ProductName,
|
||||
CompanyName: branding.ProductName(),
|
||||
DefaultDescription: "Bundled reference verifier -- auto-granted on first boot.",
|
||||
CanModifyCustomDescription: false,
|
||||
Enabled: true,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func newServiceWithCacheLimits(packs store.LangPackStore, maxBytes int64, maxEnt
|
|||
packs: packs,
|
||||
packCache: newLangPackCache(maxBytes, maxEntries),
|
||||
languageCache: newLanguageListCache(languageEntries),
|
||||
publicBaseURL: branding.DefaultPublicURL,
|
||||
publicBaseURL: branding.PublicBaseURL(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ func NewService(creds store.PasskeyStore, challenges store.PasskeyChallengeStore
|
|||
creds: creds,
|
||||
challenges: challenges,
|
||||
rpID: rpID,
|
||||
rpName: branding.ProductName,
|
||||
rpName: branding.ProductName(),
|
||||
dcID: dcID,
|
||||
challengeTTL: defaultChallengeTTL,
|
||||
now: time.Now,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue