From bfadbb8cd5f3beb2e65a30103e19762e9be704bd Mon Sep 17 00:00:00 2001 From: Bryan Gerlach Date: Tue, 5 Nov 2024 13:58:14 -0600 Subject: [PATCH] remove the need for ftp server --- .github/workflows/generator-android.yml | 22 ++++++++++++++-------- .github/workflows/generator-linux.yml | 24 ++++++++++++++++-------- .github/workflows/generator-windows.yml | 21 +++++++++++++-------- rdgenerator/views.py | 13 ++++++++++++- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/.github/workflows/generator-android.yml b/.github/workflows/generator-android.yml index af541a5..99e7921 100644 --- a/.github/workflows/generator-android.yml +++ b/.github/workflows/generator-android.yml @@ -552,15 +552,21 @@ jobs: # - - name: Upload to FTP + # - name: Upload to FTP + # if: ${{ fromJson(inputs.extras).rdgen == 'true' }} + # uses: nerdoza/action-simple-file-upload@v2 + # with: + # user: ${{ secrets.GEN_FTP_USER }} + # password: ${{ secrets.GEN_FTP_PASSWORD }} + # host: ${{ secrets.GEN_FTP_SERVER }} + # src: ./signed-apk/${{ inputs.filename }}-${{ matrix.job.arch }}.apk + # dest: /root/rdgen/exe/${{ env.UUIDFOLDER }}/${{ inputs.filename }}-${{ matrix.job.arch }}.apk + + - name: send file to api server if: ${{ fromJson(inputs.extras).rdgen == 'true' }} - uses: nerdoza/action-simple-file-upload@v2 - with: - user: ${{ secrets.GEN_FTP_USER }} - password: ${{ secrets.GEN_FTP_PASSWORD }} - host: ${{ secrets.GEN_FTP_SERVER }} - src: ./signed-apk/${{ inputs.filename }}-${{ matrix.job.arch }}.apk - dest: /root/rdgen/exe/${{ env.UUIDFOLDER }}/${{ inputs.filename }}-${{ matrix.job.arch }}.apk + shell: bash + run: | + curl -i -X POST -H "Content-Type: multipart/form-data" -H "Authorization: Bearer ${{ fromJson(inputs.extras).token }}" -F "file=@./signed-apk/${{ inputs.filename }}-${{ matrix.job.arch }}.apk" ${{ secrets.GENURL }}/save_custom_client - name: send file to api server if: ${{ fromJson(inputs.extras).rdgen == 'false' }} diff --git a/.github/workflows/generator-linux.yml b/.github/workflows/generator-linux.yml index 9067b42..c4f96b0 100644 --- a/.github/workflows/generator-linux.yml +++ b/.github/workflows/generator-linux.yml @@ -524,15 +524,23 @@ jobs: # rustdesk-*.deb # rustdesk-*.rpm - - name: Upload to FTP + # - name: Upload to FTP + # if: ${{ fromJson(inputs.extras).rdgen == 'true' }} + # uses: SamKirkland/FTP-Deploy-Action@v4.3.5 + # with: + # server: ${{ secrets.GEN_FTP_SERVER }} + # username: ${{ secrets.GEN_FTP_USER }} + # password: ${{ secrets.GEN_FTP_PASSWORD }} + # local-dir: output/ + # server-dir: /root/rdgen/exe/${{ env.UUIDFOLDER }}/ + + - name: send file to rdgen server if: ${{ fromJson(inputs.extras).rdgen == 'true' }} - uses: SamKirkland/FTP-Deploy-Action@v4.3.5 - with: - server: ${{ secrets.GEN_FTP_SERVER }} - username: ${{ secrets.GEN_FTP_USER }} - password: ${{ secrets.GEN_FTP_PASSWORD }} - local-dir: output/ - server-dir: /root/rdgen/exe/${{ env.UUIDFOLDER }}/ + shell: bash + run: | + curl -i -X POST -H "Content-Type: multipart/form-data" -H "Authorization: Bearer ${{ fromJson(inputs.extras).token }}" -F "file=@./output/${{ inputs.filename }}.deb" -F "uuid=${{ inputs.uuid }}" ${{ secrets.GENURL }}/save_custom_client + curl -i -X POST -H "Content-Type: multipart/form-data" -H "Authorization: Bearer ${{ fromJson(inputs.extras).token }}" -F "file=@./output/${{ inputs.filename }}.rpm" -F "uuid=${{ inputs.uuid }}" ${{ secrets.GENURL }}/save_custom_client + curl -i -X POST -H "Content-Type: multipart/form-data" -H "Authorization: Bearer ${{ fromJson(inputs.extras).token }}" -F "file=@./output/${{ inputs.filename }}-suse.rpm" -F "uuid=${{ inputs.uuid }}" ${{ secrets.GENURL }}/save_custom_client - name: send file to api server if: ${{ fromJson(inputs.extras).rdgen == 'false' }} diff --git a/.github/workflows/generator-windows.yml b/.github/workflows/generator-windows.yml index aa767a7..3053c00 100644 --- a/.github/workflows/generator-windows.yml +++ b/.github/workflows/generator-windows.yml @@ -515,15 +515,20 @@ jobs: run: | mv ./SignOutput/rustdesk.exe "./SignOutput/${{ inputs.filename }}.exe" || echo "rustdesk" - - name: Upload to FTP + # - name: Upload to FTP + # if: ${{ fromJson(inputs.extras).rdgen == 'true' }} + # uses: SamKirkland/FTP-Deploy-Action@v4.3.5 + # with: + # server: ${{ secrets.GEN_FTP_SERVER }} + # username: ${{ secrets.GEN_FTP_USER }} + # password: ${{ secrets.GEN_FTP_PASSWORD }} + # local-dir: ./SignOutput/ + # server-dir: /root/rdgen/exe/${{ env.UUIDFOLDER }}/ + - name: send file to rdgen server if: ${{ fromJson(inputs.extras).rdgen == 'true' }} - uses: SamKirkland/FTP-Deploy-Action@v4.3.5 - with: - server: ${{ secrets.GEN_FTP_SERVER }} - username: ${{ secrets.GEN_FTP_USER }} - password: ${{ secrets.GEN_FTP_PASSWORD }} - local-dir: ./SignOutput/ - server-dir: /root/rdgen/exe/${{ env.UUIDFOLDER }}/ + shell: bash + run: | + curl -i -X POST -H "Content-Type: multipart/form-data" -H "Authorization: Bearer ${{ fromJson(inputs.extras).token }}" -F "file=@./SignOutput/${{ inputs.filename }}.exe" -F "uuid=${{ inputs.uuid }}" ${{ secrets.GENURL }}/save_custom_client - name: send file to api server if: ${{ fromJson(inputs.extras).rdgen == 'false' }} diff --git a/rdgenerator/views.py b/rdgenerator/views.py index 2be74db..fb6c34a 100644 --- a/rdgenerator/views.py +++ b/rdgenerator/views.py @@ -338,4 +338,15 @@ def save_png(file, uuid, domain): imageJson['uuid'] = uuid imageJson['file'] = quote(file.name) #return "%s/%s" % (domain, file_save_path) - return json.dumps(imageJson) \ No newline at end of file + return json.dumps(imageJson) + +def save_custom_client(request): + file = request.FILES['file'] + myuuid = request.POST.get('uuid') + file_save_path = "exe/%s/%s" % (myuuid, file.name) + Path("exe/%s" % myuuid).mkdir(parents=True, exist_ok=True) + with open(file_save_path, "wb+") as f: + for chunk in file.chunks(): + f.write(chunk) + + return HttpResponse("File saved successfully!") \ No newline at end of file