Skip to content

Commit

Permalink
(BIDS-3049) wip
Browse files Browse the repository at this point in the history
  • Loading branch information
guybrush committed Jun 5, 2024
1 parent 8fcb4a8 commit 0fd79b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
14 changes: 7 additions & 7 deletions cmd/explorer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,18 @@ func main() {
logrus.WithError(err).Error("error decoding csrf auth key falling back to empty csrf key")
}

sameSite := csrf.SameSiteStrictMode
if utils.Config.Frontend.SessionSameSiteNone {
sameSite = csrf.SameSiteNoneMode
}
// sameSite := csrf.SameSiteStrictMode
// if utils.Config.Frontend.SessionSameSiteNone {
// sameSite = csrf.SameSiteNoneMode
// }

csrfHandler := csrf.Protect(
csrfBytes,
csrf.FieldName("CsrfField"),
csrf.Secure(!cfg.Frontend.CsrfInsecure),
csrf.Path("/"),
csrf.Domain(cfg.Frontend.SessionCookieDomain),
csrf.SameSite(sameSite),
// csrf.Domain(cfg.Frontend.SessionCookieDomain),
// csrf.SameSite(sameSite),
)

router.HandleFunc("/", handlers.Index).Methods("GET")
Expand Down Expand Up @@ -593,7 +593,7 @@ func main() {
}

authRouter.Use(handlers.UserAuthMiddleware)
// authRouter.Use(csrfHandler)
authRouter.Use(csrfHandler)

if utils.Config.Frontend.Debug {
// serve files from local directory when debugging, instead of from go embed file
Expand Down
10 changes: 0 additions & 10 deletions exporter/appsubscription_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ func verifyManuall(receipt *types.PremiumData) (*VerifyResponse, error) {

// Does not verify stripe or ethpool payments as those are handled differently
func VerifyReceipt(googleClient *playstore.Client, appleClient *api.StoreClient, receipt *types.PremiumData) (*VerifyResponse, error) {
if utils.Config.Frontend.OldProductsDeadlineUnix > 0 && time.Now().Unix() > utils.Config.Frontend.OldProductsDeadlineUnix {
if _, found := utils.ProductsMapV1ToV2[receipt.ProductID]; found {
logger.WithField("id", receipt.ID).WithField("product_id", receipt.ProductID).WithField("store", receipt.Store).Warn("not verifying old product")
return &VerifyResponse{
Valid: false,
ExpirationDate: 0,
RejectReason: "old_product",
}, nil
}
}
if receipt.Store == "ios-appstore" {
return verifyApple(appleClient, receipt)
} else if receipt.Store == "android-playstore" {
Expand Down
5 changes: 5 additions & 0 deletions handlers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3116,6 +3116,11 @@ func RegisterMobileSubscriptions(w http.ResponseWriter, r *http.Request) {
return
}

if parsedBase.ProductID == "plankton" {
SendBadRequestResponse(w, r.URL.String(), "old product")
return
}

// Only allow ios and android purchases to be registered via this endpoint
if parsedBase.Transaction.Type != "ios-appstore" && parsedBase.Transaction.Type != "android-playstore" {
SendBadRequestResponse(w, r.URL.String(), "invalid transaction type")
Expand Down
4 changes: 2 additions & 2 deletions templates/payment/mobilepricing.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ <h1 class="card-title pricing-card-title">0€ <small class="text-muted">/ mo</s
</ul>
</div>
</div>
<div class="card mx-2 mb-4 box-shadow">
<!-- div class="card mx-2 mb-4 box-shadow">
<div class="card-header">
<h4 class="my-0 font-weight-normal">Plankton</h4>
</div>
Expand Down Expand Up @@ -287,7 +287,7 @@ <h1 class="card-title pricing-card-title">1.99€* <small class="text-muted">/ m
{{ end }}
</div>
</div>
</div -->
</div>
<div style="margin: 0" class="row justify-content-center position-relative">
<div class="card mx-2 mb-4 box-shadow hot-box">
Expand Down

0 comments on commit 0fd79b9

Please sign in to comment.