Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
9234826
feat(model): update subscription.go
jurajhilje Sep 12, 2025
4b6ccfc
feat(api): update config.go
jurajhilje Sep 12, 2025
66b1e69
feat(client): update http.go
jurajhilje Sep 12, 2025
a35970f
feat(service): update user.go
jurajhilje Sep 12, 2025
c5334ac
feat(app): update Signup.vue
jurajhilje Sep 12, 2025
4800af7
feat(service): update user.go
jurajhilje Sep 12, 2025
b6fd6a5
feat(app): update Signup.vue
jurajhilje Sep 20, 2025
4f9c7d8
feat(api): update req.go
jurajhilje Sep 21, 2025
0b41f1c
feat(app): update Signup.vue
jurajhilje Sep 21, 2025
971482d
feat(api): update http.go
jurajhilje Sep 21, 2025
df00199
feat(api): update http.go
jurajhilje Sep 25, 2025
b56df43
feat(app): update Signup.vue
jurajhilje Sep 25, 2025
579de14
feat(model): update subscription.go
jurajhilje Oct 2, 2025
9d3363c
Merge branch 'main' into task/signup-update
jurajhilje Oct 6, 2025
60c5688
feat(app): update AccountSubscription.vue
jurajhilje Oct 7, 2025
3cd9156
feat(jobs): create subscription.go
jurajhilje Oct 7, 2025
c037329
feat(cron): update subscription.go
jurajhilje Oct 7, 2025
94f8161
feat(model): update subscription.go
jurajhilje Oct 7, 2025
047169e
feat(cron): update subscription.go
jurajhilje Oct 7, 2025
44ea101
feat(service): update subscription.go
jurajhilje Oct 8, 2025
8920d9a
feat(api): update routes.go
jurajhilje Oct 8, 2025
a15c27a
feat(app): update AccountSubscription.vue
jurajhilje Oct 8, 2025
1c8c94d
docs(api): update docs.go
jurajhilje Oct 9, 2025
f46c7b6
feat(api): update go.mod
jurajhilje Oct 9, 2025
3b451e6
feat(model): update subscription.go
jurajhilje Oct 12, 2025
6f7c123
tests: update subscription_test.go
jurajhilje Oct 12, 2025
06df000
tests: update subscription_test.go
jurajhilje Oct 12, 2025
fd26de3
docs(api): update docs.go
jurajhilje Oct 14, 2025
cf81674
feat(app): update AccountSubscription.vue
jurajhilje Oct 16, 2025
e06824c
feat(app): update AccountSubscription.vue
jurajhilje Oct 16, 2025
845d339
feat(service): update subscription.go
jurajhilje Oct 19, 2025
2dacd84
feat(api): update subscription.go
jurajhilje Oct 19, 2025
34030b9
feat(api): update req.go
jurajhilje Oct 20, 2025
0f8a940
feat(app): update AccountSubscription.vue
jurajhilje Oct 20, 2025
9671238
feat(app): update Signup.vue
jurajhilje Oct 20, 2025
579d87f
feat(service): update subscription.go
jurajhilje Oct 20, 2025
a2eac23
feat(service): update user.go
jurajhilje Oct 20, 2025
e0facc5
docs: update docs.go
jurajhilje Oct 20, 2025
6e40351
feat(app): update api/subscription.ts
jurajhilje Oct 20, 2025
fe390ce
feat(app): update AccountSubscription.vue
jurajhilje Oct 20, 2025
d602534
feat(api): update routes.go
jurajhilje Oct 20, 2025
e0fdb47
feat(service): update subscription.go
jurajhilje Oct 21, 2025
e250f4b
feat(api): update subscription.go
jurajhilje Oct 21, 2025
a7fea4d
feat(app): update AccountSubscription.vue
jurajhilje Oct 21, 2025
c6bda9f
feat(api): update main.go
jurajhilje Oct 21, 2025
db17d33
feat(app): update AccountSubscriptionStatus.vue
jurajhilje Oct 21, 2025
ab0ecaa
feat(app): update AccountSubscription.vue
jurajhilje Oct 21, 2025
7ebb5d3
feat(app): update AccountSubscription.vue
jurajhilje Oct 23, 2025
7f15568
Merge pull request #21 from ivpn/task/signup-data-flow
jurajhilje Oct 31, 2025
cfd2834
Merge branch 'main' into task/signup-update
jurajhilje Nov 26, 2025
c1eb446
chore(api): update go.mod
jurajhilje Nov 26, 2025
023a17b
feat(model): update subscription.go
jurajhilje Nov 27, 2025
180225e
Merge branch 'main' into task/signup-update
jurajhilje Nov 27, 2025
3bc626d
tests: update subscription_test.go
jurajhilje Nov 27, 2025
0bbcd29
Merge branch 'main' into task/signup-update
jurajhilje Jan 5, 2026
2517bc3
Merge branch 'main' into task/signup-update
jurajhilje Jan 6, 2026
d9c737c
Merge branch 'main' into task/signup-update
jurajhilje Jan 13, 2026
6b23a2a
Merge branch 'main' into task/signup-update
jurajhilje Jan 15, 2026
c19909a
feat(api): update config.go
jurajhilje Jan 21, 2026
a0cfb95
feat(api): update subscription.go
jurajhilje Jan 21, 2026
10e492e
feat(app): update Signup.vue
jurajhilje Jan 21, 2026
ad65681
feat(app): update Signup.vue
jurajhilje Jan 21, 2026
a5f3578
Merge branch 'main' into task/signup-update
jurajhilje Jan 22, 2026
f0498e7
Merge branch 'main' into task/signup-update
jurajhilje Feb 4, 2026
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
100 changes: 51 additions & 49 deletions api/.env.sample
Original file line number Diff line number Diff line change
@@ -1,67 +1,69 @@
FQDN="localhost"
API_NAME="Service Name"
API_PORT="3000"
API_ALLOW_ORIGIN="http://localhost:3001"
TOKEN_SECRET="secret"
FQDN=localhost
API_NAME=Service Name
API_PORT=3000
API_ALLOW_ORIGIN=http://localhost:3001
TOKEN_SECRET=secret
TOKEN_EXPIRATION=168h
API_TOKEN_EXPIRATION=8760h
PSK=""
PSK_ALLOW_ORIGIN="http://localhost:3001"
DOMAINS="example1.net,example2.com"
LOG_FILE="/var/log/api.log"
BASIC_AUTH_USER=""
BASIC_AUTH_PASSWORD=""
NET_SUBNET=""
NET_GATEWAY=""
SIGNUP_WEBHOOK_URL=""
SIGNUP_WEBHOOK_PSK=""
PSK=
PSK_ALLOW_ORIGIN=http://localhost:3001
DOMAINS=example1.net,example2.com
LOG_FILE=/var/log/api.log
BASIC_AUTH_USER=
BASIC_AUTH_PASSWORD=
NET_SUBNET=
NET_GATEWAY=
SIGNUP_WEBHOOK_URL=
SIGNUP_WEBHOOK_PSK=
PREAUTH_URL=
PREAUTH_PSK=
PREAUTH_TTL=60m

