Skip to content
项目

关于

Self-hosted library for PS4/PS5 FPKG games with direct install to consoles running PKG Manager

游戏与模拟器

这些数字如何统计

可以做什么

  • Library grid with square cover art, search, PS4/PS5 filter and sorting.
  • Titles group their base package, updates and DLC. Open one to see its metadata and every package available for it.
  • Any number of consoles, registered by IP address. Each shows whether PKG Manager answers, its version and free space on internal, M.2 and USB extended storage.
  • Install queue per console with live progress, speed, remaining time, cancel and retry. Consoles install in parallel; packages for one console run one after another, and a base is always sent before its own update or DLC.

实测星标增长

24小时
正在收集历史
7天
正在收集历史
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

PKG Shelf

A self-hosted library for PS4 and PS5 games in FPKG format. Point it at the folders that hold your .pkg files, register your consoles by IP address, and install any game, update or DLC to a console from the browser.

PKG Shelf is built on PKG Manager by itsPLK:

  • Metadata is read with PKG Manager's own parser (pkg_parser.c, compiled to WebAssembly), so titles, versions, package types and icons match what PKG Manager shows.
  • Installs use PKG Manager's Direct Install method. The package is streamed from the server to the console over the network; nothing is copied to USB and the console needs no extra storage for a staging copy.
  • The interface follows PKG Manager's design, with a dot-matrix layer on top.
Library
Library
Title, metadata and packages
Title
Installation progress and queue
Installs
Consoles
Consoles

Every page and state is in docs/screenshots.

Features

  • Library grid with square cover art, search, PS4/PS5 filter and sorting.
  • Titles group their base package, updates and DLC. Open one to see its metadata and every package available for it.
  • Any number of consoles, registered by IP address. Each shows whether PKG Manager answers, its version and free space on internal, M.2 and USB extended storage.
  • Per-console state: installed badges, "new update" and "new DLC" markers, and the reason when something cannot be installed (base missing, same or newer version installed, ...).
  • Install queue per console with live progress, speed, remaining time, cancel and retry. Consoles install in parallel; packages for one console run one after another, and a base is always sent before its own update or DLC.
  • Installs run on the server. Close the browser and they carry on.
  • Download any package file (base, update, DLC) through the browser from its title page, under its own name. Downloads can be paused and resumed (HTTP byte ranges).
  • Uninstall a game from a console (with its update and DLC) from its title page. See docs/uninstall.md.
  • Trophy collection: every console user's PS5 trophy lists and progress, read from the console's own trophy files over FTP and kept on the server. Syncs on its own every 15 minutes by default, when a console comes online and when you open a trophy page. See docs/trophies.md.
  • How long to beat: Main Story, Main + Extras and Completionist times from HowLongToBeat on every title page. Each game on the shelf is looked up once in the background and kept on the server; when the match is wrong, pick the right game by hand. Guests only see the times. Can be turned off in Settings. See docs/hltb.md.
  • Optional password: a login screen on new browsers and devices, and an optional guest password that only allows browsing and downloads. See Password.
  • Works on phones.

Install

Windows PKG-Shelf-Setup-<version>.exe: the desktop app, installed for your user
Linux PKG-Shelf-<version>-x86_64.AppImage: the desktop app
Docker ghcr.io/heydemoura/pkg-shelf (linux/amd64, linux/arm64): the server

The desktop app (Electron) opens PKG Shelf in a window of its own, with the server inside; phones and other computers can still open it in a browser while it runs. Downloads are on the Releases page; how to set each one up, where they keep their files and how to update them: docs/install.md. To run PKG Shelf from a checkout instead, see Quick start.

Requirements

  • Node.js 22.12 or newer on the machine that holds the packages, when running from a checkout (the desktop apps and the Docker image bring their own). No database, no native modules.
  • A PS5 running PKG Manager 1.5 or newer. PS4 packages install on a PS5 through PKG Manager as well; the PS4 console itself is not supported by PKG Manager.
  • The server and the consoles on the same network. The server opens connections to the console (ports 8844 and 18842); the console never connects back.
  • For trophies only: ftpsrv running on the console (port 2121 by default; set per console). It is only read from.
  • For uninstalling only: the console's ELF loader (elfldr, port 9021 by default; set per console). PKG Shelf sends it a small payload of its own.

Quick start

git clone https://github.com/heydemoura/pkg-shelf.git && cd pkg-shelf
npm install
npm run build        # builds the web interface into web/dist
npm start -- --library /path/to/your/pkgs

