Skip to content

Commit d8e92e0

Browse files
authored
feat: migrate from JSON files to PocketBase public API (#510)
* feat: migrate from JSON files to PocketBase public API - Remove all community JSON files from json/ folder (folder kept for user scripts) - Add pocketbase npm package - Add pbService.ts: PocketBase singleton client (unauthenticated) - Add pbScripts.ts: PocketBase queries mirroring the website's API - Update localScripts.ts: use PocketBase as primary source, local JSON as fallback - Rewrite scripts.ts router: all data fetching via PocketBase - Update scriptDownloader.js: derive script paths by convention (type+slug) instead of relying on explicit JSON paths - Update autoSyncService.js: fetch scripts from PocketBase instead of JSON files - Update env.js: add PB_URL, remove JSON_FOLDER requirement - Update .env.example: document new PB_URL variable * fix: correct PocketBase URL to db.community-scripts.org * fix: downgrade @vitejs/plugin-react to ^5 (compatible with vitest@4/vite@6), add .npmrc * fix: resolve all npm audit vulnerabilities via overrides - @hono/node-server: >=1.19.10 (authorization bypass fix) - lodash: ^4.17.23 (prototype pollution fix) All vulns were transitive deps of prisma CLI internals (@prisma/dev) * fix: remove .js extensions from TS imports for webpack compatibility * fix: remove 'source' from ScriptCard literal, fix pbScripts import extension * fix: restore repository_url as optional in ScriptCard, remove dead repo filters * fix: resolve all remaining build errors - resyncScripts: add error field to return type - ScriptsGrid.tsx: remove 'source' from ScriptCard literal - autoSyncService.js: add JSDoc types for implicit any params - githubJsonService.ts: use process.env.JSON_FOLDER directly - localScripts.ts: fix PB->Script mapping (interface_port, default_credentials, date_created, logo as null); add website field to getScriptCards() * fix: use dbUrl fallback for Prisma adapter and align default DB path with prisma.config.ts - db.ts / db.js: use dbUrl variable (with fallback to pve-scripts.db) instead of process.env.DATABASE_URL! directly, prevents crash when DATABASE_URL is not set in environment - autoSyncService.js: suppress ENOENT error log in loadSettings when .env file does not exist (return defaults silently instead of printing error) * fix: align .env.example DATABASE_URL db filename with prisma.config.ts default
1 parent f396e38 commit d8e92e0

422 files changed

Lines changed: 1779 additions & 19637 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# When adding additional environment variables, the schema in "/src/env.js"
22
# should be updated accordingly.
33

4+
# PocketBase - public API for script metadata (mirrors the community website)
5+
PB_URL="https://db.community-scripts.org"
6+
7+
# Repository - used for downloading actual .sh script files
48
REPO_URL="https://github.com/community-scripts/ProxmoxVE"
59
REPO_BRANCH="main"
610
SCRIPTS_DIRECTORY="scripts"
711
ALLOWED_SCRIPT_EXTENSIONS=".sh"
812

9-
CT_SCRIPT_FOLDER="ct"
10-
INSTALL_SCRIPT_FOLDER="install"
11-
JSON_FOLDER="frontend/public/json"
12-
1313
# Security
1414
MAX_SCRIPT_EXECUTION_TIME="900000"
1515
ALLOWED_SCRIPT_PATHS="scripts/"
@@ -31,7 +31,7 @@ AUTH_PASSWORD_HASH=
3131
AUTH_ENABLED=false
3232
AUTH_SETUP_COMPLETED=false
3333
JWT_SECRET=
34-
DATABASE_URL="file:/opt/ProxmoxVE-Local/data/settings.db"
34+
DATABASE_URL="file:/opt/ProxmoxVE-Local/data/pve-scripts.db"
3535
AUTO_SYNC_ENABLED=false
3636
SYNC_INTERVAL_TYPE=
3737
SYNC_INTERVAL_PREDEFINED=

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

json/2fauth.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

json/actualbudget.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

json/add-iptag.json

Lines changed: 0 additions & 52 deletions
This file was deleted.

json/add-netbird-lxc.json

Lines changed: 0 additions & 48 deletions
This file was deleted.

json/add-tailscale-lxc.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

json/adguard.json

Lines changed: 0 additions & 51 deletions
This file was deleted.

json/adventurelog.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

json/agentdvr.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)