mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-29 03:50:27 +00:00
Certificate Authority work
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as api from "./base";
|
||||
import { UserResponse } from "./responseTypes";
|
||||
import { User } from "./models";
|
||||
|
||||
interface AuthOptions {
|
||||
type: string;
|
||||
@@ -20,7 +20,7 @@ interface Options {
|
||||
export async function createUser(
|
||||
{ payload }: Options,
|
||||
abortController?: AbortController,
|
||||
): Promise<UserResponse> {
|
||||
): Promise<User> {
|
||||
const { result } = await api.post(
|
||||
{
|
||||
url: "/users",
|
||||
|
@@ -1,9 +1,7 @@
|
||||
import * as api from "./base";
|
||||
import { UserResponse } from "./responseTypes";
|
||||
import { User } from "./models";
|
||||
|
||||
export async function getUser(
|
||||
id: number | string = "me",
|
||||
): Promise<UserResponse> {
|
||||
export async function getUser(id: number | string = "me"): Promise<User> {
|
||||
const userId = id ? id : "me";
|
||||
const { result } = await api.get({
|
||||
url: `/users/${userId}`,
|
||||
|
@@ -3,6 +3,9 @@ export * from "./getToken";
|
||||
export * from "./getUser";
|
||||
export * from "./models";
|
||||
export * from "./refreshToken";
|
||||
export * from "./requestCertificateAuthorities";
|
||||
export * from "./requestCertificates";
|
||||
export * from "./requestHealth";
|
||||
export * from "./requestSettings";
|
||||
export * from "./requestUsers";
|
||||
export * from "./responseTypes";
|
||||
|
@@ -3,6 +3,27 @@ export interface Sort {
|
||||
direction: "ASC" | "DESC";
|
||||
}
|
||||
|
||||
export interface UserAuth {
|
||||
id: number;
|
||||
userId: number;
|
||||
type: string;
|
||||
createdOn: number;
|
||||
updatedOn: number;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
name: string;
|
||||
nickname: string;
|
||||
email: string;
|
||||
createdOn: number;
|
||||
updatedOn: number;
|
||||
roles: string[];
|
||||
gravatarUrl: string;
|
||||
isDisabled: boolean;
|
||||
auth?: UserAuth;
|
||||
}
|
||||
|
||||
export interface Setting {
|
||||
id: number;
|
||||
createdOn: number;
|
||||
@@ -10,3 +31,27 @@ export interface Setting {
|
||||
name: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export interface Certificate {
|
||||
id: number;
|
||||
createdOn: number;
|
||||
modifiedOn: number;
|
||||
name: string;
|
||||
acmeshServer: string;
|
||||
caBundle: string;
|
||||
maxDomains: number;
|
||||
isWildcardSupported: boolean;
|
||||
isSetup: boolean;
|
||||
}
|
||||
|
||||
export interface CertificateAuthority {
|
||||
id: number;
|
||||
createdOn: number;
|
||||
modifiedOn: number;
|
||||
name: string;
|
||||
acmeshServer: string;
|
||||
caBundle: string;
|
||||
maxDomains: number;
|
||||
isWildcardSupported: boolean;
|
||||
isSetup: boolean;
|
||||
}
|
||||
|
16
frontend/src/api/npm/requestCertificateAuthorities.ts
Normal file
16
frontend/src/api/npm/requestCertificateAuthorities.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as api from "./base";
|
||||
import { CertificateAuthoritiesResponse } from "./responseTypes";
|
||||
|
||||
export async function requestCertificateAuthorities(
|
||||
offset?: number,
|
||||
abortController?: AbortController,
|
||||
): Promise<CertificateAuthoritiesResponse> {
|
||||
const { result } = await api.get(
|
||||
{
|
||||
url: "certificate-authorities",
|
||||
params: { limit: 20, offset: offset || 0 },
|
||||
},
|
||||
abortController,
|
||||
);
|
||||
return result;
|
||||
}
|
16
frontend/src/api/npm/requestCertificates.ts
Normal file
16
frontend/src/api/npm/requestCertificates.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as api from "./base";
|
||||
import { CertificatesResponse } from "./responseTypes";
|
||||
|
||||
export async function requestCertificates(
|
||||
offset?: number,
|
||||
abortController?: AbortController,
|
||||
): Promise<CertificatesResponse> {
|
||||
const { result } = await api.get(
|
||||
{
|
||||
url: "certificates",
|
||||
params: { limit: 20, offset: offset || 0 },
|
||||
},
|
||||
abortController,
|
||||
);
|
||||
return result;
|
||||
}
|
16
frontend/src/api/npm/requestUsers.ts
Normal file
16
frontend/src/api/npm/requestUsers.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as api from "./base";
|
||||
import { UsersResponse } from "./responseTypes";
|
||||
|
||||
export async function requestUsers(
|
||||
offset?: number,
|
||||
abortController?: AbortController,
|
||||
): Promise<UsersResponse> {
|
||||
const { result } = await api.get(
|
||||
{
|
||||
url: "users",
|
||||
params: { limit: 20, offset: offset || 0 },
|
||||
},
|
||||
abortController,
|
||||
);
|
||||
return result;
|
||||
}
|
@@ -1,4 +1,10 @@
|
||||
import { Sort, Setting } from "./models";
|
||||
import {
|
||||
Certificate,
|
||||
CertificateAuthority,
|
||||
Setting,
|
||||
Sort,
|
||||
User,
|
||||
} from "./models";
|
||||
|
||||
export interface HealthResponse {
|
||||
commit: string;
|
||||
@@ -8,32 +14,11 @@ export interface HealthResponse {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface UserAuthResponse {
|
||||
id: number;
|
||||
userId: number;
|
||||
type: string;
|
||||
createdOn: number;
|
||||
updatedOn: number;
|
||||
}
|
||||
|
||||
export interface TokenResponse {
|
||||
expires: number;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface UserResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
nickname: string;
|
||||
email: string;
|
||||
createdOn: number;
|
||||
updatedOn: number;
|
||||
roles: string[];
|
||||
gravatarUrl: string;
|
||||
isDisabled: boolean;
|
||||
auth?: UserAuthResponse;
|
||||
}
|
||||
|
||||
export interface SettingsResponse {
|
||||
total: number;
|
||||
offset: number;
|
||||
@@ -41,3 +26,27 @@ export interface SettingsResponse {
|
||||
sort: Sort[];
|
||||
items: Setting[];
|
||||
}
|
||||
|
||||
export interface CertificatesResponse {
|
||||
total: number;
|
||||
offset: number;
|
||||
limit: number;
|
||||
sort: Sort[];
|
||||
items: Certificate[];
|
||||
}
|
||||
|
||||
export interface CertificateAuthoritiesResponse {
|
||||
total: number;
|
||||
offset: number;
|
||||
limit: number;
|
||||
sort: Sort[];
|
||||
items: CertificateAuthority[];
|
||||
}
|
||||
|
||||
export interface UsersResponse {
|
||||
total: number;
|
||||
offset: number;
|
||||
limit: number;
|
||||
sort: Sort[];
|
||||
items: User[];
|
||||
}
|
||||
|
Reference in New Issue
Block a user