feat(bskyweb): switch to generic pass type, drop strip image
This commit is contained in:
@@ -198,22 +198,14 @@ func (srv *Server) buildPassAssets(theme, handle string, avatarBytes []byte) ([]
|
||||
logo2, _ := readFS(srv.cfg.InvitePass.StripFS, "passes/logo@2x.png")
|
||||
logo3, _ := readFS(srv.cfg.InvitePass.StripFS, "passes/logo@3x.png")
|
||||
|
||||
// Strip is just the per-theme gradient PNG, served as-is. The pass's
|
||||
// storeCard primaryFields render the handle below the strip, so painting
|
||||
// it again on the image would be redundant. avatarBytes is currently
|
||||
// unused; reserved for a future composite that draws the user's avatar.
|
||||
// Generic passes do not use a strip image. The whole pass renders as
|
||||
// backgroundColor. avatarBytes is currently unused; reserved for a future
|
||||
// design that adds a thumbnail.
|
||||
_ = avatarBytes
|
||||
strip1Bytes, err := readFS(srv.cfg.InvitePass.StripFS, "passes/strip-"+theme+".png")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("strip@1x: %w", err)
|
||||
}
|
||||
strip2Bytes, _ := readFS(srv.cfg.InvitePass.StripFS, "passes/strip-"+theme+"@2x.png")
|
||||
strip3Bytes, _ := readFS(srv.cfg.InvitePass.StripFS, "passes/strip-"+theme+"@3x.png")
|
||||
|
||||
assets := []PassAsset{
|
||||
{Name: "icon.png", Data: icon1},
|
||||
{Name: "logo.png", Data: logo1},
|
||||
{Name: "strip.png", Data: strip1Bytes},
|
||||
}
|
||||
if len(icon2) > 0 {
|
||||
assets = append(assets, PassAsset{Name: "icon@2x.png", Data: icon2})
|
||||
@@ -227,12 +219,6 @@ func (srv *Server) buildPassAssets(theme, handle string, avatarBytes []byte) ([]
|
||||
if len(logo3) > 0 {
|
||||
assets = append(assets, PassAsset{Name: "logo@3x.png", Data: logo3})
|
||||
}
|
||||
if len(strip2Bytes) > 0 {
|
||||
assets = append(assets, PassAsset{Name: "strip@2x.png", Data: strip2Bytes})
|
||||
}
|
||||
if len(strip3Bytes) > 0 {
|
||||
assets = append(assets, PassAsset{Name: "strip@3x.png", Data: strip3Bytes})
|
||||
}
|
||||
return assets, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ type passField struct {
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type storeCardFields struct {
|
||||
type passFields struct {
|
||||
HeaderFields []passField `json:"headerFields"`
|
||||
PrimaryFields []passField `json:"primaryFields"`
|
||||
SecondaryFields []passField `json:"secondaryFields"`
|
||||
@@ -59,7 +59,7 @@ type pkPass struct {
|
||||
ForegroundColor string `json:"foregroundColor"`
|
||||
LabelColor string `json:"labelColor"`
|
||||
BackgroundColor string `json:"backgroundColor"`
|
||||
StoreCard storeCardFields `json:"storeCard"`
|
||||
Generic passFields `json:"generic"`
|
||||
Barcodes []barcode `json:"barcodes"`
|
||||
}
|
||||
|
||||
@@ -80,18 +80,18 @@ func BuildPassJSON(did, handle, displayName, theme, teamID string) ([]byte, erro
|
||||
TeamIdentifier: teamID,
|
||||
OrganizationName: "Bluesky",
|
||||
Description: "Bluesky invite - " + atHandle,
|
||||
LogoText: "Bluesky",
|
||||
LogoText: "",
|
||||
ForegroundColor: "rgb(255, 255, 255)",
|
||||
LabelColor: "rgb(255, 255, 255)",
|
||||
BackgroundColor: ThemeBackgroundRGB(theme),
|
||||
StoreCard: storeCardFields{
|
||||
Generic: passFields{
|
||||
HeaderFields: []passField{
|
||||
{Key: "username", Label: "USERNAME", Value: atHandle},
|
||||
},
|
||||
PrimaryFields: []passField{},
|
||||
SecondaryFields: []passField{
|
||||
{Key: "name", Label: "Member Name", Value: memberName},
|
||||
PrimaryFields: []passField{
|
||||
{Key: "name", Label: "MEMBER NAME", Value: memberName},
|
||||
},
|
||||
SecondaryFields: []passField{},
|
||||
BackFields: []passField{
|
||||
{Key: "about", Label: "About", Value: "Scan the QR code to view this Bluesky profile."},
|
||||
{Key: "url", Label: "Profile URL", Value: profileURL},
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
"teamIdentifier": "TEAMID00",
|
||||
"organizationName": "Bluesky",
|
||||
"description": "Bluesky invite - @alice.bsky.social",
|
||||
"logoText": "Bluesky",
|
||||
"logoText": "",
|
||||
"foregroundColor": "rgb(255, 255, 255)",
|
||||
"labelColor": "rgb(255, 255, 255)",
|
||||
"backgroundColor": "rgb(255, 109, 190)",
|
||||
"storeCard": {
|
||||
"generic": {
|
||||
"headerFields": [
|
||||
{
|
||||
"key": "username",
|
||||
@@ -17,14 +17,14 @@
|
||||
"value": "@alice.bsky.social"
|
||||
}
|
||||
],
|
||||
"primaryFields": [],
|
||||
"secondaryFields": [
|
||||
"primaryFields": [
|
||||
{
|
||||
"key": "name",
|
||||
"label": "Member Name",
|
||||
"label": "MEMBER NAME",
|
||||
"value": "Alice"
|
||||
}
|
||||
],
|
||||
"secondaryFields": [],
|
||||
"backFields": [
|
||||
{
|
||||
"key": "about",
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
"teamIdentifier": "TEAMID00",
|
||||
"organizationName": "Bluesky",
|
||||
"description": "Bluesky invite - @alice.bsky.social",
|
||||
"logoText": "Bluesky",
|
||||
"logoText": "",
|
||||
"foregroundColor": "rgb(255, 255, 255)",
|
||||
"labelColor": "rgb(255, 255, 255)",
|
||||
"backgroundColor": "rgb(117, 175, 255)",
|
||||
"storeCard": {
|
||||
"generic": {
|
||||
"headerFields": [
|
||||
{
|
||||
"key": "username",
|
||||
@@ -17,14 +17,14 @@
|
||||
"value": "@alice.bsky.social"
|
||||
}
|
||||
],
|
||||
"primaryFields": [],
|
||||
"secondaryFields": [
|
||||
"primaryFields": [
|
||||
{
|
||||
"key": "name",
|
||||
"label": "Member Name",
|
||||
"label": "MEMBER NAME",
|
||||
"value": "Alice"
|
||||
}
|
||||
],
|
||||
"secondaryFields": [],
|
||||
"backFields": [
|
||||
{
|
||||
"key": "about",
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
"teamIdentifier": "TEAMID00",
|
||||
"organizationName": "Bluesky",
|
||||
"description": "Bluesky invite - @alice.bsky.social",
|
||||
"logoText": "Bluesky",
|
||||
"logoText": "",
|
||||
"foregroundColor": "rgb(255, 255, 255)",
|
||||
"labelColor": "rgb(255, 255, 255)",
|
||||
"backgroundColor": "rgb(177, 90, 162)",
|
||||
"storeCard": {
|
||||
"generic": {
|
||||
"headerFields": [
|
||||
{
|
||||
"key": "username",
|
||||
@@ -17,14 +17,14 @@
|
||||
"value": "@alice.bsky.social"
|
||||
}
|
||||
],
|
||||
"primaryFields": [],
|
||||
"secondaryFields": [
|
||||
"primaryFields": [
|
||||
{
|
||||
"key": "name",
|
||||
"label": "Member Name",
|
||||
"label": "MEMBER NAME",
|
||||
"value": "Alice"
|
||||
}
|
||||
],
|
||||
"secondaryFields": [],
|
||||
"backFields": [
|
||||
{
|
||||
"key": "about",
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@
|
||||
"teamIdentifier": "TEAMID00",
|
||||
"organizationName": "Bluesky",
|
||||
"description": "Bluesky invite - @alice.bsky.social",
|
||||
"logoText": "Bluesky",
|
||||
"logoText": "",
|
||||
"foregroundColor": "rgb(255, 255, 255)",
|
||||
"labelColor": "rgb(255, 255, 255)",
|
||||
"backgroundColor": "rgb(0, 21, 51)",
|
||||
"storeCard": {
|
||||
"generic": {
|
||||
"headerFields": [
|
||||
{
|
||||
"key": "username",
|
||||
@@ -17,14 +17,14 @@
|
||||
"value": "@alice.bsky.social"
|
||||
}
|
||||
],
|
||||
"primaryFields": [],
|
||||
"secondaryFields": [
|
||||
"primaryFields": [
|
||||
{
|
||||
"key": "name",
|
||||
"label": "Member Name",
|
||||
"label": "MEMBER NAME",
|
||||
"value": "Alice"
|
||||
}
|
||||
],
|
||||
"secondaryFields": [],
|
||||
"backFields": [
|
||||
{
|
||||
"key": "about",
|
||||
|
||||
Reference in New Issue
Block a user