diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..31354ec --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..36af219 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/Dockerfile b/Dockerfile index 6691335..fbf222f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,8 @@ FROM node:lts-alpine WORKDIR /app COPY . /app -RUN rm -f package-lock.json \ - ; rm -rf .idea \ - ; rm -rf node_modules \ - ; npm config set registry "https://registry.npm.taobao.org/" \ - && npm install +RUN npm config set registry "https://registry.npm.taobao.org/" \ + && npm install --production EXPOSE 3000 CMD ["node", "app.js"] diff --git a/app.js b/app.js index f7f5020..fb56df2 100644 --- a/app.js +++ b/app.js @@ -42,9 +42,8 @@ app.use((req, res, next) => { ;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => { let crack = pair.indexOf('=') if (crack < 1 || crack == pair.length - 1) return - req.cookies[ - decodeURIComponent(pair.slice(0, crack)).trim() - ] = decodeURIComponent(pair.slice(crack + 1)).trim() + req.cookies[decodeURIComponent(pair.slice(0, crack)).trim()] = + decodeURIComponent(pair.slice(crack + 1)).trim() }) next() }) diff --git a/module/related_playlist.js b/module/related_playlist.js index 6f64b3d..02e580f 100644 --- a/module/related_playlist.js +++ b/module/related_playlist.js @@ -13,7 +13,8 @@ module.exports = (query, request) => { }, ).then((response) => { try { - const pattern = /