soup-bowl / localib

Keeps your Discogs library offline and searchable.
https://localib.app
MIT License
1 stars 0 forks source link
discogs-client pwa

Localib

CodeFactor

A mobile PWA designed to retain your Discogs library offline, so you can check your library while collecting without worrying about mobile reception.

[!IMPORTANT]
This application is in alpha - Expect bugs, reports welcome but PRs will not be accepted at this time.

Installing the PWA

Please see the Mozilla documentation, which covers installing PWAs on all platforms.

Usage

This application currently uses your Personal Access Token, until OAuth is built in. You can grab your token from the Discogs Developer Settings.

You can access settings by going to Profile, then Settings (top-right cog), and putting your username and token in the relevant fields.

For the security-concious: Your details are only used for Discogs API communications. You can verify this by looking at the API file.

Scraper

The project also contains a Discogs image scraper, built in .NET. This is designed to queue up IDs, then grab images from the Discogs API in a slow enough manner that it doesn't hit the rate limiter. This uses a MySQL database to manage state.

Configuration is via appsettings.json or environment variables:

Variable Description
ConnectionStrings__DefaultConnection Connection to a MySQL database, like Server=localhost;Database=discoarchive;User=root;Password=password;
PathSettings__ImagePath Path where the Worker stores to, and the API serves images from.
Discogs__ConsumerKey Consumer Key from Discogs Developer Application.
Discogs__ConsumerSecret Consumer Secret from Discogs Developer Application.

Environment only:

Variable Description
CORS_ALLOWED_ORIGINS CORS restriction policy, optional.

Example:

docker run --rm \
  --name Localib \
  -e ConnectionStrings__DefaultConnection="Server=localhost;Database=disc;User=root;Password=password;" \
  -e PathSettings__ImagePath=/Images \
  -e Discogs__ConsumerKey=somekeyvalue \
  -e Discogs__ConsumerSecret=somekeyvalue \
  -v "$(pwd)/Images:/Images" \
  -p 8080:8080 \
  ghcr.io/soup-bowl/netscrape:edge

Testing Offline Capabilities

If you want to test the PWA functionality locally, you can add the following to the VitePWA() segment in vite.config.ts:

devOptions: { enabled: true },

Logo

The temporary logo utilises the album-collection icon from Free icons.