APP_PORT="3001"
APP_PORT=3001

DB_HOSTS="db"
DB_PORT="3306"
DB_NAME="email"
DB_USER="email"
DB_PASSWORD="email"
DB_ROOT_USER="root"
DB_ROOT_PASSWORD="root"
DB_HOSTS=db
DB_PORT=3306
DB_NAME=email
DB_USER=email
DB_PASSWORD=email
DB_ROOT_USER=root
DB_ROOT_PASSWORD=root

REDIS_ADDR="redis:6379"
REDIS_ADDRS=""
REDIS_MASTER_NAME=""
REDIS_USERNAME=""
REDIS_PASSWORD=""
REDIS_FAILOVER_USERNAME=""
REDIS_FAILOVER_PASSWORD=""
REDIS_TLS_ENABLED="false"
REDIS_CERT_FILE=""
REDIS_KEY_FILE=""
REDIS_CA_CERT_FILE=""
REDIS_TLS_INSECURE_SKIP_VERIFY="false"
REDIS_ADDR=redis:6379
REDIS_ADDRS=
REDIS_MASTER_NAME=
REDIS_USERNAME=
REDIS_PASSWORD=
REDIS_FAILOVER_USERNAME=
REDIS_FAILOVER_PASSWORD=
REDIS_TLS_ENABLED=false
REDIS_CERT_FILE=
REDIS_KEY_FILE=
REDIS_CA_CERT_FILE=
REDIS_TLS_INSECURE_SKIP_VERIFY=false

