From 688ae3b63b4811d761f057909592755296a900ea Mon Sep 17 00:00:00 2001 From: StruckCroissant Date: Fri, 4 Feb 2022 00:42:18 -0600 Subject: [PATCH 1/4] Updated Dockerfile Resolved read-only filesystem docker error --- docker/archive/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/archive/Dockerfile b/docker/archive/Dockerfile index 5370355f..2b10d588 100644 --- a/docker/archive/Dockerfile +++ b/docker/archive/Dockerfile @@ -18,6 +18,6 @@ COPY docker/archive /app RUN npm install -g 'git+https://github.com/pirate/readability-extractor' # Block ads using /etc/hosts -RUN wget https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -O /etc/hosts +#RUN wget https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -O /etc/hosts ENTRYPOINT [ "python3", "/app/main.py"] From d26ddd2ee04d72645da701905e4bab911dafdde6 Mon Sep 17 00:00:00 2001 From: StruckCroissant Date: Mon, 7 Feb 2022 12:04:38 -0600 Subject: [PATCH 2/4] Stripping whitespace from posted channel names --- modules/videos/channel/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/videos/channel/api.py b/modules/videos/channel/api.py index 07d8169a..55f365ea 100644 --- a/modules/videos/channel/api.py +++ b/modules/videos/channel/api.py @@ -49,7 +49,10 @@ def channel_post(_: Request, body: schema.ChannelPostRequest): if not body.directory.is_dir() and body.mkdir: make_media_directory(body.directory) - channel = lib.create_channel(body.__dict__) # TODO don't use the dataclass as a dict. + bd_edit = body.__dict__ + bd_edit['name'] = bd_edit['name'].strip() + channel = lib.create_channel(bd_edit) # TODO don't use the dataclass as a dict. + print(channel) # Refresh the videos asynchronously from ..api import refresh_videos From 8bfa2cdba9721513a4511f55a4fc530656e3bb34 Mon Sep 17 00:00:00 2001 From: StruckCroissant <32440863+StruckCroissant@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:47:17 -0600 Subject: [PATCH 3/4] Update api.py --- modules/videos/channel/api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/videos/channel/api.py b/modules/videos/channel/api.py index 55f365ea..a372ec5f 100644 --- a/modules/videos/channel/api.py +++ b/modules/videos/channel/api.py @@ -52,7 +52,6 @@ def channel_post(_: Request, body: schema.ChannelPostRequest): bd_edit = body.__dict__ bd_edit['name'] = bd_edit['name'].strip() channel = lib.create_channel(bd_edit) # TODO don't use the dataclass as a dict. - print(channel) # Refresh the videos asynchronously from ..api import refresh_videos From 9a1fe7323afc0c1b51ee32d0dc84caf909017952 Mon Sep 17 00:00:00 2001 From: StruckCroissant Date: Sun, 13 Feb 2022 00:06:42 -0600 Subject: [PATCH 4/4] Added channel whitespace test --- modules/videos/channel/test/test_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/videos/channel/test/test_api.py b/modules/videos/channel/test/test_api.py index 0d00600a..3af4c84f 100644 --- a/modules/videos/channel/test/test_api.py +++ b/modules/videos/channel/test/test_api.py @@ -50,7 +50,7 @@ class TestVideoAPI(TestAPI): new_channel = dict( directory=channel_directory, match_regex='asdf', - name='Example Channel 1', + name=' Example Channel 1 ', url='https://example.com/channel1', ) @@ -67,6 +67,9 @@ class TestVideoAPI(TestAPI): self.assertIsNotNone(created) self.assertIsNotNone(created['id']) + # Channel name leading/trailing whitespace should be stripped + assert created['name'] == 'Example Channel 1' + # Channel directory should be relative to the media directory assert not pathlib.Path(created['directory']).is_absolute(), \ f'Channel directory is absolute: {created["directory"]}'