Compare commits

..

5 Commits

Author SHA1 Message Date
dgtlmoon
5aaec3f8b8 Ability to block access to simplehosts 2023-08-13 16:50:44 +02:00
dgtlmoon
1ae1b58c93 use floating env 2023-08-13 15:52:51 +02:00
dgtlmoon
60c1c96e57 validators 0.21 needs 'simple host' setting for single word hosts 2023-08-13 15:51:28 +02:00
dgtlmoon
23ef67efec Add debug to build 2023-08-13 15:01:34 +02:00
Marcelo Alencar
126f0fbf87 Re-enable ARMv6 builds (for Raspberry and other portable devices) (#1724) 2023-08-07 15:48:33 +02:00
6 changed files with 19 additions and 7 deletions

View File

@@ -95,7 +95,7 @@ jobs:
push: true
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/changedetection.io:dev,ghcr.io/${{ github.repository }}:dev
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
# Looks like this was disabled

View File

@@ -62,7 +62,7 @@ jobs:
with:
context: ./
file: ./Dockerfile
platforms: linux/arm/v7,linux/amd64,linux/arm64,
platforms: linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64,
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

View File

@@ -36,6 +36,8 @@ jobs:
run: |
# Build a changedetection.io container and start testing inside
docker build . -t test-changedetectionio
# Debug info
docker run test-changedetectionio bash -c 'pip list'
- name: Spin up ancillary SMTP+Echo message test server
run: |
@@ -44,7 +46,6 @@ jobs:
- name: Test built container with pytest
run: |
# Unit tests
docker run test-changedetectionio bash -c 'python3 -m unittest changedetectionio.tests.unit.test_notification_diff'

View File

@@ -1,3 +1,6 @@
import os
from distutils.util import strtobool
from flask_expects_json import expects_json
from changedetectionio import queuedWatchMetaData
from flask_restful import abort, Resource
@@ -209,7 +212,9 @@ class CreateWatch(Resource):
json_data = request.get_json()
url = json_data['url'].strip()
if not validators.url(json_data['url'].strip()):
# If hosts that only contain alphanumerics are allowed ("localhost" for example)
allow_simplehost = not strtobool(os.getenv('BLOCK_SIMPLEHOSTS', 'False'))
if not validators.url(url, simple_host=allow_simplehost):
return "Invalid or unsupported URL", 400
if json_data.get('proxy'):

View File

@@ -1,5 +1,6 @@
import os
import re
from distutils.util import strtobool
from wtforms import (
BooleanField,
@@ -257,9 +258,10 @@ class validateURL(object):
def __call__(self, form, field):
import validators
# If hosts that only contain alphanumerics are allowed ("localhost" for example)
allow_simplehost = not strtobool(os.getenv('BLOCK_SIMPLEHOSTS', 'False'))
try:
validators.url(field.data.strip())
validators.url(field.data.strip(), simple_host=allow_simplehost)
except validators.ValidationFailure:
message = field.gettext('\'%s\' is not a valid URL.' % (field.data.strip()))
raise ValidationError(message)

View File

@@ -10,7 +10,8 @@ flask~=2.0
inscriptis~=2.2
pytz
timeago~=1.0
validators
validators~=0.21
# Set these versions together to avoid a RequestsDependencyWarning
# >= 2.26 also adds Brotli support if brotli is installed
@@ -71,3 +72,6 @@ pillow
# Include pytest, so if theres a support issue we can ask them to run these tests on their setup
pytest ~=7.2
pytest-flask ~=1.2
# Pin jsonschema version to prevent build errors on armv6 while rpds-py wheels aren't available (1708)
jsonschema==4.17.3