diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index f0c706c..d52d660 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -1,8 +1,15 @@ name: release_docker on: + workflow_dispatch: push: branches: ["main","release"] + paths: + - 'node-proxy/**' + pull_request: + branches: [ 'main' ] + paths: + - 'node-proxy/**' jobs: release_docker: @@ -20,24 +27,12 @@ jobs: cd node-proxy npm install && npm run build - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ secrets.DOCKERHUB_NAME }} - - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: wangjinhai68 - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push id: docker_build uses: docker/build-push-action@v4 @@ -46,4 +41,4 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 \ No newline at end of file + platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/node-proxy/src/encDavHandle.js b/node-proxy/src/encDavHandle.js index 2ec6bff..0099888 100644 --- a/node-proxy/src/encDavHandle.js +++ b/node-proxy/src/encDavHandle.js @@ -148,20 +148,22 @@ const handle = async (ctx, next) => { const fileName = path.basename(url) const realName = convertRealName(passwdInfo.password, passwdInfo.encType, url) // maybe from aliyundrive, check this req url while get file list from enc folder - if (url.endsWith('/') && request.method.toLocaleUpperCase() === 'GET') { + if (url.endsWith('/') && 'GET,DELETE'.includes(request.method.toLocaleUpperCase())) { let respBody = await httpClient(ctx.req, ctx.res) - const aurlArr = respBody.match(/href="[^"]*"/g) - // logger.debug('@@aurlArr', aurlArr) - if (aurlArr && aurlArr.length) { - for (let urlStr of aurlArr) { - urlStr = urlStr.replace('href="', '').replace('"', '') - const aurl = decodeURIComponent(urlStr.replace('href="', '').replace('"', '')) - const baseUrl = decodeURIComponent(url) - if (aurl.includes(baseUrl)) { - const fileName = path.basename(aurl) - const showName = convertShowName(passwdInfo.password, passwdInfo.encType, fileName) - logger.debug('@@aurl', urlStr, showName) - respBody = respBody.replace(path.basename(urlStr), encodeURI(showName)).replace(fileName, showName) + if(request.method.toLocaleUpperCase() === 'GET'){ + const aurlArr = respBody.match(/href="[^"]*"/g) + // logger.debug('@@aurlArr', aurlArr) + if (aurlArr && aurlArr.length) { + for (let urlStr of aurlArr) { + urlStr = urlStr.replace('href="', '').replace('"', '') + const aurl = decodeURIComponent(urlStr.replace('href="', '').replace('"', '')) + const baseUrl = decodeURIComponent(url) + if (aurl.includes(baseUrl)) { + const fileName = path.basename(aurl) + const showName = convertShowName(passwdInfo.password, passwdInfo.encType, fileName) + logger.debug('@@aurl', urlStr, showName) + respBody = respBody.replace(path.basename(urlStr), encodeURI(showName)).replace(fileName, showName) + } } } }