openvibers/openvibe.tools Commits
Fix stale comments for removed process routes and RIDB demo key (#6)
Changes
@@@ -9,7 +9,7 @@// app.set('trust proxy', TRUST_PROXY); // ./ip.js: one loopback hop// app.use(guard.identify); // req.user (Network sign-in, aud checked)// app.use('/api/', legacyLimiter, guard.apiQuota); // every /api/ request (tools-api)--// app.post('/api/process', guard.toolQuota(hostTool), upload, guard.admitUpload(toolOf), guard.heavy(), …)++// app.post('/api/v1/tools/:id/run', guard.toolQuota(hostTool), upload, guard.admitUpload(toolOf), guard.heavy(), …)//// What it does:// callers one resolver (./caller.js): anonymous (address, IPv6 /64) < session < user < service;@@@ -46,7 +46,7 @@ const QUOTAS = {'tools-probe': {anonymous: q(30, 15, 600), session: q(45, 25, 1000), user: q(120, 60, 5000), service: q(600, 300, 50000), sandbox: q(15, 10, 200),},-- // Uploads processed by sharp, ffmpeg, pdf-lib, qpdf, poppler (sync /api/process and job submits).++ // Uploads processed by sharp, ffmpeg, pdf-lib, qpdf, poppler (inline runs and job submits).'tools-job': {anonymous: q(60, 30, 1500), session: q(90, 45, 3000), user: q(240, 120, 20000), service: q(1200, 600, 200000), sandbox: q(30, 15, 300),},@@@ -81,7 +81,7 @@ function envInt(name, fallback, env = process.env) {/** The host-wide bounds, read from the environment at call time (tests set it per process). */function bounds(env = process.env) {return {-- // Synchronous heavy calls (img, audio, docs /api/process…) running at once per satellite, and++ // Synchronous heavy calls (img, audio, docs run API, /api/info…) running at once per satellite, and// how many may wait for a slot, and for how long, before 503 tools.busy.sync: {concurrency: Math.max(1, envInt('TOOLS_SYNC_CONCURRENCY', 2, env)),@@@ -1,7 +1,7 @@'use strict';// ═══════════════════════════════════════════════════════════════--// Audio.OpenVibe — one audio operation, shared by the synchronous endpoint (/api/process) and the++// Audio.OpenVibe — one audio operation, shared by the run API's inline path and the// audio.process job (defineJobs below).//// Jobs can be cancelled and report progress although the tools build their own ffmpeg commands:@@@ -1,7 +1,7 @@'use strict';// Merge (merge.openvibe.tools): the host pointed at an operation that did not exist. Now 2–5 files of// any format are re-encoded to one rate and stereo and joined in order, as a job (files in "files")--// and on /api/process/multi; wrong file counts are refused before anything runs.++// and inline; wrong file counts are refused before anything runs.const assert = require('assert');const fs = require('fs');const os = require('os');@@@ -6,7 +6,7 @@// Every PDF tool is its host's operation (domain-map.js) run as a docs.process job; pdf2jpg's host// default (JPG) is its preset. Protect and Unlock need qpdf, PDF to image needs poppler's pdftoppm// and pdfinfo (`requires`): while one is missing on the host the satellite lists the tool as--// unavailable, as its page and /api/process already say. Pure data: nothing here loads pdf-lib.++// unavailable, as its page already says. Pure data: nothing here loads pdf-lib.// apps/gateway/test/descriptors.test.js holds it to tools/index.js, process.js and config.js.// ═══════════════════════════════════════════════════════════════@@@ -2,7 +2,7 @@// ═══════════════════════════════════════════════════════════════// Docs.OpenVibe — one document operation, shared by the synchronous endpoints--// (/api/process, /api/process/multi, /api/info) and the docs.process job (see defineJobs). Both run++// (the run API's inline runs, /api/info) and the docs.process job (see defineJobs). Both run// it through runTool(): pdf-lib work goes to the worker pool (./worker.js), so the two share one// concurrency cap, one heap limit and terminate-on-timeout or cancel.// ═══════════════════════════════════════════════════════════════@@@ -2,7 +2,7 @@// ═══════════════════════════════════════════════════════════════// Img.OpenVibe — one image operation, shared by the synchronous endpoints--// (/api/process, /api/process/direct) and the img.process job (defineJobs). Both run it through++// (the run API's inline runs) and the img.process job (defineJobs). Both run it through// runProcess(): the worker pool (./worker.js), so they share one concurrency cap, one heap limit and// terminate-on-timeout or cancel.// ═══════════════════════════════════════════════════════════════@@@ -3,8 +3,8 @@* Free federal recreation data: campgrounds, facilities, rec areas.* API Docs: https://ridb.recreation.gov/docs*-- * NOTE: RIDB API requires an API key. We use a demo/public-tier key.-- * Users should register at https://ridb.recreation.gov/ for their own key.++ * NOTE: RIDB requires an API key; the caller passes it in (server/config.js, RIDB_API_KEY).++ * Register at https://ridb.recreation.gov/ for one. Without it RIDB is skipped.*/const axios = require('axios');const { haversine } = require('./utils');
@@ -9,7 +9,7 @@
@@ -9,7 +9,7 @@
// app.set('trust proxy', TRUST_PROXY); // ./ip.js: one loopback hop
// app.set('trust proxy', TRUST_PROXY); // ./ip.js: one loopback hop
// app.use(guard.identify); // req.user (Network sign-in, aud checked)
// app.use(guard.identify); // req.user (Network sign-in, aud checked)
// app.use('/api/', legacyLimiter, guard.apiQuota); // every /api/ request (tools-api)
// app.use('/api/', legacyLimiter, guard.apiQuota); // every /api/ request (tools-api)
-// app.post('/api/process', guard.toolQuota(hostTool), upload, guard.admitUpload(toolOf), guard.heavy(), …)
+// app.post('/api/v1/tools/:id/run', guard.toolQuota(hostTool), upload, guard.admitUpload(toolOf), guard.heavy(), …)
//
//
// What it does:
// What it does:
// callers one resolver (./caller.js): anonymous (address, IPv6 /64) < session < user < service;
// callers one resolver (./caller.js): anonymous (address, IPv6 /64) < session < user < service;
@@ -46,7 +46,7 @@ const QUOTAS = {
@@ -46,7 +46,7 @@ const QUOTAS = {
'tools-probe': {
'tools-probe': {
anonymous: q(30, 15, 600), session: q(45, 25, 1000), user: q(120, 60, 5000), service: q(600, 300, 50000), sandbox: q(15, 10, 200),
anonymous: q(30, 15, 600), session: q(45, 25, 1000), user: q(120, 60, 5000), service: q(600, 300, 50000), sandbox: q(15, 10, 200),
},
},
- // Uploads processed by sharp, ffmpeg, pdf-lib, qpdf, poppler (sync /api/process and job submits).
+ // Uploads processed by sharp, ffmpeg, pdf-lib, qpdf, poppler (inline runs and job submits).
'tools-job': {
'tools-job': {
anonymous: q(60, 30, 1500), session: q(90, 45, 3000), user: q(240, 120, 20000), service: q(1200, 600, 200000), sandbox: q(30, 15, 300),
anonymous: q(60, 30, 1500), session: q(90, 45, 3000), user: q(240, 120, 20000), service: q(1200, 600, 200000), sandbox: q(30, 15, 300),
},
},
@@ -81,7 +81,7 @@ function envInt(name, fallback, env = process.env) {
@@ -81,7 +81,7 @@ function envInt(name, fallback, env = process.env) {
/** The host-wide bounds, read from the environment at call time (tests set it per process). */
/** The host-wide bounds, read from the environment at call time (tests set it per process). */
function bounds(env = process.env) {
function bounds(env = process.env) {
return {
return {
- // Synchronous heavy calls (img, audio, docs /api/process…) running at once per satellite, and
+ // Synchronous heavy calls (img, audio, docs run API, /api/info…) running at once per satellite, and
// how many may wait for a slot, and for how long, before 503 tools.busy.
// how many may wait for a slot, and for how long, before 503 tools.busy.
sync: {
sync: {
concurrency: Math.max(1, envInt('TOOLS_SYNC_CONCURRENCY', 2, env)),
concurrency: Math.max(1, envInt('TOOLS_SYNC_CONCURRENCY', 2, env)),
@@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
'use strict';
'use strict';
// ═══════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════
-// Audio.OpenVibe — one audio operation, shared by the synchronous endpoint (/api/process) and the
+// Audio.OpenVibe — one audio operation, shared by the run API's inline path and the
// audio.process job (defineJobs below).
// audio.process job (defineJobs below).
//
//
// Jobs can be cancelled and report progress although the tools build their own ffmpeg commands:
// Jobs can be cancelled and report progress although the tools build their own ffmpeg commands:
@@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
'use strict';
'use strict';
// Merge (merge.openvibe.tools): the host pointed at an operation that did not exist. Now 2–5 files of
// Merge (merge.openvibe.tools): the host pointed at an operation that did not exist. Now 2–5 files of
// any format are re-encoded to one rate and stereo and joined in order, as a job (files in "files")
// any format are re-encoded to one rate and stereo and joined in order, as a job (files in "files")
-// and on /api/process/multi; wrong file counts are refused before anything runs.
+// and inline; wrong file counts are refused before anything runs.
const assert = require('assert');
const assert = require('assert');
const fs = require('fs');
const fs = require('fs');
const os = require('os');
const os = require('os');
@@ -6,7 +6,7 @@
@@ -6,7 +6,7 @@
// Every PDF tool is its host's operation (domain-map.js) run as a docs.process job; pdf2jpg's host
// Every PDF tool is its host's operation (domain-map.js) run as a docs.process job; pdf2jpg's host
// default (JPG) is its preset. Protect and Unlock need qpdf, PDF to image needs poppler's pdftoppm
// default (JPG) is its preset. Protect and Unlock need qpdf, PDF to image needs poppler's pdftoppm
// and pdfinfo (`requires`): while one is missing on the host the satellite lists the tool as
// and pdfinfo (`requires`): while one is missing on the host the satellite lists the tool as
-// unavailable, as its page and /api/process already say. Pure data: nothing here loads pdf-lib.
+// unavailable, as its page already says. Pure data: nothing here loads pdf-lib.
// apps/gateway/test/descriptors.test.js holds it to tools/index.js, process.js and config.js.
// apps/gateway/test/descriptors.test.js holds it to tools/index.js, process.js and config.js.
// ═══════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════
@@ -2,7 +2,7 @@
@@ -2,7 +2,7 @@
// ═══════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════
// Docs.OpenVibe — one document operation, shared by the synchronous endpoints
// Docs.OpenVibe — one document operation, shared by the synchronous endpoints
-// (/api/process, /api/process/multi, /api/info) and the docs.process job (see defineJobs). Both run
+// (the run API's inline runs, /api/info) and the docs.process job (see defineJobs). Both run
// it through runTool(): pdf-lib work goes to the worker pool (./worker.js), so the two share one
// it through runTool(): pdf-lib work goes to the worker pool (./worker.js), so the two share one
// concurrency cap, one heap limit and terminate-on-timeout or cancel.
// concurrency cap, one heap limit and terminate-on-timeout or cancel.
// ═══════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════
@@ -2,7 +2,7 @@
@@ -2,7 +2,7 @@
// ═══════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════
// Img.OpenVibe — one image operation, shared by the synchronous endpoints
// Img.OpenVibe — one image operation, shared by the synchronous endpoints
-// (/api/process, /api/process/direct) and the img.process job (defineJobs). Both run it through
+// (the run API's inline runs) and the img.process job (defineJobs). Both run it through
// runProcess(): the worker pool (./worker.js), so they share one concurrency cap, one heap limit and
// runProcess(): the worker pool (./worker.js), so they share one concurrency cap, one heap limit and
// terminate-on-timeout or cancel.
// terminate-on-timeout or cancel.
// ═══════════════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════════════
@@ -3,8 +3,8 @@
@@ -3,8 +3,8 @@
* Free federal recreation data: campgrounds, facilities, rec areas.
* Free federal recreation data: campgrounds, facilities, rec areas.
* API Docs: https://ridb.recreation.gov/docs
* API Docs: https://ridb.recreation.gov/docs
*
*
- * NOTE: RIDB API requires an API key. We use a demo/public-tier key.
- * Users should register at https://ridb.recreation.gov/ for their own key.
+ * NOTE: RIDB requires an API key; the caller passes it in (server/config.js, RIDB_API_KEY).
+ * Register at https://ridb.recreation.gov/ for one. Without it RIDB is skipped.
*/
*/
const axios = require('axios');
const axios = require('axios');
const { haversine } = require('./utils');
const { haversine } = require('./utils');