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