mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-20 01:04:15 +00:00
implement hold discovery dropdown in settings. implement a data privacy export feature
This commit is contained in:
@@ -43,7 +43,7 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = sharedPublicPDS.Bootstrap(ctx, nil, "did:plc:owner123", true, false, "")
|
||||
err = sharedPublicPDS.Bootstrap(ctx, nil, "did:plc:owner123", true, false, "", "")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = sharedPrivatePDS.Bootstrap(ctx, nil, "did:plc:owner123", false, false, "")
|
||||
err = sharedPrivatePDS.Bootstrap(ctx, nil, "did:plc:owner123", false, false, "", "")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = sharedAllowCrewPDS.Bootstrap(ctx, nil, "did:plc:owner123", false, true, "")
|
||||
err = sharedAllowCrewPDS.Bootstrap(ctx, nil, "did:plc:owner123", false, true, "", "")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -93,7 +93,7 @@ func createTestHoldPDS(t *testing.T, ownerDID string, public bool, allowAllCrew
|
||||
|
||||
// Bootstrap with owner if provided
|
||||
if ownerDID != "" {
|
||||
err = holdPDS.Bootstrap(ctx, nil, ownerDID, public, allowAllCrew, "")
|
||||
err = holdPDS.Bootstrap(ctx, nil, ownerDID, public, allowAllCrew, "", "")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to bootstrap HoldPDS: %v", err)
|
||||
}
|
||||
|
||||
+4
-12
@@ -144,13 +144,13 @@ type captainRecordWithMeta struct {
|
||||
// getCachedCaptainRecord retrieves a captain record from database cache
|
||||
func (a *RemoteHoldAuthorizer) getCachedCaptainRecord(holdDID string) (*captainRecordWithMeta, error) {
|
||||
query := `
|
||||
SELECT owner_did, public, allow_all_crew, deployed_at, region, provider, updated_at
|
||||
SELECT owner_did, public, allow_all_crew, deployed_at, region, updated_at
|
||||
FROM hold_captain_records
|
||||
WHERE hold_did = ?
|
||||
`
|
||||
|
||||
var record atproto.CaptainRecord
|
||||
var deployedAt, region, provider sql.NullString
|
||||
var deployedAt, region sql.NullString
|
||||
var updatedAt time.Time
|
||||
|
||||
err := a.db.QueryRow(query, holdDID).Scan(
|
||||
@@ -159,7 +159,6 @@ func (a *RemoteHoldAuthorizer) getCachedCaptainRecord(holdDID string) (*captainR
|
||||
&record.AllowAllCrew,
|
||||
&deployedAt,
|
||||
®ion,
|
||||
&provider,
|
||||
&updatedAt,
|
||||
)
|
||||
|
||||
@@ -178,9 +177,6 @@ func (a *RemoteHoldAuthorizer) getCachedCaptainRecord(holdDID string) (*captainR
|
||||
if region.Valid {
|
||||
record.Region = region.String
|
||||
}
|
||||
if provider.Valid {
|
||||
record.Provider = provider.String
|
||||
}
|
||||
|
||||
return &captainRecordWithMeta{
|
||||
CaptainRecord: &record,
|
||||
@@ -193,15 +189,14 @@ func (a *RemoteHoldAuthorizer) setCachedCaptainRecord(holdDID string, record *at
|
||||
query := `
|
||||
INSERT INTO hold_captain_records (
|
||||
hold_did, owner_did, public, allow_all_crew,
|
||||
deployed_at, region, provider, updated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
deployed_at, region, updated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
ON CONFLICT(hold_did) DO UPDATE SET
|
||||
owner_did = excluded.owner_did,
|
||||
public = excluded.public,
|
||||
allow_all_crew = excluded.allow_all_crew,
|
||||
deployed_at = excluded.deployed_at,
|
||||
region = excluded.region,
|
||||
provider = excluded.provider,
|
||||
updated_at = excluded.updated_at
|
||||
`
|
||||
|
||||
@@ -212,7 +207,6 @@ func (a *RemoteHoldAuthorizer) setCachedCaptainRecord(holdDID string, record *at
|
||||
record.AllowAllCrew,
|
||||
nullString(record.DeployedAt),
|
||||
nullString(record.Region),
|
||||
nullString(record.Provider),
|
||||
time.Now(),
|
||||
)
|
||||
|
||||
@@ -256,7 +250,6 @@ func (a *RemoteHoldAuthorizer) fetchCaptainRecordFromXRPC(ctx context.Context, h
|
||||
AllowAllCrew bool `json:"allowAllCrew"`
|
||||
DeployedAt string `json:"deployedAt"`
|
||||
Region string `json:"region,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
} `json:"value"`
|
||||
}
|
||||
|
||||
@@ -272,7 +265,6 @@ func (a *RemoteHoldAuthorizer) fetchCaptainRecordFromXRPC(ctx context.Context, h
|
||||
AllowAllCrew: xrpcResp.Value.AllowAllCrew,
|
||||
DeployedAt: xrpcResp.Value.DeployedAt,
|
||||
Region: xrpcResp.Value.Region,
|
||||
Provider: xrpcResp.Value.Provider,
|
||||
}
|
||||
|
||||
return record, nil
|
||||
|
||||
@@ -129,7 +129,6 @@ func TestGetCaptainRecord_CacheHit(t *testing.T) {
|
||||
AllowAllCrew: false,
|
||||
DeployedAt: "2025-10-28T00:00:00Z",
|
||||
Region: "us-east-1",
|
||||
Provider: "fly.io",
|
||||
}
|
||||
|
||||
err := remote.setCachedCaptainRecord(holdDID, captainRecord)
|
||||
|
||||
Reference in New Issue
Block a user