mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
This commit is contained in:
@@ -403,6 +403,12 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
models.ProvisioningRequest:
|
models.ProvisioningRequest:
|
||||||
properties:
|
properties:
|
||||||
|
DisplayName:
|
||||||
|
description: |-
|
||||||
|
DisplayName is an optional name for the new peer.
|
||||||
|
If unset, a default template value (e.g., "API Peer ...") will be assigned.
|
||||||
|
example: API Peer xyz
|
||||||
|
type: string
|
||||||
InterfaceIdentifier:
|
InterfaceIdentifier:
|
||||||
description: InterfaceIdentifier is the identifier of the WireGuard interface the peer should be linked to.
|
description: InterfaceIdentifier is the identifier of the WireGuard interface the peer should be linked to.
|
||||||
example: wg0
|
example: wg0
|
||||||
|
@@ -1781,6 +1781,11 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Backend": {
|
||||||
|
"description": "the backend used for this interface e.g., local, mikrotik, ...",
|
||||||
|
"type": "string",
|
||||||
|
"example": "local"
|
||||||
|
},
|
||||||
"Disabled": {
|
"Disabled": {
|
||||||
"description": "flag that specifies if the interface is enabled (up) or not (down)",
|
"description": "flag that specifies if the interface is enabled (up) or not (down)",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
@@ -2249,6 +2254,12 @@
|
|||||||
"ApiAdminOnly": {
|
"ApiAdminOnly": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"AvailableBackends": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/model.SettingsBackendNames"
|
||||||
|
}
|
||||||
|
},
|
||||||
"LoginFormVisible": {
|
"LoginFormVisible": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
@@ -2269,6 +2280,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"model.SettingsBackendNames": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"Id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"model.User": {
|
"model.User": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@@ -65,6 +65,10 @@ definitions:
|
|||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
|
Backend:
|
||||||
|
description: the backend used for this interface e.g., local, mikrotik, ...
|
||||||
|
example: local
|
||||||
|
type: string
|
||||||
Disabled:
|
Disabled:
|
||||||
description: flag that specifies if the interface is enabled (up) or not (down)
|
description: flag that specifies if the interface is enabled (up) or not (down)
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -381,6 +385,10 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
ApiAdminOnly:
|
ApiAdminOnly:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
AvailableBackends:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/model.SettingsBackendNames'
|
||||||
|
type: array
|
||||||
LoginFormVisible:
|
LoginFormVisible:
|
||||||
type: boolean
|
type: boolean
|
||||||
MailLinkOnly:
|
MailLinkOnly:
|
||||||
@@ -394,6 +402,13 @@ definitions:
|
|||||||
WebAuthnEnabled:
|
WebAuthnEnabled:
|
||||||
type: boolean
|
type: boolean
|
||||||
type: object
|
type: object
|
||||||
|
model.SettingsBackendNames:
|
||||||
|
properties:
|
||||||
|
Id:
|
||||||
|
type: string
|
||||||
|
Name:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
model.User:
|
model.User:
|
||||||
properties:
|
properties:
|
||||||
ApiEnabled:
|
ApiEnabled:
|
||||||
|
@@ -2086,6 +2086,11 @@
|
|||||||
"InterfaceIdentifier"
|
"InterfaceIdentifier"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"DisplayName": {
|
||||||
|
"description": "DisplayName is an optional name for the new peer.\nIf unset, a default template value (e.g., \"API Peer ...\") will be assigned.",
|
||||||
|
"type": "string",
|
||||||
|
"example": "API Peer xyz"
|
||||||
|
},
|
||||||
"InterfaceIdentifier": {
|
"InterfaceIdentifier": {
|
||||||
"description": "InterfaceIdentifier is the identifier of the WireGuard interface the peer should be linked to.",
|
"description": "InterfaceIdentifier is the identifier of the WireGuard interface the peer should be linked to.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@@ -445,6 +445,12 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
models.ProvisioningRequest:
|
models.ProvisioningRequest:
|
||||||
properties:
|
properties:
|
||||||
|
DisplayName:
|
||||||
|
description: |-
|
||||||
|
DisplayName is an optional name for the new peer.
|
||||||
|
If unset, a default template value (e.g., "API Peer ...") will be assigned.
|
||||||
|
example: API Peer xyz
|
||||||
|
type: string
|
||||||
InterfaceIdentifier:
|
InterfaceIdentifier:
|
||||||
description: InterfaceIdentifier is the identifier of the WireGuard interface
|
description: InterfaceIdentifier is the identifier of the WireGuard interface
|
||||||
the peer should be linked to.
|
the peer should be linked to.
|
||||||
|
@@ -162,7 +162,11 @@ func (p ProvisioningService) NewPeer(ctx context.Context, req models.Provisionin
|
|||||||
if req.PresharedKey != "" {
|
if req.PresharedKey != "" {
|
||||||
peer.PresharedKey = domain.PreSharedKey(req.PresharedKey)
|
peer.PresharedKey = domain.PreSharedKey(req.PresharedKey)
|
||||||
}
|
}
|
||||||
peer.GenerateDisplayName("API")
|
if req.DisplayName == "" {
|
||||||
|
peer.GenerateDisplayName("API")
|
||||||
|
} else {
|
||||||
|
peer.DisplayName = req.DisplayName
|
||||||
|
}
|
||||||
|
|
||||||
// save new peer
|
// save new peer
|
||||||
peer, err = p.peers.CreatePeer(ctx, peer)
|
peer, err = p.peers.CreatePeer(ctx, peer)
|
||||||
|
@@ -68,6 +68,10 @@ type ProvisioningRequest struct {
|
|||||||
// If no user identifier is set, the authenticated user is used.
|
// If no user identifier is set, the authenticated user is used.
|
||||||
UserIdentifier string `json:"UserIdentifier" example:"uid-1234567"`
|
UserIdentifier string `json:"UserIdentifier" example:"uid-1234567"`
|
||||||
|
|
||||||
|
// DisplayName is an optional name for the new peer.
|
||||||
|
// If unset, a default template value (e.g., "API Peer ...") will be assigned.
|
||||||
|
DisplayName string `json:"DisplayName" example:"API Peer xyz" binding:"omitempty"`
|
||||||
|
|
||||||
// PublicKey is the optional public key of the peer. If no public key is set, a new key pair is generated.
|
// PublicKey is the optional public key of the peer. If no public key is set, a new key pair is generated.
|
||||||
PublicKey string `json:"PublicKey" example:"xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=" binding:"omitempty,len=44"`
|
PublicKey string `json:"PublicKey" example:"xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=" binding:"omitempty,len=44"`
|
||||||
// PresharedKey is the optional pre-shared key of the peer. If no pre-shared key is set, a new key is generated.
|
// PresharedKey is the optional pre-shared key of the peer. If no pre-shared key is set, a new key is generated.
|
||||||
|
Reference in New Issue
Block a user