Skip to content

Commit

Permalink
Merge branch 'master' into snyk-upgrade-06847a2658543dd161a81487b6e34507
Browse files Browse the repository at this point in the history
  • Loading branch information
blacklight authored Nov 22, 2024
2 parents a1fcbc8 + c8b6b1f commit eae5700
Show file tree
Hide file tree
Showing 53 changed files with 299 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .drone/rebuild-docs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

echo "Installing required build dependencies"
apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ git make py3-sphinx py3-myst-parser py3-pip $(cat platypush/install/requirements/alpine.txt)
apk add --update --no-cache git make py3-sphinx py3-myst-parser py3-pip $(cat platypush/install/requirements/alpine.txt)
pip install -U sphinx-rtd-theme sphinx-book-theme --break-system-packages
pip install . --break-system-packages
mkdir -p /docs/current
Expand Down
2 changes: 1 addition & 1 deletion .drone/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ $(cat platypush/install/requirements/alpine.txt)
apk add --update --no-cache $(cat platypush/install/requirements/alpine.txt)
pip install . --break-system-packages
pip install -r requirements-tests.txt --break-system-packages
pytest tests
2 changes: 1 addition & 1 deletion .drone/update-components-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
. .drone/macros/configure-gpg.sh

echo 'Updating components cache'
apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ $(cat platypush/install/requirements/alpine.txt)
apk add --update --no-cache $(cat platypush/install/requirements/alpine.txt)
pip install . --break-system-packages

python - <<EOF
Expand Down
23 changes: 19 additions & 4 deletions .drone/update-image-registry.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#!/bin/sh

[ -z "$DOCKER_USER" ] && echo "Please set the DOCKER_USER environment variable" && exit 1
[ -z "$DOCKER_PASS" ] && echo "Please set the DOCKER_PASS environment variable" && exit 1

export VERSION=$(grep current_version pyproject.toml | sed -r -e "s/.*=\s*['\"]?([^'\"]+)['\"]?\s*$/\1/")
export REGISTRY_ENDPOINT="${REGISTRY_ENDPOINT:-quay.io}"
export IMAGE_NAME="$REGISTRY_ENDPOINT/$DOCKER_USER/platypush"

# Log in to the registry
docker login "$REGISTRY_ENDPOINT" -u "$DOCKER_USER" -p "$DOCKER_PASS"
docker build -f Dockerfile.alpine -t "$IMAGE_NAME:$VERSION" .
docker tag "$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"

docker push "$IMAGE_NAME:$VERSION"
docker push "$IMAGE_NAME:latest"
# Required for multi-platform builds
docker buildx create --name=multiarch --driver=docker-container

# Build and publish the images
docker buildx build \
-f Dockerfile.alpine \
-t "$IMAGE_NAME:$VERSION" \
-t "$IMAGE_NAME:latest" \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--builder multiarch \
--push .

# Clean up
docker buildx rm multiarch
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [1.3.4]

- [Bug]: Fixed installation bug in `pip install platypush` introduced by the
`pyproject.toml` migration.

## [1.3.3]

- [`3e02304a`](https://git.platypush.tech/platypush/platypush/commit/3e02304ac203625650ab4b03f9d4146a40839f2f)
[Auth]: Fixed generation of API tokens when 2FA is enabled.

## [1.3.2]

- [[#414](https://git.platypush.tech/platypush/platypush/issues/414)]: added
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,20 @@ $ pip install git+https://github.com/blacklight/platypush
```bash
$ docker run -it --name platypush \
-p 8008:8008 \
-e "PLATYPUSH_DEVICE_ID=my-device"
-e "PLATYPUSH_DEVICE_ID=my-device" \
-v /path/to/your/platypush/config:/etc/platypush \
-v /path/to/your/platypush/share:/var/lib/platypush \
quay.io/platypush/platypush
```

The following architectures are currently supported:

- `amd64`/`x86_64` (standard Intel-based architectures)
- `arm64`/`aarch64` (ARM64, such as modern ARM-based MacBooks, most of the
Android devices or RaspberryPi 4 and 5)
- `armv7l` (older ARM-based devices, such as RaspberryPi 2 and 3 or older
Android devices)

The Web service will be available on `http://localhost:8008`, and a default
configuration file will be initialized under
`/path/to/your/platypush/config/config.yaml` if not available. The next
Expand Down
2 changes: 1 addition & 1 deletion platypush/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# see https://git.platypush.tech/platypush/platypush/issues/399
when = hook

__version__ = '1.3.2'
__version__ = '1.3.4'
__author__ = 'Fabio Manganiello <[email protected]>'
__all__ = [
'Application',
Expand Down
3 changes: 1 addition & 2 deletions platypush/backend/http/app/routes/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,14 @@ def _create_token():
user = None
username = payload.get('username')
password = payload.get('password')
code = payload.get('code')
name = payload.get('name')
expiry_days = payload.get('expiry_days')
user_manager = UserManager()
response = get_current_user_or_auth_status(request)

# Try and authenticate with the credentials passed in the JSON payload
if username and password:
user = user_manager.authenticate_user(username, password, code=code)
user = user_manager.authenticate_user(username, password, skip_2fa=True)
if not isinstance(user, User):
return UserAuthStatus.INVALID_CREDENTIALS.to_response()

Expand Down
1 change: 1 addition & 0 deletions platypush/backend/http/app/streaming/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def prepare(self):
auth_status = get_auth_status(self.request)
if auth_status != UserAuthStatus.OK:
self.send_error(auth_status.value.code, error=auth_status.value.message)
self.finish()
return

self.logger.info(
Expand Down
2 changes: 1 addition & 1 deletion platypush/backend/http/app/ws/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def open(self, *_, **__):
auth_status = get_auth_status(self.request)
if auth_status != UserAuthStatus.OK:
self.close(code=1008, reason=auth_status.value.message) # Policy Violation
return
raise ValueError(f'Unauthorized connection: {auth_status.value.message}')

logger.info(
'Client %s connected to %s', self.request.remote_ip, self.request.path
Expand Down
2 changes: 1 addition & 1 deletion platypush/backend/http/webapp/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/fonts/poppins.css"><title>platypush</title><script defer="defer" src="/static/js/chunk-vendors.c55c495e.js"></script><script defer="defer" src="/static/js/app.61d039e6.js"></script><link href="/static/css/chunk-vendors.d510eff2.css" rel="stylesheet"><link href="/static/css/app.70fb1f4a.css" rel="stylesheet"><link rel="icon" type="image/svg+xml" href="/img/icons/favicon.svg"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#ffffff"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="Platypush"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#ffffff"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/fonts/poppins.css"><title>platypush</title><script defer="defer" src="/static/js/chunk-vendors.c55c495e.js"></script><script defer="defer" src="/static/js/app.4c67dc8c.js"></script><link href="/static/css/chunk-vendors.d510eff2.css" rel="stylesheet"><link href="/static/css/app.70fb1f4a.css" rel="stylesheet"><link rel="icon" type="image/svg+xml" href="/img/icons/favicon.svg"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#ffffff"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="Platypush"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#ffffff"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
2 changes: 1 addition & 1 deletion platypush/backend/http/webapp/dist/service-worker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion platypush/backend/http/webapp/dist/service-worker.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Loading

0 comments on commit eae5700

Please sign in to comment.