Skip to content

Commit

Permalink
fix: update worker URL / path
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Aug 11, 2024
1 parent aaa1a32 commit b6fb167
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apps/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (process.env.NODE_ENV === "production") {
}))
}

const BASE_PATH = "/worker/v1"
const BASE_PATH = "/v1"
app.route(`${BASE_PATH}/bookmark`, bookmark)
app.route(`${BASE_PATH}/feed`, feed)

Expand Down
2 changes: 1 addition & 1 deletion apps/web/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NODE_ENV=development

# Backend Container - External URL to API
PUBLIC_WORKER_URL=http://app.company.com/worker/v1
PUBLIC_WORKER_URL=http://api.app.company.com

# Prisma - Default docker-compose.storage
DATABASE_URL=postgres://postgres:postgres@database:5432/briefkasten
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/lib/components/bookmark-row/BookmarkRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
const imageUrl = $derived.by(() => {
if (bookmark.image) {
return `${env.PUBLIC_IMG_URL}/s_260x144/${bookmark.image}`
return `${env.PUBLIC_WORKER_URL}/img/s_260x144/${bookmark.image}`
} else {
return `${env.PUBLIC_IMG_URL}/https://source.unsplash.com/random/240x144?sig=${bookmark.url}`
return `${env.PUBLIC_WORKER_URL}/img/s_260x144/https://source.unsplash.com/random/240x144?sig=${bookmark.url}`
}
})
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/lib/components/feed-row/FeedRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
const imageUrl = $derived.by(() => {
if (feedEntry.feedMedia?.[0]?.href) {
return `${env.PUBLIC_IMG_URL}/s_160x96/${feedEntry.feedMedia?.[0]?.href}`
return `${env.PUBLIC_WORKER_URL}/img/s_160x96/${feedEntry.feedMedia?.[0]?.href}`
} else {
return `${env.PUBLIC_IMG_URL}/https://picsum.photos/seed/${encodeURIComponent(feedEntry.id)}/240/153.webp`
return `${env.PUBLIC_WORKER_URL}/img/s_160x96/https://picsum.photos/seed/${encodeURIComponent(feedEntry.id)}/240/153.webp`
}
})
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/utils/save-bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function saveBookmark(bookmarks: { url?: string }[]) {

// Add bookmark to queue for fetching screenshot
if (PUBLIC_WORKER_URL) {
await fetch(`${PUBLIC_WORKER_URL}/bookmark`, {
await fetch(`${PUBLIC_WORKER_URL}/v1/bookmark`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
36 changes: 18 additions & 18 deletions apps/web/src/routes/(dashboard)/bookmarks/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const actions: Actions = {
image: form.data.image,
category: form.data.category
? {
connect: {
id: form.data.category,
},
}
: {
disconnect: true,
connect: {
id: form.data.category,
},
}
: {
disconnect: true,
},
tags: {
deleteMany: {},
connectOrCreate: form.data.tags.map((tag: Tag) => ({
Expand Down Expand Up @@ -127,28 +127,28 @@ export const actions: Actions = {
},
tags: tags
? {
create: tags.map((tag: Tag) => ({
tag: {
connect: {
id: tag.id,
},
create: tags.map((tag: Tag) => ({
tag: {
connect: {
id: tag.id,
},
})),
}
},
})),
}
: {},
category: categoryId
? {
connect: {
id: categoryId,
},
}
connect: {
id: categoryId,
},
}
: {},
},
})

// Add bookmark to queue for fetching screenshot
if (PUBLIC_WORKER_URL) {
const res = await event.fetch(`${PUBLIC_WORKER_URL}/bookmark`, {
const res = await event.fetch(`${PUBLIC_WORKER_URL}/v1/bookmark`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/api/v1/bookmarks/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const POST: RequestHandler = async (event) => {

// Add bookmark to queue for fetching screenshot
if (PUBLIC_WORKER_URL) {
await event.fetch(`${PUBLIC_WORKER_URL}/bookmark`, {
await event.fetch(`${PUBLIC_WORKER_URL}/v1/bookmark`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/settings/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const actions: Actions = {
return fail(400, { type: "error", message: "Feed URL Required" })
}

const feedRes = await fetch(`${PUBLIC_WORKER_URL}/feed`, {
const feedRes = await fetch(`${PUBLIC_WORKER_URL}/v1/feed`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down

0 comments on commit b6fb167

Please sign in to comment.