mirror of
https://github.com/whyour/qinglong.git
synced 2025-12-23 07:32:40 +08:00
修复 cron-parser import,websocket basepath
This commit is contained in:
parent
dc0b3f2eb2
commit
5f0dafa010
|
|
@ -16,7 +16,7 @@ export default (app: Router) => {
|
|||
searchValue: Joi.string().optional().allow(''),
|
||||
type: Joi.string().optional().allow(''),
|
||||
status: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default (app: Router) => {
|
|||
celebrate({
|
||||
query: Joi.object({
|
||||
path: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
|
|
@ -79,7 +79,7 @@ export default (app: Router) => {
|
|||
query: Joi.object({
|
||||
path: Joi.string().optional().allow(''),
|
||||
file: Joi.string().required(),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
|
|
@ -103,7 +103,7 @@ export default (app: Router) => {
|
|||
}),
|
||||
query: Joi.object({
|
||||
path: Joi.string().optional().allow(''),
|
||||
}),
|
||||
}).unknown(true),
|
||||
}),
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Container } from 'typedi';
|
|||
import { Logger } from 'winston';
|
||||
import SubscriptionService from '../services/subscription';
|
||||
import { celebrate, Joi } from 'celebrate';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
const route = Router();
|
||||
|
||||
export default (app: Router) => {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import SockService from '../services/sock';
|
|||
import { getPlatform } from '../config/util';
|
||||
import { shareStore } from '../shared/store';
|
||||
import { isValidToken } from '../shared/auth';
|
||||
import config from '../config';
|
||||
|
||||
export default async ({ server }: { server: Server }) => {
|
||||
const echo = sockJs.createServer({ prefix: '/api/ws', log: () => {} });
|
||||
const echo = sockJs.createServer({ prefix: `${config.baseUrl}/api/ws`, log: () => { } });
|
||||
const sockService = Container.get(SockService);
|
||||
|
||||
echo.on('connection', async (conn) => {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import config from '../config';
|
|||
import { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
|
||||
import { exec, execSync } from 'child_process';
|
||||
import fs from 'fs/promises';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import {
|
||||
getFileContentByName,
|
||||
fileExist,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Joi } from 'celebrate';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import { ScheduleType } from '../interface/schedule';
|
||||
import path from 'path';
|
||||
import config from '../config';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import config from '@/utils/config';
|
|||
import { request } from '@/utils/http';
|
||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Form, Input, Modal, Select, Space, message } from 'antd';
|
||||
import cronParser from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import { useEffect, useState } from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { getScheduleType, scheduleTypeMap } from './const';
|
||||
|
|
@ -92,7 +92,7 @@ const CronModal = ({
|
|||
{
|
||||
validator: (_, value) => {
|
||||
try {
|
||||
if (!value || cronParser.CronExpressionParser.parse(value).hasNext()) {
|
||||
if (!value || CronExpressionParser.parse(value).hasNext()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(intl.get('Cron表达式格式有误'));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import cronParser from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
const { Option } = Select;
|
||||
|
|
@ -382,7 +382,7 @@ const SubscriptionModal = ({
|
|||
if (
|
||||
scheduleType === 'interval' ||
|
||||
!value ||
|
||||
cronParser.CronExpressionParser.parse(value).hasNext()
|
||||
CronExpressionParser.parse(value).hasNext()
|
||||
) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import intl from 'react-intl-universal';
|
||||
import { LANG_MAP, LOG_END_SYMBOL } from './const';
|
||||
import cronParser from 'cron-parser';
|
||||
import CronExpressionParser from 'cron-parser';
|
||||
import { ICrontab } from '@/pages/crontab/type';
|
||||
|
||||
export default function browserType() {
|
||||
|
|
@ -333,7 +333,7 @@ export function getCommandScript(
|
|||
|
||||
export function parseCrontab(schedule: string): Date | null {
|
||||
try {
|
||||
const time = cronParser.CronExpressionParser.parse(schedule);
|
||||
const time = CronExpressionParser.parse(schedule);
|
||||
if (time) {
|
||||
return time.next().toDate();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user