mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix
This commit is contained in:
@@ -45,7 +45,7 @@ export default class URL {
|
||||
return `${this.protocol}${this.hostname}${this.route}`;
|
||||
}
|
||||
|
||||
public static fromString(url: string): URL {
|
||||
public static fromString(url: string): URL {
|
||||
let protocol: Protocol = Protocol.HTTPS;
|
||||
|
||||
if (url.startsWith('https://')) {
|
||||
|
||||
@@ -2,51 +2,51 @@ import PositiveNumber from './PositiveNumber';
|
||||
import moment from 'moment';
|
||||
|
||||
export default class OneUptimeDate {
|
||||
public static getCurrentDate(): Date {
|
||||
public static getCurrentDate(): Date {
|
||||
return moment().toDate();
|
||||
}
|
||||
|
||||
public static getCurrentMomentDate(): moment.Moment {
|
||||
public static getCurrentMomentDate(): moment.Moment {
|
||||
return moment();
|
||||
}
|
||||
|
||||
public static getOneMinAgo(): Date {
|
||||
public static getOneMinAgo(): Date {
|
||||
return this.getSomeMinutesAgo(new PositiveNumber(1));
|
||||
}
|
||||
|
||||
public static getOneDayAgo(): Date {
|
||||
public static getOneDayAgo(): Date {
|
||||
return this.getSomeDaysAgo(new PositiveNumber(1));
|
||||
}
|
||||
|
||||
public static getSomeMinutesAgo(minutes: PositiveNumber): Date {
|
||||
public static getSomeMinutesAgo(minutes: PositiveNumber): Date {
|
||||
return this.getCurrentMomentDate()
|
||||
.add(-1 * minutes.toNumber(), 'minutes')
|
||||
.toDate();
|
||||
}
|
||||
|
||||
public static getSomeHoursAgo(hours: PositiveNumber): Date {
|
||||
public static getSomeHoursAgo(hours: PositiveNumber): Date {
|
||||
return this.getCurrentMomentDate()
|
||||
.add(-1 * hours.toNumber(), 'hours')
|
||||
.toDate();
|
||||
}
|
||||
|
||||
public static getSomeDaysAgo(days: PositiveNumber): Date {
|
||||
public static getSomeDaysAgo(days: PositiveNumber): Date {
|
||||
return this.getCurrentMomentDate()
|
||||
.add(-1 * days.toNumber(), 'days')
|
||||
.toDate();
|
||||
}
|
||||
|
||||
public static getSomeSecondsAgo(seconds: PositiveNumber): Date {
|
||||
public static getSomeSecondsAgo(seconds: PositiveNumber): Date {
|
||||
return this.getCurrentMomentDate()
|
||||
.add(-1 * seconds.toNumber(), 'days')
|
||||
.toDate();
|
||||
}
|
||||
|
||||
public static momentToDate(moment: moment.Moment): Date {
|
||||
public static momentToDate(moment: moment.Moment): Date {
|
||||
return moment.toDate();
|
||||
}
|
||||
|
||||
public static getCurrentYear(): number {
|
||||
public static getCurrentYear(): number {
|
||||
return moment().year();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import EmailTemplate from '../../Types/Email/EmailTemplate';
|
||||
|
||||
export default class DefaultEmailTemplate {
|
||||
public static getDefaultTemplates(): Array<EmailTemplate> {
|
||||
public static getDefaultTemplates(): Array<EmailTemplate> {
|
||||
return [
|
||||
{
|
||||
allowedVariables: [
|
||||
|
||||
@@ -3,15 +3,15 @@ import Dictionary from 'Common/Types/Dictionary';
|
||||
export default abstract class LocalCache {
|
||||
private static cache: Dictionary<string> = {};
|
||||
|
||||
public static set(key: string, value: string): void {
|
||||
public static set(key: string, value: string): void {
|
||||
this.cache[key] = value;
|
||||
}
|
||||
|
||||
public static get(key: string): string {
|
||||
public static get(key: string): string {
|
||||
return this.cache[key] as string;
|
||||
}
|
||||
|
||||
public static hasValue(key: string): boolean {
|
||||
public static hasValue(key: string): boolean {
|
||||
return !!this.cache[key];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,15 @@ export interface OneUptimeResponse extends express.Response {
|
||||
class Express {
|
||||
private static app: express.Application;
|
||||
|
||||
public static getRouter(): express.Router {
|
||||
public static getRouter(): express.Router {
|
||||
return express.Router();
|
||||
}
|
||||
|
||||
public static setupExpress(): void {
|
||||
public static setupExpress(): void {
|
||||
this.app = express();
|
||||
}
|
||||
|
||||
public static getExpressApp(): express.Application {
|
||||
public static getExpressApp(): express.Application {
|
||||
if (!this.app) {
|
||||
this.setupExpress();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public static getExpressApp(): express.Application {
|
||||
return this.app;
|
||||
}
|
||||
|
||||
public static launchApplication(): express.Application {
|
||||
public static launchApplication(): express.Application {
|
||||
if (!this.app) {
|
||||
this.setupExpress();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import jwt from 'jsonwebtoken';
|
||||
import { EncryptionSecret } from '../Config';
|
||||
|
||||
class JSONWebToken {
|
||||
public static sign(data: string, expiresIn: Date): string {
|
||||
public static sign(data: string, expiresIn: Date): string {
|
||||
return jwt.sign({ data }, EncryptionSecret, {
|
||||
expiresIn: String(expiresIn),
|
||||
});
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import JWT from 'CommonServer/utils/JsonWebToken';
|
||||
|
||||
class WebToken {
|
||||
public static generateWebToken(licenseKey: string, expiryTime: Date): string {
|
||||
public static generateWebToken(
|
||||
licenseKey: string,
|
||||
expiryTime: Date
|
||||
): string {
|
||||
return JWT.sign(licenseKey, expiryTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import Project from '../Utils/Projects';
|
||||
import { $ } from 'zx';
|
||||
|
||||
export default class Compile {
|
||||
public static async compileAllTypeScriptProjects(): Promise<void> {
|
||||
public static async compileAllTypeScriptProjects(): Promise<void> {
|
||||
const projects: $TSFixMe = Project.getProjects();
|
||||
for (const project of projects) {
|
||||
await $`cd ${project.path}`;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ProjectType from '../Types/Project';
|
||||
|
||||
class Project {
|
||||
public static getProjects(): Array<ProjectType> {
|
||||
public static getProjects(): Array<ProjectType> {
|
||||
return [
|
||||
{
|
||||
name: 'licensing',
|
||||
|
||||
Reference in New Issue
Block a user