From a103a1f10e522fbd939d8d932e0faff01870f3a0 Mon Sep 17 00:00:00 2001 From: ashesofdream <53961395+ashesofdream@users.noreply.github.com> Date: Fri, 9 Feb 2024 02:02:08 +0800 Subject: [PATCH 1/3] fix file delete --- node-proxy/src/encDavHandle.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) 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) + } } } } From 471900720c642db4fa7f2c99e16222952e45cb38 Mon Sep 17 00:00:00 2001 From: ashesofdream <53961395+ashesofdream@users.noreply.github.com> Date: Sat, 24 Feb 2024 03:46:45 +0800 Subject: [PATCH 2/3] Update build_docker.yml --- .github/workflows/build_docker.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index f0c706c..792d1fd 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: @@ -46,4 +53,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 From 39db1428a0a6ef99d8b7c064bfffef3c3b390414 Mon Sep 17 00:00:00 2001 From: ashesofdream <53961395+ashesofdream@users.noreply.github.com> Date: Sat, 24 Feb 2024 03:49:41 +0800 Subject: [PATCH 3/3] Update build_docker.yml --- .github/workflows/build_docker.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 792d1fd..d52d660 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -27,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