SMTP_CLIENT_HOST="smtp.example.net"
SMTP_CLIENT_PORT="2525"
SMTP_CLIENT_USER=""
SMTP_CLIENT_PASSWORD=""
SMTP_CLIENT_SENDER="from@example.net"
SMTP_CLIENT_SENDER_NAME="From Name"
SMTP_CLIENT_HOST=smtp.example.net
SMTP_CLIENT_PORT=2525
SMTP_CLIENT_USER=
SMTP_CLIENT_PASSWORD=
SMTP_CLIENT_SENDER=from@example.net
SMTP_CLIENT_SENDER_NAME=From Name

OTP_EXPIRATION=15m
SUBSCRIPTION_TYPE=""
SUBSCRIPTION_TYPE=
MAX_CREDENTIALS=10
MAX_RECIPIENTS=10
MAX_DAILY_ALIASES=100
MAX_DAILY_SEND_REPLY=100
MAX_SESSIONS=10
FORWARD_GRACE_PERIOD_DAYS=14
ACCOUNT_GRACE_PERIOD_DAYS=194
ID_LIMITER_MAX=5
ID_LIMITER_EXPIRATION=60m

BACKUP_FILENAME="backup"
BACKUP_CRON_EXPRESSION="0 0 29 2 1"
BACKUP_FILENAME=backup
BACKUP_CRON_EXPRESSION=0 0 29 2 1
BACKUP_RETENTION_DAYS=7
GPG_PASSPHRASE=""
AWS_S3_BUCKET_NAME=""
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
GPG_PASSPHRASE=
AWS_S3_BUCKET_NAME=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
19 changes: 12 additions & 7 deletions api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ type APIConfig struct {
BasicAuthPassword string
SignupWebhookURL string
SignupWebhookPSK string
PreauthURL string
PreauthPSK string
PreauthTTL time.Duration
}

