diff --git a/.env.example b/.env.example index 09f7af7..afc0f36 100644 --- a/.env.example +++ b/.env.example @@ -1,13 +1,15 @@ WALLABAG_MAX_ARTICLES=30 -WALLABAG_CLIENT_ID= -WALLABAG_CLIENT_SECRET= -WALLABAG_USERNAME= -WALLABAG_PASSWORD= -WALLABAG_URL="https://app.wallabag.it" -PUBLIC_SITE_URL= +WALLABAG_MAX_PAGES=5 +NODE_VERSION=18.12.1 +WALLABAG_CLIENT_ID='' +WALLABAG_CLIENT_SECRET='' +WALLABAG_USERNAME='' +WALLABAG_PASSWORD='' +WALLABAG_URL="" +PUBLIC_SITE_URL="" PUBLIC_UMAMI_DO_NOT_TRACK=true -PUBLIC_UMAMI_URL= -PUBLIC_UMAMI_ID= +PUBLIC_UMAMI_URL="" +PUBLIC_UMAMI_ID="" PAGE_SIZE=6 USE_REDIS_CACHE=true -REDIS_URI=redis://{username}:{password}@{redisURL}:{redisPort} \ No newline at end of file +REDIS_URI= \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 2c11cb1..1d2895a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ + "Bandcamp", "bradleyshellnut", "iconify", "Mullvad", diff --git a/package.json b/package.json index b56422f..9ac5d24 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "devDependencies": { "@iconify-icons/material-symbols": "^1.2.27", + "@iconify-icons/mdi": "^1.2.41", "@iconify-icons/radix-icons": "^1.2.8", "@iconify-icons/simple-icons": "^1.2.42", "@leveluptuts/svelte-side-menu": "^1.0.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index acebe6f..9aef6e8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,6 +2,7 @@ lockfileVersion: 5.4 specifiers: '@iconify-icons/material-symbols': ^1.2.27 + '@iconify-icons/mdi': ^1.2.41 '@iconify-icons/radix-icons': ^1.2.8 '@iconify-icons/simple-icons': ^1.2.42 '@leveluptuts/svelte-side-menu': ^1.0.5 @@ -46,6 +47,7 @@ dependencies: devDependencies: '@iconify-icons/material-symbols': 1.2.27 + '@iconify-icons/mdi': 1.2.41 '@iconify-icons/radix-icons': 1.2.8 '@iconify-icons/simple-icons': 1.2.42 '@leveluptuts/svelte-side-menu': 1.0.5 @@ -569,6 +571,12 @@ packages: '@iconify/types': 2.0.0 dev: true + /@iconify-icons/mdi/1.2.41: + resolution: {integrity: sha512-duqTSmY0H+e/LdSZD5B8PxnJfdfh6qdLVnrI6klHGSSykz23d1KdvoPpfFpgF8mWWDm4UlHIO+rrvsqMLEb3NQ==} + dependencies: + '@iconify/types': 2.0.0 + dev: true + /@iconify-icons/radix-icons/1.2.8: resolution: {integrity: sha512-bZqRIbeqe6yNSLPgcQOyOl86C2P/apaY9Dq/BddWxitN8olbTp2MLuDJenNF+wxbQGgKkQFfm3vb6Z+4Nbhk+g==} dependencies: diff --git a/src/lib/components/analytics/index.svelte b/src/lib/components/analytics/index.svelte index c9159b0..bc71213 100644 --- a/src/lib/components/analytics/index.svelte +++ b/src/lib/components/analytics/index.svelte @@ -1,6 +1,5 @@ @@ -9,6 +8,6 @@ defer data-website-id={PUBLIC_UMAMI_ID} data-do-not-track={PUBLIC_UMAMI_DO_NOT_TRACK} - src={analyticsURL} + src={PUBLIC_UMAMI_URL} > diff --git a/src/lib/components/articles/index.svelte b/src/lib/components/articles/index.svelte index e69de29..ff50f1f 100644 --- a/src/lib/components/articles/index.svelte +++ b/src/lib/components/articles/index.svelte @@ -0,0 +1,105 @@ + + +
+

