Jamie Curnow 215083f6cf
Certificates Renewal + SSE
- Certificate renewal is just a re-request as it's forced already
- Rejig the routes for readability
- Added Server Side Events so that the UI would invalidate the
cache when changes happen on the backend, such as certs being
provided or failing
- Added a SSE Token, which has the same shelf life as normal token
but can't be used interchangeably. The reason for this is, the
SSE endpoint needs a token for auth as a Query param, so it would
be stored in log files. If someone where to get a hold of that,
it's pretty useless as it can't be used to change anything, only
to listen for events until it expires
- Added test endpoint for SSE testing only availabe in debug mode
2023-03-07 16:42:26 +10:00

175 lines
3.1 KiB
TypeScript

export interface Sort {
field: string;
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;
gravatarUrl: string;
isDisabled: boolean;
notifications: Notification[];
capabilities?: string[];
auth?: UserAuth;
}
export interface Notification {
title: string;
seen: boolean;
}
export interface Setting {
id: number;
createdOn: number;
modifiedOn: number;
name: string;
value: any;
}
export interface AccessList {
id: number;
createdOn: number;
modifiedOn: number;
userId: number;
name: string;
meta: any;
}
// TODO: copy pasta not right
export interface Certificate {
id: number;
createdOn: number;
modifiedOn: number;
expiresOn: number | null;
type: string;
userId: number;
certificateAuthorityId: number;
dnsProviderId: number;
name: string;
domainNames: string[];
status: string;
errorMessage: string;
isEcc: boolean;
}
export interface CertificateAuthority {
id: number;
createdOn: number;
modifiedOn: number;
name: string;
acmeshServer: string;
caBundle: string;
maxDomains: number;
isWildcardSupported: boolean;
isReadonly: boolean;
}
export interface DNSProvider {
id: number;
createdOn: number;
modifiedOn: number;
userId: number;
name: string;
acmeshName: string;
dnsSleep: number;
meta: any;
}
export interface DNSProvidersAcmeshProperty {
title: string;
type: string;
additionalProperties: boolean;
minimum: number;
maximum: number;
minLength: number;
maxLength: number;
pattern: string;
isSecret: boolean;
}
export interface DNSProvidersAcmesh {
title: string;
type: string;
additionalProperties: boolean;
minProperties: number;
required: string[];
properties: any;
}
export interface Host {
id: number;
createdOn: number;
modifiedOn: number;
userId: number;
type: string;
nginxTemplateId: number;
listenInterface: number;
domainNames: string[];
upstreamId: number;
certificateId: number;
accessListId: number;
sslForced: boolean;
cachingEnabled: boolean;
blockExploits: boolean;
allowWebsocketUpgrade: boolean;
http2Support: boolean;
hstsEnabled: boolean;
hstsSubdomains: boolean;
paths: string;
advancedConfig: string;
isDisabled: boolean;
}
export interface NginxTemplate {
id: number;
createdOn: number;
modifiedOn: number;
userId: number;
type: string;
template: string;
}
export interface Upstream {
// todo
id: number;
createdOn: number;
modifiedOn: number;
userId: number;
type: string;
nginxTemplateId: number;
listenInterface: number;
domainNames: string[];
upstreamId: number;
certificateId: number;
accessListId: number;
sslForced: boolean;
cachingEnabled: boolean;
blockExploits: boolean;
allowWebsocketUpgrade: boolean;
http2Support: boolean;
hstsEnabled: boolean;
hstsSubdomains: boolean;
paths: string;
advancedConfig: string;
isDisabled: boolean;
}
export interface SSEMessage {
lang?: string;
langParams?: string;
type?: "info" | "warning" | "success" | "error" | "loading";
affects?: string | string[];
}