Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data/
bin/
dist/
build/
node_modules/
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ start.sh
ts/*.tsbuildinfo
ts/**/*.tsbuildinfo
js/
google-chrome-stable_current_amd64.deb
zorin
zorin.pub
.gitignore
traffic_capture.txt
.gitignore
traffic.dump
config.ini_.bak
.gitignore
config.ini
jfa-go
14 changes: 14 additions & 0 deletions api-invites.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ func (app *appContext) checkInvite(code string, used bool, username string) bool
newInv.RemainingUses--
}
newInv.UsedBy = append(newInv.UsedBy, []string{username, strconv.FormatInt(currentTime.Unix(), 10)})

// Reset PaymentStatus to ensure multi-use invites require payment PER USE.
if newInv.PaymentStatus == "paid" {
newInv.PaymentStatus = ""
}

if !del {
app.storage.SetInvitesKey(code, newInv)
}
Expand Down Expand Up @@ -358,6 +364,14 @@ func (app *appContext) GenerateInvite(gc *gin.Context) {
invite.UserLabel = req.UserLabel
}
invite.Created = currentTime
if req.Price > 0 {
invite.RequiredPayment = true
invite.PriceAmount = req.Price
invite.PriceCurrency = req.Currency
if invite.PriceCurrency == "" {
invite.PriceCurrency = app.config.Section("stripe").Key("price_currency").MustString("usd")
}
}
if req.MultipleUses {
if req.NoLimit {
invite.NoLimit = true
Expand Down
Loading