Favorite Articles

+
+ {#each articles as article} + + {/each} +
+
+ {`${totalArticles} more articles`} + + + +
+
+ + + \ No newline at end of file diff --git a/src/lib/components/bandcamp/index.svelte b/src/lib/components/bandcamp/index.svelte new file mode 100644 index 0000000..37921e7 --- /dev/null +++ b/src/lib/components/bandcamp/index.svelte @@ -0,0 +1,90 @@ + + +
+

Currently listening to:

+
+ {#each displayAlbums as album} +
+
+ + {`Album + +
+ +

{album.title.length > 20 ? `${album.title.slice(0, 20)}...` : album.title}

+

by {album.artist}

+
+
+ {/each} +
+
+ + \ No newline at end of file diff --git a/src/lib/types/album.ts b/src/lib/types/album.ts new file mode 100644 index 0000000..b0e2c03 --- /dev/null +++ b/src/lib/types/album.ts @@ -0,0 +1,6 @@ +export type Album = { + url: string; + artwork: string; + title: string; + artist: string; +}; diff --git a/src/lib/util/fetchBandcampAlbums.ts b/src/lib/util/fetchBandcampAlbums.ts new file mode 100644 index 0000000..3578e84 --- /dev/null +++ b/src/lib/util/fetchBandcampAlbums.ts @@ -0,0 +1,40 @@ +// import * as htmlparser2 from 'htmlparser2'; +import scrapeIt from 'scrape-it'; +import type { Album } from '../types/album'; + +export async function fetchBandcampAlbums() { + try { + const { data } = await scrapeIt('https://bandcamp.com/royvalentine', { + collectionItems: { + listItem: '.collection-item-container', + data: { + url: { + selector: '.collection-title-details > a.item-link', + attr: 'href' + }, + artwork: { + selector: 'div.collection-item-art-container a img', + attr: 'src' + }, + title: { + selector: 'span.item-link-alt > div.collection-item-title' + }, + artist: { + selector: 'span.item-link-alt > div.collection-item-artist' + } + } + } + }); + + const albums: Album[] = data?.collectionItems || []; + console.log(`Albums ${JSON.stringify(albums)}`); + + if (albums && albums?.length > 0) { + return albums; + } else { + return []; + } + } catch (error) { + console.log(error); + } +} diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts new file mode 100644 index 0000000..335f2d9 --- /dev/null +++ b/src/routes/+page.server.ts @@ -0,0 +1,16 @@ +import type { PageServerLoad } from './lib/$types'; +import { PAGE_SIZE } from '$env/static/private'; +import { fetchBandcampAlbums } from '$root/lib/util/fetchBandcampAlbums'; + +export const load: PageServerLoad = async ({ fetch, setHeaders }) => { + const albums = async () => await fetchBandcampAlbums(); + const articles = async () => await fetch(`/api/articles?page=1&limit=3`); + + setHeaders({ + 'cache-control': 'max-age=43200' + }); + return { + albums: albums(), + articlesData: (await articles()).json() + }; +}; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 3c58e7f..0c51bc9 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,21 @@ - + + Portfolio | Bradley Shellnut +

Portfolio!

diff --git a/src/routes/portfolio/+page.ts b/src/routes/portfolio/+page.ts new file mode 100644 index 0000000..189f71e --- /dev/null +++ b/src/routes/portfolio/+page.ts @@ -0,0 +1 @@ +export const prerender = true; diff --git a/src/routes/privacy/+page.ts b/src/routes/privacy/+page.ts new file mode 100644 index 0000000..189f71e --- /dev/null +++ b/src/routes/privacy/+page.ts @@ -0,0 +1 @@ +export const prerender = true; diff --git a/src/routes/uses/+page.svelte b/src/routes/uses/+page.svelte index 6210e82..98d4f83 100644 --- a/src/routes/uses/+page.svelte +++ b/src/routes/uses/+page.svelte @@ -1,5 +1,5 @@