diff --git a/README.md b/README.md index 02a92d7..1bad720 100644 --- a/README.md +++ b/README.md @@ -102,3 +102,16 @@ To set the value, just add the environment variable to the actions step, as seen OVERLEAF_COOKIE: ${{ secrets.OVERLEAF_COOKIE }} OVERLEAF_HOST: ${{ secrets.OVERLEAF_HOST }} ``` + +### OVERLEAF_COOKIE_KEY +The OVERLEAF_COOKIE_KEY parameter can be used to sync with a self-hosted Community Edition or Server Pro Overleaf instance. Since some instances use differnt names for the authentification cooke (e.g overleaf.sid) the name of the cookie can be changed using this parameter. The parameter defaults to `overleaf_session2`, when not set. + +To set the value, just add the environment variable to the actions step, as seen below: +``` + - name: Fetch the latest version from overleaf server + uses: subhamx/overleaf_sync_with_git@master + with: + OVERLEAF_PROJECT_ID: ${{ secrets.OVERLEAF_PROJECT_ID }} + OVERLEAF_COOKIE: ${{ secrets.OVERLEAF_COOKIE }} + OVERLEAF_COOKIE_KEY: ${{ secrets.OVERLEAF_COOKIE_KEY }} +``` diff --git a/action.yml b/action.yml index d2cd48f..aa449a9 100644 --- a/action.yml +++ b/action.yml @@ -7,9 +7,12 @@ description: "🤖 A GitHub action to take backups from OverLeaf which is an Onl inputs: - OVERLEAF_COOKIE: # id of input + OVERLEAF_COOKIE: description: "Active Cookie of overleaf account" required: true + OVERLEAF_COOKIE_KEY: + description: "The key of the cookie, default is overleaf_session2" + default: "overleaf_session2" OVERLEAF_PROJECT_ID: # id of input description: "Id of the project you want the bot to take automatic snapshot" required: true @@ -23,6 +26,7 @@ runs: image: "Dockerfile" args: - ${{ inputs.OVERLEAF_COOKIE }} + - ${{ inputs.OVERLEAF_COOKIE_KEY }} - ${{ inputs.OVERLEAF_PROJECT_ID }} - ${{ inputs.OVERLEAF_HOST }} diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 010f6fa..0291204 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -10,6 +10,7 @@ PROJECT_ID="$INPUT_OVERLEAF_PROJECT_ID" ZIP_OUTPUT_PATH="${1}/main.zip" EXTRACTED_FILES_PATH="./artifacts/" COOKIE=$(echo "$INPUT_OVERLEAF_COOKIE" | sed 's/.*=//g') +COOKIE_KEY="$INPUT_OVERLEAF_COOKIE_KEY" HOST="$INPUT_OVERLEAF_HOST" echo "Dumping zip file at $ZIP_OUTPUT_PATH" @@ -21,7 +22,7 @@ curl "https://$HOST/project/$PROJECT_ID/download/zip" \ -H 'upgrade-insecure-requests: 1' \ -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ -H 'accept-language: en-US,en;q=0.9' \ - -H "Cookie: overleaf_session2=$COOKIE" \ + -H "Cookie: $COOKIE_KEY=$COOKIE" \ --output "$ZIP_OUTPUT_PATH" --create-dirs echo "Extracting all files at $EXTRACTED_FILES_PATH"