type DBConfig struct {
Expand Down Expand Up @@ -65,7 +68,6 @@ type ServiceConfig struct {
MaxDailyAliases int
MaxDailySendReply int
MaxSessions int
ForwardGracePeriodDays int
AccountGracePeriodDays int
IdLimiterMax int
IdLimiterExpiration time.Duration
Expand Down Expand Up @@ -133,11 +135,6 @@ func New() (Config, error) {
return Config{}, err
}

forwardGracePeriodDays, err := strconv.Atoi(os.Getenv("FORWARD_GRACE_PERIOD_DAYS"))
if err != nil {
return Config{}, err
}

accountGracePeriodDays, err := strconv.Atoi(os.Getenv("ACCOUNT_GRACE_PERIOD_DAYS"))
if err != nil {
return Config{}, err
Expand All @@ -146,6 +143,12 @@ func New() (Config, error) {
dbHosts := strings.Split(os.Getenv("DB_HOSTS"), ",")
redisAddrs := strings.Split(os.Getenv("REDIS_ADDRESSES"), ",")

preauthTTLStr := os.Getenv("PREAUTH_TTL")
preauthTTL, err := time.ParseDuration(preauthTTLStr)
if err != nil {
return Config{}, err
}

return Config{
API: APIConfig{
FQDN: os.Getenv("FQDN"),
Expand All @@ -163,6 +166,9 @@ func New() (Config, error) {
BasicAuthPassword: os.Getenv("BASIC_AUTH_PASSWORD"),
SignupWebhookURL: os.Getenv("SIGNUP_WEBHOOK_URL"),
SignupWebhookPSK: os.Getenv("SIGNUP_WEBHOOK_PSK"),
PreauthURL: os.Getenv("PREAUTH_URL"),
PreauthPSK: os.Getenv("PREAUTH_PSK"),
PreauthTTL: preauthTTL,
},
DB: DBConfig{
Hosts: dbHosts,
Expand Down Expand Up @@ -202,7 +208,6 @@ func New() (Config, error) {
MaxDailyAliases: maxDailyAliases,
MaxDailySendReply: maxDailySendReply,
MaxSessions: maxSessions,
ForwardGracePeriodDays: forwardGracePeriodDays,
AccountGracePeriodDays: accountGracePeriodDays,
IdLimiterMax: idLimiterMax,
IdLimiterExpiration: idLimiterExpiration,
Expand Down
115 changes: 99 additions & 16 deletions api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,46 @@ const docTemplate = `{
}
}
},
"/rotatepasession": {
"put": {
"description": "Rotate pre-auth session ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscription"
],
"summary": "Rotate pre-auth session ID",
"parameters": [
{
"description": "Rotate pre-auth session request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.RotatePASessionReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.SuccessRes"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorRes"
}
}
}
}
},
"/settings": {
"get": {
"security": [
Expand Down Expand Up @@ -1598,14 +1638,14 @@ const docTemplate = `{
}
}
},
"/subscription/add": {
"/sub/session": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Add subscription",
"description": "Add pre-auth session",
"consumes": [
"application/json"
],
Expand All @@ -1615,15 +1655,15 @@ const docTemplate = `{
"tags": [
"subscription"
],
"summary": "Add subscription",
"summary": "Add pre-auth session",
"parameters": [
{
"description": "Subscription request",
"description": "Pre-auth session request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.SubscriptionReq"
"$ref": "#/definitions/api.PASessionReq"
}
}
],
Expand Down Expand Up @@ -2360,6 +2400,25 @@ const docTemplate = `{
}
}
},
"api.PASessionReq": {
"type": "object",
"required": [
"id",
"preauth_id",
"token"
],
"properties": {
"id": {
"type": "string"
},
"preauth_id": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"api.RecipientReq": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2394,6 +2453,17 @@ const docTemplate = `{
}
}
},
"api.RotatePASessionReq": {
"type": "object",
"required": [
"sessionid"
],
"properties": {
"sessionid": {
"type": "string"
}
}
},
"api.SettingsReq": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2459,14 +2529,14 @@ const docTemplate = `{
"api.SubscriptionReq": {
"type": "object",
"required": [
"active_until",
"id"
"id",
"subid"
],
"properties": {
"active_until": {
"id": {
"type": "string"
},
"id": {
"subid": {
"type": "string"
}
}
Expand Down Expand Up @@ -2721,20 +2791,33 @@ const docTemplate = `{
"id": {
"type": "string"
},
"type": {
"$ref": "#/definitions/model.SubscriptionType"
"outage": {
"type": "boolean"
},
"status": {
"$ref": "#/definitions/model.SubscriptionStatus"
},
"tier": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"model.SubscriptionType": {
"model.SubscriptionStatus": {
"type": "string",
"enum": [
"Free",
"Managed"
"active",
"grace_period",
"limited_access",
"pending_delete"
],
"x-enum-varnames": [
"Free",
"Managed"
"Active",
"GracePeriod",
"LimitedAccess",
"PendingDelete"
]
},
"model.TOTPBackup": {
Expand Down
Loading