diff --git a/doc/api.oa3 b/doc/api.oa3 index f8ba69b2..713c4ec6 100644 --- a/doc/api.oa3 +++ b/doc/api.oa3 @@ -376,7 +376,7 @@ paths: '500': description: internal server error - /account/disabled: + /account/status: get: tags: - account @@ -390,7 +390,7 @@ paths: content: application/json: schema: - type: boolean + $ref: '#/components/schemas/AccountStatus' '401': description: authentication error '500': @@ -3871,6 +3871,22 @@ components: type: integer format: int64 + AccountStatus: + type: object + required: + - disabled + - storageUsed + - storageAvailable + properties: + disabled: + type: boolean + storageUsed: + type: number + format: int64 + storageAvailable: + type: number + format: int64 + Profile: type: object required: diff --git a/net/server/internal/README.md b/net/server/internal/README.md index d2e12f4a..5b319927 100644 --- a/net/server/internal/README.md +++ b/net/server/internal/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.0.1 -- Build date: 2022-01-13T04:53:26.618Z[GMT] +- Build date: 2022-01-13T05:04:37.485Z[GMT] ### Running the server diff --git a/net/server/internal/model_account_status.go b/net/server/internal/model_account_status.go new file mode 100644 index 00000000..916ed804 --- /dev/null +++ b/net/server/internal/model_account_status.go @@ -0,0 +1,19 @@ +/* + * DataBag + * + * DataBag provides storage for decentralized identity based self-hosting apps. It is intended to support sharing of personal data and hosting group conversations. + * + * API version: 0.0.1 + * Contact: roland.osborne@gmail.com + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package databag + +type AccountStatus struct { + + Disabled bool `json:"disabled"` + + StorageUsed float64 `json:"storageUsed"` + + StorageAvailable float64 `json:"storageAvailable"` +} diff --git a/net/server/internal/routers.go b/net/server/internal/routers.go index ca162993..3fe98a80 100644 --- a/net/server/internal/routers.go +++ b/net/server/internal/routers.go @@ -27,6 +27,15 @@ type Route struct { type Routes []Route func NewRouter() *mux.Router { + + // populate context + _configured = getBoolConfigValue(CONFIG_CONFIGURED, false); + _adminUsername = getStrConfigValue(CONFIG_USERNAME, ""); + _adminPassword = getBinConfigValue(CONFIG_PASSWORD, nil); + _nodeDomain = getStrConfigValue(CONFIG_DOMAIN, ""); + _publicLimit = getNumConfigValue(CONFIG_PUBLICLIMIT, 0); + _accountStorage = getNumConfigValue(CONFIG_STORAGE, 0); + router := mux.NewRouter().StrictSlash(true) for _, route := range routes { var handler http.Handler @@ -114,7 +123,7 @@ var routes = Routes{ Route{ "GetAccountStatus", strings.ToUpper("Get"), - "/account/disabled", + "/account/status", GetAccountStatus, },