Open http://<server>:8833. Then:

  1. Settings: add more library folders if you need to. Sub-folders are scanned.
  2. Consoles: start PKG Manager on the PS5, choose Add console and enter its IP address.
  3. Library: open a title and press Install.

Options

Flag Environment Default
--host PKGSHELF_HOST 0.0.0.0 Address to listen on
--port PKGSHELF_PORT 8833 Port to listen on
--data PKGSHELF_DATA ./data Settings, catalogue cache, icons, install history
--library PKGSHELF_LIBRARY Library folder added on first start (repeatable)
--clear-password Remove the password (if you forgot it) and exit
--trust-proxy PKGSHELF_TRUST_PROXY Address of a reverse proxy in front of PKG Shelf (repeatable; commas in the variable). Wrong passwords are then counted per visitor
PKGSHELF_HLTB_URL https://howlongtobeat.com Where game lengths are looked up

Password

PKG Shelf is open to whoever can reach it, unless you set a password in Settings → Password. Then every new browser or device shows a login screen first, and the API refuses anything without a session (401). The page's own files (scripts, icons, manifest) stay public; they hold no data.

  • A session lasts 180 days and is renewed each time the app opens. The installed phone app stays signed in.
  • Changing or removing the password needs the current one, and signs every other browser out at once. Removing it also removes the guest password.
  • After five wrong passwords from one address, each further try waits longer (2 s, 4 s, … up to 5 minutes).
  • The password is stored as an scrypt hash in <data>/auth.json, readable only by PKG Shelf's user.
  • Forgot it? Stop PKG Shelf, run it once with --clear-password (and the same --data), then start it again. This clears the guest password too.

Guest access

With your password set, Settings → Guest access adds a second password for others. Guests sign in on the same login screen; the password they type decides who they are.

  • Guests can browse the library and download packages. They don't see consoles, what is installed on them, installs, uninstalls, trophies or settings, and can't change anything.
  • The server enforces it: a guest session reaches only the library, its icons, package downloads and the library's live updates. Every other API call answers 403, and the live event stream carries nothing about consoles.
  • Setting, changing or removing the guest password needs your own password. Changing or removing it signs guests out; your sessions stay. Changing yours signs other admins out, not guests.
  • The guest password has to differ from yours.

Running as a service

# /etc/systemd/system/pkg-shelf.service
[Unit]
Description=PKG Shelf
After=network-online.target

[Service]
User=pkgshelf
WorkingDirectory=/opt/pkg-shelf
ExecStart=/usr/bin/node server/index.js --data /var/lib/pkg-shelf
Restart=on-failure

[Install]
WantedBy=multi-user.target

The service user needs read access to the library folders and write access to the data folder. Package files are only read.

Install it as an app (phones)

PKG Shelf is a PWA: it can be installed to a phone's home screen and opens in its own window. Settings → App explains how for the current browser, or shows an install button.

  • Android (Chrome, Edge, Samsung Internet): browsers only install apps from a secure https:// address. Put PKG Shelf behind a reverse proxy with a certificate (see below). Then use the Install button, or the browser menu's Install app.
  • iPhone and iPad (Safari): Share → Add to Home Screen. This also works from a plain http:// address, without the offline page.

When the server can't be reached (away from home), the installed app still opens. It says so and keeps retrying.

Without a password, keep the proxy route inside your network. With Traefik and its file provider, for example (use your own entry point and certificate resolver):

http:
  routers:
    pkgshelf:
      rule: Host(`pkgshelf.example.home`)
      entryPoints: [websecure]
      middlewares: [lan-only]
      service: pkgshelf
      tls:
        certResolver: letsencrypt
  middlewares:
    lan-only:
      ipAllowList:
        sourceRange: [192.168.1.0/24]
  services:
    pkgshelf:
      loadBalancer:
        servers:
          - url: http://192.168.1.20:8833

PKG Shelf needs little else behind a proxy. It compares a request's Origin with the Host header the proxy passes on, and the live updates are plain server-sent events.

To reach PKG Shelf from outside your network, set a password first (give others the guest password), then drop the lan-only middleware. Also start PKG Shelf with --trust-proxy <proxy address>. Otherwise every visitor arrives from the proxy's address, and a stranger guessing passwords would make everyone wait. With it, each visitor's wrong passwords count only against that visitor (the last X-Forwarded-For entry, which the proxy adds).

How installs work

