diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 16d03db..82d6346 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "features": { "ghcr.io/devcontainers/features/python:1": { "installTools": true, - "version": "3.12.1" + "version": "3.12.4" } }, "customizations": { @@ -15,7 +15,8 @@ "extensions": [ "streetsidesoftware.code-spell-checker", "ms-python.python", - "redhat.vscode-yaml" + "redhat.vscode-yaml", + "GitHub.copilot" ] } } diff --git a/.github/actions/python/action.yml b/.github/actions/python/action.yml index afef031..677c051 100644 --- a/.github/actions/python/action.yml +++ b/.github/actions/python/action.yml @@ -23,7 +23,7 @@ runs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: '3.12.1' + python-version: '3.12.4' - name: Install Dependencies shell: bash run: | diff --git a/.github/actions/tests/action.yml b/.github/actions/tests/action.yml index 3606371..3b7ed0c 100644 --- a/.github/actions/tests/action.yml +++ b/.github/actions/tests/action.yml @@ -8,7 +8,7 @@ runs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: '3.12.1' + python-version: '3.12.4' - name: Install dependencies shell: bash run: | diff --git a/Dockerfile b/Dockerfile index c368f25..c493943 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG BASE_IMAGE=python -ARG BASE_IMAGE_TAG=3.12.1-slim-bookworm +ARG BASE_IMAGE_TAG=3.12.4-slim-bookworm FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} diff --git a/Makefile b/Makefile index 4eebcfd..93ae354 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ## DOCKER BUILD VARS BASE_IMAGE=python -BASE_IMAGE_TAG=3.12-slim-bookworm +BASE_IMAGE_TAG=3.12.4-slim-bookworm IMAGE_NAME=homeylab/bookstack-file-exporter # keep this start sequence unique (IMAGE_TAG=) # github actions will use this to create a tag diff --git a/README.md b/README.md index e118dcb..5ce6970 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Table of Contents - [Using This Application](#using-this-application) - [Run via Pip](#run-via-pip) - [Run via Docker](#run-via-docker) - - [Authentication](#authentication) + - [Authentication and Permissions](#authentication-and-permissions) - [Configuration](#configuration) - [Backup Behavior](#backup-behavior) - [General](#general) @@ -21,7 +21,7 @@ Table of Contents ## Background _If you encounter any issues, want to request an additional feature, or provide assistance, feel free to open a Github issue._ -This tool provides a way to export [Bookstack](https://github.com/BookStackApp/BookStack) pages and their content (_text, images, metadata, etc._) into a relational parent-child layout locally with an option to push to remote object storage locations. See [Backup Behavior](#backup-behavior) section for more details on how pages are organized. +This tool provides a way to export [Bookstack](https://github.com/BookStackApp/BookStack) pages and their content (_text, images, attachments, metadata, etc._) into a relational parent-child layout locally with an option to push to remote object storage locations. See [Backup Behavior](#backup-behavior) section for more details on how pages are organized. Image and attachment links can also be modified in markdown exports to point to local exported paths. This small project was mainly created to run as a cron job in k8s but works anywhere. This tool allows me to export my docs in markdown, or other formats like pdf. I use Bookstack's markdown editor as default instead of WYSIWYG editor and this makes my notes portable anywhere even if offline. @@ -174,9 +174,16 @@ docker run \ | `config` | `/export/config/config.yml` | A valid configuration file |`-v /local/yourpath/config.yml:/export/config/config.yml:ro`| | `dump` | `/export/dump` | Directory to place exports. **This is optional when using remote storage option(s)**. Omit if you don't need a local copy. | `-v /local/yourpath/bkps:/export/dump` | -### Authentication -**Note visibility of pages is based on user**, so use a user that has access to pages you want to back up. +### Authentication and Permissions +#### Permissions +**Note visibility of pages is based on user**, so use a user that has read access to pages and content you want to back up. *The role assigned to the user* should have the additional permissions for target pages and their content: +- `read` for all images and attachments + - For most users this may already be set - may be required to be set depending on storage option used +- `Export Content` (This can be found in `Edit Role --> System Permissions`) + - For most users this may already set - may be required to be set if using custom roles + - If not set, you may see page contents showing as a HTML login page, as reported in this [issue](https://github.com/homeylab/bookstack-file-exporter/issues/35) +#### Token Authentication Ref: [https://demo.bookstackapp.com/api/docs#authentication](https://demo.bookstackapp.com/api/docs#authentication) Provide a tokenId and a tokenSecret as environment variables or directly in the configuration file. @@ -188,7 +195,7 @@ Env variables for credentials will take precedence over configuration file optio **For object storage authentication**, find the relevant sections further down in their respective sections. ### Configuration -_Ensure [Authentication](#authentication) has been set up beforehand for required credentials._ For a simple example to run quickly, refer to the one in the [Using This Application](#using-this-application) section. A full example is also shown below with descriptions. Optionally, look at `examples/` folder of the github repo for more examples. +_Ensure [Authentication](#authentication-and-permissions) has been set up beforehand for required credentials._ For a simple example to run quickly, refer to the one in the [Using This Application](#using-this-application) section. A full example is also shown below with descriptions. Optionally, look at `examples/` folder of the github repo for more examples. For object storage configuration, find more information in their respective sections - [Minio](#minio-backups) diff --git a/setup.cfg b/setup.cfg index dffaf0c..ef0c2bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,9 +18,9 @@ classifiers = python_requires = >=3.8 install_requires = Pyyaml >= 6.0.1 # https://pypi.org/project/PyYAML/ - Pydantic >= 2.5.3 # https://docs.pydantic.dev/latest/ - requests >= 2.31.0 # https://pypi.org/project/requests/ - minio >= 7.2.3 # https://pypi.org/project/minio/ + Pydantic >= 2.8.2 # https://docs.pydantic.dev/latest/ + requests >= 2.32.3 # https://pypi.org/project/requests/ + minio >= 7.2.7 # https://pypi.org/project/minio/ packages = find: [options.entry_points]