fix
This commit is contained in:
parent
ebb0be38d9
commit
865b5ff4f4
10 changed files with 43 additions and 29 deletions
|
|
@ -114,7 +114,7 @@ func TestServiceRebrandsEveryLanguagePackProjection(t *testing.T) {
|
||||||
t.Fatalf("%s projection: %v", name, err)
|
t.Fatalf("%s projection: %v", name, err)
|
||||||
}
|
}
|
||||||
appName := findLangPackString(pack.Strings, "AppName")
|
appName := findLangPackString(pack.Strings, "AppName")
|
||||||
if appName == nil || appName.Value != "Telesrv" || appName.ZeroValue != "No Telesrv accounts" || appName.OneValue != "One Telesrv account" || appName.TwoValue != "Two Telesrv accounts" || appName.FewValue != "Few Telesrv accounts" || appName.ManyValue != "Many Telesrv accounts" || appName.OtherValue != "Other Telesrv accounts" {
|
if appName == nil || appName.Value != "OwpenGram" || appName.ZeroValue != "No OwpenGram accounts" || appName.OneValue != "One OwpenGram account" || appName.TwoValue != "Two OwpenGram accounts" || appName.FewValue != "Few OwpenGram accounts" || appName.ManyValue != "Many OwpenGram accounts" || appName.OtherValue != "Other OwpenGram accounts" {
|
||||||
t.Fatalf("%s AppName = %+v, want all value forms rebranded", name, appName)
|
t.Fatalf("%s AppName = %+v, want all value forms rebranded", name, appName)
|
||||||
}
|
}
|
||||||
if got := stringValue(pack.Strings, "TranslationLink"); got != "https://chat.example/root/en" {
|
if got := stringValue(pack.Strings, "TranslationLink"); got != "https://chat.example/root/en" {
|
||||||
|
|
@ -129,7 +129,7 @@ func TestServiceRebrandsEveryLanguagePackProjection(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("list languages: %v", err)
|
t.Fatalf("list languages: %v", err)
|
||||||
}
|
}
|
||||||
if len(languages) != 1 || languages[0].Name != "Telesrv English" || languages[0].NativeName != "Telesrv English" || languages[0].TranslationsURL != "https://chat.example/root/en" {
|
if len(languages) != 1 || languages[0].Name != "OwpenGram English" || languages[0].NativeName != "OwpenGram English" || languages[0].TranslationsURL != "https://chat.example/root/en" {
|
||||||
t.Fatalf("languages = %+v, want branded metadata", languages)
|
t.Fatalf("languages = %+v, want branded metadata", languages)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ func TestCreateCatalogRevisionPreservesHistoricalRevision(t *testing.T) {
|
||||||
t.Fatalf("current=%+v found=%v", current, found)
|
t.Fatalf("current=%+v found=%v", current, found)
|
||||||
}
|
}
|
||||||
historical, found, _ := svc.GiftRevisionByID(ctx, first.Gift.RevisionID)
|
historical, found, _ := svc.GiftRevisionByID(ctx, first.Gift.RevisionID)
|
||||||
if !found || historical.Stars != 50 || historical.Title != "Telesrv Pin" {
|
if !found || historical.Stars != 50 || historical.Title != "OwpenGram Pin" {
|
||||||
t.Fatalf("historical=%+v found=%v", historical, found)
|
t.Fatalf("historical=%+v found=%v", historical, found)
|
||||||
}
|
}
|
||||||
if _, err := svc.SetCatalogEnabled(ctx, first.Gift.ID+999, false); !errors.Is(err, domain.ErrStarGiftNotFound) {
|
if _, err := svc.SetCatalogEnabled(ctx, first.Gift.ID+999, false); !errors.Is(err, domain.ErrStarGiftNotFound) {
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ProductName = "Telesrv"
|
ProductName = "OwpenGram"
|
||||||
ProductUsername = "telesrv"
|
ProductUsername = "owpengram"
|
||||||
DesktopAppName = "Telesrv Desktop"
|
DesktopAppName = "OwpenGram Desktop"
|
||||||
AndroidAppName = "Telesrv Android"
|
AndroidAppName = "OwpenGram Android"
|
||||||
IOSAppName = "Telesrv iOS"
|
IOSAppName = "OwpenGram iOS"
|
||||||
MacOSAppName = "Telesrv macOS"
|
MacOSAppName = "OwpenGram macOS"
|
||||||
WebAAppName = "Telesrv Web A"
|
WebAAppName = "OwpenGram Web A"
|
||||||
WebKAppName = "Telesrv Web K"
|
WebKAppName = "OwpenGram Web K"
|
||||||
PremiumName = "Telesrv Premium"
|
PremiumName = "OwpenGram Premium"
|
||||||
StarsName = "Telesrv Stars"
|
StarsName = "OwpenGram Stars"
|
||||||
DefaultPublicURL = "https://telesrv.net"
|
DefaultPublicURL = "https://owpengram.org"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientAppName returns the branded display name for a stored client platform.
|
// ClientAppName returns the branded display name for a stored client platform.
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ func TestUserVisibleTextRebrandsWordsAndOfficialHosts(t *testing.T) {
|
||||||
"Telegram telegram TELEGRAM Telegram-like https://translations.telegram.org/en t.me/example desktop.telegram.org",
|
"Telegram telegram TELEGRAM Telegram-like https://translations.telegram.org/en t.me/example desktop.telegram.org",
|
||||||
"https://chat.example/root/",
|
"https://chat.example/root/",
|
||||||
)
|
)
|
||||||
want := "Telesrv Telesrv Telesrv Telesrv-like https://chat.example/root/en chat.example/example chat.example"
|
want := "OwpenGram OwpenGram OwpenGram OwpenGram-like https://chat.example/root/en chat.example/example chat.example"
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Fatalf("UserVisibleText() = %q, want %q", got, want)
|
t.Fatalf("UserVisibleText() = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
|
|
@ -27,9 +27,9 @@ func TestUserVisibleTextPreservesTechnicalIdentifiers(t *testing.T) {
|
||||||
|
|
||||||
func TestUserVisibleTextRebrandsBareOfficialHostsWithoutTouchingDottedIdentifiers(t *testing.T) {
|
func TestUserVisibleTextRebrandsBareOfficialHostsWithoutTouchingDottedIdentifiers(t *testing.T) {
|
||||||
for input, want := range map[string]string{
|
for input, want := range map[string]string{
|
||||||
"telegram.org": "telesrv.net",
|
"telegram.org": "owpengram.org",
|
||||||
"desktop.telegram.org": "telesrv.net",
|
"desktop.telegram.org": "owpengram.org",
|
||||||
"t.me/example": "telesrv.net/example",
|
"t.me/example": "owpengram.org/example",
|
||||||
"org.telegram.messenger": "org.telegram.messenger",
|
"org.telegram.messenger": "org.telegram.messenger",
|
||||||
} {
|
} {
|
||||||
if got := UserVisibleText(input, ""); got != want {
|
if got := UserVisibleText(input, ""); got != want {
|
||||||
|
|
@ -40,7 +40,7 @@ func TestUserVisibleTextRebrandsBareOfficialHostsWithoutTouchingDottedIdentifier
|
||||||
|
|
||||||
func TestUserVisibleTextRebrandsLocalizedProductNames(t *testing.T) {
|
func TestUserVisibleTextRebrandsLocalizedProductNames(t *testing.T) {
|
||||||
got := UserVisibleText("Телеграмом تيليجرام تلگرام 텔레그램 טלגרם", "")
|
got := UserVisibleText("Телеграмом تيليجرام تلگرام 텔레그램 טלגרם", "")
|
||||||
if want := "Telesrv Telesrv Telesrv Telesrv Telesrv"; got != want {
|
if want := "OwpenGram OwpenGram OwpenGram OwpenGram OwpenGram"; got != want {
|
||||||
t.Fatalf("UserVisibleText() = %q, want %q", got, want)
|
t.Fatalf("UserVisibleText() = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ func StickerSet(req *tg.MessagesGetStickerSetRequest) tg.MessagesStickerSetClass
|
||||||
if req != nil && req.Hash == emptyStickerSetHash {
|
if req != nil && req.Hash == emptyStickerSetHash {
|
||||||
return &tg.MessagesStickerSetNotModified{}
|
return &tg.MessagesStickerSetNotModified{}
|
||||||
}
|
}
|
||||||
title, shortName := "Telesrv Empty Sticker Set", "telesrv_empty"
|
title, shortName := "OwpenGram Empty Sticker Set", "owpengram_empty"
|
||||||
if req != nil {
|
if req != nil {
|
||||||
switch set := req.Stickerset.(type) {
|
switch set := req.Stickerset.(type) {
|
||||||
case *tg.InputStickerSetAnimatedEmoji:
|
case *tg.InputStickerSetAnimatedEmoji:
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,16 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestServiceIdentityAndLoginMessageUseTelesrvBrand(t *testing.T) {
|
func TestServiceIdentityAndLoginMessageUseOwpenGramBrand(t *testing.T) {
|
||||||
serviceUser := OfficialSystemUser()
|
serviceUser := OfficialSystemUser()
|
||||||
if serviceUser.FirstName != "Telesrv" || serviceUser.Username != "telesrv" {
|
if serviceUser.FirstName != "OwpenGram" || serviceUser.Username != "owpengram" {
|
||||||
t.Fatalf("service user = %+v, want Telesrv identity", serviceUser)
|
t.Fatalf("service user = %+v, want OwpenGram identity", serviceUser)
|
||||||
}
|
}
|
||||||
message, err := OfficialLoginCodeMessage(42, "12345", 1)
|
message, err := OfficialLoginCodeMessage(42, "12345", 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("build login message: %v", err)
|
t.Fatalf("build login message: %v", err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(message.Body, "Telesrv") || strings.Contains(strings.ToLower(message.Body), "telegram") {
|
if !strings.Contains(message.Body, "OwpenGram") || strings.Contains(strings.ToLower(message.Body), "telegram") {
|
||||||
t.Fatalf("login message exposes wrong brand: %q", message.Body)
|
t.Fatalf("login message exposes wrong brand: %q", message.Body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package domain
|
package domain
|
||||||
|
|
||||||
|
import "telesrv/internal/branding"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// OfficialSystemUserID 是 Telegram 兼容客户端识别的官方系统账号。
|
// OfficialSystemUserID 是 Telegram 兼容客户端识别的官方系统账号。
|
||||||
OfficialSystemUserID int64 = 777000
|
OfficialSystemUserID int64 = 777000
|
||||||
|
|
@ -47,8 +49,8 @@ func OfficialSystemUser() User {
|
||||||
ID: OfficialSystemUserID,
|
ID: OfficialSystemUserID,
|
||||||
AccessHash: 6599886787491911851,
|
AccessHash: 6599886787491911851,
|
||||||
Phone: "42777",
|
Phone: "42777",
|
||||||
FirstName: "OwpenGram",
|
FirstName: branding.ProductName,
|
||||||
Username: "owpengram",
|
Username: branding.ProductUsername,
|
||||||
Verified: true,
|
Verified: true,
|
||||||
Support: true,
|
Support: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ func TestCatalogVerifiesSelectedDocument(t *testing.T) {
|
||||||
}
|
}
|
||||||
catalog := New(root)
|
catalog := New(root)
|
||||||
items, err := catalog.List(context.Background())
|
items, err := catalog.List(context.Background())
|
||||||
if err != nil || len(items) != 1 || items[0].ID != 1 || items[0].Title != "Telesrv Pin" {
|
if err != nil || len(items) != 1 || items[0].ID != 1 || items[0].Title != "OwpenGram Pin" {
|
||||||
t.Fatalf("items=%+v err=%v", items, err)
|
t.Fatalf("items=%+v err=%v", items, err)
|
||||||
}
|
}
|
||||||
bundle, err := catalog.Bundle(context.Background(), 1, false)
|
bundle, err := catalog.Bundle(context.Background(), 1, false)
|
||||||
if err != nil || string(bundle.BaseDocument.Data) != string(data) || bundle.Gift.Title != "Telesrv Pin" {
|
if err != nil || string(bundle.BaseDocument.Data) != string(data) || bundle.Gift.Title != "OwpenGram Pin" {
|
||||||
t.Fatalf("bundle=%+v err=%v", bundle, err)
|
t.Fatalf("bundle=%+v err=%v", bundle, err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(filepath.Join(root, "documents", "10.tgs"), []byte("tampered---"), 0o644); err != nil {
|
if err := os.WriteFile(filepath.Join(root, "documents", "10.tgs"), []byte("tampered---"), 0o644); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ func TestSignInServiceNotificationMatchesEnterpriseShape(t *testing.T) {
|
||||||
if update.Popup || update.InboxDate == 0 || update.Media == nil {
|
if update.Popup || update.InboxDate == 0 || update.Media == nil {
|
||||||
t.Fatalf("notification flags/media = popup %v inbox %d media %T", update.Popup, update.InboxDate, update.Media)
|
t.Fatalf("notification flags/media = popup %v inbox %d media %T", update.Popup, update.InboxDate, update.Media)
|
||||||
}
|
}
|
||||||
for _, want := range []string{"New login.", "Test User", "Telesrv Desktop", "Settings > Devices"} {
|
for _, want := range []string{"New login.", "Test User", "OwpenGram Desktop", "Settings > Devices"} {
|
||||||
if !strings.Contains(update.Message, want) {
|
if !strings.Contains(update.Message, want) {
|
||||||
t.Fatalf("notification message %q missing %q", update.Message, want)
|
t.Fatalf("notification message %q missing %q", update.Message, want)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1035,6 +1035,10 @@ func safePublicImageType(value string) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func legacyTgURL(kind, key, value string) string {
|
||||||
|
return schemeURL("tg", kind, key, value)
|
||||||
|
}
|
||||||
|
|
||||||
func schemeURLValues(scheme, kind string, values url.Values) string {
|
func schemeURLValues(scheme, kind string, values url.Values) string {
|
||||||
return (&url.URL{Scheme: scheme, Host: kind, RawQuery: values.Encode()}).String()
|
return (&url.URL{Scheme: scheme, Host: kind, RawQuery: values.Encode()}).String()
|
||||||
}
|
}
|
||||||
|
|
@ -1182,6 +1186,8 @@ type pageData struct {
|
||||||
CanonicalURL string
|
CanonicalURL string
|
||||||
DownloadURL string
|
DownloadURL string
|
||||||
AppURL template.URL
|
AppURL template.URL
|
||||||
|
LegacyTgURL template.URL
|
||||||
|
AppURLJS template.JS
|
||||||
}
|
}
|
||||||
|
|
||||||
type usernamePageData struct {
|
type usernamePageData struct {
|
||||||
|
|
@ -1576,8 +1582,14 @@ var landingTemplate = template.Must(template.New("landing").Parse(`<!doctype htm
|
||||||
{{if .Subtitle}}<div class="sub">{{.Subtitle}}</div>{{end}}
|
{{if .Subtitle}}<div class="sub">{{.Subtitle}}</div>{{end}}
|
||||||
{{if .Description}}<div class="about">{{.Description}}</div>{{end}}
|
{{if .Description}}<div class="about">{{.Description}}</div>{{end}}
|
||||||
<div class="actions"><a class="btn btn-primary" href="{{.AppURL}}">Open in {{.AppName}}</a></div>
|
<div class="actions"><a class="btn btn-primary" href="{{.AppURL}}">Open in {{.AppName}}</a></div>
|
||||||
|
{{if .LegacyTgURL}}<div class="sub">Old test clients only: <a href="{{.LegacyTgURL}}" style="color:inherit;text-decoration:underline">open with tg://</a></div>{{end}}
|
||||||
</div>
|
</div>
|
||||||
</main>` + publicBgIconsScript + `
|
</main>` + publicBgIconsScript + `
|
||||||
|
{{if .AppURLJS}}<script>
|
||||||
|
window.setTimeout(function () {
|
||||||
|
window.location.href = {{.AppURLJS}};
|
||||||
|
}, 250);
|
||||||
|
</script>{{end}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`))
|
`))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue