Skip to content

Commit

Permalink
v0.5.10 (#54)
Browse files Browse the repository at this point in the history
* V0.5.10 (#53)

* fix filtering bug

* bump version

* clean up comments

* fix reader settings

* mostly fix reader image layout

* fix reader to browser uninitialized error

* bump news

* update poetry

* npm update
  • Loading branch information
ajslater authored Sep 9, 2020
1 parent aaab54d commit ad51ec6
Show file tree
Hide file tree
Showing 19 changed files with 127 additions and 132 deletions.
36 changes: 7 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
ARG BASE_VERSION
FROM ajslater/python-alpine:$BASE_VERSION AS codex-install
ARG PKG_VERSION
LABEL version python${BASE_VERSION}_codex-${PKG_VERSION}

RUN echo "**** install system wheel building packages ****" && \
apk add --no-cache \
bsd-compat-headers \
build-base \
libffi-dev \
libwebp-dev \
openssl-dev \
yaml-dev \
jpeg-dev \
zlib-dev
ARG INSTALL_BASE_VERSION
ARG RUNNABLE_BASE_VERSION
FROM ajslater/codex-install-base:${INSTALL_BASE_VERSION} AS codex-install

RUN pip3 install wheel
# TODO replace with:
# RUN pip3 install codex
COPY dist/*.whl /tmp/
RUN pip3 wheel /tmp/*.whl --wheel-dir=/wheels

FROM ajslater/python-alpine:$BASE_VERSION
LABEL version python${BASE_VERSION}_codex-${PKG_VERSION}

RUN echo "*** install system runtime packages ***" && \
apk add --no-cache \
libffi \
libwebp \
openssl \
yaml \
jpeg \
zlib \
unrar
FROM ajslater/codex-base:${RUNNABLE_BASE_VERSION}
ARG PKG_VERSION
LABEL version python${RUNNABLE_BASE_VERSION}_codex-${PKG_VERSION}

RUN echo "*** install python wheels ***"
COPY --from=codex-install /wheels /wheels
COPY --from=codex-install /wheels /wheels

RUN pip3 install --no-index --find-links=/wheels /wheels/codex*.whl

Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v0.5.10
* fix filtering bugs
* fix mark read/unread bugs
* fix reader settings not setting properly
* fix reader images positioning
* fix minor crash closing books with unitialized browser app

v0.5.9
* fix sorting for folder view
* display sort key value in browse tile
Expand Down
2 changes: 1 addition & 1 deletion build-runnable-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# Build a codex docker image suitable for running from Dockerfile
. ./docker-env
docker build -t "$IMAGE" --build-arg "BASE_VERSION=$BASE_VERSION" --build-arg "PKG_VERSION=$PKG_VERSION" .
docker build -t "$IMAGE" --build-arg "INSTALL_BASE_VERSION=$INSTALL_BASE_VERSION" --build-arg "RUNNABLE_BASE_VERSION=$RUNNABLE_BASE_VERSION" --build-arg "PKG_VERSION=$PKG_VERSION" .
8 changes: 4 additions & 4 deletions codex/views/browse_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ def get_query_filters(self, choices=False):
is_folder_view = self.kwargs.get("group") == self.FOLDER_GROUP
if is_folder_view:
if choices:
# Choices needs to get all decendant comic attributes
object_filter = self.get_folders_filter()
else:
object_filter = self.get_parent_folder_filter()
else:
object_filter = self.get_browse_container_filter()

if is_folder_view or not choices:
if choices:
aggregate_filter = None
else:
bookmark_filter_join = self.get_bookmark_filter()
comic_attribute_filter = self.get_comic_attribute_filter()
aggregate_filter = bookmark_filter_join & comic_attribute_filter
else:
aggregate_filter = None
if is_folder_view:
object_filter &= aggregate_filter

return object_filter, aggregate_filter
9 changes: 7 additions & 2 deletions codex/views/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ def add_annotations(self, obj_list, model, aggregate_filter):
)

################################
# Annotate finished & progress #
# Annotate userbookmark hoists #
################################
ub_filter = self.get_userbookmark_filter()

# Hoist up: are the children finished or unfinished?
finished_aggregate = Cast(
NullIf(
Expand All @@ -226,8 +227,12 @@ def add_annotations(self, obj_list, model, aggregate_filter):

# Hoist up the bookmark
bookmark_sum = Sum("comic__userbookmark__bookmark", filter=ub_filter)

obj_list = obj_list.annotate(finished=finished_aggregate, bookmark=bookmark_sum)
# Annotate progress

#####################
# Annotate progress #
#####################
obj_list = self.annotate_progress(obj_list)

#######################
Expand Down
11 changes: 6 additions & 5 deletions codex/views/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ class UserBookmarkFinishedView(APIView, SessionMixin, UserBookmarkMixin):

def patch(self, request, *args, **kwargs):
"""Mark read or unread recursively."""
browse_type = self.kwargs.get("browse_type")
pk = self.kwargs.get("pk")

serializer = UserBookmarkFinishedSerializer(data=request.data)
serializer.is_valid(raise_exception=True)

browse_type = self.kwargs.get("browse_type")
relation = BrowseView.GROUP_RELATION.get(browse_type)
comics = Comic.objects.filter(**{relation: pk}).only("pk")
pk = self.kwargs.get("pk")
# Optimizing this call with only seems to fail the subsequent updates
comics = Comic.objects.filter(**{relation: pk})
updates = {"finished": serializer.validated_data.get("finished")}

for comic in comics:
# can't do this in bulk if using update_or_create
# can't do this in bulk if using update_or_create withtout a
# third party packages.
self.update_user_bookmark(updates, comic=comic)

return Response()
Expand Down
4 changes: 2 additions & 2 deletions codex/views/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def get_user_bookmark(self, pk):
def update_user_bookmark(self, updates, comic=None, pk=None):
"""Update a user bookmark."""
if comic is None:
comic = Comic.objects.only("pk").get(pk=pk)
search_kwargs = self._get_user_bookmark_search_kwargs(comic)
comic = Comic.objects.only("pk", "max_page").get(pk=pk)
search_kwargs = self._get_user_bookmark_search_kwargs(comic=comic, comic_pk=pk)
if updates.get("bookmark") == comic.max_page:
# Auto finish on bookmark last page
updates["finished"] = True
Expand Down
8 changes: 8 additions & 0 deletions codex/views/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@


LOG = logging.getLogger(__name__)
NULL_READER_SETTINGS = {
"fitTo": None,
"twoPages": None,
}


class ComicOpenedView(APIView, SessionMixin, UserBookmarkMixin):
Expand Down Expand Up @@ -156,4 +160,8 @@ def put(self, request, *args, **kwargs):
reader_session = self.get_session(self.READER_KEY)
reader_session["defaults"] = snake_dict
self.request.session.save()

# Null out this comic's settings so it uses all comic defaults
pk = self.kwargs.get("pk")
self.update_user_bookmark(NULL_READER_SETTINGS, pk=pk)
return Response()
5 changes: 3 additions & 2 deletions docker-env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
REPO=ajslater/codex
IMAGE=ajslater/codex
BASE_VERSION=latest
PKG_VERSION=v0.5.9
INSTALL_BASE_VERSION=python3.8.5-alpine3.12_0.1.0-3fb89fc
RUNNABLE_BASE_VERSION=python3.8.5-alpine3.12_0.2.0-a88d3d9_0.1.0-3328e8e
PKG_VERSION=v0.5.10
PUID=501
PGID=20
27 changes: 19 additions & 8 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codex",
"version": "0.5.9",
"version": "0.5.10",
"private": true,
"description": "ui for codex api",
"scripts": {
Expand Down Expand Up @@ -39,7 +39,7 @@
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-array-func": "^3.1.7",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-html": "^6.0.3",
"eslint-plugin-html": "^6.1.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-jest-async": "^1.0.3",
"eslint-plugin-json": "^2.1.2",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/api/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const getBrowseOpened = ({ group, pk, page }) => {
return ajax("get", `${BROWSE_BASE}/${group}/${pk}/${page}`);
};

const getBrowseObjects = ({ group, pk, page, settings }) => {
const getBrowseObjects = ({ route, settings }) => {
const { group, pk, page } = route;
return ajax("put", `${BROWSE_BASE}/${group}/${pk}/${page}`, settings);
};

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const setComicSettings = ({ pk, data }) => {
return ajax("patch", `${COMIC_BASE}/${pk}/settings`, data);
};

const setComicDefaultSettings = (data) => {
return ajax("put", `${COMIC_BASE}/settings`, data);
const setComicDefaultSettings = ({ pk, data }) => {
return ajax("put", `${COMIC_BASE}/${pk}/settings`, data);
};

export const getComicPageSource = ({ pk, pageNumber }) => {
Expand Down
22 changes: 3 additions & 19 deletions frontend/src/components/reader-comic-page.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
<template>
<v-img
<img
v-if="displayPage"
class="page"
:class="fitToClass"
:src="src"
:alt="alt"
contain
>
<template #placeholder>
<PlaceholderLoading />
</template>
</v-img>
/>
</template>

<script>
import { mapGetters, mapState } from "vuex";
import { getComicPageSource } from "@/api/reader";
import PlaceholderLoading from "@/components/placeholder-loading";
export default {
name: "ReaderComicPage",
components: {
PlaceholderLoading,
},
props: {
page: {
type: Number,
Expand Down Expand Up @@ -76,7 +67,7 @@ export default {

<style scoped lang="scss">
.page {
display: inline-flex;
flex: 0 0 auto;
}
.fitToHeight,
.fitToHeightTwo {
Expand All @@ -85,14 +76,7 @@ export default {
.fitToWidth {
max-width: 100vw;
}
.fitToHeightTwo,
.fitToWidthTwo {
max-width: 50vw;
}
/*
.fitToOriginal,
.fitToOriginalTwo {
}
*/
</style>
Loading

0 comments on commit ad51ec6

Please sign in to comment.