Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
a-nau committed Jun 23, 2024
2 parents c9af95e + c5aed21 commit 876daeb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 13 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/encrypt_with_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.11-nodejs20-slim
permissions: # See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions
contents: write
pages: write
steps:
- name: Install Git
run: |
Expand All @@ -21,9 +24,14 @@ jobs:
- name: Remove template salt (if necessary)
run: |
current_salt="$(grep -oP '(?<="salt": ")[^"]*' .staticrypt.json)"
if [ "${{ github.repository }}" != "a-nau/password-protected-website-template" ] && [ "$current_salt" == "9fdd6a30e734b0ce7de31a0a221786bf" ];
then
rm .staticrypt.json
if [ "$current_salt" != "9fdd6a30e734b0ce7de31a0a221786bf" ]; then
echo "Salt has been updated already"
else
echo "Salt has not been updated already"
if [ "${{ github.repository }}" != "a-nau/password-protected-website-template" ]; then
echo "Removed salt to regenerate"
rm .staticrypt.json
fi
fi
- name: Embed assets
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Encrypt Page without Assets

on:
push:
branches: [main]

jobs:
encrypt:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.11-nodejs20-slim
permissions: # See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions
contents: write
pages: write
steps:
- name: Install Git
run: |
Expand All @@ -17,9 +24,14 @@ jobs:
- name: Remove template salt (if necessary)
run: |
current_salt="$(grep -oP '(?<="salt": ")[^"]*' .staticrypt.json)"
if [ "${{ github.repository }}" != "a-nau/password-protected-website-template" ] && [ "$current_salt" == "9fdd6a30e734b0ce7de31a0a221786bf" ];
then
rm .staticrypt.json
if [ "$current_salt" != "9fdd6a30e734b0ce7de31a0a221786bf" ]; then
echo "Salt has been updated already"
else
echo "Salt has not been updated already"
if [ "${{ github.repository }}" != "a-nau/password-protected-website-template" ]; then
echo "Removed salt to regenerate"
rm .staticrypt.json
fi
fi
- name: Encrypt index
run: >
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ By default encryption of assets is enabled, since the workflow [`encrypt_with_as
Note, this only replaces all directly linked images, CSS and JavaScript file in the HTML document with an in-place base64 representation.
Thus, your relative links in files will probably not work anymore, since their location changed.

If you do not want to encrypt assets remove the asset folder from the `exclude`s of the [`_config.yml`](_config.yml) and cut the following lines from [`encrypt_with_assets.yml`](.github/workflows/encrypt_with_assets.yml) and paste them into [`encrypt_without_assets.yml`](.github/workflows/encrypt_without_assets.yml)
If you do not want to encrypt assets
- remove the asset folder from the `exclude`s of the [`_config.yml`](_config.yml),
- [`encrypt_with_assets.yml`](.github/workflows/encrypt_with_assets.yml) to `encrypt_with_assets._yml`, and
- rename [`encrypt_without_assets._yml`](.github/workflows/encrypt_without_assets.yml) to `encrypt_with_assets.yml`

```yaml
on:
push:
branches: [main]
```

### Local Usage

Expand Down
33 changes: 32 additions & 1 deletion index.html

Large diffs are not rendered by default.

0 comments on commit 876daeb

Please sign in to comment.