Skip to content

Commit df7971a

Browse files
goniszewskiSparkensteingpoussel
authored
chore: release v0.4.4 (#158)
* chore: release v0.4.1-hotfix.3 * fix(data-migration): early return if no categories have parents (#128) Signed-off-by: Robert Goniszewski <[email protected]> * Closes #130 (#131) Signed-off-by: Robert Goniszewski <[email protected]> * fix(database): use dynamic path for SQLite database file Signed-off-by: Robert Goniszewski <[email protected]> * docs(readme): use single README file for latest/preview version Signed-off-by: Robert Goniszewski <[email protected]> * feat(ci): add manual deployment workflow and adjust tag conditions Signed-off-by: Robert Goniszewski <[email protected]> * refactor(workflow): simplify manual-deploy GitHub Action Signed-off-by: Robert Goniszewski <[email protected]> * fix(metadata): handle multiple image URLs in mainImageUrl field Signed-off-by: Robert Goniszewski <[email protected]> * fix: auth error handling (#144) * refactor(api): migrate Swagger UI to external documentation and enhance health endpoint Signed-off-by: Robert Goniszewski <[email protected]> * chore: release v0.4.3 * fix(docker): resolve issue with data directory permissions (#150) * Fix issue #153: creation/update of root categories (#157) * chore: release v0.4.3 (#149) * chore: release v0.4.1-hotfix.3 * fix(data-migration): early return if no categories have parents (#128) Signed-off-by: Robert Goniszewski <[email protected]> * Closes #130 (#131) Signed-off-by: Robert Goniszewski <[email protected]> * fix(database): use dynamic path for SQLite database file Signed-off-by: Robert Goniszewski <[email protected]> * docs(readme): use single README file for latest/preview version Signed-off-by: Robert Goniszewski <[email protected]> * feat(ci): add manual deployment workflow and adjust tag conditions Signed-off-by: Robert Goniszewski <[email protected]> * refactor(workflow): simplify manual-deploy GitHub Action Signed-off-by: Robert Goniszewski <[email protected]> * fix(metadata): handle multiple image URLs in mainImageUrl field Signed-off-by: Robert Goniszewski <[email protected]> * fix: auth error handling (#144) * refactor(api): migrate Swagger UI to external documentation and enhance health endpoint Signed-off-by: Robert Goniszewski <[email protected]> * chore: release v0.4.3 --------- Signed-off-by: Robert Goniszewski <[email protected]> Co-authored-by: Prabhanjan <[email protected]> * Fix creation/update of root categories --------- Signed-off-by: Robert Goniszewski <[email protected]> Co-authored-by: Robert Goniszewski <[email protected]> Co-authored-by: Prabhanjan <[email protected]> * Fix issue #145: bookmarks without images (#156) * chore: release v0.4.3 (#149) * chore: release v0.4.1-hotfix.3 * fix(data-migration): early return if no categories have parents (#128) Signed-off-by: Robert Goniszewski <[email protected]> * Closes #130 (#131) Signed-off-by: Robert Goniszewski <[email protected]> * fix(database): use dynamic path for SQLite database file Signed-off-by: Robert Goniszewski <[email protected]> * docs(readme): use single README file for latest/preview version Signed-off-by: Robert Goniszewski <[email protected]> * feat(ci): add manual deployment workflow and adjust tag conditions Signed-off-by: Robert Goniszewski <[email protected]> * refactor(workflow): simplify manual-deploy GitHub Action Signed-off-by: Robert Goniszewski <[email protected]> * fix(metadata): handle multiple image URLs in mainImageUrl field Signed-off-by: Robert Goniszewski <[email protected]> * fix: auth error handling (#144) * refactor(api): migrate Swagger UI to external documentation and enhance health endpoint Signed-off-by: Robert Goniszewski <[email protected]> * chore: release v0.4.3 --------- Signed-off-by: Robert Goniszewski <[email protected]> Co-authored-by: Prabhanjan <[email protected]> * Fix bookmark creation/update without image --------- Signed-off-by: Robert Goniszewski <[email protected]> Co-authored-by: Robert Goniszewski <[email protected]> Co-authored-by: Prabhanjan <[email protected]> * chore: release v0.4.4 --------- Signed-off-by: Robert Goniszewski <[email protected]> Co-authored-by: Prabhanjan <[email protected]> Co-authored-by: Guillaume Poussel <[email protected]>
1 parent a7ccb95 commit df7971a

File tree

6 files changed

+39
-34
lines changed

6 files changed

+39
-34
lines changed

Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y python3 python3-pip wget build-essentia
88
bun i -g svelte-kit@latest
99

1010
RUN adduser --disabled-password --gecos '' grimoire
11-
RUN mkdir -p /app/data && chown -R grimoire:grimoire /app/data && chmod 755 /app/data
11+
RUN mkdir -p /app/data && chown -R grimoire:grimoire /app/data && chmod 766 /app/data
1212
WORKDIR /app
1313

1414
FROM base AS dependencies
@@ -35,6 +35,7 @@ COPY --from=build /app/build ./build
3535
COPY --from=build /app/migrations ./migrations
3636
COPY --from=build /app/migrate.js ./migrate.js
3737
COPY --from=build /app/package.json ./package.json
38+
COPY docker-entrypoint.sh /
3839
ENV NODE_ENV=production \
3940
PUBLIC_ORIGIN=${PUBLIC_ORIGIN:-http://localhost:5173} \
4041
ORIGIN=${PUBLIC_ORIGIN:-http://localhost:5173} \
@@ -43,8 +44,9 @@ ENV NODE_ENV=production \
4344
PUBLIC_SIGNUP_DISABLED=${PUBLIC_SIGNUP_DISABLED:-false} \
4445
BODY_SIZE_LIMIT=${BODY_SIZE_LIMIT:-5000000}
4546

47+
RUN chmod +x /docker-entrypoint.sh
4648
USER grimoire
4749
EXPOSE ${PORT}
4850
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
4951
CMD wget --no-verbose --tries=1 --spider http://localhost:$PORT/api/health || exit 1
50-
ENTRYPOINT ["sh", "-c", "bun --bun run run-migrations && bun ./build/index.js"]
52+
ENTRYPOINT ["/docker-entrypoint.sh"]

docker-entrypoint.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
chown -R grimoire:grimoire /app/data
3+
chmod 755 /app/data
4+
bun --bun run run-migrations && bun ./build/index.js

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "grimoire",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "Bookmark manager for the wizards 🧙",
55
"author": "Robert Goniszewski <[email protected]>",
66
"main": "./build/index.js",

src/lib/components/AddCategoryForm/AddCategoryForm.svelte

+6-7
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@
2828
let form: HTMLFormElement;
2929
export let closeModal: () => void;
3030
31-
const categoriesOptions = writable<{ value: string; label: string }[]>([
31+
const categoriesOptions = writable<{ value: string | null; label: string }[]>([
3232
{
33-
value: 'null',
33+
value: null,
3434
label: 'No parent'
3535
}
3636
]);
3737
3838
$: {
3939
$categoriesOptions = [
4040
{
41-
value: 'null',
41+
value: null,
4242
label: 'No parent'
4343
},
4444
...$page.data.categories
4545
.filter((c) => {
4646
return c.id !== $category.id;
4747
})
4848
.map((c) => ({
49-
value: c.id,
49+
value: c.id.toString(),
5050
label: c.name
5151
}))
5252
];
@@ -224,13 +224,12 @@
224224
name="parent"
225225
searchable
226226
placeholder="Select parent category..."
227-
required
228-
value={$category.parent?.id || $categoriesOptions[0].value}
227+
value={$category.parent?.id?.toString() || $categoriesOptions[0].value}
229228
items={$categoriesOptions}
230229
class="this-select input input-bordered w-max"
231230
on:change={(event) => {
232231
// @ts-ignore-next-line
233-
$category.parent = $page.data.categories.find((c) => c.id === event.detail.value);
232+
$category.parent = $page.data.categories.find((c) => c.id.toString() === event.detail.value);
234233
}}
235234
/>
236235
</div>

src/lib/components/EditCategoryForm/EditCategoryForm.svelte

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616
let form: HTMLFormElement;
1717
export let closeModal: () => void;
1818
19-
const categoriesOptions = writable<{ value: number; label: string }[]>([
19+
const categoriesOptions = writable<{ value: string | null; label: string }[]>([
2020
{
21-
value: 0,
21+
value: null,
2222
label: 'No parent'
2323
}
2424
]);
2525
2626
$: {
2727
$categoriesOptions = [
2828
{
29-
value: 0,
29+
value: null,
3030
label: 'No parent'
3131
},
3232
...$page.data.categories
3333
.filter((c) => {
3434
return c.id !== $category.id;
3535
})
3636
.map((c) => ({
37-
value: c.id,
37+
value: c.id.toString(),
3838
label: c.name
3939
}))
4040
];
@@ -214,13 +214,12 @@
214214
name="parent"
215215
searchable
216216
placeholder="Select parent category..."
217-
required
218-
value={$category.parent?.id || $categoriesOptions[0].value}
217+
value={$category.parent?.id?.toString() || $categoriesOptions[0].value}
219218
items={$categoriesOptions}
220219
class="this-select input input-bordered w-max"
221220
on:change={(event) => {
222221
// @ts-ignore-next-line
223-
$category.parent = $page.data.categories.find((c) => c.id === event.detail.value);
222+
$category.parent = $page.data.categories.find((c) => c.id.toString() === event.detail.value);
224223
}}
225224
/>
226225
</div>

src/routes/+page.server.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,15 @@ export const actions = {
7171
error: 'Failed to add bookmark'
7272
};
7373
}
74-
const { id: mainImageId } = await storage.storeImage(
75-
mainImageUrl,
76-
title,
77-
ownerId,
78-
bookmark.id
79-
);
80-
const { id: iconId } = await storage.storeImage(iconUrl, title, ownerId, bookmark.id);
74+
const mainImage = mainImageUrl
75+
? await storage.storeImage(mainImageUrl, title, ownerId, bookmark.id)
76+
: undefined;
77+
const icon = iconUrl
78+
? await storage.storeImage(iconUrl, title, ownerId, bookmark.id)
79+
: undefined;
8180
const updatedBookmark = await updateBookmark(bookmark.id, ownerId, {
82-
mainImageId,
83-
iconId
81+
...(mainImage ? { mainImageId: mainImage.id } : {}),
82+
...(icon ? { iconId: icon.id } : {})
8483
});
8584

8685
await upsertTagsForBookmark(bookmark.id, ownerId, tagNames);
@@ -149,8 +148,10 @@ export const actions = {
149148

150149
const tagNames = tags.map((tag: any) => tag.label);
151150

152-
const { id: mainImageId } = await storage.storeImage(mainImageUrl, title, ownerId, id);
153-
const { id: iconId } = await storage.storeImage(iconUrl, title, ownerId, id);
151+
const mainImage = mainImageUrl
152+
? await storage.storeImage(mainImageUrl, title, ownerId, id)
153+
: undefined;
154+
const icon = iconUrl ? await storage.storeImage(iconUrl, title, ownerId, id) : undefined;
154155

155156
const bookmarkData = {
156157
author,
@@ -169,8 +170,8 @@ export const actions = {
169170
title,
170171
url,
171172
read,
172-
...(mainImageId ? { mainImageId } : {}),
173-
...(iconId ? { iconId } : {})
173+
...(mainImage ? { mainImageId: mainImage.id } : {}),
174+
...(icon ? { iconId: icon.id } : {})
174175
};
175176

176177
const bookmark = await updateBookmark(id, ownerId, bookmarkData);
@@ -290,7 +291,7 @@ export const actions = {
290291
const description = data.get('description') as string;
291292
const icon = data.get('icon') as string;
292293
const color = data.get('color') as string;
293-
const parent = JSON.parse(data.get('parent') as string);
294+
const parent = data.get('parent') ? JSON.parse(data.get('parent') as string) : null;
294295
const parentValue = parent?.value ? parent.value : parent;
295296
const archived = data.get('archived') === 'on' ? new Date() : null;
296297
const setPublic = data.get('public') === 'on' ? new Date() : null;
@@ -301,7 +302,7 @@ export const actions = {
301302
description,
302303
icon,
303304
color,
304-
parentId: parentValue === 'null' ? null : parentValue,
305+
parentId: parentValue,
305306
archived,
306307
public: setPublic,
307308
ownerId,
@@ -332,7 +333,7 @@ export const actions = {
332333
const description = data.get('description') as string;
333334
const icon = data.get('icon') as string;
334335
const color = data.get('color') as string;
335-
const parent = JSON.parse(data.get('parent') as string);
336+
const parent = data.get('parent') ? JSON.parse(data.get('parent') as string) : null;
336337
const parentValue = parent?.value ? parent.value : parent;
337338
const archived = data.get('archived') === 'on' ? new Date() : null;
338339
const setPublic = data.get('public') === 'on' ? new Date() : null;
@@ -343,7 +344,7 @@ export const actions = {
343344
description,
344345
icon,
345346
color,
346-
parentId: parentValue === 'null' ? null : parentValue,
347+
parentId: parentValue,
347348
archived,
348349
public: setPublic
349350
};

0 commit comments

Comments
 (0)