small updates

This commit is contained in:
Cam 2024-02-26 09:54:08 -06:00
parent 34f083c075
commit 7e0a9a111d
No known key found for this signature in database
GPG Key ID: 367B7C7EBD84A8BD
42 changed files with 771 additions and 668 deletions

View File

@ -4,6 +4,7 @@ import Console from "./console/Console";
import {useEffect, useState} from "react";
import Login from "./console/login/Login";
import ResetPassword from "./resetPassword/ResetPassword"
import {updateApiKey} from "./index"
const App = () => {
const [user, setUser] = useState();
@ -14,6 +15,7 @@ const App = () => {
if(localUser) {
console.log(localUser)
setUser(JSON.parse(localUser));
updateApiKey()
console.log("reloaded user", localUser);
}
}

View File

@ -1,11 +1,13 @@
.babelrc
.gitignore
.travis.yml
README.md
docs/AccessRequest.md
docs/AccessResponse.md
docs/AccountApi.md
docs/AdminApi.md
docs/AuthUser.md
docs/ChangePasswordRequest.md
docs/Configuration.md
docs/CreateFrontendRequest.md
docs/CreateFrontendResponse.md
@ -33,6 +35,7 @@ docs/RegisterRequest.md
docs/RegisterResponse.md
docs/ResetPasswordRequest.md
docs/ResetPasswordRequestRequest.md
docs/ResetToken200Response.md
docs/Share.md
docs/ShareApi.md
docs/ShareRequest.md
@ -44,6 +47,7 @@ docs/UpdateFrontendRequest.md
docs/UpdateShareRequest.md
docs/VerifyRequest.md
docs/VerifyResponse.md
git_push.sh
mocha.opts
package.json
src/ApiClient.js
@ -56,6 +60,7 @@ src/index.js
src/model/AccessRequest.js
src/model/AccessResponse.js
src/model/AuthUser.js
src/model/ChangePasswordRequest.js
src/model/Configuration.js
src/model/CreateFrontendRequest.js
src/model/CreateFrontendResponse.js
@ -81,6 +86,7 @@ src/model/RegisterRequest.js
src/model/RegisterResponse.js
src/model/ResetPasswordRequest.js
src/model/ResetPasswordRequestRequest.js
src/model/ResetToken200Response.js
src/model/Share.js
src/model/ShareRequest.js
src/model/ShareResponse.js

View File

@ -1 +1 @@
7.1.0
7.3.0

View File

@ -100,12 +100,18 @@ Please follow the [installation](#installation) instruction and execute the foll
```javascript
var Zrok = require('zrok');
var defaultClient = Zrok.ApiClient.instance;
// Configure API key authorization: key
var key = defaultClient.authentications['key'];
key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//key.apiKeyPrefix['x-token'] = "Token"
var api = new Zrok.AccountApi()
var opts = {
'body': new Zrok.InviteRequest() // {InviteRequest}
'body': new Zrok.ChangePasswordRequest() // {ChangePasswordRequest}
};
api.invite(opts).then(function() {
api.changePassword(opts).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
@ -120,11 +126,13 @@ All URIs are relative to */api/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*Zrok.AccountApi* | [**changePassword**](docs/AccountApi.md#changePassword) | **POST** /changePassword |
*Zrok.AccountApi* | [**invite**](docs/AccountApi.md#invite) | **POST** /invite |
*Zrok.AccountApi* | [**login**](docs/AccountApi.md#login) | **POST** /login |
*Zrok.AccountApi* | [**register**](docs/AccountApi.md#register) | **POST** /register |
*Zrok.AccountApi* | [**resetPassword**](docs/AccountApi.md#resetPassword) | **POST** /resetPassword |
*Zrok.AccountApi* | [**resetPasswordRequest**](docs/AccountApi.md#resetPasswordRequest) | **POST** /resetPasswordRequest |
*Zrok.AccountApi* | [**resetToken**](docs/AccountApi.md#resetToken) | **POST** /resetToken |
*Zrok.AccountApi* | [**verify**](docs/AccountApi.md#verify) | **POST** /verify |
*Zrok.AdminApi* | [**createFrontend**](docs/AdminApi.md#createFrontend) | **POST** /frontend |
*Zrok.AdminApi* | [**createIdentity**](docs/AdminApi.md#createIdentity) | **POST** /identity |
@ -156,6 +164,7 @@ Class | Method | HTTP request | Description
- [Zrok.AccessRequest](docs/AccessRequest.md)
- [Zrok.AccessResponse](docs/AccessResponse.md)
- [Zrok.AuthUser](docs/AuthUser.md)
- [Zrok.ChangePasswordRequest](docs/ChangePasswordRequest.md)
- [Zrok.Configuration](docs/Configuration.md)
- [Zrok.CreateFrontendRequest](docs/CreateFrontendRequest.md)
- [Zrok.CreateFrontendResponse](docs/CreateFrontendResponse.md)
@ -181,6 +190,7 @@ Class | Method | HTTP request | Description
- [Zrok.RegisterResponse](docs/RegisterResponse.md)
- [Zrok.ResetPasswordRequest](docs/ResetPasswordRequest.md)
- [Zrok.ResetPasswordRequestRequest](docs/ResetPasswordRequestRequest.md)
- [Zrok.ResetToken200Response](docs/ResetToken200Response.md)
- [Zrok.Share](docs/Share.md)
- [Zrok.ShareRequest](docs/ShareRequest.md)
- [Zrok.ShareResponse](docs/ShareResponse.md)

View File

@ -1,181 +0,0 @@
/** @module account */
// Auto-generated, edits will be overwritten
import * as gateway from './gateway'
/**
* @param {object} options Optional options
* @param {module:types.changePasswordRequest} [options.body]
* @return {Promise<object>} changed password
*/
export function changePassword(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(changePasswordOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.inviteRequest} [options.body]
* @return {Promise<object>} invitation created
*/
export function invite(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(inviteOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.loginRequest} [options.body]
* @return {Promise<module:types.loginResponse>} login successful
*/
export function login(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(loginOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.registerRequest} [options.body]
* @return {Promise<module:types.registerResponse>} account created
*/
export function register(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(registerOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.resetPasswordRequest} [options.body]
* @return {Promise<object>} password reset
*/
export function resetPassword(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(resetPasswordOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {object} [options.body]
* @return {Promise<object>} forgot password request created
*/
export function resetPasswordRequest(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(resetPasswordRequestOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {object} [options.body]
* @return {Promise<object>} token reset
*/
export function resetToken(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(resetTokenOperation, parameters)
}
/**
* @param {object} options Optional options
* @param {module:types.verifyRequest} [options.body]
* @return {Promise<module:types.verifyResponse>} token ready
*/
export function verify(options) {
if (!options) options = {}
const parameters = {
body: {
body: options.body
}
}
return gateway.request(verifyOperation, parameters)
}
const changePasswordOperation = {
path: '/changePassword',
contentTypes: ['application/zrok.v1+json'],
method: 'post',
security: [
{
id: 'key'
}
]
}
const inviteOperation = {
path: '/invite',
contentTypes: ['application/zrok.v1+json'],
method: 'post'
}
const loginOperation = {
path: '/login',
contentTypes: ['application/zrok.v1+json'],
method: 'post'
}
const registerOperation = {
path: '/register',
contentTypes: ['application/zrok.v1+json'],
method: 'post'
}
const resetPasswordOperation = {
path: '/resetPassword',
contentTypes: ['application/zrok.v1+json'],
method: 'post'
}
const resetPasswordRequestOperation = {
path: '/resetPasswordRequest',
contentTypes: ['application/zrok.v1+json'],
method: 'post'
}
const resetTokenOperation = {
path: '/resetToken',
contentTypes: ['application/zrok.v1+json'],
method: 'post',
security: [
{
id: 'key'
}
]
}
const verifyOperation = {
path: '/verify',
contentTypes: ['application/zrok.v1+json'],
method: 'post'
}

View File

@ -4,15 +4,67 @@ All URIs are relative to */api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**changePassword**](AccountApi.md#changePassword) | **POST** /changePassword |
[**invite**](AccountApi.md#invite) | **POST** /invite |
[**login**](AccountApi.md#login) | **POST** /login |
[**register**](AccountApi.md#register) | **POST** /register |
[**resetPassword**](AccountApi.md#resetPassword) | **POST** /resetPassword |
[**resetPasswordRequest**](AccountApi.md#resetPasswordRequest) | **POST** /resetPasswordRequest |
[**resetToken**](AccountApi.md#resetToken) | **POST** /resetToken |
[**verify**](AccountApi.md#verify) | **POST** /verify |
## changePassword
> changePassword(opts)
### Example
```javascript
import Zrok from 'zrok';
let defaultClient = Zrok.ApiClient.instance;
// Configure API key authorization: key
let key = defaultClient.authentications['key'];
key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//key.apiKeyPrefix = 'Token';
let apiInstance = new Zrok.AccountApi();
let opts = {
'body': new Zrok.ChangePasswordRequest() // ChangePasswordRequest |
};
apiInstance.changePassword(opts).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ChangePasswordRequest**](ChangePasswordRequest.md)| | [optional]
### Return type
null (empty response body)
### Authorization
[key](../README.md#key)
### HTTP request headers
- **Content-Type**: application/zrok.v1+json
- **Accept**: application/zrok.v1+json
## invite
> invite(opts)
@ -233,6 +285,56 @@ No authorization required
- **Accept**: Not defined
## resetToken
> ResetToken200Response resetToken(opts)
### Example
```javascript
import Zrok from 'zrok';
let defaultClient = Zrok.ApiClient.instance;
// Configure API key authorization: key
let key = defaultClient.authentications['key'];
key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//key.apiKeyPrefix = 'Token';
let apiInstance = new Zrok.AccountApi();
let opts = {
'body': new Zrok.ResetPasswordRequestRequest() // ResetPasswordRequestRequest |
};
apiInstance.resetToken(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ResetPasswordRequestRequest**](ResetPasswordRequestRequest.md)| | [optional]
### Return type
[**ResetToken200Response**](ResetToken200Response.md)
### Authorization
[key](../README.md#key)
### HTTP request headers
- **Content-Type**: application/zrok.v1+json
- **Accept**: application/zrok.v1+json
## verify
> VerifyResponse verify(opts)

View File

@ -0,0 +1,11 @@
# Zrok.ChangePasswordRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**email** | **String** | | [optional]
**oldPassword** | **String** | | [optional]
**newPassword** | **String** | | [optional]

View File

@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Number** | | [optional]
**token** | **String** | | [optional]
**shrToken** | **String** | | [optional]
**zId** | **String** | | [optional]
**createdAt** | **Number** | | [optional]

View File

@ -0,0 +1,9 @@
# Zrok.ResetToken200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**token** | **String** | | [optional]

View File

@ -15,6 +15,7 @@ Name | Type | Description | Notes
**oauthEmailDomains** | **[String]** | | [optional]
**oauthAuthorizationCheckInterval** | **String** | | [optional]
**reserved** | **Boolean** | | [optional]
**uniqueName** | **String** | | [optional]
@ -44,6 +45,8 @@ Name | Type | Description | Notes
* `drive` (value: `"drive"`)
* `socks` (value: `"socks"`)

View File

@ -155,7 +155,7 @@ class ApiClient {
url = apiBasePath + path;
}
url = url.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
url = url.replace(/\{([\w-\.#]+)\}/g, (fullMatch, key) => {
var value;
if (pathParams.hasOwnProperty(key)) {
value = this.paramToString(pathParams[key]);

View File

@ -13,12 +13,14 @@
import ApiClient from "../ApiClient";
import ChangePasswordRequest from '../model/ChangePasswordRequest';
import InviteRequest from '../model/InviteRequest';
import LoginRequest from '../model/LoginRequest';
import RegisterRequest from '../model/RegisterRequest';
import RegisterResponse from '../model/RegisterResponse';
import ResetPasswordRequest from '../model/ResetPasswordRequest';
import ResetPasswordRequestRequest from '../model/ResetPasswordRequestRequest';
import ResetToken200Response from '../model/ResetToken200Response';
import VerifyRequest from '../model/VerifyRequest';
import VerifyResponse from '../model/VerifyResponse';
@ -42,6 +44,48 @@ export default class AccountApi {
/**
* @param {Object} opts Optional parameters
* @param {module:model/ChangePasswordRequest} [body]
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
changePasswordWithHttpInfo(opts) {
opts = opts || {};
let postBody = opts['body'];
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['key'];
let contentTypes = ['application/zrok.v1+json'];
let accepts = ['application/zrok.v1+json'];
let returnType = null;
return this.apiClient.callApi(
'/changePassword', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* @param {Object} opts Optional parameters
* @param {module:model/ChangePasswordRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
changePassword(opts) {
return this.changePasswordWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @param {Object} opts Optional parameters
* @param {module:model/InviteRequest} [body]
@ -252,6 +296,48 @@ export default class AccountApi {
}
/**
* @param {Object} opts Optional parameters
* @param {module:model/ResetPasswordRequestRequest} [body]
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ResetToken200Response} and HTTP response
*/
resetTokenWithHttpInfo(opts) {
opts = opts || {};
let postBody = opts['body'];
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['key'];
let contentTypes = ['application/zrok.v1+json'];
let accepts = ['application/zrok.v1+json'];
let returnType = ResetToken200Response;
return this.apiClient.callApi(
'/resetToken', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* @param {Object} opts Optional parameters
* @param {module:model/ResetPasswordRequestRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ResetToken200Response}
*/
resetToken(opts) {
return this.resetTokenWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* @param {Object} opts Optional parameters
* @param {module:model/VerifyRequest} [body]

View File

@ -16,6 +16,7 @@ import ApiClient from './ApiClient';
import AccessRequest from './model/AccessRequest';
import AccessResponse from './model/AccessResponse';
import AuthUser from './model/AuthUser';
import ChangePasswordRequest from './model/ChangePasswordRequest';
import Configuration from './model/Configuration';
import CreateFrontendRequest from './model/CreateFrontendRequest';
import CreateFrontendResponse from './model/CreateFrontendResponse';
@ -41,6 +42,7 @@ import RegisterRequest from './model/RegisterRequest';
import RegisterResponse from './model/RegisterResponse';
import ResetPasswordRequest from './model/ResetPasswordRequest';
import ResetPasswordRequestRequest from './model/ResetPasswordRequestRequest';
import ResetToken200Response from './model/ResetToken200Response';
import Share from './model/Share';
import ShareRequest from './model/ShareRequest';
import ShareResponse from './model/ShareResponse';
@ -114,6 +116,12 @@ export {
*/
AuthUser,
/**
* The ChangePasswordRequest model constructor.
* @property {module:model/ChangePasswordRequest}
*/
ChangePasswordRequest,
/**
* The Configuration model constructor.
* @property {module:model/Configuration}
@ -264,6 +272,12 @@ export {
*/
ResetPasswordRequestRequest,
/**
* The ResetToken200Response model constructor.
* @property {module:model/ResetToken200Response}
*/
ResetToken200Response,
/**
* The Share model constructor.
* @property {module:model/Share}

View File

@ -0,0 +1,111 @@
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 0.3.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from '../ApiClient';
/**
* The ChangePasswordRequest model module.
* @module model/ChangePasswordRequest
* @version 0.3.0
*/
class ChangePasswordRequest {
/**
* Constructs a new <code>ChangePasswordRequest</code>.
* @alias module:model/ChangePasswordRequest
*/
constructor() {
ChangePasswordRequest.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>ChangePasswordRequest</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/ChangePasswordRequest} obj Optional instance to populate.
* @return {module:model/ChangePasswordRequest} The populated <code>ChangePasswordRequest</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new ChangePasswordRequest();
if (data.hasOwnProperty('email')) {
obj['email'] = ApiClient.convertToType(data['email'], 'String');
}
if (data.hasOwnProperty('oldPassword')) {
obj['oldPassword'] = ApiClient.convertToType(data['oldPassword'], 'String');
}
if (data.hasOwnProperty('newPassword')) {
obj['newPassword'] = ApiClient.convertToType(data['newPassword'], 'String');
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>ChangePasswordRequest</code>.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ChangePasswordRequest</code>.
*/
static validateJSON(data) {
// ensure the json data is a string
if (data['email'] && !(typeof data['email'] === 'string' || data['email'] instanceof String)) {
throw new Error("Expected the field `email` to be a primitive type in the JSON string but got " + data['email']);
}
// ensure the json data is a string
if (data['oldPassword'] && !(typeof data['oldPassword'] === 'string' || data['oldPassword'] instanceof String)) {
throw new Error("Expected the field `oldPassword` to be a primitive type in the JSON string but got " + data['oldPassword']);
}
// ensure the json data is a string
if (data['newPassword'] && !(typeof data['newPassword'] === 'string' || data['newPassword'] instanceof String)) {
throw new Error("Expected the field `newPassword` to be a primitive type in the JSON string but got " + data['newPassword']);
}
return true;
}
}
/**
* @member {String} email
*/
ChangePasswordRequest.prototype['email'] = undefined;
/**
* @member {String} oldPassword
*/
ChangePasswordRequest.prototype['oldPassword'] = undefined;
/**
* @member {String} newPassword
*/
ChangePasswordRequest.prototype['newPassword'] = undefined;
export default ChangePasswordRequest;

View File

@ -50,6 +50,9 @@ class Frontend {
if (data.hasOwnProperty('id')) {
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
}
if (data.hasOwnProperty('token')) {
obj['token'] = ApiClient.convertToType(data['token'], 'String');
}
if (data.hasOwnProperty('shrToken')) {
obj['shrToken'] = ApiClient.convertToType(data['shrToken'], 'String');
}
@ -72,6 +75,10 @@ class Frontend {
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>Frontend</code>.
*/
static validateJSON(data) {
// ensure the json data is a string
if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) {
throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']);
}
// ensure the json data is a string
if (data['shrToken'] && !(typeof data['shrToken'] === 'string' || data['shrToken'] instanceof String)) {
throw new Error("Expected the field `shrToken` to be a primitive type in the JSON string but got " + data['shrToken']);
@ -94,6 +101,11 @@ class Frontend {
*/
Frontend.prototype['id'] = undefined;
/**
* @member {String} token
*/
Frontend.prototype['token'] = undefined;
/**
* @member {String} shrToken
*/

View File

@ -0,0 +1,87 @@
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 0.3.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from '../ApiClient';
/**
* The ResetToken200Response model module.
* @module model/ResetToken200Response
* @version 0.3.0
*/
class ResetToken200Response {
/**
* Constructs a new <code>ResetToken200Response</code>.
* @alias module:model/ResetToken200Response
*/
constructor() {
ResetToken200Response.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>ResetToken200Response</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/ResetToken200Response} obj Optional instance to populate.
* @return {module:model/ResetToken200Response} The populated <code>ResetToken200Response</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new ResetToken200Response();
if (data.hasOwnProperty('token')) {
obj['token'] = ApiClient.convertToType(data['token'], 'String');
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>ResetToken200Response</code>.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>ResetToken200Response</code>.
*/
static validateJSON(data) {
// ensure the json data is a string
if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) {
throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']);
}
return true;
}
}
/**
* @member {String} token
*/
ResetToken200Response.prototype['token'] = undefined;
export default ResetToken200Response;

View File

@ -81,6 +81,9 @@ class ShareRequest {
if (data.hasOwnProperty('reserved')) {
obj['reserved'] = ApiClient.convertToType(data['reserved'], 'Boolean');
}
if (data.hasOwnProperty('uniqueName')) {
obj['uniqueName'] = ApiClient.convertToType(data['uniqueName'], 'String');
}
}
return obj;
}
@ -137,6 +140,10 @@ class ShareRequest {
if (data['oauthAuthorizationCheckInterval'] && !(typeof data['oauthAuthorizationCheckInterval'] === 'string' || data['oauthAuthorizationCheckInterval'] instanceof String)) {
throw new Error("Expected the field `oauthAuthorizationCheckInterval` to be a primitive type in the JSON string but got " + data['oauthAuthorizationCheckInterval']);
}
// ensure the json data is a string
if (data['uniqueName'] && !(typeof data['uniqueName'] === 'string' || data['uniqueName'] instanceof String)) {
throw new Error("Expected the field `uniqueName` to be a primitive type in the JSON string but got " + data['uniqueName']);
}
return true;
}
@ -201,6 +208,11 @@ ShareRequest.prototype['oauthAuthorizationCheckInterval'] = undefined;
*/
ShareRequest.prototype['reserved'] = undefined;
/**
* @member {String} uniqueName
*/
ShareRequest.prototype['uniqueName'] = undefined;
@ -267,7 +279,13 @@ ShareRequest['BackendModeEnum'] = {
* value: "drive"
* @const
*/
"drive": "drive"
"drive": "drive",
/**
* value: "socks"
* @const
*/
"socks": "socks"
};

View File

@ -48,6 +48,16 @@
}
describe('AccountApi', function() {
describe('changePassword', function() {
it('should call changePassword successfully', function(done) {
//uncomment below and update the code to test changePassword
//instance.changePassword(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('invite', function() {
it('should call invite successfully', function(done) {
//uncomment below and update the code to test invite
@ -98,6 +108,16 @@
done();
});
});
describe('resetToken', function() {
it('should call resetToken successfully', function(done) {
//uncomment below and update the code to test resetToken
//instance.resetToken(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
describe('verify', function() {
it('should call verify successfully', function(done) {
//uncomment below and update the code to test verify

View File

@ -0,0 +1,77 @@
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 0.3.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.Zrok);
}
}(this, function(expect, Zrok) {
'use strict';
var instance;
beforeEach(function() {
instance = new Zrok.ChangePasswordRequest();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('ChangePasswordRequest', function() {
it('should create an instance of ChangePasswordRequest', function() {
// uncomment below and update the code to test ChangePasswordRequest
//var instance = new Zrok.ChangePasswordRequest();
//expect(instance).to.be.a(Zrok.ChangePasswordRequest);
});
it('should have the property email (base name: "email")', function() {
// uncomment below and update the code to test the property email
//var instance = new Zrok.ChangePasswordRequest();
//expect(instance).to.be();
});
it('should have the property oldPassword (base name: "oldPassword")', function() {
// uncomment below and update the code to test the property oldPassword
//var instance = new Zrok.ChangePasswordRequest();
//expect(instance).to.be();
});
it('should have the property newPassword (base name: "newPassword")', function() {
// uncomment below and update the code to test the property newPassword
//var instance = new Zrok.ChangePasswordRequest();
//expect(instance).to.be();
});
});
}));

View File

@ -60,6 +60,12 @@
//expect(instance).to.be();
});
it('should have the property token (base name: "token")', function() {
// uncomment below and update the code to test the property token
//var instance = new Zrok.Frontend();
//expect(instance).to.be();
});
it('should have the property shrToken (base name: "shrToken")', function() {
// uncomment below and update the code to test the property shrToken
//var instance = new Zrok.Frontend();

View File

@ -0,0 +1,65 @@
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 0.3.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', process.cwd()+'/src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require(process.cwd()+'/src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.Zrok);
}
}(this, function(expect, Zrok) {
'use strict';
var instance;
beforeEach(function() {
instance = new Zrok.ResetToken200Response();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('ResetToken200Response', function() {
it('should create an instance of ResetToken200Response', function() {
// uncomment below and update the code to test ResetToken200Response
//var instance = new Zrok.ResetToken200Response();
//expect(instance).to.be.a(Zrok.ResetToken200Response);
});
it('should have the property token (base name: "token")', function() {
// uncomment below and update the code to test the property token
//var instance = new Zrok.ResetToken200Response();
//expect(instance).to.be();
});
});
}));

View File

@ -120,6 +120,12 @@
//expect(instance).to.be();
});
it('should have the property uniqueName (base name: "uniqueName")', function() {
// uncomment below and update the code to test the property uniqueName
//var instance = new Zrok.ShareRequest();
//expect(instance).to.be();
});
});
}));

View File

@ -1,336 +0,0 @@
/** @module types */
// Auto-generated, edits will be overwritten
/**
* @typedef accessRequest
* @memberof module:types
*
* @property {string} envZId
* @property {string} shrToken
*/
/**
* @typedef accessResponse
* @memberof module:types
*
* @property {string} frontendToken
* @property {string} backendMode
*/
/**
* @typedef authUser
* @memberof module:types
*
* @property {string} username
* @property {string} password
*/
/**
* @typedef changePasswordRequest
* @memberof module:types
*
* @property {string} email
* @property {string} oldPassword
* @property {string} newPassword
*/
/**
* @typedef configuration
* @memberof module:types
*
* @property {string} version
* @property {string} touLink
* @property {boolean} invitesOpen
* @property {boolean} requiresInviteToken
* @property {string} inviteTokenContact
* @property {module:types.passwordRequirements} passwordRequirements
*/
/**
* @typedef createFrontendRequest
* @memberof module:types
*
* @property {string} zId
* @property {string} url_template
* @property {string} public_name
*/
/**
* @typedef createFrontendResponse
* @memberof module:types
*
* @property {string} token
*/
/**
* @typedef deleteFrontendRequest
* @memberof module:types
*
* @property {string} frontendToken
*/
/**
* @typedef disableRequest
* @memberof module:types
*
* @property {string} identity
*/
/**
* @typedef enableRequest
* @memberof module:types
*
* @property {string} description
* @property {string} host
*/
/**
* @typedef enableResponse
* @memberof module:types
*
* @property {string} identity
* @property {string} cfg
*/
/**
* @typedef environment
* @memberof module:types
*
* @property {string} description
* @property {string} host
* @property {string} address
* @property {string} zId
* @property {module:types.sparkData} activity
* @property {boolean} limited
* @property {number} createdAt
* @property {number} updatedAt
*/
/**
* @typedef environmentAndResources
* @memberof module:types
*
* @property {module:types.environment} environment
* @property {module:types.frontends} frontends
* @property {module:types.shares} shares
*/
/**
* @typedef frontend
* @memberof module:types
*
* @property {number} id
* @property {string} token
* @property {string} shrToken
* @property {string} zId
* @property {number} createdAt
* @property {number} updatedAt
*/
/**
* @typedef inviteTokenGenerateRequest
* @memberof module:types
*
* @property {string[]} tokens
*/
/**
* @typedef inviteRequest
* @memberof module:types
*
* @property {string} email
* @property {string} token
*/
/**
* @typedef loginRequest
* @memberof module:types
*
* @property {string} email
* @property {string} password
*/
/**
* @typedef metrics
* @memberof module:types
*
* @property {string} scope
* @property {string} id
* @property {number} period
* @property {module:types.metricsSample[]} samples
*/
/**
* @typedef metricsSample
* @memberof module:types
*
* @property {number} rx
* @property {number} tx
* @property {number} timestamp
*/
/**
* @typedef overview
* @memberof module:types
*
* @property {boolean} accountLimited
* @property {module:types.environmentAndResources[]} environments
*/
/**
* @typedef passwordRequirements
* @memberof module:types
*
* @property {number} length
* @property {boolean} requireCapital
* @property {boolean} requireNumeric
* @property {boolean} requireSpecial
* @property {string} validSpecialCharacters
*/
/**
* @typedef principal
* @memberof module:types
*
* @property {number} id
* @property {string} email
* @property {string} token
* @property {boolean} limitless
* @property {boolean} admin
*/
/**
* @typedef publicFrontend
* @memberof module:types
*
* @property {string} token
* @property {string} zId
* @property {string} urlTemplate
* @property {string} publicName
* @property {number} createdAt
* @property {number} updatedAt
*/
/**
* @typedef registerRequest
* @memberof module:types
*
* @property {string} token
* @property {string} password
*/
/**
* @typedef registerResponse
* @memberof module:types
*
* @property {string} token
*/
/**
* @typedef resetPasswordRequest
* @memberof module:types
*
* @property {string} token
* @property {string} password
*/
/**
* @typedef share
* @memberof module:types
*
* @property {string} token
* @property {string} zId
* @property {string} shareMode
* @property {string} backendMode
* @property {string} frontendSelection
* @property {string} frontendEndpoint
* @property {string} backendProxyEndpoint
* @property {boolean} reserved
* @property {module:types.sparkData} activity
* @property {boolean} limited
* @property {number} createdAt
* @property {number} updatedAt
*/
/**
* @typedef shareRequest
* @memberof module:types
*
* @property {string} envZId
* @property {string} shareMode
* @property {string[]} frontendSelection
* @property {string} backendMode
* @property {string} backendProxyEndpoint
* @property {string} authScheme
* @property {module:types.authUser[]} authUsers
* @property {string} oauthProvider
* @property {string[]} oauthEmailDomains
* @property {string} oauthAuthorizationCheckInterval
* @property {boolean} reserved
* @property {string} uniqueName
*/
/**
* @typedef shareResponse
* @memberof module:types
*
* @property {string[]} frontendProxyEndpoints
* @property {string} shrToken
*/
/**
* @typedef sparkDataSample
* @memberof module:types
*
* @property {number} rx
* @property {number} tx
*/
/**
* @typedef unaccessRequest
* @memberof module:types
*
* @property {string} frontendToken
* @property {string} envZId
* @property {string} shrToken
*/
/**
* @typedef unshareRequest
* @memberof module:types
*
* @property {string} envZId
* @property {string} shrToken
* @property {boolean} reserved
*/
/**
* @typedef updateFrontendRequest
* @memberof module:types
*
* @property {string} frontendToken
* @property {string} publicName
* @property {string} urlTemplate
*/
/**
* @typedef updateShareRequest
* @memberof module:types
*
* @property {string} shrToken
* @property {string} backendProxyEndpoint
*/
/**
* @typedef verifyRequest
* @memberof module:types
*
* @property {string} token
*/
/**
* @typedef verifyResponse
* @memberof module:types
*
* @property {string} email
*/

View File

@ -3,8 +3,8 @@ import {useEffect, useState} from "react";
import Visualizer from "./visualizer/Visualizer";
import Enable from "./modals/Enable";
import Version from "./modals/Version";
import {MetadataApi} from "../api/src";
import Detail from "./detail/Detail";
import { metadataApi } from "..";
const Console = (props) => {
const [showEnableModal, setShowEnableModal] = useState(false);
@ -17,11 +17,9 @@ const Console = (props) => {
const [overview, setOverview] = useState({});
const metadata = new MetadataApi()
useEffect(() => {
let mounted = true;
metadata.overview().then(resp => {
metadataApi.overview().then(resp => {
if(mounted) {
setOverview(resp);
}
@ -31,7 +29,7 @@ const Console = (props) => {
useEffect(() => {
let mounted = true;
let interval = setInterval(() => {
metadata.overview().then(resp => {
metadataApi.overview().then(resp => {
if(mounted) {
setOverview(resp);
}

View File

@ -1,17 +1,16 @@
import {mdiAccessPointNetwork} from "@mdi/js";
import Icon from "@mdi/react";
import {useEffect, useState} from "react";
import {MetadataApi} from "../../../api/src";
import {Tab, Tabs} from "react-bootstrap";
import DetailTab from "./DetailTab";
import ActionsTab from "./ActionsTab";
import { metadataApi } from "../../..";
const AccessDetail = (props) => {
const [detail, setDetail] = useState({});
const metadata = new MetadataApi()
useEffect(() => {
metadata.getFrontendDetail(props.selection.feId)
metadataApi.getFrontendDetail(props.selection.feId)
.then(resp => {
setDetail(resp);
});

View File

@ -1,7 +1,8 @@
import * as share from "../../../api/share";
import {ShareApi} from "../../../api/src";
import {Button} from "react-bootstrap";
const ActionsTab = (props) => {
const share = new ShareApi()
const deleteFrontend = (feToken, shrToken, envZId) => {
if(window.confirm("Really delete access frontend '" + feToken + "' for share '" + shrToken + "'?")) {
share.unaccess({body: {frontendToken: feToken, shrToken: shrToken, envZId: envZId}}).then(resp => {

View File

@ -1,23 +1,25 @@
import React, {useEffect, useState} from "react";
import {MetadataApi} from "../../../api/src";
import {Area, AreaChart, ResponsiveContainer} from "recharts";
import DataTable from "react-data-table-component";
import { metadataApi } from "../../..";
const EnvironmentsTab = (props) => {
const [detail, setDetail] = useState([]);
const metadata = new MetadataApi()
useEffect(() => {
metadata.getAccountDetail()
console.log("getting account details")
metadataApi.getAccountDetail()
.then(resp => {
setDetail(resp);
}).catch(err => {
console.log(err)
});
}, [props.selection]);
useEffect(() => {
let mounted = true;
let interval = setInterval(() => {
metadata.getAccountDetail()
metadataApi.getAccountDetail()
.then(resp => {
if(mounted) {
setDetail(resp);

View File

@ -1,24 +1,23 @@
import React, {useEffect, useState} from "react";
import {buildMetrics} from "../../metrics/util";
import {MetadataApi} from "../../../api/src";
import MetricsView from "../../metrics/MetricsView";
import { metadataApi } from "../../..";
const MetricsTab = () => {
const [metrics30, setMetrics30] = useState(buildMetrics([]));
const [metrics7, setMetrics7] = useState(buildMetrics([]));
const [metrics1, setMetrics1] = useState(buildMetrics([]));
const metadata = new MetadataApi()
useEffect(() => {
metadata.getAccountMetrics()
metadataApi.getAccountMetrics()
.then(resp => {
setMetrics30(buildMetrics(resp));
});
metadata.getAccountMetrics({duration: "168h"})
metadataApi.getAccountMetrics({duration: "168h"})
.then(resp => {
setMetrics7(buildMetrics(resp));
});
metadata.getAccountMetrics({duration: "24h"})
metadataApi.getAccountMetrics({duration: "24h"})
.then(resp => {
setMetrics1(buildMetrics(resp));
});
@ -27,17 +26,17 @@ const MetricsTab = () => {
useEffect(() => {
let mounted = true;
let interval = setInterval(() => {
metadata.getAccountMetrics()
metadataApi.getAccountMetrics()
.then(resp => {
if(mounted) {
setMetrics30(buildMetrics(resp));
}
});
metadata.getAccountMetrics({duration: "168h"})
metadataApi.getAccountMetrics({duration: "168h"})
.then(resp => {
setMetrics7(buildMetrics(resp));
});
metadata.getAccountMetrics({duration: "24h"})
metadataApi.getAccountMetrics({duration: "24h"})
.then(resp => {
setMetrics1(buildMetrics(resp));
});

View File

@ -1,8 +1,7 @@
import React, {useEffect, useState} from "react";
import * as account from "../../../../api/account";
import {Button, Container, Form, Row} from "react-bootstrap";
import Modal from "react-bootstrap/Modal";
import * as metadata from "../../../../api/metadata";
import { accountApi, metadataApi } from "../../../..";
const validatePassword = (password, l, rc, rn, rs, spc, cb) => {
if(password.length < l) {
@ -39,14 +38,13 @@ const ChangePassword = (props) => {
const [passwordValidSpecialCharacters, setPasswordValidSpecialCharacters] = useState("");
useEffect(() => {
metadata.configuration().then(resp => {
if (!resp.error) {
setPasswordLength(resp.data.passwordRequirements.length)
setPasswordRequireCapital(resp.data.passwordRequirements.requireCapital)
setPasswordRequireNumeric(resp.data.passwordRequirements.requireNumeric)
setPasswordRequireSpecial(resp.data.passwordRequirements.requireSpecial)
setPasswordValidSpecialCharacters(resp.data.passwordRequirements.validSpecialCharacters)
}
metadataApi.configuration().then(resp => {
console.log(resp)
setPasswordLength(resp.passwordRequirements.length)
setPasswordRequireCapital(resp.passwordRequirements.requireCapital)
setPasswordRequireNumeric(resp.passwordRequirements.requireNumeric)
setPasswordRequireSpecial(resp.passwordRequirements.requireSpecial)
setPasswordValidSpecialCharacters(resp.passwordRequirements.validSpecialCharacters)
}).catch(err => {
console.log("error getting configuration", err);
});
@ -71,14 +69,10 @@ const ChangePassword = (props) => {
return;
}
account.changePassword({ body: { oldPassword: oldPassword, newPassword: newPassword, email: props.user.email } })
accountApi.changePassword({ body: { oldPassword: oldPassword, newPassword: newPassword, email: props.user.email } })
.then(resp => {
if (!resp.error) {
console.log("resp", resp)
setMessage("Password successfully changed!");
} else {
setMessage("Failure changing password! Is old password correct?");
}
console.log("resp", resp)
setMessage("Password successfully changed!");
}).catch(resp => {
console.log("resp", resp)
setMessage("Failure changing password! Is old password correct?")

View File

@ -1,12 +1,13 @@
import Modal from "react-bootstrap/Modal";
import {Button, Container, Form, Row} from "react-bootstrap";
import React, {useState} from "react";
import * as account from "../../../../api/account";
import {accountApi} from "../../../..";
const RegenerateToken = (props) => {
const [confirmEmail, setConfirmEmail] = useState('');
const [message, setMessage] = useState('');
const hide = () => {
props.onHide();
setConfirmEmail('');
@ -21,16 +22,16 @@ const RegenerateToken = (props) => {
return;
}
account.resetToken({body: {emailAddress: props.user.email}})
accountApi.resetToken({body: {emailAddress: props.user.email}})
.then(resp => {
console.log(resp);
let user = JSON.parse(localStorage.getItem('user'));
localStorage.setItem('user', JSON.stringify({
email: user.email,
token: resp.data.token
token: resp.token
}));
document.dispatchEvent(new Event('storage'));
setMessage("Your new account token is: " + resp.data.token);
setMessage("Your new account token is: " + resp.token);
}).catch(err => {
setMessage("Account token regeneration failed!");
console.log("account token regeneration failed", err);

View File

@ -3,17 +3,16 @@ import SharesTab from "./SharesTab";
import {useEffect, useState} from "react";
import Icon from "@mdi/react";
import {mdiConsoleNetwork} from "@mdi/js";
import {MetadataApi} from "../../../api/src";
import DetailTab from "./DetailTab";
import ActionsTab from "./ActionsTab";
import MetricsTab from "./MetricsTab";
import { metadataApi } from "../../..";
const EnvironmentDetail = (props) => {
const [detail, setDetail] = useState({});
const metadata = new MetadataApi()
useEffect(() => {
metadata.getEnvironmentDetail(props.selection.envZId)
metadataApi.getEnvironmentDetail(props.selection.envZId)
.then(resp => {
setDetail(resp);
});

View File

@ -1,26 +1,31 @@
import React, {useEffect, useState} from "react";
import {buildMetrics} from "../../metrics/util";
import {MetadataApi} from "../../../api/src";
import MetricsView from "../../metrics/MetricsView";
import { metadataApi } from "../../..";
const MetricsTab = (props) => {
const [metrics30, setMetrics30] = useState(buildMetrics([]));
const [metrics7, setMetrics7] = useState(buildMetrics([]));
const [metrics1, setMetrics1] = useState(buildMetrics([]));
const metadata = new MetadataApi()
useEffect(() => {
metadata.getEnvironmentMetrics(props.selection.envZId)
metadataApi.getEnvironmentMetrics(props.selection.envZId)
.then(resp => {
setMetrics30(buildMetrics(resp));
}).catch(err => {
console.log(err)
});
metadata.getEnvironmentMetrics(props.selection.envZId, {duration: "168h"})
metadataApi.getEnvironmentMetrics(props.selection.envZId, {duration: "168h"})
.then(resp => {
setMetrics7(buildMetrics(resp));
}).catch(err => {
console.log(err)
});
metadata.getEnvironmentMetrics(props.selection.envZId, {duration: "24h"})
metadataApi.getEnvironmentMetrics(props.selection.envZId, {duration: "24h"})
.then(resp => {
setMetrics1(buildMetrics(resp));
}).catch(err => {
console.log(err)
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.selection.id]);
@ -28,19 +33,25 @@ const MetricsTab = (props) => {
useEffect(() => {
let mounted = true;
let interval = setInterval(() => {
metadata.getEnvironmentMetrics(props.selection.envZId)
metadataApi.getEnvironmentMetrics(props.selection.envZId)
.then(resp => {
if(mounted) {
setMetrics30(buildMetrics(resp));
}
}).catch(err => {
console.log(err)
});
metadata.getEnvironmentMetrics(props.selection.envZId, {duration: "168h"})
metadataApi.getEnvironmentMetrics(props.selection.envZId, {duration: "168h"})
.then(resp => {
setMetrics7(buildMetrics(resp));
}).catch(err => {
console.log(err)
});
metadata.getEnvironmentMetrics(props.selection.envZId, {duration: "24h"})
metadataApi.getEnvironmentMetrics(props.selection.envZId, {duration: "24h"})
.then(resp => {
setMetrics1(buildMetrics(resp));
}).catch(err => {
console.log(err)
});
}, 5000);
return () => {

View File

@ -1,14 +1,13 @@
import {MetadataApi} from "../../../api/src";
import React, {useEffect, useState} from "react";
import DataTable from 'react-data-table-component';
import {Area, AreaChart, ResponsiveContainer} from "recharts";
import { metadataApi } from "../../..";
const SharesTab = (props) => {
const [detail, setDetail] = useState({});
const metadata = new MetadataApi()
useEffect(() => {
metadata.getEnvironmentDetail(props.selection.envZId)
metadataApi.getEnvironmentDetail(props.selection.envZId)
.then(resp => {
setDetail(resp);
});
@ -17,7 +16,7 @@ const SharesTab = (props) => {
useEffect(() => {
let mounted = true;
let interval = setInterval(() => {
metadata.getEnvironmentDetail(props.selection.envZId)
metadataApi.getEnvironmentDetail(props.selection.envZId)
.then(resp => {
if(mounted) {
setDetail(resp);

View File

@ -1,25 +1,24 @@
import React, {useEffect, useState} from "react";
import {buildMetrics} from "../../metrics/util";
import {MetadataApi} from "../../../api/src";
import MetricsView from "../../metrics/MetricsView";
import { metadataApi } from "../../..";
const MetricsTab = (props) => {
const [metrics30, setMetrics30] = useState(buildMetrics([]));
const [metrics7, setMetrics7] = useState(buildMetrics([]));
const [metrics1, setMetrics1] = useState(buildMetrics([]));
const metadata = new MetadataApi()
useEffect(() => {
if(props.share.token) {
metadata.getShareMetrics(props.share.token)
metadataApi.getShareMetrics(props.share.token)
.then(resp => {
setMetrics30(buildMetrics(resp));
});
metadata.getShareMetrics(props.share.token, {duration: "168h"})
metadataApi.getShareMetrics(props.share.token, {duration: "168h"})
.then(resp => {
setMetrics7(buildMetrics(resp));
});
metadata.getShareMetrics(props.share.token, {duration: "24h"})
metadataApi.getShareMetrics(props.share.token, {duration: "24h"})
.then(resp => {
setMetrics1(buildMetrics(resp));
});
@ -30,19 +29,19 @@ const MetricsTab = (props) => {
let mounted = true;
let interval = setInterval(() => {
if(props.share.token) {
metadata.getShareMetrics(props.share.token)
metadataApi.getShareMetrics(props.share.token)
.then(resp => {
if(mounted) {
setMetrics30(buildMetrics(resp));
}
});
metadata.getShareMetrics(props.share.token, {duration: "168h"})
metadataApi.getShareMetrics(props.share.token, {duration: "168h"})
.then(resp => {
if(mounted) {
setMetrics7(buildMetrics(resp));
}
});
metadata.getShareMetrics(props.share.token, {duration: "24h"})
metadataApi.getShareMetrics(props.share.token, {duration: "24h"})
.then(resp => {
if(mounted) {
setMetrics1(buildMetrics(resp));

View File

@ -1,4 +1,3 @@
import {MetadataApi} from "../../../api/src";
import React, {useEffect, useState} from "react";
import {mdiShareVariant} from "@mdi/js";
import Icon from "@mdi/react";
@ -8,14 +7,13 @@ import ActionsTab from "./ActionsTab";
import SecretToggle from "../../SecretToggle";
import {Area, AreaChart, ResponsiveContainer} from "recharts";
import MetricsTab from "./MetricsTab";
import { metadataApi } from "../../..";
const ShareDetail = (props) => {
const [detail, setDetail] = useState({});
const metadata = new MetadataApi()
useEffect(() => {
metadata.getShareDetail(props.selection.shrToken)
metadataApi.getShareDetail(props.selection.shrToken)
.then(resp => {
let detail = resp;
detail.envZId = props.selection.envZId;
@ -26,7 +24,7 @@ const ShareDetail = (props) => {
useEffect(() => {
let mounted = true;
let interval = setInterval(() => {
metadata.getShareDetail(props.selection.shrToken)
metadataApi.getShareDetail(props.selection.shrToken)
.then(resp => {
if(mounted) {
let detail = resp;

View File

@ -1,7 +1,8 @@
import {useEffect, useState} from "react";
import {MetadataApi, AccountApi} from "../../api/src"
import {Button, Container, Form, Row} from "react-bootstrap";
import { Link } from "react-router-dom";
import { accountApi } from "../..";
import { metadataApi } from "../..";
const Login = (props) => {
const [email, setEmail] = useState('');
@ -9,18 +10,13 @@ const Login = (props) => {
const [message, setMessage] = useState();
const [tou, setTou] = useState();
const metadata = new MetadataApi()
const account = new AccountApi()
const errorMessage = <h2 className={"errorMessage"}>Login Failed!</h2>;
useEffect(() => {
metadata.configuration().then(resp => {
metadataApi.configuration().then(resp => {
console.log(resp)
if(!resp.error) {
if (resp.touLink !== null && resp.touLink.trim() !== "") {
setTou(resp.touLink)
}
if (resp.touLink !== null && resp.touLink.trim() !== "") {
setTou(resp.touLink)
}
}).catch(err => {
console.log("err", err);
@ -31,26 +27,17 @@ const Login = (props) => {
e.preventDefault()
console.log(email, password);
account.login({body: {"email": email, "password": password}})
accountApi.login({body: {"email": email, "password": password}})
.then(resp => {
if (!resp.error) {
let user = {
"email": email.toLowerCase(),
"token": resp.data
}
props.loginSuccess(user)
localStorage.setItem('user', JSON.stringify(user))
console.log(user)
console.log('login succeeded', resp)
document.dispatchEvent(new Event('storage'))
} else {
console.log('login failed')
setMessage(errorMessage);
let user = {
"email": email.toLowerCase(),
"token": resp
}
props.loginSuccess(user)
localStorage.setItem('user', JSON.stringify(user))
console.log(user)
console.log('login succeeded', resp)
document.dispatchEvent(new Event('storage'))
})
.catch((resp) => {
console.log('login failed', resp)

View File

@ -1,15 +1,13 @@
import {useEffect, useState} from "react";
import {MetadataApi} from "../../api/src";
import Modal from "react-bootstrap/Modal";
import { metadataApi } from "../..";
const Version = (props) => {
const [v, setV] = useState('');
const metadata = new MetadataApi()
useEffect(() => {
let mounted = true;
metadata.version().then(resp => {
metadataApi.version().then(resp => {
if(mounted) {
setV(resp);
}

View File

@ -1,9 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import {ApiClient} from "./api/src"
import {ApiClient, AccountApi, MetadataApi} from "./api/src"
import App from "./App";
export const zrokClient = new ApiClient()
export const accountApi = new AccountApi(zrokClient)
export const metadataApi = new MetadataApi(zrokClient)
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<App />
@ -18,10 +21,14 @@ function getApiKey() {
}
}
getApiKey().then(key => {
let defaultClient = ApiClient.instance;
// Configure API key authorization: key
let k = defaultClient.authentications['key'];
k.apiKey = key.apiKey;
})
export function updateApiKey() {
getApiKey().then(key => {
// Configure API key authorization: key
let v = zrokClient.authentications['key'];
v.apiKey = key.apiKey
})
}
updateApiKey();

View File

@ -1,8 +1,8 @@
import { useParams } from 'react-router-dom';
import {useEffect, useState} from "react";
import {AccountApi} from "../api/src";
import InvalidRequest from "./InvalidRequest";
import SetPasswordForm from "./SetPasswordForm";
import { accountApi } from '..';
let step;
@ -11,17 +11,11 @@ const Register = () => {
const [email, setEmail] = useState();
const [activeRequest, setActiveRequest] = useState(true);
const account = new AccountApi()
useEffect(() => {
let mounted = true
account.verify({body: {token: token}}).then(resp => {
accountApi.verify({body: {token: token}}).then(resp => {
if(mounted) {
if(resp.error) {
setActiveRequest(false);
} else {
setEmail(resp.email);
}
setEmail(resp.email);
}
}).catch(err => {
console.log("err", err);

View File

@ -1,8 +1,8 @@
import React, {useEffect, useState} from "react";
import {MetadataApi, AccountApi} from "../api/src"
import Success from "./Success";
import {Button, Container, Form, Row} from "react-bootstrap";
import PasswordForm from "../components/password";
import { accountApi, metadataApi } from "..";
const SetPasswordForm = (props) => {
const [password, setPassword] = useState('');
@ -18,21 +18,16 @@ const SetPasswordForm = (props) => {
const registerFailed = <h2 className={"errorMessage"}>Account creation failed!</h2>
const metadata = new MetadataApi()
const account = new AccountApi()
useEffect(() => {
metadata.configuration().then(resp => {
if(!resp.error) {
if (resp.touLink !== undefined && resp.touLink.trim() !== "") {
setTou(resp.touLink)
}
setPasswordLength(resp.passwordRequirements.length)
setPasswordRequireCapital(resp.passwordRequirements.requireCapital)
setPasswordRequireNumeric(resp.passwordRequirements.requireNumeric)
setPasswordRequireSpecial(resp.passwordRequirements.requireSpecial)
setPasswordValidSpecialCharacters(resp.passwordRequirements.validSpecialCharacters)
metadataApi.configuration().then(resp => {
if (resp.touLink !== undefined && resp.touLink.trim() !== "") {
setTou(resp.touLink)
}
setPasswordLength(resp.passwordRequirements.length)
setPasswordRequireCapital(resp.passwordRequirements.requireCapital)
setPasswordRequireNumeric(resp.passwordRequirements.requireNumeric)
setPasswordRequireSpecial(resp.passwordRequirements.requireSpecial)
setPasswordValidSpecialCharacters(resp.passwordRequirements.validSpecialCharacters)
}).catch(err => {
console.log("err", err);
});
@ -41,7 +36,7 @@ const SetPasswordForm = (props) => {
const handleSubmit = async e => {
e.preventDefault();
if (password !== undefined && password !== "") {
account.register({body: {"token": props.token, "password": password}})
accountApi.register({body: {"token": props.token, "password": password}})
.then(resp => {
console.log("resp", resp)
setMessage(undefined);

View File

@ -1,18 +1,16 @@
import { useState } from "react";
import {AccountApi} from '../api/src';
import { Button, Container, Form, Row } from "react-bootstrap";
import { accountApi } from "..";
const SendRequest = () => {
const [email, setEmail] = useState('');
const [complete, setComplete] = useState(false);
const account = new AccountApi()
const handleSubmit = async e => {
e.preventDefault();
console.log(email);
account.resetPasswordRequest({ body: { "emailAddress": email } })
accountApi.resetPasswordRequest({ body: { "emailAddress": email } })
.then(resp => {
setComplete(true)
})

View File

@ -1,8 +1,8 @@
import {useEffect, useState} from "react";
import {MetadataApi, AccountApi, ResetPasswordRequest} from "../api/src"
import {Button, Container, Form, Row} from "react-bootstrap";
import { Link } from "react-router-dom";
import PasswordForm from "../components/password";
import { accountApi, metadataApi } from "..";
const SetNewPassword = (props) => {
const [password, setPassword] = useState('');
@ -16,18 +16,13 @@ const SetNewPassword = (props) => {
const errorMessage = <h2 className={"errorMessage"}>Reset Password Failed!</h2>;
const metadata = new MetadataApi()
const account = new AccountApi()
useEffect(() => {
metadata.configuration().then(resp => {
if(!resp.error) {
setPasswordLength(resp.passwordRequirements.length)
setPasswordRequireCapital(resp.passwordRequirements.requireCapital)
setPasswordRequireNumeric(resp.passwordRequirements.requireNumeric)
setPasswordRequireSpecial(resp.passwordRequirements.requireSpecial)
setPasswordValidSpecialCharacters(resp.passwordRequirements.validSpecialCharacters)
}
metadataApi.configuration().then(resp => {
setPasswordLength(resp.passwordRequirements.length)
setPasswordRequireCapital(resp.passwordRequirements.requireCapital)
setPasswordRequireNumeric(resp.passwordRequirements.requireNumeric)
setPasswordRequireSpecial(resp.passwordRequirements.requireSpecial)
setPasswordValidSpecialCharacters(resp.passwordRequirements.validSpecialCharacters)
}).catch(err => {
console.log("err", err);
});
@ -36,7 +31,7 @@ const SetNewPassword = (props) => {
const handleSubmit = async e => {
e.preventDefault();
if (password !== undefined && password !== "") {
account.resetPassword({body: {"token": props.token, "password": password}})
accountApi.resetPassword({body: {"token": props.token, "password": password}})
.then(resp => {
console.log(resp)
setMessage(undefined);