diff --git a/back/api/subscription.ts b/back/api/subscription.ts index eacb0608..3aa7a5ca 100644 --- a/back/api/subscription.ts +++ b/back/api/subscription.ts @@ -48,7 +48,10 @@ export default (app: Router) => { async (req: Request, res: Response, next: NextFunction) => { const logger: Logger = Container.get('logger'); try { - if (cron_parser.parseExpression(req.body.schedule).hasNext()) { + if ( + !req.body.schedule || + cron_parser.parseExpression(req.body.schedule).hasNext() + ) { const subscriptionService = Container.get(SubscriptionService); const data = await subscriptionService.create(req.body); return res.send({ code: 200, data }); diff --git a/back/data/subscription.ts b/back/data/subscription.ts index ce83cb71..a3877033 100644 --- a/back/data/subscription.ts +++ b/back/data/subscription.ts @@ -31,7 +31,7 @@ export class Subscription { constructor(options: Subscription) { this.id = options.id; - this.name = options.name; + this.name = options.name || options.alias; this.type = options.type; this.schedule = options.schedule; this.status = diff --git a/docker/Dockerfile b/docker/Dockerfile index c3e40799..80709e04 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,12 +35,11 @@ RUN set -x \ && rm -rf /var/cache/apk/* \ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone \ - && touch ~/.bashrc \ && git config --global user.email "qinglong@@users.noreply.github.com" \ && git config --global user.name "qinglong" \ && npm install -g pnpm \ && pnpm setup \ - && source /root/.bashrc \ + && source ~/.bashrc \ && pnpm add -g pm2 ts-node typescript tslib \ && git clone -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \ && cd ${QL_DIR} \ diff --git a/shell/update.sh b/shell/update.sh index 43d492ef..f8fc1882 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -304,6 +304,10 @@ patch_version() { pnpm i -g ts-node typescript tslib fi + # 兼容pnpm@7 + pnpm setup + source ~/.bashrc + git config --global pull.rebase false cp -f $dir_root/.env.example $dir_root/.env diff --git a/src/pages/subscription/modal.tsx b/src/pages/subscription/modal.tsx index 4a4473bd..9881f715 100644 --- a/src/pages/subscription/modal.tsx +++ b/src/pages/subscription/modal.tsx @@ -105,9 +105,9 @@ const SubscriptionModal = ({ }) => { const [intervalType, setIntervalType] = useState('days'); const [intervalNumber, setIntervalNumber] = useState(); - const intervalTypeChange = (e) => { - setIntervalType(e.target.value); - onChange?.({ type: e.target.value, value: intervalNumber }); + const intervalTypeChange = (type: string) => { + setIntervalType(type); + onChange?.({ type, value: intervalNumber }); }; const numberChange = (value: number) => {