PKG Shelf does what PKG Manager's own web page does when you drop a file on Direct Install, except that the file comes from the server's disk:

  1. POST /api/upload/check asks the console whether the package can be installed.
  2. POST /api/queue adds a job to the console's install queue. A heartbeat keeps it alive.
  3. When the console selects the job, POST /api/upload/init opens a live session and the package is pushed in 1 MiB segments over a WebSocket on port 18842. The console keeps a small RAM window of the file and asks for the segments its installer needs next.
  4. POST /api/queue/attach starts the PS5 system installer once the header has arrived.
  5. The connection stays open until the console reports the job as finished.

The segment scheduler (server/installs/segmentSender.js) is PKG Manager's file, unmodified, and passes its upstream tests here.

The upload socket (server/installs/wsclient.js) is written for this one job. It hands each segment to the network as it comes off the disk, with no per-byte work, and it makes sure the console's small replies are acknowledged at once instead of after the usual TCP delay. Measured against PKG Manager's own server code, built and run on one machine with a 1 GiB package:

Upload socket First pass Segments the console asked for again Total
Node's built-in WebSocket 6.1 s about 50 s 56 s
PKG Shelf's 2.9 s about 5 s 8 s

The second column is the path the console uses after dropping data from its RAM window: it asks for one segment at a time, so every round trip counts. On a real network the link speed still sets the pace of the first pass.

If PKG Shelf stops during an install, the console cancels that install on its own after a few seconds; the job shows as interrupted and can be retried. Queued jobs start again on the next launch.

The metadata parser

server/parser/vendor/pkg-manager/ holds unmodified copies of the parser sources from PKG Manager at a pinned commit. server/parser/build.sh compiles them to server/parser/pkg_parser.wasm, which is committed, so running PKG Shelf needs no compiler. The module runs in a worker thread and can read only the one file it was asked to parse.

To rebuild after updating the vendored sources (needs clang and wasm-ld):

npm run build:parser
npm test

Limits

  • Without a password, anyone who can reach the port can browse the library and start installs, the same trust model as PKG Manager itself. Set one (see Password) before letting it out of your home network, and use --trust-proxy behind a proxy. Requests from other web origins are refused.
  • Multi-part packages (.pkg.partN files made with PKG Manager's pkg_split.py for disc swapping) are not listed. Install those from USB or disc with PKG Manager.
  • One install at a time per console. That is how the console's installer works.
  • PS4 trophies can't be read: the console keeps them in an encrypted image. PS4 games are matched to their trophy sets, but their lists and progress need code on the console.
  • HowLongToBeat has no public API. PKG Shelf uses the one its website uses, which can change without notice; game lengths then stop updating (what was looked up stays) until PKG Shelf is updated.

Development

npm test             # parser parity, sender, upload socket, mock console, end-to-end installs
npm run dev          # server with auto-restart
npm run dev:web      # Vite dev server for the interface, proxies /api to :8833
npm run demo         # demo library + simulated consoles, no PS5 needed
npm run screenshots  # regenerates docs/screenshots from the demo (needs a Chromium)
npm run desktop      # the desktop app (Electron) from the checkout; needs npm ci --prefix desktop
node desktop/build.mjs     # the desktop app for this system, into dist/ (--windows, --linux)

How the desktop apps and the Docker image are built and released: docs/install.md.

  • tools/mock-console.mjs simulates the parts of PKG Manager that Direct Install touches: the install queue, the live upload session with its RAM window, and the read pattern of the PS5 system installer. It can hash everything it reads, which is how the end-to-end tests prove that packages arrive intact.

  • tools/make-fixtures.mjs writes fictional packages that the real parser accepts. They are sparse by default, so a "41 GB" game takes a few hundred KiB on disk.

  • test/upstream-compat.test.mjs goes one step further: it compiles the console-side sources from a PKG Manager checkout (ws_upload.c, ws_stream.c, stream_server.c and upstream's PS5 installer simulator) and lets PKG Shelf's uploader push packages into them. It needs a C compiler and the checkout, so it runs on request:

    PKG_MANAGER_SRC=/path/to/ps5-pkg-manager npm run test:upstream
    

Credits and license

PKG Shelf is free software under the GNU General Public License v3.0 or later.

  • PKG Manager by itsPLK (GPL-3.0): metadata parser, direct install protocol and client logic, and the visual design this interface builds on.
  • Typefaces: Doto, Inter and JetBrains Mono, all under the SIL Open Font License.

PKG Shelf does not include, download or decrypt any game content. Use it with packages you have the right to install.

探索相关项目

加载中…