BSData / phalanx

Project Phalanx is a roster editor handling BattleScribe datafiles

Home Page:https://www.phalanx.tools/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement data acquisition

amis92 opened this issue · comments

Enable browsing BSData Gallery and downloading files from there.

For MVP here, we're aiming at:

  • downloading the Gallery JSON index: bsdata.catpkg-gallery.json form https://github.com/BSData/gallery/releases/tag/index-v1
  • showing a game system (repository) selection UI for a new roster - keep ability to select Sample Dataset
  • try to match the gamesystem ID with Gallery JSON's item (repository) when opening a roster.

BSData Gallery is a nuget.org/npm.org like Registry/Gallery that indexes gamesystems. It provides a static index asset.

Datafiles are available from GitHub data repositories via GitHub release assets. Sadly, those assets do not have CORS headers set, so that downloading them in a browser won't work.

Solutions I can see:

  1. Make Gallery "cache" the actual assets in a branch published to GitHub Pages. Content published there is CORS-enabled and can be freely downloaded in a browser.
  2. Create and use our own CORS-proxy. One thing I've researched is a Cloudflare-cors-proxy, using Cloudflare Workers.

Needed functionality:

  • browse list of game systems and repositories (CORS issue)
  • download data files (CORS issue)
  • store/manage metadata in local storage
  • (adv. feature) allow users to sync data across devices

I believe we can use the same proxy that godmode uses: https://cors.isomorphic-git.org/github.com/Bsdata/horus-heresy/info/refs?service=git-upload-pack
As explained by amis, we do not want to use a git proxy since we want to pull individual files from gallery, and the godmod proxy is intended only for "git clone".

Cloudflare proxy is setup at https://phalanx-cors.bsdata.workers.dev

To get a GitHub URL with CORS headers, pass the full GH URL in a search parameter: https://phalanx-cors.bsdata.workers.dev/?https://github.com/thing/you/want

PS It's only enabled for the phalanx.tools origin.